From 3dcffa3042a61ad3de2e3c2e8e77213932a82559 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 28 Mar 2024 04:50:08 -0400 Subject: [PATCH] More itembase refactor --- src/engine/objects/ItemFactory.java | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/engine/objects/ItemFactory.java b/src/engine/objects/ItemFactory.java index 3bad16cd..c563c9bc 100644 --- a/src/engine/objects/ItemFactory.java +++ b/src/engine/objects/ItemFactory.java @@ -141,7 +141,7 @@ public class ItemFactory { return null; } - if (overdraft > resources.get(ItemBase.GOLD_ITEM_BASE)) { + if (overdraft > resources.get(Enum.ResourceType.GOLD)) { if (pc != null) ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse for overdraft." + " " + template.item_base_name); return null; @@ -154,7 +154,7 @@ public class ItemFactory { ErrorPopupMsg.sendErrorMsg(pc, "Building does not have enough gold to produce this item." + template.item_base_name); return null; } else { - if (overdraft > resources.get(ItemBase.GOLD_ITEM_BASE)) { + if (overdraft > resources.get(Enum.ResourceType.GOLD)) { ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse to produce this item." + template.item_base_name); return null; } @@ -367,7 +367,7 @@ public class ItemFactory { return null; } - if (overdraft > cityWarehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) { + if (overdraft > cityWarehouse.resources.get(Enum.ResourceType.GOLD)) { if (pc != null) ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse for overdraft." + template.item_base_name); return null; @@ -422,7 +422,7 @@ public class ItemFactory { ErrorPopupMsg.sendErrorMsg(pc, "Building does not have enough gold to produce this item." + template.item_base_name); return null; } else { - if (overdraft > cityWarehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) { + if (overdraft > cityWarehouse.resources.get(Enum.ResourceType.GOLD)) { ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse to produce this item." + template.item_base_name); return null; } @@ -588,7 +588,7 @@ public class ItemFactory { time = (20 - rate); time *= MBServerStatics.ONE_MINUTE; - if (ml.getItemBase().getUUID() > 910010 && ml.getItemBase().getUUID() < 910019) { + if (ml.templateID > 910010 && ml.templateID < 910019) { rank = ml.getTemplateID() - 910010; time = rank * 60 * 60 * 3 * 1000; } @@ -630,7 +630,7 @@ public class ItemFactory { } - public static Item randomRoll(NPC vendor, PlayerCharacter playerCharacter, int itemsToRoll, int itemBaseID) { + public static Item randomRoll(NPC vendor, PlayerCharacter playerCharacter, int itemsToRoll, int templateID) { byte itemModTable; int prefixMod = 0; int suffixMod = 0; @@ -640,8 +640,8 @@ public class ItemFactory { ModTableEntry prefixEntry = null; ModTableEntry suffixEntry = null; - ItemBase ib = ItemBase.getItemBase(itemBaseID); - ItemTemplate template = ItemTemplate.templates.get(itemBaseID); + ItemBase ib = ItemBase.getItemBase(templateID); + ItemTemplate template = ItemTemplate.templates.get(templateID); if (template == null) return null; @@ -714,7 +714,7 @@ public class ItemFactory { suffix = suffixEntry.action; } - MobLoot toRoll = ItemFactory.produceRandomRoll(vendor, playerCharacter, prefix, suffix, itemBaseID); + MobLoot toRoll = ItemFactory.produceRandomRoll(vendor, playerCharacter, prefix, suffix, templateID); if (toRoll == null) return null; @@ -727,8 +727,10 @@ public class ItemFactory { time = (20 - rate); time *= MBServerStatics.ONE_MINUTE; - if (toRoll.getItemBase().getUUID() > 910010 && toRoll.getItemBase().getUUID() < 910019) { - rank = toRoll.getTemplateID() - 910010; + // Bane circles + + if (toRoll.templateID > 910010 && toRoll.templateID < 910019) { + rank = toRoll.templateID - 910010; time = rank * 60 * 60 * 3 * 1000; }