Skip to content

Commit f3a1590

Browse files
committed
Expand spell methods and add preliminary documentation for the new methods.
1 parent f47c9e6 commit f3a1590

6 files changed

Lines changed: 1750 additions & 100 deletions

File tree

methods/TrinityCore/AuraEffectMethods.h

Lines changed: 147 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,57 +10,105 @@
1010

1111
namespace LuaAuraEffects
1212
{
13+
/**
14+
* Returns the [Aura] that this [AuraEffect] belongs to.
15+
*
16+
* @return [Aura] base
17+
*/
1318
int GetBase(Eluna* E, AuraEffect* aurEff)
1419
{
1520
E->Push(aurEff->GetBase());
1621
return 1;
1722
}
1823

24+
/**
25+
* Returns the base amount of the [AuraEffect].
26+
*
27+
* @return int32 baseAmount
28+
*/
1929
int GetBaseAmount(Eluna* E, AuraEffect* aurEff)
2030
{
2131
E->Push(aurEff->GetBaseAmount());
2232
return 1;
2333
}
2434

35+
/**
36+
* Returns the amplitude in milliseconds of the [AuraEffect].
37+
*
38+
* @return uint32 amplitude
39+
*/
2540
int GetAmplitude(Eluna* E, AuraEffect* aurEff)
2641
{
2742
E->Push(aurEff->GetAmplitude());
2843
return 1;
2944
}
3045

46+
/**
47+
* Returns the current amount of the [AuraEffect].
48+
*
49+
* @return int32 amount
50+
*/
3151
int GetAmount(Eluna* E, AuraEffect* aurEff)
3252
{
3353
E->Push(aurEff->GetAmount());
3454
return 1;
3555
}
3656

57+
/**
58+
* Sets the amount of the [AuraEffect].
59+
*
60+
* @param int32 amount : the amount to set
61+
*/
3762
int SetAmount(Eluna* E, AuraEffect* aurEff)
3863
{
3964
int32 amount = E->CHECKVAL<int32>(2);
4065
aurEff->SetAmount(amount);
4166
return 0;
4267
}
4368

69+
/**
70+
* Returns the remaining time in milliseconds until the next tick of the [AuraEffect].
71+
*
72+
* @return int32 periodicTimer
73+
*/
4474
int GetPeriodicTimer(Eluna* E, AuraEffect* aurEff)
4575
{
4676
E->Push(aurEff->GetPeriodicTimer());
4777
return 1;
4878
}
4979

80+
/**
81+
* Sets the periodic timer of the [AuraEffect].
82+
*
83+
* @param int32 timer : the timer value in milliseconds to set
84+
*/
5085
int SetPeriodicTimer(Eluna* E, AuraEffect* aurEff)
5186
{
5287
int32 timer = E->CHECKVAL<int32>(2);
5388
aurEff->SetPeriodicTimer(timer);
5489
return 0;
5590
}
5691

92+
/**
93+
* Calculates and returns the amount of the [AuraEffect] for the given caster.
94+
*
95+
* @param [Unit] caster : the caster to calculate the amount for
96+
* @return int32 amount
97+
*/
5798
int CalculateAmount(Eluna* E, AuraEffect* aurEff)
5899
{
59100
Unit* caster = E->CHECKOBJ<Unit>(2);
60101
E->Push(aurEff->CalculateAmount(caster));
61102
return 1;
62103
}
63104

105+
/**
106+
* Calculates the periodic properties of the [AuraEffect] for the given caster.
107+
*
108+
* @param [Unit] caster : the caster to calculate for
109+
* @param bool resetPeriodicTimer = false : whether to reset the periodic timer
110+
* @param bool load = false : whether this is being loaded from the database
111+
*/
64112
int CalculatePeriodic(Eluna* E, AuraEffect* aurEff)
65113
{
66114
Unit* caster = E->CHECKOBJ<Unit>(2);
@@ -70,6 +118,13 @@ namespace LuaAuraEffects
70118
return 0;
71119
}
72120

121+
/**
122+
* Changes the amount of the [AuraEffect].
123+
*
124+
* @param int32 newAmount : the new amount to set
125+
* @param bool mark = true : whether to mark the effect as changed
126+
* @param bool onStackOrReapply = false : whether this change is due to a stack or reapply
127+
*/
73128
int ChangeAmount(Eluna* E, AuraEffect* aurEff)
74129
{
75130
int32 newAmount = E->CHECKVAL<int32>(2);
@@ -79,43 +134,76 @@ namespace LuaAuraEffects
79134
return 0;
80135
}
81136

137+
/**
138+
* Recalculates the amount of the [AuraEffect].
139+
*/
82140
int RecalculateAmount(Eluna* /*E*/, AuraEffect* aurEff)
83141
{
84142
aurEff->RecalculateAmount();
85143
return 0;
86144
}
87145

146+
/**
147+
* Returns `true` if the [AuraEffect] amount can be recalculated, `false` otherwise.
148+
*
149+
* @return bool canBeRecalculated
150+
*/
88151
int CanBeRecalculated(Eluna* E, AuraEffect* aurEff)
89152
{
90153
E->Push(aurEff->CanBeRecalculated());
91154
return 1;
92155
}
93156

157+
/**
158+
* Sets whether the [AuraEffect] amount can be recalculated.
159+
*
160+
* @param bool val = true : set to 'true' to allow recalculation
161+
*/
94162
int SetCanBeRecalculated(Eluna* E, AuraEffect* aurEff)
95163
{
96164
bool val = E->CHECKVAL<bool>(2, true);
97165
aurEff->SetCanBeRecalculated(val);
98166
return 0;
99167
}
100168

169+
/**
170+
* Returns the current tick number of the [AuraEffect].
171+
*
172+
* @return uint32 tickNumber
173+
*/
101174
int GetTickNumber(Eluna* E, AuraEffect* aurEff)
102175
{
103176
E->Push(aurEff->GetTickNumber());
104177
return 1;
105178
}
106179

180+
/**
181+
* Returns the number of remaining ticks of the [AuraEffect].
182+
*
183+
* @return uint32 remainingTicks
184+
*/
107185
int GetRemainingTicks(Eluna* E, AuraEffect* aurEff)
108186
{
109187
E->Push(aurEff->GetRemainingTicks());
110188
return 1;
111189
}
112190

191+
/**
192+
* Returns the total number of ticks of the [AuraEffect].
193+
*
194+
* @return uint32 totalTicks
195+
*/
113196
int GetTotalTicks(Eluna* E, AuraEffect* aurEff)
114197
{
115198
E->Push(aurEff->GetTotalTicks());
116199
return 1;
117200
}
118201

202+
/**
203+
* Returns a table of all [Unit]s currently affected by this [AuraEffect].
204+
*
205+
* @return table targets : a table of [Unit] objects
206+
*/
119207
int GetTargetList(Eluna* E, AuraEffect* aurEff)
120208
{
121209
std::list<Unit*> list;
@@ -134,36 +222,66 @@ namespace LuaAuraEffects
134222
return 1;
135223
}
136224

225+
/**
226+
* Returns the spell ID of the [AuraEffect].
227+
*
228+
* @return uint32 id
229+
*/
137230
int GetId(Eluna* E, AuraEffect* aurEff)
138231
{
139232
E->Push(aurEff->GetId());
140233
return 1;
141234
}
142235

236+
/**
237+
* Returns the effect index of the [AuraEffect].
238+
*
239+
* @return uint8 effIndex
240+
*/
143241
int GetEffIndex(Eluna* E, AuraEffect* aurEff)
144242
{
145243
E->Push(uint8(aurEff->GetEffIndex()));
146244
return 1;
147245
}
148246

247+
/**
248+
* Returns the aura type of the [AuraEffect].
249+
*
250+
* @return uint16 auraType
251+
*/
149252
int GetAuraType(Eluna* E, AuraEffect* aurEff)
150253
{
151254
E->Push(uint16(aurEff->GetAuraType()));
152255
return 1;
153256
}
154257

258+
/**
259+
* Returns the [Unit] that cast the [AuraEffect].
260+
*
261+
* @return [Unit] caster
262+
*/
155263
int GetCaster(Eluna* E, AuraEffect* aurEff)
156264
{
157265
E->Push(aurEff->GetCaster());
158266
return 1;
159267
}
160268

269+
/**
270+
* Returns the GUID of the [Unit] that cast the [AuraEffect].
271+
*
272+
* @return ObjectGuid casterGUID
273+
*/
161274
int GetCasterGUID(Eluna* E, AuraEffect* aurEff)
162275
{
163276
E->Push(aurEff->GetCasterGUID());
164277
return 1;
165278
}
166279

280+
/**
281+
* Returns the [ElunaSpellInfo] of the spell that created this [AuraEffect].
282+
*
283+
* @return [ElunaSpellInfo] spellInfo
284+
*/
167285
int GetSpellInfo(Eluna* E, AuraEffect* aurEff)
168286
{
169287
ElunaSpellInfo info(aurEff->GetId());
@@ -173,30 +291,35 @@ namespace LuaAuraEffects
173291

174292
ElunaRegister<AuraEffect> AuraEffectMethods[] =
175293
{
176-
{"GetBase", &LuaAuraEffects::GetBase},
177-
{"GetBaseAmount", &LuaAuraEffects::GetBaseAmount},
178-
{"GetAmplitude", &LuaAuraEffects::GetAmplitude},
179-
{"GetAmount", &LuaAuraEffects::GetAmount},
180-
{"SetAmount", &LuaAuraEffects::SetAmount},
181-
{"GetPeriodicTimer", &LuaAuraEffects::GetPeriodicTimer},
182-
{"SetPeriodicTimer", &LuaAuraEffects::SetPeriodicTimer},
183-
{"CalculateAmount", &LuaAuraEffects::CalculateAmount},
184-
{"CalculatePeriodic", &LuaAuraEffects::CalculatePeriodic},
185-
{"ChangeAmount", &LuaAuraEffects::ChangeAmount},
186-
{"RecalculateAmount", &LuaAuraEffects::RecalculateAmount},
187-
{"CanBeRecalculated", &LuaAuraEffects::CanBeRecalculated},
188-
{"SetCanBeRecalculated", &LuaAuraEffects::SetCanBeRecalculated},
189-
{"GetTickNumber", &LuaAuraEffects::GetTickNumber},
190-
{"GetRemainingTicks", &LuaAuraEffects::GetRemainingTicks},
191-
{"GetTotalTicks", &LuaAuraEffects::GetTotalTicks},
192-
{"GetTargetList", &LuaAuraEffects::GetTargetList},
193-
{"GetId", &LuaAuraEffects::GetId},
194-
{"GetEffIndex", &LuaAuraEffects::GetEffIndex},
195-
{"GetAuraType", &LuaAuraEffects::GetAuraType},
196-
{"GetCaster", &LuaAuraEffects::GetCaster},
197-
{"GetCasterGUID", &LuaAuraEffects::GetCasterGUID},
198-
{"GetSpellInfo", &LuaAuraEffects::GetSpellInfo}
294+
// Getters
295+
{ "GetBase", &LuaAuraEffects::GetBase },
296+
{ "GetBaseAmount", &LuaAuraEffects::GetBaseAmount },
297+
{ "GetAmplitude", &LuaAuraEffects::GetAmplitude },
298+
{ "GetAmount", &LuaAuraEffects::GetAmount },
299+
{ "GetPeriodicTimer", &LuaAuraEffects::GetPeriodicTimer },
300+
{ "GetTickNumber", &LuaAuraEffects::GetTickNumber },
301+
{ "GetRemainingTicks", &LuaAuraEffects::GetRemainingTicks },
302+
{ "GetTotalTicks", &LuaAuraEffects::GetTotalTicks },
303+
{ "GetTargetList", &LuaAuraEffects::GetTargetList },
304+
{ "GetId", &LuaAuraEffects::GetId },
305+
{ "GetEffIndex", &LuaAuraEffects::GetEffIndex },
306+
{ "GetAuraType", &LuaAuraEffects::GetAuraType },
307+
{ "GetCaster", &LuaAuraEffects::GetCaster },
308+
{ "GetCasterGUID", &LuaAuraEffects::GetCasterGUID },
309+
{ "GetSpellInfo", &LuaAuraEffects::GetSpellInfo },
310+
// Setters
311+
{ "SetAmount", &LuaAuraEffects::SetAmount },
312+
{ "SetPeriodicTimer", &LuaAuraEffects::SetPeriodicTimer },
313+
{ "SetCanBeRecalculated", &LuaAuraEffects::SetCanBeRecalculated },
314+
// Booleans
315+
{ "CanBeRecalculated", &LuaAuraEffects::CanBeRecalculated },
316+
// Other
317+
{ "CalculateAmount", &LuaAuraEffects::CalculateAmount },
318+
{ "CalculatePeriodic", &LuaAuraEffects::CalculatePeriodic },
319+
{ "ChangeAmount", &LuaAuraEffects::ChangeAmount },
320+
{ "RecalculateAmount", &LuaAuraEffects::RecalculateAmount },
199321
};
200-
};
322+
}
323+
201324
#endif
202325

methods/TrinityCore/AuraMethods.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ namespace LuaAura
168168
return 0;
169169
}
170170

171+
/**
172+
* Returns the [ElunaSpellInfo] of the spell that created this [Aura].
173+
*
174+
* @return [ElunaSpellInfo] spellInfo
175+
*/
171176
int GetSpellInfo(Eluna* E, Aura* aura)
172177
{
173178
ElunaSpellInfo info(aura->GetId());

0 commit comments

Comments
 (0)