Public Repository for the Magicbane Shadowbane Emulator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.1 KiB

// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.net.client.handlers;
import engine.gameManager.DispatchManager;
import engine.mbEnums;
import engine.net.client.ClientConnection;
import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.SetCombatModeMsg;
import engine.net.client.msg.UpdateStateMsg;
import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;
public class SetCombatModeMsgHandler extends AbstractClientMsgHandler {
public SetCombatModeMsgHandler() {
super();
}
@Override
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
// Member variable declaration
SetCombatModeMsg msg;
boolean toggle;
// Member variable assignment
msg = (SetCombatModeMsg) baseMsg;
if (playerCharacter == null)
return true;
toggle = msg.getToggle();
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);
DispatchManager.dispatchMsgToInterestArea(playerCharacter, rwss, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
return true;
}
}