From 299039677880f1989548b90dd48d9f1cad2947a4 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 3 Apr 2024 20:36:15 -0500 Subject: [PATCH] bugfix - item pricing --- src/engine/net/client/ClientMessagePump.java | 2 +- src/engine/objects/MobEquipment.java | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index 069e7b1b..06c2427e 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1406,7 +1406,7 @@ public class ClientMessagePump implements NetMsgHandler { if (!itemMan.hasRoomInventory(ib.getWeight())) { return; } - int cost = me.getMagicValue(); + int cost = me.magicValue; int resourceCost = Warehouse.getCostForResource(me.getItemBase().getUUID()); if (resourceCost != 0) cost = resourceCost; diff --git a/src/engine/objects/MobEquipment.java b/src/engine/objects/MobEquipment.java index b9caec70..0c9809a1 100644 --- a/src/engine/objects/MobEquipment.java +++ b/src/engine/objects/MobEquipment.java @@ -9,6 +9,7 @@ package engine.objects; +import engine.Enum; import engine.exception.SerializationException; import engine.gameManager.PowersManager; import engine.net.ByteBufferWriter; @@ -107,8 +108,13 @@ public class MobEquipment extends AbstractGameObject { public static void serializeForVendor(MobEquipment mobEquipment, ByteBufferWriter writer, float percent) throws SerializationException { _serializeForClientMsg(mobEquipment, writer, false); int baseValue = mobEquipment.itemBase.getBaseValue() + mobEquipment.itemBase.getMagicValue(); - writer.putInt(mobEquipment.magicValue); - writer.putInt(mobEquipment.magicValue); + if(mobEquipment.itemBase.getType().equals(Enum.ItemType.POTION)){ + writer.putInt((int)(mobEquipment.itemBase.getBaseValue() * 0.5f)); + writer.putInt((int)(mobEquipment.itemBase.getBaseValue() * 0.5f)); + }else { + writer.putInt(mobEquipment.magicValue); + writer.putInt(mobEquipment.magicValue); + } } public static void serializeForClientMsg(MobEquipment mobEquipment, ByteBufferWriter writer) throws SerializationException {