From 70f331d0253f529a5c842077898441a01a40a40a Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 3 Mar 2024 13:06:05 -0500 Subject: [PATCH] item_value refactored to template --- src/engine/net/client/ClientMessagePump.java | 4 ++-- .../handlers/ItemProductionMsgHandler.java | 2 +- src/engine/objects/Item.java | 18 ++---------------- src/engine/objects/MobLoot.java | 2 +- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index c672b319..255284d2 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1242,7 +1242,7 @@ public class ClientMessagePump implements NetMsgHandler { //get goldItem cost to sell - cost = sell.getBaseValue(); + cost = sell.template.item_value; //apply damaged value reduction float durabilityCurrent = (short) sell.durabilityCurrent; @@ -1468,7 +1468,7 @@ public class ClientMessagePump implements NetMsgHandler { //TODO test cost and subtract goldItem //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()) cost = buy.getMagicValue(); diff --git a/src/engine/net/client/handlers/ItemProductionMsgHandler.java b/src/engine/net/client/handlers/ItemProductionMsgHandler.java index 3134f939..08f16163 100644 --- a/src/engine/net/client/handlers/ItemProductionMsgHandler.java +++ b/src/engine/net/client/handlers/ItemProductionMsgHandler.java @@ -274,7 +274,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { if (vendor.getCharItemManager().inventoryContains(targetItem) == false) continue; - itemValue = targetItem.getBaseValue(); + itemValue = targetItem.template.item_value; if (vendor.getBuilding().getStrongboxValue() + itemValue > vendor.getBuilding().getMaxGold()) { ErrorPopupMsg.sendErrorPopup(player, 201); diff --git a/src/engine/objects/Item.java b/src/engine/objects/Item.java index a5203dba..8d0c3753 100644 --- a/src/engine/objects/Item.java +++ b/src/engine/objects/Item.java @@ -1009,20 +1009,6 @@ public class Item extends AbstractWorldObject { 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 public String getName() { @@ -1240,10 +1226,10 @@ public class Item extends AbstractWorldObject { public int getValue() { if (this.value == 0) - if (this.isID()) { + if (this.template.item_flags.contains(ItemFlags.Identified)) { return this.getMagicValue(); } else - return this.getBaseValue(); + return this.template.item_value; return this.value; } diff --git a/src/engine/objects/MobLoot.java b/src/engine/objects/MobLoot.java index fdfbe4f2..b9c603b8 100644 --- a/src/engine/objects/MobLoot.java +++ b/src/engine/objects/MobLoot.java @@ -311,7 +311,7 @@ public final class MobLoot extends Item { /** * Not implemented */ - @Override + @Deprecated public void setLastOwner(AbstractWorldObject value) { }