forked from MagicBane/Server
MagicBot
8 months ago
7 changed files with 99 additions and 52 deletions
@ -0,0 +1,43 @@ |
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.net.client.handlers; |
||||||
|
|
||||||
|
import engine.exception.MsgSendException; |
||||||
|
import engine.net.client.ClientConnection; |
||||||
|
import engine.net.client.msg.ClientNetMsg; |
||||||
|
import engine.net.client.msg.GoldFromVaultMsg; |
||||||
|
import engine.objects.Account; |
||||||
|
import engine.objects.PlayerCharacter; |
||||||
|
|
||||||
|
public class GoldFromVaultMsgHandler extends AbstractClientMsgHandler { |
||||||
|
|
||||||
|
public GoldFromVaultMsgHandler() { |
||||||
|
super(GoldFromVaultMsg.class); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { |
||||||
|
|
||||||
|
PlayerCharacter player = origin.getPlayerCharacter(); |
||||||
|
|
||||||
|
GoldFromVaultMsg msg = (GoldFromVaultMsg) baseMsg; |
||||||
|
|
||||||
|
if (player == null) |
||||||
|
return true; |
||||||
|
|
||||||
|
Account account = player.getAccount(); |
||||||
|
|
||||||
|
if (account == null) |
||||||
|
return true; |
||||||
|
|
||||||
|
account.transferGoldFromVaultToInventory(msg, origin); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,43 @@ |
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.net.client.handlers; |
||||||
|
|
||||||
|
import engine.exception.MsgSendException; |
||||||
|
import engine.net.client.ClientConnection; |
||||||
|
import engine.net.client.msg.ClientNetMsg; |
||||||
|
import engine.net.client.msg.GoldToVaultMsg; |
||||||
|
import engine.objects.Account; |
||||||
|
import engine.objects.PlayerCharacter; |
||||||
|
|
||||||
|
public class GoldToVaultMsgHandler extends AbstractClientMsgHandler { |
||||||
|
|
||||||
|
public GoldToVaultMsgHandler() { |
||||||
|
super(GoldToVaultMsg.class); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { |
||||||
|
|
||||||
|
PlayerCharacter player = origin.getPlayerCharacter(); |
||||||
|
|
||||||
|
GoldToVaultMsg msg = (GoldToVaultMsg) baseMsg; |
||||||
|
|
||||||
|
if (player == null) |
||||||
|
return true; |
||||||
|
|
||||||
|
Account account = player.getAccount(); |
||||||
|
|
||||||
|
if (account == null) |
||||||
|
return true; |
||||||
|
|
||||||
|
account.transferGoldFromInventoryToVault(msg, origin); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue