|
|
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
|
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
|
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
|
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
|
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
|
|
// Magicbane Emulator Project © 2013 - 2022
|
|
|
|
// www.magicbane.com
|
|
|
|
|
|
|
|
package engine.net.client.handlers;
|
|
|
|
|
|
|
|
import engine.exception.MsgSendException;
|
|
|
|
import engine.mbEnums.DispatchChannel;
|
|
|
|
import engine.net.Dispatch;
|
|
|
|
import engine.net.DispatchMessage;
|
|
|
|
import engine.net.client.ClientConnection;
|
|
|
|
import engine.net.client.msg.ClientNetMsg;
|
|
|
|
import engine.net.client.msg.ViewResourcesMsg;
|
|
|
|
import engine.objects.Building;
|
|
|
|
import engine.objects.City;
|
|
|
|
import engine.objects.Guild;
|
|
|
|
import engine.objects.PlayerCharacter;
|
|
|
|
|
|
|
|
public class ViewResourcesMsgHandler extends AbstractClientMsgHandler {
|
|
|
|
|
|
|
|
public ViewResourcesMsgHandler() {
|
|
|
|
super(ViewResourcesMsg.class);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
|
|
|
|
|
|
|
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
|
|
|
|
|
|
|
|
// Member variable declaration
|
|
|
|
|
|
|
|
ViewResourcesMsg msg;
|
|
|
|
|
|
|
|
// Member variable assignment
|
|
|
|
|
|
|
|
msg = (ViewResourcesMsg) baseMsg;
|
|
|
|
|
|
|
|
Guild guild = playerCharacter.getGuild();
|
|
|
|
City city = guild.getOwnedCity();
|
|
|
|
|
|
|
|
if (city == null)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if (city.warehouse == null)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
Building warehouseBuilding = city.warehouse.building;
|
|
|
|
|
|
|
|
if (warehouseBuilding == null)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
ViewResourcesMsg vrm = new ViewResourcesMsg(playerCharacter);
|
|
|
|
vrm.setWarehouseBuilding(warehouseBuilding);
|
|
|
|
vrm.setGuild(playerCharacter.getGuild());
|
|
|
|
vrm.configure();
|
|
|
|
|
|
|
|
Dispatch dispatch = Dispatch.borrow(playerCharacter, vrm);
|
|
|
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|