diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-02 23:22:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-06 01:18:56 +0300 |
commit | f32c27a3446fc8312a7fd4f9a85b60720549582a (patch) | |
tree | cfd00cc5642ef897aba98bf9f6b1a53d02ddc825 /src | |
parent | b06871fcb8e0b678a7fdbc2a10b22283b2899d1c (diff) | |
download | manaplus-f32c27a3446fc8312a7fd4f9a85b60720549582a.tar.gz manaplus-f32c27a3446fc8312a7fd4f9a85b60720549582a.tar.bz2 manaplus-f32c27a3446fc8312a7fd4f9a85b60720549582a.tar.xz manaplus-f32c27a3446fc8312a7fd4f9a85b60720549582a.zip |
eathena: add basic handling for packet SMSG_QUEST_ADD 0x02b3.
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/net/eathena/generalhandler.cpp | 5 | ||||
-rw-r--r-- | src/net/eathena/generalhandler.h | 1 | ||||
-rw-r--r-- | src/net/eathena/packets.h | 2 | ||||
-rw-r--r-- | src/net/eathena/protocol.h | 2 | ||||
-rw-r--r-- | src/net/eathena/questhandler.cpp | 87 | ||||
-rw-r--r-- | src/net/eathena/questhandler.h | 43 |
8 files changed, 142 insertions, 2 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9c9a13448..b5ff1e503 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1360,6 +1360,8 @@ SET(SRCS_EATHENA net/eathena/playerhandler.cpp net/eathena/playerhandler.h net/eathena/protocol.h + net/eathena/questhandler.cpp + net/eathena/questhandler.h net/eathena/skillhandler.cpp net/eathena/skillhandler.h net/eathena/sprite.h diff --git a/src/Makefile.am b/src/Makefile.am index 330f5fbd0..8baa3520a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1290,6 +1290,8 @@ manaplus_SOURCES += net/eathena/gui/guildtab.cpp \ net/eathena/playerhandler.cpp \ net/eathena/playerhandler.h \ net/eathena/protocol.h \ + net/eathena/questhandler.cpp \ + net/eathena/questhandler.h \ net/eathena/skillhandler.cpp \ net/eathena/skillhandler.h \ net/eathena/sprite.h \ diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp index dcc4bc15c..5a18b15f9 100644 --- a/src/net/eathena/generalhandler.cpp +++ b/src/net/eathena/generalhandler.cpp @@ -56,6 +56,7 @@ #include "net/eathena/protocol.h" #include "net/eathena/tradehandler.h" #include "net/eathena/skillhandler.h" +#include "net/eathena/questhandler.h" #include "resources/db/itemdbstat.h" @@ -88,7 +89,8 @@ GeneralHandler::GeneralHandler() : mPartyHandler(new PartyHandler), mPlayerHandler(new PlayerHandler), mSkillHandler(new SkillHandler), - mTradeHandler(new TradeHandler) + mTradeHandler(new TradeHandler), + mQuestHandler(new QuestHandler) { static const uint16_t _messages[] = { @@ -184,6 +186,7 @@ void GeneralHandler::load() mNetwork->registerHandler(mSkillHandler.get()); mNetwork->registerHandler(mTradeHandler.get()); mNetwork->registerHandler(mPartyHandler.get()); + mNetwork->registerHandler(mQuestHandler.get()); } void GeneralHandler::reload() diff --git a/src/net/eathena/generalhandler.h b/src/net/eathena/generalhandler.h index d636b9c90..c509ef6da 100644 --- a/src/net/eathena/generalhandler.h +++ b/src/net/eathena/generalhandler.h @@ -74,6 +74,7 @@ class GeneralHandler final : public MessageHandler, MessageHandlerPtr mPlayerHandler; MessageHandlerPtr mSkillHandler; MessageHandlerPtr mTradeHandler; + MessageHandlerPtr mQuestHandler; }; } // namespace EAthena diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index fd595e7e2..a4b8e1f31 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -96,7 +96,7 @@ int16_t packet_lengths[] = 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 107, 0, 0, 0, 0, 0, 191, 0, 0, 0, 0, 0, 0, // #0x02C0 0, -1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 6d6690a2e..bf0b4bfb0 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -182,6 +182,8 @@ #define SMSG_GUILD_OPPOSITION_ACK 0x0181 #define SMSG_GUILD_BROKEN 0x015e +#define SMSG_QUEST_ADD 0x02b3 + #define SMSG_MVP 0x010c /********************************** diff --git a/src/net/eathena/questhandler.cpp b/src/net/eathena/questhandler.cpp new file mode 100644 index 000000000..7eb1734f1 --- /dev/null +++ b/src/net/eathena/questhandler.cpp @@ -0,0 +1,87 @@ +/* + * The ManaPlus Client + * Copyright (C) 2012-2014 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/questhandler.h" + +#include "gui/windows/skilldialog.h" +#include "gui/windows/questswindow.h" + +#include "net/eathena/protocol.h" + +#include "resources/skillconsts.h" + +#include "debug.h" + +namespace EAthena +{ + +QuestHandler::QuestHandler() : + MessageHandler() +{ + static const uint16_t _messages[] = + { + SMSG_QUEST_ADD, + 0 + }; + handledMessages = _messages; +} + +void QuestHandler::handleMessage(Net::MessageIn &msg) +{ + BLOCK_START("QuestHandler::handleMessage") + switch (msg.getId()) + { + case SMSG_QUEST_ADD: + processAddQuest(msg); + break; + + default: + break; + } + BLOCK_END("QuestHandler::handleMessage") +} + +void QuestHandler::processAddQuest(Net::MessageIn &msg) +{ + const int var = msg.readInt32("quest id"); + const int val = msg.readUInt8("state"); + msg.readUInt8("time diff"); + msg.readInt32("time"); + const int num = msg.readInt16("objectives count"); + for (int f = 0; f < num; f ++) + { + msg.readInt32("monster id"); + msg.readInt16("count"); + msg.readString(24, "monster name"); + } + + if (questsWindow) + { + questsWindow->updateQuest(var, val); + questsWindow->rebuild(true); + } + if (skillDialog) + { + skillDialog->updateQuest(var, val); + skillDialog->playUpdateEffect(var + SKILL_VAR_MIN_ID); + } +} + +} // namespace TmwAthena diff --git a/src/net/eathena/questhandler.h b/src/net/eathena/questhandler.h new file mode 100644 index 000000000..3b882e910 --- /dev/null +++ b/src/net/eathena/questhandler.h @@ -0,0 +1,43 @@ +/* + * The ManaPlus Client + * Copyright (C) 2012-2014 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_QUESTHANDLER_H +#define NET_EATHENA_QUESTHANDLER_H + +#include "net/eathena/messagehandler.h" + +namespace EAthena +{ + +class QuestHandler final : public MessageHandler +{ + public: + QuestHandler(); + + A_DELETE_COPY(QuestHandler) + + void handleMessage(Net::MessageIn &msg) override final; + + static void processAddQuest(Net::MessageIn &msg); +}; + +} // namespace EAthena + +#endif // NET_EATHENA_QUESTHANDLER_H |