ManaPlus
questrecv.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2012-2019 The ManaPlus Developers
4  * Copyright (C) 2019-2021 Andrei Karas
5  *
6  * This file is part of The ManaPlus Client.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "net/tmwa/questrecv.h"
23 
26 
27 #include "net/messagein.h"
28 
29 #include "const/resources/skill.h"
30 
31 #include "debug.h"
32 
33 namespace TmwAthena
34 {
35 
37 {
38  const int var = msg.readInt16("variable");
39  const int val = msg.readInt32("value");
40  if (questsWindow != nullptr)
41  {
42  questsWindow->updateQuest(var, val, 0, 0, 0);
43  questsWindow->rebuild(true);
44  }
45  if (skillDialog != nullptr)
46  {
47  skillDialog->updateQuest(var, val, 0, 0, 0);
49  }
50 }
51 
53 {
54  const int count = (msg.readInt16("len") - 4) / 6;
55  for (int f = 0; f < count; f ++)
56  {
57  const int var = msg.readInt16("variable");
58  const int val = msg.readInt32("value");
59  if (questsWindow != nullptr)
60  questsWindow->updateQuest(var, val, 0, 0, 0);
61  if (skillDialog != nullptr)
62  skillDialog->updateQuest(var, val, 0, 0, 0);
63  }
64  if (questsWindow != nullptr)
65  questsWindow->rebuild(false);
66 }
67 
68 } // namespace TmwAthena
void updateQuest(const int var, const int val1, const int val2, const int val3, const int time1)
void rebuild(const bool playSound)
void updateQuest(const int var, const int val1, const int val2, const int val3, const int time1)
void playUpdateEffect(const int id) const
bool msg(InputEvent &event)
Definition: chat.cpp:39
void processPlayerQuests(Net::MessageIn &msg)
Definition: questrecv.cpp:52
void processSetQuestVar(Net::MessageIn &msg)
Definition: questrecv.cpp:36
QuestsWindow * questsWindow
const unsigned int SKILL_VAR_MIN_ID
Definition: skill.h:26
SkillDialog * skillDialog
Definition: skilldialog.cpp:66