summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Athay <ko2fan@gmail.com>2024-04-09 15:22:27 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-04-09 17:48:28 +0200
commit51020c05584c26c9a824df33115c72dcf51bcd74 (patch)
tree3d1311add7987862436b3a4f576c18cb1ebc9dfb
parent5c254b7c13cc1cad43830a097ea56ba227608178 (diff)
downloadmana-51020c05584c26c9a824df33115c72dcf51bcd74.tar.gz
mana-51020c05584c26c9a824df33115c72dcf51bcd74.tar.bz2
mana-51020c05584c26c9a824df33115c72dcf51bcd74.tar.xz
mana-51020c05584c26c9a824df33115c72dcf51bcd74.zip
WIP: Add online player list handler - Currently doesn't recieve SMSG_ONLINE_LIST.
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/commandhandler.cpp2
-rw-r--r--src/gui/socialwindow.cpp3
-rw-r--r--src/net/net.cpp7
-rw-r--r--src/net/net.h2
-rw-r--r--src/net/playerlisthandler.h35
-rw-r--r--src/net/tmwa/generalhandler.cpp5
-rw-r--r--src/net/tmwa/generalhandler.h1
-rw-r--r--src/net/tmwa/playerlisthandler.cpp68
-rw-r--r--src/net/tmwa/playerlisthandler.h42
10 files changed, 166 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b7300e46..fc2b6ee3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -546,6 +546,8 @@ SET(SRCS_TMWA
net/tmwa/partyhandler.h
net/tmwa/playerhandler.cpp
net/tmwa/playerhandler.h
+ net/tmwa/playerlisthandler.cpp
+ net/tmwa/playerlisthandler.h
net/tmwa/protocol.h
net/tmwa/specialhandler.cpp
net/tmwa/specialhandler.h
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index addb7367..5a9063fb 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -24,6 +24,7 @@
#include "actorspritemanager.h"
#include "channelmanager.h"
#include "game.h"
+#include "gui/chatwindow.h"
#include "localplayer.h"
#include "playerrelations.h"
@@ -32,6 +33,7 @@
#include "net/chathandler.h"
#include "net/net.h"
#include "net/partyhandler.h"
+#include "net/playerlisthandler.h"
#include "utils/gettext.h"
#include "utils/stringutils.h"
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index 61605e79..a81117a6 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -42,6 +42,7 @@
#include "net/net.h"
#include "net/guildhandler.h"
#include "net/partyhandler.h"
+#include "net/playerlisthandler.h"
#include "resources/theme.h"
@@ -266,6 +267,8 @@ public:
mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO);
mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_AUTO);
+
+ Net::getPlayerListHandler()->refreshList();
}
~PlayerListTab()
{
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 86f7dc13..075288cd 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -35,6 +35,7 @@
#include "net/npchandler.h"
#include "net/partyhandler.h"
#include "net/playerhandler.h"
+#include "net/playerlisthandler.h"
#include "net/specialhandler.h"
#include "net/tradehandler.h"
@@ -55,6 +56,7 @@ Net::GuildHandler *guildHandler = nullptr;
Net::NpcHandler *npcHandler = nullptr;
Net::PartyHandler *partyHandler = nullptr;
Net::PlayerHandler *playerHandler = nullptr;
+Net::PlayerListHandler *playerListHandler = nullptr;
Net::SpecialHandler *specialHandler = nullptr;
Net::TradeHandler *tradeHandler = nullptr;
@@ -113,6 +115,11 @@ Net::PlayerHandler *Net::getPlayerHandler()
return playerHandler;
}
+Net::PlayerListHandler *Net::getPlayerListHandler()
+{
+ return playerListHandler;
+}
+
Net::SpecialHandler *Net::getSpecialHandler()
{
return specialHandler;
diff --git a/src/net/net.h b/src/net/net.h
index 135f2cb7..8aba9e2d 100644
--- a/src/net/net.h
+++ b/src/net/net.h
@@ -45,6 +45,7 @@ class LoginHandler;
class NpcHandler;
class PartyHandler;
class PlayerHandler;
+class PlayerListHandler;
class SpecialHandler;
class TradeHandler;
@@ -59,6 +60,7 @@ LoginHandler *getLoginHandler();
NpcHandler *getNpcHandler();
PartyHandler *getPartyHandler();
PlayerHandler *getPlayerHandler();
+PlayerListHandler *getPlayerListHandler();
SpecialHandler *getSpecialHandler();
TradeHandler *getTradeHandler();
diff --git a/src/net/playerlisthandler.h b/src/net/playerlisthandler.h
new file mode 100644
index 00000000..3390038b
--- /dev/null
+++ b/src/net/playerlisthandler.h
@@ -0,0 +1,35 @@
+/*
+ * The Mana Client
+ * Copyright (C) 2009-2024 The Mana Developers
+ *
+ * This file is part of The Mana Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef PLAYERLISTHANDLER_H
+#define PLAYERLISTHANDLER_H
+
+namespace Net {
+
+class PlayerListHandler
+{
+ public:
+ virtual ~PlayerListHandler() = default;
+ virtual void refreshList() = 0;
+};
+
+} // namespace Net
+
+#endif // PLAYERLISTHANDLER_H
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 832d6973..528f468b 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -48,6 +48,7 @@
#include "net/tmwa/npchandler.h"
#include "net/tmwa/partyhandler.h"
#include "net/tmwa/playerhandler.h"
+#include "net/tmwa/playerlisthandler.h"
#include "net/tmwa/protocol.h"
#include "net/tmwa/tradehandler.h"
#include "net/tmwa/specialhandler.h"
@@ -85,6 +86,7 @@ GeneralHandler::GeneralHandler():
mNpcHandler(new NpcHandler),
mPartyHandler(new PartyHandler),
mPlayerHandler(new PlayerHandler),
+ mPlayerListHandler(new PlayerListHandler),
mSpecialHandler(new SpecialHandler),
mTradeHandler(new TradeHandler)
{
@@ -169,10 +171,11 @@ void GeneralHandler::load()
mNetwork->registerHandler(mItemHandler.get());
mNetwork->registerHandler(mLoginHandler.get());
mNetwork->registerHandler(mNpcHandler.get());
+ mNetwork->registerHandler(mPartyHandler.get());
mNetwork->registerHandler(mPlayerHandler.get());
+ mNetwork->registerHandler(mPlayerListHandler.get());
mNetwork->registerHandler(mSpecialHandler.get());
mNetwork->registerHandler(mTradeHandler.get());
- mNetwork->registerHandler(mPartyHandler.get());
}
void GeneralHandler::reload()
diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h
index f105da96..d0916c8b 100644
--- a/src/net/tmwa/generalhandler.h
+++ b/src/net/tmwa/generalhandler.h
@@ -67,6 +67,7 @@ class GeneralHandler final : public MessageHandler, public Net::GeneralHandler,
MessageHandlerPtr mNpcHandler;
MessageHandlerPtr mPartyHandler;
MessageHandlerPtr mPlayerHandler;
+ MessageHandlerPtr mPlayerListHandler;
MessageHandlerPtr mSpecialHandler;
MessageHandlerPtr mTradeHandler;
};
diff --git a/src/net/tmwa/playerlisthandler.cpp b/src/net/tmwa/playerlisthandler.cpp
new file mode 100644
index 00000000..530af4c7
--- /dev/null
+++ b/src/net/tmwa/playerlisthandler.cpp
@@ -0,0 +1,68 @@
+/*
+ * The Mana Client
+ * Copyright (C) 2009-2024 The Mana Developers
+ *
+ * This file is part of The Mana Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "net/tmwa/playerlisthandler.h"
+
+#include "net/tmwa/messagein.h"
+#include "net/tmwa/messageout.h"
+#include "net/tmwa/protocol.h"
+
+#include "utils/gettext.h"
+
+#include "event.h"
+#include "log.h"
+
+extern Net::PlayerListHandler *playerListHandler;
+
+namespace TmwAthena {
+
+PlayerListHandler::PlayerListHandler()
+{
+ static const uint16_t _messages[] = {
+ SMSG_ONLINE_LIST,
+ 0
+ };
+ handledMessages = _messages;
+ playerListHandler = this;
+}
+
+PlayerListHandler::~PlayerListHandler()
+{
+}
+
+void PlayerListHandler::handleMessage(MessageIn &msg)
+{
+ switch (msg.getId())
+ {
+ case SMSG_ONLINE_LIST:
+ {
+ SERVER_NOTICE(_("RECEIVED SMSG_ONLINE_LIST"))
+ logger->log("GOT SMSG_ONLINE_LIST");
+ }
+ break;
+ }
+}
+
+void PlayerListHandler::refreshList()
+{
+ MessageOut outMsg(CMSG_ONLINE_LIST);
+}
+
+} // namespace TmwAthena \ No newline at end of file
diff --git a/src/net/tmwa/playerlisthandler.h b/src/net/tmwa/playerlisthandler.h
new file mode 100644
index 00000000..c11fb300
--- /dev/null
+++ b/src/net/tmwa/playerlisthandler.h
@@ -0,0 +1,42 @@
+/*
+ * The Mana Client
+ * Copyright (C) 2009-2024 The Mana Developers
+ *
+ * This file is part of The Mana Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NET_TA_PLAYERLISTHANDLER_H
+#define NET_TA_PLAYERLISTHANDLER_H
+
+#include "net/net.h"
+#include "net/playerlisthandler.h"
+
+#include "net/tmwa/messagehandler.h"
+
+namespace TmwAthena {
+
+class PlayerListHandler final : public MessageHandler, public Net::PlayerListHandler
+{
+ public:
+ PlayerListHandler();
+ ~PlayerListHandler() override;
+ void handleMessage(MessageIn &msg) override;
+ void refreshList() override;
+};
+
+} // namespace TmwAthena
+
+#endif // NET_TA_PARTYHANDLER_H