Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarQuestTemplateDatabase.hpp
blob: 3af67dadbf3c8c988f64fdf0d33d7d6daad6cb52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#pragma once

#include "StarItemDescriptor.hpp"
#include "StarThread.hpp"
#include "StarVector.hpp"
#include "StarStrongTypedef.hpp"

namespace Star {

STAR_CLASS(SpeciesTextVariants);
STAR_CLASS(PositionalTextVariants);
STAR_CLASS(QuestTemplate);
STAR_CLASS(QuestTemplateDatabase);

// A Quest Template
// Used to check prerequisites for quest availability and by the QuestManager to
// instantiate quests
class QuestTemplate {
public:
  QuestTemplate(Json const& config);

  Json config;
  String templateId;
  String title;
  String text;
  String completionText;
  String failureText;
  StringMap<String> parameterTypes;
  JsonObject parameterExamples;
  Vec2U moneyRange;
  List<List<ItemDescriptor>> rewards;
  List<String> rewardParameters;
  Maybe<String> completionCinema;
  bool canBeAbandoned;
  // Whether the quest is cleared from the quest log when it is
  // completed/failed.
  bool ephemeral;
  // determine whether to show the quest in the quest log
  bool showInLog;
  // whether to show the quest accept, quest complete, and/or quest fail popups
  bool showAcceptDialog;
  bool showCompleteDialog;
  bool showFailDialog;
  // main quests are listed separately in the quest log
  bool mainQuest;
  // hide from log when the quest server uuid doesn't match the current client context server uuid
  bool hideCrossServer;
  String questGiverIndicator;
  String questReceiverIndicator;

  List<String> prerequisiteQuests;
  Maybe<unsigned> requiredShipLevel;
  List<ItemDescriptor> requiredItems;

  unsigned updateDelta;
  Maybe<String> script;
  JsonObject scriptConfig;

  Maybe<String> newQuestGuiConfig;
  Maybe<String> questCompleteGuiConfig;
  Maybe<String> questFailedGuiConfig;
};

// Quest Template Database
// Stores and returns from the list of known quest templates
class QuestTemplateDatabase {
public:
  QuestTemplateDatabase();

  // Return a list of all known template id values
  List<String> allQuestTemplateIds() const;

  // Return the template for the given template id
  QuestTemplatePtr questTemplate(String const& templateId) const;

private:
  StringMap<QuestTemplatePtr> m_templates;
};

}