|
|
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
|
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
|
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
|
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
|
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
|
|
// Magicbane Emulator Project © 2013 - 2022
|
|
|
|
// www.magicbane.com
|
|
|
|
|
|
|
|
package engine.net.client.handlers;
|
|
|
|
|
|
|
|
import engine.exception.MsgSendException;
|
|
|
|
import engine.mbEnums;
|
|
|
|
import engine.net.DispatchMessage;
|
|
|
|
import engine.net.client.ClientConnection;
|
|
|
|
import engine.net.client.msg.ClientNetMsg;
|
|
|
|
import engine.net.client.msg.ToggleCombatMsg;
|
|
|
|
import engine.net.client.msg.UpdateStateMsg;
|
|
|
|
import engine.objects.PlayerCharacter;
|
|
|
|
import engine.server.MBServerStatics;
|
|
|
|
|
|
|
|
public class ToggleCombatMsgHandler extends AbstractClientMsgHandler {
|
|
|
|
|
|
|
|
public ToggleCombatMsgHandler() {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
|
|
|
|
|
|
|
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
|
|
|
|
|
|
|
|
// Member variable declaration
|
|
|
|
|
|
|
|
ToggleCombatMsg msg;
|
|
|
|
boolean toggle;
|
|
|
|
|
|
|
|
// Member variable assignment
|
|
|
|
|
|
|
|
msg = (ToggleCombatMsg) baseMsg;
|
|
|
|
|
|
|
|
if (playerCharacter == null)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
toggle = msg.toggleCombat();
|
|
|
|
playerCharacter.setCombat(toggle);
|
|
|
|
|
|
|
|
if (!toggle) // toggle is move it to false so clear combat target
|
|
|
|
playerCharacter.setCombatTarget(null); //clear last combat target
|
|
|
|
|
|
|
|
UpdateStateMsg rwss = new UpdateStateMsg();
|
|
|
|
rwss.setPlayer(playerCharacter);
|
|
|
|
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, rwss, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|