|
|
@ -55,7 +55,6 @@ public class Item extends AbstractWorldObject { |
|
|
|
public int templateID; |
|
|
|
public int templateID; |
|
|
|
private AbstractWorldObject lastOwner; |
|
|
|
private AbstractWorldObject lastOwner; |
|
|
|
private long dateToUpgrade; |
|
|
|
private long dateToUpgrade; |
|
|
|
private String customName = ""; |
|
|
|
|
|
|
|
private int magicValue; |
|
|
|
private int magicValue; |
|
|
|
public ItemTemplate template; |
|
|
|
public ItemTemplate template; |
|
|
|
public String name; |
|
|
|
public String name; |
|
|
@ -69,6 +68,7 @@ public class Item extends AbstractWorldObject { |
|
|
|
super(); |
|
|
|
super(); |
|
|
|
this.templateID = templateID; |
|
|
|
this.templateID = templateID; |
|
|
|
this.template = ItemTemplate.templates.get(templateID); |
|
|
|
this.template = ItemTemplate.templates.get(templateID); |
|
|
|
|
|
|
|
this.name = this.template.item_base_name; |
|
|
|
this.chargesRemaining = this.template.item_initial_charges; |
|
|
|
this.chargesRemaining = this.template.item_initial_charges; |
|
|
|
this.durabilityCurrent = this.template.combat_health_full; |
|
|
|
this.durabilityCurrent = this.template.combat_health_full; |
|
|
|
this.equipSlot = EquipSlotType.NONE; |
|
|
|
this.equipSlot = EquipSlotType.NONE; |
|
|
@ -88,8 +88,15 @@ public class Item extends AbstractWorldObject { |
|
|
|
this.template = ItemTemplate.templates.get(this.templateID); |
|
|
|
this.template = ItemTemplate.templates.get(this.templateID); |
|
|
|
|
|
|
|
|
|
|
|
if (this.template == null) |
|
|
|
if (this.template == null) |
|
|
|
Logger.error("Null template of " + this.templateID) |
|
|
|
Logger.error("Null template of " + this.templateID); |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
this.name = rs.getString("item_name"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.name == null) |
|
|
|
|
|
|
|
this.name = this.template.item_base_name; |
|
|
|
|
|
|
|
else if (this.name.isEmpty()) |
|
|
|
|
|
|
|
this.name = this.template.item_base_name; |
|
|
|
|
|
|
|
|
|
|
|
// Set container enumeration
|
|
|
|
// Set container enumeration
|
|
|
|
|
|
|
|
|
|
|
|
String container = rs.getString("item_container"); |
|
|
|
String container = rs.getString("item_container"); |
|
|
@ -145,8 +152,6 @@ public class Item extends AbstractWorldObject { |
|
|
|
this.flags = rs.getInt("item_flags"); |
|
|
|
this.flags = rs.getInt("item_flags"); |
|
|
|
this.dateToUpgrade = rs.getLong("item_dateToUpgrade"); |
|
|
|
this.dateToUpgrade = rs.getLong("item_dateToUpgrade"); |
|
|
|
this.value = rs.getInt("item_value"); |
|
|
|
this.value = rs.getInt("item_value"); |
|
|
|
this.customName = rs.getString("item_name"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -213,10 +218,7 @@ public class Item extends AbstractWorldObject { |
|
|
|
writer.putInt(itemColor); |
|
|
|
writer.putInt(itemColor); |
|
|
|
|
|
|
|
|
|
|
|
writer.put((byte) 1); // End Datablock byte
|
|
|
|
writer.put((byte) 1); // End Datablock byte
|
|
|
|
if (item.customName.isEmpty() || item.customName.isEmpty()) { |
|
|
|
writer.putString(item.name); // Unknown. pad?
|
|
|
|
writer.putInt(0); |
|
|
|
|
|
|
|
} else |
|
|
|
|
|
|
|
writer.putString(item.customName); // Unknown. pad?
|
|
|
|
|
|
|
|
writer.put((byte) 1); // End Datablock byte
|
|
|
|
writer.put((byte) 1); // End Datablock byte
|
|
|
|
|
|
|
|
|
|
|
|
writer.putFloat(item.template.item_health_full); |
|
|
|
writer.putFloat(item.template.item_health_full); |
|
|
@ -655,10 +657,6 @@ public class Item extends AbstractWorldObject { |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String getCustomName() { |
|
|
|
|
|
|
|
return customName; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ItemBase getItemBase() { |
|
|
|
public ItemBase getItemBase() { |
|
|
|
return ItemBase.getItemBase(templateID); |
|
|
|
return ItemBase.getItemBase(templateID); |
|
|
|
} |
|
|
|
} |
|
|
@ -1006,21 +1004,6 @@ public class Item extends AbstractWorldObject { |
|
|
|
return this.magicValue; |
|
|
|
return this.magicValue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public String getName() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.customName.isEmpty() == false) |
|
|
|
|
|
|
|
return this.customName; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ItemTemplate template = ItemTemplate.templates.get(this.getTemplateID()); |
|
|
|
|
|
|
|
return template.item_base_name; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setName(String name) { |
|
|
|
|
|
|
|
this.customName = name; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void applyBakedInStats() { |
|
|
|
private void applyBakedInStats() { |
|
|
|
|
|
|
|
|
|
|
|
EffectsBase effect; |
|
|
|
EffectsBase effect; |
|
|
|