From fa440e2885def2d0f64cee41a79984cb6039f586 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 1 Mar 2024 21:32:51 -0500 Subject: [PATCH] Begin constructor refactor --- src/engine/db/handlers/dbItemHandler.java | 10 ++--- src/engine/devcmd/cmds/InfoCmd.java | 4 +- src/engine/devcmd/cmds/MakeItemCmd.java | 13 +++--- src/engine/devcmd/cmds/PrintBankCmd.java | 2 +- src/engine/devcmd/cmds/PrintBonusesCmd.java | 2 +- src/engine/devcmd/cmds/PrintEquipCmd.java | 2 +- src/engine/devcmd/cmds/PrintInventoryCmd.java | 4 +- src/engine/devcmd/cmds/PrintVaultCmd.java | 2 +- src/engine/gameManager/BuildingManager.java | 4 +- src/engine/gameManager/ChatManager.java | 2 +- src/engine/gameManager/LootManager.java | 8 ++-- src/engine/net/client/ClientMessagePump.java | 4 +- .../GuildCreationFinalizeHandler.java | 2 +- .../handlers/ObjectActionMsgHandler.java | 2 +- .../net/client/msg/ItemProductionMsg.java | 4 +- src/engine/net/client/msg/ManageNPCMsg.java | 10 ++--- src/engine/objects/CharacterItemManager.java | 11 +++-- src/engine/objects/Item.java | 42 ++++++++----------- src/engine/objects/ItemFactory.java | 18 ++++---- src/engine/objects/Warehouse.java | 2 +- 20 files changed, 72 insertions(+), 76 deletions(-) diff --git a/src/engine/db/handlers/dbItemHandler.java b/src/engine/db/handlers/dbItemHandler.java index 89a87987..f7d4723e 100644 --- a/src/engine/db/handlers/dbItemHandler.java +++ b/src/engine/db/handlers/dbItemHandler.java @@ -61,9 +61,9 @@ public class dbItemHandler extends dbHandlerBase { PreparedStatement preparedStatement = connection.prepareStatement("CALL `item_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?,?);")) { preparedStatement.setInt(1, toAdd.getOwnerID()); - preparedStatement.setInt(2, toAdd.getItemBaseID()); - preparedStatement.setInt(3, toAdd.getChargesRemaining()); - preparedStatement.setInt(4, toAdd.getDurabilityCurrent()); + preparedStatement.setInt(2, toAdd.getTemplsteID()); + preparedStatement.setInt(3, (byte) toAdd.chargesRemaining); + preparedStatement.setInt(4, (short) toAdd.durabilityCurrent); preparedStatement.setInt(5, toAdd.getDurabilityMax()); if (toAdd.getNumOfItems() < 1) @@ -392,7 +392,7 @@ public class dbItemHandler extends dbHandlerBase { preparedStatement.setInt(1, value); preparedStatement.setLong(2, item.getObjectUUID()); - preparedStatement.setInt(3, item.getDurabilityCurrent()); + preparedStatement.setInt(3, (short) item.durabilityCurrent); return (preparedStatement.executeUpdate() > 0); @@ -461,7 +461,7 @@ public class dbItemHandler extends dbHandlerBase { try (Connection connection = DbManager.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_chargesRemaining` = ? WHERE `UID` = ?")) { - preparedStatement.setInt(1, item.getChargesRemaining()); + preparedStatement.setInt(1, (byte) item.chargesRemaining); preparedStatement.setLong(2, item.getObjectUUID()); return (preparedStatement.executeUpdate() > 0); diff --git a/src/engine/devcmd/cmds/InfoCmd.java b/src/engine/devcmd/cmds/InfoCmd.java index 75963a1f..45a8baa0 100644 --- a/src/engine/devcmd/cmds/InfoCmd.java +++ b/src/engine/devcmd/cmds/InfoCmd.java @@ -506,14 +506,14 @@ public class InfoCmd extends AbstractDevCmd { case MobLoot: Item item = (Item) target; ItemBase itemBase = item.getItemBase(); - ItemTemplate template = ItemTemplate.itemTemplates.get(item.getItemBaseID()); + ItemTemplate template = ItemTemplate.itemTemplates.get(item.getTemplsteID()); output += StringUtils.addWS("ItemBase: " + itemBase.getUUID(), 20); output += "Weight: " + itemBase.getWeight(); output += newline; DecimalFormat df = new DecimalFormat("###,###,###,###,##0"); output += StringUtils.addWS("Qty: " + df.format(item.getNumOfItems()), 20); - output += "Charges: " + item.getChargesRemaining() + output += "Charges: " + (byte) item.chargesRemaining + '/' + item.getChargesMax(); output += newline; output += "Name: " + template.item_base_name; diff --git a/src/engine/devcmd/cmds/MakeItemCmd.java b/src/engine/devcmd/cmds/MakeItemCmd.java index 835cdb27..eedc72e8 100644 --- a/src/engine/devcmd/cmds/MakeItemCmd.java +++ b/src/engine/devcmd/cmds/MakeItemCmd.java @@ -37,9 +37,10 @@ public class MakeItemCmd extends AbstractDevCmd { if (ibID == 7) continue; - ItemBase ib = ItemBase.getItemBase(ibID); + ItemTemplate template = ItemTemplate.itemTemplates.get(ibID); + + int weight = template.item_wt; - short weight = ib.getWeight(); if (!pc.getCharItemManager().hasRoomInventory(weight)) { throwbackError(pc, "Not enough room in inventory for any more of this item"); @@ -48,10 +49,10 @@ public class MakeItemCmd extends AbstractDevCmd { } boolean worked = false; - Item item = new Item(ib, pc.getObjectUUID(), - OwnerType.PlayerCharacter, (byte) 0, (byte) 0, (short) ib.getDurability(), (short) ib.getDurability(), - true, false, ItemContainerType.INVENTORY, (byte) 0, - new ArrayList<>(), ""); + Item item = new Item(template.template_id); + item.ownerID = pc.getObjectUUID(); + item.ownerType = OwnerType.PlayerCharacter; + item.containerType = ItemContainerType.INVENTORY; item.setNumOfItems(Warehouse.getMaxResources().get(ibID)); diff --git a/src/engine/devcmd/cmds/PrintBankCmd.java b/src/engine/devcmd/cmds/PrintBankCmd.java index e0a7df1e..9ca407af 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.getItemBaseID()); + ItemTemplate template = ItemTemplate.itemTemplates.get(item.getTemplsteID()); 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 d21c0853..cc7300f8 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).getItemBaseID()); + ItemTemplate template = ItemTemplate.itemTemplates.get(((Item) tar).getTemplsteID()); name = template.item_base_name; } else if (target instanceof AbstractCharacter) { tar = (AbstractCharacter) target; diff --git a/src/engine/devcmd/cmds/PrintEquipCmd.java b/src/engine/devcmd/cmds/PrintEquipCmd.java index c5b8ab27..601dffd7 100644 --- a/src/engine/devcmd/cmds/PrintEquipCmd.java +++ b/src/engine/devcmd/cmds/PrintEquipCmd.java @@ -87,7 +87,7 @@ public class PrintEquipCmd extends AbstractDevCmd { throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')'); for (Integer slot : list.keySet()) { Item item = list.get(slot); - ItemTemplate template = ItemTemplate.itemTemplates.get(item.getItemBaseID()); + ItemTemplate template = ItemTemplate.itemTemplates.get(item.getTemplsteID()); throwbackInfo(pc, " " + template.item_base_name + ", slot: " + slot); } } diff --git a/src/engine/devcmd/cmds/PrintInventoryCmd.java b/src/engine/devcmd/cmds/PrintInventoryCmd.java index be5d70e1..f3dbbd8e 100644 --- a/src/engine/devcmd/cmds/PrintInventoryCmd.java +++ b/src/engine/devcmd/cmds/PrintInventoryCmd.java @@ -79,10 +79,10 @@ public class PrintInventoryCmd extends AbstractDevCmd { String chargeInfo = ""; byte chargeMax = item.getChargesMax(); if (chargeMax > 0) { - byte charges = item.getChargesRemaining(); + byte charges = (byte) item.chargesRemaining; chargeInfo = " charges: " + charges + '/' + chargeMax; } - ItemTemplate template = ItemTemplate.itemTemplates.get(item.getItemBaseID()); + ItemTemplate template = ItemTemplate.itemTemplates.get(item.getTemplsteID()); throwbackInfo(pc, " " + template.item_base_name + ", count: " + item.getNumOfItems() + chargeInfo); } else goldCount += item.getNumOfItems(); diff --git a/src/engine/devcmd/cmds/PrintVaultCmd.java b/src/engine/devcmd/cmds/PrintVaultCmd.java index 40338799..1bf283a5 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.getItemBaseID()); + ItemTemplate template = ItemTemplate.itemTemplates.get(item.getTemplsteID()); throwbackInfo(pc, " " + template.item_base_name + ", count: " + item.getNumOfItems()); } Item gold = cim.getGoldVault(); diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index 53ff29bf..f50d8550 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -572,8 +572,8 @@ public enum BuildingManager { String pirateName = NPCManager.getPirateName(contract.getMobbaseID()); - if (item.getChargesRemaining() > 0) - rank = item.getChargesRemaining() * 10; + if ((byte) item.chargesRemaining > 0) + rank = (byte) item.chargesRemaining * 10; else rank = 10; diff --git a/src/engine/gameManager/ChatManager.java b/src/engine/gameManager/ChatManager.java index 16773a1b..ffd5bcef 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.getItemBaseID()); + ItemTemplate template = ItemTemplate.itemTemplates.get(item.getTemplsteID()); 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/LootManager.java b/src/engine/gameManager/LootManager.java index e8e7256c..9cf10cfc 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.getItemBaseID()); + ItemTemplate template = ItemTemplate.itemTemplates.get(it.getTemplsteID()); 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?"); @@ -354,7 +354,7 @@ public enum LootManager { if (ml != null && dropCount < 1) { ml.setIsID(true); - ml.setDurabilityCurrent((short) (ml.getDurabilityCurrent() - ThreadLocalRandom.current().nextInt(5) + 1)); + ml.setDurabilityCurrent((short) ((short) ml.durabilityCurrent - ThreadLocalRandom.current().nextInt(5) + 1)); mob.getCharItemManager().addItemToInventory(ml); dropCount = 1; //break; // Exit on first successful roll. @@ -383,8 +383,8 @@ public enum LootManager { int tableID = 0; - if (_bootySetMap.get(gift.getItemBaseID()) != null) - tableID = _bootySetMap.get(gift.getItemBaseID()).get(ThreadLocalRandom.current().nextInt(_bootySetMap.get(gift.getItemBaseID()).size())).genTable; + if (_bootySetMap.get(gift.getTemplsteID()) != null) + tableID = _bootySetMap.get(gift.getTemplsteID()).get(ThreadLocalRandom.current().nextInt(_bootySetMap.get(gift.getTemplsteID()).size())).genTable; if (tableID == 0) return; diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index 48501ebd..89170e62 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1245,7 +1245,7 @@ public class ClientMessagePump implements NetMsgHandler { cost = sell.getBaseValue(); //apply damaged value reduction - float durabilityCurrent = sell.getDurabilityCurrent(); + float durabilityCurrent = (short) sell.durabilityCurrent; float durabilityMax = sell.getDurabilityMax(); float damagedModifier = durabilityCurrent / durabilityMax; cost *= damagedModifier; @@ -1639,7 +1639,7 @@ public class ClientMessagePump implements NetMsgHandler { return; //make sure item is damaged and not destroyed - short dur = toRepair.getDurabilityCurrent(); + short dur = (short) toRepair.durabilityCurrent; short max = toRepair.getDurabilityMax(); //account for durability modifications float durMod = toRepair.getBonusPercent(ModType.Durability, SourceType.NONE); diff --git a/src/engine/net/client/handlers/GuildCreationFinalizeHandler.java b/src/engine/net/client/handlers/GuildCreationFinalizeHandler.java index 0bcdb7b3..46663378 100644 --- a/src/engine/net/client/handlers/GuildCreationFinalizeHandler.java +++ b/src/engine/net/client/handlers/GuildCreationFinalizeHandler.java @@ -64,7 +64,7 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler { charter = msg.getCharter(); - if (charter == null || charter.getOwnerType() != OwnerType.PlayerCharacter || charter.getOwnerID() != player.getObjectUUID()) { + if (charter == null || charter.ownerType != OwnerType.PlayerCharacter || charter.getOwnerID() != player.getObjectUUID()) { ErrorPopupMsg.sendErrorPopup(player, GuildManager.NO_CHARTER_FOUND); return true; } diff --git a/src/engine/net/client/handlers/ObjectActionMsgHandler.java b/src/engine/net/client/handlers/ObjectActionMsgHandler.java index 5621349e..c70c4814 100644 --- a/src/engine/net/client/handlers/ObjectActionMsgHandler.java +++ b/src/engine/net/client/handlers/ObjectActionMsgHandler.java @@ -493,7 +493,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler { removeRune(player, origin, comps.get(1).intValue()); } break; - } else if (item.getChargesRemaining() > 0) { + } else if ((byte) item.chargesRemaining > 0) { ArrayList tarList = msg.getTargetCompID(); AbstractWorldObject target = player; if (tarList.size() > 1) { diff --git a/src/engine/net/client/msg/ItemProductionMsg.java b/src/engine/net/client/msg/ItemProductionMsg.java index dc7ed812..cd14e6e1 100644 --- a/src/engine/net/client/msg/ItemProductionMsg.java +++ b/src/engine/net/client/msg/ItemProductionMsg.java @@ -284,7 +284,7 @@ public class ItemProductionMsg extends ClientNetMsg { writer.putInt(this.itemUUID); writer.putInt(0); //items left to produce? if (toRoll != null) { - writer.putInt(toRoll.getItemBaseID()); + writer.putInt(toRoll.getTemplsteID()); writer.putInt(toRoll.getValue()); } else { writer.putInt(0); @@ -301,7 +301,7 @@ public class ItemProductionMsg extends ClientNetMsg { timeLeft /= 1000; writer.putInt((int) timeLeft); - writer.putInt(vendor.getRollingTimeInSeconds(toRoll.getItemBaseID())); + writer.putInt(vendor.getRollingTimeInSeconds(toRoll.getTemplsteID())); } } else { diff --git a/src/engine/net/client/msg/ManageNPCMsg.java b/src/engine/net/client/msg/ManageNPCMsg.java index b9255b0a..62c1bf0e 100644 --- a/src/engine/net/client/msg/ManageNPCMsg.java +++ b/src/engine/net/client/msg/ManageNPCMsg.java @@ -449,15 +449,15 @@ public class ManageNPCMsg extends ClientNetMsg { writer.putInt(i.getObjectUUID()); writer.putInt(0); - writer.putInt(i.getItemBaseID()); - writer.putInt(ib.getBaseValue()); + writer.putInt(i.getTemplsteID()); + writer.putInt(ib.getBaseValue()); long timeLife = i.getDateToUpgrade() - System.currentTimeMillis(); timeLife /= 1000; - writer.putInt((int) timeLife); - writer.putInt(npc.getRollingTimeInSeconds(i.getItemBaseID())); - writer.putInt(1); + writer.putInt((int) timeLife); + writer.putInt(npc.getRollingTimeInSeconds(i.getTemplsteID())); + writer.putInt(1); if (i.isComplete()) writer.put((byte) 1); diff --git a/src/engine/objects/CharacterItemManager.java b/src/engine/objects/CharacterItemManager.java index 874be6a0..483afd9c 100644 --- a/src/engine/objects/CharacterItemManager.java +++ b/src/engine/objects/CharacterItemManager.java @@ -12,7 +12,10 @@ package engine.objects; import engine.Enum; import engine.Enum.GameObjectType; import engine.Enum.ItemType; -import engine.gameManager.*; +import engine.gameManager.BuildingManager; +import engine.gameManager.ChatManager; +import engine.gameManager.ConfigManager; +import engine.gameManager.DbManager; import engine.math.Vector3fImmutable; import engine.net.Dispatch; import engine.net.DispatchMessage; @@ -931,7 +934,7 @@ public class CharacterItemManager { public synchronized boolean consume(Item i) { i.decrementChargesRemaining(); - if (i.getChargesRemaining() > 0) + if ((byte) i.chargesRemaining > 0) return true; return junk(i, true); } @@ -2089,7 +2092,7 @@ public class CharacterItemManager { } } - public boolean hasRoomInventory(short weight) { + public boolean hasRoomInventory(int weight) { if (this.absCharacter == null) return false; if (this.absCharacter.getObjectType() == GameObjectType.PlayerCharacter) { @@ -2447,7 +2450,7 @@ public class CharacterItemManager { if (!item.isCanDestroy()) return; - int dur = (int) item.getDurabilityCurrent(); + int dur = (int) (short) item.durabilityCurrent; if (dur - amount <= 0) { //destroy the item junk(item); diff --git a/src/engine/objects/Item.java b/src/engine/objects/Item.java index 5e53d718..23b48369 100644 --- a/src/engine/objects/Item.java +++ b/src/engine/objects/Item.java @@ -45,18 +45,18 @@ public class Item extends AbstractWorldObject { private final ArrayList effectNames = new ArrayList<>(); public Enum.ItemContainerType containerType; public ReentrantLock lootLock = new ReentrantLock(); - private int ownerID; //may be character, account, npc, mob + public int ownerID; //may be character, account, npc, mob private int flags; //1 = isIDed private int numberOfItems; - private short durabilityCurrent; - private byte chargesRemaining; + public float durabilityCurrent; + public int chargesRemaining; private byte equipSlot; private boolean canDestroy; private boolean rentable; private boolean isRandom = false; private int value; - private OwnerType ownerType; - private int itemBaseID; + public OwnerType ownerType; + public int templsteID; private AbstractWorldObject lastOwner; private ArrayList enchants = new ArrayList<>(); private long dateToUpgrade; @@ -72,7 +72,11 @@ public class Item extends AbstractWorldObject { public Item(int templateID) { super(); this.template = ItemTemplate.itemTemplates.get(templateID); + this.chargesRemaining = this.template.item_initial_charges; + this.durabilityCurrent = this.template.combat_health_full; + loadEnchantments(); + bakeInStats(); } public Item(ItemBase itemBase, int ownerID, @@ -81,7 +85,7 @@ public class Item extends AbstractWorldObject { boolean rentable, Enum.ItemContainerType containerType, byte equipSlot, ArrayList enchants, String name) { super(); - this.itemBaseID = itemBase.getUUID(); + this.templsteID = itemBase.getUUID(); this.ownerID = ownerID; this.ownerType = ownerType; @@ -119,7 +123,7 @@ public class Item extends AbstractWorldObject { ArrayList enchants, int newUUID) { super(newUUID); - this.itemBaseID = itemBase.getUUID(); + this.templsteID = itemBase.getUUID(); this.ownerID = ownerID; this.ownerType = ownerType; this.customName = ""; @@ -146,7 +150,7 @@ public class Item extends AbstractWorldObject { public Item(ResultSet rs) throws SQLException { super(rs); - this.itemBaseID = rs.getInt("item_itemBaseID"); + this.templsteID = rs.getInt("item_itemBaseID"); // Set container enumeration @@ -784,11 +788,11 @@ public class Item extends AbstractWorldObject { } public ItemBase getItemBase() { - return ItemBase.getItemBase(itemBaseID); + return ItemBase.getItemBase(templsteID); } - public int getItemBaseID() { - return this.itemBaseID; + public int getTemplsteID() { + return this.templsteID; } public int getOwnerID() { @@ -800,10 +804,6 @@ public class Item extends AbstractWorldObject { this.ownerID = ownerID; } - public OwnerType getOwnerType() { - return ownerType; - } - public AbstractGameObject getOwner() { if (this.ownerType == OwnerType.Npc) return NPC.getFromCache(this.ownerID); @@ -850,15 +850,7 @@ public class Item extends AbstractWorldObject { return chargesMax; } - public byte getChargesRemaining() { - return chargesRemaining; - } - - public short getDurabilityCurrent() { - return durabilityCurrent; - } - - public void setDurabilityCurrent(short value) { + public void setDurabilityCurrent(float value) { this.durabilityCurrent = value; } @@ -1194,7 +1186,7 @@ public class Item extends AbstractWorldObject { if (this.customName.isEmpty() == false) return this.customName; - ItemTemplate template = ItemTemplate.itemTemplates.get(this.getItemBaseID()); + ItemTemplate template = ItemTemplate.itemTemplates.get(this.getTemplsteID()); return template.item_base_name; } diff --git a/src/engine/objects/ItemFactory.java b/src/engine/objects/ItemFactory.java index 7237f3ea..feb75198 100644 --- a/src/engine/objects/ItemFactory.java +++ b/src/engine/objects/ItemFactory.java @@ -189,7 +189,7 @@ public class ItemFactory { time *= MBServerStatics.ONE_MINUTE; if (ml.getItemBase().getUUID() > 910010 && ml.getItemBase().getUUID() < 910019) { - rank = ml.getItemBaseID() - 910010; + rank = ml.getTemplsteID() - 910010; time = rank * 60 * 60 * 3 * 1000; } @@ -210,8 +210,8 @@ public class ItemFactory { if (pc != null) playerID = pc.getObjectUUID(); - DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(ml.getObjectUUID(), npc.getObjectUUID(), ml.getItemBaseID(), dateTime, "", "", "", false, playerID); - ProducedItem pi = new ProducedItem(ml.getObjectUUID(), npc.getObjectUUID(), ml.getItemBaseID(), dateTime, false, "", "", "", playerID); + DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(ml.getObjectUUID(), npc.getObjectUUID(), ml.getTemplsteID(), dateTime, "", "", "", false, playerID); + ProducedItem pi = new ProducedItem(ml.getObjectUUID(), npc.getObjectUUID(), ml.getTemplsteID(), dateTime, false, "", "", "", playerID); pi.setProducedItemID(ml.getObjectUUID()); pi.setAmount(itemsToRoll); pi.setRandom(false); @@ -606,7 +606,7 @@ public class ItemFactory { time *= MBServerStatics.ONE_MINUTE; if (ml.getItemBase().getUUID() > 910010 && ml.getItemBase().getUUID() < 910019) { - rank = ml.getItemBaseID() - 910010; + rank = ml.getTemplsteID() - 910010; time = rank * 60 * 60 * 3 * 1000; } @@ -627,8 +627,8 @@ public class ItemFactory { if (pc != null) playerID = pc.getObjectUUID(); - DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(ml.getObjectUUID(), npc.getObjectUUID(), ml.getItemBaseID(), dateTime, prefixString, suffixString, ml.getCustomName(), false, playerID); - ProducedItem pi = new ProducedItem(npc.getRolling().size(), npc.getObjectUUID(), ml.getItemBaseID(), dateTime, false, prefixString, suffixString, ml.getCustomName(), playerID); + DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(ml.getObjectUUID(), npc.getObjectUUID(), ml.getTemplsteID(), dateTime, prefixString, suffixString, ml.getCustomName(), false, playerID); + ProducedItem pi = new ProducedItem(npc.getRolling().size(), npc.getObjectUUID(), ml.getTemplsteID(), dateTime, false, prefixString, suffixString, ml.getCustomName(), playerID); pi.setProducedItemID(ml.getObjectUUID()); pi.setAmount(itemsToRoll); @@ -745,7 +745,7 @@ public class ItemFactory { time *= MBServerStatics.ONE_MINUTE; if (toRoll.getItemBase().getUUID() > 910010 && toRoll.getItemBase().getUUID() < 910019) { - rank = toRoll.getItemBaseID() - 910010; + rank = toRoll.getTemplsteID() - 910010; time = rank * 60 * 60 * 3 * 1000; } @@ -765,9 +765,9 @@ public class ItemFactory { if (playerCharacter != null) playerID = playerCharacter.getObjectUUID(); - DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(toRoll.getObjectUUID(), vendor.getObjectUUID(), toRoll.getItemBaseID(), dateTime, prefix, suffix, toRoll.getCustomName(), true, playerID); + DbManager.NPCQueries.ADD_TO_PRODUCTION_LIST(toRoll.getObjectUUID(), vendor.getObjectUUID(), toRoll.getTemplsteID(), dateTime, prefix, suffix, toRoll.getCustomName(), true, playerID); - ProducedItem pi = new ProducedItem(toRoll.getObjectUUID(), vendor.getObjectUUID(), toRoll.getItemBaseID(), dateTime, true, prefix, suffix, toRoll.getCustomName(), playerID); + ProducedItem pi = new ProducedItem(toRoll.getObjectUUID(), vendor.getObjectUUID(), toRoll.getTemplsteID(), dateTime, true, prefix, suffix, toRoll.getCustomName(), playerID); pi.setProducedItemID(toRoll.getObjectUUID()); pi.setAmount(itemsToRoll); ItemQueue produced = ItemQueue.borrow(pi, (long) (time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()))); diff --git a/src/engine/objects/Warehouse.java b/src/engine/objects/Warehouse.java index f42374f5..2eb2663c 100644 --- a/src/engine/objects/Warehouse.java +++ b/src/engine/objects/Warehouse.java @@ -344,7 +344,7 @@ public class Warehouse extends AbstractWorldObject { if (resource.getItemBase().getType().equals(Enum.ItemType.GOLD)) resourceType = Resource.GOLD; else - resourceType = Resource.valueOf(ItemTemplate.itemTemplates.get(resource.getItemBaseID()).item_base_name.toUpperCase()); + resourceType = Resource.valueOf(ItemTemplate.itemTemplates.get(resource.getTemplsteID()).item_base_name.toUpperCase()); if (transaction) AddTransactionToWarehouse(warehouse, pc.getObjectType(), pc.getObjectUUID(), Enum.TransactionType.DEPOSIT, resourceType, amount);