From 019c254ac1eee0b183babb4102308f37bcc591ac Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 29 Mar 2024 08:58:31 -0400 Subject: [PATCH] Handler created for InvalidTradeRequestMsg --- src/engine/gameManager/TradeManager.java | 13 ----- src/engine/net/client/ClientMessagePump.java | 5 -- src/engine/net/client/Protocol.java | 2 +- .../InvalidTradeRequestMsgHandler.java | 47 +++++++++++++++++++ 4 files changed, 48 insertions(+), 19 deletions(-) create mode 100644 src/engine/net/client/handlers/InvalidTradeRequestMsgHandler.java diff --git a/src/engine/gameManager/TradeManager.java b/src/engine/gameManager/TradeManager.java index dbb13513..95f8dd79 100644 --- a/src/engine/gameManager/TradeManager.java +++ b/src/engine/gameManager/TradeManager.java @@ -8,22 +8,9 @@ package engine.gameManager; -import engine.Enum; -import engine.net.Dispatch; -import engine.net.DispatchMessage; -import engine.net.client.msg.InvalidTradeRequestMsg; -import engine.objects.PlayerCharacter; - public enum TradeManager { TRADEMANAGER; - public static void invalidTradeRequest(InvalidTradeRequestMsg msg) { - PlayerCharacter requester = PlayerCharacter.getFromCache(msg.getRequesterID()); - Dispatch dispatch; - - dispatch = Dispatch.borrow(requester, msg); - DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY); - } } \ No newline at end of file diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index 445413da..d2be335d 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -10,11 +10,9 @@ package engine.net.client; import engine.gameManager.SessionManager; -import engine.gameManager.TradeManager; import engine.net.NetMsgHandler; import engine.net.client.handlers.AbstractClientMsgHandler; import engine.net.client.msg.ClientNetMsg; -import engine.net.client.msg.InvalidTradeRequestMsg; import engine.server.world.WorldServer; import engine.session.Session; import engine.util.StringUtils; @@ -74,9 +72,6 @@ public class ClientMessagePump implements NetMsgHandler { break; case OPENVAULT: break; - case ARCREQUESTTRADEBUSY: - TradeManager.invalidTradeRequest((InvalidTradeRequestMsg) msg); - break; case CHANNELMUTE: break; case KEEPALIVESERVERCLIENT: diff --git a/src/engine/net/client/Protocol.java b/src/engine/net/client/Protocol.java index 7ba3b560..3c68e34f 100644 --- a/src/engine/net/client/Protocol.java +++ b/src/engine/net/client/Protocol.java @@ -41,7 +41,7 @@ public enum Protocol { ARCPETCMD(0x4E80E001, PetCmdMsg.class, PetCmdMsgHandler.class), // Stop ArcPetAttack, Toggle Assist, Toggle Rest ARCPOWERPROJECTILE(0xA2312D3B, null, null), ARCPROMPTRECALL(0xE3196B6E, PromptRecallMsg.class, PromptRecallMsgHandler.class), //Recall Prompt - ARCREQUESTTRADEBUSY(0xD4BAB4DF, InvalidTradeRequestMsg.class, null), // Attempt trade with someone who is already trading + ARCREQUESTTRADEBUSY(0xD4BAB4DF, InvalidTradeRequestMsg.class, InvalidTradeRequestMsgHandler.class), // Attempt trade with someone who is already trading ARCSERVERSTATUS(0x87BA4462, null, null), //Update Server Status ARCSIEGESPIRE(0x36A49BC6, ArcSiegeSpireMsg.class, ArcSiegeSpireMsgHandler.class), // Activate/Deactivate Spires ARCSUMMON(0xFD816A0A, RecvSummonsMsg.class, RecvSummonsMsgHandler.class), // Suspect Recv Summons Request diff --git a/src/engine/net/client/handlers/InvalidTradeRequestMsgHandler.java b/src/engine/net/client/handlers/InvalidTradeRequestMsgHandler.java new file mode 100644 index 00000000..ea6bcc9d --- /dev/null +++ b/src/engine/net/client/handlers/InvalidTradeRequestMsgHandler.java @@ -0,0 +1,47 @@ +// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . +// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· +// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ +// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ +// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ +// Magicbane Emulator Project © 2013 - 2022 +// www.magicbane.com + +package engine.net.client.handlers; + +import engine.Enum; +import engine.exception.MsgSendException; +import engine.net.Dispatch; +import engine.net.DispatchMessage; +import engine.net.client.ClientConnection; +import engine.net.client.msg.ClientNetMsg; +import engine.net.client.msg.InvalidTradeRequestMsg; +import engine.objects.PlayerCharacter; + +public class InvalidTradeRequestMsgHandler extends AbstractClientMsgHandler { + + public InvalidTradeRequestMsgHandler() { + super(InvalidTradeRequestMsg.class); + } + + @Override + protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { + + PlayerCharacter playerCharacter = origin.getPlayerCharacter(); + + // Member variable declaration + + InvalidTradeRequestMsg msg; + + // Member variable assignment + + msg = (InvalidTradeRequestMsg) baseMsg; + + Dispatch dispatch; + + dispatch = Dispatch.borrow(playerCharacter, msg); + DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY); + + return true; + } + +} \ No newline at end of file