From 22326802b32f6c282825439c4521c2936ecea781 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 1 Mar 2024 16:28:28 -0500 Subject: [PATCH] Begin constructor refactor --- src/engine/objects/Item.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/engine/objects/Item.java b/src/engine/objects/Item.java index 754d94ce..baad0c58 100644 --- a/src/engine/objects/Item.java +++ b/src/engine/objects/Item.java @@ -39,8 +39,8 @@ import java.util.concurrent.locks.ReentrantLock; public class Item extends AbstractWorldObject { private static ConcurrentHashMap enchantValues = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); - private final short durabilityMax; - private final byte chargesMax; + private short durabilityMax; + private byte chargesMax; private final ConcurrentHashMap bonuses = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); private final ArrayList effectNames = new ArrayList<>(); public Enum.ItemContainerType containerType; @@ -62,10 +62,19 @@ public class Item extends AbstractWorldObject { private long dateToUpgrade; private String customName = ""; private int magicValue; + public ItemTemplate template; + public String name; /** - * No Id Constructor + * In Memory constructor */ + + public Item(int templateID) { + + this.template = ItemTemplate.itemTemplates.get(templateID); + + } + public Item(ItemBase itemBase, int ownerID, OwnerType ownerType, byte chargesMax, byte chargesRemaining, short durabilityCurrent, short durabilityMax, boolean canDestroy,