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/net/eathena | |
parent | b06871fcb8e0b678a7fdbc2a10b22283b2899d1c (diff) | |
download | plus-f32c27a3446fc8312a7fd4f9a85b60720549582a.tar.gz plus-f32c27a3446fc8312a7fd4f9a85b60720549582a.tar.bz2 plus-f32c27a3446fc8312a7fd4f9a85b60720549582a.tar.xz plus-f32c27a3446fc8312a7fd4f9a85b60720549582a.zip |
eathena: add basic handling for packet SMSG_QUEST_ADD 0x02b3.
Diffstat (limited to 'src/net/eathena')
-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 |
6 files changed, 138 insertions, 2 deletions
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 |