Eluna fix doc style and prepare merge a PR

This commit is contained in:
Rochet2
2014-08-09 01:26:14 +03:00
parent 57153d6c47
commit 30e5c418ba
6 changed files with 158 additions and 94 deletions

View File

@@ -10,9 +10,9 @@
namespace LuaAura namespace LuaAura
{ {
/** /**
* Returns the `Unit` that casted the `Spell` that caused this Aura to be applied. * Returns the &Unit that casted the &Spell that caused this &Aura to be applied.
* *
* @return :Unit the `Unit` that casted this Aura * @return &Unit : the &Unit that casted this &Aura
*/ */
int GetCaster(lua_State* L, Aura* aura) int GetCaster(lua_State* L, Aura* aura)
{ {
@@ -21,9 +21,9 @@ namespace LuaAura
} }
/** /**
* Returns the GUID of the `Unit` that casted the `Spell` that caused this Aura to be applied. * Returns the GUID of the &Unit that casted the &Spell that caused this &Aura to be applied.
* *
* @return :string the GUID of the `Unit` as a decimal string * @return uint64 : the GUID of the &Unit as a string
*/ */
int GetCasterGUID(lua_State* L, Aura* aura) int GetCasterGUID(lua_State* L, Aura* aura)
{ {
@@ -36,9 +36,9 @@ namespace LuaAura
} }
/** /**
* Returns the level of the `Unit` that casted the `Spell` that caused this Aura to be applied. * Returns the level of the &Unit that casted the &Spell that caused this &Aura to be applied.
* *
* @return :number the level of the `Unit` * @return uint8 : the level of the &Unit
*/ */
int GetCasterLevel(lua_State* L, Aura* aura) int GetCasterLevel(lua_State* L, Aura* aura)
{ {
@@ -47,9 +47,9 @@ namespace LuaAura
} }
/** /**
* Returns the amount of time left until the Aura expires. * Returns the amount of time left until the &Aura expires.
* *
* @return :number amount of time left in milliseconds * @return int32 : amount of time left in milliseconds
*/ */
int GetDuration(lua_State* L, Aura* aura) int GetDuration(lua_State* L, Aura* aura)
{ {
@@ -62,9 +62,9 @@ namespace LuaAura
} }
/** /**
* Returns the ID of the `Spell` that caused this Aura to be applied. * Returns the ID of the &Spell that caused this &Aura to be applied.
* *
* @return :number the `Spell` ID * @return uint32 : the spellid
*/ */
int GetAuraId(lua_State* L, Aura* aura) int GetAuraId(lua_State* L, Aura* aura)
{ {
@@ -73,12 +73,12 @@ namespace LuaAura
} }
/** /**
* Returns the amount of time this Aura lasts when applied. * Returns the amount of time this &Aura lasts when applied.
* *
* To determine how much time has passed since this Aura was applied, * To determine how much time has passed since this &Aura was applied,
* subtract the result of `GetDuration` from the result of this method. * subtract the result of `GetDuration` from the result of this method.
* *
* @return :number the maximum duration of the Aura, in milliseconds * @return int32 : the maximum duration of the &Aura, in milliseconds
*/ */
int GetMaxDuration(lua_State* L, Aura* aura) int GetMaxDuration(lua_State* L, Aura* aura)
{ {
@@ -91,11 +91,11 @@ namespace LuaAura
} }
/** /**
* Returns the number of times the Aura has "stacked". * Returns the number of times the &Aura has "stacked".
* *
* This is the same as the number displayed on the Aura's icon in-game. * This is the same as the number displayed on the &Aura's icon in-game.
* *
* @return :number how many times the Aura has stacked * @return uint8 : how many times the &Aura has stacked
*/ */
int GetStackAmount(lua_State* L, Aura* aura) int GetStackAmount(lua_State* L, Aura* aura)
{ {
@@ -104,9 +104,9 @@ namespace LuaAura
} }
/** /**
* Returns the `Unit` that the Aura has been applied to. * Returns the &Unit that the &Aura has been applied to.
* *
* @return :Unit who the Aura has been applied to * @return &Unit : &Unit who the &Aura has been applied to
*/ */
int GetOwner(lua_State* L, Aura* aura) int GetOwner(lua_State* L, Aura* aura)
{ {
@@ -119,13 +119,13 @@ namespace LuaAura
} }
/** /**
* Change the amount of time before the Aura expires. * Change the amount of time before the &Aura expires.
* *
* @param duration :number the new duration of the Aura, in milliseconds * @param int32 duration : the new duration of the &Aura, in milliseconds
*/ */
int SetDuration(lua_State* L, Aura* aura) int SetDuration(lua_State* L, Aura* aura)
{ {
int duration = Eluna::CHECKVAL<int>(L, 2); int32 duration = Eluna::CHECKVAL<int32>(L, 2);
#ifndef TRINITY #ifndef TRINITY
aura->GetHolder()->SetAuraDuration(duration); aura->GetHolder()->SetAuraDuration(duration);
#else #else
@@ -135,16 +135,16 @@ namespace LuaAura
} }
/** /**
* Change the maximum amount of time before the Aura expires. * Change the maximum amount of time before the &Aura expires.
* *
* This does not affect the current duration of the Aura, but if the Aura * This does not affect the current duration of the &Aura, but if the &Aura
* is reset to the maximum duration, it will instead change to `duration`. * is reset to the maximum duration, it will instead change to `duration`.
* *
* @param duration :number the new maximum duration of the Aura, in milliseconds * @param int32 duration : the new maximum duration of the &Aura, in milliseconds
*/ */
int SetMaxDuration(lua_State* L, Aura* aura) int SetMaxDuration(lua_State* L, Aura* aura)
{ {
int duration = Eluna::CHECKVAL<int>(L, 2); int32 duration = Eluna::CHECKVAL<int32>(L, 2);
#ifndef TRINITY #ifndef TRINITY
aura->GetHolder()->SetAuraMaxDuration(duration); aura->GetHolder()->SetAuraMaxDuration(duration);
#else #else
@@ -154,16 +154,16 @@ namespace LuaAura
} }
/** /**
* Change the amount of times the Aura has "stacked" on the `Unit`. * Change the amount of times the &Aura has "stacked" on the &Unit.
* *
* If `amount` is greater than or equal to the current number of stacks, * If `amount` is greater than or equal to the current number of stacks,
* then the Aura has its duration reset to the maximum duration. * then the &Aura has its duration reset to the maximum duration.
* *
* @param amount :number the new stack amount for the Aura * @param uint8 amount : the new stack amount for the &Aura
*/ */
int SetStackAmount(lua_State* L, Aura* aura) int SetStackAmount(lua_State* L, Aura* aura)
{ {
int amount = Eluna::CHECKVAL<int>(L, 2); uint8 amount = Eluna::CHECKVAL<uint8>(L, 2);
#ifndef TRINITY #ifndef TRINITY
aura->GetHolder()->SetStackAmount(amount); aura->GetHolder()->SetStackAmount(amount);
#else #else
@@ -173,7 +173,7 @@ namespace LuaAura
} }
/** /**
* Remove this Aura from the `Unit` it is applied to. * Remove this &Aura from the &Unit it is applied to.
*/ */
int Remove(lua_State* /*L*/, Aura* aura) int Remove(lua_State* /*L*/, Aura* aura)
{ {

View File

@@ -950,8 +950,8 @@ namespace LuaGlobalFunctions
int banMode = Eluna::CHECKVAL<int>(L, 1); int banMode = Eluna::CHECKVAL<int>(L, 1);
std::string nameOrIP = Eluna::CHECKVAL<std::string>(L, 2); std::string nameOrIP = Eluna::CHECKVAL<std::string>(L, 2);
uint32 duration = Eluna::CHECKVAL<uint32>(L, 3); uint32 duration = Eluna::CHECKVAL<uint32>(L, 3);
const char* reason = Eluna::CHECKVAL<const char*>(L, 4); const char* reason = Eluna::CHECKVAL<const char*>(L, 4, "");
const char* whoBanned = Eluna::CHECKOBJ<Player>(L, 5); const char* whoBanned = Eluna::CHECKVAL<const char*>(L, 5, "");
switch (banMode) switch (banMode)
{ {

View File

@@ -190,9 +190,10 @@ void Eluna::OnPacketSendAny(Player* player, WorldPacket& packet, bool& result)
{ {
if (lua_isnoneornil(L, i)) if (lua_isnoneornil(L, i))
continue; continue;
if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, i, false)) if (lua_isuserdata(L, i))
packet = *data; if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, i, false))
if (!CHECKVAL<bool>(L, i, true)) packet = *data;
if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{ {
result = false; result = false;
break; break;
@@ -210,9 +211,10 @@ void Eluna::OnPacketSendOne(Player* player, WorldPacket& packet, bool& result)
{ {
if (lua_isnoneornil(L, i)) if (lua_isnoneornil(L, i))
continue; continue;
if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, i, false)) if (lua_isuserdata(L, i))
packet = *data; if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, i, false))
if (!CHECKVAL<bool>(L, i, true)) packet = *data;
if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{ {
result = false; result = false;
break; break;
@@ -241,9 +243,10 @@ void Eluna::OnPacketReceiveAny(Player* player, WorldPacket& packet, bool& result
{ {
if (lua_isnoneornil(L, i)) if (lua_isnoneornil(L, i))
continue; continue;
if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, i, false)) if (lua_isuserdata(L, i))
packet = *data; if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, i, false))
if (!CHECKVAL<bool>(L, i, true)) packet = *data;
if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{ {
result = false; result = false;
break; break;
@@ -261,9 +264,10 @@ void Eluna::OnPacketReceiveOne(Player* player, WorldPacket& packet, bool& result
{ {
if (lua_isnoneornil(L, i)) if (lua_isnoneornil(L, i))
continue; continue;
if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, i, false)) if (lua_isuserdata(L, i))
packet = *data; if (WorldPacket* data = CHECKOBJ<WorldPacket>(L, i, false))
if (!CHECKVAL<bool>(L, i, true)) packet = *data;
if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{ {
result = false; result = false;
break; break;
@@ -477,9 +481,8 @@ bool Eluna::OnItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targ
ENTRY_EXECUTE(1); ENTRY_EXECUTE(1);
FOR_RETS(i) FOR_RETS(i)
{ {
if (lua_isnoneornil(L, i)) if (lua_isboolean(L, i))
continue; result = CHECKVAL<bool>(L, i, result);
result = CHECKVAL<bool>(L, i, result);
} }
ENDCALL(); ENDCALL();
return result; return result;
@@ -495,9 +498,8 @@ bool Eluna::OnItemGossip(Player* pPlayer, Item* pItem, SpellCastTargets const& /
ENTRY_EXECUTE(1); ENTRY_EXECUTE(1);
FOR_RETS(i) FOR_RETS(i)
{ {
if (lua_isnoneornil(L, i)) if (lua_isboolean(L, i))
continue; result = CHECKVAL<bool>(L, i, result);
result = CHECKVAL<bool>(L, i, result);
} }
ENDCALL(); ENDCALL();
return result; return result;
@@ -556,9 +558,8 @@ bool Eluna::OnCommand(Player* player, const char* text)
EVENT_EXECUTE(1); EVENT_EXECUTE(1);
FOR_RETS(i) FOR_RETS(i)
{ {
if (lua_isnoneornil(L, i)) if (lua_isboolean(L, i))
continue; result = CHECKVAL<bool>(L, i, result);
result = CHECKVAL<bool>(L, i, result);
} }
ENDCALL(); ENDCALL();
return result; return result;
@@ -637,7 +638,7 @@ InventoryResult Eluna::OnCanUseItem(const Player* pPlayer, uint32 itemEntry)
EVENT_EXECUTE(1); EVENT_EXECUTE(1);
FOR_RETS(i) FOR_RETS(i)
{ {
if (lua_isnoneornil(L, i)) if (!lua_isnumber(L, i))
continue; continue;
uint32 res = CHECKVAL<uint32>(L, i, EQUIP_ERR_OK); uint32 res = CHECKVAL<uint32>(L, i, EQUIP_ERR_OK);
if (res != EQUIP_ERR_OK) if (res != EQUIP_ERR_OK)
@@ -735,9 +736,8 @@ void Eluna::OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim)
EVENT_EXECUTE(1); EVENT_EXECUTE(1);
FOR_RETS(i) FOR_RETS(i)
{ {
if (lua_isnoneornil(L, i)) if (lua_isnumber(L, i))
continue; amount = CHECKVAL<uint32>(L, i, amount);
amount = CHECKVAL<uint32>(L, i, amount);
} }
ENDCALL(); ENDCALL();
} }
@@ -752,9 +752,8 @@ void Eluna::OnReputationChange(Player* pPlayer, uint32 factionID, int32& standin
EVENT_EXECUTE(1); EVENT_EXECUTE(1);
FOR_RETS(i) FOR_RETS(i)
{ {
if (lua_isnoneornil(L, i)) if (lua_isnumber(L, i))
continue; standing = CHECKVAL<uint32>(L, i, standing);
standing = CHECKVAL<uint32>(L, i, standing);
} }
ENDCALL(); ENDCALL();
} }
@@ -901,9 +900,10 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg)
{ {
if (lua_isnoneornil(L, i)) if (lua_isnoneornil(L, i))
continue; continue;
if (const char* c_str = CHECKVAL<const char*>(L, i, NULL)) if (lua_isstring(L, i))
msg = std::string(c_str); if (const char* c_str = CHECKVAL<const char*>(L, i, NULL))
else if (!CHECKVAL<bool>(L, i, true)) msg = std::string(c_str);
else if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{ {
result = false; result = false;
break; break;
@@ -929,9 +929,10 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg,
{ {
if (lua_isnoneornil(L, i)) if (lua_isnoneornil(L, i))
continue; continue;
if (const char* c_str = CHECKVAL<const char*>(L, i, NULL)) if (lua_isstring(L, i))
msg = std::string(c_str); if (const char* c_str = CHECKVAL<const char*>(L, i, NULL))
else if (!CHECKVAL<bool>(L, i, true)) msg = std::string(c_str);
else if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{ {
result = false; result = false;
break; break;
@@ -957,9 +958,10 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg,
{ {
if (lua_isnoneornil(L, i)) if (lua_isnoneornil(L, i))
continue; continue;
if (const char* c_str = CHECKVAL<const char*>(L, i, NULL)) if (lua_isstring(L, i))
msg = std::string(c_str); if (const char* c_str = CHECKVAL<const char*>(L, i, NULL))
else if (!CHECKVAL<bool>(L, i, true)) msg = std::string(c_str);
else if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{ {
result = false; result = false;
break; break;
@@ -985,9 +987,10 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg,
{ {
if (lua_isnoneornil(L, i)) if (lua_isnoneornil(L, i))
continue; continue;
if (const char* c_str = CHECKVAL<const char*>(L, i, NULL)) if (lua_isstring(L, i))
msg = std::string(c_str); if (const char* c_str = CHECKVAL<const char*>(L, i, NULL))
else if (!CHECKVAL<bool>(L, i, true)) msg = std::string(c_str);
else if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{ {
result = false; result = false;
break; break;
@@ -1013,9 +1016,10 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg,
{ {
if (lua_isnoneornil(L, i)) if (lua_isnoneornil(L, i))
continue; continue;
if (const char* c_str = CHECKVAL<const char*>(L, i, NULL)) if (lua_isstring(L, i))
msg = std::string(c_str); if (const char* c_str = CHECKVAL<const char*>(L, i, NULL))
else if (!CHECKVAL<bool>(L, i, true)) msg = std::string(c_str);
else if (lua_isboolean(L, i) && !CHECKVAL<bool>(L, i, true))
{ {
result = false; result = false;
break; break;
@@ -1479,9 +1483,8 @@ struct ElunaCreatureAI : ScriptedAI
ENTRY_EXECUTE(1); ENTRY_EXECUTE(1);
FOR_RETS(i) FOR_RETS(i)
{ {
if (lua_isnoneornil(L, i)) if (lua_isnumber(L, i))
continue; damage = Eluna::CHECKVAL<uint32>(L, i, damage);
damage = Eluna::CHECKVAL<uint32>(L, i, damage);
} }
ENDCALL(); ENDCALL();
} }
@@ -1619,9 +1622,8 @@ struct ElunaCreatureAI : ScriptedAI
ENTRY_EXECUTE(1); ENTRY_EXECUTE(1);
FOR_RETS(i) FOR_RETS(i)
{ {
if (lua_isnoneornil(L, i)) if (lua_isnumber(L, i))
continue; respawnDelay = Eluna::CHECKVAL<uint32>(L, i, respawnDelay);
respawnDelay = Eluna::CHECKVAL<uint32>(L, i, respawnDelay);
} }
ENDCALL(); ENDCALL();
} }

View File

@@ -102,7 +102,7 @@ void RegisterGlobals(lua_State* L)
lua_register(L, "VendorRemoveItem", &LuaGlobalFunctions::VendorRemoveItem); // VendorRemoveItem(entry, item) - Removes an item from vendor entry lua_register(L, "VendorRemoveItem", &LuaGlobalFunctions::VendorRemoveItem); // VendorRemoveItem(entry, item) - Removes an item from vendor entry
lua_register(L, "VendorRemoveAllItems", &LuaGlobalFunctions::VendorRemoveAllItems); // VendorRemoveAllItems(entry) - Removes all items from vendor entry lua_register(L, "VendorRemoveAllItems", &LuaGlobalFunctions::VendorRemoveAllItems); // VendorRemoveAllItems(entry) - Removes all items from vendor entry
lua_register(L, "Kick", &LuaGlobalFunctions::Kick); // Kick(player) - Kicks given player lua_register(L, "Kick", &LuaGlobalFunctions::Kick); // Kick(player) - Kicks given player
lua_register(L, "Ban", &LuaGlobalFunctions::Ban); // Ban(banMode(integer), nameOrIP(string), duration(string), reason(string), whoBanned(string)) - Banmode: 0 account, 1 character, 2 IP lua_register(L, "Ban", &LuaGlobalFunctions::Ban); // Ban(banMode(integer), nameOrIP(string), duration(string), [reason(string), whoBanned(string)]) - Banmode: 0 account, 1 character, 2 IP
lua_register(L, "SaveAllPlayers", &LuaGlobalFunctions::SaveAllPlayers); // SaveAllPlayers() - Saves all players lua_register(L, "SaveAllPlayers", &LuaGlobalFunctions::SaveAllPlayers); // SaveAllPlayers() - Saves all players
lua_register(L, "SendMail", &LuaGlobalFunctions::SendMail); // SendMail(subject, text, receiverLowGUID[, senderLowGUID, stationary, delay, itemEntry, itemAmount, itemEntry2, itemAmount2...]) - Sends a mail to player with lowguid. use nil to use default values on optional arguments. UNDOCUMENTED lua_register(L, "SendMail", &LuaGlobalFunctions::SendMail); // SendMail(subject, text, receiverLowGUID[, senderLowGUID, stationary, delay, itemEntry, itemAmount, itemEntry2, itemAmount2...]) - Sends a mail to player with lowguid. use nil to use default values on optional arguments. UNDOCUMENTED
lua_register(L, "AddTaxiPath", &LuaGlobalFunctions::AddTaxiPath); // AddTaxiPath(pathTable, mountA, mountH[, price, pathId]) - Adds a new taxi path. Returns the path's ID. Will replace an existing path if pathId provided and already used. mountIDs are NPC entries. path table structure: T = {{map, x, y, z[, actionFlag, delay, arrivalEvId, departEvId]}, {...}, ...} lua_register(L, "AddTaxiPath", &LuaGlobalFunctions::AddTaxiPath); // AddTaxiPath(pathTable, mountA, mountH[, price, pathId]) - Adds a new taxi path. Returns the path's ID. Will replace an existing path if pathId provided and already used. mountIDs are NPC entries. path table structure: T = {{map, x, y, z[, actionFlag, delay, arrivalEvId, departEvId]}, {...}, ...}
@@ -381,6 +381,7 @@ ElunaRegister<Unit> UnitMethods[] =
{ "MoveClear", &LuaUnit::MoveClear }, // :MoveClear([reset]) { "MoveClear", &LuaUnit::MoveClear }, // :MoveClear([reset])
{ "DealDamage", &LuaUnit::DealDamage }, // :DealDamage(target, amount[, durabilityloss]) - Deals damage to target, durabilityloss is true by default { "DealDamage", &LuaUnit::DealDamage }, // :DealDamage(target, amount[, durabilityloss]) - Deals damage to target, durabilityloss is true by default
{ "DealHeal", &LuaUnit::DealHeal }, // :DealDamage(target, amount, spell[, critical]) - Heals target by given amount. This will be logged as being healed by spell as critical if true. { "DealHeal", &LuaUnit::DealHeal }, // :DealDamage(target, amount, spell[, critical]) - Heals target by given amount. This will be logged as being healed by spell as critical if true.
{ "AddThreat", &LuaUnit::AddThreat },
{ NULL, NULL }, { NULL, NULL },
}; };

View File

@@ -1361,18 +1361,17 @@ namespace LuaUnit
} }
/** /**
Casts the spell at target. * Casts the spell at target with modified basepoints or casters.
pb0, 1 and 2 are modifiers for the base points of the spell. *
* @param &Unit target
@param &Unit target * @param uint32 spell
@param uint32 spell * @param bool triggered = false
@param bool triggered = false * @param int32 bp0 = nil : modifier for the base points of the spell.
@param int32 bp0 = nil * @param int32 bp1 = nil : modifier for the base points of the spell.
@param int32 bp1 = nil * @param int32 bp2 = nil : modifier for the base points of the spell.
@param int32 bp2 = nil * @param &Item castItem = nil
@param &Item castItem = nil * @param uint64 originalCaster = 0
@param uint64 originalCaster = 0 */
*/
int CastCustomSpell(lua_State* L, Unit* unit) int CastCustomSpell(lua_State* L, Unit* unit)
{ {
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2); Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
@@ -1618,6 +1617,48 @@ namespace LuaUnit
return 0; return 0;
} }
/**
* Adds threat to the &Unit from the victim.
*
* <pre>
* enum SpellSchoolMask
* {
* SPELL_SCHOOL_MASK_NONE = 0,
* SPELL_SCHOOL_MASK_NORMAL = 1,
* SPELL_SCHOOL_MASK_HOLY = 2,
* SPELL_SCHOOL_MASK_FIRE = 4,
* SPELL_SCHOOL_MASK_NATURE = 8,
* SPELL_SCHOOL_MASK_FROST = 16,
* SPELL_SCHOOL_MASK_SHADOW = 32,
* SPELL_SCHOOL_MASK_ARCANE = 64,
* }
* </pre>
*
* @param &Unit victim : &Unit that caused the threat
* @param float threat : threat amount
* @param uint32 SpellSchoolMask = 0 : school mask of the threat causer
* @param uint32 spell = 0 : spell entry used for threat
*/
int AddThreat(lua_State* L, Unit* unit)
{
Unit* victim = Eluna::CHECKOBJ<Unit>(L, 2);
float threat = Eluna::CHECKVAL<float>(L, 3, true);
uint32 schoolMask = Eluna::CHECKVAL<uint32>(L, 3, 0);
uint32 spell = Eluna::CHECKVAL<uint32>(L, 3, 0);
if (schoolMask > SPELL_SCHOOL_MASK_ALL)
{
return luaL_argerror(L, 3, "valid SpellSchoolMask expected");
}
#ifdef TRINITY
unit->AddThreat(victim, threat, (SpellSchoolMask)schoolMask, spell ? sSpellMgr->GetSpellInfo(spell) : NULL);
#else
unit->AddThreat(victim, threat, false, (SpellSchoolMask)schoolMask, spell ? sSpellStore.LookupEntry(spell) : NULL);
#endif
return 0;
}
/*int RestoreDisplayId(lua_State* L, Unit* unit) /*int RestoreDisplayId(lua_State* L, Unit* unit)
{ {
unit->RestoreDisplayId(); unit->RestoreDisplayId();

View File

@@ -78,6 +78,14 @@ namespace LuaWorldObject
return 1; return 1;
} }
/**
* Returns the coordinates and orientation of the &WorldObject
*
* @return float x
* @return float y
* @return float z
* @return float o
*/
int GetLocation(lua_State* L, WorldObject* obj) int GetLocation(lua_State* L, WorldObject* obj)
{ {
Eluna::Push(L, obj->GetPositionX()); Eluna::Push(L, obj->GetPositionX());
@@ -386,6 +394,18 @@ namespace LuaWorldObject
return 1; return 1;
} }
/**
* Spawns the creature at specified location.
*
* @param uint32 entry : creature entry
* @param float x
* @param float y
* @param float z
* @param float o
* @param TempSummonType spawnType : defines how and when the creature despawns
* @param uint32 despawnTimer : despawn time in seconds
* @return &Creature
*/
int SpawnCreature(lua_State* L, WorldObject* obj) int SpawnCreature(lua_State* L, WorldObject* obj)
{ {
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2); uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);