From 5cfbd9998c31d9b02327281d5ce823203297b54f Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 27 Mar 2024 13:29:33 -0400 Subject: [PATCH] Handler created for UseCharterMsg --- src/engine/net/client/ClientMessagePump.java | 7 ---- src/engine/net/client/Protocol.java | 2 +- .../client/handlers/UseCharterMsgHandler.java | 37 +++++++++++++++++++ src/engine/net/client/msg/UseCharterMsg.java | 6 +-- 4 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 src/engine/net/client/handlers/UseCharterMsgHandler.java diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index 12223fc0..f361b541 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -795,13 +795,6 @@ public class ClientMessagePump implements NetMsgHandler { case LEADERCHANNELMESSAGE: ChatManager.handleChatMsg(s, (AbstractChatMsg) msg); break; - case ACTIVATECHARTER: - UseCharterMsg ucm = (UseCharterMsg) msg; - ucm.setUnknown02(1); - ucm.configure(); - Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), ucm); - DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); - break; case CHECKUNIQUEGUILD: break; case CANCELGUILDCREATION: diff --git a/src/engine/net/client/Protocol.java b/src/engine/net/client/Protocol.java index 2982992e..db08d515 100644 --- a/src/engine/net/client/Protocol.java +++ b/src/engine/net/client/Protocol.java @@ -22,7 +22,7 @@ public enum Protocol { NONE(0x0, null, null), ABANDONASSET(0xFDDBB233, AbandonAssetMsg.class, AbandonAssetMsgHandler.class), // AbandonAsset - ACTIVATECHARTER(0x296C0B22, UseCharterMsg.class, null),// Use Guild Charter + USECHARTER(0x296C0B22, UseCharterMsg.class, UseCharterMsgHandler.class),// Use Guild Charter ACTIVATENPC(0xC9AAE81E, ActivateNPCMessage.class, ActivateNPCMsgHandler.class), ACTIVATEPLEDGE(0x5A694DC0, SwearInMsg.class, SwearInHandler.class), // Swear In ADDFRIEND(0xCFA1C787, AddFriendMessage.class, null), diff --git a/src/engine/net/client/handlers/UseCharterMsgHandler.java b/src/engine/net/client/handlers/UseCharterMsgHandler.java new file mode 100644 index 00000000..f61ea384 --- /dev/null +++ b/src/engine/net/client/handlers/UseCharterMsgHandler.java @@ -0,0 +1,37 @@ +// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . +// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· +// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ +// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ +// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ +// Magicbane Emulator Project © 2013 - 2022 +// www.magicbane.com + +package engine.net.client.handlers; + +import engine.Enum.DispatchChannel; +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.KeepAliveServerClientMsg; +import engine.net.client.msg.UseCharterMsg; + +public class UseCharterMsgHandler extends AbstractClientMsgHandler { + + public UseCharterMsgHandler() { + super(KeepAliveServerClientMsg.class); + } + + @Override + protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { + + UseCharterMsg msg = (UseCharterMsg) baseMsg; + msg.setUnknown02(1); + msg.configure(); + Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), msg); + DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); + return true; + } + +} \ No newline at end of file diff --git a/src/engine/net/client/msg/UseCharterMsg.java b/src/engine/net/client/msg/UseCharterMsg.java index 4f2cadac..d2c1e193 100644 --- a/src/engine/net/client/msg/UseCharterMsg.java +++ b/src/engine/net/client/msg/UseCharterMsg.java @@ -35,11 +35,11 @@ public class UseCharterMsg extends ClientNetMsg { * This is the general purpose constructor. */ public UseCharterMsg() { - super(Protocol.ACTIVATECHARTER); + super(Protocol.USECHARTER); } public UseCharterMsg(PlayerCharacter player, boolean close) { - super(Protocol.ACTIVATECHARTER); + super(Protocol.USECHARTER); this.close = close; this.player = player; @@ -52,7 +52,7 @@ public class UseCharterMsg extends ClientNetMsg { * caller. */ public UseCharterMsg(AbstractConnection origin, ByteBufferReader reader) { - super(Protocol.ACTIVATECHARTER, origin, reader); + super(Protocol.USECHARTER, origin, reader); } /**