Browse Source

item_value refactored to template

combat-2
MagicBot 9 months ago
parent
commit
70f331d025
  1. 4
      src/engine/net/client/ClientMessagePump.java
  2. 2
      src/engine/net/client/handlers/ItemProductionMsgHandler.java
  3. 18
      src/engine/objects/Item.java
  4. 2
      src/engine/objects/MobLoot.java

4
src/engine/net/client/ClientMessagePump.java

@ -1242,7 +1242,7 @@ public class ClientMessagePump implements NetMsgHandler {
//get goldItem cost to sell //get goldItem cost to sell
cost = sell.getBaseValue(); cost = sell.template.item_value;
//apply damaged value reduction //apply damaged value reduction
float durabilityCurrent = (short) sell.durabilityCurrent; float durabilityCurrent = (short) sell.durabilityCurrent;
@ -1468,7 +1468,7 @@ public class ClientMessagePump implements NetMsgHandler {
//TODO test cost and subtract goldItem //TODO test cost and subtract goldItem
//TODO CHnage this if we ever put NPc city npcs in buildings. //TODO CHnage this if we ever put NPc city npcs in buildings.
int cost = buy.getBaseValue(); int cost = buy.template.item_value;
if (buy.isID() || buy.isCustomValue()) if (buy.isID() || buy.isCustomValue())
cost = buy.getMagicValue(); cost = buy.getMagicValue();

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

@ -274,7 +274,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
if (vendor.getCharItemManager().inventoryContains(targetItem) == false) if (vendor.getCharItemManager().inventoryContains(targetItem) == false)
continue; continue;
itemValue = targetItem.getBaseValue(); itemValue = targetItem.template.item_value;
if (vendor.getBuilding().getStrongboxValue() + itemValue > vendor.getBuilding().getMaxGold()) { if (vendor.getBuilding().getStrongboxValue() + itemValue > vendor.getBuilding().getMaxGold()) {
ErrorPopupMsg.sendErrorPopup(player, 201); ErrorPopupMsg.sendErrorPopup(player, 201);

18
src/engine/objects/Item.java

@ -1009,20 +1009,6 @@ public class Item extends AbstractWorldObject {
return this.magicValue; return this.magicValue;
} }
public int getBaseValue() {
if (this.getItemBase() != null)
return this.getItemBase().getBaseValue();
return 0;
}
public AbstractWorldObject getLastOwner() {
return this.lastOwner;
}
public void setLastOwner(AbstractWorldObject value) {
this.lastOwner = value;
}
@Override @Override
public String getName() { public String getName() {
@ -1240,10 +1226,10 @@ public class Item extends AbstractWorldObject {
public int getValue() { public int getValue() {
if (this.value == 0) if (this.value == 0)
if (this.isID()) { if (this.template.item_flags.contains(ItemFlags.Identified)) {
return this.getMagicValue(); return this.getMagicValue();
} else } else
return this.getBaseValue(); return this.template.item_value;
return this.value; return this.value;
} }

2
src/engine/objects/MobLoot.java

@ -311,7 +311,7 @@ public final class MobLoot extends Item {
/** /**
* Not implemented * Not implemented
*/ */
@Override
@Deprecated @Deprecated
public void setLastOwner(AbstractWorldObject value) { public void setLastOwner(AbstractWorldObject value) {
} }

Loading…
Cancel
Save