diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 2758e100..5acc0a7c 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -2694,7 +2694,7 @@ public class Enum { ResourceType(int templateID, int hash, int deposit_limit, int mine_production) { this.templateID = templateID; - this.template = ItemTemplate.itemTemplates.get(this.templateID); + this.template = ItemTemplate.templates.get(this.templateID); this.hash = hash; this.deposit_limit = deposit_limit; this.mine_production = mine_production; diff --git a/src/engine/db/handlers/dbItemHandler.java b/src/engine/db/handlers/dbItemHandler.java index d1ec7801..67d64f45 100644 --- a/src/engine/db/handlers/dbItemHandler.java +++ b/src/engine/db/handlers/dbItemHandler.java @@ -180,7 +180,7 @@ public class dbItemHandler extends dbHandlerBase { JSONObject jsonObject = (JSONObject) jsonParser.parse(rs.getString("template")); ItemTemplate itemTemplate = new ItemTemplate(jsonObject); itemTemplate.template_id = templateID; - ItemTemplate.itemTemplates.put(templateID, itemTemplate); + ItemTemplate.templates.put(templateID, itemTemplate); } } catch (Exception e) { diff --git a/src/engine/devcmd/cmds/InfoCmd.java b/src/engine/devcmd/cmds/InfoCmd.java index c5be675c..5adb69f5 100644 --- a/src/engine/devcmd/cmds/InfoCmd.java +++ b/src/engine/devcmd/cmds/InfoCmd.java @@ -505,7 +505,7 @@ public class InfoCmd extends AbstractDevCmd { case Item: //intentional passthrough case MobLoot: Item item = (Item) target; - ItemTemplate template = ItemTemplate.itemTemplates.get(item.getTemplateID()); + ItemTemplate template = ItemTemplate.templates.get(item.getTemplateID()); output += StringUtils.addWS("ItemBase: " + template.template_id, 20); output += "Weight: " + template.item_wt; output += newline; diff --git a/src/engine/devcmd/cmds/MakeItemCmd.java b/src/engine/devcmd/cmds/MakeItemCmd.java index e10007f0..e8a14c3f 100644 --- a/src/engine/devcmd/cmds/MakeItemCmd.java +++ b/src/engine/devcmd/cmds/MakeItemCmd.java @@ -62,7 +62,7 @@ public class MakeItemCmd extends AbstractDevCmd { ItemTemplate template; try { templateID = Integer.parseInt(words[0]); - template = ItemTemplate.itemTemplates.get(words[0].toLowerCase()); + template = ItemTemplate.templates.get(words[0].toLowerCase()); if (template == null) { throwbackError(pc, "Supplied type " + words[0] @@ -132,7 +132,7 @@ public class MakeItemCmd extends AbstractDevCmd { return; } } - template = ItemTemplate.itemTemplates.get(templateID); + template = ItemTemplate.templates.get(templateID); if (template == null) { throwbackError(pc, "Unable to find template " + templateID); diff --git a/src/engine/devcmd/cmds/PrintBankCmd.java b/src/engine/devcmd/cmds/PrintBankCmd.java index a1d811f3..b5327df3 100644 --- a/src/engine/devcmd/cmds/PrintBankCmd.java +++ b/src/engine/devcmd/cmds/PrintBankCmd.java @@ -52,7 +52,7 @@ public class PrintBankCmd extends AbstractDevCmd { throwbackInfo(pc, "Bank for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')'); for (Item item : list) { - ItemTemplate template = ItemTemplate.itemTemplates.get(item.getTemplateID()); + ItemTemplate template = ItemTemplate.templates.get(item.getTemplateID()); throwbackInfo(pc, " " + template.item_base_name + ", count: " + item.getNumOfItems()); } diff --git a/src/engine/devcmd/cmds/PrintBonusesCmd.java b/src/engine/devcmd/cmds/PrintBonusesCmd.java index 2f450e93..99338f8c 100644 --- a/src/engine/devcmd/cmds/PrintBonusesCmd.java +++ b/src/engine/devcmd/cmds/PrintBonusesCmd.java @@ -33,7 +33,7 @@ public class PrintBonusesCmd extends AbstractDevCmd { if (target instanceof Item) { type = "Item"; tar = (Item) target; - ItemTemplate template = ItemTemplate.itemTemplates.get(((Item) tar).getTemplateID()); + ItemTemplate template = ItemTemplate.templates.get(((Item) tar).getTemplateID()); name = template.item_base_name; } else if (target instanceof AbstractCharacter) { tar = (AbstractCharacter) target; diff --git a/src/engine/devcmd/cmds/PrintInventoryCmd.java b/src/engine/devcmd/cmds/PrintInventoryCmd.java index 90e31943..7c5725da 100644 --- a/src/engine/devcmd/cmds/PrintInventoryCmd.java +++ b/src/engine/devcmd/cmds/PrintInventoryCmd.java @@ -75,7 +75,7 @@ public class PrintInventoryCmd extends AbstractDevCmd { int goldCount = 0; for (Item item : inventory) { - ItemTemplate template = ItemTemplate.itemTemplates.get(item.templateID); + ItemTemplate template = ItemTemplate.templates.get(item.templateID); if (item.template.item_type.equals(ItemType.GOLD) == false) { diff --git a/src/engine/devcmd/cmds/PrintVaultCmd.java b/src/engine/devcmd/cmds/PrintVaultCmd.java index 0e77732d..25e4a463 100644 --- a/src/engine/devcmd/cmds/PrintVaultCmd.java +++ b/src/engine/devcmd/cmds/PrintVaultCmd.java @@ -50,7 +50,7 @@ public class PrintVaultCmd extends AbstractDevCmd { ArrayList list = cim.getVault(); throwbackInfo(pc, "Vault for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')'); for (Item item : list) { - ItemTemplate template = ItemTemplate.itemTemplates.get(item.getTemplateID()); + ItemTemplate template = ItemTemplate.templates.get(item.getTemplateID()); throwbackInfo(pc, " " + template.item_base_name + ", count: " + item.getNumOfItems()); } Item gold = cim.getGoldVault(); diff --git a/src/engine/devcmd/cmds/SimulateBootyCmd.java b/src/engine/devcmd/cmds/SimulateBootyCmd.java index dbe41e59..92da5c49 100644 --- a/src/engine/devcmd/cmds/SimulateBootyCmd.java +++ b/src/engine/devcmd/cmds/SimulateBootyCmd.java @@ -34,7 +34,7 @@ public class SimulateBootyCmd extends AbstractDevCmd { if (mob.bootySet != 0) { for (BootySetEntry entry : LootManager._bootySetMap.get(mob.bootySet)) { - ItemTemplate template = ItemTemplate.itemTemplates.get(entry.templateID); + ItemTemplate template = ItemTemplate.templates.get(entry.templateID); if (template != null) output += "[" + entry.bootyType + "] " + template.item_base_name + " [Chance] " + entry.dropChance + newline; diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index ae9fc246..d0307464 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -207,7 +207,7 @@ public enum BuildingManager { return false; } - ItemTemplate template = ItemTemplate.itemTemplates.get(1705032); // Elan Stone + ItemTemplate template = ItemTemplate.templates.get(1705032); // Elan Stone if (!player.getCharItemManager().hasRoomInventory(template.item_wt)) return false; diff --git a/src/engine/gameManager/ChatManager.java b/src/engine/gameManager/ChatManager.java index e23a71c5..1361a1e7 100644 --- a/src/engine/gameManager/ChatManager.java +++ b/src/engine/gameManager/ChatManager.java @@ -612,7 +612,7 @@ public enum ChatManager { name = amount + " gold "; else { String vowels = "aeiou"; - ItemTemplate template = ItemTemplate.itemTemplates.get(item.getTemplateID()); + ItemTemplate template = ItemTemplate.templates.get(item.getTemplateID()); String iName = template.item_base_name; if (iName.length() > 0) if (vowels.indexOf(iName.substring(0, 1).toLowerCase()) >= 0) diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index 595af2be..4fd28411 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -595,7 +595,7 @@ public enum CombatManager { // Apply Weapon power effect if any. don't try to apply twice if // dual wielding. Perform after passive test for sync purposes. - ItemTemplate template = ItemTemplate.itemTemplates.get(wb.getUUID()); + ItemTemplate template = ItemTemplate.templates.get(wb.getUUID()); if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || ItemTemplate.isTwoHanded(template))) { @@ -813,7 +813,7 @@ public enum CombatManager { // Apply Weapon power effect if any. // don't try to apply twice if dual wielding. - ItemTemplate template = ItemTemplate.itemTemplates.get(wb.getUUID()); + ItemTemplate template = ItemTemplate.templates.get(wb.getUUID()); if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || ItemTemplate.isTwoHanded(template))) { dpj = ((PlayerCharacter) attacker).getWeaponPower(); @@ -982,7 +982,7 @@ public enum CombatManager { if (wb == null) return 75; - ItemTemplate template = ItemTemplate.itemTemplates.get(wb.getUUID()); + ItemTemplate template = ItemTemplate.templates.get(wb.getUUID()); if (mainHand) { if (template.weapon_attack_anim_right.size() > 0) { diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index 0a93a014..49fa0e55 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -87,7 +87,7 @@ public enum LootManager { if (ib == null) break; - ItemTemplate template = ItemTemplate.itemTemplates.get(it.getTemplateID()); + ItemTemplate template = ItemTemplate.templates.get(it.getTemplateID()); if (ib.isDiscRune() || template.item_base_name.toLowerCase().contains("of the gods")) { ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().zoneName + " has found the " + template.item_base_name + ". Are you tough enough to take it?"); @@ -175,12 +175,12 @@ public enum LootManager { if (itemUUID == 0) return null; - if (ItemTemplate.itemTemplates.get(itemUUID).item_type.equals(Enum.ItemType.RESOURCE)) { + if (ItemTemplate.templates.get(itemUUID).item_type.equals(Enum.ItemType.RESOURCE)) { int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1); - return new MobLoot(mob, ItemTemplate.itemTemplates.get(itemUUID), amount, false); + return new MobLoot(mob, ItemTemplate.templates.get(itemUUID), amount, false); } - outItem = new MobLoot(mob, ItemTemplate.itemTemplates.get(itemUUID), false); + outItem = new MobLoot(mob, ItemTemplate.templates.get(itemUUID), false); if(selectedRow.pModTable != 0){ try { @@ -369,7 +369,7 @@ public enum LootManager { if (chanceRoll > bse.dropChance) return; - MobLoot lootItem = new MobLoot(mob, ItemTemplate.itemTemplates.get(bse.templateID), true); + MobLoot lootItem = new MobLoot(mob, ItemTemplate.templates.get(bse.templateID), true); if (lootItem != null) mob.getCharItemManager().addItemToInventory(lootItem); @@ -417,7 +417,7 @@ public enum LootManager { //create the item from the table, quantity is always 1 - MobLoot winnings = new MobLoot(playerCharacter, ItemTemplate.itemTemplates.get(selectedItem.cacheID), 1, false); + MobLoot winnings = new MobLoot(playerCharacter, ItemTemplate.templates.get(selectedItem.cacheID), 1, false); if (winnings == null) return; diff --git a/src/engine/net/client/msg/ManageNPCMsg.java b/src/engine/net/client/msg/ManageNPCMsg.java index 699320a7..4c310294 100644 --- a/src/engine/net/client/msg/ManageNPCMsg.java +++ b/src/engine/net/client/msg/ManageNPCMsg.java @@ -423,7 +423,7 @@ public class ManageNPCMsg extends ClientNetMsg { for (int templateID : rollableSet) { ItemBase item = ItemBase.getItemBase(templateID); - ItemTemplate template = ItemTemplate.itemTemplates.get(templateID); + ItemTemplate template = ItemTemplate.templates.get(templateID); writer.put((byte) 1); writer.putInt(0); writer.putInt(templateID); //itemID @@ -444,7 +444,7 @@ public class ManageNPCMsg extends ClientNetMsg { for (Item i : itemList) { ItemBase ib = i.getItemBase(); - ItemTemplate template = ItemTemplate.itemTemplates.get(ib); + ItemTemplate template = ItemTemplate.templates.get(ib); writer.put((byte) 0); // ? Unknown45 writer.putInt(i.getObjectType().ordinal()); writer.putInt(i.getObjectUUID()); diff --git a/src/engine/objects/Item.java b/src/engine/objects/Item.java index 64e87ac0..185933f4 100644 --- a/src/engine/objects/Item.java +++ b/src/engine/objects/Item.java @@ -68,7 +68,7 @@ public class Item extends AbstractWorldObject { public Item(int templateID) { super(); this.templateID = templateID; - this.template = ItemTemplate.itemTemplates.get(templateID); + this.template = ItemTemplate.templates.get(templateID); this.chargesRemaining = this.template.item_initial_charges; this.durabilityCurrent = this.template.combat_health_full; this.equipSlot = EquipSlotType.NONE; @@ -85,7 +85,7 @@ public class Item extends AbstractWorldObject { super(rs); this.templateID = rs.getInt("item_itemBaseID"); - this.template = ItemTemplate.itemTemplates.get(this.templateID); + this.template = ItemTemplate.templates.get(this.templateID); if (this.template == null) Logger.error("Null template of " + this.templateID) @@ -1012,7 +1012,7 @@ public class Item extends AbstractWorldObject { if (this.customName.isEmpty() == false) return this.customName; - ItemTemplate template = ItemTemplate.itemTemplates.get(this.getTemplateID()); + ItemTemplate template = ItemTemplate.templates.get(this.getTemplateID()); return template.item_base_name; } diff --git a/src/engine/objects/ItemBase.java b/src/engine/objects/ItemBase.java index 34542771..c39ba1bc 100644 --- a/src/engine/objects/ItemBase.java +++ b/src/engine/objects/ItemBase.java @@ -57,7 +57,7 @@ public class ItemBase { this.mastery = rs.getString("mastery"); damageType = Enum.SourceType.valueOf(rs.getString("damageType").toUpperCase()); - ItemTemplate template = ItemTemplate.itemTemplates.get(this.getUUID()); + ItemTemplate template = ItemTemplate.templates.get(this.getUUID()); if (template == null) Logger.error(this.getUUID() + " null template"); @@ -68,10 +68,10 @@ public class ItemBase { _itemBaseByUUID.put(itemBase.uuid, itemBase); - if (ItemTemplate.itemTemplates.get(itemBase.uuid).item_type.equals(ItemType.RESOURCE)) + if (ItemTemplate.templates.get(itemBase.uuid).item_type.equals(ItemType.RESOURCE)) _resourceList.add(itemBase); - ItemTemplate template = ItemTemplate.itemTemplates.get(itemBase.uuid); + ItemTemplate template = ItemTemplate.templates.get(itemBase.uuid); if (template == null) Logger.error("Null template for: " + itemBase.uuid); diff --git a/src/engine/objects/ItemFactory.java b/src/engine/objects/ItemFactory.java index 9a61156e..3c523f84 100644 --- a/src/engine/objects/ItemFactory.java +++ b/src/engine/objects/ItemFactory.java @@ -38,7 +38,7 @@ public class ItemFactory { int max = 20; CharacterItemManager itemManager = pc.getCharItemManager(); - ItemTemplate template = ItemTemplate.itemTemplates.get(templateID); + ItemTemplate template = ItemTemplate.templates.get(templateID); if (count > max) count = max; @@ -86,7 +86,7 @@ public class ItemFactory { boolean useWarehouse = false; - ItemTemplate template = ItemTemplate.itemTemplates.get(templateID); + ItemTemplate template = ItemTemplate.templates.get(templateID); if (template == null) return null; @@ -641,7 +641,7 @@ public class ItemFactory { ModTableEntry suffixEntry = null; ItemBase ib = ItemBase.getItemBase(itemBaseID); - ItemTemplate template = ItemTemplate.itemTemplates.get(itemBaseID); + ItemTemplate template = ItemTemplate.templates.get(itemBaseID); if (template == null) return null; @@ -766,7 +766,7 @@ public class ItemFactory { if (npc == null) return null; - ItemTemplate template = ItemTemplate.itemTemplates.get(templateID); + ItemTemplate template = ItemTemplate.templates.get(templateID); Building forge = npc.getBuilding(); diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index eee95ae3..909d050e 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -22,7 +22,7 @@ import java.util.concurrent.ConcurrentHashMap; public class ItemTemplate { // Global template lookup - public static HashMap itemTemplates = new HashMap<>(); + public static HashMap templates = new HashMap<>(); public int template_id; diff --git a/src/engine/objects/MobEquipment.java b/src/engine/objects/MobEquipment.java index ebd9811f..8b39b4a7 100644 --- a/src/engine/objects/MobEquipment.java +++ b/src/engine/objects/MobEquipment.java @@ -45,7 +45,7 @@ public class MobEquipment extends AbstractGameObject { super(MobEquipment.getNewID()); this.itemBase = itemBase; this.templateID = this.itemBase.getUUID(); - this.template = ItemTemplate.itemTemplates.get(templateID); + this.template = ItemTemplate.templates.get(templateID); this.slot = slot; this.parentID = parentID; this.enchanted = false; @@ -59,7 +59,7 @@ public class MobEquipment extends AbstractGameObject { public MobEquipment(int itemBaseID, float dropChance) { super(MobEquipment.getNewID()); this.itemBase = ItemBase.getItemBase(itemBaseID); - this.template = ItemTemplate.itemTemplates.get(itemBaseID); + this.template = ItemTemplate.templates.get(itemBaseID); Enum.EquipSlotType equipSlot = template.item_eq_slots_and.iterator().next(); @@ -184,17 +184,17 @@ public class MobEquipment extends AbstractGameObject { if (mobEquipment.itemBase == null) name = eb.getName(); else - name = eb.getName() + ' ' + ItemTemplate.itemTemplates.get(mobEquipment.itemBase.getUUID()).item_base_name; + name = eb.getName() + ' ' + ItemTemplate.templates.get(mobEquipment.itemBase.getUUID()).item_base_name; } else if (eb.isSuffix()) { if (mobEquipment.itemBase == null) name = eb.getName(); else - name = ItemTemplate.itemTemplates.get(mobEquipment.itemBase.getUUID()).item_base_name + ' ' + eb.getName(); + name = ItemTemplate.templates.get(mobEquipment.itemBase.getUUID()).item_base_name + ' ' + eb.getName(); } else { if (mobEquipment.itemBase == null) name = ""; else - name = ItemTemplate.itemTemplates.get(mobEquipment.itemBase.getUUID()).item_base_name; + name = ItemTemplate.templates.get(mobEquipment.itemBase.getUUID()).item_base_name; } writer.putInt(eb.getToken()); diff --git a/src/engine/objects/MobLoot.java b/src/engine/objects/MobLoot.java index c323bbd9..e0f17353 100644 --- a/src/engine/objects/MobLoot.java +++ b/src/engine/objects/MobLoot.java @@ -38,7 +38,7 @@ public final class MobLoot extends Item { } public MobLoot(AbstractCharacter mob, int qtyOfGold) { - this(mob, ItemTemplate.itemTemplates.get(Enum.ResourceType.GOLD.templateID), qtyOfGold, false); + this(mob, ItemTemplate.templates.get(Enum.ResourceType.GOLD.templateID), qtyOfGold, false); } public MobLoot(AbstractCharacter mob, ItemTemplate template, int quantity, boolean noSteal) { diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index 354f5bd7..e04515b0 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -920,7 +920,7 @@ public class NPC extends AbstractCharacter { DbManager.NPCQueries.LOAD_ALL_ITEMS_TO_PRODUCE(this); for (ProducedItem producedItem : this.forgedItems) { - MobLoot ml = new MobLoot(this, ItemTemplate.itemTemplates.get(producedItem.getItemBaseID()), false); + MobLoot ml = new MobLoot(this, ItemTemplate.templates.get(producedItem.getItemBaseID()), false); DbManager.NPCQueries.UPDATE_ITEM_ID(producedItem.getID(), currentID, ml.getObjectUUID()); @@ -1070,7 +1070,7 @@ public class NPC extends AbstractCharacter { ItemBase itemBase; for (Integer itemID : fullItemList) { itemBase = ItemBase.getItemBase(itemID); - boolean exclude = itemBase.getPercentRequired() == 0 && ItemTemplate.itemTemplates.get(itemID).item_type == ItemType.WEAPON; + boolean exclude = itemBase.getPercentRequired() == 0 && ItemTemplate.templates.get(itemID).item_type == ItemType.WEAPON; if (itemBase.getPercentRequired() <= maxSkill && !exclude) filteredItemList.add(itemID); } @@ -1095,7 +1095,7 @@ public class NPC extends AbstractCharacter { if (ib == null) return 0; - if (ItemTemplate.itemTemplates.get(itemID).item_type == ItemType.SCROLL) + if (ItemTemplate.templates.get(itemID).item_type == ItemType.SCROLL) return this.getRank() * 60 * 60 * 3; float time; diff --git a/src/engine/objects/Warehouse.java b/src/engine/objects/Warehouse.java index a11fe524..db1a534b 100644 --- a/src/engine/objects/Warehouse.java +++ b/src/engine/objects/Warehouse.java @@ -294,7 +294,7 @@ public class Warehouse extends AbstractWorldObject { if (resource.template.item_type.equals(Enum.ItemType.GOLD)) resourceType = Enum.ResourceType.GOLD; else - resourceType = Enum.ResourceType.valueOf(ItemTemplate.itemTemplates.get(resource.getTemplateID()).item_base_name.toUpperCase()); + resourceType = Enum.ResourceType.valueOf(ItemTemplate.templates.get(resource.getTemplateID()).item_base_name.toUpperCase()); if (transaction) AddTransactionToWarehouse(warehouse, pc.getObjectType(), pc.getObjectUUID(), Enum.TransactionType.DEPOSIT, resourceType, amount); @@ -596,7 +596,7 @@ public class Warehouse extends AbstractWorldObject { if (pc == null) return false; - ItemTemplate template = ItemTemplate.itemTemplates.get(resourceType.templateID); + ItemTemplate template = ItemTemplate.templates.get(resourceType.templateID); if (warehouse.resources.get(resourceType) == null) return false; @@ -678,7 +678,7 @@ public class Warehouse extends AbstractWorldObject { if (pc == null) return false; - ItemTemplate template = ItemTemplate.itemTemplates.get(resourceType); + ItemTemplate template = ItemTemplate.templates.get(resourceType); if (template == null) return false;