Handlers created for gold-vault interactions
This commit is contained in:
@@ -187,39 +187,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
ChatManager.chatInfoError(player, "Can't transfer to vault: " + reason);
|
ChatManager.chatInfoError(player, "Can't transfer to vault: " + reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void transferGoldFromVaultToInventory(TransferGoldFromVaultToInventoryMsg msg, ClientConnection origin) {
|
|
||||||
|
|
||||||
PlayerCharacter player = origin.getPlayerCharacter();
|
|
||||||
|
|
||||||
|
|
||||||
if (player == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Account account = player.getAccount();
|
|
||||||
|
|
||||||
if (account == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
account.transferGoldFromVaultToInventory(msg, origin);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void transferGoldFromInventoryToVault(TransferGoldFromInventoryToVaultMsg msg, ClientConnection origin) {
|
|
||||||
|
|
||||||
PlayerCharacter player = origin.getPlayerCharacter();
|
|
||||||
Dispatch dispatch;
|
|
||||||
|
|
||||||
if (player == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Account account = player.getAccount();
|
|
||||||
|
|
||||||
if (account == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
account.transferGoldFromInventoryToVault(msg, origin);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void DeleteItem(DeleteItemMsg msg, ClientConnection origin) {
|
private static void DeleteItem(DeleteItemMsg msg, ClientConnection origin) {
|
||||||
|
|
||||||
CharacterItemManager itemManager = origin.getPlayerCharacter().charItemManager;
|
CharacterItemManager itemManager = origin.getPlayerCharacter().charItemManager;
|
||||||
@@ -1144,12 +1111,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
case SHOWCOMBATINFO:
|
case SHOWCOMBATINFO:
|
||||||
show((ShowMsg) msg, origin);
|
show((ShowMsg) msg, origin);
|
||||||
break;
|
break;
|
||||||
case TRANSFERGOLDFROMVAULTTOINVENTORY:
|
|
||||||
transferGoldFromVaultToInventory((TransferGoldFromVaultToInventoryMsg) msg, origin);
|
|
||||||
break;
|
|
||||||
case GOLDTOVAULT:
|
|
||||||
transferGoldFromInventoryToVault((TransferGoldFromInventoryToVaultMsg) msg, origin);
|
|
||||||
break;
|
|
||||||
case REQUESTTOTRADE:
|
case REQUESTTOTRADE:
|
||||||
TradeManager.tradeRequest((TradeRequestMsg) msg, origin);
|
TradeManager.tradeRequest((TradeRequestMsg) msg, origin);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -99,7 +99,8 @@ public enum Protocol {
|
|||||||
FURNITURE(0xCE7FA503, FurnitureMsg.class, FurnitureHandler.class),
|
FURNITURE(0xCE7FA503, FurnitureMsg.class, FurnitureHandler.class),
|
||||||
GAMESERVERIPRESPONSE(0x6C95CF87, GameServerIPResponseMsg.class, null), // Game Server IP Response
|
GAMESERVERIPRESPONSE(0x6C95CF87, GameServerIPResponseMsg.class, null), // Game Server IP Response
|
||||||
GLOBALCHANNELMESSAGE(0x2bf03fd2, null, null),
|
GLOBALCHANNELMESSAGE(0x2bf03fd2, null, null),
|
||||||
GOLDTOVAULT(0x3ABAEE49, TransferGoldFromInventoryToVaultMsg.class, null), // Transfer Gold from Inventory to Vault
|
GOLDFROMVAULT(0x011D0123, GoldFromVaultMsg.class, GoldFromVaultMsgHandler.class), // Transfer Gold from Vault to Inventory
|
||||||
|
GOLDTOVAULT(0x3ABAEE49, GoldToVaultMsg.class, GoldToVaultMsgHandler.class), // Transfer Gold from Inventory to Vault
|
||||||
GROUPDISBAND(0xE2B85AA4, DisbandGroupMsg.class, DisbandGroupHandler.class), //Disband Group
|
GROUPDISBAND(0xE2B85AA4, DisbandGroupMsg.class, DisbandGroupHandler.class), //Disband Group
|
||||||
GROUPFOLLOW(0xC61B0476, FormationFollowMsg.class, FormationFollowHandler.class), //Toggle Follow, set Formation
|
GROUPFOLLOW(0xC61B0476, FormationFollowMsg.class, FormationFollowHandler.class), //Toggle Follow, set Formation
|
||||||
GROUPLEADERAPPOINT(0xEF778DD3, AppointGroupLeaderMsg.class, AppointGroupLeaderHandler.class), //Appoint new group leader
|
GROUPLEADERAPPOINT(0xEF778DD3, AppointGroupLeaderMsg.class, AppointGroupLeaderHandler.class), //Appoint new group leader
|
||||||
@@ -221,7 +222,6 @@ public enum Protocol {
|
|||||||
TRAINERLIST(0x41FABA62, TrainerInfoMsg.class, null), //Req/Send Trainer Info/Pricing
|
TRAINERLIST(0x41FABA62, TrainerInfoMsg.class, null), //Req/Send Trainer Info/Pricing
|
||||||
TRAINSKILL(0xB0BF68CD, TrainMsg.class, null), //Train skills/powers
|
TRAINSKILL(0xB0BF68CD, TrainMsg.class, null), //Train skills/powers
|
||||||
TRANSFERASSET(0x3EA1C4C9, TransferAssetMsg.class, TransferAssetMsgHandler.class), // Transfer Building
|
TRANSFERASSET(0x3EA1C4C9, TransferAssetMsg.class, TransferAssetMsgHandler.class), // Transfer Building
|
||||||
TRANSFERGOLDFROMVAULTTOINVENTORY(0x011D0123, TransferGoldFromVaultToInventoryMsg.class, null), // Transfer Gold from Vault to Inventory
|
|
||||||
TRANSFERGOLDTOFROMBUILDING(0x1B1AC8C7, TransferGoldToFromBuildingMsg.class, TransferGoldToFromBuildingMsgHandler.class), // Transfer Gold to/From Building, Transfer Error
|
TRANSFERGOLDTOFROMBUILDING(0x1B1AC8C7, TransferGoldToFromBuildingMsg.class, TransferGoldToFromBuildingMsgHandler.class), // Transfer Gold to/From Building, Transfer Error
|
||||||
TRANSFERITEMFROMBANK(0x9D04977B, TransferItemFromBankMsg.class, TransferItemFromBankMsgHandler.class), // Transfer Item from Bank to Inventory
|
TRANSFERITEMFROMBANK(0x9D04977B, TransferItemFromBankMsg.class, TransferItemFromBankMsgHandler.class), // Transfer Item from Bank to Inventory
|
||||||
TRANSFERITEMTOBANK(0xD48C46FA, TransferItemToBankMsg.class, TransferItemToBankMsgHandler.class), // Transfer Item from Inventory to Bank
|
TRANSFERITEMTOBANK(0xD48C46FA, TransferItemToBankMsg.class, TransferItemToBankMsgHandler.class), // Transfer Item from Inventory to Bank
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+5
-5
@@ -21,7 +21,7 @@ import engine.net.client.Protocol;
|
|||||||
*
|
*
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*/
|
*/
|
||||||
public class TransferGoldFromVaultToInventoryMsg extends ClientNetMsg {
|
public class GoldFromVaultMsg extends ClientNetMsg {
|
||||||
|
|
||||||
private long unknown01;
|
private long unknown01;
|
||||||
private long playerCompID;
|
private long playerCompID;
|
||||||
@@ -31,8 +31,8 @@ public class TransferGoldFromVaultToInventoryMsg extends ClientNetMsg {
|
|||||||
/**
|
/**
|
||||||
* This is the general purpose constructor
|
* This is the general purpose constructor
|
||||||
*/
|
*/
|
||||||
public TransferGoldFromVaultToInventoryMsg(long unknown01, long playerCompID, long accountCompID, int amount) {
|
public GoldFromVaultMsg(long unknown01, long playerCompID, long accountCompID, int amount) {
|
||||||
super(Protocol.TRANSFERGOLDFROMVAULTTOINVENTORY);
|
super(Protocol.GOLDFROMVAULT);
|
||||||
this.unknown01 = unknown01;
|
this.unknown01 = unknown01;
|
||||||
this.playerCompID = playerCompID;
|
this.playerCompID = playerCompID;
|
||||||
this.accountCompID = accountCompID;
|
this.accountCompID = accountCompID;
|
||||||
@@ -44,8 +44,8 @@ public class TransferGoldFromVaultToInventoryMsg extends ClientNetMsg {
|
|||||||
* past the limit) then this constructor Throws that Exception to the
|
* past the limit) then this constructor Throws that Exception to the
|
||||||
* caller.
|
* caller.
|
||||||
*/
|
*/
|
||||||
public TransferGoldFromVaultToInventoryMsg(AbstractConnection origin, ByteBufferReader reader) {
|
public GoldFromVaultMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||||
super(Protocol.TRANSFERGOLDFROMVAULTTOINVENTORY, origin, reader);
|
super(Protocol.GOLDFROMVAULT, origin, reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
+4
-4
@@ -22,7 +22,7 @@ import engine.net.client.Protocol;
|
|||||||
* @author Eighty
|
* @author Eighty
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class TransferGoldFromInventoryToVaultMsg extends ClientNetMsg {
|
public class GoldToVaultMsg extends ClientNetMsg {
|
||||||
|
|
||||||
private int playerID;
|
private int playerID;
|
||||||
private int accountID;
|
private int accountID;
|
||||||
@@ -33,12 +33,12 @@ public class TransferGoldFromInventoryToVaultMsg extends ClientNetMsg {
|
|||||||
/**
|
/**
|
||||||
* This is the general purpose constructor
|
* This is the general purpose constructor
|
||||||
*/
|
*/
|
||||||
public TransferGoldFromInventoryToVaultMsg() {
|
public GoldToVaultMsg() {
|
||||||
super(Protocol.GOLDTOVAULT);
|
super(Protocol.GOLDTOVAULT);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TransferGoldFromInventoryToVaultMsg(int playerID, int npcID, int accountID, int amount) {
|
public GoldToVaultMsg(int playerID, int npcID, int accountID, int amount) {
|
||||||
super(Protocol.GOLDTOVAULT);
|
super(Protocol.GOLDTOVAULT);
|
||||||
this.playerID = playerID;
|
this.playerID = playerID;
|
||||||
this.npcID = npcID;
|
this.npcID = npcID;
|
||||||
@@ -52,7 +52,7 @@ public class TransferGoldFromInventoryToVaultMsg extends ClientNetMsg {
|
|||||||
* past the limit) then this constructor Throws that Exception to the
|
* past the limit) then this constructor Throws that Exception to the
|
||||||
* caller.
|
* caller.
|
||||||
*/
|
*/
|
||||||
public TransferGoldFromInventoryToVaultMsg(AbstractConnection origin, ByteBufferReader reader) {
|
public GoldToVaultMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||||
super(Protocol.GOLDTOVAULT, origin, reader);
|
super(Protocol.GOLDTOVAULT, origin, reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@ public class Account extends AbstractGameObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void transferGoldFromVaultToInventory(TransferGoldFromVaultToInventoryMsg msg, ClientConnection origin) {
|
public synchronized void transferGoldFromVaultToInventory(GoldFromVaultMsg msg, ClientConnection origin) {
|
||||||
|
|
||||||
PlayerCharacter player = origin.getPlayerCharacter();
|
PlayerCharacter player = origin.getPlayerCharacter();
|
||||||
Dispatch dispatch;
|
Dispatch dispatch;
|
||||||
@@ -332,7 +332,7 @@ public class Account extends AbstractGameObject {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void transferGoldFromInventoryToVault(TransferGoldFromInventoryToVaultMsg msg, ClientConnection origin) {
|
public synchronized void transferGoldFromInventoryToVault(GoldToVaultMsg msg, ClientConnection origin) {
|
||||||
|
|
||||||
PlayerCharacter player = origin.getPlayerCharacter();
|
PlayerCharacter player = origin.getPlayerCharacter();
|
||||||
Dispatch dispatch;
|
Dispatch dispatch;
|
||||||
|
|||||||
Reference in New Issue
Block a user