diff --git a/src/engine/db/handlers/dbItemBaseHandler.java b/src/engine/db/handlers/dbItemBaseHandler.java index e1b11523..c7a97a3e 100644 --- a/src/engine/db/handlers/dbItemBaseHandler.java +++ b/src/engine/db/handlers/dbItemBaseHandler.java @@ -26,25 +26,6 @@ public class dbItemBaseHandler extends dbHandlerBase { } - public void LOAD_BAKEDINSTATS(ItemBase itemBase) { - - try (Connection connection = DbManager.getConnection(); - PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_bakedinstat` WHERE `itemID` = ?")) { - - preparedStatement.setInt(1, itemBase.getUUID()); - ResultSet rs = preparedStatement.executeQuery(); - - while (rs.next()) { - if (rs.getBoolean("fromUse")) - itemBase.getUsedStats().put(rs.getInt("token"), rs.getInt("numTrains")); - else - itemBase.getBakedInStats().put(rs.getInt("token"), rs.getInt("numTrains")); - } - } catch (SQLException e) { - Logger.error(e); - } - } - public void LOAD_ANIMATIONS(ItemBase itemBase) { ArrayList tempList = new ArrayList<>(); diff --git a/src/engine/objects/Item.java b/src/engine/objects/Item.java index 24838310..15323491 100644 --- a/src/engine/objects/Item.java +++ b/src/engine/objects/Item.java @@ -76,7 +76,7 @@ public class Item extends AbstractWorldObject { this.containerType = ItemContainerType.NONE; this.numberOfItems = 1; loadEnchantments(); - bakeInStats(); + applyBakedInStats(); } /** @@ -1022,25 +1022,25 @@ public class Item extends AbstractWorldObject { this.customName = name; } - private void bakeInStats() { + private void applyBakedInStats() { EffectsBase effect; if (ConfigManager.serverType.equals(Enum.ServerType.LOGINSERVER)) return; - if (this.getItemBase() != null) - for (Integer token : this.getItemBase().getBakedInStats().keySet()) { + for (String effectID : this.template.item_user_power_action.keySet()) { - effect = PowersManager.getEffectByToken(token); + effect = PowersManager.getEffectByIDString(effectID); - if (effect == null) { - Logger.error("missing effect of token " + token); - continue; - } - AbstractPowerAction apa = PowersManager.getPowerActionByIDString(effect.getIDString()); - apa.applyBakedInStatsForItem(this, this.getItemBase().getBakedInStats().get(token)); + if (effect == null) { + Logger.error("missing effect of type: " + effectID); + continue; + } + + AbstractPowerAction apa = PowersManager.getPowerActionByIDString(effect.getIDString()); + apa.applyBakedInStatsForItem(this, this.template.item_user_power_action.get(effectID)[0]); } } @@ -1123,7 +1123,7 @@ public class Item extends AbstractWorldObject { @Override public void runAfterLoad() { loadEnchantments(); - bakeInStats(); + applyBakedInStats(); } diff --git a/src/engine/objects/ItemBase.java b/src/engine/objects/ItemBase.java index 08fc5840..b19207c0 100644 --- a/src/engine/objects/ItemBase.java +++ b/src/engine/objects/ItemBase.java @@ -99,7 +99,6 @@ public class ItemBase { } catch (Exception e) { Logger.error(e.getMessage()); } - initBakedInStats(); initializeHashes(); } @@ -152,10 +151,6 @@ public class ItemBase { DbManager.ItemBaseQueries.LOAD_ALL_ITEMBASES(); } - private void initBakedInStats() { - DbManager.ItemBaseQueries.LOAD_BAKEDINSTATS(this); - } - public boolean isConsumable() { return this.isConsumable; }