diff --git a/src/engine/db/handlers/dbItemBaseHandler.java b/src/engine/db/handlers/dbItemBaseHandler.java index c7a97a3e..52c8f8ae 100644 --- a/src/engine/db/handlers/dbItemBaseHandler.java +++ b/src/engine/db/handlers/dbItemBaseHandler.java @@ -26,34 +26,6 @@ public class dbItemBaseHandler extends dbHandlerBase { } - public void LOAD_ANIMATIONS(ItemBase itemBase) { - - ArrayList tempList = new ArrayList<>(); - ArrayList tempListOff = new ArrayList<>(); - - try (Connection connection = DbManager.getConnection(); - PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_itembase_animations` WHERE `itemBaseUUID` = ?")) { - - preparedStatement.setInt(1, itemBase.getUUID()); - ResultSet rs = preparedStatement.executeQuery(); - - while (rs.next()) { - int animation = rs.getInt("animation"); - boolean rightHand = rs.getBoolean("rightHand"); - - if (rightHand) - tempList.add(animation); - else - tempListOff.add(animation); - } - } catch (SQLException e) { - Logger.error(e); - } - - itemBase.setAnimations(tempList); - itemBase.setOffHandAnimations(tempListOff); - } - public void LOAD_ALL_ITEMBASES() { ItemBase itemBase; diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index b24d484a..595af2be 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -982,66 +982,66 @@ public enum CombatManager { if (wb == null) return 75; + ItemTemplate template = ItemTemplate.itemTemplates.get(wb.getUUID()); + if (mainHand) { - if (wb.getAnimations().size() > 0) { + if (template.weapon_attack_anim_right.size() > 0) { int animation; - int random = ThreadLocalRandom.current().nextInt(wb.getAnimations().size()); + int random = ThreadLocalRandom.current().nextInt(template.weapon_attack_anim_right.size()); try { - animation = wb.getAnimations().get(random); + animation = template.weapon_attack_anim_right.get(random)[0]; return animation; } catch (Exception e) { Logger.error(e.getMessage()); - return wb.getAnimations().get(0); + return template.weapon_attack_anim_right.get(0)[0]; } - } else if (wb.getOffHandAnimations().size() > 0) { + } else if (template.weapon_attack_anim_left.size() > 0) { int animation; - int random = ThreadLocalRandom.current().nextInt(wb.getOffHandAnimations().size()); + int random = ThreadLocalRandom.current().nextInt(template.weapon_attack_anim_left.size()); try { - animation = wb.getOffHandAnimations().get(random); + animation = template.weapon_attack_anim_left.get(random)[0]; return animation; } catch (Exception e) { Logger.error(e.getMessage()); - return wb.getOffHandAnimations().get(0); + return template.weapon_attack_anim_right.get(0)[0]; } } } else { - if (wb.getOffHandAnimations().size() > 0) { + if (template.weapon_attack_anim_left.size() > 0) { int animation; - int random = ThreadLocalRandom.current().nextInt(wb.getOffHandAnimations().size()); + int random = ThreadLocalRandom.current().nextInt(template.weapon_attack_anim_left.size()); try { - animation = wb.getOffHandAnimations().get(random); + animation = template.weapon_attack_anim_left.get(random)[0]; return animation; } catch (Exception e) { Logger.error(e.getMessage()); - return wb.getOffHandAnimations().get(0); + return template.weapon_attack_anim_right.get(0)[0]; } - } else if (wb.getAnimations().size() > 0) { + } else if (template.weapon_attack_anim_left.size() > 0) { int animation; - int random = ThreadLocalRandom.current().nextInt(wb.getAnimations().size()); + int random = ThreadLocalRandom.current().nextInt(template.weapon_attack_anim_left.size()); try { - animation = wb.getAnimations().get(random); + animation = template.weapon_attack_anim_left.get(random)[0]; return animation; } catch (Exception e) { Logger.error(e.getMessage()); - return wb.getAnimations().get(0); + return template.weapon_attack_anim_right.get(0)[0]; } } } - ItemTemplate template = ItemTemplate.itemTemplates.get(wb.getUUID()); - String required = template.item_skill_used; String mastery = wb.getMastery(); diff --git a/src/engine/objects/ItemBase.java b/src/engine/objects/ItemBase.java index 5fbc273e..e86038bc 100644 --- a/src/engine/objects/ItemBase.java +++ b/src/engine/objects/ItemBase.java @@ -42,8 +42,6 @@ public class ItemBase { private final engine.Enum.SourceType damageType; private boolean isConsumable; private final boolean isStrBased; - private ArrayList animations = new ArrayList<>(); - private ArrayList offHandAnimations = new ArrayList<>(); public ItemBase(ResultSet rs) throws SQLException { @@ -84,12 +82,6 @@ public class ItemBase { this.isConsumable = true; break; } - - try { - DbManager.ItemBaseQueries.LOAD_ANIMATIONS(this); - } catch (Exception e) { - Logger.error(e.getMessage()); - } initializeHashes(); } @@ -204,7 +196,6 @@ public class ItemBase { public short getMinDamage() { return minDamage; } - public Enum.SourceType getDamageType() { return damageType; } @@ -213,20 +204,4 @@ public class ItemBase { return percentRequired; } - public ArrayList getAnimations() { - return animations; - } - - public void setAnimations(ArrayList animations) { - this.animations = animations; - } - - public ArrayList getOffHandAnimations() { - return offHandAnimations; - } - - public void setOffHandAnimations(ArrayList offHandAnimations) { - this.offHandAnimations = offHandAnimations; - } - }