Tramway SDK v0.1.1
quest.h
Go to the documentation of this file.
1// Tramway Drifting and Dungeon Exploration Simulator SDK Runtime
2
3#ifndef TRAM_SDK_EXTENSIONS_KITCHENSINK_QUEST_H
4#define TRAM_SDK_EXTENSIONS_KITCHENSINK_QUEST_H
5
6#include <framework/value.h>
7
8#include <vector>
9
10namespace tram::Ext::Kitchensink {
11
12enum quest_t : int {
14
17
25
28
30
31
33
34
39};
40
44
45 union {
46 struct {
49
50 struct {
55
56 struct {
59
60 struct {
63
64 // if quest2 set, then variable2 is name of the quest's variable
65 // if quest is not set, then variable2 is the Value for comparison
68
70
71 struct {
74 int count;
76 };
77
80
87
90
92
94
96
99
102 //QuestVariable& operator=(QuestVariable& a, const QuestVariable& b);
103
105};
106
110
111 name_t condition; // condition, if any, for firing
112
113 name_t variable; // name for variable which will be set
114 value_t value; // variable name for which will be set
115
117 void SetObjective(name_t name, name_t state);
119};
120
121struct Quest {
123
125
126 std::vector<QuestVariable> variables;
127 std::vector<QuestTrigger> triggers;
128
129 // TODO: add trigger script
130 // if can't find in trigger list, then call script
131
133 void SetVariable(name_t, Value);
134
135 void FireTrigger(name_t);
136
137 static void Init();
138
139
140 static std::vector<Quest*> FindAll(bool unknown_also);
141
142 static void LoadFromDisk(const char* filename);
143 static Quest* Find(name_t quest);
144};
145
146}
147
148#endif // TRAM_SDK_EXTENSIONS_KITCHENSINK_QUEST_H
Generic, type-safe union.
Definition: value.h:18
Extension containing random stuff that doesn't fit in anywhere else.
Definition: ai.cpp:15
quest_t
Definition: quest.h:12
@ QUEST_VAR_CONDITION_OR
Definition: quest.h:27
@ QUEST_VAR_VALUE_GREATER_OR_EQUAL
Definition: quest.h:21
@ QUEST_TGR_INCREMENT
Definition: quest.h:37
@ QUEST_VAR_CONDITION_AND
Definition: quest.h:26
@ QUEST_VAR_INVALID
Definition: quest.h:13
@ QUEST_VAR_CONDITION_NOT
Definition: quest.h:24
@ QUEST_TGR_SET_OBJECTIVE
Definition: quest.h:36
@ QUEST_VAR_CONDITION_SCRIPT
Definition: quest.h:29
@ QUEST_VAR_VALUE_IS
Definition: quest.h:18
@ QUEST_VAR_VALUE
Definition: quest.h:15
@ QUEST_VAR_OBJECTIVE
Definition: quest.h:16
@ QUEST_TGR_SET_VARIABLE
Definition: quest.h:35
@ QUEST_VAR_ENTITY_ITEM_COUNT
Definition: quest.h:32
@ QUEST_VAR_VALUE_LESS_OR_EQUAL
Definition: quest.h:23
@ QUEST_VAR_VALUE_GREATER
Definition: quest.h:20
@ QUEST_VAR_VALUE_IS_NOT
Definition: quest.h:19
@ QUEST_VAR_VALUE_LESS
Definition: quest.h:22
@ QUEST_TGR_SHOW_MESSAGE
Definition: quest.h:38
Definition: quest.h:121
Value GetVariable(name_t)
Definition: quest.cpp:286
static void Init()
Definition: quest.cpp:397
name_t name
Definition: quest.h:124
static Quest * Find(name_t quest)
Definition: quest.cpp:385
Quest(name_t name)
Definition: quest.h:122
void SetVariable(name_t, Value)
Definition: quest.cpp:296
static void LoadFromDisk(const char *filename)
Definition: quest.cpp:427
void FireTrigger(name_t)
Definition: quest.cpp:318
std::vector< QuestVariable > variables
Definition: quest.h:126
static std::vector< Quest * > FindAll(bool unknown_also)
Definition: quest.cpp:353
std::vector< QuestTrigger > triggers
Definition: quest.h:127
name_t name
Definition: quest.h:108
name_t variable
Definition: quest.h:113
quest_t type
Definition: quest.h:109
name_t condition
Definition: quest.h:111
value_t value
Definition: quest.h:114
void SetIncrement(name_t variable)
Definition: quest.cpp:279
void SetObjective(name_t name, name_t state)
Definition: quest.cpp:273
void SetValue(name_t variable, Value)
Definition: quest.cpp:267
name_t item
Definition: quest.h:73
~QuestVariable()
Definition: quest.h:98
static QuestVariable Value(name_t, value_t)
Definition: quest.cpp:35
struct tram::Ext::Kitchensink::QuestVariable::@21::@26 comparison
name_t quest1
Definition: quest.h:61
static QuestVariable ItemCount(name_t, name_t, name_t)
Definition: quest.cpp:196
static QuestVariable Script(name_t, name_t)
Definition: quest.cpp:172
static QuestVariable Is(name_t, name_t, name_t, name_t, value_t)
Definition: quest.cpp:46
value_t variable2
Definition: quest.h:67
QuestVariable & operator=(const QuestVariable &)
Definition: quest.cpp:30
QuestVariable()
Definition: quest.h:97
static QuestVariable Or(name_t, name_t, name_t, name_t, value_t)
Definition: quest.cpp:158
int count
Definition: quest.h:74
struct tram::Ext::Kitchensink::QuestVariable::@21::@25 script
static QuestVariable Less(name_t, name_t, name_t, name_t, value_t)
Definition: quest.cpp:102
name_t entity
Definition: quest.h:72
struct tram::Ext::Kitchensink::QuestVariable::@21::@24 objective
static QuestVariable Greater(name_t, name_t, name_t, name_t, value_t)
Definition: quest.cpp:74
quest_t type
Definition: quest.h:43
static QuestVariable Not(name_t, name_t, name_t)
Definition: quest.cpp:130
name_t subtitle
Definition: quest.h:53
name_t value
Definition: quest.h:51
static QuestVariable LessOrEqual(name_t, name_t, name_t, name_t, value_t)
Definition: quest.cpp:116
Value value
Definition: quest.h:47
static QuestVariable IsNot(name_t, name_t, name_t, name_t, value_t)
Definition: quest.cpp:60
static QuestVariable GreaterOrEqual(name_t, name_t, name_t, name_t, value_t)
Definition: quest.cpp:88
name_t name
Definition: quest.h:42
static QuestVariable Objective(name_t, name_t, name_t, name_t)
Definition: quest.cpp:183
value_t Evaluate()
Definition: quest.cpp:220
name_t variable1
Definition: quest.h:62
name_t title
Definition: quest.h:52
static QuestVariable And(name_t, name_t, name_t, name_t, value_t)
Definition: quest.cpp:144
name_t quest2
Definition: quest.h:66
Interned string type.
Definition: uid.h:10