|
|
@ -39,8 +39,6 @@ import java.util.concurrent.locks.ReentrantLock; |
|
|
|
public class Item extends AbstractWorldObject { |
|
|
|
public class Item extends AbstractWorldObject { |
|
|
|
|
|
|
|
|
|
|
|
private static ConcurrentHashMap<String, Integer> enchantValues = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
|
|
private static ConcurrentHashMap<String, Integer> enchantValues = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
|
|
private short durabilityMax; |
|
|
|
|
|
|
|
private byte chargesMax; |
|
|
|
|
|
|
|
private final ConcurrentHashMap<AbstractEffectModifier, Float> bonuses = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
|
|
private final ConcurrentHashMap<AbstractEffectModifier, Float> bonuses = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
|
|
private final ArrayList<String> effectNames = new ArrayList<>(); |
|
|
|
private final ArrayList<String> effectNames = new ArrayList<>(); |
|
|
|
public Enum.ItemContainerType containerType; |
|
|
|
public Enum.ItemContainerType containerType; |
|
|
@ -87,7 +85,11 @@ public class Item extends AbstractWorldObject { |
|
|
|
super(rs); |
|
|
|
super(rs); |
|
|
|
|
|
|
|
|
|
|
|
this.templsteID = rs.getInt("item_itemBaseID"); |
|
|
|
this.templsteID = rs.getInt("item_itemBaseID"); |
|
|
|
|
|
|
|
this.template = ItemTemplate.itemTemplates.get(this.templsteID); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.template == null) |
|
|
|
|
|
|
|
Logger.error("Null template of " + this.templsteID) |
|
|
|
|
|
|
|
; |
|
|
|
// Set container enumeration
|
|
|
|
// Set container enumeration
|
|
|
|
|
|
|
|
|
|
|
|
String container = rs.getString("item_container"); |
|
|
|
String container = rs.getString("item_container"); |
|
|
@ -115,15 +117,9 @@ public class Item extends AbstractWorldObject { |
|
|
|
|
|
|
|
|
|
|
|
this.ownerID = rs.getInt("parent"); |
|
|
|
this.ownerID = rs.getInt("parent"); |
|
|
|
|
|
|
|
|
|
|
|
if (this.getItemBase() != null) |
|
|
|
|
|
|
|
this.chargesMax = (byte) this.getItemBase().getNumCharges(); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
this.chargesMax = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.chargesRemaining = rs.getByte("item_chargesRemaining"); |
|
|
|
this.chargesRemaining = rs.getByte("item_chargesRemaining"); |
|
|
|
|
|
|
|
|
|
|
|
this.durabilityCurrent = rs.getShort("item_durabilityCurrent"); |
|
|
|
this.durabilityCurrent = rs.getShort("item_durabilityCurrent"); |
|
|
|
this.durabilityMax = rs.getShort("item_durabilityMax"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DbObjectType ownerType; |
|
|
|
DbObjectType ownerType; |
|
|
|
ownerType = DbManager.BuildingQueries.GET_UID_ENUM(this.ownerID); |
|
|
|
ownerType = DbManager.BuildingQueries.GET_UID_ENUM(this.ownerID); |
|
|
@ -221,7 +217,7 @@ public class Item extends AbstractWorldObject { |
|
|
|
writer.putString(item.customName); // Unknown. pad?
|
|
|
|
writer.putString(item.customName); // Unknown. pad?
|
|
|
|
writer.put((byte) 1); // End Datablock byte
|
|
|
|
writer.put((byte) 1); // End Datablock byte
|
|
|
|
|
|
|
|
|
|
|
|
writer.putFloat((float) item.durabilityMax); |
|
|
|
writer.putFloat(item.template.item_health_full); |
|
|
|
writer.putFloat((float) item.durabilityCurrent); |
|
|
|
writer.putFloat((float) item.durabilityCurrent); |
|
|
|
|
|
|
|
|
|
|
|
writer.put((byte) 1); // End Datablock byte
|
|
|
|
writer.put((byte) 1); // End Datablock byte
|
|
|
@ -708,18 +704,10 @@ public class Item extends AbstractWorldObject { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public byte getChargesMax() { |
|
|
|
|
|
|
|
return chargesMax; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setDurabilityCurrent(float value) { |
|
|
|
public void setDurabilityCurrent(float value) { |
|
|
|
this.durabilityCurrent = value; |
|
|
|
this.durabilityCurrent = value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public short getDurabilityMax() { |
|
|
|
|
|
|
|
return durabilityMax; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isCanDestroy() { |
|
|
|
public boolean isCanDestroy() { |
|
|
|
return canDestroy; |
|
|
|
return canDestroy; |
|
|
|
} |
|
|
|
} |
|
|
|