forked from MagicBane/Server
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.
45 lines
1.8 KiB
45 lines
1.8 KiB
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . |
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· |
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ |
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ |
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ |
|
// Magicbane Emulator Project © 2013 - 2022 |
|
// www.magicbane.com |
|
|
|
package engine.net.client.handlers; |
|
|
|
import engine.exception.MsgSendException; |
|
import engine.gameManager.SessionManager; |
|
import engine.mbEnums; |
|
import engine.net.client.ClientConnection; |
|
import engine.net.client.msg.ClientNetMsg; |
|
import engine.net.client.msg.TargetObjectMsg; |
|
import engine.objects.PlayerCharacter; |
|
|
|
public class TargetObjectMsgHandler extends AbstractClientMsgHandler { |
|
|
|
public TargetObjectMsgHandler() { |
|
super(); |
|
} |
|
|
|
@Override |
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { |
|
|
|
TargetObjectMsg msg = (TargetObjectMsg) baseMsg; |
|
|
|
PlayerCharacter player = SessionManager.getPlayerCharacter(origin); |
|
|
|
if (player == null) |
|
return true; |
|
|
|
// TODO improve this later. hacky way to make sure player ingame is |
|
// active. |
|
|
|
if (!player.isActive()) |
|
player.setActive(true); |
|
|
|
player.setLastTarget(mbEnums.GameObjectType.values()[msg.getTargetType()], msg.getTargetID()); |
|
return true; |
|
} |
|
|
|
} |