forked from MagicBane/Server
resource stacking update
This commit is contained in:
@@ -51,7 +51,7 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
int failures = 0;
|
int failures = 0;
|
||||||
int goldAmount = 0;
|
int goldAmount = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 1000; ++i) {
|
for (int i = 0; i < 10000; ++i) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mob.loadInventory();
|
mob.loadInventory();
|
||||||
|
|||||||
@@ -1244,34 +1244,23 @@ public class CharacterItemManager {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.inventory.add(i);
|
|
||||||
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal());
|
|
||||||
|
|
||||||
ItemBase ib = i.getItemBase();
|
|
||||||
if (ib != null)
|
|
||||||
this.inventoryWeight += ib.getWeight();
|
|
||||||
|
|
||||||
if (i.getItemBase().getType().equals(ItemType.RESOURCE) && this.getOwner().getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
if (i.getItemBase().getType().equals(ItemType.RESOURCE) && this.getOwner().getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||||
int count = i.getNumOfItems();
|
for(Item item : this.getInventory()){
|
||||||
ArrayList<Item> purge = new ArrayList<>();
|
if(item.getItemBaseID() == i.getItemBaseID()){
|
||||||
for (Item it : this.getInventory()) {
|
if(item.getNumOfItems() + i.getNumOfItems() <= Warehouse.getMaxResources().get(item.getItemBaseID())) {
|
||||||
if (it.getItemBase().equals(i.getItemBase()) && it.getNumOfItems() + i.getNumOfItems() <= Warehouse.getMaxResources().get(it.getItemBaseID())) {
|
item.setNumOfItems(item.getNumOfItems() + i.getNumOfItems());
|
||||||
purge.add(it);
|
updateInventory();
|
||||||
count += it.getNumOfItems();
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count <= Warehouse.getMaxResources().get(i.getItemBaseID())) {
|
}else {
|
||||||
MobLoot ml = new MobLoot(this.getOwner(), i.getItemBase(), count, false);
|
this.inventory.add(i);
|
||||||
for (Item p : purge) {
|
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal());
|
||||||
this.removeItemFromInventory(p);
|
|
||||||
}
|
|
||||||
this.addItemToInventory(ml.promoteToItem((PlayerCharacter) this.getOwner()), 1);
|
|
||||||
this.updateInventory(ml.promoteToItem((PlayerCharacter) this.getOwner()),true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
ItemBase ib = i.getItemBase();
|
||||||
|
if (ib != null)
|
||||||
|
this.inventoryWeight += ib.getWeight();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user