MagicBot
8 months ago
5 changed files with 50 additions and 23 deletions
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
package engine.net.client.handlers; |
||||
|
||||
import engine.Enum; |
||||
import engine.exception.MsgSendException; |
||||
import engine.gameManager.SessionManager; |
||||
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(TargetObjectMsg.class); |
||||
} |
||||
|
||||
@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(Enum.GameObjectType.values()[msg.getTargetType()], msg.getTargetID()); |
||||
return true; |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue