forked from MagicBane/Server
resource stacking bug
This commit is contained in:
@@ -640,7 +640,6 @@ public class CharacterItemManager {
|
||||
dispatch = Dispatch.borrow(other, utwm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
|
||||
stripTempEnchants(i);
|
||||
this.updateInventory();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1057,7 +1056,6 @@ public class CharacterItemManager {
|
||||
|
||||
calculateWeights();
|
||||
stripTempEnchants(i);
|
||||
this.updateInventory();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1203,7 +1201,6 @@ public class CharacterItemManager {
|
||||
|
||||
calculateWeights();
|
||||
stripTempEnchants(i);
|
||||
this.updateInventory();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1258,40 +1255,10 @@ public class CharacterItemManager {
|
||||
|
||||
return false;
|
||||
}
|
||||
if (i.getItemBase().getType().equals(ItemType.RESOURCE) && this.getOwner().getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
boolean added = false;
|
||||
ArrayList<Item> purge = new ArrayList<>();
|
||||
int count = i.getNumOfItems();
|
||||
for(Item item : this.inventory){
|
||||
if(item.getItemBaseID() == i.getItemBaseID()){
|
||||
purge.add(item);
|
||||
if(count + item.getNumOfItems() <= Warehouse.maxResources.get(i.getItemBaseID())) {
|
||||
count += item.getNumOfItems();
|
||||
added = true;
|
||||
purge.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!added){
|
||||
this.inventory.add(i);
|
||||
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal());
|
||||
|
||||
ItemBase ib = i.getItemBase();
|
||||
if (ib != null)
|
||||
this.inventoryWeight += ib.getWeight();
|
||||
} else{
|
||||
i.setNumOfItems(count);
|
||||
for(Item item : purge){
|
||||
this.removeItemFromInventory(item);
|
||||
}
|
||||
}
|
||||
this.inventory.add(i);
|
||||
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal());
|
||||
this.inventory.add(i);
|
||||
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal());
|
||||
|
||||
ItemBase ib = i.getItemBase();
|
||||
if (ib != null)
|
||||
this.inventoryWeight += ib.getWeight();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2466,7 +2433,6 @@ public class CharacterItemManager {
|
||||
|
||||
calculateWeights();
|
||||
stripTempEnchants(i);
|
||||
this.updateInventory();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user