Browse Source

vorg fix

lakebane-master
FatBoy-DOTC 8 months ago
parent
commit
f53c2c5cb0
  1. 59
      src/engine/db/handlers/dbItemBaseHandler.java
  2. 26
      src/engine/objects/Item.java
  3. 44
      src/engine/objects/ItemBase.java
  4. 2
      src/engine/objects/MobLoot.java

59
src/engine/db/handlers/dbItemBaseHandler.java

@ -28,10 +28,67 @@ public class dbItemBaseHandler extends dbHandlerBase {
public void LOAD_BAKEDINSTATS(ItemBase itemBase) { 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(); try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_bakedinstat` WHERE `itemID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_bakedinstat` WHERE `itemID` = ?")) {
preparedStatement.setInt(1, itemBase.getUUID()); preparedStatement.setInt(1, itemBaseID);
ResultSet rs = preparedStatement.executeQuery(); ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) { while (rs.next()) {

26
src/engine/objects/Item.java

@ -96,10 +96,7 @@ public class Item extends AbstractWorldObject {
this.customName = name; this.customName = name;
loadEnchantments(); loadEnchantments();
if(this.getItemBase().isVorg() == false)
bakeInStats(); bakeInStats();
else
Item.BakeVorgStats(this);
} }
public Item(ItemBase itemBase, int ownerID, public Item(ItemBase itemBase, int ownerID,
@ -131,8 +128,6 @@ public class Item extends AbstractWorldObject {
loadEnchantments(); loadEnchantments();
bakeInStats(); bakeInStats();
if(this.getItemBase().isVorg())
Item.BakeVorgStats(this);
} }
/** /**
@ -165,8 +160,6 @@ public class Item extends AbstractWorldObject {
loadEnchantments(); loadEnchantments();
bakeInStats(); bakeInStats();
if(this.getItemBase().isVorg())
Item.BakeVorgStats(this);
} }
/** /**
@ -240,8 +233,6 @@ public class Item extends AbstractWorldObject {
this.value = rs.getInt("item_value"); this.value = rs.getInt("item_value");
this.customName = rs.getString("item_name"); this.customName = rs.getString("item_name");
if(this.getItemBase().isVorg())
Item.BakeVorgStats(this);
} }
public static void _serializeForClientMsg(Item item, ByteBufferWriter writer) public static void _serializeForClientMsg(Item item, ByteBufferWriter writer)
@ -634,8 +625,6 @@ public class Item extends AbstractWorldObject {
} catch (Exception e) { } catch (Exception e) {
Logger.error(e); Logger.error(e);
} }
if(item.getItemBase().isVorg())
Item.BakeVorgStats(item);
return item; return item;
} }
@ -676,21 +665,6 @@ public class Item extends AbstractWorldObject {
} }
return item; 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) { public static Item getFromCache(int id) {
return (Item) DbManager.getFromCache(GameObjectType.Item, id); return (Item) DbManager.getFromCache(GameObjectType.Item, id);
} }

44
src/engine/objects/ItemBase.java

@ -926,49 +926,7 @@ public class ItemBase{
} }
public String[] getVorgStats() { 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[]{}; return new String[]{};
} }
} }

2
src/engine/objects/MobLoot.java

@ -164,8 +164,6 @@ public final class MobLoot extends Item {
item.addPermanentEnchantment(this.suffix, 0); item.addPermanentEnchantment(this.suffix, 0);
this.junk(); this.junk();
if(item.getItemBase().isVorg())
Item.BakeVorgStats(item);
return item; return item;
} }

Loading…
Cancel
Save