Browse Source

Protocol handler created for ArcMineWindowAvailableTimeMsg.

master
MagicBot 2 years ago
parent
commit
de41702914
  1. 34
      src/engine/net/client/ClientMessagePump.java
  2. 2
      src/engine/net/client/Protocol.java
  3. 63
      src/engine/net/client/handlers/ArcMineWindowAvailableTimeHandler.java

34
src/engine/net/client/ClientMessagePump.java

@ -262,9 +262,6 @@ public class ClientMessagePump implements NetMsgHandler {
case VENDORDIALOG: case VENDORDIALOG:
VendorDialogMsg.replyDialog((VendorDialogMsg) msg, origin); VendorDialogMsg.replyDialog((VendorDialogMsg) msg, origin);
break; break;
case ARCMINEWINDOWAVAILABLETIME:
MineWindowAvailableTime((ArcMineWindowAvailableTimeMsg) msg, origin);
break;
case ARCOWNEDMINESLIST: case ARCOWNEDMINESLIST:
ListOwnedMines((ArcOwnedMinesListMsg) msg, origin); ListOwnedMines((ArcOwnedMinesListMsg) msg, origin);
break; 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) { private static void ListOwnedMines(ArcOwnedMinesListMsg msg, ClientConnection origin) {
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin); PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);

2
src/engine/net/client/Protocol.java

@ -35,7 +35,7 @@ public enum Protocol {
ARCLOGINNOTIFY(0x010FED87, ArcLoginNotifyMsg.class, ArcLoginNotifyMsgHandler.class), //Client Confirms entering world ARCLOGINNOTIFY(0x010FED87, ArcLoginNotifyMsg.class, ArcLoginNotifyMsgHandler.class), //Client Confirms entering world
ARCMINECHANGEPRODUCTION(0x1EAA993F, ArcMineChangeProductionMsg.class, null), ARCMINECHANGEPRODUCTION(0x1EAA993F, ArcMineChangeProductionMsg.class, null),
ARCMINETOWERCRESTUPDATE(0x34164D0D, null, null), ARCMINETOWERCRESTUPDATE(0x34164D0D, null, null),
ARCMINEWINDOWAVAILABLETIME(0x6C909DE7, ArcMineWindowAvailableTimeMsg.class, null), ARCMINEWINDOWAVAILABLETIME(0x6C909DE7, ArcMineWindowAvailableTimeMsg.class, ArcMineWindowAvailableTimeHandler.class),
ARCMINEWINDOWCHANGE(0x92B2148A, ArcMineWindowChangeMsg.class, MineWindowChangeHandler.class), ARCMINEWINDOWCHANGE(0x92B2148A, ArcMineWindowChangeMsg.class, MineWindowChangeHandler.class),
ARCOWNEDMINESLIST(0x59184455, ArcOwnedMinesListMsg.class, null), ARCOWNEDMINESLIST(0x59184455, ArcOwnedMinesListMsg.class, null),
ARCPETATTACK(0x18CD61AD, PetAttackMsg.class, null), // Pet Attack ARCPETATTACK(0x18CD61AD, PetAttackMsg.class, null), // Pet Attack

63
src/engine/net/client/handlers/ArcMineWindowAvailableTimeHandler.java

@ -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;
}
}
Loading…
Cancel
Save