From 1a0b91b06885a1e660e6f47f65155dd9f316b0d1 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 13 Jun 2024 19:21:34 -0500 Subject: [PATCH] buying larger stacks of resources form resource vendor --- src/engine/net/client/ClientMessagePump.java | 8 ++++++++ src/engine/objects/Contract.java | 8 ++++++++ src/engine/objects/MobEquipment.java | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index fb436c79..5fdbe8b2 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1407,6 +1407,11 @@ public class ClientMessagePump implements NetMsgHandler { return; int cost = me.getMagicValue(); + int amountResource = 0; + if(ib.getType().equals(ItemType.RESOURCE) && npc.contractUUID == 900){ //resource merchant + amountResource = 3000000 / (ib.getBaseValue() * 2); + cost = amountResource * (ib.getBaseValue() * 2); + } float bargain = sourcePlayer.getBargain(); @@ -1444,6 +1449,9 @@ public class ClientMessagePump implements NetMsgHandler { if (buy != null) { me.transferEnchants(buy); + if(ib.getType().equals(ItemType.RESOURCE) && npc.contractUUID == 900){ //resource merchant + buy.setNumOfItems(amountResource); + } itemMan.addItemToInventory(buy); //itemMan.updateInventory(); } diff --git a/src/engine/objects/Contract.java b/src/engine/objects/Contract.java index 076e8525..1b5cf65e 100644 --- a/src/engine/objects/Contract.java +++ b/src/engine/objects/Contract.java @@ -198,6 +198,14 @@ public class Contract extends AbstractGameObject { } public ArrayList getSellInventory() { + if(this.getObjectUUID() == 900){ //resource merchant + for(MobEquipment me : this.sellInventory){ + if(me.getItemBase().getType().equals(Enum.ItemType.RESOURCE)){ + int amountResource = 3000000 / (me.getItemBase().getBaseValue() * 2); + me.magicValue = amountResource * (me.getItemBase().getBaseValue() * 2); + } + } + } return this.sellInventory; } diff --git a/src/engine/objects/MobEquipment.java b/src/engine/objects/MobEquipment.java index d15b6274..db22066e 100644 --- a/src/engine/objects/MobEquipment.java +++ b/src/engine/objects/MobEquipment.java @@ -34,7 +34,7 @@ public class MobEquipment extends AbstractGameObject { private AbstractPowerAction suffix; private int pValue; private int sValue; - private int magicValue; + int magicValue; private float dropChance = 0;