Browse Source

Refactor out itembase

combat-2
MagicBot 8 months ago
parent
commit
561b80b1aa
  1. 4
      src/engine/objects/Item.java
  2. 16
      src/engine/objects/ItemBase.java
  3. 2
      src/engine/objects/ItemTemplate.java

4
src/engine/objects/Item.java

@ -637,10 +637,6 @@ public class Item extends AbstractWorldObject { @@ -637,10 +637,6 @@ public class Item extends AbstractWorldObject {
return 0;
}
public ItemBase getItemBase() {
return ItemBase.getItemBase(templateID);
}
public int getTemplateID() {
return this.templateID;
}

16
src/engine/objects/ItemBase.java

@ -22,17 +22,10 @@ public class ItemBase { @@ -22,17 +22,10 @@ public class ItemBase {
public static HashMap<Integer, ItemBase> _itemBaseByUUID = new HashMap<>();
public final int uuid;
private final int modTable;
public ItemBase(ResultSet rs) throws SQLException {
this.uuid = rs.getInt("ID");
this.modTable = rs.getInt("modTable");
ItemTemplate template = ItemTemplate.templates.get(this.getUUID());
if (template == null)
Logger.error(this.getUUID() + " null template");
}
@ -46,11 +39,6 @@ public class ItemBase { @@ -46,11 +39,6 @@ public class ItemBase {
Logger.error("Null template for: " + itemBase.uuid);
}
public static ItemBase getItemBase(int uuid) {
return _itemBaseByUUID.get(uuid);
}
public static HashMap<Integer, ItemBase> getUUIDCache() {
return _itemBaseByUUID;
}
@ -60,10 +48,6 @@ public class ItemBase { @@ -60,10 +48,6 @@ public class ItemBase {
}
public int getModTable() {
return modTable;
}
public final int getUUID() {
return uuid;
}

2
src/engine/objects/ItemTemplate.java

@ -579,7 +579,7 @@ public class ItemTemplate { @@ -579,7 +579,7 @@ public class ItemTemplate {
//players can't wear 0 value items.
return item.template.item_value != 0 || Kit.IsNoobGear(item.getItemBase().uuid);
return item.template.item_value != 0 || Kit.IsNoobGear(item.templateID);
}
}

Loading…
Cancel
Save