Browse Source

More itembase refactor

combat-2
MagicBot 8 months ago
parent
commit
61bb7be6b1
  1. 12
      src/engine/gameManager/GroupManager.java

12
src/engine/gameManager/GroupManager.java

@ -303,12 +303,13 @@ public enum GroupManager {
} }
public static boolean goldSplit(PlayerCharacter pc, Item item, ClientConnection origin, AbstractWorldObject tar) { public static boolean goldSplit(PlayerCharacter pc, Item item, ClientConnection origin, AbstractWorldObject tar) {
if (item == null || pc == null || tar == null || item.getItemBase() == null) {
if (item == null || pc == null || tar == null) {
Logger.error("null something"); Logger.error("null something");
return false; return false;
} }
if (item.getItemBase().getUUID() != 7) //only split goldItem if (!item.template.item_type.equals(Enum.ItemType.GOLD)) //only split goldItem
return false; return false;
Group group = getGroup(pc); Group group = getGroup(pc);
@ -316,7 +317,6 @@ public enum GroupManager {
if (group == null || !group.getSplitGold()) //make sure player is grouped and split is on if (group == null || !group.getSplitGold()) //make sure player is grouped and split is on
return false; return false;
ArrayList<PlayerCharacter> playersSplit = new ArrayList<>(); ArrayList<PlayerCharacter> playersSplit = new ArrayList<>();
//get group members //get group members
@ -331,8 +331,8 @@ public enum GroupManager {
playersSplit.add(groupMember); playersSplit.add(groupMember);
} }
//make sure more than one group member in loot range
//make sure more then one group member in loot range
int size = playersSplit.size(); int size = playersSplit.size();
if (size < 2) if (size < 2)
@ -358,8 +358,8 @@ public enum GroupManager {
item.setNumOfItems(0); item.setNumOfItems(0);
} else } else
item.setNumOfItems(0); item.setNumOfItems(0);
for (PlayerCharacter splitPlayer : playersSplit) {
for (PlayerCharacter splitPlayer : playersSplit) {
int amt = (group.isGroupLead(splitPlayer)) ? (amount + dif) : amount; int amt = (group.isGroupLead(splitPlayer)) ? (amount + dif) : amount;
if (amt > 0) if (amt > 0)
@ -368,7 +368,6 @@ public enum GroupManager {
for (PlayerCharacter splitPlayer : playersSplit) { for (PlayerCharacter splitPlayer : playersSplit) {
UpdateGoldMsg ugm = new UpdateGoldMsg(splitPlayer); UpdateGoldMsg ugm = new UpdateGoldMsg(splitPlayer);
ugm.configure(); ugm.configure();
@ -380,7 +379,6 @@ public enum GroupManager {
updateTargetGold.configure(); updateTargetGold.configure();
DispatchMessage.dispatchMsgToInterestArea(tar, updateTargetGold, Enum.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false); DispatchMessage.dispatchMsgToInterestArea(tar, updateTargetGold, Enum.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
// //TODO send group split message // //TODO send group split message
String text = "Group Split: " + amount; String text = "Group Split: " + amount;
ChatManager.chatGroupInfo(pc, text); ChatManager.chatGroupInfo(pc, text);

Loading…
Cancel
Save