More item refactor work.

This commit is contained in:
2024-03-02 11:07:07 -05:00
parent d05dbef71d
commit b98e7cda15
7 changed files with 28 additions and 156 deletions
+3 -32
View File
@@ -47,7 +47,7 @@ public class Item extends AbstractWorldObject {
public ReentrantLock lootLock = new ReentrantLock();
public int ownerID; //may be character, account, npc, mob
private int flags; //1 = isIDed
private int numberOfItems;
public int numberOfItems;
public float durabilityCurrent;
public int chargesRemaining;
public byte equipSlot;
@@ -73,37 +73,8 @@ public class Item extends AbstractWorldObject {
this.chargesRemaining = this.template.item_initial_charges;
this.durabilityCurrent = this.template.combat_health_full;
this.equipSlot = 0;
loadEnchantments();
bakeInStats();
}
public Item(ItemBase itemBase, int ownerID,
OwnerType ownerType, byte chargesMax, byte chargesRemaining,
short durabilityCurrent, short durabilityMax, boolean canDestroy,
boolean rentable, Enum.ItemContainerType containerType, byte equipSlot,
String name) {
super();
this.templsteID = itemBase.getUUID();
this.ownerID = ownerID;
this.ownerType = ownerType;
if (itemBase.getType().getValue() == 20) {
this.chargesMax = chargesMax;
this.chargesRemaining = chargesRemaining;
} else {
this.chargesMax = (byte) itemBase.getNumCharges();
this.chargesRemaining = (byte) itemBase.getNumCharges();
}
this.durabilityMax = (short) itemBase.getDurability();
this.durabilityCurrent = (short) itemBase.getDurability();
this.containerType = containerType;
this.canDestroy = canDestroy;
this.equipSlot = equipSlot;
this.flags = 1;
this.value = this.magicValue;
this.customName = name;
this.containerType = ItemContainerType.NONE;
this.numberOfItems = 1;
loadEnchantments();
bakeInStats();
}