From f53c2c5cb070434a75d640c548e57f69139b558a Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 24 Apr 2024 21:43:48 -0500 Subject: [PATCH] vorg fix --- src/engine/db/handlers/dbItemBaseHandler.java | 59 ++++++++++++++++++- src/engine/objects/Item.java | 28 +-------- src/engine/objects/ItemBase.java | 44 +------------- src/engine/objects/MobLoot.java | 2 - 4 files changed, 60 insertions(+), 73 deletions(-) diff --git a/src/engine/db/handlers/dbItemBaseHandler.java b/src/engine/db/handlers/dbItemBaseHandler.java index d474a2c0..41f0e343 100644 --- a/src/engine/db/handlers/dbItemBaseHandler.java +++ b/src/engine/db/handlers/dbItemBaseHandler.java @@ -28,10 +28,67 @@ public class dbItemBaseHandler extends dbHandlerBase { public void LOAD_BAKEDINSTATS(ItemBase itemBase) { + int itemBaseID = itemBase.getUUID(); + switch(itemBaseID){ + case 27550://bow + case 27560://dagger + case 27570://hammer + case 27580://axe + case 27590://sword + //return new String[]{"PRE-010","SUF-260"}; + itemBaseID = 8000000; + break; + case 27600://staff + //return new String[]{"PRE-334","PRE-315"}; + itemBaseID = 8000010; + break; + + case 188500://HA chest + case 188510://HA arms + case 188520://HA legs + case 188530://HA gloves + case 188550://HA helm + case 188720://CC hood + case 188900://MA chest + case 188910://MA Sleeves + case 188920://MA Legs + case 188930://MA gloves + case 188950://MA helm + case 189100://la chest + case 189110://la arms + case 189120://la legs + case 189130://la gloves + case 189150://la helm + case 189550://CC gloves + //return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222", "SUF-007"}; + itemBaseID = 8000020; + break; + + case 188540://HA boots + case 188940://MA boots + case 189140://LA boots + case 189560://CC boots + //return new String[]{"PRE-133", "PRE-230", "PRE-210", "PRE-220", "SUF-003","SUF-150"}; + itemBaseID = 8000030; + break; + + case 188700://CC robe + //return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222","SUF-317","SUF-317","SUF-317"}; + itemBaseID = 8000040; + break; + + case 189500://MA shield + case 189510://HA shield + //return new String[]{"PRE-125","PRE-125","PRE-125", "PRE-230", "PRE-210", "PRE-220"}; + itemBaseID = 8000050; + } + + + try (Connection connection = DbManager.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_bakedinstat` WHERE `itemID` = ?")) { - preparedStatement.setInt(1, itemBase.getUUID()); + preparedStatement.setInt(1, itemBaseID); ResultSet rs = preparedStatement.executeQuery(); while (rs.next()) { diff --git a/src/engine/objects/Item.java b/src/engine/objects/Item.java index d25fe6fa..b5e6b71b 100644 --- a/src/engine/objects/Item.java +++ b/src/engine/objects/Item.java @@ -96,10 +96,7 @@ public class Item extends AbstractWorldObject { this.customName = name; loadEnchantments(); - if(this.getItemBase().isVorg() == false) - bakeInStats(); - else - Item.BakeVorgStats(this); + bakeInStats(); } public Item(ItemBase itemBase, int ownerID, @@ -131,8 +128,6 @@ public class Item extends AbstractWorldObject { loadEnchantments(); bakeInStats(); - if(this.getItemBase().isVorg()) - Item.BakeVorgStats(this); } /** @@ -165,8 +160,6 @@ public class Item extends AbstractWorldObject { loadEnchantments(); bakeInStats(); - if(this.getItemBase().isVorg()) - Item.BakeVorgStats(this); } /** @@ -240,8 +233,6 @@ public class Item extends AbstractWorldObject { this.value = rs.getInt("item_value"); this.customName = rs.getString("item_name"); - if(this.getItemBase().isVorg()) - Item.BakeVorgStats(this); } public static void _serializeForClientMsg(Item item, ByteBufferWriter writer) @@ -634,8 +625,6 @@ public class Item extends AbstractWorldObject { } catch (Exception e) { Logger.error(e); } - if(item.getItemBase().isVorg()) - Item.BakeVorgStats(item); return item; } @@ -676,21 +665,6 @@ public class Item extends AbstractWorldObject { } return item; } - - public static void BakeVorgStats(Item item){ - if (item.getItemBase().isVorg()) { - item.getEnchants().clear(); - for (String powerString : item.getItemBase().getVorgStats()) { - try { - item.addPermanentEnchantment(powerString, 0); - } - catch(Exception e){ - Logger.error("Couldn't find enchantment for: " + powerString); - } - } - item.setName(item.getItemBase().getName()); - } - } public static Item getFromCache(int id) { return (Item) DbManager.getFromCache(GameObjectType.Item, id); } diff --git a/src/engine/objects/ItemBase.java b/src/engine/objects/ItemBase.java index 32af5c53..8b108c50 100644 --- a/src/engine/objects/ItemBase.java +++ b/src/engine/objects/ItemBase.java @@ -926,49 +926,7 @@ public class ItemBase{ } public String[] getVorgStats() { - switch(this.uuid){ - case 27550://bow - case 27560://dagger - case 27570://hammer - case 27580://axe - case 27590://sword - return new String[]{"PRE-010","SUF-260"}; - - case 27600://staff - return new String[]{"PRE-334","PRE-315"}; - - case 188500://HA chest - case 188510://HA arms - case 188520://HA legs - case 188530://HA gloves - case 188550://HA helm - case 188720://CC hood - case 188900://MA chest - case 188910://MA Sleeves - case 188920://MA Legs - case 188930://MA gloves - case 188950://MA helm - case 189100://la chest - case 189110://la arms - case 189120://la legs - case 189130://la gloves - case 189150://la helm - case 189550://CC gloves - return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222", "SUF-007"}; - - case 188540://HA boots - case 188940://MA boots - case 189140://LA boots - case 189560://CC boots - return new String[]{"PRE-133", "PRE-230", "PRE-210", "PRE-220", "SUF-003","SUF-150"}; - - case 188700://CC robe - return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222","SUF-317","SUF-317","SUF-317"}; - - case 189500://MA shield - case 189510://HA shield - return new String[]{"PRE-125","PRE-125","PRE-125", "PRE-230", "PRE-210", "PRE-220"}; - } + return new String[]{}; } } diff --git a/src/engine/objects/MobLoot.java b/src/engine/objects/MobLoot.java index fa757c48..235eccd1 100644 --- a/src/engine/objects/MobLoot.java +++ b/src/engine/objects/MobLoot.java @@ -164,8 +164,6 @@ public final class MobLoot extends Item { item.addPermanentEnchantment(this.suffix, 0); this.junk(); - if(item.getItemBase().isVorg()) - Item.BakeVorgStats(item); return item; }