Browse Source

bugfix - item pricing

lakebane-master
FatBoy-DOTC 7 months ago
parent
commit
2990396778
  1. 2
      src/engine/net/client/ClientMessagePump.java
  2. 10
      src/engine/objects/MobEquipment.java

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

@ -1406,7 +1406,7 @@ public class ClientMessagePump implements NetMsgHandler {
if (!itemMan.hasRoomInventory(ib.getWeight())) { if (!itemMan.hasRoomInventory(ib.getWeight())) {
return; return;
} }
int cost = me.getMagicValue(); int cost = me.magicValue;
int resourceCost = Warehouse.getCostForResource(me.getItemBase().getUUID()); int resourceCost = Warehouse.getCostForResource(me.getItemBase().getUUID());
if (resourceCost != 0) if (resourceCost != 0)
cost = resourceCost; cost = resourceCost;

10
src/engine/objects/MobEquipment.java

@ -9,6 +9,7 @@
package engine.objects; package engine.objects;
import engine.Enum;
import engine.exception.SerializationException; import engine.exception.SerializationException;
import engine.gameManager.PowersManager; import engine.gameManager.PowersManager;
import engine.net.ByteBufferWriter; 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 { public static void serializeForVendor(MobEquipment mobEquipment, ByteBufferWriter writer, float percent) throws SerializationException {
_serializeForClientMsg(mobEquipment, writer, false); _serializeForClientMsg(mobEquipment, writer, false);
int baseValue = mobEquipment.itemBase.getBaseValue() + mobEquipment.itemBase.getMagicValue(); int baseValue = mobEquipment.itemBase.getBaseValue() + mobEquipment.itemBase.getMagicValue();
writer.putInt(mobEquipment.magicValue); if(mobEquipment.itemBase.getType().equals(Enum.ItemType.POTION)){
writer.putInt(mobEquipment.magicValue); 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 { public static void serializeForClientMsg(MobEquipment mobEquipment, ByteBufferWriter writer) throws SerializationException {

Loading…
Cancel
Save