Browse Source

Handlers created for bank interaction

combat-2
MagicBot 8 months ago
parent
commit
e7e32ca4ef
  1. 63
      src/engine/net/client/ClientMessagePump.java

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

@ -11,7 +11,6 @@ package engine.net.client; @@ -11,7 +11,6 @@ package engine.net.client;
import engine.Enum.DispatchChannel;
import engine.Enum.GameObjectType;
import engine.Enum.ItemContainerType;
import engine.InterestManagement.WorldGrid;
import engine.exception.MsgSendException;
import engine.gameManager.*;
@ -156,65 +155,6 @@ public class ClientMessagePump implements NetMsgHandler { @@ -156,65 +155,6 @@ public class ClientMessagePump implements NetMsgHandler {
DispatchMessage.dispatchMsgToInterestArea(pc, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, true);
}
private static void transferItemFromBankToInventory(TransferItemFromBankMsg msg, ClientConnection origin) {
PlayerCharacter player = origin.getPlayerCharacter();
Dispatch dispatch;
if (player == null)
return;
if (!NPCManager.NPCVaultBankRangeCheck(player, origin, "bank"))
return;
CharacterItemManager itemManager = player.charItemManager;
if (itemManager == null)
return;
int uuid = msg.getUUID();
Item item = itemManager.getItemByUUID(uuid);
if (item == null)
return;
//dupe check
// WTF Checking but not logging?
if (!item.validForBank(origin, player, itemManager))
return;
if (item.containerType == ItemContainerType.BANK && itemManager.isBankOpen() == false)
return;
if (item.template.item_type.equals(engine.Enum.ItemType.GOLD)) {
if (!itemManager.moveGoldToInventory(item, msg.getNumItems()))
return;
UpdateGoldMsg goldMes = new UpdateGoldMsg(player);
goldMes.configure();
dispatch = Dispatch.borrow(player, goldMes);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return;
}
// Not gold, process update here
if (!itemManager.hasRoomInventory(item.template.item_wt))
return;
if (itemManager.moveItemToInventory(item) == false)
return;
dispatch = Dispatch.borrow(player, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
}
private static void transferItemFromVaultToInventory(TransferItemFromVaultToInventoryMsg msg, ClientConnection origin) {
PlayerCharacter player = origin.getPlayerCharacter();
@ -1233,9 +1173,6 @@ public class ClientMessagePump implements NetMsgHandler { @@ -1233,9 +1173,6 @@ public class ClientMessagePump implements NetMsgHandler {
case SHOWCOMBATINFO:
show((ShowMsg) msg, origin);
break;
case TRANSFERITEMFROMBANK:
transferItemFromBankToInventory((TransferItemFromBankMsg) msg, origin);
break;
case TRANSFERITEMFROMVAULTTOINVENTORY:
transferItemFromVaultToInventory((TransferItemFromVaultToInventoryMsg) msg, origin);
break;

Loading…
Cancel
Save