forked from MagicBane/Server
MagicBot
8 months ago
3 changed files with 66 additions and 30 deletions
@ -0,0 +1,65 @@ |
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// 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.ToggleSitStandMsg; |
||||||
|
import engine.net.client.msg.UpdateStateMsg; |
||||||
|
import engine.objects.PlayerCharacter; |
||||||
|
import engine.server.MBServerStatics; |
||||||
|
|
||||||
|
public class ToggleSitStandMsgHandler extends AbstractClientMsgHandler { |
||||||
|
|
||||||
|
public ToggleSitStandMsgHandler() { |
||||||
|
super(ToggleSitStandMsg.class); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { |
||||||
|
|
||||||
|
PlayerCharacter playerCharacter = origin.getPlayerCharacter(); |
||||||
|
|
||||||
|
// Member variable declaration
|
||||||
|
|
||||||
|
ToggleSitStandMsg msg; |
||||||
|
|
||||||
|
// Member variable assignment
|
||||||
|
|
||||||
|
msg = (ToggleSitStandMsg) baseMsg; |
||||||
|
|
||||||
|
if (playerCharacter == null) |
||||||
|
return true; |
||||||
|
|
||||||
|
playerCharacter.update(); |
||||||
|
|
||||||
|
playerCharacter.setSit(msg.toggleSitStand()); |
||||||
|
|
||||||
|
// cancel effects that break on sit
|
||||||
|
if (playerCharacter.isSit()) { |
||||||
|
playerCharacter.setCombat(false); |
||||||
|
playerCharacter.cancelOnSit(); |
||||||
|
} |
||||||
|
|
||||||
|
UpdateStateMsg rwss = new UpdateStateMsg(); |
||||||
|
|
||||||
|
if (playerCharacter.isSit()) { |
||||||
|
playerCharacter.setCombat(false); |
||||||
|
rwss.setAware(1); |
||||||
|
} |
||||||
|
rwss.setPlayer(playerCharacter); |
||||||
|
|
||||||
|
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, rwss, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue