Browse Source

Variable renamed to conform with json

combat-2
MagicBot 8 months ago
parent
commit
f523e4832e
  1. 4
      src/engine/db/handlers/dbItemHandler.java
  2. 2
      src/engine/gameManager/LootManager.java
  3. 6
      src/engine/net/client/handlers/RepairMsgHandler.java
  4. 2
      src/engine/net/client/handlers/VendorSellMsgHandler.java
  5. 4
      src/engine/objects/CharacterItemManager.java
  6. 12
      src/engine/objects/Item.java

4
src/engine/db/handlers/dbItemHandler.java

@ -65,7 +65,7 @@ public class dbItemHandler extends dbHandlerBase {
preparedStatement.setInt(1, toAdd.ownerID); preparedStatement.setInt(1, toAdd.ownerID);
preparedStatement.setInt(2, toAdd.getTemplateID()); preparedStatement.setInt(2, toAdd.getTemplateID());
preparedStatement.setInt(3, (byte) toAdd.chargesRemaining); 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); preparedStatement.setInt(5, (int) toAdd.template.item_health_full);
if (toAdd.getNumOfItems() < 1) if (toAdd.getNumOfItems() < 1)
@ -401,7 +401,7 @@ public class dbItemHandler extends dbHandlerBase {
preparedStatement.setInt(1, value); preparedStatement.setInt(1, value);
preparedStatement.setLong(2, item.getObjectUUID()); preparedStatement.setLong(2, item.getObjectUUID());
preparedStatement.setInt(3, (short) item.durabilityCurrent); preparedStatement.setInt(3, (short) item.combat_health_current);
return (preparedStatement.executeUpdate() > 0); return (preparedStatement.executeUpdate() > 0);

2
src/engine/gameManager/LootManager.java

@ -352,7 +352,7 @@ public enum LootManager {
if (ml != null && dropCount < 1) { if (ml != null && dropCount < 1) {
ml.flags.add(Enum.ItemFlags.Identified); 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); mob.charItemManager.addItemToInventory(ml);
dropCount = 1; dropCount = 1;
//break; // Exit on first successful roll. //break; // Exit on first successful roll.

6
src/engine/net/client/handlers/RepairMsgHandler.java

@ -85,7 +85,7 @@ public class RepairMsgHandler extends AbstractClientMsgHandler {
//make sure item is damaged and not destroyed //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; short max = (short) toRepair.template.item_health_full;
//account for durability modifications //account for durability modifications
@ -95,7 +95,7 @@ public class RepairMsgHandler extends AbstractClientMsgHandler {
if (dur >= max || dur < 1) { if (dur >= max || dur < 1) {
//redundancy message to clear item from window in client //redundancy message to clear item from window in client
toRepair.setDurabilityCurrent(max); toRepair.setCombat_health_current(max);
repairMsg.setupRepairAck(max - dur); repairMsg.setupRepairAck(max - dur);
dispatch = Dispatch.borrow(player, repairMsg); dispatch = Dispatch.borrow(player, repairMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
@ -142,7 +142,7 @@ public class RepairMsgHandler extends AbstractClientMsgHandler {
//repair the item //repair the item
toRepair.setDurabilityCurrent(max); toRepair.setCombat_health_current(max);
//send repair msg //send repair msg

2
src/engine/net/client/handlers/VendorSellMsgHandler.java

@ -108,7 +108,7 @@ public class VendorSellMsgHandler extends AbstractClientMsgHandler {
cost = sell.template.item_value; cost = sell.template.item_value;
//apply damaged value reduction //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; cost *= damagedModifier;
float bargain = player.getBargain(); float bargain = player.getBargain();

4
src/engine/objects/CharacterItemManager.java

@ -2339,7 +2339,7 @@ public class CharacterItemManager {
if (!item.isCanDestroy()) if (!item.isCanDestroy())
return; return;
int dur = (int) (short) item.durabilityCurrent; int dur = (int) (short) item.combat_health_current;
if (dur - amount <= 0) { if (dur - amount <= 0) {
//destroy the item //destroy the item
@ -2352,7 +2352,7 @@ public class CharacterItemManager {
dur -= amount; dur -= amount;
if (!DbManager.ItemQueries.SET_DURABILITY(item, dur)) if (!DbManager.ItemQueries.SET_DURABILITY(item, dur))
return; return;
item.setDurabilityCurrent((short) dur); item.setCombat_health_current((short) dur);
} }

12
src/engine/objects/Item.java

@ -47,7 +47,7 @@ public class Item extends AbstractWorldObject {
public float drop_chance; public float drop_chance;
public EnumSet<Enum.ItemFlags> flags = EnumSet.noneOf(ItemFlags.class); public EnumSet<Enum.ItemFlags> flags = EnumSet.noneOf(ItemFlags.class);
public int numberOfItems; public int numberOfItems;
public float durabilityCurrent; public float combat_health_current;
public int chargesRemaining; public int chargesRemaining;
public Enum.EquipSlotType equipSlot; public Enum.EquipSlotType equipSlot;
private boolean canDestroy; private boolean canDestroy;
@ -70,7 +70,7 @@ public class Item extends AbstractWorldObject {
this.templateID = templateID; this.templateID = templateID;
this.template = ItemTemplate.templates.get(templateID); this.template = ItemTemplate.templates.get(templateID);
this.chargesRemaining = this.template.item_initial_charges; 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.equipSlot = EquipSlotType.NONE;
this.containerType = ItemContainerType.NONE; this.containerType = ItemContainerType.NONE;
this.numberOfItems = 1; this.numberOfItems = 1;
@ -128,7 +128,7 @@ public class Item extends AbstractWorldObject {
this.chargesRemaining = rs.getByte("item_chargesRemaining"); this.chargesRemaining = rs.getByte("item_chargesRemaining");
this.durabilityCurrent = rs.getShort("item_durabilityCurrent"); this.combat_health_current = rs.getShort("item_durabilityCurrent");
DbObjectType ownerType; DbObjectType ownerType;
ownerType = DbManager.BuildingQueries.GET_UID_ENUM(this.ownerID); 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.put((byte) 1); // End Datablock byte
writer.putFloat(item.template.item_health_full); 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 writer.put((byte) 1); // End Datablock byte
@ -700,8 +700,8 @@ public class Item extends AbstractWorldObject {
return true; return true;
} }
public void setDurabilityCurrent(float value) { public void setCombat_health_current(float value) {
this.durabilityCurrent = value; this.combat_health_current = value;
} }
public boolean isCanDestroy() { public boolean isCanDestroy() {

Loading…
Cancel
Save