Browse Source

Handler created for LFGmsg

combat-2
MagicBot 8 months ago
parent
commit
e86097d732
  1. 20
      src/engine/net/client/ClientMessagePump.java
  2. 2
      src/engine/net/client/Protocol.java
  3. 59
      src/engine/net/client/handlers/ToggleLfgRecruitingMsgHandler.java

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

@ -48,22 +48,6 @@ public class ClientMessagePump implements NetMsgHandler {
this.server = server; 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 { private static void toggleSitStand(ToggleSitStandMsg msg, ClientConnection origin) throws MsgSendException {
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin); PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
if (pc == null) if (pc == null)
@ -378,10 +362,6 @@ public class ClientMessagePump implements NetMsgHandler {
break; break;
case OPENVAULT: case OPENVAULT:
break; break;
case MODIFYGUILDSTATE:
ToggleLfgRecruitingMsg tlrm = (ToggleLfgRecruitingMsg) msg;
toggleLfgRecruiting(tlrm, origin);
break;
case TOGGLESITSTAND: case TOGGLESITSTAND:
ToggleSitStandMsg tssm = (ToggleSitStandMsg) msg; ToggleSitStandMsg tssm = (ToggleSitStandMsg) msg;
toggleSitStand(tssm, origin); toggleSitStand(tssm, origin);

2
src/engine/net/client/Protocol.java

@ -140,7 +140,7 @@ public enum Protocol {
MANAGENPC(0x43A273FA, null, null), // Open Hireling Management Page 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 MERCHANT(0x3E645EF4, MerchantMsg.class, MerchantMsgHandler.class), // Open Teleport List, Teleport, Open Shrine, Request Boon, open/manage warehouse window
MINIONTRAINING(0xD355F528, MinionTrainingMessage.class, MinionTrainingMsgHandler.class), 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 MOTD(0xEC841E8D, MOTDMsg.class, MOTDEditHandler.class), //Send/Rec Guild/Nation/IC MOTD Message
MOVECORRECTION(0x47FAD1E3, null, null), //Force move to point? MOVECORRECTION(0x47FAD1E3, null, null), //Force move to point?
MOVEOBJECTTOCONTAINER(0xD1639F7C, LootMsg.class, LootMsgHandler.class), //Send/Recv MoveObjectToContainer Msg MOVEOBJECTTOCONTAINER(0xD1639F7C, LootMsg.class, LootMsgHandler.class), //Send/Recv MoveObjectToContainer Msg

59
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;
}
}
Loading…
Cancel
Save