From a9dc7b1c5b2d31ef2c6f94757cd6c4e629f79036 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 8 Mar 2024 12:46:20 -0500 Subject: [PATCH] Equipment slot refactor started. --- src/engine/db/handlers/dbItemHandler.java | 2 +- src/engine/objects/MobEquipment.java | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/engine/db/handlers/dbItemHandler.java b/src/engine/db/handlers/dbItemHandler.java index 1735a306..d06fe9b2 100644 --- a/src/engine/db/handlers/dbItemHandler.java +++ b/src/engine/db/handlers/dbItemHandler.java @@ -92,7 +92,7 @@ public class dbItemHandler extends dbHandlerBase { break; } - preparedStatement.setByte(8, toAdd.getEquipSlot()); + preparedStatement.setByte(8, (byte) toAdd.equipSlot.ordinal()); preparedStatement.setInt(9, toAdd.getFlags()); preparedStatement.setString(10, toAdd.getCustomName()); diff --git a/src/engine/objects/MobEquipment.java b/src/engine/objects/MobEquipment.java index 9ab744b4..87d4089e 100644 --- a/src/engine/objects/MobEquipment.java +++ b/src/engine/objects/MobEquipment.java @@ -9,12 +9,12 @@ package engine.objects; +import engine.Enum; import engine.exception.SerializationException; import engine.gameManager.PowersManager; import engine.net.ByteBufferWriter; import engine.powers.EffectsBase; import engine.powers.poweractions.AbstractPowerAction; -import org.pmw.tinylog.Logger; import java.util.concurrent.atomic.AtomicInteger; @@ -61,13 +61,8 @@ public class MobEquipment extends AbstractGameObject { this.itemBase = ItemBase.getItemBase(itemBaseID); this.template = ItemTemplate.itemTemplates.get(itemBaseID); - if (this.itemBase != null) - this.slot = this.itemBase.getValidSlot(); - else { - Logger.error("Failed to find Itembase for ID : " + itemBaseID); - this.slot = 0; - } - + Enum.EquipSlotType equipSlot = template.item_eq_slots_and.iterator().next(); + this.slot = equipSlot.ordinal(); this.dropChance = dropChance; this.parentID = 0;