Fix calling Eluna functions from coroutines.

Fixes #126.
This commit is contained in:
Patman64
2014-12-15 00:33:46 -05:00
parent 3f08b37fd0
commit 967a8045eb
21 changed files with 2548 additions and 2548 deletions

View File

@@ -24,9 +24,9 @@ namespace LuaAura
* *
* @return [Unit] caster * @return [Unit] caster
*/ */
int GetCaster(Eluna* E, Aura* aura) int GetCaster(Eluna* /*E*/, lua_State* L, Aura* aura)
{ {
Eluna::Push(E->L, aura->GetCaster()); Eluna::Push(L, aura->GetCaster());
return 1; return 1;
} }
@@ -35,12 +35,12 @@ namespace LuaAura
* *
* @return string caster_guid : the GUID of the Unit as a decimal string * @return string caster_guid : the GUID of the Unit as a decimal string
*/ */
int GetCasterGUID(Eluna* E, Aura* aura) int GetCasterGUID(Eluna* /*E*/, lua_State* L, Aura* aura)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, aura->GetCasterGuid()); Eluna::Push(L, aura->GetCasterGuid());
#else #else
Eluna::Push(E->L, aura->GetCasterGUID()); Eluna::Push(L, aura->GetCasterGUID());
#endif #endif
return 1; return 1;
} }
@@ -50,9 +50,9 @@ namespace LuaAura
* *
* @return uint32 caster_level * @return uint32 caster_level
*/ */
int GetCasterLevel(Eluna* E, Aura* aura) int GetCasterLevel(Eluna* /*E*/, lua_State* L, Aura* aura)
{ {
Eluna::Push(E->L, aura->GetCaster()->getLevel()); Eluna::Push(L, aura->GetCaster()->getLevel());
return 1; return 1;
} }
@@ -61,12 +61,12 @@ namespace LuaAura
* *
* @return int32 duration : amount of time left in milliseconds * @return int32 duration : amount of time left in milliseconds
*/ */
int GetDuration(Eluna* E, Aura* aura) int GetDuration(Eluna* /*E*/, lua_State* L, Aura* aura)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, aura->GetAuraDuration()); Eluna::Push(L, aura->GetAuraDuration());
#else #else
Eluna::Push(E->L, aura->GetDuration()); Eluna::Push(L, aura->GetDuration());
#endif #endif
return 1; return 1;
} }
@@ -76,9 +76,9 @@ namespace LuaAura
* *
* @return uint32 aura_id * @return uint32 aura_id
*/ */
int GetAuraId(Eluna* E, Aura* aura) int GetAuraId(Eluna* /*E*/, lua_State* L, Aura* aura)
{ {
Eluna::Push(E->L, aura->GetId()); Eluna::Push(L, aura->GetId());
return 1; return 1;
} }
@@ -90,12 +90,12 @@ namespace LuaAura
* *
* @return int32 max_duration : the maximum duration of the Aura, in milliseconds * @return int32 max_duration : the maximum duration of the Aura, in milliseconds
*/ */
int GetMaxDuration(Eluna* E, Aura* aura) int GetMaxDuration(Eluna* /*E*/, lua_State* L, Aura* aura)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, aura->GetAuraMaxDuration()); Eluna::Push(L, aura->GetAuraMaxDuration());
#else #else
Eluna::Push(E->L, aura->GetMaxDuration()); Eluna::Push(L, aura->GetMaxDuration());
#endif #endif
return 1; return 1;
} }
@@ -107,9 +107,9 @@ namespace LuaAura
* *
* @return uint32 stack_amount * @return uint32 stack_amount
*/ */
int GetStackAmount(Eluna* E, Aura* aura) int GetStackAmount(Eluna* /*E*/, lua_State* L, Aura* aura)
{ {
Eluna::Push(E->L, aura->GetStackAmount()); Eluna::Push(L, aura->GetStackAmount());
return 1; return 1;
} }
@@ -118,12 +118,12 @@ namespace LuaAura
* *
* @return [Unit] owner * @return [Unit] owner
*/ */
int GetOwner(Eluna* E, Aura* aura) int GetOwner(Eluna* /*E*/, lua_State* L, Aura* aura)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, aura->GetTarget()); Eluna::Push(L, aura->GetTarget());
#else #else
Eluna::Push(E->L, aura->GetOwner()); Eluna::Push(L, aura->GetOwner());
#endif #endif
return 1; return 1;
} }
@@ -133,9 +133,9 @@ namespace LuaAura
* *
* @param int32 duration : the new duration of the Aura, in milliseconds * @param int32 duration : the new duration of the Aura, in milliseconds
*/ */
int SetDuration(Eluna* E, Aura* aura) int SetDuration(Eluna* /*E*/, lua_State* L, Aura* aura)
{ {
int32 duration = Eluna::CHECKVAL<int32>(E->L, 2); int32 duration = Eluna::CHECKVAL<int32>(L, 2);
#ifndef TRINITY #ifndef TRINITY
aura->GetHolder()->SetAuraDuration(duration); aura->GetHolder()->SetAuraDuration(duration);
#if (defined(TBC) || defined(CLASSIC)) #if (defined(TBC) || defined(CLASSIC))
@@ -157,9 +157,9 @@ namespace LuaAura
* *
* @param int32 duration : the new maximum duration of the Aura, in milliseconds * @param int32 duration : the new maximum duration of the Aura, in milliseconds
*/ */
int SetMaxDuration(Eluna* E, Aura* aura) int SetMaxDuration(Eluna* /*E*/, lua_State* L, Aura* aura)
{ {
int32 duration = Eluna::CHECKVAL<int32>(E->L, 2); int32 duration = Eluna::CHECKVAL<int32>(L, 2);
#ifndef TRINITY #ifndef TRINITY
aura->GetHolder()->SetAuraMaxDuration(duration); aura->GetHolder()->SetAuraMaxDuration(duration);
#if (defined(TBC) || defined(CLASSIC)) #if (defined(TBC) || defined(CLASSIC))
@@ -181,9 +181,9 @@ namespace LuaAura
* *
* @param uint32 amount * @param uint32 amount
*/ */
int SetStackAmount(Eluna* E, Aura* aura) int SetStackAmount(Eluna* /*E*/, lua_State* L, Aura* aura)
{ {
uint8 amount = Eluna::CHECKVAL<uint8>(E->L, 2); uint8 amount = Eluna::CHECKVAL<uint8>(L, 2);
#ifndef TRINITY #ifndef TRINITY
aura->GetHolder()->SetStackAmount(amount); aura->GetHolder()->SetStackAmount(amount);
#else #else
@@ -195,14 +195,14 @@ namespace LuaAura
/** /**
* Remove this [Aura] from the [Unit] it is applied to. * Remove this [Aura] from the [Unit] it is applied to.
*/ */
int Remove(Eluna* E, Aura* aura) int Remove(Eluna* /*E*/, lua_State* L, Aura* aura)
{ {
#ifndef TRINITY #ifndef TRINITY
aura->GetTarget()->RemoveSpellAuraHolder(aura->GetHolder(), AURA_REMOVE_BY_CANCEL); aura->GetTarget()->RemoveSpellAuraHolder(aura->GetHolder(), AURA_REMOVE_BY_CANCEL);
#else #else
aura->Remove(); aura->Remove();
#endif #endif
Eluna::CHECKOBJ<ElunaObject>(E->L, 1)->Invalidate(); Eluna::CHECKOBJ<ElunaObject>(L, 1)->Invalidate();
return 0; return 0;
} }
}; };

View File

@@ -14,9 +14,9 @@ namespace LuaBattleGround
* *
* @return string name * @return string name
*/ */
int GetName(Eluna* E, BattleGround* bg) int GetName(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
Eluna::Push(E->L, bg->GetName()); Eluna::Push(L, bg->GetName());
return 1; return 1;
} }
@@ -26,11 +26,11 @@ namespace LuaBattleGround
* @param uint32 team : team ID * @param uint32 team : team ID
* @return uint32 count * @return uint32 count
*/ */
int GetAlivePlayersCountByTeam(Eluna* E, BattleGround* bg) int GetAlivePlayersCountByTeam(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
uint32 team = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(E->L, bg->GetAlivePlayersCountByTeam((Team)team)); Eluna::Push(L, bg->GetAlivePlayersCountByTeam((Team)team));
return 1; return 1;
} }
@@ -39,9 +39,9 @@ namespace LuaBattleGround
* *
* @return [Map] map * @return [Map] map
*/ */
int GetMap(Eluna* E, BattleGround* bg) int GetMap(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
Eluna::Push(E->L, bg->GetBgMap()); Eluna::Push(L, bg->GetBgMap());
return 1; return 1;
} }
@@ -51,11 +51,11 @@ namespace LuaBattleGround
* @param uint32 kills : amount of kills * @param uint32 kills : amount of kills
* @return uint32 bonusHonor * @return uint32 bonusHonor
*/ */
int GetBonusHonorFromKillCount(Eluna* E, BattleGround* bg) int GetBonusHonorFromKillCount(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
uint32 kills = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 kills = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(E->L, bg->GetBonusHonorFromKill(kills)); Eluna::Push(L, bg->GetBonusHonorFromKill(kills));
return 1; return 1;
} }
@@ -64,9 +64,9 @@ namespace LuaBattleGround
* *
* @return BattleGroundBracketId bracketId * @return BattleGroundBracketId bracketId
*/ */
int GetBracketId(Eluna* E, BattleGround* bg) int GetBracketId(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
Eluna::Push(E->L, bg->GetBracketId()); Eluna::Push(L, bg->GetBracketId());
return 1; return 1;
} }
@@ -75,12 +75,12 @@ namespace LuaBattleGround
* *
* @return uint32 endTime * @return uint32 endTime
*/ */
int GetEndTime(Eluna* E, BattleGround* bg) int GetEndTime(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
#ifdef CATA #ifdef CATA
Eluna::Push(E->L, bg->GetRemainingTime()); Eluna::Push(L, bg->GetRemainingTime());
#else #else
Eluna::Push(E->L, bg->GetEndTime()); Eluna::Push(L, bg->GetEndTime());
#endif #endif
return 1; return 1;
} }
@@ -91,11 +91,11 @@ namespace LuaBattleGround
* @param uint32 team : team ID * @param uint32 team : team ID
* @return uint32 freeSlots * @return uint32 freeSlots
*/ */
int GetFreeSlotsForTeam(Eluna* E, BattleGround* bg) int GetFreeSlotsForTeam(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
uint32 team = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(E->L, bg->GetFreeSlotsForTeam((Team)team)); Eluna::Push(L, bg->GetFreeSlotsForTeam((Team)team));
return 1; return 1;
} }
@@ -104,9 +104,9 @@ namespace LuaBattleGround
* *
* @return uint32 instanceId * @return uint32 instanceId
*/ */
int GetInstanceId(Eluna* E, BattleGround* bg) int GetInstanceId(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
Eluna::Push(E->L, bg->GetInstanceID()); Eluna::Push(L, bg->GetInstanceID());
return 1; return 1;
} }
@@ -115,9 +115,9 @@ namespace LuaBattleGround
* *
* @return uint32 mapId * @return uint32 mapId
*/ */
int GetMapId(Eluna* E, BattleGround* bg) int GetMapId(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
Eluna::Push(E->L, bg->GetMapId()); Eluna::Push(L, bg->GetMapId());
return 1; return 1;
} }
@@ -126,9 +126,9 @@ namespace LuaBattleGround
* *
* @return BattleGroundTypeId typeId * @return BattleGroundTypeId typeId
*/ */
int GetTypeId(Eluna* E, BattleGround* bg) int GetTypeId(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
Eluna::Push(E->L, bg->GetTypeID()); Eluna::Push(L, bg->GetTypeID());
return 1; return 1;
} }
@@ -137,9 +137,9 @@ namespace LuaBattleGround
* *
* @return uint32 maxLevel * @return uint32 maxLevel
*/ */
int GetMaxLevel(Eluna* E, BattleGround* bg) int GetMaxLevel(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
Eluna::Push(E->L, bg->GetMaxLevel()); Eluna::Push(L, bg->GetMaxLevel());
return 1; return 1;
} }
@@ -148,9 +148,9 @@ namespace LuaBattleGround
* *
* @return uint32 minLevel * @return uint32 minLevel
*/ */
int GetMinLevel(Eluna* E, BattleGround* bg) int GetMinLevel(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
Eluna::Push(E->L, bg->GetMinLevel()); Eluna::Push(L, bg->GetMinLevel());
return 1; return 1;
} }
@@ -159,9 +159,9 @@ namespace LuaBattleGround
* *
* @return uint32 maxPlayerCount * @return uint32 maxPlayerCount
*/ */
int GetMaxPlayers(Eluna* E, BattleGround* bg) int GetMaxPlayers(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
Eluna::Push(E->L, bg->GetMaxPlayers()); Eluna::Push(L, bg->GetMaxPlayers());
return 1; return 1;
} }
@@ -170,9 +170,9 @@ namespace LuaBattleGround
* *
* @return uint32 minPlayerCount * @return uint32 minPlayerCount
*/ */
int GetMinPlayers(Eluna* E, BattleGround* bg) int GetMinPlayers(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
Eluna::Push(E->L, bg->GetMinPlayers()); Eluna::Push(L, bg->GetMinPlayers());
return 1; return 1;
} }
@@ -181,9 +181,9 @@ namespace LuaBattleGround
* *
* @return uint32 maxTeamPlayerCount * @return uint32 maxTeamPlayerCount
*/ */
int GetMaxPlayersPerTeam(Eluna* E, BattleGround* bg) int GetMaxPlayersPerTeam(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
Eluna::Push(E->L, bg->GetMaxPlayersPerTeam()); Eluna::Push(L, bg->GetMaxPlayersPerTeam());
return 1; return 1;
} }
@@ -192,9 +192,9 @@ namespace LuaBattleGround
* *
* @return uint32 minTeamPlayerCount * @return uint32 minTeamPlayerCount
*/ */
int GetMinPlayersPerTeam(Eluna* E, BattleGround* bg) int GetMinPlayersPerTeam(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
Eluna::Push(E->L, bg->GetMinPlayersPerTeam()); Eluna::Push(L, bg->GetMinPlayersPerTeam());
return 1; return 1;
} }
@@ -203,9 +203,9 @@ namespace LuaBattleGround
* *
* @return Team team * @return Team team
*/ */
int GetWinner(Eluna* E, BattleGround* bg) int GetWinner(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
Eluna::Push(E->L, bg->GetWinner()); Eluna::Push(L, bg->GetWinner());
return 1; return 1;
} }
@@ -214,9 +214,9 @@ namespace LuaBattleGround
* *
* @return BattleGroundStatus status * @return BattleGroundStatus status
*/ */
int GetStatus(Eluna* E, BattleGround* bg) int GetStatus(Eluna* /*E*/, lua_State* L, BattleGround* bg)
{ {
Eluna::Push(E->L, bg->GetStatus()); Eluna::Push(L, bg->GetStatus());
return 1; return 1;
} }
}; };

View File

