diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index 2e1b0a84..2f672355 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -48,22 +48,6 @@ public class ClientMessagePump implements NetMsgHandler { this.server = server; } - private static void toggleLfgRecruiting(ToggleLfgRecruitingMsg msg, ClientConnection origin) throws MsgSendException { - PlayerCharacter pc = SessionManager.getPlayerCharacter(origin); - if (pc == null) - return; - int num = msg.toggleLfgRecruiting(); - if (num == 1) - pc.toggleLFGroup(); - else if (num == 2) - pc.toggleLFGuild(); - else if (num == 3) - pc.toggleRecruiting(); - UpdateStateMsg rwss = new UpdateStateMsg(); - rwss.setPlayer(pc); - DispatchMessage.dispatchMsgToInterestArea(pc, rwss, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false); - } - private static void toggleSitStand(ToggleSitStandMsg msg, ClientConnection origin) throws MsgSendException { PlayerCharacter pc = SessionManager.getPlayerCharacter(origin); if (pc == null) @@ -378,10 +362,6 @@ public class ClientMessagePump implements NetMsgHandler { break; case OPENVAULT: break; - case MODIFYGUILDSTATE: - ToggleLfgRecruitingMsg tlrm = (ToggleLfgRecruitingMsg) msg; - toggleLfgRecruiting(tlrm, origin); - break; case TOGGLESITSTAND: ToggleSitStandMsg tssm = (ToggleSitStandMsg) msg; toggleSitStand(tssm, origin); diff --git a/src/engine/net/client/Protocol.java b/src/engine/net/client/Protocol.java index 05aefd66..274ee5aa 100644 --- a/src/engine/net/client/Protocol.java +++ b/src/engine/net/client/Protocol.java @@ -140,7 +140,7 @@ public enum Protocol { MANAGENPC(0x43A273FA, null, null), // Open Hireling Management Page MERCHANT(0x3E645EF4, MerchantMsg.class, MerchantMsgHandler.class), // Open Teleport List, Teleport, Open Shrine, Request Boon, open/manage warehouse window MINIONTRAINING(0xD355F528, MinionTrainingMessage.class, MinionTrainingMsgHandler.class), - MODIFYGUILDSTATE(0x38936FEA, ToggleLfgRecruitingMsg.class, null), //Toggle LFGroup/LFGuild/Recruiting + MODIFYGUILDSTATE(0x38936FEA, ToggleLfgRecruitingMsg.class, ToggleLfgRecruitingMsgHandler.class), //Toggle LFGroup/LFGuild/Recruiting MOTD(0xEC841E8D, MOTDMsg.class, MOTDEditHandler.class), //Send/Rec Guild/Nation/IC MOTD Message MOVECORRECTION(0x47FAD1E3, null, null), //Force move to point? MOVEOBJECTTOCONTAINER(0xD1639F7C, LootMsg.class, LootMsgHandler.class), //Send/Recv MoveObjectToContainer Msg diff --git a/src/engine/net/client/handlers/ToggleLfgRecruitingMsgHandler.java b/src/engine/net/client/handlers/ToggleLfgRecruitingMsgHandler.java new file mode 100644 index 00000000..b2a1dc04 --- /dev/null +++ b/src/engine/net/client/handlers/ToggleLfgRecruitingMsgHandler.java @@ -0,0 +1,59 @@ +// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . +// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· +// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ +// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ +// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ +// Magicbane Emulator Project © 2013 - 2022 +// www.magicbane.com + +package engine.net.client.handlers; + +import engine.Enum.DispatchChannel; +import engine.exception.MsgSendException; +import engine.net.DispatchMessage; +import engine.net.client.ClientConnection; +import engine.net.client.msg.ClientNetMsg; +import engine.net.client.msg.ToggleLfgRecruitingMsg; +import engine.net.client.msg.UpdateStateMsg; +import engine.objects.PlayerCharacter; +import engine.server.MBServerStatics; + +public class ToggleLfgRecruitingMsgHandler extends AbstractClientMsgHandler { + + public ToggleLfgRecruitingMsgHandler() { + super(ToggleLfgRecruitingMsg.class); + } + + @Override + protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { + + PlayerCharacter playerCharacter = origin.getPlayerCharacter(); + + // Member variable declaration + + ToggleLfgRecruitingMsg msg; + + // Member variable assignment + + msg = (ToggleLfgRecruitingMsg) baseMsg; + + if (playerCharacter == null) + return true; + + int num = msg.toggleLfgRecruiting(); + + if (num == 1) + playerCharacter.toggleLFGroup(); + else if (num == 2) + playerCharacter.toggleLFGuild(); + else if (num == 3) + playerCharacter.toggleRecruiting(); + + UpdateStateMsg rwss = new UpdateStateMsg(); + rwss.setPlayer(playerCharacter); + DispatchMessage.dispatchMsgToInterestArea(playerCharacter, rwss, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false); + + return true; + } + +} \ No newline at end of file