Browse Source

Value is only an override

combat-2
MagicBot 8 months ago
parent
commit
a130240339
  1. 8
      src/engine/objects/CharacterItemManager.java
  2. 2
      src/engine/objects/Item.java

8
src/engine/objects/CharacterItemManager.java

@ -1482,10 +1482,10 @@ public class CharacterItemManager { @@ -1482,10 +1482,10 @@ public class CharacterItemManager {
if (!purchasedItem.moveItemToInventory((PlayerCharacter) this.absCharacter))
return false;
if (purchasedItem.getValue() != purchasedItem.magicValue) {
DbManager.ItemQueries.UPDATE_VALUE(purchasedItem, 0);
purchasedItem.setValue(0);
}
// Reset value
purchasedItem.value = (int) (purchasedItem.template.item_value * (purchasedItem.combat_health_current / purchasedItem.template.combat_health_full));
purchasedItem.value = purchasedItem.value * (purchasedItem.chargesRemaining / purchasedItem.template.item_initial_charges);
DbManager.ItemQueries.UPDATE_VALUE(purchasedItem, purchasedItem.value);
// db transfer successfull, remove from this character
// skip this check if this is a mobLoot item (which is not in any inventory)

2
src/engine/objects/Item.java

@ -781,7 +781,7 @@ public class Item extends AbstractWorldObject { @@ -781,7 +781,7 @@ public class Item extends AbstractWorldObject {
if (this.chargesRemaining < 0)
this.chargesRemaining = 0;
DbManager.ItemQueries.UPDATE_REMAINING_CHARGES(this);
this.value = this.value * (this.chargesRemaining / this.template.item_initial_charges);
this.value = this.template.item_value * (this.chargesRemaining / this.template.item_initial_charges);
DbManager.ItemQueries.UPDATE_VALUE(this, this.value);
}

Loading…
Cancel
Save