Browse Source

Template id back-filled when created.

combat-2
MagicBot 9 months ago
parent
commit
37af60781d
  1. 1
      src/engine/db/handlers/dbItemHandler.java
  2. 2
      src/engine/objects/ItemTemplate.java

1
src/engine/db/handlers/dbItemHandler.java

@ -179,6 +179,7 @@ public class dbItemHandler extends dbHandlerBase { @@ -179,6 +179,7 @@ public class dbItemHandler extends dbHandlerBase {
int templateID = rs.getInt("id");
JSONObject jsonObject = (JSONObject) jsonParser.parse(rs.getString("template"));
ItemTemplate itemTemplate = new ItemTemplate(jsonObject);
itemTemplate.template_id = templateID;
ItemTemplate.itemTemplates.put(templateID, itemTemplate);
}

2
src/engine/objects/ItemTemplate.java

@ -23,6 +23,8 @@ public class ItemTemplate { @@ -23,6 +23,8 @@ public class ItemTemplate {
// Global template lookup
public static HashMap<Integer, ItemTemplate> itemTemplates = new HashMap<>();
public int template_id;
// Template Properties
public String obj_name;
public boolean obj_pickable;

Loading…
Cancel
Save