forked from ElunaLuaEngine/Eluna
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BattleGroundMethods.h
228 lines (206 loc) · 5.31 KB
/
BattleGroundMethods.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/*
* 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 BATTLEGROUNDMETHODS_H
#define BATTLEGROUNDMETHODS_H
/***
* Contains the state of a battleground, e.g. Warsong Gulch, Arathi Basin, etc.
*
* Inherits all methods from: none
*/
namespace LuaBattleGround
{
/**
* Returns the name of the [BattleGround].
*
* @return string name
*/
int GetName(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetName());
return 1;
}
/**
* Returns the amount of alive players in the [BattleGround] by the team ID.
*
* @param [Team] team : team ID
* @return uint32 count
*/
int GetAlivePlayersCountByTeam(lua_State* L, BattleGround* bg)
{
uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, bg->GetAlivePlayersCountByTeam((Team)team));
return 1;
}
/**
* Returns the [Map] of the [BattleGround].
*
* @return [Map] map
*/
int GetMap(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetBgMap());
return 1;
}
/**
* Returns the bonus honor given by amount of kills in the specific [BattleGround].
*
* @param uint32 kills : amount of kills
* @return uint32 bonusHonor
*/
int GetBonusHonorFromKillCount(lua_State* L, BattleGround* bg)
{
uint32 kills = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, bg->GetBonusHonorFromKill(kills));
return 1;
}
/**
* Returns the bracket ID of the specific [BattleGround].
*
* @return [BattleGroundBracketId] bracketId
*/
int GetBracketId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetBracketId());
return 1;
}
/**
* Returns the end time of the [BattleGround].
*
* @return uint32 endTime
*/
int GetEndTime(lua_State* L, BattleGround* bg)
{
#ifdef CATA
Eluna::Push(L, bg->GetRemainingTime());
#else
Eluna::Push(L, bg->GetEndTime());
#endif
return 1;
}
/**
* Returns the amount of free slots for the selected team in the specific [BattleGround].
*
* @param [Team] team : team ID
* @return uint32 freeSlots
*/
int GetFreeSlotsForTeam(lua_State* L, BattleGround* bg)
{
uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, bg->GetFreeSlotsForTeam((Team)team));
return 1;
}
/**
* Returns the instance ID of the [BattleGround].
*
* @return uint32 instanceId
*/
int GetInstanceId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetInstanceID());
return 1;
}
/**
* Returns the map ID of the [BattleGround].
*
* @return uint32 mapId
*/
int GetMapId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMapId());
return 1;
}
/**
* Returns the type ID of the [BattleGround].
*
* @return [BattleGroundTypeId] typeId
*/
int GetTypeId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetTypeID());
return 1;
}
/**
* Returns the max allowed [Player] level of the specific [BattleGround].
*
* @return uint32 maxLevel
*/
int GetMaxLevel(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMaxLevel());
return 1;
}
/**
* Returns the minimum allowed [Player] level of the specific [BattleGround].
*
* @return uint32 minLevel
*/
int GetMinLevel(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMinLevel());
return 1;
}
/**
* Returns the maximum allowed [Player] count of the specific [BattleGround].
*
* @return uint32 maxPlayerCount
*/
int GetMaxPlayers(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMaxPlayers());
return 1;
}
/**
* Returns the minimum allowed [Player] count of the specific [BattleGround].
*
* @return uint32 minPlayerCount
*/
int GetMinPlayers(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMinPlayers());
return 1;
}
/**
* Returns the maximum allowed [Player] count per team of the specific [BattleGround].
*
* @return uint32 maxTeamPlayerCount
*/
int GetMaxPlayersPerTeam(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMaxPlayersPerTeam());
return 1;
}
/**
* Returns the minimum allowed [Player] count per team of the specific [BattleGround].
*
* @return uint32 minTeamPlayerCount
*/
int GetMinPlayersPerTeam(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMinPlayersPerTeam());
return 1;
}
/**
* Returns the winning team of the specific [BattleGround].
*
* @return [Team] team
*/
int GetWinner(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetWinner());
return 1;
}
/**
* Returns the status of the specific [BattleGround].
*
* @return [BattleGroundStatus] status
*/
int GetStatus(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetStatus());
return 1;
}
};
#endif