Browse Source

Resource Auto Stacking

lakebane-master
FatBoy-DOTC 7 months ago
parent
commit
15136518a3
  1. 11
      src/engine/net/client/ClientMessagePump.java
  2. 10
      src/engine/objects/CharacterItemManager.java
  3. 2
      src/engine/objects/Warehouse.java

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

@ -445,8 +445,6 @@ public class ClientMessagePump implements NetMsgHandler { @@ -445,8 +445,6 @@ public class ClientMessagePump implements NetMsgHandler {
dispatch = Dispatch.borrow(player, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
itemManager.StackResources();
}
private static void transferItemFromVaultToInventory(TransferItemFromVaultToInventoryMsg msg, ClientConnection origin) {
@ -460,8 +458,6 @@ public class ClientMessagePump implements NetMsgHandler { @@ -460,8 +458,6 @@ public class ClientMessagePump implements NetMsgHandler {
if (player.getAccount() == null)
return;
player.getAccount().transferItemFromVaultToInventory(msg, origin);
player.getCharItemManager().StackResources();
}
//call this if the transfer fails server side to kick the item back to inventory from vault
@ -994,10 +990,6 @@ public class ClientMessagePump implements NetMsgHandler { @@ -994,10 +990,6 @@ public class ClientMessagePump implements NetMsgHandler {
ChatManager.chatGroupInfoCanSee(player, text);
}
if(item.getItemBase().getType().equals(ItemType.RESOURCE)){
player.getCharItemManager().StackResources();
}
} catch (Exception e) {
Logger.info(e.getMessage());
} finally {
@ -1614,9 +1606,6 @@ public class ClientMessagePump implements NetMsgHandler { @@ -1614,9 +1606,6 @@ public class ClientMessagePump implements NetMsgHandler {
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
itemMan.updateInventory();
}
if(buy.getItemBase().getType().equals(ItemType.RESOURCE)){
itemMan.StackResources();
}
} finally {
origin.buyLock.unlock();
}

10
src/engine/objects/CharacterItemManager.java

@ -776,8 +776,6 @@ public class CharacterItemManager { @@ -776,8 +776,6 @@ public class CharacterItemManager {
this.commitTrade();
this.closeTradeWindow(ctwm1, false);
other.getCharItemManager().closeTradeWindow(ctwm2, false);
other.getCharItemManager().StackResources();
this.StackResources();
}
return true;
}
@ -1257,9 +1255,6 @@ public class CharacterItemManager { @@ -1257,9 +1255,6 @@ public class CharacterItemManager {
}
this.inventory.add(i);
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal());
if(i.getItemBase().getType().equals(ItemType.RESOURCE)){
this.StackResources();
}
return true;
}
@ -2317,6 +2312,7 @@ public class CharacterItemManager { @@ -2317,6 +2312,7 @@ public class CharacterItemManager {
* Update the player's inventory window by resending the entire contents.
*/
public void updateInventory() {
this.StackResources();
this.updateInventory(this.getInventory(), true);
}
@ -2628,7 +2624,7 @@ public class CharacterItemManager { @@ -2628,7 +2624,7 @@ public class CharacterItemManager {
//populate resources hashmap with items currently in inventory
for(Item item : this.getInventory()){
if(Warehouse.getMaxResources().get(item.getItemBaseID()) != null && Warehouse.getMaxResources().get(item.getItemBaseID()) != 0){
if(resources.containsKey(item.getItemBaseID())){
if(resources.containsKey(item.getItemBase())){
resources.get(item.getItemBase()).add(item);
} else{
resources.put(item.getItemBase(),new ArrayList<>());
@ -2670,7 +2666,7 @@ public class CharacterItemManager { @@ -2670,7 +2666,7 @@ public class CharacterItemManager {
this.delete(purged);
}
this.updateInventory();
//this.updateInventory();
}
}

2
src/engine/objects/Warehouse.java

@ -217,8 +217,6 @@ public class Warehouse extends AbstractWorldObject { @@ -217,8 +217,6 @@ public class Warehouse extends AbstractWorldObject {
vrm.configure();
dispatch = Dispatch.borrow(player, vrm);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
player.getCharItemManager().StackResources();
}
public static void warehouseLock(MerchantMsg msg, PlayerCharacter player, NPC npc, ClientConnection origin) {

Loading…
Cancel
Save