@@ -14,12 +14,12 @@ namespace LuaCorpse
* *
* @return uint64 ownerGUID * @return uint64 ownerGUID
*/ */
int GetOwnerGUID(Eluna* E, Corpse* corpse) int GetOwnerGUID(Eluna* /*E*/, lua_State* L, Corpse* corpse)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, corpse->GetOwnerGuid()); Eluna::Push(L, corpse->GetOwnerGuid());
#else #else
Eluna::Push(E->L, corpse->GetOwnerGUID()); Eluna::Push(L, corpse->GetOwnerGUID());
#endif #endif
return 1; return 1;
} }
@@ -29,9 +29,9 @@ namespace LuaCorpse
* *
* @return uint32 ghostTime * @return uint32 ghostTime
*/ */
int GetGhostTime(Eluna* E, Corpse* corpse) int GetGhostTime(Eluna* /*E*/, lua_State* L, Corpse* corpse)
{ {
Eluna::Push(E->L, uint32(corpse->GetGhostTime())); Eluna::Push(L, uint32(corpse->GetGhostTime()));
return 1; return 1;
} }
@@ -49,9 +49,9 @@ namespace LuaCorpse
* *
* @return [CorpseType] corpseType * @return [CorpseType] corpseType
*/ */
int GetType(Eluna* E, Corpse* corpse) int GetType(Eluna* /*E*/, lua_State* L, Corpse* corpse)
{ {
Eluna::Push(E->L, corpse->GetType()); Eluna::Push(L, corpse->GetType());
return 1; return 1;
} }
@@ -59,7 +59,7 @@ namespace LuaCorpse
* Resets the [Corpse] ghost time. * Resets the [Corpse] ghost time.
* *
*/ */
int ResetGhostTime(Eluna* /*E*/, Corpse* corpse) int ResetGhostTime(Eluna* /*E*/, lua_State* L, Corpse* corpse)
{ {
corpse->ResetGhostTime(); corpse->ResetGhostTime();
return 0; return 0;
@@ -69,7 +69,7 @@ namespace LuaCorpse
* Saves the [Corpse] to the database. * Saves the [Corpse] to the database.
* *
*/ */
int SaveToDB(Eluna* /*E*/, Corpse* corpse) int SaveToDB(Eluna* /*E*/, lua_State* L, Corpse* corpse)
{ {
corpse->SaveToDB(); corpse->SaveToDB();
return 0; return 0;
@@ -79,7 +79,7 @@ namespace LuaCorpse
* Deletes the [Corpse] from the world. * Deletes the [Corpse] from the world.
* *
*/ */
int DeleteBonesFromWorld(Eluna* /*E*/, Corpse* corpse) int DeleteBonesFromWorld(Eluna* /*E*/, lua_State* L, Corpse* corpse)
{ {
corpse->DeleteBonesFromWorld(); corpse->DeleteBonesFromWorld();
return 0; return 0;

View File

@@ -22,9 +22,9 @@ namespace LuaCreature
* *
* @return bool reputationDisabled * @return bool reputationDisabled
*/ */
int IsReputationGainDisabled(Eluna* E, Creature* creature) int IsReputationGainDisabled(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->IsReputationGainDisabled()); Eluna::Push(L, creature->IsReputationGainDisabled());
return 1; return 1;
} }
@@ -34,12 +34,12 @@ namespace LuaCreature
* *
* @return bool regeneratesHealth * @return bool regeneratesHealth
*/ */
int CanRegenerateHealth(Eluna* E, Creature* creature) int CanRegenerateHealth(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, creature->IsRegeneratingHealth()); Eluna::Push(L, creature->IsRegeneratingHealth());
#else #else
Eluna::Push(E->L, creature->isRegeneratingHealth()); Eluna::Push(L, creature->isRegeneratingHealth());
#endif #endif
return 1; return 1;
} }
@@ -51,14 +51,14 @@ namespace LuaCreature
* @param uint32 questID : the ID of a [Quest] * @param uint32 questID : the ID of a [Quest]
* @return bool completesQuest * @return bool completesQuest
*/ */
int CanCompleteQuest(Eluna* E, Creature* creature) int CanCompleteQuest(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
uint32 quest_id = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 quest_id = Eluna::CHECKVAL<uint32>(L, 2);
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, creature->HasInvolvedQuest(quest_id)); Eluna::Push(L, creature->HasInvolvedQuest(quest_id));
#else #else
Eluna::Push(E->L, creature->hasInvolvedQuest(quest_id)); Eluna::Push(L, creature->hasInvolvedQuest(quest_id));
#endif #endif
return 1; return 1;
} }
@@ -70,14 +70,14 @@ namespace LuaCreature
* @param bool mustBeDead = false : if `true`, only returns `true` if the [Creature] is also dead. Otherwise, it must be alive. * @param bool mustBeDead = false : if `true`, only returns `true` if the [Creature] is also dead. Otherwise, it must be alive.
* @return bool targetable * @return bool targetable
*/ */
int IsTargetableForAttack(Eluna* E, Creature* creature) int IsTargetableForAttack(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
bool mustBeDead = Eluna::CHECKVAL<bool>(E->L, 2, false); bool mustBeDead = Eluna::CHECKVAL<bool>(L, 2, false);
#ifdef MANGOS #ifdef MANGOS
Eluna::Push(E->L, creature->IsTargetableForAttack(mustBeDead)); Eluna::Push(L, creature->IsTargetableForAttack(mustBeDead));
#else #else
Eluna::Push(E->L, creature->isTargetableForAttack(mustBeDead)); Eluna::Push(L, creature->isTargetableForAttack(mustBeDead));
#endif #endif
return 1; return 1;
} }
@@ -91,13 +91,13 @@ namespace LuaCreature
* @param bool checkFaction = true : if `true`, the [Creature] must be the same faction as `friend` to assist * @param bool checkFaction = true : if `true`, the [Creature] must be the same faction as `friend` to assist
* @return bool canAssist * @return bool canAssist
*/ */
int CanAssistTo(Eluna* E, Creature* creature) int CanAssistTo(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Unit* u = Eluna::CHECKOBJ<Unit>(E->L, 2); Unit* u = Eluna::CHECKOBJ<Unit>(L, 2);
Unit* enemy = Eluna::CHECKOBJ<Unit>(E->L, 3); Unit* enemy = Eluna::CHECKOBJ<Unit>(L, 3);
bool checkfaction = Eluna::CHECKVAL<bool>(E->L, 4, true); bool checkfaction = Eluna::CHECKVAL<bool>(L, 4, true);
Eluna::Push(E->L, creature->CanAssistTo(u, enemy, checkfaction)); Eluna::Push(L, creature->CanAssistTo(u, enemy, checkfaction));
return 1; return 1;
} }
@@ -107,9 +107,9 @@ namespace LuaCreature
* *
* @return bool searchedForAssistance * @return bool searchedForAssistance
*/ */
int HasSearchedAssistance(Eluna* E, Creature* creature) int HasSearchedAssistance(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->HasSearchedAssistance()); Eluna::Push(L, creature->HasSearchedAssistance());
return 1; return 1;
} }
@@ -119,14 +119,14 @@ namespace LuaCreature
* *
* @return bool tapped * @return bool tapped
*/ */
int IsTappedBy(Eluna* E, Creature* creature) int IsTappedBy(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
#ifdef MANGOS #ifdef MANGOS
Eluna::Push(E->L, creature->IsTappedBy(player)); Eluna::Push(L, creature->IsTappedBy(player));
#else #else
Eluna::Push(E->L, creature->isTappedBy(player)); Eluna::Push(L, creature->isTappedBy(player));
#endif #endif
return 1; return 1;
} }
@@ -137,12 +137,12 @@ namespace LuaCreature
* *
* @return bool hasLootRecipient * @return bool hasLootRecipient
*/ */
int HasLootRecipient(Eluna* E, Creature* creature) int HasLootRecipient(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, creature->HasLootRecipient()); Eluna::Push(L, creature->HasLootRecipient());
#else #else
Eluna::Push(E->L, creature->hasLootRecipient()); Eluna::Push(L, creature->hasLootRecipient());
#endif #endif
return 1; return 1;
} }
@@ -153,13 +153,13 @@ namespace LuaCreature
* *
* @return bool canAggro * @return bool canAggro
*/ */
int CanAggro(Eluna* E, Creature* creature) int CanAggro(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
#ifdef TRINITY #ifdef TRINITY
Eluna::Push(E->L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)); Eluna::Push(L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC));
#else #else
// Eluna::Push(E->L, creature->CanInitiateAttack()); // Eluna::Push(L, creature->CanInitiateAttack());
Eluna::Push(E->L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)); Eluna::Push(L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE));
#endif #endif
return 1; return 1;
} }
@@ -170,9 +170,9 @@ namespace LuaCreature
* *
* @return bool canSwim * @return bool canSwim
*/ */
int CanSwim(Eluna* E, Creature* creature) int CanSwim(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->CanSwim()); Eluna::Push(L, creature->CanSwim());
return 1; return 1;
} }
@@ -182,9 +182,9 @@ namespace LuaCreature
* *
* @return bool canWalk * @return bool canWalk
*/ */
int CanWalk(Eluna* E, Creature* creature) int CanWalk(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->CanWalk()); Eluna::Push(L, creature->CanWalk());
return 1; return 1;
} }
@@ -194,9 +194,9 @@ namespace LuaCreature
* *
* @return bool inEvadeMode * @return bool inEvadeMode
*/ */
int IsInEvadeMode(Eluna* E, Creature* creature) int IsInEvadeMode(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->IsInEvadeMode()); Eluna::Push(L, creature->IsInEvadeMode());
return 1; return 1;
} }
@@ -206,12 +206,12 @@ namespace LuaCreature
* *
* @return bool isElite * @return bool isElite
*/ */
int IsElite(Eluna* E, Creature* creature) int IsElite(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, creature->IsElite()); Eluna::Push(L, creature->IsElite());
#else #else
Eluna::Push(E->L, creature->isElite()); Eluna::Push(L, creature->isElite());
#endif #endif
return 1; return 1;
} }
@@ -222,9 +222,9 @@ namespace LuaCreature
* *
* @return bool isGuard * @return bool isGuard
*/ */
int IsGuard(Eluna* E, Creature* creature) int IsGuard(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->IsGuard()); Eluna::Push(L, creature->IsGuard());
return 1; return 1;
} }
@@ -234,9 +234,9 @@ namespace LuaCreature
* *
* @return bool isCivilian * @return bool isCivilian
*/ */
int IsCivilian(Eluna* E, Creature* creature) int IsCivilian(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->IsCivilian()); Eluna::Push(L, creature->IsCivilian());
return 1; return 1;
} }
@@ -246,9 +246,9 @@ namespace LuaCreature
* *
* @return bool isLeader * @return bool isLeader
*/ */
int IsRacialLeader(Eluna* E, Creature* creature) int IsRacialLeader(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->IsRacialLeader()); Eluna::Push(L, creature->IsRacialLeader());
return 1; return 1;
} }
@@ -258,12 +258,12 @@ namespace LuaCreature
* *
* @return bool isWorldBoss * @return bool isWorldBoss
*/ */
int IsWorldBoss(Eluna* E, Creature* creature) int IsWorldBoss(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, creature->IsWorldBoss()); Eluna::Push(L, creature->IsWorldBoss());
#else #else
Eluna::Push(E->L, creature->isWorldBoss()); Eluna::Push(L, creature->isWorldBoss());
#endif #endif
return 1; return 1;
} }
@@ -275,11 +275,11 @@ namespace LuaCreature
* @param uint32 spellId : the ID of a [Spell] * @param uint32 spellId : the ID of a [Spell]
* @return bool hasCooldown * @return bool hasCooldown
*/ */
int HasCategoryCooldown(Eluna* E, Creature* creature) int HasCategoryCooldown(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
uint32 spell = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(E->L, creature->HasCategoryCooldown(spell)); Eluna::Push(L, creature->HasCategoryCooldown(spell));
return 1; return 1;
} }
@@ -290,11 +290,11 @@ namespace LuaCreature
* @param uint32 spellId : the ID of a [Spell] * @param uint32 spellId : the ID of a [Spell]
* @return bool hasSpell * @return bool hasSpell
*/ */
int HasSpell(Eluna* E, Creature* creature) int HasSpell(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
uint32 id = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 id = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(E->L, creature->HasSpell(id)); Eluna::Push(L, creature->HasSpell(id));
return 1; return 1;
} }
@@ -305,14 +305,14 @@ namespace LuaCreature
* @param uint32 questId : the ID of a [Quest] * @param uint32 questId : the ID of a [Quest]
* @return bool hasQuest * @return bool hasQuest
*/ */
int HasQuest(Eluna* E, Creature* creature) int HasQuest(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
uint32 questId = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, creature->HasQuest(questId)); Eluna::Push(L, creature->HasQuest(questId));
#else #else
Eluna::Push(E->L, creature->hasQuest(questId)); Eluna::Push(L, creature->hasQuest(questId));
#endif #endif
return 1; return 1;
} }
@@ -324,11 +324,11 @@ namespace LuaCreature
* @param uint32 spellId : the ID of a [Spell] * @param uint32 spellId : the ID of a [Spell]
* @return bool hasCooldown * @return bool hasCooldown
*/ */
int HasSpellCooldown(Eluna* E, Creature* creature) int HasSpellCooldown(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
uint32 spellId = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(E->L, creature->HasSpellCooldown(spellId)); Eluna::Push(L, creature->HasSpellCooldown(spellId));
return 1; return 1;
} }
@@ -338,9 +338,9 @@ namespace LuaCreature
* *
* @return bool canFly * @return bool canFly
*/ */
int CanFly(Eluna* E, Creature* creature) int CanFly(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->CanFly()); Eluna::Push(L, creature->CanFly());
return 1; return 1;
} }
@@ -351,32 +351,32 @@ namespace LuaCreature
* *
* @return bool canFly * @return bool canFly
*/ */
int IsTrigger(Eluna* E, Creature* creature) int IsTrigger(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->IsTrigger()); Eluna::Push(L, creature->IsTrigger());
return 1; return 1;
} }
int IsDamageEnoughForLootingAndReward(Eluna* E, Creature* creature) int IsDamageEnoughForLootingAndReward(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->IsDamageEnoughForLootingAndReward()); Eluna::Push(L, creature->IsDamageEnoughForLootingAndReward());
return 1; return 1;
} }
int CanStartAttack(Eluna* E, Creature* creature) // TODO: Implement core side int CanStartAttack(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement core side
{ {
Unit* target = Eluna::CHECKOBJ<Unit>(E->L, 2); Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
bool force = Eluna::CHECKVAL<bool>(E->L, 3, true); bool force = Eluna::CHECKVAL<bool>(L, 3, true);
Eluna::Push(E->L, creature->CanStartAttack(target, force)); Eluna::Push(L, creature->CanStartAttack(target, force));
return 1; return 1;
} }
int HasLootMode(Eluna* E, Creature* creature) // TODO: Implement LootMode features int HasLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
{ {
uint16 lootMode = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
Eluna::Push(E->L, creature->HasLootMode(lootMode)); Eluna::Push(L, creature->HasLootMode(lootMode));
return 1; return 1;
} }
#endif #endif
@@ -391,9 +391,9 @@ namespace LuaCreature
* *
* @return uint32 respawnDelay : the respawn delay, in seconds * @return uint32 respawnDelay : the respawn delay, in seconds
*/ */
int GetRespawnDelay(Eluna* E, Creature* creature) int GetRespawnDelay(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->GetRespawnDelay()); Eluna::Push(L, creature->GetRespawnDelay());
return 1; return 1;
} }
@@ -403,9 +403,9 @@ namespace LuaCreature
* *
* @return float wanderRadius * @return float wanderRadius
*/ */
int GetWanderRadius(Eluna* E, Creature* creature) int GetWanderRadius(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->GetRespawnRadius()); Eluna::Push(L, creature->GetRespawnRadius());
return 1; return 1;
} }
@@ -415,9 +415,9 @@ namespace LuaCreature
* *
* @return uint32 pathId * @return uint32 pathId
*/ */
int GetWaypointPath(Eluna* E, Creature* creature) int GetWaypointPath(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->GetWaypointPath()); Eluna::Push(L, creature->GetWaypointPath());
return 1; return 1;
} }
#endif #endif
@@ -427,12 +427,12 @@ namespace LuaCreature
* *
* @return uint32 wpId * @return uint32 wpId
*/ */
int GetCurrentWaypointId(Eluna* E, Creature* creature) int GetCurrentWaypointId(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
#ifdef TRINITY #ifdef TRINITY
Eluna::Push(E->L, creature->GetCurrentWaypointID()); Eluna::Push(L, creature->GetCurrentWaypointID());
#else #else
Eluna::Push(E->L, creature->GetMotionMaster()->getLastReachedWaypoint()); Eluna::Push(L, creature->GetMotionMaster()->getLastReachedWaypoint());
#endif #endif
return 1; return 1;
} }
@@ -442,9 +442,9 @@ namespace LuaCreature
* *
* @return MovementGeneratorType defaultMovementType * @return MovementGeneratorType defaultMovementType
*/ */
int GetDefaultMovementType(Eluna* E, Creature* creature) int GetDefaultMovementType(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->GetDefaultMovementType()); Eluna::Push(L, creature->GetDefaultMovementType());
return 1; return 1;
} }
@@ -454,16 +454,16 @@ namespace LuaCreature
* @param Unit target * @param Unit target
* @return float aggroRange * @return float aggroRange
*/ */
int GetAggroRange(Eluna* E, Creature* creature) int GetAggroRange(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Unit* target = Eluna::CHECKOBJ<Unit>(E->L, 2); Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
#ifndef TRINITY #ifndef TRINITY
float AttackDist = creature->GetAttackDistance(target); float AttackDist = creature->GetAttackDistance(target);
float ThreatRadius = sWorld.getConfig(CONFIG_FLOAT_THREAT_RADIUS); float ThreatRadius = sWorld.getConfig(CONFIG_FLOAT_THREAT_RADIUS);
Eluna::Push(E->L, ThreatRadius > AttackDist ? ThreatRadius : AttackDist); Eluna::Push(L, ThreatRadius > AttackDist ? ThreatRadius : AttackDist);
#else #else
Eluna::Push(E->L, creature->GetAggroRange(target)); Eluna::Push(L, creature->GetAggroRange(target));
#endif #endif
return 1; return 1;
} }
@@ -477,11 +477,11 @@ namespace LuaCreature
* @param Unit target * @param Unit target
* @return float attackDistance * @return float attackDistance
*/ */
int GetAttackDistance(Eluna* E, Creature* creature) int GetAttackDistance(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Unit* target = Eluna::CHECKOBJ<Unit>(E->L, 2); Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
Eluna::Push(E->L, creature->GetAttackDistance(target)); Eluna::Push(L, creature->GetAttackDistance(target));
return 1; return 1;
} }
@@ -490,12 +490,12 @@ namespace LuaCreature
* *
* @return Group lootRecipientGroup : the group or `nil` * @return Group lootRecipientGroup : the group or `nil`
*/ */
int GetLootRecipientGroup(Eluna* E, Creature* creature) int GetLootRecipientGroup(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, creature->GetGroupLootRecipient()); Eluna::Push(L, creature->GetGroupLootRecipient());
#else #else
Eluna::Push(E->L, creature->GetLootRecipientGroup()); Eluna::Push(L, creature->GetLootRecipientGroup());
#endif #endif
return 1; return 1;
} }
@@ -505,9 +505,9 @@ namespace LuaCreature
* *
* @return Player lootRecipient : the player or `nil` * @return Player lootRecipient : the player or `nil`
*/ */
int GetLootRecipient(Eluna* E, Creature* creature) int GetLootRecipient(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->GetLootRecipient()); Eluna::Push(L, creature->GetLootRecipient());
return 1; return 1;
} }
@@ -520,9 +520,9 @@ namespace LuaCreature
* *
* @return string scriptName * @return string scriptName
*/ */
int GetScriptName(Eluna* E, Creature* creature) int GetScriptName(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->GetScriptName()); Eluna::Push(L, creature->GetScriptName());
return 1; return 1;
} }
@@ -535,9 +535,9 @@ namespace LuaCreature
* *
* @return string AIName * @return string AIName
*/ */
int GetAIName(Eluna* E, Creature* creature) int GetAIName(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->GetAIName()); Eluna::Push(L, creature->GetAIName());
return 1; return 1;
} }
@@ -549,9 +549,9 @@ namespace LuaCreature
* *
* @return uint32 scriptID * @return uint32 scriptID
*/ */
int GetScriptId(Eluna* E, Creature* creature) int GetScriptId(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->GetScriptId()); Eluna::Push(L, creature->GetScriptId());
return 1; return 1;
} }
@@ -561,11 +561,11 @@ namespace LuaCreature
* @param uint32 spellID * @param uint32 spellID
* @return uint32 cooldown : the cooldown, in milliseconds * @return uint32 cooldown : the cooldown, in milliseconds
*/ */
int GetCreatureSpellCooldownDelay(Eluna* E, Creature* creature) int GetCreatureSpellCooldownDelay(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
uint32 spell = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(E->L, creature->GetCreatureSpellCooldownDelay(spell)); Eluna::Push(L, creature->GetCreatureSpellCooldownDelay(spell));
return 1; return 1;
} }
@@ -574,9 +574,9 @@ namespace LuaCreature
* *
* @return uint32 corpseDelay : the delay, in seconds * @return uint32 corpseDelay : the delay, in seconds
*/ */
int GetCorpseDelay(Eluna* E, Creature* creature) int GetCorpseDelay(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->GetCorpseDelay()); Eluna::Push(L, creature->GetCorpseDelay());
return 1; return 1;
} }
@@ -589,7 +589,7 @@ namespace LuaCreature
* @return float z * @return float z
* @return float o * @return float o
*/ */
int GetHomePosition(Eluna* E, Creature* creature) int GetHomePosition(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
float x, y, z, o; float x, y, z, o;
#ifndef TRINITY #ifndef TRINITY
@@ -598,10 +598,10 @@ namespace LuaCreature
creature->GetHomePosition(x, y, z, o); creature->GetHomePosition(x, y, z, o);
#endif #endif
Eluna::Push(E->L, x); Eluna::Push(L, x);
Eluna::Push(E->L, y); Eluna::Push(L, y);
Eluna::Push(E->L, z); Eluna::Push(L, z);
Eluna::Push(E->L, o); Eluna::Push(L, o);
return 4; return 4;
} }
@@ -614,12 +614,12 @@ namespace LuaCreature
* @param float z * @param float z
* @param float o * @param float o
*/ */
int SetHomePosition(Eluna* E, Creature* creature) int SetHomePosition(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
float x = Eluna::CHECKVAL<float>(E->L, 2); float x = Eluna::CHECKVAL<float>(L, 2);
float y = Eluna::CHECKVAL<float>(E->L, 3); float y = Eluna::CHECKVAL<float>(L, 3);
float z = Eluna::CHECKVAL<float>(E->L, 4); float z = Eluna::CHECKVAL<float>(L, 4);
float o = Eluna::CHECKVAL<float>(E->L, 5); float o = Eluna::CHECKVAL<float>(L, 5);
#ifndef TRINITY #ifndef TRINITY
creature->SetRespawnCoord(x, y, z, o); creature->SetRespawnCoord(x, y, z, o);
@@ -658,13 +658,13 @@ namespace LuaCreature
* @param int32 aura = 0 : if positive, the target must have this [Aura]. If negative, the the target must not have this Aura * @param int32 aura = 0 : if positive, the target must have this [Aura]. If negative, the the target must not have this Aura
* @return Unit target : the target, or `nil` * @return Unit target : the target, or `nil`
*/ */
int GetAITarget(Eluna* E, Creature* creature) int GetAITarget(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
uint32 targetType = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 targetType = Eluna::CHECKVAL<uint32>(L, 2);
bool playerOnly = Eluna::CHECKVAL<bool>(E->L, 3, false); bool playerOnly = Eluna::CHECKVAL<bool>(L, 3, false);
uint32 position = Eluna::CHECKVAL<uint32>(E->L, 4, 0); uint32 position = Eluna::CHECKVAL<uint32>(L, 4, 0);
float dist = Eluna::CHECKVAL<float>(E->L, 5, 0.0f); float dist = Eluna::CHECKVAL<float>(L, 5, 0.0f);
int32 aura = Eluna::CHECKVAL<int32>(E->L, 6, 0); int32 aura = Eluna::CHECKVAL<int32>(L, 6, 0);
#ifdef MANGOS #ifdef MANGOS
ThreatList const& threatlist = creature->GetThreatManager().getThreatList(); ThreatList const& threatlist = creature->GetThreatManager().getThreatList();
@@ -711,7 +711,7 @@ namespace LuaCreature
std::list<Unit*>::const_iterator itr = targetList.begin(); std::list<Unit*>::const_iterator itr = targetList.begin();
if (position) if (position)
std::advance(itr, position); std::advance(itr, position);
Eluna::Push(E->L, *itr); Eluna::Push(L, *itr);
} }
break; break;
case SELECT_TARGET_FARTHEST: case SELECT_TARGET_FARTHEST:
@@ -720,7 +720,7 @@ namespace LuaCreature
std::list<Unit*>::reverse_iterator ritr = targetList.rbegin(); std::list<Unit*>::reverse_iterator ritr = targetList.rbegin();
if (position) if (position)
std::advance(ritr, position); std::advance(ritr, position);
Eluna::Push(E->L, *ritr); Eluna::Push(L, *ritr);
} }
break; break;
case SELECT_TARGET_RANDOM: case SELECT_TARGET_RANDOM:
@@ -730,11 +730,11 @@ namespace LuaCreature
std::advance(itr, urand(0, position)); std::advance(itr, urand(0, position));
else else
std::advance(itr, urand(0, targetList.size() - 1)); std::advance(itr, urand(0, targetList.size() - 1));
Eluna::Push(E->L, *itr); Eluna::Push(L, *itr);
} }
break; break;
default: default:
luaL_argerror(E->L, 2, "SelectAggroTarget expected"); luaL_argerror(L, 2, "SelectAggroTarget expected");
break; break;
} }
@@ -746,10 +746,10 @@ namespace LuaCreature
* *
* @return table targets * @return table targets
*/ */
int GetAITargets(Eluna* E, Creature* creature) int GetAITargets(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
lua_newtable(E->L); lua_newtable(L);
int tbl = lua_gettop(E->L); int tbl = lua_gettop(L);
uint32 i = 0; uint32 i = 0;
#ifdef MANGOS #ifdef MANGOS
@@ -765,12 +765,12 @@ namespace LuaCreature
if (!target) if (!target)
continue; continue;
++i; ++i;
Eluna::Push(E->L, i); Eluna::Push(L, i);
Eluna::Push(E->L, target); Eluna::Push(L, target);
lua_settable(E->L, tbl); lua_settable(L, tbl);
} }
lua_settop(E->L, tbl); lua_settop(L, tbl);
return 1; return 1;
} }
@@ -779,12 +779,12 @@ namespace LuaCreature
* *
* @return int targetsCount * @return int targetsCount
*/ */
int GetAITargetsCount(Eluna* E, Creature* creature) int GetAITargetsCount(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
#ifdef MANGOS #ifdef MANGOS
Eluna::Push(E->L, creature->GetThreatManager().getThreatList().size()); Eluna::Push(L, creature->GetThreatManager().getThreatList().size());
#else #else
Eluna::Push(E->L, creature->getThreatManager().getThreatList().size()); Eluna::Push(L, creature->getThreatManager().getThreatList().size());
#endif #endif
return 1; return 1;
} }
@@ -797,9 +797,9 @@ namespace LuaCreature
* *
* @return NPCFlags npcFlags * @return NPCFlags npcFlags
*/ */
int GetNPCFlags(Eluna* E, Creature* creature) int GetNPCFlags(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->GetUInt32Value(UNIT_NPC_FLAGS)); Eluna::Push(L, creature->GetUInt32Value(UNIT_NPC_FLAGS));
return 1; return 1;
} }
@@ -809,17 +809,17 @@ namespace LuaCreature
* *
* @return uint32 shieldBlockValue * @return uint32 shieldBlockValue
*/ */
int GetShieldBlockValue(Eluna* E, Creature* creature) int GetShieldBlockValue(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Eluna::Push(E->L, creature->GetShieldBlockValue()); Eluna::Push(L, creature->GetShieldBlockValue());
return 1; return 1;
} }
#endif #endif
#ifdef TRINITY #ifdef TRINITY
int GetLootMode(Eluna* E, Creature* creature) // TODO: Implement LootMode features int GetLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
{ {
Eluna::Push(E->L, creature->GetLootMode()); Eluna::Push(L, creature->GetLootMode());
return 1; return 1;
} }
#endif #endif
@@ -831,9 +831,9 @@ namespace LuaCreature
* *
* @param NPCFlags flags * @param NPCFlags flags
*/ */
int SetNPCFlags(Eluna* E, Creature* creature) int SetNPCFlags(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
uint32 flags = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 flags = Eluna::CHECKVAL<uint32>(L, 2);
creature->SetUInt32Value(UNIT_NPC_FLAGS, flags); creature->SetUInt32Value(UNIT_NPC_FLAGS, flags);
return 0; return 0;
@@ -845,9 +845,9 @@ namespace LuaCreature
* *
* @param bool enable = true * @param bool enable = true
*/ */
int SetDisableGravity(Eluna* E, Creature* creature) int SetDisableGravity(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
bool enable = Eluna::CHECKVAL<bool>(E->L, 2, true); bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
#ifdef TRINITY #ifdef TRINITY
creature->SetDisableGravity(!enable); creature->SetDisableGravity(!enable);
@@ -858,9 +858,9 @@ namespace LuaCreature
} }
#ifdef TRINITY #ifdef TRINITY
int SetLootMode(Eluna* E, Creature* creature) // TODO: Implement LootMode features int SetLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
{ {
uint16 lootMode = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
creature->SetLootMode(lootMode); creature->SetLootMode(lootMode);
return 0; return 0;
@@ -872,9 +872,9 @@ namespace LuaCreature
* *
* @param DeathState deathState * @param DeathState deathState
*/ */
int SetDeathState(Eluna* E, Creature* creature) int SetDeathState(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
int32 state = Eluna::CHECKVAL<int32>(E->L, 2); int32 state = Eluna::CHECKVAL<int32>(L, 2);
#ifndef TRINITY #ifndef TRINITY
creature->SetDeathState((DeathState)state); creature->SetDeathState((DeathState)state);
@@ -889,9 +889,9 @@ namespace LuaCreature
* *
* @param bool enable = true : `true` to enable walking, `false` for running * @param bool enable = true : `true` to enable walking, `false` for running
*/ */
int SetWalk(Eluna* E, Creature* creature) // TODO: Move same to Player ? int SetWalk(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Move same to Player ?
{ {
bool enable = Eluna::CHECKVAL<bool>(E->L, 2, true); bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
creature->SetWalk(enable); creature->SetWalk(enable);
return 0; return 0;
@@ -904,11 +904,11 @@ namespace LuaCreature
* @param uint32 off_hand : off hand [Item]'s entry * @param uint32 off_hand : off hand [Item]'s entry
* @param uint32 ranged : ranged [Item]'s entry * @param uint32 ranged : ranged [Item]'s entry
*/ */
int SetEquipmentSlots(Eluna* E, Creature* creature) int SetEquipmentSlots(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
uint32 main_hand = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 main_hand = Eluna::CHECKVAL<uint32>(L, 2);
uint32 off_hand = Eluna::CHECKVAL<uint32>(E->L, 3); uint32 off_hand = Eluna::CHECKVAL<uint32>(L, 3);
uint32 ranged = Eluna::CHECKVAL<uint32>(E->L, 4); uint32 ranged = Eluna::CHECKVAL<uint32>(L, 4);
#ifdef TRINITY #ifdef TRINITY
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, main_hand); creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, main_hand);
@@ -927,9 +927,9 @@ namespace LuaCreature
* *
* @param bool allow = true : `true` to allow aggro, `false` to disable aggro * @param bool allow = true : `true` to allow aggro, `false` to disable aggro
*/ */
int SetAggroEnabled(Eluna* E, Creature* creature) int SetAggroEnabled(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
bool allow = Eluna::CHECKVAL<bool>(E->L, 2, true); bool allow = Eluna::CHECKVAL<bool>(L, 2, true);
#ifdef TRINITY #ifdef TRINITY
if (allow) if (allow)
@@ -951,9 +951,9 @@ namespace LuaCreature
* *
* @param bool disable = true : `true` to disable reputation, `false` to enable * @param bool disable = true : `true` to disable reputation, `false` to enable
*/ */
int SetDisableReputationGain(Eluna* E, Creature* creature) int SetDisableReputationGain(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
bool disable = Eluna::CHECKVAL<bool>(E->L, 2, true); bool disable = Eluna::CHECKVAL<bool>(L, 2, true);
creature->SetDisableReputationGain(disable); creature->SetDisableReputationGain(disable);
return 0; return 0;
@@ -965,7 +965,7 @@ namespace LuaCreature
* This is used by raid bosses to prevent Players from using out-of-combat * This is used by raid bosses to prevent Players from using out-of-combat
* actions once the encounter has begun. * actions once the encounter has begun.
*/ */
int SetInCombatWithZone(Eluna* /*E*/, Creature* creature) int SetInCombatWithZone(Eluna* /*E*/, lua_State* /*L*/, Creature* creature)
{ {
creature->SetInCombatWithZone(); creature->SetInCombatWithZone();
return 0; return 0;
@@ -976,9 +976,9 @@ namespace LuaCreature
* *
* @param float distance * @param float distance
*/ */
int SetWanderRadius(Eluna* E, Creature* creature) int SetWanderRadius(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
float dist = Eluna::CHECKVAL<float>(E->L, 2); float dist = Eluna::CHECKVAL<float>(L, 2);
creature->SetRespawnRadius(dist); creature->SetRespawnRadius(dist);
return 0; return 0;
@@ -989,9 +989,9 @@ namespace LuaCreature
* *
* @param uint32 delay : the delay, in seconds * @param uint32 delay : the delay, in seconds
*/ */
int SetRespawnDelay(Eluna* E, Creature* creature) int SetRespawnDelay(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
uint32 delay = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 delay = Eluna::CHECKVAL<uint32>(L, 2);
creature->SetRespawnDelay(delay); creature->SetRespawnDelay(delay);
return 0; return 0;
@@ -1002,9 +1002,9 @@ namespace LuaCreature
* *
* @param MovementGeneratorType type * @param MovementGeneratorType type
*/ */
int SetDefaultMovementType(Eluna* E, Creature* creature) int SetDefaultMovementType(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
int32 type = Eluna::CHECKVAL<int32>(E->L, 2); int32 type = Eluna::CHECKVAL<int32>(L, 2);
creature->SetDefaultMovementType((MovementGeneratorType)type); creature->SetDefaultMovementType((MovementGeneratorType)type);
return 0; return 0;
@@ -1015,9 +1015,9 @@ namespace LuaCreature
* *
* @param bool enable = true : `true` to disable searching, `false` to allow * @param bool enable = true : `true` to disable searching, `false` to allow
*/ */
int SetNoSearchAssistance(Eluna* E, Creature* creature) int SetNoSearchAssistance(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
bool val = Eluna::CHECKVAL<bool>(E->L, 2, true); bool val = Eluna::CHECKVAL<bool>(L, 2, true);
creature->SetNoSearchAssistance(val); creature->SetNoSearchAssistance(val);
return 0; return 0;
@@ -1028,9 +1028,9 @@ namespace LuaCreature
* *
* @param bool enable = true : `true` to disable calling for help, `false` to enable * @param bool enable = true : `true` to disable calling for help, `false` to enable
*/ */
int SetNoCallAssistance(Eluna* E, Creature* creature) int SetNoCallAssistance(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
bool val = Eluna::CHECKVAL<bool>(E->L, 2, true); bool val = Eluna::CHECKVAL<bool>(L, 2, true);
creature->SetNoCallAssistance(val); creature->SetNoCallAssistance(val);
return 0; return 0;
@@ -1041,9 +1041,9 @@ namespace LuaCreature
* *
* @param bool enable = true : `true` to enable hovering, `false` to disable * @param bool enable = true : `true` to enable hovering, `false` to disable
*/ */
int SetHover(Eluna* E, Creature* creature) int SetHover(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
bool enable = Eluna::CHECKVAL<bool>(E->L, 2, true); bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
#ifdef TRINITY #ifdef TRINITY
creature->SetHover(enable); creature->SetHover(enable);
@@ -1069,9 +1069,9 @@ namespace LuaCreature
* *
* @param uint32 delay = 0 : dely to despawn in milliseconds * @param uint32 delay = 0 : dely to despawn in milliseconds
*/ */
int DespawnOrUnsummon(Eluna* E, Creature* creature) int DespawnOrUnsummon(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
uint32 msTimeToDespawn = Eluna::CHECKVAL<uint32>(E->L, 2, 0); uint32 msTimeToDespawn = Eluna::CHECKVAL<uint32>(L, 2, 0);
#ifndef TRINITY #ifndef TRINITY
creature->ForcedDespawn(msTimeToDespawn); creature->ForcedDespawn(msTimeToDespawn);
@@ -1084,7 +1084,7 @@ namespace LuaCreature
/** /**
* Respawn this [Creature]. * Respawn this [Creature].
*/ */
int Respawn(Eluna* /*E*/, Creature* creature) int Respawn(Eluna* /*E*/, lua_State* /*L*/, Creature* creature)
{ {
creature->Respawn(); creature->Respawn();
return 0; return 0;
@@ -1093,7 +1093,7 @@ namespace LuaCreature
/** /**
* Remove this [Creature]'s corpse. * Remove this [Creature]'s corpse.
*/ */
int RemoveCorpse(Eluna* /*E*/, Creature* creature) int RemoveCorpse(Eluna* /*E*/, lua_State* /*L*/, Creature* creature)
{ {
creature->RemoveCorpse(); creature->RemoveCorpse();
return 0; return 0;
@@ -1102,7 +1102,7 @@ namespace LuaCreature
/** /**
* Make the [Creature] start following it's waypoint path. * Make the [Creature] start following it's waypoint path.
*/ */
int MoveWaypoint(Eluna* /*E*/, Creature* creature) int MoveWaypoint(Eluna* /*E*/, lua_State* /*L*/, Creature* creature)
{ {
#ifndef TRINITY #ifndef TRINITY
creature->GetMotionMaster()->MoveWaypoint(); creature->GetMotionMaster()->MoveWaypoint();
@@ -1115,7 +1115,7 @@ namespace LuaCreature
/** /**
* Make the [Creature] call for assistance in combat from other nearby [Creature]s. * Make the [Creature] call for assistance in combat from other nearby [Creature]s.
*/ */
int CallAssistance(Eluna* /*E*/, Creature* creature) int CallAssistance(Eluna* /*E*/, lua_State* /*L*/, Creature* creature)
{ {
creature->CallAssistance(); creature->CallAssistance();
return 0; return 0;
@@ -1126,9 +1126,9 @@ namespace LuaCreature
* *
* @param float radius * @param float radius
*/ */
int CallForHelp(Eluna* E, Creature* creature) int CallForHelp(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
float radius = Eluna::CHECKVAL<float>(E->L, 2); float radius = Eluna::CHECKVAL<float>(L, 2);
creature->CallForHelp(radius); creature->CallForHelp(radius);
return 0; return 0;
@@ -1137,7 +1137,7 @@ namespace LuaCreature
/** /**
* Make the [Creature] flee combat to get assistance from a nearby friendly [Creature]. * Make the [Creature] flee combat to get assistance from a nearby friendly [Creature].
*/ */
int FleeToGetAssistance(Eluna* /*E*/, Creature* creature) int FleeToGetAssistance(Eluna* /*E*/, lua_State* /*L*/, Creature* creature)
{ {
creature->DoFleeToGetAssistance(); creature->DoFleeToGetAssistance();
return 0; return 0;
@@ -1148,9 +1148,9 @@ namespace LuaCreature
* *
* @param Unit target * @param Unit target
*/ */
int AttackStart(Eluna* E, Creature* creature) int AttackStart(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
Unit* target = Eluna::CHECKOBJ<Unit>(E->L, 2); Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
creature->AI()->AttackStart(target); creature->AI()->AttackStart(target);
return 0; return 0;
@@ -1159,7 +1159,7 @@ namespace LuaCreature
/** /**
* Save the [Creature] in the database. * Save the [Creature] in the database.
*/ */
int SaveToDB(Eluna* /*E*/, Creature* creature) int SaveToDB(Eluna* /*E*/, lua_State* /*L*/, Creature* creature)
{ {
creature->SaveToDB(); creature->SaveToDB();
return 0; return 0;
@@ -1170,12 +1170,12 @@ namespace LuaCreature
* *
* This should be called every update cycle for the Creature's AI. * This should be called every update cycle for the Creature's AI.
*/ */
int SelectVictim(Eluna* E, Creature* creature) int SelectVictim(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, creature->SelectHostileTarget()); Eluna::Push(L, creature->SelectHostileTarget());
#else #else
Eluna::Push(E->L, creature->SelectVictim()); Eluna::Push(L, creature->SelectVictim());
#endif #endif
return 1; return 1;
} }
@@ -1186,10 +1186,10 @@ namespace LuaCreature
* @param uint32 entry : the Creature ID to transform into * @param uint32 entry : the Creature ID to transform into
* @param uint32 dataGUIDLow = 0 : use this Creature's model and equipment instead of the defaults * @param uint32 dataGUIDLow = 0 : use this Creature's model and equipment instead of the defaults
*/ */
int UpdateEntry(Eluna* E, Creature* creature) int UpdateEntry(Eluna* /*E*/, lua_State* L, Creature* creature)
{ {
uint32 entry = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
uint32 dataGuidLow = Eluna::CHECKVAL<uint32>(E->L, 3, 0); uint32 dataGuidLow = Eluna::CHECKVAL<uint32>(L, 3, 0);
#ifndef TRINITY #ifndef TRINITY
creature->UpdateEntry(entry, ALLIANCE, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL); creature->UpdateEntry(entry, ALLIANCE, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL);
@@ -1200,23 +1200,23 @@ namespace LuaCreature
} }
#ifdef TRINITY #ifdef TRINITY
int ResetLootMode(Eluna* /*E*/, Creature* creature) // TODO: Implement LootMode features int ResetLootMode(Eluna* /*E*/, lua_State* /*L*/, Creature* creature) // TODO: Implement LootMode features
{ {
creature->ResetLootMode(); creature->ResetLootMode();
return 0; return 0;
} }
int RemoveLootMode(Eluna* E, Creature* creature) // TODO: Implement LootMode features int RemoveLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
{ {
uint16 lootMode = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
creature->RemoveLootMode(lootMode); creature->RemoveLootMode(lootMode);
return 0; return 0;
} }
int AddLootMode(Eluna* E, Creature* creature) // TODO: Implement LootMode features int AddLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
{ {
uint16 lootMode = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
creature->AddLootMode(lootMode); creature->AddLootMode(lootMode);
return 0; return 0;

View File

@@ -14,152 +14,152 @@
#endif #endif
namespace LuaQuery namespace LuaQuery
{ {
void CheckFields(Eluna* E, ElunaQuery* result) void CheckFields(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
{ {
if (Eluna::CHECKVAL<uint32>(E->L, 2) >= RESULT->GetFieldCount()) if (Eluna::CHECKVAL<uint32>(L, 2) >= RESULT->GetFieldCount())
luaL_argerror(E->L, 2, "invalid field index"); luaL_argerror(L, 2, "invalid field index");
} }
/* BOOLEAN */ /* BOOLEAN */
int IsNull(Eluna* E, ElunaQuery* result) int IsNull(Eluna* E, lua_State* L, ElunaQuery* result)
{ {
uint32 col = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(E, result); CheckFields(E, L, result);
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, RESULT->Fetch()[col].IsNULL()); Eluna::Push(L, RESULT->Fetch()[col].IsNULL());
#else #else
Eluna::Push(E->L, RESULT->Fetch()[col].IsNull()); Eluna::Push(L, RESULT->Fetch()[col].IsNull());
#endif #endif
return 1; return 1;
} }
/* GETTERS */ /* GETTERS */
int GetColumnCount(Eluna* E, ElunaQuery* result) int GetColumnCount(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
{ {
Eluna::Push(E->L, RESULT->GetFieldCount()); Eluna::Push(L, RESULT->GetFieldCount());
return 1; return 1;
} }
int GetRowCount(Eluna* E, ElunaQuery* result) int GetRowCount(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
{ {
if (RESULT->GetRowCount() > (uint32)-1) if (RESULT->GetRowCount() > (uint32)-1)
Eluna::Push(E->L, (uint32)-1); Eluna::Push(L, (uint32)-1);
else else
Eluna::Push(E->L, RESULT->GetRowCount()); Eluna::Push(L, RESULT->GetRowCount());
return 1; return 1;
} }
int GetBool(Eluna* E, ElunaQuery* result) int GetBool(Eluna* E, lua_State* L, ElunaQuery* result)
{ {
uint32 col = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(E, result); CheckFields(E, L, result);
Eluna::Push(E->L, RESULT->Fetch()[col].GetBool()); Eluna::Push(L, RESULT->Fetch()[col].GetBool());
return 1; return 1;
} }
int GetUInt8(Eluna* E, ElunaQuery* result) int GetUInt8(Eluna* E, lua_State* L, ElunaQuery* result)
{ {
uint32 col = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(E, result); CheckFields(E, L, result);
Eluna::Push(E->L, RESULT->Fetch()[col].GetUInt8()); Eluna::Push(L, RESULT->Fetch()[col].GetUInt8());
return 1; return 1;
} }
int GetUInt16(Eluna* E, ElunaQuery* result) int GetUInt16(Eluna* E, lua_State* L, ElunaQuery* result)
{ {
uint32 col = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(E, result); CheckFields(E, L, result);
Eluna::Push(E->L, RESULT->Fetch()[col].GetUInt16()); Eluna::Push(L, RESULT->Fetch()[col].GetUInt16());
return 1; return 1;
} }
int GetUInt32(Eluna* E, ElunaQuery* result) int GetUInt32(Eluna* E, lua_State* L, ElunaQuery* result)
{ {
uint32 col = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(E, result); CheckFields(E, L, result);
Eluna::Push(E->L, RESULT->Fetch()[col].GetUInt32()); Eluna::Push(L, RESULT->Fetch()[col].GetUInt32());
return 1; return 1;
} }
int GetUInt64(Eluna* E, ElunaQuery* result) int GetUInt64(Eluna* E, lua_State* L, ElunaQuery* result)
{ {
uint32 col = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(E, result); CheckFields(E, L, result);
Eluna::Push(E->L, RESULT->Fetch()[col].GetUInt64()); Eluna::Push(L, RESULT->Fetch()[col].GetUInt64());
return 1; return 1;
} }
int GetInt8(Eluna* E, ElunaQuery* result) int GetInt8(Eluna* E, lua_State* L, ElunaQuery* result)
{ {
uint32 col = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(E, result); CheckFields(E, L, result);
Eluna::Push(E->L, RESULT->Fetch()[col].GetInt8()); Eluna::Push(L, RESULT->Fetch()[col].GetInt8());
return 1; return 1;
} }
int GetInt16(Eluna* E, ElunaQuery* result) int GetInt16(Eluna* E, lua_State* L, ElunaQuery* result)
{ {
uint32 col = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(E, result); CheckFields(E, L, result);
Eluna::Push(E->L, RESULT->Fetch()[col].GetInt16()); Eluna::Push(L, RESULT->Fetch()[col].GetInt16());
return 1; return 1;
} }
int GetInt32(Eluna* E, ElunaQuery* result) int GetInt32(Eluna* E, lua_State* L, ElunaQuery* result)
{ {
uint32 col = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(E, result); CheckFields(E, L, result);
Eluna::Push(E->L, RESULT->Fetch()[col].GetInt32()); Eluna::Push(L, RESULT->Fetch()[col].GetInt32());
return 1; return 1;
} }
int GetInt64(Eluna* E, ElunaQuery* result) int GetInt64(Eluna* E, lua_State* L, ElunaQuery* result)
{ {
uint32 col = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(E, result); CheckFields(E, L, result);
Eluna::Push(E->L, RESULT->Fetch()[col].GetInt64()); Eluna::Push(L, RESULT->Fetch()[col].GetInt64());
return 1; return 1;
} }
int GetFloat(Eluna* E, ElunaQuery* result) int GetFloat(Eluna* E, lua_State* L, ElunaQuery* result)
{ {
uint32 col = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(E, result); CheckFields(E, L, result);
Eluna::Push(E->L, RESULT->Fetch()[col].GetFloat()); Eluna::Push(L, RESULT->Fetch()[col].GetFloat());
return 1; return 1;
} }
int GetDouble(Eluna* E, ElunaQuery* result) int GetDouble(Eluna* E, lua_State* L, ElunaQuery* result)
{ {
uint32 col = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(E, result); CheckFields(E, L, result);
Eluna::Push(E->L, RESULT->Fetch()[col].GetDouble()); Eluna::Push(L, RESULT->Fetch()[col].GetDouble());
return 1; return 1;
} }
int GetString(Eluna* E, ElunaQuery* result) int GetString(Eluna* E, lua_State* L, ElunaQuery* result)
{ {
uint32 col = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(E, result); CheckFields(E, L, result);
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, RESULT->Fetch()[col].GetCppString()); Eluna::Push(L, RESULT->Fetch()[col].GetCppString());
#else #else
Eluna::Push(E->L, RESULT->Fetch()[col].GetString()); Eluna::Push(L, RESULT->Fetch()[col].GetString());
#endif #endif
return 1; return 1;
} }
int GetCString(Eluna* E, ElunaQuery* result) int GetCString(Eluna* E, lua_State* L, ElunaQuery* result)
{ {
uint32 col = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(E, result); CheckFields(E, L, result);
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, RESULT->Fetch()[col].GetString()); Eluna::Push(L, RESULT->Fetch()[col].GetString());
#else #else
Eluna::Push(E->L, RESULT->Fetch()[col].GetCString()); Eluna::Push(L, RESULT->Fetch()[col].GetCString());
#endif #endif
return 1; return 1;
} }
@@ -172,9 +172,9 @@ namespace LuaQuery
* *
* @return bool hadNextRow * @return bool hadNextRow
*/ */
int NextRow(Eluna* E, ElunaQuery* result) int NextRow(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
{ {
Eluna::Push(E->L, RESULT->NextRow()); Eluna::Push(L, RESULT->NextRow());
return 1; return 1;
} }
@@ -186,10 +186,10 @@ namespace LuaQuery
* *
* @return table rowData : table filled with row columns and data where `T[column] = data` * @return table rowData : table filled with row columns and data where `T[column] = data`
*/ */
int GetRow(Eluna* E, ElunaQuery* result) int GetRow(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
{ {
lua_newtable(E->L); lua_newtable(L);
int tbl = lua_gettop(E->L); int tbl = lua_gettop(L);
uint32 col = RESULT->GetFieldCount(); uint32 col = RESULT->GetFieldCount();
Field* row = RESULT->Fetch(); Field* row = RESULT->Fetch();
@@ -201,17 +201,17 @@ namespace LuaQuery
for (uint32 i = 0; i < col; ++i) for (uint32 i = 0; i < col; ++i)
{ {
#ifdef TRINITY #ifdef TRINITY
Eluna::Push(E->L, RESULT->GetFieldName(i)); Eluna::Push(L, RESULT->GetFieldName(i));
const char* str = row[i].GetCString(); const char* str = row[i].GetCString();
if (row[i].IsNull() || !str) if (row[i].IsNull() || !str)
Eluna::Push(E->L); Eluna::Push(L);
#else #else
Eluna::Push(E->L, names[i]); Eluna::Push(L, names[i]);
const char* str = row[i].GetString(); const char* str = row[i].GetString();
if (row[i].IsNULL() || !str) if (row[i].IsNULL() || !str)
Eluna::Push(E->L); Eluna::Push(L);
#endif #endif
else else
{ {
@@ -224,18 +224,18 @@ namespace LuaQuery
case MYSQL_TYPE_LONG: case MYSQL_TYPE_LONG:
case MYSQL_TYPE_FLOAT: case MYSQL_TYPE_FLOAT:
case MYSQL_TYPE_DOUBLE: case MYSQL_TYPE_DOUBLE:
Eluna::Push(E->L, strtod(str, NULL)); Eluna::Push(L, strtod(str, NULL));
break; break;
default: default:
Eluna::Push(E->L, str); Eluna::Push(L, str);
break; break;
} }
} }
lua_settable(E->L, tbl); lua_settable(L, tbl);
} }
lua_settop(E->L, tbl); lua_settop(L, tbl);
return 1; return 1;
} }
}; };

View File

@@ -22,7 +22,7 @@ public:
struct ElunaRegister struct ElunaRegister
{ {
const char* name; const char* name;
int(*mfunc)(Eluna*); int(*mfunc)(Eluna*, lua_State*);
}; };
static int thunk(lua_State* L) static int thunk(lua_State* L)
@@ -30,7 +30,7 @@ public:
ElunaRegister* l = static_cast<ElunaRegister*>(lua_touserdata(L, lua_upvalueindex(1))); ElunaRegister* l = static_cast<ElunaRegister*>(lua_touserdata(L, lua_upvalueindex(1)));
Eluna* E = static_cast<Eluna*>(lua_touserdata(L, lua_upvalueindex(2))); Eluna* E = static_cast<Eluna*>(lua_touserdata(L, lua_upvalueindex(2)));
int args = lua_gettop(L); int args = lua_gettop(L);
int expected = l->mfunc(E); int expected = l->mfunc(E, L);
args = lua_gettop(L) - args; args = lua_gettop(L) - args;
if (args < 0 || args > expected) // Assert instead? if (args < 0 || args > expected) // Assert instead?
{ {
@@ -105,7 +105,7 @@ template<typename T>
struct ElunaRegister struct ElunaRegister
{ {
const char* name; const char* name;
int(*mfunc)(Eluna*, T*); int(*mfunc)(Eluna*, lua_State*, T*);
}; };
template<typename T> template<typename T>
@@ -336,7 +336,7 @@ public:
ElunaRegister<T>* l = static_cast<ElunaRegister<T>*>(lua_touserdata(L, lua_upvalueindex(1))); ElunaRegister<T>* l = static_cast<ElunaRegister<T>*>(lua_touserdata(L, lua_upvalueindex(1)));
Eluna* E = static_cast<Eluna*>(lua_touserdata(L, lua_upvalueindex(2))); Eluna* E = static_cast<Eluna*>(lua_touserdata(L, lua_upvalueindex(2)));
int top = lua_gettop(L); int top = lua_gettop(L);
int expected = l->mfunc(E, obj); int expected = l->mfunc(E, L, obj);
int args = lua_gettop(L) - top; int args = lua_gettop(L) - top;
if (args < 0 || args > expected) // Assert instead? if (args < 0 || args > expected) // Assert instead?
{ {

View File

@@ -15,14 +15,14 @@ namespace LuaGameObject
* @param uint32 questId : quest entry Id to check * @param uint32 questId : quest entry Id to check
* @return bool hasQuest * @return bool hasQuest
*/ */
int HasQuest(Eluna* E, GameObject* go) int HasQuest(Eluna* /*E*/, lua_State* L, GameObject* go)
{ {
uint32 questId = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, go->HasQuest(questId)); Eluna::Push(L, go->HasQuest(questId));
#else #else
Eluna::Push(E->L, go->hasQuest(questId)); Eluna::Push(L, go->hasQuest(questId));
#endif #endif
return 1; return 1;
} }
@@ -32,9 +32,9 @@ namespace LuaGameObject
* *
* @return bool isSpawned * @return bool isSpawned
*/ */
int IsSpawned(Eluna* E, GameObject* go) int IsSpawned(Eluna* /*E*/, lua_State* L, GameObject* go)
{ {
Eluna::Push(E->L, go->isSpawned()); Eluna::Push(L, go->isSpawned());
return 1; return 1;
} }
@@ -43,9 +43,9 @@ namespace LuaGameObject
* *
* @return bool isTransport * @return bool isTransport
*/ */
int IsTransport(Eluna* E, GameObject* go) int IsTransport(Eluna* /*E*/, lua_State* L, GameObject* go)
{ {
Eluna::Push(E->L, go->IsTransport()); Eluna::Push(L, go->IsTransport());
return 1; return 1;
} }
@@ -54,15 +54,15 @@ namespace LuaGameObject
* *
* @return bool isActive * @return bool isActive
*/ */
int IsActive(Eluna* E, GameObject* go) int IsActive(Eluna* /*E*/, lua_State* L, GameObject* go)
{ {
Eluna::Push(E->L, go->isActiveObject()); Eluna::Push(L, go->isActiveObject());
return 1; return 1;
} }
/*int IsDestructible(Eluna* E, GameObject* go) // TODO: Implementation core side /*int IsDestructible(Eluna* E, lua_State* L, GameObject* go) // TODO: Implementation core side
{ {
Eluna::Push(E->L, go->IsDestructibleBuilding()); Eluna::Push(L, go->IsDestructibleBuilding());
return 1; return 1;
}*/ }*/
@@ -71,9 +71,9 @@ namespace LuaGameObject
* *
* @return uint32 displayId * @return uint32 displayId
*/ */
int GetDisplayId(Eluna* E, GameObject* go) int GetDisplayId(Eluna* /*E*/, lua_State* L, GameObject* go)
{ {
Eluna::Push(E->L, go->GetDisplayId()); Eluna::Push(L, go->GetDisplayId());
return 1; return 1;
} }
@@ -92,9 +92,9 @@ namespace LuaGameObject
* *
* @return [GOState] goState * @return [GOState] goState
*/ */
int GetGoState(Eluna* E, GameObject* go) int GetGoState(Eluna* /*E*/, lua_State* L, GameObject* go)
{ {
Eluna::Push(E->L, go->GetGoState()); Eluna::Push(L, go->GetGoState());
return 1; return 1;
} }
@@ -114,9 +114,9 @@ namespace LuaGameObject
* *
* @return [LootState] lootState * @return [LootState] lootState
*/ */
int GetLootState(Eluna* E, GameObject* go) int GetLootState(Eluna* /*E*/, lua_State* L, GameObject* go)
{ {
Eluna::Push(E->L, go->getLootState()); Eluna::Push(L, go->getLootState());
return 1; return 1;
} }
@@ -134,9 +134,9 @@ namespace LuaGameObject
* *
* @param [GOState] state : all available go states can be seen above * @param [GOState] state : all available go states can be seen above
*/ */
int SetGoState(Eluna* E, GameObject* go) int SetGoState(Eluna* /*E*/, lua_State* L, GameObject* go)
{ {
uint32 state = Eluna::CHECKVAL<uint32>(E->L, 2, 0); uint32 state = Eluna::CHECKVAL<uint32>(L, 2, 0);
if (state == 0) if (state == 0)
go->SetGoState(GO_STATE_ACTIVE); go->SetGoState(GO_STATE_ACTIVE);
@@ -164,9 +164,9 @@ namespace LuaGameObject
* *
* @param [LootState] state : all available loot states can be seen above * @param [LootState] state : all available loot states can be seen above
*/ */
int SetLootState(Eluna* E, GameObject* go) int SetLootState(Eluna* /*E*/, lua_State* L, GameObject* go)
{ {
uint32 state = Eluna::CHECKVAL<uint32>(E->L, 2, 0); uint32 state = Eluna::CHECKVAL<uint32>(L, 2, 0);
if (state == 0) if (state == 0)
go->SetLootState(GO_NOT_READY); go->SetLootState(GO_NOT_READY);
@@ -184,7 +184,7 @@ namespace LuaGameObject
* Saves [GameObject] to the database * Saves [GameObject] to the database
* *
*/ */
int SaveToDB(Eluna* /*E*/, GameObject* go) int SaveToDB(Eluna* /*E*/, lua_State* /*L*/, GameObject* go)
{ {
go->SaveToDB(); go->SaveToDB();
return 0; return 0;
@@ -195,9 +195,9 @@ namespace LuaGameObject
* *
* @param bool deleteFromDB : if true, it will delete the [GameObject] from the database * @param bool deleteFromDB : if true, it will delete the [GameObject] from the database
*/ */
int RemoveFromWorld(Eluna* E, GameObject* go) int RemoveFromWorld(Eluna* /*E*/, lua_State* L, GameObject* go)
{ {
bool deldb = Eluna::CHECKVAL<bool>(E->L, 2, false); bool deldb = Eluna::CHECKVAL<bool>(L, 2, false);
if (deldb) if (deldb)
go->DeleteFromDB(); go->DeleteFromDB();
go->RemoveFromWorld(); go->RemoveFromWorld();
@@ -209,9 +209,9 @@ namespace LuaGameObject
* *
* @param uint32 delay : cooldown time in seconds to restore the [GameObject] back to normal * @param uint32 delay : cooldown time in seconds to restore the [GameObject] back to normal
*/ */
int UseDoorOrButton(Eluna* E, GameObject* go) int UseDoorOrButton(Eluna* /*E*/, lua_State* L, GameObject* go)
{ {
uint32 delay = Eluna::CHECKVAL<uint32>(E->L, 2, 0); uint32 delay = Eluna::CHECKVAL<uint32>(L, 2, 0);
go->UseDoorOrButton(delay); go->UseDoorOrButton(delay);
return 0; return 0;
@@ -222,9 +222,9 @@ namespace LuaGameObject
* *
* @param uint32 delay : time in seconds to despawn * @param uint32 delay : time in seconds to despawn
*/ */
int Despawn(Eluna* E, GameObject* go) int Despawn(Eluna* /*E*/, lua_State* L, GameObject* go)
{ {
uint32 delay = Eluna::CHECKVAL<uint32>(E->L, 2, 1); uint32 delay = Eluna::CHECKVAL<uint32>(L, 2, 1);
if (!delay) if (!delay)
delay = 1; delay = 1;
@@ -238,9 +238,9 @@ namespace LuaGameObject
* *
* @param uint32 delay : time of respawn in seconds * @param uint32 delay : time of respawn in seconds
*/ */
int Respawn(Eluna* E, GameObject* go) int Respawn(Eluna* /*E*/, lua_State* L, GameObject* go)
{ {
uint32 delay = Eluna::CHECKVAL<uint32>(E->L, 2, 1); uint32 delay = Eluna::CHECKVAL<uint32>(L, 2, 1);
if (!delay) if (!delay)
delay = 1; delay = 1;

File diff suppressed because it is too large Load Diff

View File

@@ -15,10 +15,10 @@ namespace LuaGroup
* @param uint64 guid : guid of a possible leader * @param uint64 guid : guid of a possible leader
* @return bool isLeader * @return bool isLeader
*/ */
int IsLeader(Eluna* E, Group* group) int IsLeader(Eluna* /*E*/, lua_State* L, Group* group)
{ {
uint64 guid = Eluna::CHECKVAL<uint64>(E->L, 2); uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
Eluna::Push(E->L, group->IsLeader(ObjectGuid(guid))); Eluna::Push(L, group->IsLeader(ObjectGuid(guid)));
return 1; return 1;
} }
@@ -27,9 +27,9 @@ namespace LuaGroup
* *
* @return bool isFull * @return bool isFull
*/ */
int IsFull(Eluna* E, Group* group) int IsFull(Eluna* /*E*/, lua_State* L, Group* group)
{ {
Eluna::Push(E->L, group->IsFull()); Eluna::Push(L, group->IsFull());
return 1; return 1;
} }
@@ -38,9 +38,9 @@ namespace LuaGroup
* *
* @return bool isRaid * @return bool isRaid
*/ */
int IsRaidGroup(Eluna* E, Group* group) int IsRaidGroup(Eluna* /*E*/, lua_State* L, Group* group)
{ {
Eluna::Push(E->L, group->isRaidGroup()); Eluna::Push(L, group->isRaidGroup());
return 1; return 1;
} }
@@ -49,9 +49,9 @@ namespace LuaGroup
* *
* @return bool isBG * @return bool isBG
*/ */
int IsBGGroup(Eluna* E, Group* group) int IsBGGroup(Eluna* /*E*/, lua_State* L, Group* group)
{ {
Eluna::Push(E->L, group->isBGGroup()); Eluna::Push(L, group->isBGGroup());
return 1; return 1;
} }
@@ -61,10 +61,10 @@ namespace LuaGroup
* @param [Player] player : [Player] to check * @param [Player] player : [Player] to check
* @return bool isMember * @return bool isMember
*/ */
int IsMember(Eluna* E, Group* group) int IsMember(Eluna* /*E*/, lua_State* L, Group* group)
{ {
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
Eluna::Push(E->L, group->IsMember(player->GET_GUID())); Eluna::Push(L, group->IsMember(player->GET_GUID()));
return 1; return 1;
} }
@@ -74,11 +74,11 @@ namespace LuaGroup
* @param [Player] player : [Player] to check * @param [Player] player : [Player] to check
* @return bool isAssistant * @return bool isAssistant
*/ */
int IsAssistant(Eluna* E, Group* group) int IsAssistant(Eluna* /*E*/, lua_State* L, Group* group)
{ {
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
Eluna::Push(E->L, group->IsAssistant(player->GET_GUID())); Eluna::Push(L, group->IsAssistant(player->GET_GUID()));
return 1; return 1;
} }
@@ -89,11 +89,11 @@ namespace LuaGroup
* @param [Player] player2 : second [Player] to check * @param [Player] player2 : second [Player] to check
* @return bool sameSubGroup * @return bool sameSubGroup
*/ */
int SameSubGroup(Eluna* E, Group* group) int SameSubGroup(Eluna* /*E*/, lua_State* L, Group* group)
{ {
Player* player1 = Eluna::CHECKOBJ<Player>(E->L, 2); Player* player1 = Eluna::CHECKOBJ<Player>(L, 2);
Player* player2 = Eluna::CHECKOBJ<Player>(E->L, 3); Player* player2 = Eluna::CHECKOBJ<Player>(L, 3);
Eluna::Push(E->L, group->SameSubGroup(player1, player2)); Eluna::Push(L, group->SameSubGroup(player1, player2));
return 1; return 1;
} }
@@ -103,10 +103,10 @@ namespace LuaGroup
* @param uint8 subGroup : subGroup ID to check * @param uint8 subGroup : subGroup ID to check
* @return bool hasFreeSlot * @return bool hasFreeSlot
*/ */
int HasFreeSlotSubGroup(Eluna* E, Group* group) int HasFreeSlotSubGroup(Eluna* /*E*/, lua_State* L, Group* group)
{ {
uint8 subGroup = Eluna::CHECKVAL<uint8>(E->L, 2); uint8 subGroup = Eluna::CHECKVAL<uint8>(L, 2);
Eluna::Push(E->L, group->HasFreeSlotSubGroup(subGroup)); Eluna::Push(L, group->HasFreeSlotSubGroup(subGroup));
return 1; return 1;
} }
@@ -116,23 +116,23 @@ namespace LuaGroup
* @param [Player] player : [Player] to invite * @param [Player] player : [Player] to invite
* @return bool invited * @return bool invited
*/ */
int AddInvite(Eluna* E, Group* group) int AddInvite(Eluna* /*E*/, lua_State* L, Group* group)
{ {
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
Eluna::Push(E->L, group->AddInvite(player)); Eluna::Push(L, group->AddInvite(player));
return 1; return 1;
} }
/*int IsLFGGroup(Eluna* E, Group* group) // TODO: Implementation /*int IsLFGGroup(Eluna* E, lua_State* L, Group* group) // TODO: Implementation
{ {
Eluna::Push(E->L, group->isLFGGroup()); Eluna::Push(L, group->isLFGGroup());
return 1; return 1;
}*/ }*/
/*int IsBFGroup(Eluna* E, Group* group) // TODO: Implementation /*int IsBFGroup(Eluna* E, lua_State* L, Group* group) // TODO: Implementation
{ {
Eluna::Push(E->L, group->isBFGroup()); Eluna::Push(L, group->isBFGroup());
return 1; return 1;
}*/ }*/
@@ -141,10 +141,10 @@ namespace LuaGroup
* *
* @return table groupPlayers : table of [Player]s * @return table groupPlayers : table of [Player]s
*/ */
int GetMembers(Eluna* E, Group* group) int GetMembers(Eluna* /*E*/, lua_State* L, Group* group)
{ {
lua_newtable(E->L); lua_newtable(L);
int tbl = lua_gettop(E->L); int tbl = lua_gettop(L);
uint32 i = 0; uint32 i = 0;
for (GroupReference* itr = group->GetFirstMember(); itr; itr = itr->next()) for (GroupReference* itr = group->GetFirstMember(); itr; itr = itr->next())
@@ -159,12 +159,12 @@ namespace LuaGroup
continue; continue;
++i; ++i;
Eluna::Push(E->L, i); Eluna::Push(L, i);
Eluna::Push(E->L, member); Eluna::Push(L, member);
lua_settable(E->L, tbl); lua_settable(L, tbl);
} }
lua_settop(E->L, tbl); // push table to top of stack lua_settop(L, tbl); // push table to top of stack
return 1; return 1;
} }
@@ -173,12 +173,12 @@ namespace LuaGroup
* *
* @return uint64 leaderGUID * @return uint64 leaderGUID
*/ */
int GetLeaderGUID(Eluna* E, Group* group) int GetLeaderGUID(Eluna* /*E*/, lua_State* L, Group* group)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, group->GetLeaderGuid()); Eluna::Push(L, group->GetLeaderGuid());
#else #else
Eluna::Push(E->L, group->GetLeaderGUID()); Eluna::Push(L, group->GetLeaderGUID());
#endif #endif
return 1; return 1;
} }
@@ -188,12 +188,12 @@ namespace LuaGroup
* *
* @return [Player] leader * @return [Player] leader
*/ */
int GetLeader(Eluna* E, Group* group) int GetLeader(Eluna* /*E*/, lua_State* L, Group* group)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, eObjectAccessor->FindPlayer(group->GetLeaderGuid())); Eluna::Push(L, eObjectAccessor->FindPlayer(group->GetLeaderGuid()));
#else #else
Eluna::Push(E->L, eObjectAccessor->FindPlayer(group->GetLeaderGUID())); Eluna::Push(L, eObjectAccessor->FindPlayer(group->GetLeaderGUID()));
#endif #endif
return 1; return 1;
} }
@@ -203,12 +203,12 @@ namespace LuaGroup
* *
* @return uint64 groupGUID * @return uint64 groupGUID
*/ */
int GetGUID(Eluna* E, Group* group) int GetGUID(Eluna* /*E*/, lua_State* L, Group* group)
{ {
#ifdef CLASSIC #ifdef CLASSIC
Eluna::Push(E->L, group->GetId()); Eluna::Push(L, group->GetId());
#else #else
Eluna::Push(E->L, group->GET_GUID()); Eluna::Push(L, group->GET_GUID());
#endif #endif
return 1; return 1;
} }
@@ -219,13 +219,13 @@ namespace LuaGroup
* @param string name : the [Player]'s name * @param string name : the [Player]'s name
* @return uint64 memberGUID * @return uint64 memberGUID
*/ */
int GetMemberGUID(Eluna* E, Group* group) int GetMemberGUID(Eluna* /*E*/, lua_State* L, Group* group)
{ {
const char* name = Eluna::CHECKVAL<const char*>(E->L, 2); const char* name = Eluna::CHECKVAL<const char*>(L, 2);
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, group->GetMemberGuid(name)); Eluna::Push(L, group->GetMemberGuid(name));
#else #else
Eluna::Push(E->L, group->GetMemberGUID(name)); Eluna::Push(L, group->GetMemberGUID(name));
#endif #endif
return 1; return 1;
} }
@@ -235,9 +235,9 @@ namespace LuaGroup
* *
* @return uint32 memberCount * @return uint32 memberCount
*/ */
int GetMembersCount(Eluna* E, Group* group) int GetMembersCount(Eluna* /*E*/, lua_State* L, Group* group)
{ {
Eluna::Push(E->L, group->GetMembersCount()); Eluna::Push(L, group->GetMembersCount());
return 1; return 1;
} }
@@ -247,11 +247,11 @@ namespace LuaGroup
* @param [Player] player : the [Player] to check * @param [Player] player : the [Player] to check
* @return uint8 subGroupID * @return uint8 subGroupID
*/ */
int GetMemberGroup(Eluna* E, Group* group) int GetMemberGroup(Eluna* /*E*/, lua_State* L, Group* group)
{ {
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
Eluna::Push(E->L, group->GetMemberGroup(player->GET_GUID())); Eluna::Push(L, group->GetMemberGroup(player->GET_GUID()));
return 1; return 1;
} }
@@ -260,9 +260,9 @@ namespace LuaGroup
* *
* @param [Player] leader : the [Player] leader to change * @param [Player] leader : the [Player] leader to change
*/ */
int SetLeader(Eluna* E, Group* group) int SetLeader(Eluna* /*E*/, lua_State* L, Group* group)
{ {
Player* leader = Eluna::CHECKOBJ<Player>(E->L, 2); Player* leader = Eluna::CHECKOBJ<Player>(L, 2);
group->ChangeLeader(leader->GET_GUID()); group->ChangeLeader(leader->GET_GUID());
return 0; return 0;
@@ -275,11 +275,11 @@ namespace LuaGroup
* @param bool ignorePlayersInBg : ignores [Player]s in a battleground * @param bool ignorePlayersInBg : ignores [Player]s in a battleground
* @param uint64 ignore : ignore a [Player] by their GUID * @param uint64 ignore : ignore a [Player] by their GUID
*/ */
int SendPacket(Eluna* E, Group* group) int SendPacket(Eluna* /*E*/, lua_State* L, Group* group)
{ {
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(E->L, 2); WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
bool ignorePlayersInBg = Eluna::CHECKVAL<bool>(E->L, 3); bool ignorePlayersInBg = Eluna::CHECKVAL<bool>(L, 3);
uint64 ignore = Eluna::CHECKVAL<uint64>(E->L, 4); uint64 ignore = Eluna::CHECKVAL<uint64>(L, 4);
group->BroadcastPacket(data, ignorePlayersInBg, -1, ObjectGuid(ignore)); group->BroadcastPacket(data, ignorePlayersInBg, -1, ObjectGuid(ignore));
return 0; return 0;
@@ -302,15 +302,15 @@ namespace LuaGroup
* @param [RemoveMethod] method : method used to remove the player * @param [RemoveMethod] method : method used to remove the player
* @return bool removed * @return bool removed
*/ */
int RemoveMember(Eluna* E, Group* group) int RemoveMember(Eluna* /*E*/, lua_State* L, Group* group)
{ {
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint32 method = Eluna::CHECKVAL<uint32>(E->L, 3, 0); uint32 method = Eluna::CHECKVAL<uint32>(L, 3, 0);
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, group->RemoveMember(player->GET_GUID(), method)); Eluna::Push(L, group->RemoveMember(player->GET_GUID(), method));
#else #else
Eluna::Push(E->L, group->RemoveMember(player->GET_GUID(), (RemoveMethod)method)); Eluna::Push(L, group->RemoveMember(player->GET_GUID(), (RemoveMethod)method));
#endif #endif
return 1; return 1;
} }
@@ -319,7 +319,7 @@ namespace LuaGroup
* Disbands this [Group] * Disbands this [Group]
* *
*/ */
int Disband(Eluna* /*E*/, Group* group) int Disband(Eluna* /*E*/, lua_State* /*L*/, Group* group)
{ {
group->Disband(); group->Disband();
return 0; return 0;
@@ -329,7 +329,7 @@ namespace LuaGroup
* Converts this [Group] to a raid [Group] * Converts this [Group] to a raid [Group]
* *
*/ */
int ConvertToRaid(Eluna* /*E*/, Group* group) int ConvertToRaid(Eluna* /*E*/, lua_State* /*L*/, Group* group)
{ {
group->ConvertToRaid(); group->ConvertToRaid();
return 0; return 0;
@@ -341,10 +341,10 @@ namespace LuaGroup
* @param [Player] player : [Player] to move * @param [Player] player : [Player] to move
* @param uint8 groupID : the subGroup's ID * @param uint8 groupID : the subGroup's ID
*/ */
int SetMembersGroup(Eluna* E, Group* group) int SetMembersGroup(Eluna* /*E*/, lua_State* L, Group* group)
{ {
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint8 groupID = Eluna::CHECKVAL<uint8>(E->L, 3); uint8 groupID = Eluna::CHECKVAL<uint8>(L, 3);
group->ChangeMembersGroup(player->GET_GUID(), groupID); group->ChangeMembersGroup(player->GET_GUID(), groupID);
return 0; return 0;
@@ -357,14 +357,14 @@ namespace LuaGroup
* @param uint64 target : GUID of the icon target, 0 is to clear the icon * @param uint64 target : GUID of the icon target, 0 is to clear the icon
* @param uint64 setter : GUID of the icon setter * @param uint64 setter : GUID of the icon setter
*/ */
int SetTargetIcon(Eluna* E, Group* group) int SetTargetIcon(Eluna* /*E*/, lua_State* L, Group* group)
{ {
uint8 icon = Eluna::CHECKVAL<uint8>(E->L, 2); uint8 icon = Eluna::CHECKVAL<uint8>(L, 2);
uint64 target = Eluna::CHECKVAL<uint64>(E->L, 3); uint64 target = Eluna::CHECKVAL<uint64>(L, 3);
uint64 setter = Eluna::CHECKVAL<uint64>(E->L, 4, 0); uint64 setter = Eluna::CHECKVAL<uint64>(L, 4, 0);
if (icon >= TARGETICONCOUNT) if (icon >= TARGETICONCOUNT)
return luaL_argerror(E->L, 2, "valid target icon expected"); return luaL_argerror(L, 2, "valid target icon expected");
#if (defined(CLASSIC) || defined(TBC)) #if (defined(CLASSIC) || defined(TBC))
group->SetTargetIcon(icon, ObjectGuid(target)); group->SetTargetIcon(icon, ObjectGuid(target));
@@ -374,7 +374,7 @@ namespace LuaGroup
return 0; return 0;
} }
/*int ConvertToLFG(Eluna* E, Group* group) // TODO: Implementation /*int ConvertToLFG(Eluna* E, lua_State* L, Group* group) // TODO: Implementation
{ {
group->ConvertToLFG(); group->ConvertToLFG();
return 0; return 0;

View File

@@ -10,10 +10,10 @@
namespace LuaGuild namespace LuaGuild
{ {
/* GETTERS */ /* GETTERS */
int GetMembers(Eluna* E, Guild* guild) int GetMembers(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
lua_newtable(E->L); lua_newtable(L);
int tbl = lua_gettop(E->L); int tbl = lua_gettop(L);
uint32 i = 0; uint32 i = 0;
SessionMap const& sessions = eWorld->GetAllSessions(); SessionMap const& sessions = eWorld->GetAllSessions();
@@ -24,76 +24,76 @@ namespace LuaGuild
if (player->GetSession() && (player->GetGuildId() == guild->GetId())) if (player->GetSession() && (player->GetGuildId() == guild->GetId()))
{ {
++i; ++i;
Eluna::Push(E->L, i); Eluna::Push(L, i);
Eluna::Push(E->L, player); Eluna::Push(L, player);
lua_settable(E->L, tbl); lua_settable(L, tbl);
} }
} }
} }
lua_settop(E->L, tbl); // push table to top of stack lua_settop(L, tbl); // push table to top of stack
return 1; return 1;
} }
int GetMemberCount(Eluna* E, Guild* guild) int GetMemberCount(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
Eluna::Push(E->L, guild->GetMemberSize()); Eluna::Push(L, guild->GetMemberSize());
return 1; return 1;
} }
int GetLeader(Eluna* E, Guild* guild) int GetLeader(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, eObjectAccessor->FindPlayer(guild->GetLeaderGuid())); Eluna::Push(L, eObjectAccessor->FindPlayer(guild->GetLeaderGuid()));
#else #else
Eluna::Push(E->L, eObjectAccessor->FindPlayer(guild->GetLeaderGUID())); Eluna::Push(L, eObjectAccessor->FindPlayer(guild->GetLeaderGUID()));
#endif #endif
return 1; return 1;
} }
int GetLeaderGUID(Eluna* E, Guild* guild) int GetLeaderGUID(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, guild->GetLeaderGuid()); Eluna::Push(L, guild->GetLeaderGuid());
#else #else
Eluna::Push(E->L, guild->GetLeaderGUID()); Eluna::Push(L, guild->GetLeaderGUID());
#endif #endif
return 1; return 1;
} }
int GetId(Eluna* E, Guild* guild) int GetId(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
Eluna::Push(E->L, guild->GetId()); Eluna::Push(L, guild->GetId());
return 1; return 1;
} }
int GetName(Eluna* E, Guild* guild) int GetName(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
Eluna::Push(E->L, guild->GetName()); Eluna::Push(L, guild->GetName());
return 1; return 1;
} }
int GetMOTD(Eluna* E, Guild* guild) int GetMOTD(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
Eluna::Push(E->L, guild->GetMOTD()); Eluna::Push(L, guild->GetMOTD());
return 1; return 1;
} }
int GetInfo(Eluna* E, Guild* guild) int GetInfo(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, guild->GetGINFO()); Eluna::Push(L, guild->GetGINFO());
#else #else
Eluna::Push(E->L, guild->GetInfo()); Eluna::Push(L, guild->GetInfo());
#endif #endif
return 1; return 1;
} }
/* SETTERS */ /* SETTERS */
#ifndef CATA #ifndef CATA
int SetLeader(Eluna* E, Guild* guild) int SetLeader(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
#ifndef TRINITY #ifndef TRINITY
guild->SetLeader(player->GET_GUID()); guild->SetLeader(player->GET_GUID());
@@ -105,10 +105,10 @@ namespace LuaGuild
#endif #endif
#ifndef CLASSIC #ifndef CLASSIC
int SetBankTabText(Eluna* E, Guild* guild) int SetBankTabText(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
uint8 tabId = Eluna::CHECKVAL<uint8>(E->L, 2); uint8 tabId = Eluna::CHECKVAL<uint8>(L, 2);
const char* text = Eluna::CHECKVAL<const char*>(E->L, 3); const char* text = Eluna::CHECKVAL<const char*>(L, 3);
#ifndef TRINITY #ifndef TRINITY
guild->SetGuildBankTabText(tabId, text); guild->SetGuildBankTabText(tabId, text);
#else #else
@@ -120,43 +120,43 @@ namespace LuaGuild
/* OTHER */ /* OTHER */
// SendPacketToGuild(packet) // SendPacketToGuild(packet)
int SendPacket(Eluna* E, Guild* guild) int SendPacket(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(E->L, 2); WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
guild->BroadcastPacket(data); guild->BroadcastPacket(data);
return 0; return 0;
} }
// SendPacketToRankedInGuild(packet, rankId) // SendPacketToRankedInGuild(packet, rankId)
int SendPacketToRanked(Eluna* E, Guild* guild) int SendPacketToRanked(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(E->L, 2); WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
uint8 ranked = Eluna::CHECKVAL<uint8>(E->L, 3); uint8 ranked = Eluna::CHECKVAL<uint8>(L, 3);
guild->BroadcastPacketToRank(data, ranked); guild->BroadcastPacketToRank(data, ranked);
return 0; return 0;
} }
int Disband(Eluna* /*E*/, Guild* guild) int Disband(Eluna* /*E*/, lua_State* /*L*/, Guild* guild)
{ {
guild->Disband(); guild->Disband();
return 0; return 0;
} }
int AddMember(Eluna* E, Guild* guild) int AddMember(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint8 rankId = Eluna::CHECKVAL<uint8>(E->L, 3, GUILD_RANK_NONE); uint8 rankId = Eluna::CHECKVAL<uint8>(L, 3, GUILD_RANK_NONE);
guild->AddMember(player->GET_GUID(), rankId); guild->AddMember(player->GET_GUID(), rankId);
return 0; return 0;
} }
int DeleteMember(Eluna* E, Guild* guild) int DeleteMember(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
bool isDisbanding = Eluna::CHECKVAL<bool>(E->L, 3, false); bool isDisbanding = Eluna::CHECKVAL<bool>(L, 3, false);
#ifndef TRINITY #ifndef TRINITY
guild->DelMember(player->GET_GUID(), isDisbanding); guild->DelMember(player->GET_GUID(), isDisbanding);
@@ -166,10 +166,10 @@ namespace LuaGuild
return 0; return 0;
} }
int SetMemberRank(Eluna* E, Guild* guild) int SetMemberRank(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint8 newRank = Eluna::CHECKVAL<uint8>(E->L, 3); uint8 newRank = Eluna::CHECKVAL<uint8>(L, 3);
guild->ChangeMemberRank(player->GET_GUID(), newRank); guild->ChangeMemberRank(player->GET_GUID(), newRank);
return 0; return 0;
@@ -177,10 +177,10 @@ namespace LuaGuild
#ifndef CLASSIC #ifndef CLASSIC
// Move to Player methods // Move to Player methods
int WithdrawBankMoney(Eluna* E, Guild* guild) int WithdrawBankMoney(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint32 money = Eluna::CHECKVAL<uint32>(E->L, 3); uint32 money = Eluna::CHECKVAL<uint32>(L, 3);
#ifndef TRINITY #ifndef TRINITY
if (guild->GetGuildBankMoney() < money) if (guild->GetGuildBankMoney() < money)
return 0; return 0;
@@ -192,10 +192,10 @@ namespace LuaGuild
} }
// Move to Player methods // Move to Player methods
int DepositBankMoney(Eluna* E, Guild* guild) int DepositBankMoney(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint32 money = Eluna::CHECKVAL<uint32>(E->L, 3); uint32 money = Eluna::CHECKVAL<uint32>(L, 3);
#ifndef TRINITY #ifndef TRINITY
guild->SetBankMoney(guild->GetGuildBankMoney() + money); guild->SetBankMoney(guild->GetGuildBankMoney() + money);

View File

@@ -10,136 +10,136 @@
namespace LuaItem namespace LuaItem
{ {
/* BOOLEAN */ /* BOOLEAN */
int IsSoulBound(Eluna* E, Item* item) int IsSoulBound(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->IsSoulBound()); Eluna::Push(L, item->IsSoulBound());
return 1; return 1;
} }
#if (!defined(TBC) && !defined(CLASSIC)) #if (!defined(TBC) && !defined(CLASSIC))
int IsBoundAccountWide(Eluna* E, Item* item) int IsBoundAccountWide(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->IsBoundAccountWide()); Eluna::Push(L, item->IsBoundAccountWide());
return 1; return 1;
} }
#endif #endif
int IsBoundByEnchant(Eluna* E, Item* item) int IsBoundByEnchant(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->IsBoundByEnchant()); Eluna::Push(L, item->IsBoundByEnchant());
return 1; return 1;
} }
int IsNotBoundToPlayer(Eluna* E, Item* item) int IsNotBoundToPlayer(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
Eluna::Push(E->L, item->IsBindedNotWith(player)); Eluna::Push(L, item->IsBindedNotWith(player));
return 1; return 1;
} }
int IsLocked(Eluna* E, Item* item) int IsLocked(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->IsLocked()); Eluna::Push(L, item->IsLocked());
return 1; return 1;
} }
int IsBag(Eluna* E, Item* item) int IsBag(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->IsBag()); Eluna::Push(L, item->IsBag());
return 1; return 1;
} }
#ifndef CLASSIC #ifndef CLASSIC
int IsCurrencyToken(Eluna* E, Item* item) int IsCurrencyToken(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->IsCurrencyToken()); Eluna::Push(L, item->IsCurrencyToken());
return 1; return 1;
} }
#endif #endif
int IsNotEmptyBag(Eluna* E, Item* item) int IsNotEmptyBag(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->IsNotEmptyBag()); Eluna::Push(L, item->IsNotEmptyBag());
return 1; return 1;
} }
int IsBroken(Eluna* E, Item* item) int IsBroken(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->IsBroken()); Eluna::Push(L, item->IsBroken());
return 1; return 1;
} }
int CanBeTraded(Eluna* E, Item* item) int CanBeTraded(Eluna* /*E*/, lua_State* L, Item* item)
{ {
#if (defined(TBC) || defined(CLASSIC)) #if (defined(TBC) || defined(CLASSIC))
Eluna::Push(E->L, item->CanBeTraded()); Eluna::Push(L, item->CanBeTraded());
#else #else
bool mail = Eluna::CHECKVAL<bool>(E->L, 2, false); bool mail = Eluna::CHECKVAL<bool>(L, 2, false);
Eluna::Push(E->L, item->CanBeTraded(mail)); Eluna::Push(L, item->CanBeTraded(mail));
#endif #endif
return 1; return 1;
} }
int IsInTrade(Eluna* E, Item* item) int IsInTrade(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->IsInTrade()); Eluna::Push(L, item->IsInTrade());
return 1; return 1;
} }
int IsInBag(Eluna* E, Item* item) int IsInBag(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->IsInBag()); Eluna::Push(L, item->IsInBag());
return 1; return 1;
} }
int IsEquipped(Eluna* E, Item* item) int IsEquipped(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->IsEquipped()); Eluna::Push(L, item->IsEquipped());
return 1; return 1;
} }
int HasQuest(Eluna* E, Item* item) int HasQuest(Eluna* /*E*/, lua_State* L, Item* item)
{ {
uint32 quest = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 quest = Eluna::CHECKVAL<uint32>(L, 2);
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, item->HasQuest(quest)); Eluna::Push(L, item->HasQuest(quest));
#else #else
Eluna::Push(E->L, item->hasQuest(quest)); Eluna::Push(L, item->hasQuest(quest));
#endif #endif
return 1; return 1;
} }
int IsPotion(Eluna* E, Item* item) int IsPotion(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->IsPotion()); Eluna::Push(L, item->IsPotion());
return 1; return 1;
} }
#ifndef CATA #ifndef CATA
int IsWeaponVellum(Eluna* E, Item* item) int IsWeaponVellum(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->IsWeaponVellum()); Eluna::Push(L, item->IsWeaponVellum());
return 1; return 1;
} }
int IsArmorVellum(Eluna* E, Item* item) int IsArmorVellum(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->IsArmorVellum()); Eluna::Push(L, item->IsArmorVellum());
return 1; return 1;
} }
#endif #endif
int IsConjuredConsumable(Eluna* E, Item* item) int IsConjuredConsumable(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->IsConjuredConsumable()); Eluna::Push(L, item->IsConjuredConsumable());
return 1; return 1;
} }
/* /*
* int IsRefundExpired(Eluna* E, Item* item)// TODO: Implement core support * int IsRefundExpired(Eluna* E, lua_State* L, Item* item)// TODO: Implement core support
* { * {
* Eluna::Push(E->L, item->IsRefundExpired()); * Eluna::Push(L, item->IsRefundExpired());
* return 1; * return 1;
* } * }
*/ */
@@ -167,11 +167,11 @@ namespace LuaItem
* @param [LocaleConstant] locale = DEFAULT_LOCALE : locale to return the [Item]'s name in * @param [LocaleConstant] locale = DEFAULT_LOCALE : locale to return the [Item]'s name in
* @return string itemLink * @return string itemLink
*/ */
int GetItemLink(Eluna* E, Item* item) int GetItemLink(Eluna* /*E*/, lua_State* L, Item* item)
{ {
uint8 locale = Eluna::CHECKVAL<uint8>(E->L, 2, DEFAULT_LOCALE); uint8 locale = Eluna::CHECKVAL<uint8>(L, 2, DEFAULT_LOCALE);
if (locale >= TOTAL_LOCALES) if (locale >= TOTAL_LOCALES)
return luaL_argerror(E->L, 2, "valid LocaleConstant expected"); return luaL_argerror(L, 2, "valid LocaleConstant expected");
const ItemTemplate* temp = item->GetTemplate(); const ItemTemplate* temp = item->GetTemplate();
std::string name = temp->Name1; std::string name = temp->Name1;
@@ -223,200 +223,200 @@ namespace LuaItem
item->GetItemRandomPropertyId() << ":" << item->GetItemSuffixFactor() << ":" << item->GetItemRandomPropertyId() << ":" << item->GetItemSuffixFactor() << ":" <<
(uint32)item->GetOwner()->getLevel() << "|h[" << name << "]|h|r"; (uint32)item->GetOwner()->getLevel() << "|h[" << name << "]|h|r";
Eluna::Push(E->L, oss.str()); Eluna::Push(L, oss.str());
return 1; return 1;
} }
int GetOwnerGUID(Eluna* E, Item* item) int GetOwnerGUID(Eluna* /*E*/, lua_State* L, Item* item)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, item->GetOwnerGuid()); Eluna::Push(L, item->GetOwnerGuid());
#else #else
Eluna::Push(E->L, item->GetOwnerGUID()); Eluna::Push(L, item->GetOwnerGUID());
#endif #endif
return 1; return 1;
} }
int GetOwner(Eluna* E, Item* item) int GetOwner(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetOwner()); Eluna::Push(L, item->GetOwner());
return 1; return 1;
} }
int GetCount(Eluna* E, Item* item) int GetCount(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetCount()); Eluna::Push(L, item->GetCount());
return 1; return 1;
} }
int GetMaxStackCount(Eluna* E, Item* item) int GetMaxStackCount(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetMaxStackCount()); Eluna::Push(L, item->GetMaxStackCount());
return 1; return 1;
} }
int GetSlot(Eluna* E, Item* item) int GetSlot(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetSlot()); Eluna::Push(L, item->GetSlot());
return 1; return 1;
} }
int GetBagSlot(Eluna* E, Item* item) int GetBagSlot(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetBagSlot()); Eluna::Push(L, item->GetBagSlot());
return 1; return 1;
} }
int GetEnchantmentId(Eluna* E, Item* item) int GetEnchantmentId(Eluna* /*E*/, lua_State* L, Item* item)
{ {
uint32 enchant_slot = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 enchant_slot = Eluna::CHECKVAL<uint32>(L, 2);
if (enchant_slot >= MAX_INSPECTED_ENCHANTMENT_SLOT) if (enchant_slot >= MAX_INSPECTED_ENCHANTMENT_SLOT)
return luaL_argerror(E->L, 2, "valid EnchantmentSlot expected"); return luaL_argerror(L, 2, "valid EnchantmentSlot expected");
Eluna::Push(E->L, item->GetEnchantmentId(EnchantmentSlot(enchant_slot))); Eluna::Push(L, item->GetEnchantmentId(EnchantmentSlot(enchant_slot)));
return 1; return 1;
} }
int GetSpellId(Eluna* E, Item* item) int GetSpellId(Eluna* /*E*/, lua_State* L, Item* item)
{ {
uint32 index = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 index = Eluna::CHECKVAL<uint32>(L, 2);
if (index >= MAX_ITEM_PROTO_SPELLS) if (index >= MAX_ITEM_PROTO_SPELLS)
return luaL_argerror(E->L, 2, "valid SpellIndex expected"); return luaL_argerror(L, 2, "valid SpellIndex expected");
Eluna::Push(E->L, item->GetTemplate()->Spells[index].SpellId); Eluna::Push(L, item->GetTemplate()->Spells[index].SpellId);
return 1; return 1;
} }
int GetSpellTrigger(Eluna* E, Item* item) int GetSpellTrigger(Eluna* /*E*/, lua_State* L, Item* item)
{ {
uint32 index = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 index = Eluna::CHECKVAL<uint32>(L, 2);
if (index >= MAX_ITEM_PROTO_SPELLS) if (index >= MAX_ITEM_PROTO_SPELLS)
return luaL_argerror(E->L, 2, "valid SpellIndex expected"); return luaL_argerror(L, 2, "valid SpellIndex expected");
Eluna::Push(E->L, item->GetTemplate()->Spells[index].SpellTrigger); Eluna::Push(L, item->GetTemplate()->Spells[index].SpellTrigger);
return 1; return 1;
} }
int GetClass(Eluna* E, Item* item) int GetClass(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetTemplate()->Class); Eluna::Push(L, item->GetTemplate()->Class);
return 1; return 1;
} }
int GetSubClass(Eluna* E, Item* item) int GetSubClass(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetTemplate()->SubClass); Eluna::Push(L, item->GetTemplate()->SubClass);
return 1; return 1;
} }
int GetName(Eluna* E, Item* item) int GetName(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetTemplate()->Name1); Eluna::Push(L, item->GetTemplate()->Name1);
return 1; return 1;
} }
int GetDisplayId(Eluna* E, Item* item) int GetDisplayId(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetTemplate()->DisplayInfoID); Eluna::Push(L, item->GetTemplate()->DisplayInfoID);
return 1; return 1;
} }
int GetQuality(Eluna* E, Item* item) int GetQuality(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetTemplate()->Quality); Eluna::Push(L, item->GetTemplate()->Quality);
return 1; return 1;
} }
int GetBuyCount(Eluna* E, Item* item) int GetBuyCount(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetTemplate()->BuyCount); Eluna::Push(L, item->GetTemplate()->BuyCount);
return 1; return 1;
} }
int GetBuyPrice(Eluna* E, Item* item) int GetBuyPrice(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetTemplate()->BuyPrice); Eluna::Push(L, item->GetTemplate()->BuyPrice);
return 1; return 1;
} }
int GetSellPrice(Eluna* E, Item* item) int GetSellPrice(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetTemplate()->SellPrice); Eluna::Push(L, item->GetTemplate()->SellPrice);
return 1; return 1;
} }
int GetInventoryType(Eluna* E, Item* item) int GetInventoryType(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetTemplate()->InventoryType); Eluna::Push(L, item->GetTemplate()->InventoryType);
return 1; return 1;
} }
int GetAllowableClass(Eluna* E, Item* item) int GetAllowableClass(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetTemplate()->AllowableClass); Eluna::Push(L, item->GetTemplate()->AllowableClass);
return 1; return 1;
} }
int GetAllowableRace(Eluna* E, Item* item) int GetAllowableRace(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetTemplate()->AllowableRace); Eluna::Push(L, item->GetTemplate()->AllowableRace);
return 1; return 1;
} }
int GetItemLevel(Eluna* E, Item* item) int GetItemLevel(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetTemplate()->ItemLevel); Eluna::Push(L, item->GetTemplate()->ItemLevel);
return 1; return 1;
} }
int GetRequiredLevel(Eluna* E, Item* item) int GetRequiredLevel(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetTemplate()->RequiredLevel); Eluna::Push(L, item->GetTemplate()->RequiredLevel);
return 1; return 1;
} }
#ifdef WOTLK #ifdef WOTLK
int GetStatsCount(Eluna* E, Item* item) int GetStatsCount(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetTemplate()->StatsCount); Eluna::Push(L, item->GetTemplate()->StatsCount);
return 1; return 1;
} }
#endif #endif
int GetRandomProperty(Eluna* E, Item* item) int GetRandomProperty(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetTemplate()->RandomProperty); Eluna::Push(L, item->GetTemplate()->RandomProperty);
return 1; return 1;
} }
#ifndef CLASSIC #ifndef CLASSIC
int GetRandomSuffix(Eluna* E, Item* item) int GetRandomSuffix(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetTemplate()->RandomSuffix); Eluna::Push(L, item->GetTemplate()->RandomSuffix);
return 1; return 1;
} }
#endif #endif
int GetItemSet(Eluna* E, Item* item) int GetItemSet(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Eluna::Push(E->L, item->GetTemplate()->ItemSet); Eluna::Push(L, item->GetTemplate()->ItemSet);
return 1; return 1;
} }
int GetBagSize(Eluna* E, Item* item) int GetBagSize(Eluna* /*E*/, lua_State* L, Item* item)
{ {
if (Bag* bag = item->ToBag()) if (Bag* bag = item->ToBag())
Eluna::Push(E->L, bag->GetBagSize()); Eluna::Push(L, bag->GetBagSize());
else else
Eluna::Push(E->L, 0); Eluna::Push(L, 0);
return 1; return 1;
} }
/* SETTERS */ /* SETTERS */
int SetOwner(Eluna* E, Item* item) int SetOwner(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
#ifndef TRINITY #ifndef TRINITY
item->SetOwnerGuid(player->GET_GUID()); item->SetOwnerGuid(player->GET_GUID());
#else #else
@@ -425,75 +425,75 @@ namespace LuaItem
return 0; return 0;
} }
int SetBinding(Eluna* E, Item* item) int SetBinding(Eluna* /*E*/, lua_State* L, Item* item)
{ {
bool soulbound = Eluna::CHECKVAL<bool>(E->L, 2); bool soulbound = Eluna::CHECKVAL<bool>(L, 2);
item->SetBinding(soulbound); item->SetBinding(soulbound);
return 0; return 0;
} }
int SetCount(Eluna* E, Item* item) int SetCount(Eluna* /*E*/, lua_State* L, Item* item)
{ {
uint32 count = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 count = Eluna::CHECKVAL<uint32>(L, 2);
item->SetCount(count); item->SetCount(count);
return 0; return 0;
} }
int SetEnchantment(Eluna* E, Item* item) int SetEnchantment(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Player* owner = item->GetOwner(); Player* owner = item->GetOwner();
if (!owner) if (!owner)
{ {
Eluna::Push(E->L, false); Eluna::Push(L, false);
return 1; return 1;
} }
uint32 enchant = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 enchant = Eluna::CHECKVAL<uint32>(L, 2);
if (!sSpellItemEnchantmentStore.LookupEntry(enchant)) if (!sSpellItemEnchantmentStore.LookupEntry(enchant))
{ {
Eluna::Push(E->L, false); Eluna::Push(L, false);
return 1; return 1;
} }
EnchantmentSlot slot = (EnchantmentSlot)Eluna::CHECKVAL<uint32>(E->L, 3); EnchantmentSlot slot = (EnchantmentSlot)Eluna::CHECKVAL<uint32>(L, 3);
if (slot >= MAX_INSPECTED_ENCHANTMENT_SLOT) if (slot >= MAX_INSPECTED_ENCHANTMENT_SLOT)
return luaL_argerror(E->L, 2, "valid EnchantmentSlot expected"); return luaL_argerror(L, 2, "valid EnchantmentSlot expected");
owner->ApplyEnchantment(item, slot, false); owner->ApplyEnchantment(item, slot, false);
item->SetEnchantment(slot, enchant, 0, 0); item->SetEnchantment(slot, enchant, 0, 0);
owner->ApplyEnchantment(item, slot, true); owner->ApplyEnchantment(item, slot, true);
Eluna::Push(E->L, true); Eluna::Push(L, true);
return 1; return 1;
} }
/* OTHER */ /* OTHER */
int ClearEnchantment(Eluna* E, Item* item) int ClearEnchantment(Eluna* /*E*/, lua_State* L, Item* item)
{ {
Player* owner = item->GetOwner(); Player* owner = item->GetOwner();
if (!owner) if (!owner)
{ {
Eluna::Push(E->L, false); Eluna::Push(L, false);
return 1; return 1;
} }
EnchantmentSlot slot = (EnchantmentSlot)Eluna::CHECKVAL<uint32>(E->L, 2); EnchantmentSlot slot = (EnchantmentSlot)Eluna::CHECKVAL<uint32>(L, 2);
if (slot >= MAX_INSPECTED_ENCHANTMENT_SLOT) if (slot >= MAX_INSPECTED_ENCHANTMENT_SLOT)
return luaL_argerror(E->L, 2, "valid EnchantmentSlot expected"); return luaL_argerror(L, 2, "valid EnchantmentSlot expected");
if (!item->GetEnchantmentId(slot)) if (!item->GetEnchantmentId(slot))
{ {
Eluna::Push(E->L, false); Eluna::Push(L, false);
return 1; return 1;
} }
owner->ApplyEnchantment(item, slot, false); owner->ApplyEnchantment(item, slot, false);
item->ClearEnchantment(slot); item->ClearEnchantment(slot);
Eluna::Push(E->L, true); Eluna::Push(L, true);
return 1; return 1;
} }
int SaveToDB(Eluna* /*E*/, Item* item) int SaveToDB(Eluna* /*E*/, lua_State* /*L*/, Item* item)
{ {
#ifndef TRINITY #ifndef TRINITY
item->SaveToDB(); item->SaveToDB();

View File

@@ -16,9 +16,9 @@ namespace LuaMap
* *
* @return bool isArena * @return bool isArena
*/ */
int IsArena(Eluna* E, Map* map) int IsArena(Eluna* /*E*/, lua_State* L, Map* map)
{ {
Eluna::Push(E->L, map->IsBattleArena()); Eluna::Push(L, map->IsBattleArena());
return 1; return 1;
} }
#endif #endif
@@ -28,12 +28,12 @@ namespace LuaMap
* *
* @return bool isBattleGround * @return bool isBattleGround
*/ */
int IsBattleground(Eluna* E, Map* map) int IsBattleground(Eluna* /*E*/, lua_State* L, Map* map)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, map->IsBattleGround()); Eluna::Push(L, map->IsBattleGround());
#else #else
Eluna::Push(E->L, map->IsBattleground()); Eluna::Push(L, map->IsBattleground());
#endif #endif
return 1; return 1;
} }
@@ -43,9 +43,9 @@ namespace LuaMap
* *
* @return bool isDungeon * @return bool isDungeon
*/ */
int IsDungeon(Eluna* E, Map* map) int IsDungeon(Eluna* /*E*/, lua_State* L, Map* map)
{ {
Eluna::Push(E->L, map->IsDungeon()); Eluna::Push(L, map->IsDungeon());
return 1; return 1;
} }
@@ -54,9 +54,9 @@ namespace LuaMap
* *
* @return bool isEmpty * @return bool isEmpty
*/ */
int IsEmpty(Eluna* E, Map* map) int IsEmpty(Eluna* /*E*/, lua_State* L, Map* map)
{ {
Eluna::Push(E->L, map->isEmpty()); Eluna::Push(L, map->isEmpty());
return 1; return 1;
} }
@@ -66,9 +66,9 @@ namespace LuaMap
* *
* @return bool isHeroic * @return bool isHeroic
*/ */
int IsHeroic(Eluna* E, Map* map) int IsHeroic(Eluna* /*E*/, lua_State* L, Map* map)
{ {
Eluna::Push(E->L, map->IsHeroic()); Eluna::Push(L, map->IsHeroic());
return 1; return 1;
} }
#endif #endif
@@ -78,9 +78,9 @@ namespace LuaMap
* *
* @return bool isRaid * @return bool isRaid
*/ */
int IsRaid(Eluna* E, Map* map) int IsRaid(Eluna* /*E*/, lua_State* L, Map* map)
{ {
Eluna::Push(E->L, map->IsRaid()); Eluna::Push(L, map->IsRaid());
return 1; return 1;
} }
@@ -89,9 +89,9 @@ namespace LuaMap
* *
* @return string mapName * @return string mapName
*/ */
int GetName(Eluna* E, Map* map) int GetName(Eluna* /*E*/, lua_State* L, Map* map)
{ {
Eluna::Push(E->L, map->GetMapName()); Eluna::Push(L, map->GetMapName());
return 1; return 1;
} }
@@ -103,18 +103,18 @@ namespace LuaMap
* @param float y * @param float y
* @return float z * @return float z
*/ */
int GetHeight(Eluna* E, Map* map) int GetHeight(Eluna* /*E*/, lua_State* L, Map* map)
{ {
float x = Eluna::CHECKVAL<float>(E->L, 2); float x = Eluna::CHECKVAL<float>(L, 2);
float y = Eluna::CHECKVAL<float>(E->L, 3); float y = Eluna::CHECKVAL<float>(L, 3);
#if (defined(TBC) || defined(CLASSIC)) #if (defined(TBC) || defined(CLASSIC))
float z = map->GetHeight(x, y, MAX_HEIGHT); float z = map->GetHeight(x, y, MAX_HEIGHT);
#else #else
uint32 phasemask = Eluna::CHECKVAL<uint32>(E->L, 4, 1); uint32 phasemask = Eluna::CHECKVAL<uint32>(L, 4, 1);
float z = map->GetHeight(phasemask, x, y, MAX_HEIGHT); float z = map->GetHeight(phasemask, x, y, MAX_HEIGHT);
#endif #endif
if (z != INVALID_HEIGHT) if (z != INVALID_HEIGHT)
Eluna::Push(E->L, z); Eluna::Push(L, z);
return 1; return 1;
} }
@@ -123,12 +123,12 @@ namespace LuaMap
* *
* @return int32 difficulty * @return int32 difficulty
*/ */
int GetDifficulty(Eluna* E, Map* map) int GetDifficulty(Eluna* /*E*/, lua_State* L, Map* map)
{ {
#ifndef CLASSIC #ifndef CLASSIC
Eluna::Push(E->L, map->GetDifficulty()); Eluna::Push(L, map->GetDifficulty());
#else #else
Eluna::Push(E->L, (Difficulty)0); Eluna::Push(L, (Difficulty)0);
#endif #endif
return 1; return 1;
} }
@@ -138,9 +138,9 @@ namespace LuaMap
* *
* @return uint32 instanceId * @return uint32 instanceId
*/ */
int GetInstanceId(Eluna* E, Map* map) int GetInstanceId(Eluna* /*E*/, lua_State* L, Map* map)
{ {
Eluna::Push(E->L, map->GetInstanceId()); Eluna::Push(L, map->GetInstanceId());
return 1; return 1;
} }
@@ -150,9 +150,9 @@ namespace LuaMap
* *
* @return uint32 playerCount * @return uint32 playerCount
*/ */
int GetPlayerCount(Eluna* E, Map* map) int GetPlayerCount(Eluna* /*E*/, lua_State* L, Map* map)
{ {
Eluna::Push(E->L, map->GetPlayersCountExceptGMs()); Eluna::Push(L, map->GetPlayersCountExceptGMs());
return 1; return 1;
} }
@@ -161,9 +161,9 @@ namespace LuaMap
* *
* @return uint32 mapId * @return uint32 mapId
*/ */
int GetMapId(Eluna* E, Map* map) int GetMapId(Eluna* /*E*/, lua_State* L, Map* map)
{ {
Eluna::Push(E->L, map->GetId()); Eluna::Push(L, map->GetId());
return 1; return 1;
} }
@@ -175,16 +175,16 @@ namespace LuaMap
* @param float z * @param float z
* @return uint32 areaId * @return uint32 areaId
*/ */
int GetAreaId(Eluna* E, Map* map) int GetAreaId(Eluna* /*E*/, lua_State* L, Map* map)
{ {
float x = Eluna::CHECKVAL<float>(E->L, 2); float x = Eluna::CHECKVAL<float>(L, 2);
float y = Eluna::CHECKVAL<float>(E->L, 3); float y = Eluna::CHECKVAL<float>(L, 3);
float z = Eluna::CHECKVAL<float>(E->L, 4); float z = Eluna::CHECKVAL<float>(L, 4);
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, map->GetTerrain()->GetAreaId(x, y, z)); Eluna::Push(L, map->GetTerrain()->GetAreaId(x, y, z));
#else #else
Eluna::Push(E->L, map->GetAreaId(x, y, z)); Eluna::Push(L, map->GetAreaId(x, y, z));
#endif #endif
return 1; return 1;
} }
@@ -194,35 +194,35 @@ namespace LuaMap
* *
* @param uint64 guid * @param uint64 guid
*/ */
int GetWorldObject(Eluna* E, Map* map) int GetWorldObject(Eluna* /*E*/, lua_State* L, Map* map)
{ {
uint64 guid = Eluna::CHECKVAL<uint64>(E->L, 2); uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, map->GetWorldObject(ObjectGuid(guid))); Eluna::Push(L, map->GetWorldObject(ObjectGuid(guid)));
#else #else
switch (GUID_HIPART(guid)) switch (GUID_HIPART(guid))
{ {
case HIGHGUID_PLAYER: case HIGHGUID_PLAYER:
Eluna::Push(E->L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Player*)NULL)); Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Player*)NULL));
break; break;
case HIGHGUID_TRANSPORT: case HIGHGUID_TRANSPORT:
case HIGHGUID_MO_TRANSPORT: case HIGHGUID_MO_TRANSPORT:
case HIGHGUID_GAMEOBJECT: case HIGHGUID_GAMEOBJECT:
Eluna::Push(E->L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (GameObject*)NULL)); Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (GameObject*)NULL));
break; break;
case HIGHGUID_VEHICLE: case HIGHGUID_VEHICLE:
case HIGHGUID_UNIT: case HIGHGUID_UNIT:
Eluna::Push(E->L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Creature*)NULL)); Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Creature*)NULL));
break; break;
case HIGHGUID_PET: case HIGHGUID_PET:
Eluna::Push(E->L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Pet*)NULL)); Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Pet*)NULL));
break; break;
case HIGHGUID_DYNAMICOBJECT: case HIGHGUID_DYNAMICOBJECT:
Eluna::Push(E->L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (DynamicObject*)NULL)); Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (DynamicObject*)NULL));
break; break;
case HIGHGUID_CORPSE: case HIGHGUID_CORPSE:
Eluna::Push(E->L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Corpse*)NULL)); Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Corpse*)NULL));
break; break;
default: default:
break; break;

