From 5e61ef26e19ce1415463bfc8cd00d101c7272bf2 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 14 May 2024 22:03:45 -0500 Subject: [PATCH] stack resources completed --- src/engine/net/client/ClientMessagePump.java | 10 ++++----- src/engine/objects/CharacterItemManager.java | 22 ++++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index a38d7dd8..dd97696f 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -579,7 +579,7 @@ public class ClientMessagePump implements NetMsgHandler { } if (itemManager.delete(i) == true) { sourcePlayer.getCharItemManager().addGoldToInventory(value,false); - sourcePlayer.getCharItemManager().updateInventory(); + sourcePlayer.getCharItemManager().StackResources(); Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg); DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); } @@ -921,7 +921,7 @@ public class ClientMessagePump implements NetMsgHandler { DispatchMessage.dispatchMsgToInterestArea(corpse, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, true); - //player.getCharItemManager().updateInventory(); + //player.getCharItemManager().StackResources(); } //TODO send group loot message if player is grouped and visible @@ -978,7 +978,7 @@ public class ClientMessagePump implements NetMsgHandler { dispatch = Dispatch.borrow(player, newItemMsg); DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY); - //player.getCharItemManager().updateInventory(); + //player.getCharItemManager().StackResources(); } //TODO send group loot message if player is grouped and visible @@ -1464,7 +1464,7 @@ public class ClientMessagePump implements NetMsgHandler { if (buy != null) { me.transferEnchants(buy); itemMan.addItemToInventory(buy); - //itemMan.updateInventory(); + //itemMan.StackResources(); } } } @@ -1604,7 +1604,7 @@ public class ClientMessagePump implements NetMsgHandler { // msg.setItemID(buy.getObjectUUID()); Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg); DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); - itemMan.updateInventory(); + itemMan.StackResources(); } } finally { origin.buyLock.unlock(); diff --git a/src/engine/objects/CharacterItemManager.java b/src/engine/objects/CharacterItemManager.java index 567496e9..07ad6048 100644 --- a/src/engine/objects/CharacterItemManager.java +++ b/src/engine/objects/CharacterItemManager.java @@ -103,7 +103,7 @@ public class CharacterItemManager { return; if (take != null) { itemMan.buyFromNPC(take, npc); - itemMan.updateInventory(); + itemMan.StackResources(); } } @@ -690,7 +690,7 @@ public class CharacterItemManager { this.addGoldToTrade(amt); // BONUS CODE BELOW: Thanks some unknown retard! - // sourceItemMan.updateInventory(sourceItemMan.getInventory(), true); + // sourceItemMan.StackResources(sourceItemMan.getInventory(), true); UpdateGoldMsg ugm = new UpdateGoldMsg(source); ugm.configure(); @@ -936,13 +936,13 @@ public class CharacterItemManager { return junk(i, true); } - private synchronized boolean junk(Item i, boolean updateInventory) { + private synchronized boolean junk(Item i, boolean StackResources) { if (i.getItemBase().getType().equals(ItemType.GOLD)) { if (this.getGoldInventory().getObjectUUID() == i.getObjectUUID()) if (DbManager.ItemQueries.UPDATE_GOLD(i, 0)) { this.getGoldInventory().setNumOfItems(0); - if (updateInventory) - updateInventory(); + if (StackResources) + StackResources(); return true; } else { return false; @@ -970,9 +970,9 @@ public class CharacterItemManager { calculateWeights(); - if (updateInventory) + if (StackResources) // Send the new inventory - //updateInventory(i, false); this line was causing entire inventory to disappear + //StackResources(i, false); this line was causing entire inventory to disappear updateInventory(this.getInventory(), true); return true; @@ -1247,7 +1247,7 @@ public class CharacterItemManager { } else { int amt = i.getNumOfItems(); if (DbManager.ItemQueries.UPDATE_GOLD(this.goldInventory, this.goldInventory.getNumOfItems() + amt)) { - updateInventory(); + StackResources(); return true; } return false; @@ -1475,7 +1475,7 @@ public class CharacterItemManager { if (sdrMerchant) { this.delete(itemToSell); - this.updateInventory(); + this.StackResources(); } else if (!itemToSell.moveItemToInventory(npc)) return false; @@ -2276,8 +2276,8 @@ public class CharacterItemManager { return; PlayerCharacter pc = (PlayerCharacter) this.absCharacter; - UpdateInventoryMsg updateInventoryMsg = new UpdateInventoryMsg(inventory, this.getBank(), this.getGoldInventory(), add); - Dispatch dispatch = Dispatch.borrow(pc, updateInventoryMsg); + UpdateInventoryMsg StackResourcesMsg = new UpdateInventoryMsg(inventory, this.getBank(), this.getGoldInventory(), add); + Dispatch dispatch = Dispatch.borrow(pc, StackResourcesMsg); DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY); }