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 { @@ -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 { @@ -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);

2
src/engine/gameManager/LootManager.java

@ -352,7 +352,7 @@ public enum LootManager { @@ -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.

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

@ -85,7 +85,7 @@ public class RepairMsgHandler extends AbstractClientMsgHandler { @@ -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 { @@ -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 { @@ -142,7 +142,7 @@ public class RepairMsgHandler extends AbstractClientMsgHandler {
//repair the item
toRepair.setDurabilityCurrent(max);
toRepair.setCombat_health_current(max);
//send repair msg

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

@ -108,7 +108,7 @@ public class VendorSellMsgHandler extends AbstractClientMsgHandler { @@ -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();

4
src/engine/objects/CharacterItemManager.java

@ -2339,7 +2339,7 @@ public class CharacterItemManager { @@ -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 { @@ -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);
}

12
src/engine/objects/Item.java

@ -47,7 +47,7 @@ public class Item extends AbstractWorldObject { @@ -47,7 +47,7 @@ public class Item extends AbstractWorldObject {
public float drop_chance;
public EnumSet<Enum.ItemFlags> 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 { @@ -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 { @@ -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 { @@ -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 { @@ -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() {

Loading…
Cancel
Save