View File

@@ -10,219 +10,219 @@
namespace LuaObject namespace LuaObject
{ {
/* BOOLEAN */ /* BOOLEAN */
int HasFlag(Eluna* E, Object* obj) int HasFlag(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
uint16 index = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint32 flag = Eluna::CHECKVAL<uint32>(E->L, 3); uint32 flag = Eluna::CHECKVAL<uint32>(L, 3);
Eluna::Push(E->L, obj->HasFlag(index, flag)); Eluna::Push(L, obj->HasFlag(index, flag));
return 1; return 1;
} }
int IsInWorld(Eluna* E, Object* obj) int IsInWorld(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
Eluna::Push(E->L, obj->IsInWorld()); Eluna::Push(L, obj->IsInWorld());
return 1; return 1;
} }
/* GETTERS */ /* GETTERS */
int GetInt32Value(Eluna* E, Object* obj) int GetInt32Value(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
uint16 index = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
Eluna::Push(E->L, obj->GetInt32Value(index)); Eluna::Push(L, obj->GetInt32Value(index));
return 1; return 1;
} }
int GetUInt32Value(Eluna* E, Object* obj) int GetUInt32Value(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
uint16 index = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
Eluna::Push(E->L, obj->GetUInt32Value(index)); Eluna::Push(L, obj->GetUInt32Value(index));
return 1; return 1;
} }
int GetFloatValue(Eluna* E, Object* obj) int GetFloatValue(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
uint16 index = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
Eluna::Push(E->L, obj->GetFloatValue(index)); Eluna::Push(L, obj->GetFloatValue(index));
return 1; return 1;
} }
int GetByteValue(Eluna* E, Object* obj) int GetByteValue(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
uint16 index = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint8 offset = Eluna::CHECKVAL<uint8>(E->L, 3); uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
Eluna::Push(E->L, obj->GetByteValue(index, offset)); Eluna::Push(L, obj->GetByteValue(index, offset));
return 1; return 1;
} }
int GetUInt16Value(Eluna* E, Object* obj) int GetUInt16Value(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
uint16 index = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint8 offset = Eluna::CHECKVAL<uint8>(E->L, 3); uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
Eluna::Push(E->L, obj->GetUInt16Value(index, offset)); Eluna::Push(L, obj->GetUInt16Value(index, offset));
return 1; return 1;
} }
int GetScale(Eluna* E, Object* obj) int GetScale(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
Eluna::Push(E->L, obj->GetObjectScale()); Eluna::Push(L, obj->GetObjectScale());
return 1; return 1;
} }
int GetEntry(Eluna* E, Object* obj) int GetEntry(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
Eluna::Push(E->L, obj->GetEntry()); Eluna::Push(L, obj->GetEntry());
return 1; return 1;
} }
int GetGUID(Eluna* E, Object* obj) int GetGUID(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
Eluna::Push(E->L, obj->GET_GUID()); Eluna::Push(L, obj->GET_GUID());
return 1; return 1;
} }
int GetGUIDLow(Eluna* E, Object* obj) int GetGUIDLow(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
Eluna::Push(E->L, obj->GetGUIDLow()); Eluna::Push(L, obj->GetGUIDLow());
return 1; return 1;
} }
int GetTypeId(Eluna* E, Object* obj) int GetTypeId(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
Eluna::Push(E->L, obj->GetTypeId()); Eluna::Push(L, obj->GetTypeId());
return 1; return 1;
} }
int GetUInt64Value(Eluna* E, Object* obj) int GetUInt64Value(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
uint16 index = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
obj->GetUInt64Value(index); obj->GetUInt64Value(index);
return 0; return 0;
} }
/* SETTERS */ /* SETTERS */
int SetFlag(Eluna* E, Object* obj) int SetFlag(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
uint16 index = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint32 flag = Eluna::CHECKVAL<uint32>(E->L, 3); uint32 flag = Eluna::CHECKVAL<uint32>(L, 3);
obj->SetFlag(index, flag); obj->SetFlag(index, flag);
return 0; return 0;
} }
int SetInt32Value(Eluna* E, Object* obj) int SetInt32Value(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
uint16 index = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
int32 value = Eluna::CHECKVAL<int32>(E->L, 3); int32 value = Eluna::CHECKVAL<int32>(L, 3);
obj->SetInt32Value(index, value); obj->SetInt32Value(index, value);
return 0; return 0;
} }
int SetUInt32Value(Eluna* E, Object* obj) int SetUInt32Value(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
uint16 index = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint32 value = Eluna::CHECKVAL<uint32>(E->L, 3); uint32 value = Eluna::CHECKVAL<uint32>(L, 3);
obj->SetUInt32Value(index, value); obj->SetUInt32Value(index, value);
return 0; return 0;
} }
int SetFloatValue(Eluna* E, Object* obj) int SetFloatValue(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
uint16 index = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
float value = Eluna::CHECKVAL<float>(E->L, 3); float value = Eluna::CHECKVAL<float>(L, 3);
obj->SetFloatValue(index, value); obj->SetFloatValue(index, value);
return 0; return 0;
} }
int SetByteValue(Eluna* E, Object* obj) int SetByteValue(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
uint16 index = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint8 offset = Eluna::CHECKVAL<uint8>(E->L, 3); uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
uint8 value = Eluna::CHECKVAL<uint8>(E->L, 4); uint8 value = Eluna::CHECKVAL<uint8>(L, 4);
obj->SetByteValue(index, offset, value); obj->SetByteValue(index, offset, value);
return 0; return 0;
} }
int SetUInt16Value(Eluna* E, Object* obj) int SetUInt16Value(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
uint16 index = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint8 offset = Eluna::CHECKVAL<uint8>(E->L, 3); uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
uint16 value = Eluna::CHECKVAL<uint16>(E->L, 4); uint16 value = Eluna::CHECKVAL<uint16>(L, 4);
obj->SetUInt16Value(index, offset, value); obj->SetUInt16Value(index, offset, value);
return 0; return 0;
} }
int SetInt16Value(Eluna* E, Object* obj) int SetInt16Value(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
uint16 index = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint8 offset = Eluna::CHECKVAL<uint8>(E->L, 3); uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
int16 value = Eluna::CHECKVAL<int16>(E->L, 4); int16 value = Eluna::CHECKVAL<int16>(L, 4);
obj->SetInt16Value(index, offset, value); obj->SetInt16Value(index, offset, value);
return 0; return 0;
} }
int SetScale(Eluna* E, Object* obj) int SetScale(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
float size = Eluna::CHECKVAL<float>(E->L, 2); float size = Eluna::CHECKVAL<float>(L, 2);
obj->SetObjectScale(size); obj->SetObjectScale(size);
return 0; return 0;
} }
int SetUInt64Value(Eluna* E, Object* obj) int SetUInt64Value(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
uint16 index = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint64 value = Eluna::CHECKVAL<uint64>(E->L, 3); uint64 value = Eluna::CHECKVAL<uint64>(L, 3);
obj->SetUInt64Value(index, value); obj->SetUInt64Value(index, value);
return 0; return 0;
} }
/* OTHER */ /* OTHER */
int RemoveFlag(Eluna* E, Object* obj) int RemoveFlag(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
uint16 index = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint32 flag = Eluna::CHECKVAL<uint32>(E->L, 3); uint32 flag = Eluna::CHECKVAL<uint32>(L, 3);
obj->RemoveFlag(index, flag); obj->RemoveFlag(index, flag);
return 0; return 0;
} }
int UpdateUInt32Value(Eluna* E, Object* obj) int UpdateUInt32Value(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
uint16 index = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint32 value = Eluna::CHECKVAL<uint32>(E->L, 3); uint32 value = Eluna::CHECKVAL<uint32>(L, 3);
obj->UpdateUInt32Value(index, value); obj->UpdateUInt32Value(index, value);
return 0; return 0;
} }
int ToCorpse(Eluna* E, Object* obj) int ToCorpse(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
Eluna::Push(E->L, obj->ToCorpse()); Eluna::Push(L, obj->ToCorpse());
return 1; return 1;
} }
int ToGameObject(Eluna* E, Object* obj) int ToGameObject(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
Eluna::Push(E->L, obj->ToGameObject()); Eluna::Push(L, obj->ToGameObject());
return 1; return 1;
} }
int ToUnit(Eluna* E, Object* obj) int ToUnit(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
Eluna::Push(E->L, obj->ToUnit()); Eluna::Push(L, obj->ToUnit());
return 1; return 1;
} }
int ToCreature(Eluna* E, Object* obj) int ToCreature(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
Eluna::Push(E->L, obj->ToCreature()); Eluna::Push(L, obj->ToCreature());
return 1; return 1;
} }
int ToPlayer(Eluna* E, Object* obj) int ToPlayer(Eluna* /*E*/, lua_State* L, Object* obj)
{ {
Eluna::Push(E->L, obj->ToPlayer()); Eluna::Push(L, obj->ToPlayer());
return 1; return 1;
} }
}; };

