Public Repository for the Magicbane Shadowbane Emulator
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.

62 lines
1.7 KiB

package engine.net.client.handlers;
import engine.gameManager.BuildingManager;
import engine.gameManager.DispatchManager;
import engine.gameManager.SessionManager;
import engine.mbEnums;
import engine.net.Dispatch;
import engine.net.client.ClientConnection;
import engine.net.client.msg.ArcViewAssetTransactionsMsg;
import engine.net.client.msg.ClientNetMsg;
import engine.objects.Building;
import engine.objects.City;
import engine.objects.PlayerCharacter;
import engine.objects.Warehouse;
/*
* @Author:
* @Summary: Processes application protocol message which transfers
* gold between a building's strongbox and a player character.
*/
public class ArcViewAssetTransactionsMsgHandler extends AbstractClientMsgHandler {
public ArcViewAssetTransactionsMsgHandler() {
super();
}
@Override
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
PlayerCharacter player;
ArcViewAssetTransactionsMsg msg;
ArcViewAssetTransactionsMsg newMsg;
player = SessionManager.getPlayerCharacter(origin);
Dispatch dispatch;
if (player == null)
return true;
msg = (ArcViewAssetTransactionsMsg) baseMsg;
Building warehouseBuilding = BuildingManager.getBuilding(msg.getWarehouseID());
City city = warehouseBuilding.getCity();
if (city == null)
return true;
Warehouse warehouse = city.warehouse;
if (warehouse == null)
return true;
newMsg = new ArcViewAssetTransactionsMsg(warehouse, msg);
newMsg.configure();
dispatch = Dispatch.borrow(player, newMsg);
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
return true;
}
}