From 4dc0f52295dae7545475fc2d8302460a30c2fa13 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 3 Mar 2024 15:06:44 -0500 Subject: [PATCH] item_wt refactored to template --- src/engine/devcmd/cmds/InfoCmd.java | 2 +- src/engine/gameManager/BuildingManager.java | 11 +-- src/engine/gameManager/CombatManager.java | 6 +- src/engine/gameManager/LootManager.java | 2 +- src/engine/net/client/ClientMessagePump.java | 30 +++---- .../handlers/ItemProductionMsgHandler.java | 4 +- src/engine/objects/Account.java | 4 +- src/engine/objects/CharacterItemManager.java | 78 ++++++++++--------- src/engine/objects/Corpse.java | 24 +++--- src/engine/objects/ItemBase.java | 7 -- src/engine/objects/ItemFactory.java | 43 ++++------ src/engine/objects/Warehouse.java | 8 +- 12 files changed, 100 insertions(+), 119 deletions(-) diff --git a/src/engine/devcmd/cmds/InfoCmd.java b/src/engine/devcmd/cmds/InfoCmd.java index 956ee270..0416a820 100644 --- a/src/engine/devcmd/cmds/InfoCmd.java +++ b/src/engine/devcmd/cmds/InfoCmd.java @@ -508,7 +508,7 @@ public class InfoCmd extends AbstractDevCmd { ItemBase itemBase = item.getItemBase(); ItemTemplate template = ItemTemplate.itemTemplates.get(item.getTemplsteID()); output += StringUtils.addWS("ItemBase: " + itemBase.getUUID(), 20); - output += "Weight: " + itemBase.getWeight(); + output += "Weight: " + template.item_wt; output += newline; DecimalFormat df = new DecimalFormat("###,###,###,###,##0"); output += StringUtils.addWS("Qty: " diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index 746e8e61..3f15b1b8 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -208,10 +208,9 @@ public enum BuildingManager { ItemBase elanIB = ItemBase.getItemBase(1705032); - if (elanIB == null) - return false; + ItemTemplate template = ItemTemplate.itemTemplates.get(1705032); // Elan Stone - if (!player.getCharItemManager().hasRoomInventory(elanIB.getWeight())) + if (!player.getCharItemManager().hasRoomInventory(template.item_wt)) return false; if (!Item.MakeItemForPlayer(elanIB, player, amount)) @@ -227,7 +226,10 @@ public enum BuildingManager { return false; for (ItemBase resourceBase : ItemBase.getResourceList()) { - if (!player.getCharItemManager().hasRoomInventory(resourceBase.getWeight())) { + + template = ItemTemplate.itemTemplates.get(resourceBase.getUUID()); + + if (!player.getCharItemManager().hasRoomInventory(template.item_wt)) { ChatManager.chatSystemInfo(player, "You can not carry any more of that item."); return false; } @@ -240,7 +242,6 @@ public enum BuildingManager { continue; if (Warehouse.loot(warehouse, player, resourceBase, resourceAmount, true)) { - ItemTemplate template = ItemTemplate.itemTemplates.get(resourceBase.getUUID()); ChatManager.chatInfoInfo(player, "You have looted " + resourceAmount + ' ' + template.item_base_name); } diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index 744f2e4c..1f467487 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -359,7 +359,7 @@ public enum CombatManager { if (wb == null) { if (abstractCharacter.getStamina() < 1) attackFailure = true; - } else if (abstractCharacter.getStamina() < wb.getWeight()) + } else if (abstractCharacter.getStamina() < weapon.template.item_wt) attackFailure = true; //see if attacker is stunned. If so, stop here @@ -514,7 +514,7 @@ public enum CombatManager { if (wb == null) attacker.modifyStamina(-0.5f, attacker, true); else { - float stam = wb.getWeight() / 3; + float stam = weapon.template.item_wt / 3f; stam = (stam < 1) ? 1 : stam; attacker.modifyStamina(-(stam), attacker, true); } @@ -1333,7 +1333,7 @@ public enum CombatManager { if (wb != null) if (wb.isGlass()) //glass used weighted so fast weapons don't break faster - chance = 9000 / wb.getWeight(); + chance = 9000 / weapon.template.item_wt; //test damaging attackers weapon diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index 9cf10cfc..c75c935d 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -426,7 +426,7 @@ public enum LootManager { //early exit if the inventory of the player will not old the item - if (itemMan.hasRoomInventory(winnings.getItemBase().getWeight()) == false) { + if (itemMan.hasRoomInventory(winnings.template.item_wt) == false) { ErrorPopupMsg.sendErrorPopup(playerCharacter, 21); return; } diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index 255284d2..287bd34a 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -370,7 +370,7 @@ public class ClientMessagePump implements NetMsgHandler { } else { - if (!itemManager.hasRoomBank(item.getItemBase().getWeight())) + if (!itemManager.hasRoomBank(item.template.item_wt)) return; if (!itemManager.moveItemToBank(item)) @@ -430,7 +430,7 @@ public class ClientMessagePump implements NetMsgHandler { // Not gold, process update here - if (!itemManager.hasRoomInventory(item.getItemBase().getWeight())) + if (!itemManager.hasRoomInventory(item.template.item_wt)) return; if (itemManager.moveItemToInventory(item) == false) @@ -1224,13 +1224,11 @@ public class ClientMessagePump implements NetMsgHandler { //get item to sell - ItemBase ib = sell.getItemBase(); - - if (ib == null) + if (sell.template == null) return; if (npc.getParentZone() != null && npc.getParentZone().playerCityUUID != 0) - if (!npc.getCharItemManager().hasRoomInventory(ib.getWeight())) { + if (!npc.getCharItemManager().hasRoomInventory(sell.template.item_wt)) { ErrorPopupMsg.sendErrorPopup(player, 21); return; @@ -1390,12 +1388,14 @@ public class ClientMessagePump implements NetMsgHandler { return; for (MobEquipment me : sellInventory) { if (me.getObjectUUID() == msg.getItemID()) { + ItemBase ib = me.getItemBase(); + if (ib == null) return; //test room available for item - if (!itemMan.hasRoomInventory(ib.getWeight())) + if (!itemMan.hasRoomInventory(me.template.item_wt)) return; int cost = me.getMagicValue(); @@ -1407,10 +1407,8 @@ public class ClientMessagePump implements NetMsgHandler { if (profit < 1) profit = 1; - cost *= profit; - if (gold.getNumOfItems() - cost < 0) { //dont' have enough goldItem exit! // chatMan.chatSystemInfo(pc, "" + "You dont have enough gold."); @@ -1453,16 +1451,11 @@ public class ClientMessagePump implements NetMsgHandler { if (buy == null) return; - ItemBase ib = buy.getItemBase(); - - if (ib == null) - return; - if (!npcCim.inventoryContains(buy)) return; //test room available for item - if (!itemMan.hasRoomInventory(ib.getWeight())) + if (!itemMan.hasRoomInventory(buy.template.item_wt)) return; //TODO test cost and subtract goldItem @@ -1524,16 +1517,11 @@ public class ClientMessagePump implements NetMsgHandler { if (buy == null) return; - ItemBase ib = buy.getItemBase(); - - if (ib == null) - return; - if (!npcCim.inventoryContains(buy)) return; //test room available for item - if (!itemMan.hasRoomInventory(ib.getWeight())) + if (!itemMan.hasRoomInventory(buy.template.item_wt)) return; //TODO test cost and subtract goldItem diff --git a/src/engine/net/client/handlers/ItemProductionMsgHandler.java b/src/engine/net/client/handlers/ItemProductionMsgHandler.java index 08f16163..aca20b90 100644 --- a/src/engine/net/client/handlers/ItemProductionMsgHandler.java +++ b/src/engine/net/client/handlers/ItemProductionMsgHandler.java @@ -129,7 +129,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { if (targetItem.getItemBase().getType() == ItemType.GOLD) return; - if (!vendor.getCharItemManager().hasRoomInventory(targetItem.getItemBase().getWeight())) { + if (!vendor.getCharItemManager().hasRoomInventory(targetItem.template.item_wt)) { ErrorPopupMsg.sendErrorPopup(player, 21); return; @@ -407,7 +407,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { if (vendor.getCharItemManager().inventoryContains(targetItem) == false) return; - if (player.getCharItemManager().hasRoomInventory(targetItem.getItemBase().getWeight()) == false) + if (player.getCharItemManager().hasRoomInventory(targetItem.template.item_wt) == false) return; player.getCharItemManager().buyFromNPC(targetItem, vendor); diff --git a/src/engine/objects/Account.java b/src/engine/objects/Account.java index 7beb72b5..cc2cde18 100644 --- a/src/engine/objects/Account.java +++ b/src/engine/objects/Account.java @@ -218,7 +218,7 @@ public class Account extends AbstractGameObject { return; if (item.containerType == Enum.ItemContainerType.INVENTORY && player.getCharItemManager().isVaultOpen()) { - if (!player.getCharItemManager().hasRoomVault(item.getItemBase().getWeight())) { + if (!player.getCharItemManager().hasRoomVault(item.template.item_wt)) { ClientMessagePump.forceTransferFromVaultToInventory(msg, origin, "There is no room in your vault."); return; } @@ -264,7 +264,7 @@ public class Account extends AbstractGameObject { return; if (item.containerType == Enum.ItemContainerType.VAULT && itemManager.isVaultOpen()) { - if (!itemManager.hasRoomInventory(item.getItemBase().getWeight())) { + if (!itemManager.hasRoomInventory(item.template.item_wt)) { ClientMessagePump.forceTransferFromInventoryToVault(msg, origin, "There is no room in your inventory."); return; } diff --git a/src/engine/objects/CharacterItemManager.java b/src/engine/objects/CharacterItemManager.java index 017db1be..a8ef06c7 100644 --- a/src/engine/objects/CharacterItemManager.java +++ b/src/engine/objects/CharacterItemManager.java @@ -90,21 +90,29 @@ public class CharacterItemManager { } public static void takeFromNPC(NPC npc, PlayerCharacter pc, Item take, ClientMessagePump clientMessagePump) { + ItemBase ib = take.getItemBase(); - if (ib == null) + ItemTemplate template = take.template; + + if (template == null) return; + CharacterItemManager itemMan = pc.getCharItemManager(); + if (itemMan == null) return; + CharacterItemManager npcCim = npc.getCharItemManager(); + if (npcCim == null) return; - if (!npcCim.inventoryContains(take)) { + + if (!npcCim.inventoryContains(take)) return; - } - if (!itemMan.hasRoomInventory(ib.getWeight())) + if (!itemMan.hasRoomInventory(template.item_wt)) return; + if (take != null) { itemMan.buyFromNPC(take, npc); itemMan.updateInventory(); @@ -621,7 +629,7 @@ public class CharacterItemManager { if (!i.validForInventory(source.getClientConnection(), source, this)) return false; - if (!tradingWith.hasRoomTrade(i.getItemBase().getWeight())) { + if (!tradingWith.hasRoomTrade(i.template.item_wt)) { dispatch = Dispatch.borrow(source, msg); DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY); return false; @@ -1251,9 +1259,10 @@ public class CharacterItemManager { 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.template != null) + this.inventoryWeight += i.template.item_wt; + return true; } @@ -1503,18 +1512,19 @@ public class CharacterItemManager { synchronized (this) { synchronized (itemMan) { - itemBase = purchasedItem.getItemBase(); + ItemTemplate template = purchasedItem.template; - if (itemBase == null) + if (template == null) return false; //test inventory is not full - if (!hasRoomInventory(itemBase.getWeight())) + if (!hasRoomInventory(template.item_wt)) return false; if (!itemMan.inventory.contains(purchasedItem)) return false; + // attempt to transfer item in db if (purchasedItem.getObjectType() == GameObjectType.MobLoot) { @@ -1625,10 +1635,11 @@ public class CharacterItemManager { return null; // get weight of item - ItemBase ib = lootItem.getItemBase(); - if (ib == null) + + if (lootItem.template == null) return null; - short weight = ib.getWeight(); + + int weight = lootItem.template.item_wt; // make sure lootingPlayer has room for item if (!lootItem.getItemBase().getType().equals(ItemType.GOLD) && !looterItems.hasRoomInventory(weight)) @@ -2106,7 +2117,7 @@ public class CharacterItemManager { return true; // npc's need checked } - public boolean hasRoomTrade(short itemWeight) { + public boolean hasRoomTrade(int itemWeight) { PlayerCharacter playerCharacter; PlayerCharacter tradeCharacter; @@ -2134,13 +2145,15 @@ public class CharacterItemManager { return tradeWeight <= (int) playerCharacter.statStrBase * 3; } - public boolean hasRoomBank(short weight) { + public boolean hasRoomBank(int weight) { + if (this.absCharacter == null) return false; + return weight <= this.absCharacter.getBankCapacityRemaining(); } - public boolean hasRoomVault(short weight) { + public boolean hasRoomVault(int weight) { if (this.absCharacter == null) return false; return weight <= this.absCharacter.getVaultCapacityRemaining(); @@ -2181,8 +2194,7 @@ public class CharacterItemManager { if (item == null) continue; - ItemBase ib = item.getItemBase(); - weight += ib.getWeight(); + weight += item.template.item_wt; } return weight; } @@ -2200,10 +2212,9 @@ public class CharacterItemManager { public void calculateBankWeight() { this.bankWeight = 0; - for (Item i : this.bank) { - ItemBase ib = i.getItemBase(); - if (ib != null) - this.bankWeight += ib.getWeight(); + for (Item item : this.bank) { + if (item.template != null) + this.bankWeight += item.template.item_value; } } @@ -2212,28 +2223,25 @@ public class CharacterItemManager { Collection c = this.equipped.values(); Iterator it = c.iterator(); while (it.hasNext()) { - Item i = it.next(); - ItemBase ib = i.getItemBase(); - if (ib != null) - this.equipWeight += ib.getWeight(); + Item item = it.next(); + if (item.template != null) + this.equipWeight += item.template.item_wt; } } public void calculateInventoryWeight() { this.inventoryWeight = 0; - for (Item i : this.inventory) { - ItemBase ib = i.getItemBase(); - if (ib != null) - this.inventoryWeight += ib.getWeight(); + for (Item item : this.inventory) { + if (item.template != null) + this.inventoryWeight += item.template.item_wt; } } public void calculateVaultWeight() { this.vaultWeight = 0; - for (Item i : this.vault) { - ItemBase ib = i.getItemBase(); - if (ib != null) - this.vaultWeight += ib.getWeight(); + for (Item item : this.vault) { + if (item.template != null) + this.vaultWeight += item.template.item_wt; } } diff --git a/src/engine/objects/Corpse.java b/src/engine/objects/Corpse.java index fa7970ad..7d355d76 100644 --- a/src/engine/objects/Corpse.java +++ b/src/engine/objects/Corpse.java @@ -281,7 +281,7 @@ public class Corpse extends AbstractWorldObject { Logger.error("Can't find inventory for player " + belongsTo.getObjectUUID()); } - public Item lootItem(Item i, PlayerCharacter looter) { + public Item lootItem(Item item, PlayerCharacter looter) { //make sure looter exists if (looter == null) return null; @@ -294,38 +294,36 @@ public class Corpse extends AbstractWorldObject { synchronized (this.inventory) { //make sure player has item in inventory - if (!this.inventory.contains(i)) + if (!this.inventory.contains(item)) return null; //get weight of item - ItemBase ib = i.getItemBase(); - if (ib == null) - return null; - short weight = ib.getWeight(); + + int weight = item.template.item_wt; //make sure looter has room for item - if (ib.getType().equals(ItemType.GOLD) == false && !looterItems.hasRoomInventory(weight)) + if (item.template.item_type.equals(ItemType.GOLD) == false && !looterItems.hasRoomInventory(weight)) return null; //attempt to transfer item in db - if (ib.getType().equals(ItemType.GOLD)) { - if (!looterItems.moveGoldToInventory(i, i.getNumOfItems())) + if (item.template.item_type.equals(ItemType.GOLD)) { + if (!looterItems.moveGoldToInventory(item, item.getNumOfItems())) return null; - } else if (!i.moveItemToInventory(looter)) + } else if (!item.moveItemToInventory(looter)) return null; //db transfer successful, remove from this character - this.inventory.remove(this.inventory.indexOf(i)); + this.inventory.remove(this.inventory.indexOf(item)); } //add item to looter. - if (!looterItems.addItemToInventory(i)) + if (!looterItems.addItemToInventory(item)) return null; //calculate new weights looterItems.calculateInventoryWeight(); - return i; + return item; } public boolean hasGold() { diff --git a/src/engine/objects/ItemBase.java b/src/engine/objects/ItemBase.java index 1ed1f87e..31e175b1 100644 --- a/src/engine/objects/ItemBase.java +++ b/src/engine/objects/ItemBase.java @@ -45,7 +45,6 @@ public class ItemBase { public EnumSet requiredClasses; public EnumSet requiredDiscs; public EnumSet restrictedDiscs; - private final short weight; private final short color; private final ItemType type; private int vendorType; @@ -90,7 +89,6 @@ public class ItemBase { this.uuid = rs.getInt("ID"); - this.weight = rs.getShort("weight"); this.color = rs.getShort("color"); this.type = ItemType.valueOf(rs.getString("Type")); this.useID = rs.getInt("useID"); @@ -256,11 +254,6 @@ public class ItemBase { DbManager.ItemBaseQueries.LOAD_BAKEDINSTATS(this); } - public short getWeight() { - return this.weight; - } - - public boolean isConsumable() { return this.isConsumable; } diff --git a/src/engine/objects/ItemFactory.java b/src/engine/objects/ItemFactory.java index d766d39a..b23ae38e 100644 --- a/src/engine/objects/ItemFactory.java +++ b/src/engine/objects/ItemFactory.java @@ -30,33 +30,36 @@ import java.util.concurrent.ThreadLocalRandom; public class ItemFactory { - public static void fillInventory(PlayerCharacter pc, int objectID, int count) { + public static void fillInventory(PlayerCharacter pc, int templateID, int count) { if (pc == null) return; int max = 20; CharacterItemManager itemManager = pc.getCharItemManager(); - ItemBase ib = ItemBase.getItemBase(objectID); + + ItemTemplate template = ItemTemplate.itemTemplates.get(templateID); + if (count > max) count = max; ClientConnection cc = pc.getClientConnection(); - if (itemManager == null || ib == null || cc == null) + if (itemManager == null || template == null || cc == null) return; boolean worked; + for (int i = 0; i < count; i++) { worked = false; - if (!itemManager.hasRoomInventory(ib.getWeight())) { + if (!itemManager.hasRoomInventory(template.item_wt)) { if (pc != null) ChatManager.chatSystemInfo(pc, "You can not carry any more of that item."); break; } - Item item = new Item(ib.getUUID()); + Item item = new Item(templateID); item.ownerID = pc.getObjectUUID(); item.ownerType = OwnerType.PlayerCharacter; item.containerType = ItemContainerType.INVENTORY; @@ -74,7 +77,7 @@ public class ItemFactory { itemManager.updateInventory(); } - public static Item fillForge(NPC npc, PlayerCharacter pc, int itemsToRoll, int itemID, int pToken, int sToken, String customName) { + public static Item fillForge(NPC npc, PlayerCharacter pc, int itemsToRoll, int templateID, int pToken, int sToken, String customName) { String prefixString = ""; String suffixString = ""; @@ -83,10 +86,10 @@ public class ItemFactory { boolean useWarehouse = false; - ItemBase ib = ItemBase.getItemBase(itemID); - ItemTemplate template = ItemTemplate.itemTemplates.get(itemID); + ItemBase ib = ItemBase.getItemBase(templateID); + ItemTemplate template = ItemTemplate.itemTemplates.get(templateID); - if (ib == null) + if (template == null) return null; Building forge = npc.getBuilding(); @@ -94,8 +97,7 @@ public class ItemFactory { if (forge == null) return null; - - if (!npc.getCharItemManager().hasRoomInventory(ib.getWeight())) { + if (!npc.getCharItemManager().hasRoomInventory(template.item_wt)) { if (pc != null) ErrorPopupMsg.sendErrorPopup(pc, 21); return null; @@ -120,12 +122,13 @@ public class ItemFactory { useWarehouse = true; // ROLL BANE SCROLL. - if (ib.getUUID() > 910010 && ib.getUUID() < 910019) { + if (templateID > 910010 && templateID < 910019) { ConcurrentHashMap resources = cityWarehouse.resources; int buildingWithdraw = BuildingManager.GetWithdrawAmountForRolling(forge, template.item_value); int overdraft = BuildingManager.GetOverdraft(forge, template.item_value); + if (overdraft > 0 && !useWarehouse) { if (pc != null) ErrorPopupMsg.sendErrorMsg(pc, "Not enough gold in building strongbox." + " " + template.item_base_name); @@ -144,15 +147,6 @@ public class ItemFactory { return null; } - //All checks passed, lets withdraw from building first. - - // if (pc != null){ - // ChatManager.chatGuildInfo(pc.getGuild(), "Building withdraw = " + buildingWithdraw); - // ChatManager.chatGuildInfo(pc.getGuild(), "Warehouse overdraft withdraw = " + overdraft); - // - // ChatManager.chatGuildInfo(pc.getGuild(), "total withdraw = " + (overdraft + buildingWithdraw)); - // } - if (!forge.transferGold(-buildingWithdraw, false)) { overdraft += buildingWithdraw; @@ -169,15 +163,12 @@ public class ItemFactory { if (overdraft > 0) if (!Warehouse.withdraw(cityWarehouse, npc, ItemBase.GOLD_ITEM_BASE, overdraft, true)) { - //ChatManager.chatGuildError(pc, "Failed to create Item"); Logger.error("Warehouse With UID of " + cityWarehouse.UID + " Failed to Create Item." + template.item_base_name); return null; } - ml = new MobLoot(npc, ib, false); - ml.containerType = Enum.ItemContainerType.FORGE; ml.setValue(0); ml.loadEnchantments(); @@ -660,10 +651,10 @@ public class ItemFactory { ItemBase ib = ItemBase.getItemBase(itemBaseID); ItemTemplate template = ItemTemplate.itemTemplates.get(itemBaseID); - if (ib == null) + if (template == null) return null; - if (!vendor.getCharItemManager().hasRoomInventory(ib.getWeight())) { + if (!vendor.getCharItemManager().hasRoomInventory(template.item_wt)) { if (playerCharacter != null) ChatManager.chatSystemInfo(playerCharacter, vendor.getName() + " " + vendor.getContract().getName() + " Inventory is full."); diff --git a/src/engine/objects/Warehouse.java b/src/engine/objects/Warehouse.java index 8839ea1e..04b32ec6 100644 --- a/src/engine/objects/Warehouse.java +++ b/src/engine/objects/Warehouse.java @@ -715,7 +715,7 @@ public class Warehouse extends AbstractWorldObject { return false; if (addToInventory) - if (!itemMan.hasRoomInventory(ib.getWeight())) { + if (!itemMan.hasRoomInventory(template.item_wt)) { ChatManager.chatSystemInfo(pc, "You can not carry any more of that item."); return false; } @@ -790,7 +790,9 @@ public class Warehouse extends AbstractWorldObject { if (pc == null) return false; - if (ib == null) + ItemTemplate template = ItemTemplate.itemTemplates.get(ib.getUUID()); + + if (template == null) return false; if (warehouse.resources.get(ib) == null) @@ -804,7 +806,7 @@ public class Warehouse extends AbstractWorldObject { if (itemMan == null) return false; - if (!itemMan.hasRoomInventory(ib.getWeight())) { + if (!itemMan.hasRoomInventory(template.item_wt)) { ChatManager.chatSystemInfo(pc, "You can not carry any more of that item."); return false; }