From f523e4832eb588de4bf1cba0ed2c11206d48d6b1 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 25 Mar 2024 05:25:09 -0400 Subject: [PATCH] Variable renamed to conform with json --- src/engine/db/handlers/dbItemHandler.java | 4 ++-- src/engine/gameManager/LootManager.java | 2 +- src/engine/net/client/handlers/RepairMsgHandler.java | 6 +++--- .../net/client/handlers/VendorSellMsgHandler.java | 2 +- src/engine/objects/CharacterItemManager.java | 4 ++-- src/engine/objects/Item.java | 12 ++++++------ 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/engine/db/handlers/dbItemHandler.java b/src/engine/db/handlers/dbItemHandler.java index 44749b5d..51aac5ab 100644 --- a/src/engine/db/handlers/dbItemHandler.java +++ b/src/engine/db/handlers/dbItemHandler.java @@ -65,7 +65,7 @@ public class dbItemHandler extends dbHandlerBase { preparedStatement.setInt(1, toAdd.ownerID); preparedStatement.setInt(2, toAdd.getTemplateID()); preparedStatement.setInt(3, (byte) toAdd.chargesRemaining); - preparedStatement.setInt(4, (short) toAdd.durabilityCurrent); + preparedStatement.setInt(4, (short) toAdd.combat_health_current); preparedStatement.setInt(5, (int) toAdd.template.item_health_full); if (toAdd.getNumOfItems() < 1) @@ -401,7 +401,7 @@ public class dbItemHandler extends dbHandlerBase { preparedStatement.setInt(1, value); preparedStatement.setLong(2, item.getObjectUUID()); - preparedStatement.setInt(3, (short) item.durabilityCurrent); + preparedStatement.setInt(3, (short) item.combat_health_current); return (preparedStatement.executeUpdate() > 0); diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index 156e1efa..b20fe1cc 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -352,7 +352,7 @@ public enum LootManager { if (ml != null && dropCount < 1) { ml.flags.add(Enum.ItemFlags.Identified); - ml.setDurabilityCurrent((short) ((short) ml.durabilityCurrent - ThreadLocalRandom.current().nextInt(5) + 1)); + ml.setCombat_health_current((short) ((short) ml.combat_health_current - ThreadLocalRandom.current().nextInt(5) + 1)); mob.charItemManager.addItemToInventory(ml); dropCount = 1; //break; // Exit on first successful roll. diff --git a/src/engine/net/client/handlers/RepairMsgHandler.java b/src/engine/net/client/handlers/RepairMsgHandler.java index 144b483d..12abbbb6 100644 --- a/src/engine/net/client/handlers/RepairMsgHandler.java +++ b/src/engine/net/client/handlers/RepairMsgHandler.java @@ -85,7 +85,7 @@ public class RepairMsgHandler extends AbstractClientMsgHandler { //make sure item is damaged and not destroyed - short dur = (short) toRepair.durabilityCurrent; + short dur = (short) toRepair.combat_health_current; short max = (short) toRepair.template.item_health_full; //account for durability modifications @@ -95,7 +95,7 @@ public class RepairMsgHandler extends AbstractClientMsgHandler { if (dur >= max || dur < 1) { //redundancy message to clear item from window in client - toRepair.setDurabilityCurrent(max); + toRepair.setCombat_health_current(max); repairMsg.setupRepairAck(max - dur); dispatch = Dispatch.borrow(player, repairMsg); DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); @@ -142,7 +142,7 @@ public class RepairMsgHandler extends AbstractClientMsgHandler { //repair the item - toRepair.setDurabilityCurrent(max); + toRepair.setCombat_health_current(max); //send repair msg diff --git a/src/engine/net/client/handlers/VendorSellMsgHandler.java b/src/engine/net/client/handlers/VendorSellMsgHandler.java index 6332ca98..dcd5b496 100644 --- a/src/engine/net/client/handlers/VendorSellMsgHandler.java +++ b/src/engine/net/client/handlers/VendorSellMsgHandler.java @@ -108,7 +108,7 @@ public class VendorSellMsgHandler extends AbstractClientMsgHandler { cost = sell.template.item_value; //apply damaged value reduction - float damagedModifier = sell.durabilityCurrent / sell.template.item_health_full; + float damagedModifier = sell.combat_health_current / sell.template.item_health_full; cost *= damagedModifier; float bargain = player.getBargain(); diff --git a/src/engine/objects/CharacterItemManager.java b/src/engine/objects/CharacterItemManager.java index 28af33c6..20b0b3ff 100644 --- a/src/engine/objects/CharacterItemManager.java +++ b/src/engine/objects/CharacterItemManager.java @@ -2339,7 +2339,7 @@ public class CharacterItemManager { if (!item.isCanDestroy()) return; - int dur = (int) (short) item.durabilityCurrent; + int dur = (int) (short) item.combat_health_current; if (dur - amount <= 0) { //destroy the item @@ -2352,7 +2352,7 @@ public class CharacterItemManager { dur -= amount; if (!DbManager.ItemQueries.SET_DURABILITY(item, dur)) return; - item.setDurabilityCurrent((short) dur); + item.setCombat_health_current((short) dur); } diff --git a/src/engine/objects/Item.java b/src/engine/objects/Item.java index 76eafbfb..039204aa 100644 --- a/src/engine/objects/Item.java +++ b/src/engine/objects/Item.java @@ -47,7 +47,7 @@ public class Item extends AbstractWorldObject { public float drop_chance; public EnumSet flags = EnumSet.noneOf(ItemFlags.class); public int numberOfItems; - public float durabilityCurrent; + public float combat_health_current; public int chargesRemaining; public Enum.EquipSlotType equipSlot; private boolean canDestroy; @@ -70,7 +70,7 @@ public class Item extends AbstractWorldObject { this.templateID = templateID; this.template = ItemTemplate.templates.get(templateID); this.chargesRemaining = this.template.item_initial_charges; - this.durabilityCurrent = this.template.combat_health_full; + this.combat_health_current = this.template.combat_health_full; this.equipSlot = EquipSlotType.NONE; this.containerType = ItemContainerType.NONE; this.numberOfItems = 1; @@ -128,7 +128,7 @@ public class Item extends AbstractWorldObject { this.chargesRemaining = rs.getByte("item_chargesRemaining"); - this.durabilityCurrent = rs.getShort("item_durabilityCurrent"); + this.combat_health_current = rs.getShort("item_durabilityCurrent"); DbObjectType ownerType; ownerType = DbManager.BuildingQueries.GET_UID_ENUM(this.ownerID); @@ -232,7 +232,7 @@ public class Item extends AbstractWorldObject { writer.put((byte) 1); // End Datablock byte writer.putFloat(item.template.item_health_full); - writer.putFloat((float) item.durabilityCurrent); + writer.putFloat((float) item.combat_health_current); writer.put((byte) 1); // End Datablock byte @@ -700,8 +700,8 @@ public class Item extends AbstractWorldObject { return true; } - public void setDurabilityCurrent(float value) { - this.durabilityCurrent = value; + public void setCombat_health_current(float value) { + this.combat_health_current = value; } public boolean isCanDestroy() {