forked from MagicBane/Server
MagicBot
8 months ago
8 changed files with 83 additions and 48 deletions
@ -0,0 +1,65 @@
@@ -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.gameManager.BuildingManager; |
||||
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; |
||||
|
||||
Building warehouse = BuildingManager.getBuilding(city.getWarehouseBuildingID()); |
||||
|
||||
if (warehouse == null) |
||||
return true; |
||||
|
||||
ViewResourcesMsg vrm = new ViewResourcesMsg(playerCharacter); |
||||
vrm.setWarehouseBuilding(warehouse); |
||||
vrm.setGuild(playerCharacter.getGuild()); |
||||
vrm.configure(); |
||||
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, vrm); |
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue