Browse Source

Handler created for SocialMSg

combat-2
MagicBot 8 months ago
parent
commit
68ae9c1b97
  1. 10
      src/engine/net/client/ClientMessagePump.java
  2. 2
      src/engine/net/client/Protocol.java
  3. 43
      src/engine/net/client/handlers/SocialMsgHandler.java

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

@ -93,13 +93,6 @@ public class ClientMessagePump implements NetMsgHandler { @@ -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 { @@ -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;

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

@ -198,7 +198,7 @@ public enum Protocol { @@ -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),

43
src/engine/net/client/handlers/SocialMsgHandler.java

@ -0,0 +1,43 @@ @@ -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;
}
}
Loading…
Cancel
Save