diff --git a/src/engine/db/handlers/dbContractHandler.java b/src/engine/db/handlers/dbContractHandler.java index 39ee22c2..314fe0be 100644 --- a/src/engine/db/handlers/dbContractHandler.java +++ b/src/engine/db/handlers/dbContractHandler.java @@ -12,7 +12,7 @@ package engine.db.handlers; import engine.Enum; import engine.gameManager.DbManager; import engine.objects.Contract; -import engine.objects.ItemBase; +import engine.objects.ItemTemplate; import engine.objects.MobEquipment; import org.pmw.tinylog.Logger; @@ -63,33 +63,29 @@ public class dbContractHandler extends dbHandlerBase { while (rs.next()) { - //handle item base - int itemBaseID = rs.getInt("itembaseID"); + int templateID = rs.getInt("itembaseID"); - ItemBase ib = ItemBase.getItemBase(itemBaseID); + MobEquipment me = new MobEquipment(ItemTemplate.templates.get(templateID), Enum.EquipSlotType.NONE, 0); + contract.getSellInventory().add(me); - if (ib != null) { + //handle magic effects - MobEquipment me = new MobEquipment(ib, Enum.EquipSlotType.NONE, 0); - contract.getSellInventory().add(me); + String prefix = rs.getString("prefix"); + int pRank = rs.getInt("pRank"); - //handle magic effects - String prefix = rs.getString("prefix"); - int pRank = rs.getInt("pRank"); - String suffix = rs.getString("suffix"); - int sRank = rs.getInt("sRank"); + String suffix = rs.getString("suffix"); + int sRank = rs.getInt("sRank"); - if (prefix != null) { - me.setPrefix(prefix, pRank); - me.setIsID(true); - } - - if (suffix != null) { - me.setSuffix(suffix, sRank); - me.setIsID(true); - } + if (prefix != null) { + me.setPrefix(prefix, pRank); + me.setIsID(true); + } + if (suffix != null) { + me.setSuffix(suffix, sRank); + me.setIsID(true); } + } } catch (SQLException e) { Logger.error(e); diff --git a/src/engine/objects/MobEquipment.java b/src/engine/objects/MobEquipment.java index b09e0af6..07b7282d 100644 --- a/src/engine/objects/MobEquipment.java +++ b/src/engine/objects/MobEquipment.java @@ -41,11 +41,11 @@ public class MobEquipment extends AbstractGameObject { /** * No Id Constructor */ - public MobEquipment(ItemBase itemBase, Enum.EquipSlotType slot, int parentID) { + public MobEquipment(ItemTemplate template, Enum.EquipSlotType slot, int parentID) { super(MobEquipment.getNewID()); - this.itemBase = itemBase; - this.templateID = this.itemBase.getUUID(); + this.templateID = template.template_id; this.template = ItemTemplate.templates.get(templateID); + this.itemBase = ItemBase.getItemBase(templateID); this.slot = slot; this.parentID = parentID; this.enchanted = false;