From bf712accf9fb4c6a170f36f5cbd7bdb470755cc4 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 29 Mar 2024 07:07:25 -0400 Subject: [PATCH] Handler created for RefineScreenMsg --- src/engine/net/client/ClientMessagePump.java | 3 -- src/engine/net/client/Protocol.java | 2 +- .../handlers/RefinerScreenMsgHandler.java | 51 +++++++++++++++++++ src/engine/server/world/WorldServer.java | 13 ----- 4 files changed, 52 insertions(+), 17 deletions(-) create mode 100644 src/engine/net/client/handlers/RefinerScreenMsgHandler.java diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index c814fe52..bcca3228 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -126,9 +126,6 @@ public class ClientMessagePump implements NetMsgHandler { case TRAINERLIST: WorldServer.trainerInfo((TrainerInfoMsg) msg, origin); break; - case ARCUNTRAINLIST: - WorldServer.refinerScreen((RefinerScreenMsg) msg, origin); - break; case POWERTARGNAME: PowersManager.summon((SendSummonsRequestMsg) msg, origin); break; diff --git a/src/engine/net/client/Protocol.java b/src/engine/net/client/Protocol.java index 2aa3324d..8d7cc663 100644 --- a/src/engine/net/client/Protocol.java +++ b/src/engine/net/client/Protocol.java @@ -48,7 +48,7 @@ public enum Protocol { ARCTRACKINGLIST(0xC89CF08B, TrackWindowMsg.class, null), //Request/Send Track window ARCTRACKOBJECT(0x609B6BA2, TrackArrowMsg.class, null), //Send Track Arrow ARCUNTRAINABILITY(0x548DBF83, RefineMsg.class, RefineMsgHandler.class), //Refine - ARCUNTRAINLIST(0x38879E90, RefinerScreenMsg.class, null), //Refiner screen + ARCUNTRAINLIST(0x38879E90, RefinerScreenMsg.class, RefinerScreenMsgHandler.class), //Refiner screen ARCVIEWASSETTRANSACTIONS(0xBFA476E4, ArcViewAssetTransactionsMsg.class, ArcViewAssetTransactionsMsgHandler.class), ASSETSUPPORT(0xc481f89D, AssetSupportMsg.class, AssetSupportMsgHandler.class), BANISHMEMBER(0x31AA3368, BanishUnbanishMsg.class, BanishUnbanishHandler.class), // Banish/Unbanish diff --git a/src/engine/net/client/handlers/RefinerScreenMsgHandler.java b/src/engine/net/client/handlers/RefinerScreenMsgHandler.java new file mode 100644 index 00000000..2e905fe9 --- /dev/null +++ b/src/engine/net/client/handlers/RefinerScreenMsgHandler.java @@ -0,0 +1,51 @@ +// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . +// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· +// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ +// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ +// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ +// Magicbane Emulator Project © 2013 - 2022 +// www.magicbane.com + +package engine.net.client.handlers; + +import engine.Enum; +import engine.exception.MsgSendException; +import engine.net.Dispatch; +import engine.net.DispatchMessage; +import engine.net.client.ClientConnection; +import engine.net.client.msg.ClientNetMsg; +import engine.net.client.msg.RefinerScreenMsg; +import engine.objects.NPC; +import engine.objects.PlayerCharacter; + +public class RefinerScreenMsgHandler extends AbstractClientMsgHandler { + + public RefinerScreenMsgHandler() { + super(RefinerScreenMsg.class); + } + + @Override + protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { + + PlayerCharacter playerCharacter = origin.getPlayerCharacter(); + + // Member variable declaration + + RefinerScreenMsg msg; + + // Member variable assignment + + msg = (RefinerScreenMsg) baseMsg; + + NPC npc = NPC.getFromCache(msg.getNpcID()); + + if (npc != null) + msg.setUnknown02(0); //cost to refine? + + Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), msg); + DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY); + + return true; + } + +} \ No newline at end of file diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index ffd9461d..30af5b70 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -33,7 +33,6 @@ import engine.net.client.ClientConnection; import engine.net.client.ClientConnectionManager; import engine.net.client.ClientMessagePump; import engine.net.client.Protocol; -import engine.net.client.msg.RefinerScreenMsg; import engine.net.client.msg.TrainerInfoMsg; import engine.net.client.msg.UpdateStateMsg; import engine.net.client.msg.chat.ChatSystemMsg; @@ -143,18 +142,6 @@ public class WorldServer { } - public static void refinerScreen(RefinerScreenMsg msg, ClientConnection origin) - throws MsgSendException { - - NPC npc = NPC.getFromCache(msg.getNpcID()); - - if (npc != null) - msg.setUnknown02(0); //cost to refine? - - Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), msg); - DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY); - } - public static String getUptimeString() { String outString = null;