From 5b896ca505255c8f3f567cea87fad93444a6b2fd Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 26 Sep 2018 06:13:20 +0300 Subject: Add packet CMSG_ACHIEVEMENT_GET_REWARD 0x0a25. --- src/CMakeLists.txt | 5 ++++ src/Makefile.am | 5 ++++ src/net/achievementhandler.h | 47 ++++++++++++++++++++++++++++++++++ src/net/eathena/achievementhandler.cpp | 47 ++++++++++++++++++++++++++++++++++ src/net/eathena/achievementhandler.h | 42 ++++++++++++++++++++++++++++++ src/net/eathena/generalhandler.cpp | 3 +++ src/net/eathena/generalhandler.h | 2 ++ src/net/eathena/packetsout.inc | 2 ++ src/net/net.cpp | 2 ++ src/net/tmwa/achievementhandler.cpp | 42 ++++++++++++++++++++++++++++++ src/net/tmwa/achievementhandler.h | 42 ++++++++++++++++++++++++++++++ src/net/tmwa/generalhandler.cpp | 3 +++ src/net/tmwa/generalhandler.h | 2 ++ 13 files changed, 244 insertions(+) create mode 100644 src/net/achievementhandler.h create mode 100644 src/net/eathena/achievementhandler.cpp create mode 100644 src/net/eathena/achievementhandler.h create mode 100644 src/net/tmwa/achievementhandler.cpp create mode 100644 src/net/tmwa/achievementhandler.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index aa4894429..2d1c8e972 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -560,6 +560,7 @@ SET(SRCS gui/windows/worldselectdialog.cpp gui/windows/worldselectdialog.h net/adminhandler.h + net/achievementhandler.h net/attendancehandler.h net/character.h net/characters.h @@ -1596,6 +1597,8 @@ SET(SRCS net/eathena/adminrecv.h net/eathena/adminhandler.cpp net/eathena/adminhandler.h + net/eathena/achievementhandler.cpp + net/eathena/achievementhandler.h net/eathena/attendancehandler.cpp net/eathena/attendancehandler.h net/eathena/attendancerecv.cpp @@ -2037,6 +2040,8 @@ SET(SRCS_TMWA gui/windows/shopselldialog.h net/tmwa/adminhandler.cpp net/tmwa/adminhandler.h + net/tmwa/achievementhandler.cpp + net/tmwa/achievementhandler.h net/tmwa/attendancehandler.cpp net/tmwa/attendancehandler.h net/tmwa/beingrecv.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 6a4c21411..17b320e41 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1576,6 +1576,7 @@ SRC = ${BASE_SRC} \ resources/map/walklayer.cpp \ resources/map/walklayer.h \ net/adminhandler.h \ + net/achievementhandler.h \ net/attendancehandler.h \ net/beinghandler.h \ net/buysellhandler.h \ @@ -1719,6 +1720,8 @@ SRC += \ gui/windows/shopselldialog.h \ net/tmwa/adminhandler.cpp \ net/tmwa/adminhandler.h \ + net/tmwa/achievementhandler.cpp \ + net/tmwa/achievementhandler.h \ net/tmwa/attendancehandler.cpp \ net/tmwa/attendancehandler.h \ net/tmwa/beingrecv.cpp \ @@ -1906,6 +1909,8 @@ SRC += gui/windows/bankwindow.cpp \ net/eathena/adminrecv.h \ net/eathena/adminhandler.cpp \ net/eathena/adminhandler.h \ + net/eathena/achievementhandler.cpp \ + net/eathena/achievementhandler.h \ net/eathena/attendancehandler.cpp \ net/eathena/attendancehandler.h \ net/eathena/attendancerecv.cpp \ 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 . + */ + +#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 . + */ + +#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 . + */ + +#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 . + */ + +#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 . + */ + +#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; -- cgit v1.2.3-70-g09d2