summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-09-26 06:13:20 +0300
committerAndrei Karas <akaras@inbox.ru>2018-09-26 06:13:20 +0300
commit5b896ca505255c8f3f567cea87fad93444a6b2fd (patch)
treea3b0c9fb6c8c3fc112345d366afb03edce764e08 /src/net
parent014f6d127beb00f08531c038b4edcd7cc049aba2 (diff)
downloadmanaplus-5b896ca505255c8f3f567cea87fad93444a6b2fd.tar.gz
manaplus-5b896ca505255c8f3f567cea87fad93444a6b2fd.tar.bz2
manaplus-5b896ca505255c8f3f567cea87fad93444a6b2fd.tar.xz
manaplus-5b896ca505255c8f3f567cea87fad93444a6b2fd.zip
Add packet CMSG_ACHIEVEMENT_GET_REWARD 0x0a25.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/achievementhandler.h47
-rw-r--r--src/net/eathena/achievementhandler.cpp47
-rw-r--r--src/net/eathena/achievementhandler.h42
-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/achievementhandler.cpp42
-rw-r--r--src/net/tmwa/achievementhandler.h42
-rw-r--r--src/net/tmwa/generalhandler.cpp3
-rw-r--r--src/net/tmwa/generalhandler.h2
11 files changed, 234 insertions, 0 deletions
diff --git a/src/net/achievementhandler.h b/src/net/achievementhandler.h
new file mode 100644
index 000000000..7ba81ef4c
--- /dev/null
+++ b/src/net/achievementhandler.h
@@ -0,0 +1,47 @@
+/*
+ * 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_ACHIEVEMENTHANDLER_H
+#define NET_ACHIEVEMENTHANDLER_H
+
+#include "localconsts.h"
+
+namespace Net
+{
+
+class AchievementHandler notfinal
+{
+ public:
+ AchievementHandler()
+ { }
+
+ A_DELETE_COPY(AchievementHandler)
+
+ virtual ~AchievementHandler()
+ { }
+
+ virtual void requestReward(const int achId) const = 0;
+};
+
+} // namespace Net
+
+extern Net::AchievementHandler *achievementHandler;
+
+#endif // NET_ACHIEVEMENTHANDLER_H
diff --git a/src/net/eathena/achievementhandler.cpp b/src/net/eathena/achievementhandler.cpp
new file mode 100644
index 000000000..b0279a908
--- /dev/null
+++ b/src/net/eathena/achievementhandler.cpp
@@ -0,0 +1,47 @@
+/*
+ * 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/achievementhandler.h"
+
+#include "net/eathena/messageout.h"
+#include "net/eathena/protocolout.h"
+
+#include "debug.h"
+
+namespace EAthena
+{
+
+AchievementHandler::AchievementHandler()
+{
+ achievementHandler = this;
+}
+
+AchievementHandler::~AchievementHandler()
+{
+ achievementHandler = nullptr;
+}
+
+void AchievementHandler::requestReward(const int achId) const
+{
+ createOutPacket(CMSG_ACHIEVEMENT_GET_REWARD);
+ outMsg.writeInt32(achId, "ach id");
+}
+
+} // namespace EAthena
diff --git a/src/net/eathena/achievementhandler.h b/src/net/eathena/achievementhandler.h
new file mode 100644
index 000000000..b58342a75
--- /dev/null
+++ b/src/net/eathena/achievementhandler.h
@@ -0,0 +1,42 @@
+/*
+ * 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_ACHIEVEMENTHANDLER_H
+#define NET_EATHENA_ACHIEVEMENTHANDLER_H
+
+#include "net/achievementhandler.h"
+
+namespace EAthena
+{
+class AchievementHandler final : public Net::AchievementHandler
+{
+ public:
+ AchievementHandler();
+
+ A_DELETE_COPY(AchievementHandler)
+
+ ~AchievementHandler() override final;
+
+ void requestReward(const int achId) const override final;
+};
+
+} // namespace EAthena
+
+#endif // NET_EATHENA_ACHIEVEMENTHANDLER_H
diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp
index 3963f6423..940a27fd8 100644
--- a/src/net/eathena/generalhandler.cpp
+++ b/src/net/eathena/generalhandler.cpp
@@ -34,6 +34,7 @@
#include "net/eathena/adminhandler.h"
#include "net/eathena/auctionhandler.h"
+#include "net/eathena/achievementhandler.h"
#include "net/eathena/attendancehandler.h"
#include "net/eathena/bankhandler.h"
#include "net/eathena/battlegroundhandler.h"
@@ -102,6 +103,7 @@ GeneralHandler::GeneralHandler() :
mMail2Handler(new Mail2Handler),
mMailHandler(new MailHandler),
mAuctionHandler(new AuctionHandler),
+ mAchievementHandler(new AchievementHandler),
mAttendanceHandler(new AttendanceHandler),
mCashShopHandler(new CashShopHandler),
mFamilyHandler(new FamilyHandler),
@@ -148,6 +150,7 @@ GeneralHandler::~GeneralHandler()
delete2(mMail2Handler);
delete2(mMailHandler);
delete2(mAuctionHandler);
+ delete2(mAchievementHandler);
delete2(mAttendanceHandler);
delete2(mCashShopHandler);
delete2(mFamilyHandler);
diff --git a/src/net/eathena/generalhandler.h b/src/net/eathena/generalhandler.h
index 485670194..044279102 100644
--- a/src/net/eathena/generalhandler.h
+++ b/src/net/eathena/generalhandler.h
@@ -48,6 +48,7 @@ class TradeHandler;
class QuestHandler;
class ServerFeatures;
class AuctionHandler;
+class AchievementHandler;
class AttendanceHandler;
class BankHandler;
class BattleGroundHandler;
@@ -116,6 +117,7 @@ class GeneralHandler final : public Net::GeneralHandler
Mail2Handler *mMail2Handler;
MailHandler *mMailHandler;
AuctionHandler *mAuctionHandler;
+ AchievementHandler *mAchievementHandler;
AttendanceHandler *mAttendanceHandler;
CashShopHandler *mCashShopHandler;
FamilyHandler *mFamilyHandler;
diff --git a/src/net/eathena/packetsout.inc b/src/net/eathena/packetsout.inc
index 3ea0fb61c..a4208a16f 100644
--- a/src/net/eathena/packetsout.inc
+++ b/src/net/eathena/packetsout.inc
@@ -341,6 +341,7 @@ packet(CMSG_PET_EVOLUTION, 0x0000, 0, nullptr);
packet(CMSG_PLAYER_SET_TITLE, 0x0000, 0, nullptr);
packet(CMSG_CHANGE_DRESS, 0x0000, 0, nullptr);
packet(CMSG_INSTANCE_COMMAND, 0x0000, 0, nullptr);
+packet(CMSG_ACHIEVEMENT_GET_REWARD, 0x0000, 0, nullptr);
#else
// 20040713
if (packetVersion >= 20040713)
@@ -1318,6 +1319,7 @@ if (packetVersion >= 20140611)
// new packets
packet(CMSG_ROULETTE_GENERATE, 0x0a1f, 2, clif->pRouletteGenerate);
packet(CMSG_ROULETTE_RECV_ITEM, 0x0a21, 6, clif->pRouletteRecvItem);
+ packet(CMSG_ACHIEVEMENT_GET_REWARD, 0x0a25, 6, clif->pAchievementGetReward);
// changed packets
packet(CMSG_ROULETTE_OPEN, 0x0a19, 2, clif->pRouletteOpen);
packet(CMSG_ROULETTE_CLOSE, 0x0a1d, 2, clif->pRouletteClose);
diff --git a/src/net/net.cpp b/src/net/net.cpp
index ce129c519..f9422c367 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -41,6 +41,7 @@ int evolPacketOffset = 0;
namespace Net
{
class AuctionHandler;
+ class AchievementHandler;
class AttendanceHandler;
class BankHandler;
class BattleGroundHandler;
@@ -96,6 +97,7 @@ Net::BeingHandler *beingHandler = nullptr;
Net::BuySellHandler *buySellHandler = nullptr;
Net::ServerFeatures *serverFeatures = nullptr;
Net::AuctionHandler *auctionHandler = nullptr;
+Net::AchievementHandler *achievementHandler = nullptr;
Net::AttendanceHandler *attendanceHandler = nullptr;
Net::BankHandler *bankHandler = nullptr;
Net::BattleGroundHandler *battleGroundHandler = nullptr;
diff --git a/src/net/tmwa/achievementhandler.cpp b/src/net/tmwa/achievementhandler.cpp
new file mode 100644
index 000000000..fb92effab
--- /dev/null
+++ b/src/net/tmwa/achievementhandler.cpp
@@ -0,0 +1,42 @@
+/*
+ * 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/achievementhandler.h"
+
+#include "debug.h"
+
+namespace TmwAthena
+{
+
+AchievementHandler::AchievementHandler()
+{
+ achievementHandler = this;
+}
+
+AchievementHandler::~AchievementHandler()
+{
+ achievementHandler = nullptr;
+}
+
+void AchievementHandler::requestReward(const int achId A_UNUSED) const
+{
+}
+
+} // namespace TmwAthena
diff --git a/src/net/tmwa/achievementhandler.h b/src/net/tmwa/achievementhandler.h
new file mode 100644
index 000000000..a7d9fa8d1
--- /dev/null
+++ b/src/net/tmwa/achievementhandler.h
@@ -0,0 +1,42 @@
+/*
+ * 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_ACHIEVEMENTHANDLER_H
+#define NET_TMWA_ACHIEVEMENTHANDLER_H
+
+#include "net/achievementhandler.h"
+
+namespace TmwAthena
+{
+class AchievementHandler final : public Net::AchievementHandler
+{
+ public:
+ AchievementHandler();
+
+ A_DELETE_COPY(AchievementHandler)
+
+ ~AchievementHandler() override final;
+
+ void requestReward(const int achId) const override final;
+};
+
+} // namespace TmwAthena
+
+#endif // NET_TMWA_ACHIEVEMENTHANDLER_H
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 9a1701fc1..99865f61d 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -52,6 +52,7 @@
#include "net/tmwa/questhandler.h"
#include "net/tmwa/auctionhandler.h"
+#include "net/tmwa/achievementhandler.h"
#include "net/tmwa/attendancehandler.h"
#include "net/tmwa/bankhandler.h"
#include "net/tmwa/battlegroundhandler.h"
@@ -99,6 +100,7 @@ GeneralHandler::GeneralHandler() :
mQuestHandler(new QuestHandler),
mServerFeatures(new ServerFeatures),
mAuctionHandler(new AuctionHandler),
+ mAchievementHandler(new AchievementHandler),
mAttendanceHandler(new AttendanceHandler),
mBankHandler(new BankHandler),
mBattleGroundHandler(new BattleGroundHandler),
@@ -145,6 +147,7 @@ GeneralHandler::~GeneralHandler()
delete2(mQuestHandler);
delete2(mServerFeatures);
delete2(mAuctionHandler);
+ delete2(mAchievementHandler);
delete2(mAttendanceHandler);
delete2(mBankHandler);
delete2(mBattleGroundHandler);
diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h
index ef2d98969..1be9b9f97 100644
--- a/src/net/tmwa/generalhandler.h
+++ b/src/net/tmwa/generalhandler.h
@@ -47,6 +47,7 @@ class TradeHandler;
class QuestHandler;
class ServerFeatures;
class AuctionHandler;
+class AchievementHandler;
class AttendanceHandler;
class BankHandler;
class BattleGroundHandler;
@@ -113,6 +114,7 @@ class GeneralHandler final : public Net::GeneralHandler
QuestHandler *mQuestHandler;
ServerFeatures *mServerFeatures;
AuctionHandler *mAuctionHandler;
+ AchievementHandler *mAchievementHandler;
AttendanceHandler *mAttendanceHandler;
BankHandler *mBankHandler;
BattleGroundHandler *mBattleGroundHandler;