Browse Source

Handler created for UpdateStateMsg

combat-2
MagicBot 8 months ago
parent
commit
4598709ba1
  1. 20
      src/engine/net/client/ClientMessagePump.java
  2. 2
      src/engine/net/client/Protocol.java
  3. 48
      src/engine/net/client/handlers/UpdateStateMsgHandler.java

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

@ -73,22 +73,6 @@ public class ClientMessagePump implements NetMsgHandler { @@ -73,22 +73,6 @@ public class ClientMessagePump implements NetMsgHandler {
pc.getTimestamps().put("WHO", System.currentTimeMillis() + 3000);
}
// *** Refactor need to figure this out.
// Commented out for some reson or another.
private static void runWalkSitStand(UpdateStateMsg msg, ClientConnection origin) throws MsgSendException {
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
if (pc == null)
return;
pc.update();
if (msg.getSpeed() == 2)
pc.setWalkMode(false);
else
pc.setWalkMode(true);
DispatchMessage.dispatchMsgToInterestArea(pc, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
}
private static void toggleLfgRecruiting(ToggleLfgRecruitingMsg msg, ClientConnection origin) throws MsgSendException {
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
if (pc == null)
@ -839,10 +823,6 @@ public class ClientMessagePump implements NetMsgHandler { @@ -839,10 +823,6 @@ public class ClientMessagePump implements NetMsgHandler {
case LEADERCHANNELMESSAGE:
ChatManager.handleChatMsg(s, (AbstractChatMsg) msg);
break;
case UPDATESTATE:
UpdateStateMsg rwss = (UpdateStateMsg) msg;
runWalkSitStand(rwss, origin);
break;
case ACTIVATECHARTER:
UseCharterMsg ucm = (UseCharterMsg) msg;
ucm.setUnknown02(1);

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

@ -234,7 +234,7 @@ public enum Protocol { @@ -234,7 +234,7 @@ public enum Protocol {
UPDATEGROUP(0x004E6BCE, GroupUpdateMsg.class, GroupUpdateHandler.class), // Update Group Info
UPDATEGUILD(0x001D4DF6, GuildInfoMsg.class, GuildInfoHandler.class), // REQ / CMD Promote/Demote Screen
UPDATEOBJECT(0x1A724739, null, null),
UPDATESTATE(0x001A45FB, UpdateStateMsg.class, null), // REQ / CMD Toggle Run/Walk Sit/Stand :: UpdateStateMessage
UPDATESTATE(0x001A45FB, UpdateStateMsg.class, UpdateStateMsgHandler.class), // REQ / CMD Toggle Run/Walk Sit/Stand :: UpdateStateMessage
UPDATETRADEWINDOW(0x406EBDE6, UpdateTradeWindowMsg.class, null), // Trade Complete
UPGRADEASSET(0x2B85A865, UpgradeAssetMessage.class, UpgradeAssetMsgHandler.class),
VENDORDIALOG(0x98ACD594, VendorDialogMsg.class, VendorDialogMsgHandler.class), // Send/Recv Vendor Dialog

48
src/engine/net/client/handlers/UpdateStateMsgHandler.java

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.net.client.handlers;
import engine.Enum.DispatchChannel;
import engine.exception.MsgSendException;
import engine.gameManager.SessionManager;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.UpdateStateMsg;
import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;
public class UpdateStateMsgHandler extends AbstractClientMsgHandler {
public UpdateStateMsgHandler() {
super(UpdateStateMsg.class);
}
@Override
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
UpdateStateMsg msg = (UpdateStateMsg) baseMsg;
PlayerCharacter player = SessionManager.getPlayerCharacter(origin);
if (player == null)
return true;
player.update();
if (msg.getSpeed() == 2)
player.setWalkMode(false);
else
player.setWalkMode(true);
DispatchMessage.dispatchMsgToInterestArea(player, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
return true;
}
}
Loading…
Cancel
Save