forked from MagicBane/Server
Protocol handler created for ArcMineWindowAvailableTimeMsg.
This commit is contained in:
@@ -262,9 +262,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
case VENDORDIALOG:
|
||||
VendorDialogMsg.replyDialog((VendorDialogMsg) msg, origin);
|
||||
break;
|
||||
case ARCMINEWINDOWAVAILABLETIME:
|
||||
MineWindowAvailableTime((ArcMineWindowAvailableTimeMsg) msg, origin);
|
||||
break;
|
||||
case ARCOWNEDMINESLIST:
|
||||
ListOwnedMines((ArcOwnedMinesListMsg) msg, origin);
|
||||
break;
|
||||
@@ -1426,37 +1423,6 @@ boolean updateCity = false;
|
||||
|
||||
}
|
||||
|
||||
private static void MineWindowAvailableTime(ArcMineWindowAvailableTimeMsg msg, ClientConnection origin) {
|
||||
Building tol = BuildingManager.getBuildingFromCache(msg.getBuildingUUID());
|
||||
Dispatch dispatch;
|
||||
|
||||
if (tol == null)
|
||||
return;
|
||||
|
||||
if (tol.getBlueprintUUID() == 0)
|
||||
return;
|
||||
|
||||
if (tol.getBlueprint().getBuildingGroup() != BuildingGroup.TOL)
|
||||
return;
|
||||
|
||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||
|
||||
if (pc == null)
|
||||
return;
|
||||
|
||||
if (!Guild.sameGuild(tol.getGuild(), pc.getGuild()))
|
||||
return; //must be same guild
|
||||
|
||||
if (GuildStatusController.isInnerCouncil(pc.getGuildStatus()) == false) // is this only GL?
|
||||
return;
|
||||
|
||||
ArcMineWindowAvailableTimeMsg amwat = new ArcMineWindowAvailableTimeMsg(tol, 10);
|
||||
amwat.configure();
|
||||
dispatch = Dispatch.borrow(pc, amwat);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
|
||||
private static void ListOwnedMines(ArcOwnedMinesListMsg msg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||
|
||||
@@ -35,7 +35,7 @@ public enum Protocol {
|
||||
ARCLOGINNOTIFY(0x010FED87, ArcLoginNotifyMsg.class, ArcLoginNotifyMsgHandler.class), //Client Confirms entering world
|
||||
ARCMINECHANGEPRODUCTION(0x1EAA993F, ArcMineChangeProductionMsg.class, null),
|
||||
ARCMINETOWERCRESTUPDATE(0x34164D0D, null, null),
|
||||
ARCMINEWINDOWAVAILABLETIME(0x6C909DE7, ArcMineWindowAvailableTimeMsg.class, null),
|
||||
ARCMINEWINDOWAVAILABLETIME(0x6C909DE7, ArcMineWindowAvailableTimeMsg.class, ArcMineWindowAvailableTimeHandler.class),
|
||||
ARCMINEWINDOWCHANGE(0x92B2148A, ArcMineWindowChangeMsg.class, MineWindowChangeHandler.class),
|
||||
ARCOWNEDMINESLIST(0x59184455, ArcOwnedMinesListMsg.class, null),
|
||||
ARCPETATTACK(0x18CD61AD, PetAttackMsg.class, null), // Pet Attack
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.Enum;
|
||||
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.ArcMineWindowAvailableTimeMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.KeepAliveServerClientMsg;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.Guild;
|
||||
import engine.objects.GuildStatusController;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/*
|
||||
* @Author:
|
||||
* @Summary: Processes application protocol message which keeps
|
||||
* client's tcp connection open.
|
||||
*/
|
||||
|
||||
public class ArcMineWindowAvailableTimeHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ArcMineWindowAvailableTimeHandler() {
|
||||
super(KeepAliveServerClientMsg.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
|
||||
ArcMineWindowAvailableTimeMsg msg = (ArcMineWindowAvailableTimeMsg) baseMsg;
|
||||
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
|
||||
Building treeOfLife = BuildingManager.getBuildingFromCache(msg.getBuildingUUID());
|
||||
Dispatch dispatch;
|
||||
|
||||
if (treeOfLife == null)
|
||||
return true;
|
||||
|
||||
if (treeOfLife.getBlueprintUUID() == 0)
|
||||
return true;
|
||||
|
||||
if (treeOfLife.getBlueprint().getBuildingGroup() != Enum.BuildingGroup.TOL)
|
||||
return true;
|
||||
|
||||
if (playerCharacter == null)
|
||||
return true;
|
||||
|
||||
if (!Guild.sameGuild(treeOfLife.getGuild(), playerCharacter.getGuild()))
|
||||
return true;
|
||||
|
||||
if (GuildStatusController.isInnerCouncil(playerCharacter.getGuildStatus()) == false) // is this only GL?
|
||||
return true;
|
||||
|
||||
ArcMineWindowAvailableTimeMsg outMsg = new ArcMineWindowAvailableTimeMsg(treeOfLife, 10);
|
||||
outMsg.configure();
|
||||
dispatch = Dispatch.borrow(playerCharacter, outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user