Browse Source

Templates backfilled with modtable data

combat-2
MagicBot 8 months ago
parent
commit
230679cef9
  1. 17
      src/engine/db/handlers/dbItemHandler.java
  2. 9
      src/engine/net/client/msg/ManageNPCMsg.java
  3. 3
      src/engine/objects/ItemFactory.java
  4. 1
      src/engine/objects/ItemTemplate.java
  5. 3
      src/engine/server/login/LoginServer.java
  6. 3
      src/engine/server/world/WorldServer.java

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

@ -193,9 +193,26 @@ public class dbItemHandler extends dbHandlerBase { @@ -193,9 +193,26 @@ public class dbItemHandler extends dbHandlerBase {
} catch (Exception e) {
Logger.error(e);
}
}
public void LOAD_TEMPLATE_MODTABLES() {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_vendor_items`;");
ResultSet rs = preparedStatement.executeQuery()) {
while (rs.next()) {
int templateID = rs.getInt("templateID");
int modTable = rs.getInt("modTable");
ItemTemplate template = ItemTemplate.templates.get(templateID);
template.modTable = modTable;
}
} catch (Exception e) {
Logger.error(e);
}
}
public Item GET_ITEM(final int itemUUID) {
Item item;

9
src/engine/net/client/msg/ManageNPCMsg.java

@ -422,7 +422,6 @@ public class ManageNPCMsg extends ClientNetMsg { @@ -422,7 +422,6 @@ public class ManageNPCMsg extends ClientNetMsg {
writer.putInt(rollableSet.size());
for (int templateID : rollableSet) {
ItemBase item = ItemBase.getItemBase(templateID);
ItemTemplate template = ItemTemplate.templates.get(templateID);
writer.put((byte) 1);
writer.putInt(0);
@ -430,10 +429,10 @@ public class ManageNPCMsg extends ClientNetMsg { @@ -430,10 +429,10 @@ public class ManageNPCMsg extends ClientNetMsg {
writer.putInt(template.item_value);
writer.putInt(600);
writer.put((byte) 1);
writer.put((byte) item.getModTable());
writer.put((byte) item.getModTable());
writer.put((byte) item.getModTable());
writer.put((byte) item.getModTable());//EffectItemType
writer.put((byte) template.modTable);
writer.put((byte) template.modTable);
writer.put((byte) template.modTable);
writer.put((byte) template.modTable);//EffectItemType
}
List<MobLoot> itemList = npc.getRolling();

3
src/engine/objects/ItemFactory.java

@ -640,7 +640,6 @@ public class ItemFactory { @@ -640,7 +640,6 @@ public class ItemFactory {
ModTableEntry prefixEntry = null;
ModTableEntry suffixEntry = null;
ItemBase ib = ItemBase.getItemBase(templateID);
ItemTemplate template = ItemTemplate.templates.get(templateID);
if (template == null)
@ -654,7 +653,7 @@ public class ItemFactory { @@ -654,7 +653,7 @@ public class ItemFactory {
return null;
}
itemModTable = (byte) ib.getModTable();
itemModTable = (byte) template.modTable;
if (!vendor.getItemModTable().contains(itemModTable)) {

1
src/engine/objects/ItemTemplate.java

@ -84,6 +84,7 @@ public class ItemTemplate { @@ -84,6 +84,7 @@ public class ItemTemplate {
public static HashMap<String, Integer> item_power_grant = new HashMap<>();
public HashMap<String, int[]> item_power_action = new HashMap<>();
public HashMap<Enum.ResourceType, Integer> item_resource_cost = new HashMap<>();
public int modTable;
// Deed related fields

3
src/engine/server/login/LoginServer.java

@ -263,9 +263,6 @@ public class LoginServer { @@ -263,9 +263,6 @@ public class LoginServer {
Logger.info("Initializing Blueprint data.");
Blueprint.loadAllBlueprints();
Logger.info("Loading Item Templates");
DbManager.ItemQueries.LOAD_ITEM_TEMPLATES();
Logger.info("Loading Kits");
DbManager.KitQueries.GET_ALL_KITS();

3
src/engine/server/world/WorldServer.java

@ -343,6 +343,9 @@ public class WorldServer { @@ -343,6 +343,9 @@ public class WorldServer {
Logger.info("Loading Item Templates");
DbManager.ItemQueries.LOAD_ITEM_TEMPLATES();
Logger.info("Back fill template modTables");
DbManager.ItemQueries.LOAD_TEMPLATE_MODTABLES();
Logger.info("Loading ItemBases");
ItemBase.loadAllItemBases();

Loading…
Cancel
Save