Browse Source

stack resources completed

lakebane-master
FatBoy-DOTC 7 months ago
parent
commit
5e61ef26e1
  1. 10
      src/engine/net/client/ClientMessagePump.java
  2. 22
      src/engine/objects/CharacterItemManager.java

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

@ -579,7 +579,7 @@ public class ClientMessagePump implements NetMsgHandler { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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();

22
src/engine/objects/CharacterItemManager.java

@ -103,7 +103,7 @@ public class CharacterItemManager { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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);
}

Loading…
Cancel
Save