From c55f67a9773980213cf5531fb1931d95764b4637 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 28 May 2024 20:24:59 -0500 Subject: [PATCH] resource vendor now sells in stack sizes of 500k purchase --- src/engine/net/client/ClientMessagePump.java | 8 +++++--- src/engine/objects/Contract.java | 2 +- src/engine/objects/Warehouse.java | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index ec4ab4ed..3b697852 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1472,6 +1472,7 @@ public class ClientMessagePump implements NetMsgHandler { } if(me.getItemBase().getType().equals(ItemType.RESOURCE) && npc.getContractID() == 900){ boolean stacked = false; + int buystack = Warehouse.getSellStackSize(me.getItemBase().getUUID()); for(Item item : itemMan.getInventory()){ int itemID = item.getItemBaseID(); int meID = me.getItemBase().getUUID(); @@ -1479,8 +1480,8 @@ public class ClientMessagePump implements NetMsgHandler { if(Warehouse.maxResources.isEmpty()) Warehouse.getMaxResources(); int maxStack = Warehouse.maxResources.get(itemID); - if(maxStack > item.getNumOfItems() + 1){ - item.setNumOfItems(item.getNumOfItems() + 1); + if(maxStack > item.getNumOfItems() + buystack){ + item.setNumOfItems(item.getNumOfItems() + buystack); stacked = true; itemMan.updateInventory(); DbManager.ItemQueries.UPDATE_NUM_ITEMS(item,item.getNumOfItems(),0); @@ -1493,7 +1494,8 @@ public class ClientMessagePump implements NetMsgHandler { if (buy != null) { me.transferEnchants(buy); itemMan.addItemToInventory(buy); - //itemMan.updateInventory(); + buy.setNumOfItems(buystack); + DbManager.ItemQueries.UPDATE_NUM_ITEMS(buy,buy.getNumOfItems(),0); } } }else { diff --git a/src/engine/objects/Contract.java b/src/engine/objects/Contract.java index dcfd6001..07cd934b 100644 --- a/src/engine/objects/Contract.java +++ b/src/engine/objects/Contract.java @@ -201,7 +201,7 @@ public class Contract extends AbstractGameObject { if(this.getObjectUUID() == 900){ for(MobEquipment me : this.sellInventory){ - me.magicValue = Warehouse.getCostForResource(me.getItemBase().getUUID()); + me.magicValue = Warehouse.getCostForResource(me.getItemBase().getUUID()) * Warehouse.getSellStackSize(me.getItemBase().getUUID()); } } if(this.getObjectUUID() == 1202) diff --git a/src/engine/objects/Warehouse.java b/src/engine/objects/Warehouse.java index 5db69727..0deaea60 100644 --- a/src/engine/objects/Warehouse.java +++ b/src/engine/objects/Warehouse.java @@ -1455,4 +1455,8 @@ public class Warehouse extends AbstractWorldObject { return newCost; } + public static int getSellStackSize(int id){ + + return (int)500000 / (getCostForResource(id)); + } }