diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index c51b1b7d..f1a16f77 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -187,39 +187,6 @@ public class ClientMessagePump implements NetMsgHandler { ChatManager.chatInfoError(player, "Can't transfer to vault: " + reason); } - private static void transferGoldFromVaultToInventory(TransferGoldFromVaultToInventoryMsg msg, ClientConnection origin) { - - PlayerCharacter player = origin.getPlayerCharacter(); - - - if (player == null) - return; - - Account account = player.getAccount(); - - if (account == null) - return; - - account.transferGoldFromVaultToInventory(msg, origin); - } - - private static void transferGoldFromInventoryToVault(TransferGoldFromInventoryToVaultMsg msg, ClientConnection origin) { - - PlayerCharacter player = origin.getPlayerCharacter(); - Dispatch dispatch; - - if (player == null) - return; - - Account account = player.getAccount(); - - if (account == null) - return; - - account.transferGoldFromInventoryToVault(msg, origin); - - } - private static void DeleteItem(DeleteItemMsg msg, ClientConnection origin) { CharacterItemManager itemManager = origin.getPlayerCharacter().charItemManager; @@ -1144,12 +1111,6 @@ public class ClientMessagePump implements NetMsgHandler { case SHOWCOMBATINFO: show((ShowMsg) msg, origin); break; - case TRANSFERGOLDFROMVAULTTOINVENTORY: - transferGoldFromVaultToInventory((TransferGoldFromVaultToInventoryMsg) msg, origin); - break; - case GOLDTOVAULT: - transferGoldFromInventoryToVault((TransferGoldFromInventoryToVaultMsg) msg, origin); - break; case REQUESTTOTRADE: TradeManager.tradeRequest((TradeRequestMsg) msg, origin); break; diff --git a/src/engine/net/client/Protocol.java b/src/engine/net/client/Protocol.java index 9a62e9c7..35307b5c 100644 --- a/src/engine/net/client/Protocol.java +++ b/src/engine/net/client/Protocol.java @@ -99,7 +99,8 @@ public enum Protocol { FURNITURE(0xCE7FA503, FurnitureMsg.class, FurnitureHandler.class), GAMESERVERIPRESPONSE(0x6C95CF87, GameServerIPResponseMsg.class, null), // Game Server IP Response GLOBALCHANNELMESSAGE(0x2bf03fd2, null, null), - GOLDTOVAULT(0x3ABAEE49, TransferGoldFromInventoryToVaultMsg.class, null), // Transfer Gold from Inventory to Vault + GOLDFROMVAULT(0x011D0123, GoldFromVaultMsg.class, GoldFromVaultMsgHandler.class), // Transfer Gold from Vault to Inventory + GOLDTOVAULT(0x3ABAEE49, GoldToVaultMsg.class, GoldToVaultMsgHandler.class), // Transfer Gold from Inventory to Vault GROUPDISBAND(0xE2B85AA4, DisbandGroupMsg.class, DisbandGroupHandler.class), //Disband Group GROUPFOLLOW(0xC61B0476, FormationFollowMsg.class, FormationFollowHandler.class), //Toggle Follow, set Formation GROUPLEADERAPPOINT(0xEF778DD3, AppointGroupLeaderMsg.class, AppointGroupLeaderHandler.class), //Appoint new group leader @@ -221,7 +222,6 @@ public enum Protocol { TRAINERLIST(0x41FABA62, TrainerInfoMsg.class, null), //Req/Send Trainer Info/Pricing TRAINSKILL(0xB0BF68CD, TrainMsg.class, null), //Train skills/powers TRANSFERASSET(0x3EA1C4C9, TransferAssetMsg.class, TransferAssetMsgHandler.class), // Transfer Building - TRANSFERGOLDFROMVAULTTOINVENTORY(0x011D0123, TransferGoldFromVaultToInventoryMsg.class, null), // Transfer Gold from Vault to Inventory TRANSFERGOLDTOFROMBUILDING(0x1B1AC8C7, TransferGoldToFromBuildingMsg.class, TransferGoldToFromBuildingMsgHandler.class), // Transfer Gold to/From Building, Transfer Error TRANSFERITEMFROMBANK(0x9D04977B, TransferItemFromBankMsg.class, TransferItemFromBankMsgHandler.class), // Transfer Item from Bank to Inventory TRANSFERITEMTOBANK(0xD48C46FA, TransferItemToBankMsg.class, TransferItemToBankMsgHandler.class), // Transfer Item from Inventory to Bank diff --git a/src/engine/net/client/handlers/GoldFromVaultMsgHandler.java b/src/engine/net/client/handlers/GoldFromVaultMsgHandler.java new file mode 100644 index 00000000..63bc4dc7 --- /dev/null +++ b/src/engine/net/client/handlers/GoldFromVaultMsgHandler.java @@ -0,0 +1,43 @@ +// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . +// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· +// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ +// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ +// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ +// Magicbane Emulator Project © 2013 - 2022 +// www.magicbane.com + +package engine.net.client.handlers; + +import engine.exception.MsgSendException; +import engine.net.client.ClientConnection; +import engine.net.client.msg.ClientNetMsg; +import engine.net.client.msg.GoldFromVaultMsg; +import engine.objects.Account; +import engine.objects.PlayerCharacter; + +public class GoldFromVaultMsgHandler extends AbstractClientMsgHandler { + + public GoldFromVaultMsgHandler() { + super(GoldFromVaultMsg.class); + } + + @Override + protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { + + PlayerCharacter player = origin.getPlayerCharacter(); + + GoldFromVaultMsg msg = (GoldFromVaultMsg) baseMsg; + + if (player == null) + return true; + + Account account = player.getAccount(); + + if (account == null) + return true; + + account.transferGoldFromVaultToInventory(msg, origin); + return true; + } + +} \ No newline at end of file diff --git a/src/engine/net/client/handlers/GoldToVaultMsgHandler.java b/src/engine/net/client/handlers/GoldToVaultMsgHandler.java new file mode 100644 index 00000000..7b75aaf4 --- /dev/null +++ b/src/engine/net/client/handlers/GoldToVaultMsgHandler.java @@ -0,0 +1,43 @@ +// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . +// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· +// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ +// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ +// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ +// Magicbane Emulator Project © 2013 - 2022 +// www.magicbane.com + +package engine.net.client.handlers; + +import engine.exception.MsgSendException; +import engine.net.client.ClientConnection; +import engine.net.client.msg.ClientNetMsg; +import engine.net.client.msg.GoldToVaultMsg; +import engine.objects.Account; +import engine.objects.PlayerCharacter; + +public class GoldToVaultMsgHandler extends AbstractClientMsgHandler { + + public GoldToVaultMsgHandler() { + super(GoldToVaultMsg.class); + } + + @Override + protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { + + PlayerCharacter player = origin.getPlayerCharacter(); + + GoldToVaultMsg msg = (GoldToVaultMsg) baseMsg; + + if (player == null) + return true; + + Account account = player.getAccount(); + + if (account == null) + return true; + + account.transferGoldFromInventoryToVault(msg, origin); + return true; + } + +} \ No newline at end of file diff --git a/src/engine/net/client/msg/TransferGoldFromVaultToInventoryMsg.java b/src/engine/net/client/msg/GoldFromVaultMsg.java similarity index 88% rename from src/engine/net/client/msg/TransferGoldFromVaultToInventoryMsg.java rename to src/engine/net/client/msg/GoldFromVaultMsg.java index b76b68f6..cc55ecde 100644 --- a/src/engine/net/client/msg/TransferGoldFromVaultToInventoryMsg.java +++ b/src/engine/net/client/msg/GoldFromVaultMsg.java @@ -21,7 +21,7 @@ import engine.net.client.Protocol; * * @author Eighty */ -public class TransferGoldFromVaultToInventoryMsg extends ClientNetMsg { +public class GoldFromVaultMsg extends ClientNetMsg { private long unknown01; private long playerCompID; @@ -31,8 +31,8 @@ public class TransferGoldFromVaultToInventoryMsg extends ClientNetMsg { /** * This is the general purpose constructor */ - public TransferGoldFromVaultToInventoryMsg(long unknown01, long playerCompID, long accountCompID, int amount) { - super(Protocol.TRANSFERGOLDFROMVAULTTOINVENTORY); + public GoldFromVaultMsg(long unknown01, long playerCompID, long accountCompID, int amount) { + super(Protocol.GOLDFROMVAULT); this.unknown01 = unknown01; this.playerCompID = playerCompID; this.accountCompID = accountCompID; @@ -44,8 +44,8 @@ public class TransferGoldFromVaultToInventoryMsg extends ClientNetMsg { * past the limit) then this constructor Throws that Exception to the * caller. */ - public TransferGoldFromVaultToInventoryMsg(AbstractConnection origin, ByteBufferReader reader) { - super(Protocol.TRANSFERGOLDFROMVAULTTOINVENTORY, origin, reader); + public GoldFromVaultMsg(AbstractConnection origin, ByteBufferReader reader) { + super(Protocol.GOLDFROMVAULT, origin, reader); } /** diff --git a/src/engine/net/client/msg/TransferGoldFromInventoryToVaultMsg.java b/src/engine/net/client/msg/GoldToVaultMsg.java similarity index 90% rename from src/engine/net/client/msg/TransferGoldFromInventoryToVaultMsg.java rename to src/engine/net/client/msg/GoldToVaultMsg.java index 459bc61a..09231b11 100644 --- a/src/engine/net/client/msg/TransferGoldFromInventoryToVaultMsg.java +++ b/src/engine/net/client/msg/GoldToVaultMsg.java @@ -22,7 +22,7 @@ import engine.net.client.Protocol; * @author Eighty */ -public class TransferGoldFromInventoryToVaultMsg extends ClientNetMsg { +public class GoldToVaultMsg extends ClientNetMsg { private int playerID; private int accountID; @@ -33,12 +33,12 @@ public class TransferGoldFromInventoryToVaultMsg extends ClientNetMsg { /** * This is the general purpose constructor */ - public TransferGoldFromInventoryToVaultMsg() { + public GoldToVaultMsg() { super(Protocol.GOLDTOVAULT); } - public TransferGoldFromInventoryToVaultMsg(int playerID, int npcID, int accountID, int amount) { + public GoldToVaultMsg(int playerID, int npcID, int accountID, int amount) { super(Protocol.GOLDTOVAULT); this.playerID = playerID; this.npcID = npcID; @@ -52,7 +52,7 @@ public class TransferGoldFromInventoryToVaultMsg extends ClientNetMsg { * past the limit) then this constructor Throws that Exception to the * caller. */ - public TransferGoldFromInventoryToVaultMsg(AbstractConnection origin, ByteBufferReader reader) { + public GoldToVaultMsg(AbstractConnection origin, ByteBufferReader reader) { super(Protocol.GOLDTOVAULT, origin, reader); } diff --git a/src/engine/objects/Account.java b/src/engine/objects/Account.java index 32ba9211..5695ed8f 100644 --- a/src/engine/objects/Account.java +++ b/src/engine/objects/Account.java @@ -280,7 +280,7 @@ public class Account extends AbstractGameObject { } } - public synchronized void transferGoldFromVaultToInventory(TransferGoldFromVaultToInventoryMsg msg, ClientConnection origin) { + public synchronized void transferGoldFromVaultToInventory(GoldFromVaultMsg msg, ClientConnection origin) { PlayerCharacter player = origin.getPlayerCharacter(); Dispatch dispatch; @@ -332,7 +332,7 @@ public class Account extends AbstractGameObject { } - public synchronized void transferGoldFromInventoryToVault(TransferGoldFromInventoryToVaultMsg msg, ClientConnection origin) { + public synchronized void transferGoldFromInventoryToVault(GoldToVaultMsg msg, ClientConnection origin) { PlayerCharacter player = origin.getPlayerCharacter(); Dispatch dispatch;