From 08aa431f5d7eb44fd176a5c357d7c729417cce5d Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 2 Mar 2024 11:11:24 -0500 Subject: [PATCH] More item refactor work. --- src/engine/objects/AbstractGameObject.java | 2 +- src/engine/objects/Item.java | 31 +--------------------- src/engine/objects/MobLoot.java | 11 ++++---- 3 files changed, 7 insertions(+), 37 deletions(-) diff --git a/src/engine/objects/AbstractGameObject.java b/src/engine/objects/AbstractGameObject.java index b105cf14..e0b5f206 100644 --- a/src/engine/objects/AbstractGameObject.java +++ b/src/engine/objects/AbstractGameObject.java @@ -25,7 +25,7 @@ import java.util.concurrent.ConcurrentHashMap; public abstract class AbstractGameObject { private GameObjectType objectType = GameObjectType.unknown; - private int objectUUID; + public int objectUUID; private byte ver = 1; diff --git a/src/engine/objects/Item.java b/src/engine/objects/Item.java index 57d19582..baa43c1d 100644 --- a/src/engine/objects/Item.java +++ b/src/engine/objects/Item.java @@ -65,6 +65,7 @@ public class Item extends AbstractWorldObject { /** * In Memory constructor + * Set values and call PERSIST(); */ public Item(int templateID) { @@ -79,36 +80,6 @@ public class Item extends AbstractWorldObject { bakeInStats(); } - /** - * Normal Constructor - */ - public Item(ItemBase itemBase, int ownerID, - OwnerType ownerType, byte chargesMax, byte chargesRemaining, - short durabilityCurrent, short durabilityMax, boolean canDestroy, - boolean rentable, boolean inBank, boolean inVault, - boolean inInventory, boolean isEquipped, byte equipSlot, - ArrayList enchants, int newUUID) { - - super(newUUID); - this.templsteID = itemBase.getUUID(); - this.ownerID = ownerID; - this.ownerType = ownerType; - this.customName = ""; - - this.chargesMax = (byte) itemBase.getNumCharges(); - this.chargesRemaining = (byte) itemBase.getNumCharges(); - - this.durabilityMax = (short) itemBase.getDurability(); - this.durabilityCurrent = (short) itemBase.getDurability(); - this.canDestroy = canDestroy; - this.equipSlot = equipSlot; - this.flags = 1; - this.value = this.magicValue; - - loadEnchantments(); - bakeInStats(); - } - /** * ResultSet Constructor */ diff --git a/src/engine/objects/MobLoot.java b/src/engine/objects/MobLoot.java index f71c2fb7..a09859bc 100644 --- a/src/engine/objects/MobLoot.java +++ b/src/engine/objects/MobLoot.java @@ -17,7 +17,6 @@ import engine.gameManager.PowersManager; import engine.powers.poweractions.AbstractPowerAction; import org.pmw.tinylog.Logger; -import java.util.ArrayList; import java.util.concurrent.atomic.AtomicInteger; /** @@ -64,15 +63,15 @@ public final class MobLoot extends Item { * @param quantity Quantity of the item */ public MobLoot(AbstractCharacter mob, ItemBase ib, int quantity, boolean noSteal) { - super(ib, mob.getObjectUUID(), - OwnerType.Mob, (byte) 0, (byte) 0, (short) 0, - (short) 0, true, false, false, false, true, - false, (byte) 0, new ArrayList<>(), generateId()); + + super(ib.getUUID()); + this.ownerType = OwnerType.Mob; + this.ownerID = mob.getObjectUUID(); + this.objectUUID = generateId(); if (quantity == 0 && ib.getType() == ItemType.RESOURCE) quantity = 1; - if (quantity > 0) this.setNumOfItems(quantity);