From 36cb532b20e48a3c8a15d2c7f31b0f42297155ac Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 21 Jan 2023 09:47:53 -0500 Subject: [PATCH] Handler created for ArcOwnedMinesListHandler. --- src/engine/net/client/ClientMessagePump.java | 19 -------- src/engine/net/client/Protocol.java | 2 +- .../ArcMineWindowAvailableTimeHandler.java | 2 +- .../handlers/ArcOwnedMinesListHandler.java | 45 +++++++++++++++++++ 4 files changed, 47 insertions(+), 21 deletions(-) create mode 100644 src/engine/net/client/handlers/ArcOwnedMinesListHandler.java diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index f2598353..0b0bc992 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -262,9 +262,6 @@ public class ClientMessagePump implements NetMsgHandler { case VENDORDIALOG: VendorDialogMsg.replyDialog((VendorDialogMsg) msg, origin); break; - case ARCOWNEDMINESLIST: - ListOwnedMines((ArcOwnedMinesListMsg) msg, origin); - break; case ARCMINECHANGEPRODUCTION: changeMineProduction((ArcMineChangeProductionMsg) msg, origin); break; @@ -1423,22 +1420,6 @@ boolean updateCity = false; } - private static void ListOwnedMines(ArcOwnedMinesListMsg msg, ClientConnection origin) { - - PlayerCharacter pc = SessionManager.getPlayerCharacter(origin); - - if (pc == null) - return; - //TODO verify this against the warehouse? - - if (GuildStatusController.isInnerCouncil(pc.getGuildStatus()) == false)// is this only GL? - return; - - msg.setMineList(Mine.getMinesForGuild(pc.getGuild().getObjectUUID())); - Dispatch dispatch = Dispatch.borrow(pc, msg); - DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); - } - private static void changeMineProduction(ArcMineChangeProductionMsg msg, ClientConnection origin) { PlayerCharacter sourcePlayer = SessionManager.getPlayerCharacter(origin); diff --git a/src/engine/net/client/Protocol.java b/src/engine/net/client/Protocol.java index f3f543cc..121acdcc 100644 --- a/src/engine/net/client/Protocol.java +++ b/src/engine/net/client/Protocol.java @@ -37,7 +37,7 @@ public enum Protocol { ARCMINETOWERCRESTUPDATE(0x34164D0D, null, null), ARCMINEWINDOWAVAILABLETIME(0x6C909DE7, ArcMineWindowAvailableTimeMsg.class, ArcMineWindowAvailableTimeHandler.class), ARCMINEWINDOWCHANGE(0x92B2148A, ArcMineWindowChangeMsg.class, MineWindowChangeHandler.class), - ARCOWNEDMINESLIST(0x59184455, ArcOwnedMinesListMsg.class, null), + ARCOWNEDMINESLIST(0x59184455, ArcOwnedMinesListMsg.class, ArcOwnedMinesListHandler.class), ARCPETATTACK(0x18CD61AD, PetAttackMsg.class, null), // Pet Attack ARCPETCMD(0x4E80E001, PetCmdMsg.class, null), // Stop ArcPetAttack, Toggle Assist, Toggle Rest ARCPOWERPROJECTILE(0xA2312D3B, null, null), diff --git a/src/engine/net/client/handlers/ArcMineWindowAvailableTimeHandler.java b/src/engine/net/client/handlers/ArcMineWindowAvailableTimeHandler.java index b3ab1d67..a201d90b 100644 --- a/src/engine/net/client/handlers/ArcMineWindowAvailableTimeHandler.java +++ b/src/engine/net/client/handlers/ArcMineWindowAvailableTimeHandler.java @@ -24,7 +24,7 @@ import engine.objects.PlayerCharacter; public class ArcMineWindowAvailableTimeHandler extends AbstractClientMsgHandler { public ArcMineWindowAvailableTimeHandler() { - super(KeepAliveServerClientMsg.class); + super(ArcMineWindowAvailableTimeMsg.class); } @Override diff --git a/src/engine/net/client/handlers/ArcOwnedMinesListHandler.java b/src/engine/net/client/handlers/ArcOwnedMinesListHandler.java new file mode 100644 index 00000000..10f7f802 --- /dev/null +++ b/src/engine/net/client/handlers/ArcOwnedMinesListHandler.java @@ -0,0 +1,45 @@ +package engine.net.client.handlers; + +import engine.Enum.DispatchChannel; +import engine.exception.MsgSendException; +import engine.net.Dispatch; +import engine.net.DispatchMessage; +import engine.net.client.ClientConnection; +import engine.net.client.msg.ArcOwnedMinesListMsg; +import engine.net.client.msg.ClientNetMsg; +import engine.objects.GuildStatusController; +import engine.objects.Mine; +import engine.objects.PlayerCharacter; + +/* + * @Author: + * @Summary: Processes application protocol message which keeps + * client's tcp connection open. + */ + +public class ArcOwnedMinesListHandler extends AbstractClientMsgHandler { + + public ArcOwnedMinesListHandler() { + super(ArcOwnedMinesListMsg.class); + } + + @Override + protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { + + PlayerCharacter playerCharacter = origin.getPlayerCharacter(); + ArcOwnedMinesListMsg msg = (ArcOwnedMinesListMsg) baseMsg; + + if (playerCharacter == null) + return true; + + if (GuildStatusController.isInnerCouncil(playerCharacter.getGuildStatus()) == false)// is this only GL? + return true; + + msg.setMineList(Mine.getMinesForGuild(playerCharacter.getGuild().getObjectUUID())); + Dispatch dispatch = Dispatch.borrow(playerCharacter, msg); + DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); + + return true; + } + +} \ No newline at end of file