diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index aef4c228..12223fc0 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -93,13 +93,6 @@ public class ClientMessagePump implements NetMsgHandler { DispatchMessage.dispatchMsgToInterestArea(pc, rwss, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false); } - private static void social(SocialMsg msg, ClientConnection origin) throws MsgSendException { - PlayerCharacter pc = SessionManager.getPlayerCharacter(origin); - if (pc == null) - return; - DispatchMessage.dispatchMsgToInterestArea(pc, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, true); - } - private static void DeleteItem(DeleteItemMsg msg, ClientConnection origin) { CharacterItemManager itemManager = origin.getPlayerCharacter().charItemManager; @@ -826,9 +819,6 @@ public class ClientMessagePump implements NetMsgHandler { case CLIENTADMINCOMMAND: ChatManager.HandleClientAdminCmd((ClientAdminCommandMsg) msg, origin); break; - case SOCIALCHANNEL: - social((SocialMsg) msg, origin); - break; case COMBATMODE: CombatManager.toggleCombat(((ToggleCombatMsg) msg).toggleCombat(), origin); break; diff --git a/src/engine/net/client/Protocol.java b/src/engine/net/client/Protocol.java index 3282adaf..2982992e 100644 --- a/src/engine/net/client/Protocol.java +++ b/src/engine/net/client/Protocol.java @@ -198,7 +198,7 @@ public enum Protocol { TARGETOBJECT(0x64E10938, TargetObjectMsg.class, TargetObjectMsgHandler.class), // Target an object SHOWCOMBATINFO(0x9BF1E5EA, ShowMsg.class, null), // Request/Response /show SHOWVAULTINVENTORY(0xD1FB4842, null, null), // Show Vault Inventory - SOCIALCHANNEL(0x2BF58FA6, SocialMsg.class, null), // Socials + SOCIALCHANNEL(0x2BF58FA6, SocialMsg.class, SocialMsgHandler.class), // Socials STANDARDALERT(0xFA0A24BB, ErrorPopupMsg.class, null), //Popup messages STUCK(0x3D04AF3A, StuckCommandMsg.class, null), // /Stuck Command SWEARINGUILD(0x389B66B1, SwearInGuildMsg.class, SwearInGuildHandler.class), diff --git a/src/engine/net/client/handlers/SocialMsgHandler.java b/src/engine/net/client/handlers/SocialMsgHandler.java new file mode 100644 index 00000000..4a0bca1b --- /dev/null +++ b/src/engine/net/client/handlers/SocialMsgHandler.java @@ -0,0 +1,43 @@ +// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . +// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· +// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ +// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ +// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ +// 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.SocialMsg; +import engine.objects.PlayerCharacter; +import engine.server.MBServerStatics; + +public class SocialMsgHandler extends AbstractClientMsgHandler { + + public SocialMsgHandler() { + super(SocialMsg.class); + } + + @Override + protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { + + PlayerCharacter player = origin.getPlayerCharacter(); + + // Member variable assignment + + SocialMsg msg = (SocialMsg) baseMsg; + + if (player == null) + return true; + + DispatchMessage.dispatchMsgToInterestArea(player, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, true); + + return true; + } + +} \ No newline at end of file