File diff suppressed because it is too large Load Diff

View File

@@ -46,13 +46,13 @@ namespace LuaQuest
* @param uint32 flag : all available flags can be seen above * @param uint32 flag : all available flags can be seen above
* @return bool hasFlag * @return bool hasFlag
*/ */
int HasFlag(Eluna* E, Quest* quest) int HasFlag(Eluna* /*E*/, lua_State* L, Quest* quest)
{ {
uint32 flag = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 flag = Eluna::CHECKVAL<uint32>(L, 2);
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, quest->HasQuestFlag((QuestFlags)flag)); Eluna::Push(L, quest->HasQuestFlag((QuestFlags)flag));
#else #else
Eluna::Push(E->L, quest->HasFlag(flag)); Eluna::Push(L, quest->HasFlag(flag));
#endif #endif
return 1; return 1;
} }
@@ -63,9 +63,9 @@ namespace LuaQuest
* *
* @return bool isDaily * @return bool isDaily
*/ */
int IsDaily(Eluna* E, Quest* quest) int IsDaily(Eluna* /*E*/, lua_State* L, Quest* quest)
{ {
Eluna::Push(E->L, quest->IsDaily()); Eluna::Push(L, quest->IsDaily());
return 1; return 1;
} }
#endif #endif
@@ -75,9 +75,9 @@ namespace LuaQuest
* *
* @return bool isRepeatable * @return bool isRepeatable
*/ */
int IsRepeatable(Eluna* E, Quest* quest) int IsRepeatable(Eluna* /*E*/, lua_State* L, Quest* quest)
{ {
Eluna::Push(E->L, quest->IsRepeatable()); Eluna::Push(L, quest->IsRepeatable());
return 1; return 1;
} }
@@ -86,9 +86,9 @@ namespace LuaQuest
* *
* @return uint32 entryId * @return uint32 entryId
*/ */
int GetId(Eluna* E, Quest* quest) int GetId(Eluna* /*E*/, lua_State* L, Quest* quest)
{ {
Eluna::Push(E->L, quest->GetQuestId()); Eluna::Push(L, quest->GetQuestId());
return 1; return 1;
} }
@@ -97,9 +97,9 @@ namespace LuaQuest
* *
* @return uint32 level * @return uint32 level
*/ */
int GetLevel(Eluna* E, Quest* quest) int GetLevel(Eluna* /*E*/, lua_State* L, Quest* quest)
{ {
Eluna::Push(E->L, quest->GetQuestLevel()); Eluna::Push(L, quest->GetQuestLevel());
return 1; return 1;
} }
@@ -108,9 +108,9 @@ namespace LuaQuest
* *
* @return uint32 minLevel * @return uint32 minLevel
*/ */
int GetMinLevel(Eluna* E, Quest* quest) int GetMinLevel(Eluna* /*E*/, lua_State* L, Quest* quest)
{ {
Eluna::Push(E->L, quest->GetMinLevel()); Eluna::Push(L, quest->GetMinLevel());
return 1; return 1;
} }
@@ -119,9 +119,9 @@ namespace LuaQuest
* *
* @return int32 entryId * @return int32 entryId
*/ */
int GetNextQuestId(Eluna* E, Quest* quest) int GetNextQuestId(Eluna* /*E*/, lua_State* L, Quest* quest)
{ {
Eluna::Push(E->L, quest->GetNextQuestId()); Eluna::Push(L, quest->GetNextQuestId());
return 1; return 1;
} }
@@ -130,9 +130,9 @@ namespace LuaQuest
* *
* @return int32 entryId * @return int32 entryId
*/ */
int GetPrevQuestId(Eluna* E, Quest* quest) int GetPrevQuestId(Eluna* /*E*/, lua_State* L, Quest* quest)
{ {
Eluna::Push(E->L, quest->GetPrevQuestId()); Eluna::Push(L, quest->GetPrevQuestId());
return 1; return 1;
} }
@@ -141,9 +141,9 @@ namespace LuaQuest
* *
* @return int32 entryId * @return int32 entryId
*/ */
int GetNextQuestInChain(Eluna* E, Quest* quest) int GetNextQuestInChain(Eluna* /*E*/, lua_State* L, Quest* quest)
{ {
Eluna::Push(E->L, quest->GetNextQuestInChain()); Eluna::Push(L, quest->GetNextQuestInChain());
return 1; return 1;
} }
@@ -152,12 +152,12 @@ namespace LuaQuest
* *
* @return uint32 flags * @return uint32 flags
*/ */
int GetFlags(Eluna* E, Quest* quest) int GetFlags(Eluna* /*E*/, lua_State* L, Quest* quest)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, quest->GetQuestFlags()); Eluna::Push(L, quest->GetQuestFlags());
#else #else
Eluna::Push(E->L, quest->GetFlags()); Eluna::Push(L, quest->GetFlags());
#endif #endif
return 1; return 1;
} }
@@ -169,15 +169,15 @@ namespace LuaQuest
* *
* @return uint32 type * @return uint32 type
*/ */
int GetType(Eluna* E, Quest* quest) int GetType(Eluna* /*E*/, lua_State* L, Quest* quest)
{ {
Eluna::Push(E->L, quest->GetType()); Eluna::Push(L, quest->GetType());
return 1; return 1;
} }
/*int GetMaxLevel(Eluna* E, Quest* quest) /*int GetMaxLevel(Eluna* E, lua_State* L, Quest* quest)
{ {
Eluna::Push(E->L, quest->GetMaxLevel()); Eluna::Push(L, quest->GetMaxLevel());
return 1; return 1;
}*/ }*/
}; };

