diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index 407d66b4..ebc48f41 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -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 { 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); diff --git a/src/engine/net/client/Protocol.java b/src/engine/net/client/Protocol.java index b4539375..b5ecaa05 100644 --- a/src/engine/net/client/Protocol.java +++ b/src/engine/net/client/Protocol.java @@ -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 diff --git a/src/engine/net/client/handlers/UpdateStateMsgHandler.java b/src/engine/net/client/handlers/UpdateStateMsgHandler.java new file mode 100644 index 00000000..5e78c27b --- /dev/null +++ b/src/engine/net/client/handlers/UpdateStateMsgHandler.java @@ -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; + } + +} \ No newline at end of file