summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/Makefile.am4
-rw-r--r--src/net/clanhandler.h49
-rw-r--r--src/net/eathena/clanhandler.cpp73
-rw-r--r--src/net/eathena/clanhandler.h44
-rw-r--r--src/net/eathena/generalhandler.cpp3
-rw-r--r--src/net/eathena/generalhandler.h2
-rw-r--r--src/net/eathena/packetsout.inc2
-rw-r--r--src/net/net.cpp2
-rw-r--r--src/net/tmwa/clanhandler.cpp43
-rw-r--r--src/net/tmwa/clanhandler.h44
-rw-r--r--src/net/tmwa/generalhandler.cpp3
-rw-r--r--src/net/tmwa/generalhandler.h2
13 files changed, 275 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ca1a624e2..ea69c1c9e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1591,6 +1591,8 @@ SET(SRCS
net/eathena/chathandler.h
net/eathena/chatrecv.cpp
net/eathena/chatrecv.h
+ net/eathena/clanhandler.cpp
+ net/eathena/clanhandler.h
net/eathena/clanrecv.cpp
net/eathena/clanrecv.h
net/eathena/elementalhandler.cpp
@@ -1998,6 +2000,8 @@ SET(SRCS_TMWA
net/tmwa/chathandler.h
net/tmwa/chatrecv.cpp
net/tmwa/chatrecv.h
+ net/tmwa/clanhandler.cpp
+ net/tmwa/clanhandler.h
net/tmwa/gamehandler.cpp
net/tmwa/gamehandler.h
net/tmwa/gamerecv.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index bca161c69..d23d5f586 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1700,6 +1700,8 @@ SRC += \
net/tmwa/chathandler.h \
net/tmwa/chatrecv.cpp \
net/tmwa/chatrecv.h \
+ net/tmwa/clanhandler.cpp \
+ net/tmwa/clanhandler.h \
net/tmwa/gamehandler.cpp \
net/tmwa/gamehandler.h \
net/tmwa/gamerecv.cpp \
@@ -1896,6 +1898,8 @@ SRC += gui/windows/bankwindow.cpp \
net/eathena/chathandler.h \
net/eathena/chatrecv.cpp \
net/eathena/chatrecv.h \
+ net/eathena/clanhandler.cpp \
+ net/eathena/clanhandler.h \
net/eathena/clanrecv.cpp \
net/eathena/clanrecv.h \
net/eathena/elementalhandler.cpp \
diff --git a/src/net/clanhandler.h b/src/net/clanhandler.h
new file mode 100644
index 000000000..dc177540c
--- /dev/null
+++ b/src/net/clanhandler.h
@@ -0,0 +1,49 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2018 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus 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_CLANHANDLER_H
+#define NET_CLANHANDLER_H
+
+#include <string>
+
+#include "localconsts.h"
+
+namespace Net
+{
+
+class ClanHandler notfinal
+{
+ public:
+ ClanHandler()
+ { }
+
+ A_DELETE_COPY(ClanHandler)
+
+ virtual ~ClanHandler()
+ { }
+
+ virtual void chat(const std::string &restrict text) const = 0;
+};
+
+} // namespace Net
+
+extern Net::ClanHandler *clanHandler;
+
+#endif // NET_CLANHANDLER_H
diff --git a/src/net/eathena/clanhandler.cpp b/src/net/eathena/clanhandler.cpp
new file mode 100644
index 000000000..f35bc9504
--- /dev/null
+++ b/src/net/eathena/clanhandler.cpp
@@ -0,0 +1,73 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2018 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus 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/eathena/clanhandler.h"
+
+#include "being/localplayer.h"
+
+#include "net/eathena/messageout.h"
+#include "net/eathena/protocolout.h"
+
+#include "utils/cast.h"
+
+#include "debug.h"
+
+extern int packetVersion;
+
+namespace EAthena
+{
+
+ClanHandler::ClanHandler() :
+ Net::ClanHandler()
+{
+ clanHandler = this;
+}
+
+ClanHandler::~ClanHandler()
+{
+ clanHandler = nullptr;
+}
+
+void ClanHandler::chat(const std::string &restrict text) const
+{
+ if (localPlayer == nullptr)
+ return;
+
+ if (packetVersion < 20120716)
+ return;
+
+ const std::string mes = std::string(localPlayer->getName()).append(
+ " : ").append(text);
+
+ createOutPacket(CMSG_CLAN_MESSAGE);
+ if (packetVersion >= 20151001)
+ {
+ outMsg.writeInt16(CAST_S16(mes.length() + 4), "len");
+ outMsg.writeString(mes, CAST_S32(mes.length()), "message");
+ }
+ else
+ {
+ // Added + 1 in order to let eAthena parse admin commands correctly
+ outMsg.writeInt16(CAST_S16(mes.length() + 4 + 1), "len");
+ outMsg.writeString(mes, CAST_S32(mes.length() + 1), "message");
+ }
+}
+
+} // namespace EAthena
diff --git a/src/net/eathena/clanhandler.h b/src/net/eathena/clanhandler.h
new file mode 100644
index 000000000..f1ce56eb6
--- /dev/null
+++ b/src/net/eathena/clanhandler.h
@@ -0,0 +1,44 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2018 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus 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_EATHENA_CLANHANDLER_H
+#define NET_EATHENA_CLANHANDLER_H
+
+#include "net/clanhandler.h"
+
+namespace EAthena
+{
+class MessageOut;
+
+class ClanHandler final : public Net::ClanHandler
+{
+ public:
+ ClanHandler();
+
+ A_DELETE_COPY(ClanHandler)
+
+ ~ClanHandler() override final;
+
+ void chat(const std::string &restrict text) const override final;
+};
+
+} // namespace EAthena
+
+#endif // NET_EATHENA_CLANHANDLER_H
diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp
index ee690e57e..aaf762d3f 100644
--- a/src/net/eathena/generalhandler.cpp
+++ b/src/net/eathena/generalhandler.cpp
@@ -40,6 +40,7 @@
#include "net/eathena/buysellhandler.h"
#include "net/eathena/cashshophandler.h"
#include "net/eathena/chathandler.h"
+#include "net/eathena/clanhandler.h"
#include "net/eathena/charserverhandler.h"
#include "net/eathena/elementalhandler.h"
#include "net/eathena/familyhandler.h"
@@ -82,6 +83,7 @@ GeneralHandler::GeneralHandler() :
mBuySellHandler(new BuySellHandler),
mCharServerHandler(new CharServerHandler),
mChatHandler(new ChatHandler),
+ mClanHandler(new ClanHandler),
mGameHandler(new GameHandler),
mGuildHandler(new GuildHandler),
mInventoryHandler(new InventoryHandler),
@@ -125,6 +127,7 @@ GeneralHandler::~GeneralHandler()
delete2(mBuySellHandler);
delete2(mCharServerHandler);
delete2(mChatHandler);
+ delete2(mClanHandler);
delete2(mGameHandler);
delete2(mGuildHandler);
delete2(mInventoryHandler);
diff --git a/src/net/eathena/generalhandler.h b/src/net/eathena/generalhandler.h
index 6c6e47979..8f6dc5166 100644
--- a/src/net/eathena/generalhandler.h
+++ b/src/net/eathena/generalhandler.h
@@ -33,6 +33,7 @@ class BeingHandler;
class BuySellHandler;
class CharServerHandler;
class ChatHandler;
+class ClanHandler;
class GameHandler;
class GuildHandler;
class InventoryHandler;
@@ -97,6 +98,7 @@ class GeneralHandler final : public Net::GeneralHandler
BuySellHandler *mBuySellHandler;
CharServerHandler *mCharServerHandler;
ChatHandler *mChatHandler;
+ ClanHandler *mClanHandler;
GameHandler *mGameHandler;
GuildHandler *mGuildHandler;
InventoryHandler *mInventoryHandler;
diff --git a/src/net/eathena/packetsout.inc b/src/net/eathena/packetsout.inc
index 4fda23153..744a90955 100644
--- a/src/net/eathena/packetsout.inc
+++ b/src/net/eathena/packetsout.inc
@@ -330,6 +330,7 @@ packet(CMSG_MAIL2_REFRESH_MAIL_LIST, 0x0000, 0, nullptr);
packet(CMSG_MAIL2_OPEN_MAILBOX, 0x0000, 0, nullptr);
packet(CMSG_MAIL2_CLOSE_MAILBOX, 0x0000, 0, nullptr);
packet(CMSG_MAIL2_CANCEL_WRITE_MAIL, 0x0000, 0, nullptr);
+packet(CMSG_CLAN_MESSAGE, 0x0000, 0, nullptr);
#else
// 20040713
if (packetVersion >= 20040713)
@@ -823,6 +824,7 @@ if (packetVersion >= 20120716)
packet(CMSG_MOVE_FROM_STORAGE, 0x0364, 8, clif->pMoveFromKafra);
packet(CMSG_SKILL_USE_BEING, 0x083c, 10, clif->pUseSkillToId);
packet(CMSG_STORAGE_PASSWORD, 0x0819, 36, clif->pStoragePassword);
+ packet(CMSG_CLAN_MESSAGE, 0x098d, -1, clif->pClanMessage);
}
// 20120925
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 7aa43fb31..e7720bb76 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -62,6 +62,7 @@ namespace Net
class BuySellHandler;
class CharServerHandler;
class ChatHandler;
+ class ClanHandler;
class GameHandler;
class GuildHandler;
class InventoryHandler;
@@ -78,6 +79,7 @@ namespace Net
Net::AdminHandler *adminHandler = nullptr;
Net::CharServerHandler *charServerHandler = nullptr;
Net::ChatHandler *chatHandler = nullptr;
+Net::ClanHandler *clanHandler = nullptr;
Net::GeneralHandler *generalHandler = nullptr;
Net::InventoryHandler *inventoryHandler = nullptr;
Net::LoginHandler *loginHandler = nullptr;
diff --git a/src/net/tmwa/clanhandler.cpp b/src/net/tmwa/clanhandler.cpp
new file mode 100644
index 000000000..6f27b1d19
--- /dev/null
+++ b/src/net/tmwa/clanhandler.cpp
@@ -0,0 +1,43 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2018 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus 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/clanhandler.h"
+
+#include "debug.h"
+
+namespace TmwAthena
+{
+
+ClanHandler::ClanHandler() :
+ Net::ClanHandler()
+{
+ clanHandler = this;
+}
+
+ClanHandler::~ClanHandler()
+{
+ clanHandler = nullptr;
+}
+
+void ClanHandler::chat(const std::string &restrict text A_UNUSED) const
+{
+}
+
+} // namespace TmwAthena
diff --git a/src/net/tmwa/clanhandler.h b/src/net/tmwa/clanhandler.h
new file mode 100644
index 000000000..138cc52db
--- /dev/null
+++ b/src/net/tmwa/clanhandler.h
@@ -0,0 +1,44 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2018 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus 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_TMWA_CLANHANDLER_H
+#define NET_TMWA_CLANHANDLER_H
+
+#include "net/clanhandler.h"
+
+namespace TmwAthena
+{
+
+class ClanHandler final : public Net::ClanHandler
+{
+ public:
+ ClanHandler();
+
+ A_DELETE_COPY(ClanHandler)
+
+ ~ClanHandler() override final;
+
+ void chat(const std::string &restrict text A_UNUSED) const
+ override final;
+};
+
+} // namespace TmwAthena
+
+#endif // NET_TMWA_CLANHANDLER_H
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 5a77f8253..f61342e5f 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -34,6 +34,7 @@
#include "net/tmwa/beinghandler.h"
#include "net/tmwa/buysellhandler.h"
#include "net/tmwa/chathandler.h"
+#include "net/tmwa/clanhandler.h"
#include "net/tmwa/charserverhandler.h"
#include "net/tmwa/gamehandler.h"
#include "net/tmwa/guildhandler.h"
@@ -82,6 +83,7 @@ GeneralHandler::GeneralHandler() :
mBuySellHandler(new BuySellHandler),
mCharServerHandler(new CharServerHandler),
mChatHandler(new ChatHandler),
+ mClanHandler(new ClanHandler),
mGameHandler(new GameHandler),
mGuildHandler(new GuildHandler),
mInventoryHandler(new InventoryHandler),
@@ -125,6 +127,7 @@ GeneralHandler::~GeneralHandler()
delete2(mBuySellHandler);
delete2(mCharServerHandler);
delete2(mChatHandler);
+ delete2(mClanHandler);
delete2(mGameHandler);
delete2(mGuildHandler);
delete2(mInventoryHandler);
diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h
index 72f4228fc..8c80c504f 100644
--- a/src/net/tmwa/generalhandler.h
+++ b/src/net/tmwa/generalhandler.h
@@ -32,6 +32,7 @@ class BeingHandler;
class BuySellHandler;
class CharServerHandler;
class ChatHandler;
+class ClanHandler;
class GameHandler;
class GuildHandler;
class InventoryHandler;
@@ -96,6 +97,7 @@ class GeneralHandler final : public Net::GeneralHandler
BuySellHandler *mBuySellHandler;
CharServerHandler *mCharServerHandler;
ChatHandler *mChatHandler;
+ ClanHandler *mClanHandler;
GameHandler *mGameHandler;
GuildHandler *mGuildHandler;
InventoryHandler *mInventoryHandler;