View File

@@ -14,9 +14,9 @@ namespace LuaSpell
* *
* @return bool isAutoRepeating * @return bool isAutoRepeating
*/ */
int IsAutoRepeat(Eluna* E, Spell* spell) int IsAutoRepeat(Eluna* /*E*/, lua_State* L, Spell* spell)
{ {
Eluna::Push(E->L, spell->IsAutoRepeat()); Eluna::Push(L, spell->IsAutoRepeat());
return 1; return 1;
} }
@@ -25,9 +25,9 @@ namespace LuaSpell
* *
* @return [Unit] caster * @return [Unit] caster
*/ */
int GetCaster(Eluna* E, Spell* spell) int GetCaster(Eluna* /*E*/, lua_State* L, Spell* spell)
{ {
Eluna::Push(E->L, spell->GetCaster()); Eluna::Push(L, spell->GetCaster());
return 1; return 1;
} }
@@ -36,9 +36,9 @@ namespace LuaSpell
* *
* @return int32 castTime * @return int32 castTime
*/ */
int GetCastTime(Eluna* E, Spell* spell) int GetCastTime(Eluna* /*E*/, lua_State* L, Spell* spell)
{ {
Eluna::Push(E->L, spell->GetCastTime()); Eluna::Push(L, spell->GetCastTime());
return 1; return 1;
} }
@@ -47,9 +47,9 @@ namespace LuaSpell
* *
* @return uint32 entryId * @return uint32 entryId
*/ */
int GetEntry(Eluna* E, Spell* spell) int GetEntry(Eluna* /*E*/, lua_State* L, Spell* spell)
{ {
Eluna::Push(E->L, spell->m_spellInfo->Id); Eluna::Push(L, spell->m_spellInfo->Id);
return 1; return 1;
} }
@@ -58,9 +58,9 @@ namespace LuaSpell
* *
* @return uint32 powerCost * @return uint32 powerCost
*/ */
int GetPowerCost(Eluna* E, Spell* spell) int GetPowerCost(Eluna* /*E*/, lua_State* L, Spell* spell)
{ {
Eluna::Push(E->L, spell->GetPowerCost()); Eluna::Push(L, spell->GetPowerCost());
return 1; return 1;
} }
@@ -69,12 +69,12 @@ namespace LuaSpell
* *
* @return int32 duration * @return int32 duration
*/ */
int GetDuration(Eluna* E, Spell* spell) int GetDuration(Eluna* /*E*/, lua_State* L, Spell* spell)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, GetSpellDuration(spell->m_spellInfo)); Eluna::Push(L, GetSpellDuration(spell->m_spellInfo));
#else #else
Eluna::Push(E->L, spell->GetSpellInfo()->GetDuration()); Eluna::Push(L, spell->GetSpellInfo()->GetDuration());
#endif #endif
return 1; return 1;
} }
@@ -86,7 +86,7 @@ namespace LuaSpell
* @return float y : y coordinate of the [Spell] * @return float y : y coordinate of the [Spell]
* @return float z : z coordinate of the [Spell] * @return float z : z coordinate of the [Spell]
*/ */
int GetTargetDest(Eluna* E, Spell* spell) int GetTargetDest(Eluna* /*E*/, lua_State* L, Spell* spell)
{ {
#ifndef TRINITY #ifndef TRINITY
if (!(spell->m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)) if (!(spell->m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION))
@@ -99,9 +99,9 @@ namespace LuaSpell
float x, y, z; float x, y, z;
spell->m_targets.GetDstPos()->GetPosition(x, y, z); spell->m_targets.GetDstPos()->GetPosition(x, y, z);
#endif #endif
Eluna::Push(E->L, x); Eluna::Push(L, x);
Eluna::Push(E->L, y); Eluna::Push(L, y);
Eluna::Push(E->L, z); Eluna::Push(L, z);
return 3; return 3;
} }
@@ -111,28 +111,28 @@ namespace LuaSpell
* *
* @return [Object] target * @return [Object] target
*/ */
int GetTarget(Eluna* E, Spell* spell) int GetTarget(Eluna* /*E*/, lua_State* L, Spell* spell)
{ {
#ifndef TRINITY #ifndef TRINITY
if (GameObject* target = spell->m_targets.getGOTarget()) if (GameObject* target = spell->m_targets.getGOTarget())
Eluna::Push(E->L, target); Eluna::Push(L, target);
else if (Item* target = spell->m_targets.getItemTarget()) else if (Item* target = spell->m_targets.getItemTarget())
Eluna::Push(E->L, target); Eluna::Push(L, target);
else if (Corpse* target = spell->GetCaster()->GetMap()->GetCorpse(spell->m_targets.getCorpseTargetGuid())) else if (Corpse* target = spell->GetCaster()->GetMap()->GetCorpse(spell->m_targets.getCorpseTargetGuid()))
Eluna::Push(E->L, target); Eluna::Push(L, target);
else if (Unit* target = spell->m_targets.getUnitTarget()) else if (Unit* target = spell->m_targets.getUnitTarget())
Eluna::Push(E->L, target); Eluna::Push(L, target);
#else #else
if (GameObject* target = spell->m_targets.GetGOTarget()) if (GameObject* target = spell->m_targets.GetGOTarget())
Eluna::Push(E->L, target); Eluna::Push(L, target);
else if (Item* target = spell->m_targets.GetItemTarget()) else if (Item* target = spell->m_targets.GetItemTarget())
Eluna::Push(E->L, target); Eluna::Push(L, target);
else if (Corpse* target = spell->m_targets.GetCorpseTarget()) else if (Corpse* target = spell->m_targets.GetCorpseTarget())
Eluna::Push(E->L, target); Eluna::Push(L, target);
else if (Unit* target = spell->m_targets.GetUnitTarget()) else if (Unit* target = spell->m_targets.GetUnitTarget())
Eluna::Push(E->L, target); Eluna::Push(L, target);
else if (WorldObject* target = spell->m_targets.GetObjectTarget()) else if (WorldObject* target = spell->m_targets.GetObjectTarget())
Eluna::Push(E->L, target); Eluna::Push(L, target);
#endif #endif
return 1; return 1;
} }
@@ -142,9 +142,9 @@ namespace LuaSpell
* *
* @param bool repeat : set variable to 'true' for spell to automatically repeat * @param bool repeat : set variable to 'true' for spell to automatically repeat
*/ */
int SetAutoRepeat(Eluna* E, Spell* spell) int SetAutoRepeat(Eluna* /*E*/, lua_State* L, Spell* spell)
{ {
bool repeat = Eluna::CHECKVAL<bool>(E->L, 2); bool repeat = Eluna::CHECKVAL<bool>(L, 2);
spell->SetAutoRepeat(repeat); spell->SetAutoRepeat(repeat);
return 0; return 0;
} }
@@ -154,9 +154,9 @@ namespace LuaSpell
* *
* @param bool skipCheck = false : skips initial checks to see if the [Spell] can be casted or not, this is optional * @param bool skipCheck = false : skips initial checks to see if the [Spell] can be casted or not, this is optional
*/ */
int Cast(Eluna* E, Spell* spell) int Cast(Eluna* /*E*/, lua_State* L, Spell* spell)
{ {
bool skipCheck = Eluna::CHECKVAL<bool>(E->L, 2, false); bool skipCheck = Eluna::CHECKVAL<bool>(L, 2, false);
spell->cast(skipCheck); spell->cast(skipCheck);
return 0; return 0;
} }
@@ -165,7 +165,7 @@ namespace LuaSpell
* Cancels the [Spell]. * Cancels the [Spell].
* *
*/ */
int Cancel(Eluna* /*E*/, Spell* spell) int Cancel(Eluna* /*E*/, lua_State* /*L*/, Spell* spell)
{ {
spell->cancel(); spell->cancel();
return 0; return 0;
@@ -175,7 +175,7 @@ namespace LuaSpell
* Finishes the [Spell]. * Finishes the [Spell].
* *
*/ */
int Finish(Eluna* /*E*/, Spell* spell) int Finish(Eluna* /*E*/, lua_State* /*L*/, Spell* spell)
{ {
spell->finish(); spell->finish();
return 0; return 0;

File diff suppressed because it is too large Load Diff

View File

@@ -12,50 +12,50 @@
namespace LuaVehicle namespace LuaVehicle
{ {
/* BOOLEAN */ /* BOOLEAN */
int IsOnBoard(Eluna* E, Vehicle* vehicle) int IsOnBoard(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
{ {
Unit* passenger = Eluna::CHECKOBJ<Unit>(E->L, 2); Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, vehicle->HasOnBoard(passenger)); Eluna::Push(L, vehicle->HasOnBoard(passenger));
#else #else
Eluna::Push(E->L, passenger->IsOnVehicle(vehicle->GetBase())); Eluna::Push(L, passenger->IsOnVehicle(vehicle->GetBase()));
#endif #endif
return 1; return 1;
} }
/* GETTERS */ /* GETTERS */
int GetOwner(Eluna* E, Vehicle* vehicle) int GetOwner(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, vehicle->GetOwner()); Eluna::Push(L, vehicle->GetOwner());
#else #else
Eluna::Push(E->L, vehicle->GetBase()); Eluna::Push(L, vehicle->GetBase());
#endif #endif
return 1; return 1;
} }
int GetEntry(Eluna* E, Vehicle* vehicle) int GetEntry(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, vehicle->GetVehicleEntry()->m_ID); Eluna::Push(L, vehicle->GetVehicleEntry()->m_ID);
#else #else
Eluna::Push(E->L, vehicle->GetVehicleInfo()->m_ID); Eluna::Push(L, vehicle->GetVehicleInfo()->m_ID);
#endif #endif
return 1; return 1;
} }
int GetPassenger(Eluna* E, Vehicle* vehicle) int GetPassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
{ {
int8 seatId = Eluna::CHECKVAL<int8>(E->L, 2); int8 seatId = Eluna::CHECKVAL<int8>(L, 2);
Eluna::Push(E->L, vehicle->GetPassenger(seatId)); Eluna::Push(L, vehicle->GetPassenger(seatId));
return 1; return 1;
} }
/* OTHER */ /* OTHER */
int AddPassenger(Eluna* E, Vehicle* vehicle) int AddPassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
{ {
Unit* passenger = Eluna::CHECKOBJ<Unit>(E->L, 2); Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
int8 seatId = Eluna::CHECKVAL<int8>(E->L, 3); int8 seatId = Eluna::CHECKVAL<int8>(L, 3);
#ifndef TRINITY #ifndef TRINITY
if (vehicle->CanBoard(passenger)) if (vehicle->CanBoard(passenger))
vehicle->Board(passenger, seatId); vehicle->Board(passenger, seatId);
@@ -65,9 +65,9 @@ namespace LuaVehicle
return 0; return 0;
} }
int RemovePassenger(Eluna* E, Vehicle* vehicle) int RemovePassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
{ {
Unit* passenger = Eluna::CHECKOBJ<Unit>(E->L, 2); Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
#ifndef TRINITY #ifndef TRINITY
vehicle->UnBoard(passenger, false); vehicle->UnBoard(passenger, false);
#else #else

View File

@@ -14,9 +14,9 @@ namespace LuaWeather
* *
* @return uint32 zoneId * @return uint32 zoneId
*/ */
int GetZoneId(Eluna* E, Weather* weather) int GetZoneId(Eluna* /*E*/, lua_State* L, Weather* weather)
{ {
Eluna::Push(E->L, weather->GetZone()); Eluna::Push(L, weather->GetZone());
return 1; return 1;
} }
@@ -38,10 +38,10 @@ namespace LuaWeather
* @param WeatherType type : the [WeatherType], see above available weather types * @param WeatherType type : the [WeatherType], see above available weather types
* @param float grade : the intensity/grade of the [Weather], ranges from 0 to 1 * @param float grade : the intensity/grade of the [Weather], ranges from 0 to 1
*/ */
int SetWeather(Eluna* E, Weather* weather) int SetWeather(Eluna* /*E*/, lua_State* L, Weather* weather)
{ {
uint32 weatherType = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 weatherType = Eluna::CHECKVAL<uint32>(L, 2);
float grade = Eluna::CHECKVAL<float>(E->L, 3); float grade = Eluna::CHECKVAL<float>(L, 3);
weather->SetWeather((WeatherType)weatherType, grade); weather->SetWeather((WeatherType)weatherType, grade);
return 0; return 0;
@@ -52,9 +52,9 @@ namespace LuaWeather
* *
* @param [Player] player * @param [Player] player
*/ */
int SendWeatherUpdateToPlayer(Eluna* E, Weather* weather) int SendWeatherUpdateToPlayer(Eluna* /*E*/, lua_State* L, Weather* weather)
{ {
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
weather->SendWeatherUpdateToPlayer(player); weather->SendWeatherUpdateToPlayer(player);
return 0; return 0;
@@ -70,9 +70,9 @@ namespace LuaWeather
* *
* @return bool changed : returns 'true' if [Weather] changed * @return bool changed : returns 'true' if [Weather] changed
*/ */
int Regenerate(Eluna* E, Weather* weather) int Regenerate(Eluna* /*E*/, lua_State* L, Weather* weather)
{ {
Eluna::Push(E->L, weather->ReGenerate()); Eluna::Push(L, weather->ReGenerate());
return 1; return 1;
} }
@@ -81,9 +81,9 @@ namespace LuaWeather
* *
* @param bool changed : returns 'true' if weather changed for any [Player] in the zone, 'false' if no [Player] is within the zone * @param bool changed : returns 'true' if weather changed for any [Player] in the zone, 'false' if no [Player] is within the zone
*/ */
int UpdateWeather(Eluna* E, Weather* weather) int UpdateWeather(Eluna* /*E*/, lua_State* L, Weather* weather)
{ {
Eluna::Push(E->L, weather->UpdateWeather()); Eluna::Push(L, weather->UpdateWeather());
return 1; return 1;
} }
}; };

View File

@@ -14,9 +14,9 @@ namespace LuaWorldObject
* *
* @return string name * @return string name
*/ */
int GetName(Eluna* E, WorldObject* obj) int GetName(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
Eluna::Push(E->L, obj->GetName()); Eluna::Push(L, obj->GetName());
return 1; return 1;
} }
@@ -25,9 +25,9 @@ namespace LuaWorldObject
* *
* @return [Map] mapObject * @return [Map] mapObject
*/ */
int GetMap(Eluna* E, WorldObject* obj) int GetMap(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
Eluna::Push(E->L, obj->GetMap()); Eluna::Push(L, obj->GetMap());
return 1; return 1;
} }
@@ -37,9 +37,9 @@ namespace LuaWorldObject
* *
* @return uint32 phase * @return uint32 phase
*/ */
int GetPhaseMask(Eluna* E, WorldObject* obj) int GetPhaseMask(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
Eluna::Push(E->L, obj->GetPhaseMask()); Eluna::Push(L, obj->GetPhaseMask());
return 1; return 1;
} }
#endif #endif
@@ -49,9 +49,9 @@ namespace LuaWorldObject
* *
* @return uint32 instanceId * @return uint32 instanceId
*/ */
int GetInstanceId(Eluna* E, WorldObject* obj) int GetInstanceId(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
Eluna::Push(E->L, obj->GetInstanceId()); Eluna::Push(L, obj->GetInstanceId());
return 1; return 1;
} }
@@ -60,9 +60,9 @@ namespace LuaWorldObject
* *
* @return uint32 areaId * @return uint32 areaId
*/ */
int GetAreaId(Eluna* E, WorldObject* obj) int GetAreaId(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
Eluna::Push(E->L, obj->GetAreaId()); Eluna::Push(L, obj->GetAreaId());
return 1; return 1;
} }
@@ -71,9 +71,9 @@ namespace LuaWorldObject
* *
* @return uint32 zoneId * @return uint32 zoneId
*/ */
int GetZoneId(Eluna* E, WorldObject* obj) int GetZoneId(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
Eluna::Push(E->L, obj->GetZoneId()); Eluna::Push(L, obj->GetZoneId());
return 1; return 1;
} }
@@ -82,9 +82,9 @@ namespace LuaWorldObject
* *
* @return uint32 mapId * @return uint32 mapId
*/ */
int GetMapId(Eluna* E, WorldObject* obj) int GetMapId(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
Eluna::Push(E->L, obj->GetMapId()); Eluna::Push(L, obj->GetMapId());
return 1; return 1;
} }
@@ -93,9 +93,9 @@ namespace LuaWorldObject
* *
* @return float x * @return float x
*/ */
int GetX(Eluna* E, WorldObject* obj) int GetX(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
Eluna::Push(E->L, obj->GetPositionX()); Eluna::Push(L, obj->GetPositionX());
return 1; return 1;
} }
@@ -104,9 +104,9 @@ namespace LuaWorldObject
* *
* @return float y * @return float y
*/ */
int GetY(Eluna* E, WorldObject* obj) int GetY(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
Eluna::Push(E->L, obj->GetPositionY()); Eluna::Push(L, obj->GetPositionY());
return 1; return 1;
} }
@@ -115,9 +115,9 @@ namespace LuaWorldObject
* *
* @return float z * @return float z
*/ */
int GetZ(Eluna* E, WorldObject* obj) int GetZ(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
Eluna::Push(E->L, obj->GetPositionZ()); Eluna::Push(L, obj->GetPositionZ());
return 1; return 1;
} }
@@ -126,9 +126,9 @@ namespace LuaWorldObject
* *
* @return float orientation / facing * @return float orientation / facing
*/ */
int GetO(Eluna* E, WorldObject* obj) int GetO(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
Eluna::Push(E->L, obj->GetOrientation()); Eluna::Push(L, obj->GetOrientation());
return 1; return 1;
} }
@@ -140,12 +140,12 @@ namespace LuaWorldObject
* @return float z : z coordinate (height) of the [WorldObject] * @return float z : z coordinate (height) of the [WorldObject]
* @return float o : facing / orientation of the [WorldObject] * @return float o : facing / orientation of the [WorldObject]
*/ */
int GetLocation(Eluna* E, WorldObject* obj) int GetLocation(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
Eluna::Push(E->L, obj->GetPositionX()); Eluna::Push(L, obj->GetPositionX());
Eluna::Push(E->L, obj->GetPositionY()); Eluna::Push(L, obj->GetPositionY());
Eluna::Push(E->L, obj->GetPositionZ()); Eluna::Push(L, obj->GetPositionZ());
Eluna::Push(E->L, obj->GetOrientation()); Eluna::Push(L, obj->GetOrientation());
return 4; return 4;
} }
@@ -156,9 +156,9 @@ namespace LuaWorldObject
* *
* @return [Player] nearestPlayer * @return [Player] nearestPlayer
*/ */
int GetNearestPlayer(Eluna* E, WorldObject* obj) int GetNearestPlayer(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
float range = Eluna::CHECKVAL<float>(E->L, 2, SIZE_OF_GRIDS); float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
Unit* target = NULL; Unit* target = NULL;
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_PLAYER); ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_PLAYER);
@@ -170,7 +170,7 @@ namespace LuaWorldObject
obj->VisitNearbyObject(range, searcher); obj->VisitNearbyObject(range, searcher);
#endif #endif
Eluna::Push(E->L, target); Eluna::Push(L, target);
return 1; return 1;
} }
@@ -182,10 +182,10 @@ namespace LuaWorldObject
* *
* @return [GameObject] nearestGameObject * @return [GameObject] nearestGameObject
*/ */
int GetNearestGameObject(Eluna* E, WorldObject* obj) int GetNearestGameObject(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
float range = Eluna::CHECKVAL<float>(E->L, 2, SIZE_OF_GRIDS); float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
uint32 entry = Eluna::CHECKVAL<uint32>(E->L, 3, 0); uint32 entry = Eluna::CHECKVAL<uint32>(L, 3, 0);
GameObject* target = NULL; GameObject* target = NULL;
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_GAMEOBJECT, entry); ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_GAMEOBJECT, entry);
@@ -197,7 +197,7 @@ namespace LuaWorldObject
obj->VisitNearbyObject(range, searcher); obj->VisitNearbyObject(range, searcher);
#endif #endif
Eluna::Push(E->L, target); Eluna::Push(L, target);
return 1; return 1;
} }
@@ -209,10 +209,10 @@ namespace LuaWorldObject
* *
* @return [Creature] nearestCreature * @return [Creature] nearestCreature
*/ */
int GetNearestCreature(Eluna* E, WorldObject* obj) int GetNearestCreature(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
float range = Eluna::CHECKVAL<float>(E->L, 2, SIZE_OF_GRIDS); float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
uint32 entry = Eluna::CHECKVAL<uint32>(E->L, 3, 0); uint32 entry = Eluna::CHECKVAL<uint32>(L, 3, 0);
Creature* target = NULL; Creature* target = NULL;
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_UNIT, entry); ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_UNIT, entry);
@@ -224,7 +224,7 @@ namespace LuaWorldObject
obj->VisitNearbyObject(range, searcher); obj->VisitNearbyObject(range, searcher);
#endif #endif
Eluna::Push(E->L, target); Eluna::Push(L, target);
return 1; return 1;
} }
@@ -235,9 +235,9 @@ namespace LuaWorldObject
* *
* @return table playersInRange : table of [Player]s * @return table playersInRange : table of [Player]s
*/ */
int GetPlayersInRange(Eluna* E, WorldObject* obj) int GetPlayersInRange(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
float range = Eluna::CHECKVAL<float>(E->L, 2, SIZE_OF_GRIDS); float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
std::list<Player*> list; std::list<Player*> list;
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_PLAYER); ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_PLAYER);
@@ -249,18 +249,18 @@ namespace LuaWorldObject
obj->VisitNearbyObject(range, searcher); obj->VisitNearbyObject(range, searcher);
#endif #endif
lua_newtable(E->L); lua_newtable(L);
int tbl = lua_gettop(E->L); int tbl = lua_gettop(L);
uint32 i = 0; uint32 i = 0;
for (std::list<Player*>::const_iterator it = list.begin(); it != list.end(); ++it) for (std::list<Player*>::const_iterator it = list.begin(); it != list.end(); ++it)
{ {
Eluna::Push(E->L, ++i); Eluna::Push(L, ++i);
Eluna::Push(E->L, *it); Eluna::Push(L, *it);
lua_settable(E->L, tbl); lua_settable(L, tbl);
} }
lua_settop(E->L, tbl); lua_settop(L, tbl);
return 1; return 1;
} }
@@ -272,10 +272,10 @@ namespace LuaWorldObject
* *
* @return table creaturesInRange : table of [Creature]s * @return table creaturesInRange : table of [Creature]s
*/ */
int GetCreaturesInRange(Eluna* E, WorldObject* obj) int GetCreaturesInRange(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
float range = Eluna::CHECKVAL<float>(E->L, 2, SIZE_OF_GRIDS); float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
uint32 entry = Eluna::CHECKVAL<uint32>(E->L, 3, 0); uint32 entry = Eluna::CHECKVAL<uint32>(L, 3, 0);
std::list<Creature*> list; std::list<Creature*> list;
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_UNIT, entry); ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_UNIT, entry);
@@ -287,18 +287,18 @@ namespace LuaWorldObject
obj->VisitNearbyObject(range, searcher); obj->VisitNearbyObject(range, searcher);
#endif #endif
lua_newtable(E->L); lua_newtable(L);
int tbl = lua_gettop(E->L); int tbl = lua_gettop(L);
uint32 i = 0; uint32 i = 0;
for (std::list<Creature*>::const_iterator it = list.begin(); it != list.end(); ++it) for (std::list<Creature*>::const_iterator it = list.begin(); it != list.end(); ++it)
{ {
Eluna::Push(E->L, ++i); Eluna::Push(L, ++i);
Eluna::Push(E->L, *it); Eluna::Push(L, *it);
lua_settable(E->L, tbl); lua_settable(L, tbl);
} }
lua_settop(E->L, tbl); lua_settop(L, tbl);
return 1; return 1;
} }
@@ -310,10 +310,10 @@ namespace LuaWorldObject
* *
* @return table gameObjectsInRange : table of [GameObject]s * @return table gameObjectsInRange : table of [GameObject]s
*/ */
int GetGameObjectsInRange(Eluna* E, WorldObject* obj) int GetGameObjectsInRange(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
float range = Eluna::CHECKVAL<float>(E->L, 2, SIZE_OF_GRIDS); float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
uint32 entry = Eluna::CHECKVAL<uint32>(E->L, 3, 0); uint32 entry = Eluna::CHECKVAL<uint32>(L, 3, 0);
std::list<GameObject*> list; std::list<GameObject*> list;
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_GAMEOBJECT, entry); ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_GAMEOBJECT, entry);
@@ -325,18 +325,18 @@ namespace LuaWorldObject
obj->VisitNearbyObject(range, searcher); obj->VisitNearbyObject(range, searcher);
#endif #endif
lua_newtable(E->L); lua_newtable(L);
int tbl = lua_gettop(E->L); int tbl = lua_gettop(L);
uint32 i = 0; uint32 i = 0;
for (std::list<GameObject*>::const_iterator it = list.begin(); it != list.end(); ++it) for (std::list<GameObject*>::const_iterator it = list.begin(); it != list.end(); ++it)
{ {
Eluna::Push(E->L, ++i); Eluna::Push(L, ++i);
Eluna::Push(E->L, *it); Eluna::Push(L, *it);
lua_settable(E->L, tbl); lua_settable(L, tbl);
} }
lua_settop(E->L, tbl); lua_settop(L, tbl);
return 1; return 1;
} }
@@ -351,12 +351,12 @@ namespace LuaWorldObject
* *
* @return [WorldObject] worldObject * @return [WorldObject] worldObject
*/ */
int GetNearObject(Eluna* E, WorldObject* obj) int GetNearObject(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
float range = Eluna::CHECKVAL<float>(E->L, 2, SIZE_OF_GRIDS); float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
uint16 type = Eluna::CHECKVAL<uint16>(E->L, 3, 0); // TypeMask uint16 type = Eluna::CHECKVAL<uint16>(L, 3, 0); // TypeMask
uint32 entry = Eluna::CHECKVAL<uint32>(E->L, 4, 0); uint32 entry = Eluna::CHECKVAL<uint32>(L, 4, 0);
uint32 hostile = Eluna::CHECKVAL<uint32>(E->L, 5, 0); // 0 none, 1 hostile, 2 friendly uint32 hostile = Eluna::CHECKVAL<uint32>(L, 5, 0); // 0 none, 1 hostile, 2 friendly
float x, y, z; float x, y, z;
obj->GetPosition(x, y, z); obj->GetPosition(x, y, z);
@@ -371,7 +371,7 @@ namespace LuaWorldObject
obj->VisitNearbyObject(range, searcher); obj->VisitNearbyObject(range, searcher);
#endif #endif
Eluna::Push(E->L, target); Eluna::Push(L, target);
return 1; return 1;
} }
@@ -386,12 +386,12 @@ namespace LuaWorldObject
* *
* @return table worldObjectList : table of [WorldObject]s * @return table worldObjectList : table of [WorldObject]s
*/ */
int GetNearObjects(Eluna* E, WorldObject* obj) int GetNearObjects(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
float range = Eluna::CHECKVAL<float>(E->L, 2, SIZE_OF_GRIDS); float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
uint16 type = Eluna::CHECKVAL<uint16>(E->L, 3, 0); // TypeMask uint16 type = Eluna::CHECKVAL<uint16>(L, 3, 0); // TypeMask
uint32 entry = Eluna::CHECKVAL<uint32>(E->L, 4, 0); uint32 entry = Eluna::CHECKVAL<uint32>(L, 4, 0);
uint32 hostile = Eluna::CHECKVAL<uint32>(E->L, 5, 0); // 0 none, 1 hostile, 2 friendly uint32 hostile = Eluna::CHECKVAL<uint32>(L, 5, 0); // 0 none, 1 hostile, 2 friendly
float x, y, z; float x, y, z;
obj->GetPosition(x, y, z); obj->GetPosition(x, y, z);
@@ -406,18 +406,18 @@ namespace LuaWorldObject
obj->VisitNearbyObject(range, searcher); obj->VisitNearbyObject(range, searcher);
#endif #endif
lua_newtable(E->L); lua_newtable(L);
int tbl = lua_gettop(E->L); int tbl = lua_gettop(L);
uint32 i = 0; uint32 i = 0;
for (std::list<WorldObject*>::const_iterator it = list.begin(); it != list.end(); ++it) for (std::list<WorldObject*>::const_iterator it = list.begin(); it != list.end(); ++it)
{ {
Eluna::Push(E->L, ++i); Eluna::Push(L, ++i);
Eluna::Push(E->L, *it); Eluna::Push(L, *it);
lua_settable(E->L, tbl); lua_settable(L, tbl);
} }
lua_settop(E->L, tbl); lua_settop(L, tbl);
return 1; return 1;
} }
@@ -434,17 +434,17 @@ namespace LuaWorldObject
* *
* @return float dist : the distance in yards * @return float dist : the distance in yards
*/ */
int GetDistance(Eluna* E, WorldObject* obj) int GetDistance(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
WorldObject* target = Eluna::CHECKOBJ<WorldObject>(E->L, 2, false); WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2, false);
if (target && target->IsInWorld()) if (target && target->IsInWorld())
Eluna::Push(E->L, obj->GetDistance(target)); Eluna::Push(L, obj->GetDistance(target));
else else
{ {
float X = Eluna::CHECKVAL<float>(E->L, 2); float X = Eluna::CHECKVAL<float>(L, 2);
float Y = Eluna::CHECKVAL<float>(E->L, 3); float Y = Eluna::CHECKVAL<float>(L, 3);
float Z = Eluna::CHECKVAL<float>(E->L, 4); float Z = Eluna::CHECKVAL<float>(L, 4);
Eluna::Push(E->L, obj->GetDistance(X, Y, Z)); Eluna::Push(L, obj->GetDistance(X, Y, Z));
} }
return 1; return 1;
} }
@@ -459,17 +459,17 @@ namespace LuaWorldObject
* @return float y * @return float y
* @return float z * @return float z
*/ */
int GetRelativePoint(Eluna* E, WorldObject* obj) int GetRelativePoint(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
float dist = Eluna::CHECKVAL<float>(E->L, 2); float dist = Eluna::CHECKVAL<float>(L, 2);
float rad = Eluna::CHECKVAL<float>(E->L, 3); float rad = Eluna::CHECKVAL<float>(L, 3);
float x, y, z; float x, y, z;
obj->GetClosePoint(x, y, z, 0.0f, dist, rad); obj->GetClosePoint(x, y, z, 0.0f, dist, rad);
Eluna::Push(E->L, x); Eluna::Push(L, x);
Eluna::Push(E->L, y); Eluna::Push(L, y);
Eluna::Push(E->L, z); Eluna::Push(L, z);
return 3; return 3;
} }
@@ -486,17 +486,17 @@ namespace LuaWorldObject
* *
* @return float angle : angle in radians in range 0..2*pi * @return float angle : angle in radians in range 0..2*pi
*/ */
int GetAngle(Eluna* E, WorldObject* obj) int GetAngle(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
WorldObject* target = Eluna::CHECKOBJ<WorldObject>(E->L, 2, false); WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2, false);
if (target && target->IsInWorld()) if (target && target->IsInWorld())
Eluna::Push(E->L, obj->GetAngle(target)); Eluna::Push(L, obj->GetAngle(target));
else else
{ {
float x = Eluna::CHECKVAL<float>(E->L, 2); float x = Eluna::CHECKVAL<float>(L, 2);
float y = Eluna::CHECKVAL<float>(E->L, 3); float y = Eluna::CHECKVAL<float>(L, 3);
Eluna::Push(E->L, obj->GetAngle(x, y)); Eluna::Push(L, obj->GetAngle(x, y));
} }
return 1; return 1;
} }
@@ -506,9 +506,9 @@ namespace LuaWorldObject
* *
* @param [WorldPacket] packet * @param [WorldPacket] packet
*/ */
int SendPacket(Eluna* E, WorldObject* obj) int SendPacket(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(E->L, 2); WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
obj->SendMessageToSet(data, true); obj->SendMessageToSet(data, true);
return 0; return 0;
} }
@@ -524,18 +524,18 @@ namespace LuaWorldObject
* @param uint32 respawnDelay = 30 : respawn time in seconds * @param uint32 respawnDelay = 30 : respawn time in seconds
* @return [GameObject] gameObject * @return [GameObject] gameObject
*/ */
int SummonGameObject(Eluna* E, WorldObject* obj) int SummonGameObject(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
uint32 entry = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
float x = Eluna::CHECKVAL<float>(E->L, 3); float x = Eluna::CHECKVAL<float>(L, 3);
float y = Eluna::CHECKVAL<float>(E->L, 4); float y = Eluna::CHECKVAL<float>(L, 4);
float z = Eluna::CHECKVAL<float>(E->L, 5); float z = Eluna::CHECKVAL<float>(L, 5);
float o = Eluna::CHECKVAL<float>(E->L, 6); float o = Eluna::CHECKVAL<float>(L, 6);
uint32 respawnDelay = Eluna::CHECKVAL<uint32>(E->L, 7, 30); uint32 respawnDelay = Eluna::CHECKVAL<uint32>(L, 7, 30);
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(E->L, obj->SummonGameObject(entry, x, y, z, o, respawnDelay)); Eluna::Push(L, obj->SummonGameObject(entry, x, y, z, o, respawnDelay));
#else #else
Eluna::Push(E->L, obj->SummonGameObject(entry, x, y, z, o, 0, 0, 0, 0, respawnDelay)); Eluna::Push(L, obj->SummonGameObject(entry, x, y, z, o, 0, 0, 0, 0, respawnDelay));
#endif #endif
return 1; return 1;
} }
@@ -552,15 +552,15 @@ namespace LuaWorldObject
* @param uint32 despawnTimer : despawn time in seconds * @param uint32 despawnTimer : despawn time in seconds
* @return [Creature] spawnedCreature * @return [Creature] spawnedCreature
*/ */
int SpawnCreature(Eluna* E, WorldObject* obj) int SpawnCreature(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
uint32 entry = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
float x = Eluna::CHECKVAL<float>(E->L, 3); float x = Eluna::CHECKVAL<float>(L, 3);
float y = Eluna::CHECKVAL<float>(E->L, 4); float y = Eluna::CHECKVAL<float>(L, 4);
float z = Eluna::CHECKVAL<float>(E->L, 5); float z = Eluna::CHECKVAL<float>(L, 5);
float o = Eluna::CHECKVAL<float>(E->L, 6); float o = Eluna::CHECKVAL<float>(L, 6);
uint32 spawnType = Eluna::CHECKVAL<uint32>(E->L, 7, 8); uint32 spawnType = Eluna::CHECKVAL<uint32>(L, 7, 8);
uint32 despawnTimer = Eluna::CHECKVAL<uint32>(E->L, 8, 0); uint32 despawnTimer = Eluna::CHECKVAL<uint32>(L, 8, 0);
TempSummonType type; TempSummonType type;
switch (spawnType) switch (spawnType)
@@ -602,9 +602,9 @@ namespace LuaWorldObject
break; break;
#endif #endif
default: default:
return luaL_argerror(E->L, 7, "valid SpawnType expected"); return luaL_argerror(L, 7, "valid SpawnType expected");
} }
Eluna::Push(E->L, obj->SummonCreature(entry, x, y, z, o, type, despawnTimer)); Eluna::Push(L, obj->SummonCreature(entry, x, y, z, o, type, despawnTimer));
return 1; return 1;
} }
@@ -621,18 +621,18 @@ namespace LuaWorldObject
* @param uint32 repeats : how many times for the event to repeat, 0 is infinite * @param uint32 repeats : how many times for the event to repeat, 0 is infinite
* @return int eventId : unique ID for the timed event used to cancel it or nil * @return int eventId : unique ID for the timed event used to cancel it or nil
*/ */
int RegisterEvent(Eluna* E, WorldObject* obj) int RegisterEvent(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
luaL_checktype(E->L, 2, LUA_TFUNCTION); luaL_checktype(L, 2, LUA_TFUNCTION);
uint32 delay = Eluna::CHECKVAL<uint32>(E->L, 3); uint32 delay = Eluna::CHECKVAL<uint32>(L, 3);
uint32 repeats = Eluna::CHECKVAL<uint32>(E->L, 4); uint32 repeats = Eluna::CHECKVAL<uint32>(L, 4);
lua_pushvalue(E->L, 2); lua_pushvalue(L, 2);
int functionRef = luaL_ref(E->L, LUA_REGISTRYINDEX); int functionRef = luaL_ref(L, LUA_REGISTRYINDEX);
if (functionRef != LUA_REFNIL && functionRef != LUA_NOREF) if (functionRef != LUA_REFNIL && functionRef != LUA_NOREF)
{ {
obj->elunaEvents->AddEvent(functionRef, delay, repeats); obj->elunaEvents->AddEvent(functionRef, delay, repeats);
Eluna::Push(E->L, functionRef); Eluna::Push(L, functionRef);
} }
return 1; return 1;
} }
@@ -642,9 +642,9 @@ namespace LuaWorldObject
* *
* @param int eventId : event Id to remove * @param int eventId : event Id to remove
*/ */
int RemoveEventById(Eluna* E, WorldObject* obj) int RemoveEventById(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
int eventId = Eluna::CHECKVAL<int>(E->L, 2); int eventId = Eluna::CHECKVAL<int>(L, 2);
obj->elunaEvents->RemoveEvent(eventId); obj->elunaEvents->RemoveEvent(eventId);
return 0; return 0;
} }
@@ -653,7 +653,7 @@ namespace LuaWorldObject
* Removes all timed events from a [WorldObject] * Removes all timed events from a [WorldObject]
* *
*/ */
int RemoveEvents(Eluna* /*E*/, WorldObject* obj) int RemoveEvents(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
obj->elunaEvents->RemoveEvents(); obj->elunaEvents->RemoveEvents();
return 0; return 0;
@@ -671,18 +671,18 @@ namespace LuaWorldObject
* @param float z * @param float z
* @return bool isInLoS * @return bool isInLoS
*/ */
int IsWithinLoS(Eluna* E, WorldObject* obj) int IsWithinLoS(Eluna* /*E*/, lua_State* L, WorldObject* obj)
{ {
WorldObject* target = Eluna::CHECKOBJ<WorldObject>(E->L, 2, false); WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2, false);
if (target) if (target)
Eluna::Push(E->L, obj->IsWithinLOSInMap(target)); Eluna::Push(L, obj->IsWithinLOSInMap(target));
else else
{ {
float x = Eluna::CHECKVAL<float>(E->L, 2); float x = Eluna::CHECKVAL<float>(L, 2);
float y = Eluna::CHECKVAL<float>(E->L, 3); float y = Eluna::CHECKVAL<float>(L, 3);
float z = Eluna::CHECKVAL<float>(E->L, 4); float z = Eluna::CHECKVAL<float>(L, 4);
Eluna::Push(E->L, obj->IsWithinLOS(x, y, z)); Eluna::Push(L, obj->IsWithinLOS(x, y, z));
} }
return 1; return 1;

View File

@@ -14,9 +14,9 @@ namespace LuaPacket
* *
* @return uint16 opcode * @return uint16 opcode
*/ */
int GetOpcode(Eluna* E, WorldPacket* packet) int GetOpcode(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
Eluna::Push(E->L, packet->GetOpcode()); Eluna::Push(L, packet->GetOpcode());
return 1; return 1;
} }
@@ -25,9 +25,9 @@ namespace LuaPacket
* *
* @return uint32 size : size of [WorldPacket] * @return uint32 size : size of [WorldPacket]
*/ */
int GetSize(Eluna* E, WorldPacket* packet) int GetSize(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
Eluna::Push(E->L, packet->size()); Eluna::Push(L, packet->size());
return 1; return 1;
} }
@@ -36,11 +36,11 @@ namespace LuaPacket
* *
* @param uint32 opcode : the opcode specified to be set for the [WorldPacket] * @param uint32 opcode : the opcode specified to be set for the [WorldPacket]
*/ */
int SetOpcode(Eluna* E, WorldPacket* packet) int SetOpcode(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
uint32 opcode = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 opcode = Eluna::CHECKVAL<uint32>(L, 2);
if (opcode >= NUM_MSG_TYPES) if (opcode >= NUM_MSG_TYPES)
return luaL_argerror(E->L, 2, "valid opcode expected"); return luaL_argerror(L, 2, "valid opcode expected");
packet->SetOpcode((OpcodesList)opcode); packet->SetOpcode((OpcodesList)opcode);
return 0; return 0;
} }
@@ -50,11 +50,11 @@ namespace LuaPacket
* *
* @return int8 value * @return int8 value
*/ */
int ReadByte(Eluna* E, WorldPacket* packet) int ReadByte(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
int8 _byte; int8 _byte;
(*packet) >> _byte; (*packet) >> _byte;
Eluna::Push(E->L, _byte); Eluna::Push(L, _byte);
return 1; return 1;
} }
@@ -63,11 +63,11 @@ namespace LuaPacket
* *
* @return uint8 value * @return uint8 value
*/ */
int ReadUByte(Eluna* E, WorldPacket* packet) int ReadUByte(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
uint8 _ubyte; uint8 _ubyte;
(*packet) >> _ubyte; (*packet) >> _ubyte;
Eluna::Push(E->L, _ubyte); Eluna::Push(L, _ubyte);
return 1; return 1;
} }
@@ -76,11 +76,11 @@ namespace LuaPacket
* *
* @return int16 value * @return int16 value
*/ */
int ReadShort(Eluna* E, WorldPacket* packet) int ReadShort(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
int16 _short; int16 _short;
(*packet) >> _short; (*packet) >> _short;
Eluna::Push(E->L, _short); Eluna::Push(L, _short);
return 1; return 1;
} }
@@ -89,11 +89,11 @@ namespace LuaPacket
* *
* @return uint16 value * @return uint16 value
*/ */
int ReadUShort(Eluna* E, WorldPacket* packet) int ReadUShort(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
uint16 _ushort; uint16 _ushort;
(*packet) >> _ushort; (*packet) >> _ushort;
Eluna::Push(E->L, _ushort); Eluna::Push(L, _ushort);
return 1; return 1;
} }
@@ -102,11 +102,11 @@ namespace LuaPacket
* *
* @return int32 value * @return int32 value
*/ */
int ReadLong(Eluna* E, WorldPacket* packet) int ReadLong(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
int32 _long; int32 _long;
(*packet) >> _long; (*packet) >> _long;
Eluna::Push(E->L, _long); Eluna::Push(L, _long);
return 1; return 1;
} }
@@ -115,11 +115,11 @@ namespace LuaPacket
* *
* @return uint32 value * @return uint32 value
*/ */
int ReadULong(Eluna* E, WorldPacket* packet) int ReadULong(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
uint32 _ulong; uint32 _ulong;
(*packet) >> _ulong; (*packet) >> _ulong;
Eluna::Push(E->L, _ulong); Eluna::Push(L, _ulong);
return 1; return 1;
} }
@@ -128,11 +128,11 @@ namespace LuaPacket
* *
* @return float value * @return float value
*/ */
int ReadFloat(Eluna* E, WorldPacket* packet) int ReadFloat(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
float _val; float _val;
(*packet) >> _val; (*packet) >> _val;
Eluna::Push(E->L, _val); Eluna::Push(L, _val);
return 1; return 1;
} }
@@ -141,11 +141,11 @@ namespace LuaPacket
* *
* @return double value * @return double value
*/ */
int ReadDouble(Eluna* E, WorldPacket* packet) int ReadDouble(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
double _val; double _val;
(*packet) >> _val; (*packet) >> _val;
Eluna::Push(E->L, _val); Eluna::Push(L, _val);
return 1; return 1;
} }
@@ -154,11 +154,11 @@ namespace LuaPacket
* *
* @return uint64 value : value returned as string * @return uint64 value : value returned as string
*/ */
int ReadGUID(Eluna* E, WorldPacket* packet) int ReadGUID(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
uint64 guid; uint64 guid;
(*packet) >> guid; (*packet) >> guid;
Eluna::Push(E->L, guid); Eluna::Push(L, guid);
return 1; return 1;
} }
@@ -167,11 +167,11 @@ namespace LuaPacket
* *
* @return string value * @return string value
*/ */
int ReadString(Eluna* E, WorldPacket* packet) int ReadString(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
std::string _val; std::string _val;
(*packet) >> _val; (*packet) >> _val;
Eluna::Push(E->L, _val); Eluna::Push(L, _val);
return 1; return 1;
} }
@@ -180,9 +180,9 @@ namespace LuaPacket
* *
* @param uint64 value : the value to be written to the [WorldPacket] * @param uint64 value : the value to be written to the [WorldPacket]
*/ */
int WriteGUID(Eluna* E, WorldPacket* packet) int WriteGUID(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
uint64 guid = Eluna::CHECKVAL<uint64>(E->L, 2); uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
(*packet) << guid; (*packet) << guid;
return 0; return 0;
} }
@@ -192,9 +192,9 @@ namespace LuaPacket
* *
* @param string value : the string to be written to the [WorldPacket] * @param string value : the string to be written to the [WorldPacket]
*/ */
int WriteString(Eluna* E, WorldPacket* packet) int WriteString(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
std::string _val = Eluna::CHECKVAL<std::string>(E->L, 2); std::string _val = Eluna::CHECKVAL<std::string>(L, 2);
(*packet) << _val; (*packet) << _val;
return 0; return 0;
} }
@@ -204,9 +204,9 @@ namespace LuaPacket
* *
* @param int8 value : the int8 value to be written to the [WorldPacket] * @param int8 value : the int8 value to be written to the [WorldPacket]
*/ */
int WriteByte(Eluna* E, WorldPacket* packet) int WriteByte(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
int8 byte = Eluna::CHECKVAL<int8>(E->L, 2); int8 byte = Eluna::CHECKVAL<int8>(L, 2);
(*packet) << byte; (*packet) << byte;
return 0; return 0;
} }
@@ -216,9 +216,9 @@ namespace LuaPacket
* *
* @param uint8 value : the uint8 value to be written to the [WorldPacket] * @param uint8 value : the uint8 value to be written to the [WorldPacket]
*/ */
int WriteUByte(Eluna* E, WorldPacket* packet) int WriteUByte(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
uint8 byte = Eluna::CHECKVAL<uint8>(E->L, 2); uint8 byte = Eluna::CHECKVAL<uint8>(L, 2);
(*packet) << byte; (*packet) << byte;
return 0; return 0;
} }
@@ -228,9 +228,9 @@ namespace LuaPacket
* *
* @param int16 value : the int16 value to be written to the [WorldPacket] * @param int16 value : the int16 value to be written to the [WorldPacket]
*/ */
int WriteShort(Eluna* E, WorldPacket* packet) int WriteShort(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
int16 _short = Eluna::CHECKVAL<int16>(E->L, 2); int16 _short = Eluna::CHECKVAL<int16>(L, 2);
(*packet) << _short; (*packet) << _short;
return 0; return 0;
} }
@@ -240,9 +240,9 @@ namespace LuaPacket
* *
* @param uint16 value : the uint16 value to be written to the [WorldPacket] * @param uint16 value : the uint16 value to be written to the [WorldPacket]
*/ */
int WriteUShort(Eluna* E, WorldPacket* packet) int WriteUShort(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
uint16 _ushort = Eluna::CHECKVAL<uint16>(E->L, 2); uint16 _ushort = Eluna::CHECKVAL<uint16>(L, 2);
(*packet) << _ushort; (*packet) << _ushort;
return 0; return 0;
} }
@@ -252,9 +252,9 @@ namespace LuaPacket
* *
* @param int32 value : the int32 value to be written to the [WorldPacket] * @param int32 value : the int32 value to be written to the [WorldPacket]
*/ */
int WriteLong(Eluna* E, WorldPacket* packet) int WriteLong(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
int32 _long = Eluna::CHECKVAL<int32>(E->L, 2); int32 _long = Eluna::CHECKVAL<int32>(L, 2);
(*packet) << _long; (*packet) << _long;
return 0; return 0;
} }
@@ -264,9 +264,9 @@ namespace LuaPacket
* *
* @param uint32 value : the uint32 value to be written to the [WorldPacket] * @param uint32 value : the uint32 value to be written to the [WorldPacket]
*/ */
int WriteULong(Eluna* E, WorldPacket* packet) int WriteULong(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
uint32 _ulong = Eluna::CHECKVAL<uint32>(E->L, 2); uint32 _ulong = Eluna::CHECKVAL<uint32>(L, 2);
(*packet) << _ulong; (*packet) << _ulong;
return 0; return 0;
} }
@@ -276,9 +276,9 @@ namespace LuaPacket
* *
* @param float value : the float value to be written to the [WorldPacket] * @param float value : the float value to be written to the [WorldPacket]
*/ */
int WriteFloat(Eluna* E, WorldPacket* packet) int WriteFloat(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
float _val = Eluna::CHECKVAL<float>(E->L, 2); float _val = Eluna::CHECKVAL<float>(L, 2);
(*packet) << _val; (*packet) << _val;
return 0; return 0;
} }
@@ -288,9 +288,9 @@ namespace LuaPacket
* *
* @param double value : the double value to be written to the [WorldPacket] * @param double value : the double value to be written to the [WorldPacket]
*/ */
int WriteDouble(Eluna* E, WorldPacket* packet) int WriteDouble(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
{ {
double _val = Eluna::CHECKVAL<double>(E->L, 2); double _val = Eluna::CHECKVAL<double>(L, 2);
(*packet) << _val; (*packet) << _val;
return 0; return 0;
} }