forked from ElunaLuaEngine/Eluna
-
Notifications
You must be signed in to change notification settings - Fork 0
/
QuestMethods.h
187 lines (174 loc) · 5.92 KB
/
QuestMethods.h
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/*
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
#ifndef QUESTMETHODS_H
#define QUESTMETHODS_H
/***
* Inherits all methods from: none
*/
namespace LuaQuest
{
/**
* Returns 'true' if the [Quest] has the specified flag, false otherwise.
* Below flags are based off of 3.3.5a. Subject to change.
*
* <pre>
* enum QuestFlags
* {
* // Flags used at server and sent to client
* QUEST_FLAGS_NONE = 0x0,
* QUEST_FLAGS_STAY_ALIVE = 0x1, // Not used currently
* QUEST_FLAGS_PARTY_ACCEPT = 0x2, // Not used currently. If player in party, all players that can accept this quest will receive confirmation box to accept quest CMSG_QUEST_CONFIRM_ACCEPT/SMSG_QUEST_CONFIRM_ACCEPT
* QUEST_FLAGS_EXPLORATION = 0x4, // Not used currently
* QUEST_FLAGS_SHARABLE = 0x8, // Can be shared: Player::CanShareQuest()
* QUEST_FLAGS_HAS_CONDITION = 0x10, // Not used currently
* QUEST_FLAGS_HIDE_REWARD_POI = 0x20, // Not used currently: Unsure of content
* QUEST_FLAGS_RAID = 0x40, // Not used currently
* QUEST_FLAGS_TBC = 0x80, // Not used currently: Available if TBC expansion enabled only
* QUEST_FLAGS_NO_MONEY_FROM_XP = 0x100, // Not used currently: Experience is not converted to gold at max level
* QUEST_FLAGS_HIDDEN_REWARDS = 0x200, // Items and money rewarded only sent in SMSG_QUESTGIVER_OFFER_REWARD (not in SMSG_QUESTGIVER_QUEST_DETAILS or in client quest log(SMSG_QUEST_QUERY_RESPONSE))
* QUEST_FLAGS_TRACKING = 0x400, // These quests are automatically rewarded on quest complete and they will never appear in quest log client side.
* QUEST_FLAGS_DEPRECATE_REPUTATION = 0x800, // Not used currently
* QUEST_FLAGS_DAILY = 0x1000, // Used to know quest is Daily one
* QUEST_FLAGS_FLAGS_PVP = 0x2000, // Having this quest in log forces PvP flag
* QUEST_FLAGS_UNAVAILABLE = 0x4000, // Used on quests that are not generically available
* QUEST_FLAGS_WEEKLY = 0x8000,
* QUEST_FLAGS_AUTOCOMPLETE = 0x10000, // auto complete
* QUEST_FLAGS_DISPLAY_ITEM_IN_TRACKER = 0x20000, // Displays usable item in quest tracker
* QUEST_FLAGS_OBJ_TEXT = 0x40000, // use Objective text as Complete text
* QUEST_FLAGS_AUTO_ACCEPT = 0x80000, // The client recognizes this flag as auto-accept. However, NONE of the current quests (3.3.5a) have this flag. Maybe blizz used to use it, or will use it in the future.
*
* // ... 4.x added flags up to 0x80000000 - all unknown for now
* };
* </pre>
*
* @param [QuestFlags] flag : all available flags can be seen above
* @return bool hasFlag
*/
int HasFlag(lua_State* L, Quest* quest)
{
uint32 flag = Eluna::CHECKVAL<uint32>(L, 2);
#ifndef TRINITY
Eluna::Push(L, quest->HasQuestFlag((QuestFlags)flag));
#else
Eluna::Push(L, quest->HasFlag(flag));
#endif
return 1;
}
#ifndef CLASSIC
/**
* Returns 'true' if the [Quest] is a daily quest, false otherwise.
*
* @return bool isDaily
*/
int IsDaily(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->IsDaily());
return 1;
}
#endif
/**
* Returns 'true' if the [Quest] is repeatable, false otherwise.
*
* @return bool isRepeatable
*/
int IsRepeatable(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->IsRepeatable());
return 1;
}
/**
* Returns entry ID of the [Quest].
*
* @return uint32 entryId
*/
int GetId(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->GetQuestId());
return 1;
}
/**
* Returns the [Quest]'s level.
*
* @return uint32 level
*/
int GetLevel(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->GetQuestLevel());
return 1;
}
/**
* Returns the minimum level required to pick up the [Quest].
*
* @return uint32 minLevel
*/
int GetMinLevel(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->GetMinLevel());
return 1;
}
/**
* Returns the next [Quest] entry ID.
*
* @return int32 entryId
*/
int GetNextQuestId(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->GetNextQuestId());
return 1;
}
/**
* Returns the previous [Quest] entry ID.
*
* @return int32 entryId
*/
int GetPrevQuestId(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->GetPrevQuestId());
return 1;
}
/**
* Returns the next [Quest] entry ID in the specific [Quest] chain.
*
* @return int32 entryId
*/
int GetNextQuestInChain(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->GetNextQuestInChain());
return 1;
}
/**
* Returns the [Quest]'s flags.
*
* @return [QuestFlags] flags
*/
int GetFlags(lua_State* L, Quest* quest)
{
#ifndef TRINITY
Eluna::Push(L, quest->GetQuestFlags());
#else
Eluna::Push(L, quest->GetFlags());
#endif
return 1;
}
/**
* Returns the [Quest]'s type.
*
* TODO: Document types available.
*
* @return uint32 type
*/
int GetType(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->GetType());
return 1;
}
/*int GetMaxLevel(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->GetMaxLevel());
return 1;
}*/
};
#endif