From 967a8045eb3985b9a1c847c1dfcc4f5eab8b450d Mon Sep 17 00:00:00 2001 From: Patman64 Date: Mon, 15 Dec 2014 00:33:46 -0500 Subject: [PATCH] Fix calling Eluna functions from coroutines. Fixes #126. --- AuraMethods.h | 56 +- BattleGroundMethods.h | 80 +-- CorpseMethods.h | 20 +- CreatureMethods.h | 398 ++++++------- ElunaQueryMethods.h | 160 ++--- ElunaTemplate.h | 8 +- GameObjectMethods.h | 62 +- GlobalMethods.h | 742 +++++++++++------------ GroupMethods.h | 152 ++--- GuildMethods.h | 100 ++-- ItemMethods.h | 258 ++++---- MapMethods.h | 88 +-- ObjectMethods.h | 160 ++--- PlayerMethods.h | 1322 ++++++++++++++++++++--------------------- QuestMethods.h | 54 +- SpellMethods.h | 66 +- UnitMethods.h | 942 ++++++++++++++--------------- VehicleMethods.h | 36 +- WeatherMethods.h | 22 +- WorldObjectMethods.h | 276 ++++----- WorldPacketMethods.h | 94 +-- 21 files changed, 2548 insertions(+), 2548 deletions(-) diff --git a/AuraMethods.h b/AuraMethods.h index 76166eb..0370058 100644 --- a/AuraMethods.h +++ b/AuraMethods.h @@ -24,9 +24,9 @@ namespace LuaAura * * @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; } @@ -35,12 +35,12 @@ namespace LuaAura * * @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 - Eluna::Push(E->L, aura->GetCasterGuid()); + Eluna::Push(L, aura->GetCasterGuid()); #else - Eluna::Push(E->L, aura->GetCasterGUID()); + Eluna::Push(L, aura->GetCasterGUID()); #endif return 1; } @@ -50,9 +50,9 @@ namespace LuaAura * * @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; } @@ -61,12 +61,12 @@ namespace LuaAura * * @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 - Eluna::Push(E->L, aura->GetAuraDuration()); + Eluna::Push(L, aura->GetAuraDuration()); #else - Eluna::Push(E->L, aura->GetDuration()); + Eluna::Push(L, aura->GetDuration()); #endif return 1; } @@ -76,9 +76,9 @@ namespace LuaAura * * @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; } @@ -90,12 +90,12 @@ namespace LuaAura * * @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 - Eluna::Push(E->L, aura->GetAuraMaxDuration()); + Eluna::Push(L, aura->GetAuraMaxDuration()); #else - Eluna::Push(E->L, aura->GetMaxDuration()); + Eluna::Push(L, aura->GetMaxDuration()); #endif return 1; } @@ -107,9 +107,9 @@ namespace LuaAura * * @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; } @@ -118,12 +118,12 @@ namespace LuaAura * * @return [Unit] owner */ - int GetOwner(Eluna* E, Aura* aura) + int GetOwner(Eluna* /*E*/, lua_State* L, Aura* aura) { #ifndef TRINITY - Eluna::Push(E->L, aura->GetTarget()); + Eluna::Push(L, aura->GetTarget()); #else - Eluna::Push(E->L, aura->GetOwner()); + Eluna::Push(L, aura->GetOwner()); #endif return 1; } @@ -133,9 +133,9 @@ namespace LuaAura * * @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(E->L, 2); + int32 duration = Eluna::CHECKVAL(L, 2); #ifndef TRINITY aura->GetHolder()->SetAuraDuration(duration); #if (defined(TBC) || defined(CLASSIC)) @@ -157,9 +157,9 @@ namespace LuaAura * * @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(E->L, 2); + int32 duration = Eluna::CHECKVAL(L, 2); #ifndef TRINITY aura->GetHolder()->SetAuraMaxDuration(duration); #if (defined(TBC) || defined(CLASSIC)) @@ -181,9 +181,9 @@ namespace LuaAura * * @param uint32 amount */ - int SetStackAmount(Eluna* E, Aura* aura) + int SetStackAmount(Eluna* /*E*/, lua_State* L, Aura* aura) { - uint8 amount = Eluna::CHECKVAL(E->L, 2); + uint8 amount = Eluna::CHECKVAL(L, 2); #ifndef TRINITY aura->GetHolder()->SetStackAmount(amount); #else @@ -195,14 +195,14 @@ namespace LuaAura /** * 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 aura->GetTarget()->RemoveSpellAuraHolder(aura->GetHolder(), AURA_REMOVE_BY_CANCEL); #else aura->Remove(); #endif - Eluna::CHECKOBJ(E->L, 1)->Invalidate(); + Eluna::CHECKOBJ(L, 1)->Invalidate(); return 0; } }; diff --git a/BattleGroundMethods.h b/BattleGroundMethods.h index 0920a46..4349b3e 100644 --- a/BattleGroundMethods.h +++ b/BattleGroundMethods.h @@ -14,9 +14,9 @@ namespace LuaBattleGround * * @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; } @@ -26,11 +26,11 @@ namespace LuaBattleGround * @param uint32 team : team ID * @return uint32 count */ - int GetAlivePlayersCountByTeam(Eluna* E, BattleGround* bg) + int GetAlivePlayersCountByTeam(Eluna* /*E*/, lua_State* L, BattleGround* bg) { - uint32 team = Eluna::CHECKVAL(E->L, 2); + uint32 team = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, bg->GetAlivePlayersCountByTeam((Team)team)); + Eluna::Push(L, bg->GetAlivePlayersCountByTeam((Team)team)); return 1; } @@ -39,9 +39,9 @@ namespace LuaBattleGround * * @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; } @@ -51,11 +51,11 @@ namespace LuaBattleGround * @param uint32 kills : amount of kills * @return uint32 bonusHonor */ - int GetBonusHonorFromKillCount(Eluna* E, BattleGround* bg) + int GetBonusHonorFromKillCount(Eluna* /*E*/, lua_State* L, BattleGround* bg) { - uint32 kills = Eluna::CHECKVAL(E->L, 2); + uint32 kills = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, bg->GetBonusHonorFromKill(kills)); + Eluna::Push(L, bg->GetBonusHonorFromKill(kills)); return 1; } @@ -64,9 +64,9 @@ namespace LuaBattleGround * * @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; } @@ -75,12 +75,12 @@ namespace LuaBattleGround * * @return uint32 endTime */ - int GetEndTime(Eluna* E, BattleGround* bg) + int GetEndTime(Eluna* /*E*/, lua_State* L, BattleGround* bg) { #ifdef CATA - Eluna::Push(E->L, bg->GetRemainingTime()); + Eluna::Push(L, bg->GetRemainingTime()); #else - Eluna::Push(E->L, bg->GetEndTime()); + Eluna::Push(L, bg->GetEndTime()); #endif return 1; } @@ -91,11 +91,11 @@ namespace LuaBattleGround * @param uint32 team : team ID * @return uint32 freeSlots */ - int GetFreeSlotsForTeam(Eluna* E, BattleGround* bg) + int GetFreeSlotsForTeam(Eluna* /*E*/, lua_State* L, BattleGround* bg) { - uint32 team = Eluna::CHECKVAL(E->L, 2); + uint32 team = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, bg->GetFreeSlotsForTeam((Team)team)); + Eluna::Push(L, bg->GetFreeSlotsForTeam((Team)team)); return 1; } @@ -104,9 +104,9 @@ namespace LuaBattleGround * * @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; } @@ -115,9 +115,9 @@ namespace LuaBattleGround * * @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; } @@ -126,9 +126,9 @@ namespace LuaBattleGround * * @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; } @@ -137,9 +137,9 @@ namespace LuaBattleGround * * @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; } @@ -148,9 +148,9 @@ namespace LuaBattleGround * * @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; } @@ -159,9 +159,9 @@ namespace LuaBattleGround * * @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; } @@ -170,9 +170,9 @@ namespace LuaBattleGround * * @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; } @@ -181,9 +181,9 @@ namespace LuaBattleGround * * @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; } @@ -192,9 +192,9 @@ namespace LuaBattleGround * * @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; } @@ -203,9 +203,9 @@ namespace LuaBattleGround * * @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; } @@ -214,9 +214,9 @@ namespace LuaBattleGround * * @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; } }; diff --git a/CorpseMethods.h b/CorpseMethods.h index deb3ccc..3282295 100644 --- a/CorpseMethods.h +++ b/CorpseMethods.h @@ -14,12 +14,12 @@ namespace LuaCorpse * * @return uint64 ownerGUID */ - int GetOwnerGUID(Eluna* E, Corpse* corpse) + int GetOwnerGUID(Eluna* /*E*/, lua_State* L, Corpse* corpse) { #ifndef TRINITY - Eluna::Push(E->L, corpse->GetOwnerGuid()); + Eluna::Push(L, corpse->GetOwnerGuid()); #else - Eluna::Push(E->L, corpse->GetOwnerGUID()); + Eluna::Push(L, corpse->GetOwnerGUID()); #endif return 1; } @@ -29,9 +29,9 @@ namespace LuaCorpse * * @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; } @@ -49,9 +49,9 @@ namespace LuaCorpse * * @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; } @@ -59,7 +59,7 @@ namespace LuaCorpse * Resets the [Corpse] ghost time. * */ - int ResetGhostTime(Eluna* /*E*/, Corpse* corpse) + int ResetGhostTime(Eluna* /*E*/, lua_State* L, Corpse* corpse) { corpse->ResetGhostTime(); return 0; @@ -69,7 +69,7 @@ namespace LuaCorpse * Saves the [Corpse] to the database. * */ - int SaveToDB(Eluna* /*E*/, Corpse* corpse) + int SaveToDB(Eluna* /*E*/, lua_State* L, Corpse* corpse) { corpse->SaveToDB(); return 0; @@ -79,7 +79,7 @@ namespace LuaCorpse * Deletes the [Corpse] from the world. * */ - int DeleteBonesFromWorld(Eluna* /*E*/, Corpse* corpse) + int DeleteBonesFromWorld(Eluna* /*E*/, lua_State* L, Corpse* corpse) { corpse->DeleteBonesFromWorld(); return 0; diff --git a/CreatureMethods.h b/CreatureMethods.h index 95f6425..d9eefe2 100644 --- a/CreatureMethods.h +++ b/CreatureMethods.h @@ -22,9 +22,9 @@ namespace LuaCreature * * @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; } @@ -34,12 +34,12 @@ namespace LuaCreature * * @return bool regeneratesHealth */ - int CanRegenerateHealth(Eluna* E, Creature* creature) + int CanRegenerateHealth(Eluna* /*E*/, lua_State* L, Creature* creature) { #ifndef TRINITY - Eluna::Push(E->L, creature->IsRegeneratingHealth()); + Eluna::Push(L, creature->IsRegeneratingHealth()); #else - Eluna::Push(E->L, creature->isRegeneratingHealth()); + Eluna::Push(L, creature->isRegeneratingHealth()); #endif return 1; } @@ -51,14 +51,14 @@ namespace LuaCreature * @param uint32 questID : the ID of a [Quest] * @return bool completesQuest */ - int CanCompleteQuest(Eluna* E, Creature* creature) + int CanCompleteQuest(Eluna* /*E*/, lua_State* L, Creature* creature) { - uint32 quest_id = Eluna::CHECKVAL(E->L, 2); + uint32 quest_id = Eluna::CHECKVAL(L, 2); #ifndef TRINITY - Eluna::Push(E->L, creature->HasInvolvedQuest(quest_id)); + Eluna::Push(L, creature->HasInvolvedQuest(quest_id)); #else - Eluna::Push(E->L, creature->hasInvolvedQuest(quest_id)); + Eluna::Push(L, creature->hasInvolvedQuest(quest_id)); #endif 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. * @return bool targetable */ - int IsTargetableForAttack(Eluna* E, Creature* creature) + int IsTargetableForAttack(Eluna* /*E*/, lua_State* L, Creature* creature) { - bool mustBeDead = Eluna::CHECKVAL(E->L, 2, false); + bool mustBeDead = Eluna::CHECKVAL(L, 2, false); #ifdef MANGOS - Eluna::Push(E->L, creature->IsTargetableForAttack(mustBeDead)); + Eluna::Push(L, creature->IsTargetableForAttack(mustBeDead)); #else - Eluna::Push(E->L, creature->isTargetableForAttack(mustBeDead)); + Eluna::Push(L, creature->isTargetableForAttack(mustBeDead)); #endif 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 * @return bool canAssist */ - int CanAssistTo(Eluna* E, Creature* creature) + int CanAssistTo(Eluna* /*E*/, lua_State* L, Creature* creature) { - Unit* u = Eluna::CHECKOBJ(E->L, 2); - Unit* enemy = Eluna::CHECKOBJ(E->L, 3); - bool checkfaction = Eluna::CHECKVAL(E->L, 4, true); + Unit* u = Eluna::CHECKOBJ(L, 2); + Unit* enemy = Eluna::CHECKOBJ(L, 3); + bool checkfaction = Eluna::CHECKVAL(L, 4, true); - Eluna::Push(E->L, creature->CanAssistTo(u, enemy, checkfaction)); + Eluna::Push(L, creature->CanAssistTo(u, enemy, checkfaction)); return 1; } @@ -107,9 +107,9 @@ namespace LuaCreature * * @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; } @@ -119,14 +119,14 @@ namespace LuaCreature * * @return bool tapped */ - int IsTappedBy(Eluna* E, Creature* creature) + int IsTappedBy(Eluna* /*E*/, lua_State* L, Creature* creature) { - Player* player = Eluna::CHECKOBJ(E->L, 2); + Player* player = Eluna::CHECKOBJ(L, 2); #ifdef MANGOS - Eluna::Push(E->L, creature->IsTappedBy(player)); + Eluna::Push(L, creature->IsTappedBy(player)); #else - Eluna::Push(E->L, creature->isTappedBy(player)); + Eluna::Push(L, creature->isTappedBy(player)); #endif return 1; } @@ -137,12 +137,12 @@ namespace LuaCreature * * @return bool hasLootRecipient */ - int HasLootRecipient(Eluna* E, Creature* creature) + int HasLootRecipient(Eluna* /*E*/, lua_State* L, Creature* creature) { #ifndef TRINITY - Eluna::Push(E->L, creature->HasLootRecipient()); + Eluna::Push(L, creature->HasLootRecipient()); #else - Eluna::Push(E->L, creature->hasLootRecipient()); + Eluna::Push(L, creature->hasLootRecipient()); #endif return 1; } @@ -153,13 +153,13 @@ namespace LuaCreature * * @return bool canAggro */ - int CanAggro(Eluna* E, Creature* creature) + int CanAggro(Eluna* /*E*/, lua_State* L, Creature* creature) { #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 - // Eluna::Push(E->L, creature->CanInitiateAttack()); - Eluna::Push(E->L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)); + // Eluna::Push(L, creature->CanInitiateAttack()); + Eluna::Push(L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)); #endif return 1; } @@ -170,9 +170,9 @@ namespace LuaCreature * * @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; } @@ -182,9 +182,9 @@ namespace LuaCreature * * @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; } @@ -194,9 +194,9 @@ namespace LuaCreature * * @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; } @@ -206,12 +206,12 @@ namespace LuaCreature * * @return bool isElite */ - int IsElite(Eluna* E, Creature* creature) + int IsElite(Eluna* /*E*/, lua_State* L, Creature* creature) { #ifndef TRINITY - Eluna::Push(E->L, creature->IsElite()); + Eluna::Push(L, creature->IsElite()); #else - Eluna::Push(E->L, creature->isElite()); + Eluna::Push(L, creature->isElite()); #endif return 1; } @@ -222,9 +222,9 @@ namespace LuaCreature * * @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; } @@ -234,9 +234,9 @@ namespace LuaCreature * * @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; } @@ -246,9 +246,9 @@ namespace LuaCreature * * @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; } @@ -258,12 +258,12 @@ namespace LuaCreature * * @return bool isWorldBoss */ - int IsWorldBoss(Eluna* E, Creature* creature) + int IsWorldBoss(Eluna* /*E*/, lua_State* L, Creature* creature) { #ifndef TRINITY - Eluna::Push(E->L, creature->IsWorldBoss()); + Eluna::Push(L, creature->IsWorldBoss()); #else - Eluna::Push(E->L, creature->isWorldBoss()); + Eluna::Push(L, creature->isWorldBoss()); #endif return 1; } @@ -275,11 +275,11 @@ namespace LuaCreature * @param uint32 spellId : the ID of a [Spell] * @return bool hasCooldown */ - int HasCategoryCooldown(Eluna* E, Creature* creature) + int HasCategoryCooldown(Eluna* /*E*/, lua_State* L, Creature* creature) { - uint32 spell = Eluna::CHECKVAL(E->L, 2); + uint32 spell = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, creature->HasCategoryCooldown(spell)); + Eluna::Push(L, creature->HasCategoryCooldown(spell)); return 1; } @@ -290,11 +290,11 @@ namespace LuaCreature * @param uint32 spellId : the ID of a [Spell] * @return bool hasSpell */ - int HasSpell(Eluna* E, Creature* creature) + int HasSpell(Eluna* /*E*/, lua_State* L, Creature* creature) { - uint32 id = Eluna::CHECKVAL(E->L, 2); + uint32 id = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, creature->HasSpell(id)); + Eluna::Push(L, creature->HasSpell(id)); return 1; } @@ -305,14 +305,14 @@ namespace LuaCreature * @param uint32 questId : the ID of a [Quest] * @return bool hasQuest */ - int HasQuest(Eluna* E, Creature* creature) + int HasQuest(Eluna* /*E*/, lua_State* L, Creature* creature) { - uint32 questId = Eluna::CHECKVAL(E->L, 2); + uint32 questId = Eluna::CHECKVAL(L, 2); #ifndef TRINITY - Eluna::Push(E->L, creature->HasQuest(questId)); + Eluna::Push(L, creature->HasQuest(questId)); #else - Eluna::Push(E->L, creature->hasQuest(questId)); + Eluna::Push(L, creature->hasQuest(questId)); #endif return 1; } @@ -324,11 +324,11 @@ namespace LuaCreature * @param uint32 spellId : the ID of a [Spell] * @return bool hasCooldown */ - int HasSpellCooldown(Eluna* E, Creature* creature) + int HasSpellCooldown(Eluna* /*E*/, lua_State* L, Creature* creature) { - uint32 spellId = Eluna::CHECKVAL(E->L, 2); + uint32 spellId = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, creature->HasSpellCooldown(spellId)); + Eluna::Push(L, creature->HasSpellCooldown(spellId)); return 1; } @@ -338,9 +338,9 @@ namespace LuaCreature * * @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; } @@ -351,32 +351,32 @@ namespace LuaCreature * * @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; } - 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; } - 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(E->L, 2); - bool force = Eluna::CHECKVAL(E->L, 3, true); + Unit* target = Eluna::CHECKOBJ(L, 2); + bool force = Eluna::CHECKVAL(L, 3, true); - Eluna::Push(E->L, creature->CanStartAttack(target, force)); + Eluna::Push(L, creature->CanStartAttack(target, force)); 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(E->L, 2); + uint16 lootMode = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, creature->HasLootMode(lootMode)); + Eluna::Push(L, creature->HasLootMode(lootMode)); return 1; } #endif @@ -391,9 +391,9 @@ namespace LuaCreature * * @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; } @@ -403,9 +403,9 @@ namespace LuaCreature * * @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; } @@ -415,9 +415,9 @@ namespace LuaCreature * * @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; } #endif @@ -427,12 +427,12 @@ namespace LuaCreature * * @return uint32 wpId */ - int GetCurrentWaypointId(Eluna* E, Creature* creature) + int GetCurrentWaypointId(Eluna* /*E*/, lua_State* L, Creature* creature) { #ifdef TRINITY - Eluna::Push(E->L, creature->GetCurrentWaypointID()); + Eluna::Push(L, creature->GetCurrentWaypointID()); #else - Eluna::Push(E->L, creature->GetMotionMaster()->getLastReachedWaypoint()); + Eluna::Push(L, creature->GetMotionMaster()->getLastReachedWaypoint()); #endif return 1; } @@ -442,9 +442,9 @@ namespace LuaCreature * * @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; } @@ -454,16 +454,16 @@ namespace LuaCreature * @param Unit target * @return float aggroRange */ - int GetAggroRange(Eluna* E, Creature* creature) + int GetAggroRange(Eluna* /*E*/, lua_State* L, Creature* creature) { - Unit* target = Eluna::CHECKOBJ(E->L, 2); + Unit* target = Eluna::CHECKOBJ(L, 2); #ifndef TRINITY float AttackDist = creature->GetAttackDistance(target); float ThreatRadius = sWorld.getConfig(CONFIG_FLOAT_THREAT_RADIUS); - Eluna::Push(E->L, ThreatRadius > AttackDist ? ThreatRadius : AttackDist); + Eluna::Push(L, ThreatRadius > AttackDist ? ThreatRadius : AttackDist); #else - Eluna::Push(E->L, creature->GetAggroRange(target)); + Eluna::Push(L, creature->GetAggroRange(target)); #endif return 1; } @@ -477,11 +477,11 @@ namespace LuaCreature * @param Unit target * @return float attackDistance */ - int GetAttackDistance(Eluna* E, Creature* creature) + int GetAttackDistance(Eluna* /*E*/, lua_State* L, Creature* creature) { - Unit* target = Eluna::CHECKOBJ(E->L, 2); + Unit* target = Eluna::CHECKOBJ(L, 2); - Eluna::Push(E->L, creature->GetAttackDistance(target)); + Eluna::Push(L, creature->GetAttackDistance(target)); return 1; } @@ -490,12 +490,12 @@ namespace LuaCreature * * @return Group lootRecipientGroup : the group or `nil` */ - int GetLootRecipientGroup(Eluna* E, Creature* creature) + int GetLootRecipientGroup(Eluna* /*E*/, lua_State* L, Creature* creature) { #ifndef TRINITY - Eluna::Push(E->L, creature->GetGroupLootRecipient()); + Eluna::Push(L, creature->GetGroupLootRecipient()); #else - Eluna::Push(E->L, creature->GetLootRecipientGroup()); + Eluna::Push(L, creature->GetLootRecipientGroup()); #endif return 1; } @@ -505,9 +505,9 @@ namespace LuaCreature * * @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; } @@ -520,9 +520,9 @@ namespace LuaCreature * * @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; } @@ -535,9 +535,9 @@ namespace LuaCreature * * @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; } @@ -549,9 +549,9 @@ namespace LuaCreature * * @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; } @@ -561,11 +561,11 @@ namespace LuaCreature * @param uint32 spellID * @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(E->L, 2); + uint32 spell = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, creature->GetCreatureSpellCooldownDelay(spell)); + Eluna::Push(L, creature->GetCreatureSpellCooldownDelay(spell)); return 1; } @@ -574,9 +574,9 @@ namespace LuaCreature * * @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; } @@ -589,7 +589,7 @@ namespace LuaCreature * @return float z * @return float o */ - int GetHomePosition(Eluna* E, Creature* creature) + int GetHomePosition(Eluna* /*E*/, lua_State* L, Creature* creature) { float x, y, z, o; #ifndef TRINITY @@ -598,10 +598,10 @@ namespace LuaCreature creature->GetHomePosition(x, y, z, o); #endif - Eluna::Push(E->L, x); - Eluna::Push(E->L, y); - Eluna::Push(E->L, z); - Eluna::Push(E->L, o); + Eluna::Push(L, x); + Eluna::Push(L, y); + Eluna::Push(L, z); + Eluna::Push(L, o); return 4; } @@ -614,12 +614,12 @@ namespace LuaCreature * @param float z * @param float o */ - int SetHomePosition(Eluna* E, Creature* creature) + int SetHomePosition(Eluna* /*E*/, lua_State* L, Creature* creature) { - float x = Eluna::CHECKVAL(E->L, 2); - float y = Eluna::CHECKVAL(E->L, 3); - float z = Eluna::CHECKVAL(E->L, 4); - float o = Eluna::CHECKVAL(E->L, 5); + float x = Eluna::CHECKVAL(L, 2); + float y = Eluna::CHECKVAL(L, 3); + float z = Eluna::CHECKVAL(L, 4); + float o = Eluna::CHECKVAL(L, 5); #ifndef TRINITY 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 * @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(E->L, 2); - bool playerOnly = Eluna::CHECKVAL(E->L, 3, false); - uint32 position = Eluna::CHECKVAL(E->L, 4, 0); - float dist = Eluna::CHECKVAL(E->L, 5, 0.0f); - int32 aura = Eluna::CHECKVAL(E->L, 6, 0); + uint32 targetType = Eluna::CHECKVAL(L, 2); + bool playerOnly = Eluna::CHECKVAL(L, 3, false); + uint32 position = Eluna::CHECKVAL(L, 4, 0); + float dist = Eluna::CHECKVAL(L, 5, 0.0f); + int32 aura = Eluna::CHECKVAL(L, 6, 0); #ifdef MANGOS ThreatList const& threatlist = creature->GetThreatManager().getThreatList(); @@ -711,7 +711,7 @@ namespace LuaCreature std::list::const_iterator itr = targetList.begin(); if (position) std::advance(itr, position); - Eluna::Push(E->L, *itr); + Eluna::Push(L, *itr); } break; case SELECT_TARGET_FARTHEST: @@ -720,7 +720,7 @@ namespace LuaCreature std::list::reverse_iterator ritr = targetList.rbegin(); if (position) std::advance(ritr, position); - Eluna::Push(E->L, *ritr); + Eluna::Push(L, *ritr); } break; case SELECT_TARGET_RANDOM: @@ -730,11 +730,11 @@ namespace LuaCreature std::advance(itr, urand(0, position)); else std::advance(itr, urand(0, targetList.size() - 1)); - Eluna::Push(E->L, *itr); + Eluna::Push(L, *itr); } break; default: - luaL_argerror(E->L, 2, "SelectAggroTarget expected"); + luaL_argerror(L, 2, "SelectAggroTarget expected"); break; } @@ -746,10 +746,10 @@ namespace LuaCreature * * @return table targets */ - int GetAITargets(Eluna* E, Creature* creature) + int GetAITargets(Eluna* /*E*/, lua_State* L, Creature* creature) { - lua_newtable(E->L); - int tbl = lua_gettop(E->L); + lua_newtable(L); + int tbl = lua_gettop(L); uint32 i = 0; #ifdef MANGOS @@ -765,12 +765,12 @@ namespace LuaCreature if (!target) continue; ++i; - Eluna::Push(E->L, i); - Eluna::Push(E->L, target); - lua_settable(E->L, tbl); + Eluna::Push(L, i); + Eluna::Push(L, target); + lua_settable(L, tbl); } - lua_settop(E->L, tbl); + lua_settop(L, tbl); return 1; } @@ -779,12 +779,12 @@ namespace LuaCreature * * @return int targetsCount */ - int GetAITargetsCount(Eluna* E, Creature* creature) + int GetAITargetsCount(Eluna* /*E*/, lua_State* L, Creature* creature) { #ifdef MANGOS - Eluna::Push(E->L, creature->GetThreatManager().getThreatList().size()); + Eluna::Push(L, creature->GetThreatManager().getThreatList().size()); #else - Eluna::Push(E->L, creature->getThreatManager().getThreatList().size()); + Eluna::Push(L, creature->getThreatManager().getThreatList().size()); #endif return 1; } @@ -797,9 +797,9 @@ namespace LuaCreature * * @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; } @@ -809,17 +809,17 @@ namespace LuaCreature * * @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; } #endif #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; } #endif @@ -831,9 +831,9 @@ namespace LuaCreature * * @param NPCFlags flags */ - int SetNPCFlags(Eluna* E, Creature* creature) + int SetNPCFlags(Eluna* /*E*/, lua_State* L, Creature* creature) { - uint32 flags = Eluna::CHECKVAL(E->L, 2); + uint32 flags = Eluna::CHECKVAL(L, 2); creature->SetUInt32Value(UNIT_NPC_FLAGS, flags); return 0; @@ -845,9 +845,9 @@ namespace LuaCreature * * @param bool enable = true */ - int SetDisableGravity(Eluna* E, Creature* creature) + int SetDisableGravity(Eluna* /*E*/, lua_State* L, Creature* creature) { - bool enable = Eluna::CHECKVAL(E->L, 2, true); + bool enable = Eluna::CHECKVAL(L, 2, true); #ifdef TRINITY creature->SetDisableGravity(!enable); @@ -858,9 +858,9 @@ namespace LuaCreature } #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(E->L, 2); + uint16 lootMode = Eluna::CHECKVAL(L, 2); creature->SetLootMode(lootMode); return 0; @@ -872,9 +872,9 @@ namespace LuaCreature * * @param DeathState deathState */ - int SetDeathState(Eluna* E, Creature* creature) + int SetDeathState(Eluna* /*E*/, lua_State* L, Creature* creature) { - int32 state = Eluna::CHECKVAL(E->L, 2); + int32 state = Eluna::CHECKVAL(L, 2); #ifndef TRINITY creature->SetDeathState((DeathState)state); @@ -889,9 +889,9 @@ namespace LuaCreature * * @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(E->L, 2, true); + bool enable = Eluna::CHECKVAL(L, 2, true); creature->SetWalk(enable); return 0; @@ -904,11 +904,11 @@ namespace LuaCreature * @param uint32 off_hand : off hand [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(E->L, 2); - uint32 off_hand = Eluna::CHECKVAL(E->L, 3); - uint32 ranged = Eluna::CHECKVAL(E->L, 4); + uint32 main_hand = Eluna::CHECKVAL(L, 2); + uint32 off_hand = Eluna::CHECKVAL(L, 3); + uint32 ranged = Eluna::CHECKVAL(L, 4); #ifdef TRINITY 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 */ - int SetAggroEnabled(Eluna* E, Creature* creature) + int SetAggroEnabled(Eluna* /*E*/, lua_State* L, Creature* creature) { - bool allow = Eluna::CHECKVAL(E->L, 2, true); + bool allow = Eluna::CHECKVAL(L, 2, true); #ifdef TRINITY if (allow) @@ -951,9 +951,9 @@ namespace LuaCreature * * @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(E->L, 2, true); + bool disable = Eluna::CHECKVAL(L, 2, true); creature->SetDisableReputationGain(disable); return 0; @@ -965,7 +965,7 @@ namespace LuaCreature * This is used by raid bosses to prevent Players from using out-of-combat * actions once the encounter has begun. */ - int SetInCombatWithZone(Eluna* /*E*/, Creature* creature) + int SetInCombatWithZone(Eluna* /*E*/, lua_State* /*L*/, Creature* creature) { creature->SetInCombatWithZone(); return 0; @@ -976,9 +976,9 @@ namespace LuaCreature * * @param float distance */ - int SetWanderRadius(Eluna* E, Creature* creature) + int SetWanderRadius(Eluna* /*E*/, lua_State* L, Creature* creature) { - float dist = Eluna::CHECKVAL(E->L, 2); + float dist = Eluna::CHECKVAL(L, 2); creature->SetRespawnRadius(dist); return 0; @@ -989,9 +989,9 @@ namespace LuaCreature * * @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(E->L, 2); + uint32 delay = Eluna::CHECKVAL(L, 2); creature->SetRespawnDelay(delay); return 0; @@ -1002,9 +1002,9 @@ namespace LuaCreature * * @param MovementGeneratorType type */ - int SetDefaultMovementType(Eluna* E, Creature* creature) + int SetDefaultMovementType(Eluna* /*E*/, lua_State* L, Creature* creature) { - int32 type = Eluna::CHECKVAL(E->L, 2); + int32 type = Eluna::CHECKVAL(L, 2); creature->SetDefaultMovementType((MovementGeneratorType)type); return 0; @@ -1015,9 +1015,9 @@ namespace LuaCreature * * @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(E->L, 2, true); + bool val = Eluna::CHECKVAL(L, 2, true); creature->SetNoSearchAssistance(val); return 0; @@ -1028,9 +1028,9 @@ namespace LuaCreature * * @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(E->L, 2, true); + bool val = Eluna::CHECKVAL(L, 2, true); creature->SetNoCallAssistance(val); return 0; @@ -1041,9 +1041,9 @@ namespace LuaCreature * * @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(E->L, 2, true); + bool enable = Eluna::CHECKVAL(L, 2, true); #ifdef TRINITY creature->SetHover(enable); @@ -1069,9 +1069,9 @@ namespace LuaCreature * * @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(E->L, 2, 0); + uint32 msTimeToDespawn = Eluna::CHECKVAL(L, 2, 0); #ifndef TRINITY creature->ForcedDespawn(msTimeToDespawn); @@ -1084,7 +1084,7 @@ namespace LuaCreature /** * Respawn this [Creature]. */ - int Respawn(Eluna* /*E*/, Creature* creature) + int Respawn(Eluna* /*E*/, lua_State* /*L*/, Creature* creature) { creature->Respawn(); return 0; @@ -1093,7 +1093,7 @@ namespace LuaCreature /** * Remove this [Creature]'s corpse. */ - int RemoveCorpse(Eluna* /*E*/, Creature* creature) + int RemoveCorpse(Eluna* /*E*/, lua_State* /*L*/, Creature* creature) { creature->RemoveCorpse(); return 0; @@ -1102,7 +1102,7 @@ namespace LuaCreature /** * 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 creature->GetMotionMaster()->MoveWaypoint(); @@ -1115,7 +1115,7 @@ namespace LuaCreature /** * 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(); return 0; @@ -1126,9 +1126,9 @@ namespace LuaCreature * * @param float radius */ - int CallForHelp(Eluna* E, Creature* creature) + int CallForHelp(Eluna* /*E*/, lua_State* L, Creature* creature) { - float radius = Eluna::CHECKVAL(E->L, 2); + float radius = Eluna::CHECKVAL(L, 2); creature->CallForHelp(radius); return 0; @@ -1137,7 +1137,7 @@ namespace LuaCreature /** * 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(); return 0; @@ -1148,9 +1148,9 @@ namespace LuaCreature * * @param Unit target */ - int AttackStart(Eluna* E, Creature* creature) + int AttackStart(Eluna* /*E*/, lua_State* L, Creature* creature) { - Unit* target = Eluna::CHECKOBJ(E->L, 2); + Unit* target = Eluna::CHECKOBJ(L, 2); creature->AI()->AttackStart(target); return 0; @@ -1159,7 +1159,7 @@ namespace LuaCreature /** * Save the [Creature] in the database. */ - int SaveToDB(Eluna* /*E*/, Creature* creature) + int SaveToDB(Eluna* /*E*/, lua_State* /*L*/, Creature* creature) { creature->SaveToDB(); return 0; @@ -1170,12 +1170,12 @@ namespace LuaCreature * * 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 - Eluna::Push(E->L, creature->SelectHostileTarget()); + Eluna::Push(L, creature->SelectHostileTarget()); #else - Eluna::Push(E->L, creature->SelectVictim()); + Eluna::Push(L, creature->SelectVictim()); #endif return 1; } @@ -1186,10 +1186,10 @@ namespace LuaCreature * @param uint32 entry : the Creature ID to transform into * @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(E->L, 2); - uint32 dataGuidLow = Eluna::CHECKVAL(E->L, 3, 0); + uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 dataGuidLow = Eluna::CHECKVAL(L, 3, 0); #ifndef TRINITY creature->UpdateEntry(entry, ALLIANCE, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL); @@ -1200,23 +1200,23 @@ namespace LuaCreature } #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(); 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(E->L, 2); + uint16 lootMode = Eluna::CHECKVAL(L, 2); creature->RemoveLootMode(lootMode); 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(E->L, 2); + uint16 lootMode = Eluna::CHECKVAL(L, 2); creature->AddLootMode(lootMode); return 0; diff --git a/ElunaQueryMethods.h b/ElunaQueryMethods.h index e65cfda..ef5d894 100644 --- a/ElunaQueryMethods.h +++ b/ElunaQueryMethods.h @@ -14,152 +14,152 @@ #endif namespace LuaQuery { - void CheckFields(Eluna* E, ElunaQuery* result) + void CheckFields(Eluna* /*E*/, lua_State* L, ElunaQuery* result) { - if (Eluna::CHECKVAL(E->L, 2) >= RESULT->GetFieldCount()) - luaL_argerror(E->L, 2, "invalid field index"); + if (Eluna::CHECKVAL(L, 2) >= RESULT->GetFieldCount()) + luaL_argerror(L, 2, "invalid field index"); } /* BOOLEAN */ - int IsNull(Eluna* E, ElunaQuery* result) + int IsNull(Eluna* E, lua_State* L, ElunaQuery* result) { - uint32 col = Eluna::CHECKVAL(E->L, 2); - CheckFields(E, result); + uint32 col = Eluna::CHECKVAL(L, 2); + CheckFields(E, L, result); #ifndef TRINITY - Eluna::Push(E->L, RESULT->Fetch()[col].IsNULL()); + Eluna::Push(L, RESULT->Fetch()[col].IsNULL()); #else - Eluna::Push(E->L, RESULT->Fetch()[col].IsNull()); + Eluna::Push(L, RESULT->Fetch()[col].IsNull()); #endif return 1; } /* 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; } - int GetRowCount(Eluna* E, ElunaQuery* result) + int GetRowCount(Eluna* /*E*/, lua_State* L, ElunaQuery* result) { if (RESULT->GetRowCount() > (uint32)-1) - Eluna::Push(E->L, (uint32)-1); + Eluna::Push(L, (uint32)-1); else - Eluna::Push(E->L, RESULT->GetRowCount()); + Eluna::Push(L, RESULT->GetRowCount()); return 1; } - int GetBool(Eluna* E, ElunaQuery* result) + int GetBool(Eluna* E, lua_State* L, ElunaQuery* result) { - uint32 col = Eluna::CHECKVAL(E->L, 2); - CheckFields(E, result); - Eluna::Push(E->L, RESULT->Fetch()[col].GetBool()); + uint32 col = Eluna::CHECKVAL(L, 2); + CheckFields(E, L, result); + Eluna::Push(L, RESULT->Fetch()[col].GetBool()); return 1; } - int GetUInt8(Eluna* E, ElunaQuery* result) + int GetUInt8(Eluna* E, lua_State* L, ElunaQuery* result) { - uint32 col = Eluna::CHECKVAL(E->L, 2); - CheckFields(E, result); - Eluna::Push(E->L, RESULT->Fetch()[col].GetUInt8()); + uint32 col = Eluna::CHECKVAL(L, 2); + CheckFields(E, L, result); + Eluna::Push(L, RESULT->Fetch()[col].GetUInt8()); return 1; } - int GetUInt16(Eluna* E, ElunaQuery* result) + int GetUInt16(Eluna* E, lua_State* L, ElunaQuery* result) { - uint32 col = Eluna::CHECKVAL(E->L, 2); - CheckFields(E, result); - Eluna::Push(E->L, RESULT->Fetch()[col].GetUInt16()); + uint32 col = Eluna::CHECKVAL(L, 2); + CheckFields(E, L, result); + Eluna::Push(L, RESULT->Fetch()[col].GetUInt16()); return 1; } - int GetUInt32(Eluna* E, ElunaQuery* result) + int GetUInt32(Eluna* E, lua_State* L, ElunaQuery* result) { - uint32 col = Eluna::CHECKVAL(E->L, 2); - CheckFields(E, result); - Eluna::Push(E->L, RESULT->Fetch()[col].GetUInt32()); + uint32 col = Eluna::CHECKVAL(L, 2); + CheckFields(E, L, result); + Eluna::Push(L, RESULT->Fetch()[col].GetUInt32()); return 1; } - int GetUInt64(Eluna* E, ElunaQuery* result) + int GetUInt64(Eluna* E, lua_State* L, ElunaQuery* result) { - uint32 col = Eluna::CHECKVAL(E->L, 2); - CheckFields(E, result); - Eluna::Push(E->L, RESULT->Fetch()[col].GetUInt64()); + uint32 col = Eluna::CHECKVAL(L, 2); + CheckFields(E, L, result); + Eluna::Push(L, RESULT->Fetch()[col].GetUInt64()); return 1; } - int GetInt8(Eluna* E, ElunaQuery* result) + int GetInt8(Eluna* E, lua_State* L, ElunaQuery* result) { - uint32 col = Eluna::CHECKVAL(E->L, 2); - CheckFields(E, result); - Eluna::Push(E->L, RESULT->Fetch()[col].GetInt8()); + uint32 col = Eluna::CHECKVAL(L, 2); + CheckFields(E, L, result); + Eluna::Push(L, RESULT->Fetch()[col].GetInt8()); return 1; } - int GetInt16(Eluna* E, ElunaQuery* result) + int GetInt16(Eluna* E, lua_State* L, ElunaQuery* result) { - uint32 col = Eluna::CHECKVAL(E->L, 2); - CheckFields(E, result); - Eluna::Push(E->L, RESULT->Fetch()[col].GetInt16()); + uint32 col = Eluna::CHECKVAL(L, 2); + CheckFields(E, L, result); + Eluna::Push(L, RESULT->Fetch()[col].GetInt16()); return 1; } - int GetInt32(Eluna* E, ElunaQuery* result) + int GetInt32(Eluna* E, lua_State* L, ElunaQuery* result) { - uint32 col = Eluna::CHECKVAL(E->L, 2); - CheckFields(E, result); - Eluna::Push(E->L, RESULT->Fetch()[col].GetInt32()); + uint32 col = Eluna::CHECKVAL(L, 2); + CheckFields(E, L, result); + Eluna::Push(L, RESULT->Fetch()[col].GetInt32()); return 1; } - int GetInt64(Eluna* E, ElunaQuery* result) + int GetInt64(Eluna* E, lua_State* L, ElunaQuery* result) { - uint32 col = Eluna::CHECKVAL(E->L, 2); - CheckFields(E, result); - Eluna::Push(E->L, RESULT->Fetch()[col].GetInt64()); + uint32 col = Eluna::CHECKVAL(L, 2); + CheckFields(E, L, result); + Eluna::Push(L, RESULT->Fetch()[col].GetInt64()); return 1; } - int GetFloat(Eluna* E, ElunaQuery* result) + int GetFloat(Eluna* E, lua_State* L, ElunaQuery* result) { - uint32 col = Eluna::CHECKVAL(E->L, 2); - CheckFields(E, result); - Eluna::Push(E->L, RESULT->Fetch()[col].GetFloat()); + uint32 col = Eluna::CHECKVAL(L, 2); + CheckFields(E, L, result); + Eluna::Push(L, RESULT->Fetch()[col].GetFloat()); return 1; } - int GetDouble(Eluna* E, ElunaQuery* result) + int GetDouble(Eluna* E, lua_State* L, ElunaQuery* result) { - uint32 col = Eluna::CHECKVAL(E->L, 2); - CheckFields(E, result); - Eluna::Push(E->L, RESULT->Fetch()[col].GetDouble()); + uint32 col = Eluna::CHECKVAL(L, 2); + CheckFields(E, L, result); + Eluna::Push(L, RESULT->Fetch()[col].GetDouble()); return 1; } - int GetString(Eluna* E, ElunaQuery* result) + int GetString(Eluna* E, lua_State* L, ElunaQuery* result) { - uint32 col = Eluna::CHECKVAL(E->L, 2); - CheckFields(E, result); + uint32 col = Eluna::CHECKVAL(L, 2); + CheckFields(E, L, result); #ifndef TRINITY - Eluna::Push(E->L, RESULT->Fetch()[col].GetCppString()); + Eluna::Push(L, RESULT->Fetch()[col].GetCppString()); #else - Eluna::Push(E->L, RESULT->Fetch()[col].GetString()); + Eluna::Push(L, RESULT->Fetch()[col].GetString()); #endif return 1; } - int GetCString(Eluna* E, ElunaQuery* result) + int GetCString(Eluna* E, lua_State* L, ElunaQuery* result) { - uint32 col = Eluna::CHECKVAL(E->L, 2); - CheckFields(E, result); + uint32 col = Eluna::CHECKVAL(L, 2); + CheckFields(E, L, result); #ifndef TRINITY - Eluna::Push(E->L, RESULT->Fetch()[col].GetString()); + Eluna::Push(L, RESULT->Fetch()[col].GetString()); #else - Eluna::Push(E->L, RESULT->Fetch()[col].GetCString()); + Eluna::Push(L, RESULT->Fetch()[col].GetCString()); #endif return 1; } @@ -172,9 +172,9 @@ namespace LuaQuery * * @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; } @@ -186,10 +186,10 @@ namespace LuaQuery * * @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); - int tbl = lua_gettop(E->L); + lua_newtable(L); + int tbl = lua_gettop(L); uint32 col = RESULT->GetFieldCount(); Field* row = RESULT->Fetch(); @@ -201,17 +201,17 @@ namespace LuaQuery for (uint32 i = 0; i < col; ++i) { #ifdef TRINITY - Eluna::Push(E->L, RESULT->GetFieldName(i)); + Eluna::Push(L, RESULT->GetFieldName(i)); const char* str = row[i].GetCString(); if (row[i].IsNull() || !str) - Eluna::Push(E->L); + Eluna::Push(L); #else - Eluna::Push(E->L, names[i]); + Eluna::Push(L, names[i]); const char* str = row[i].GetString(); if (row[i].IsNULL() || !str) - Eluna::Push(E->L); + Eluna::Push(L); #endif else { @@ -224,18 +224,18 @@ namespace LuaQuery case MYSQL_TYPE_LONG: case MYSQL_TYPE_FLOAT: case MYSQL_TYPE_DOUBLE: - Eluna::Push(E->L, strtod(str, NULL)); + Eluna::Push(L, strtod(str, NULL)); break; default: - Eluna::Push(E->L, str); + Eluna::Push(L, str); break; } } - lua_settable(E->L, tbl); + lua_settable(L, tbl); } - lua_settop(E->L, tbl); + lua_settop(L, tbl); return 1; } }; diff --git a/ElunaTemplate.h b/ElunaTemplate.h index 0bd12ce..215c448 100644 --- a/ElunaTemplate.h +++ b/ElunaTemplate.h @@ -22,7 +22,7 @@ public: struct ElunaRegister { const char* name; - int(*mfunc)(Eluna*); + int(*mfunc)(Eluna*, lua_State*); }; static int thunk(lua_State* L) @@ -30,7 +30,7 @@ public: ElunaRegister* l = static_cast(lua_touserdata(L, lua_upvalueindex(1))); Eluna* E = static_cast(lua_touserdata(L, lua_upvalueindex(2))); int args = lua_gettop(L); - int expected = l->mfunc(E); + int expected = l->mfunc(E, L); args = lua_gettop(L) - args; if (args < 0 || args > expected) // Assert instead? { @@ -105,7 +105,7 @@ template struct ElunaRegister { const char* name; - int(*mfunc)(Eluna*, T*); + int(*mfunc)(Eluna*, lua_State*, T*); }; template @@ -336,7 +336,7 @@ public: ElunaRegister* l = static_cast*>(lua_touserdata(L, lua_upvalueindex(1))); Eluna* E = static_cast(lua_touserdata(L, lua_upvalueindex(2))); int top = lua_gettop(L); - int expected = l->mfunc(E, obj); + int expected = l->mfunc(E, L, obj); int args = lua_gettop(L) - top; if (args < 0 || args > expected) // Assert instead? { diff --git a/GameObjectMethods.h b/GameObjectMethods.h index 371f871..7c59982 100644 --- a/GameObjectMethods.h +++ b/GameObjectMethods.h @@ -15,14 +15,14 @@ namespace LuaGameObject * @param uint32 questId : quest entry Id to check * @return bool hasQuest */ - int HasQuest(Eluna* E, GameObject* go) + int HasQuest(Eluna* /*E*/, lua_State* L, GameObject* go) { - uint32 questId = Eluna::CHECKVAL(E->L, 2); + uint32 questId = Eluna::CHECKVAL(L, 2); #ifndef TRINITY - Eluna::Push(E->L, go->HasQuest(questId)); + Eluna::Push(L, go->HasQuest(questId)); #else - Eluna::Push(E->L, go->hasQuest(questId)); + Eluna::Push(L, go->hasQuest(questId)); #endif return 1; } @@ -32,9 +32,9 @@ namespace LuaGameObject * * @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; } @@ -43,9 +43,9 @@ namespace LuaGameObject * * @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; } @@ -54,15 +54,15 @@ namespace LuaGameObject * * @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; } - /*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; }*/ @@ -71,9 +71,9 @@ namespace LuaGameObject * * @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; } @@ -92,9 +92,9 @@ namespace LuaGameObject * * @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; } @@ -114,9 +114,9 @@ namespace LuaGameObject * * @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; } @@ -134,9 +134,9 @@ namespace LuaGameObject * * @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(E->L, 2, 0); + uint32 state = Eluna::CHECKVAL(L, 2, 0); if (state == 0) go->SetGoState(GO_STATE_ACTIVE); @@ -164,9 +164,9 @@ namespace LuaGameObject * * @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(E->L, 2, 0); + uint32 state = Eluna::CHECKVAL(L, 2, 0); if (state == 0) go->SetLootState(GO_NOT_READY); @@ -184,7 +184,7 @@ namespace LuaGameObject * Saves [GameObject] to the database * */ - int SaveToDB(Eluna* /*E*/, GameObject* go) + int SaveToDB(Eluna* /*E*/, lua_State* /*L*/, GameObject* go) { go->SaveToDB(); return 0; @@ -195,9 +195,9 @@ namespace LuaGameObject * * @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(E->L, 2, false); + bool deldb = Eluna::CHECKVAL(L, 2, false); if (deldb) go->DeleteFromDB(); go->RemoveFromWorld(); @@ -209,9 +209,9 @@ namespace LuaGameObject * * @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(E->L, 2, 0); + uint32 delay = Eluna::CHECKVAL(L, 2, 0); go->UseDoorOrButton(delay); return 0; @@ -222,9 +222,9 @@ namespace LuaGameObject * * @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(E->L, 2, 1); + uint32 delay = Eluna::CHECKVAL(L, 2, 1); if (!delay) delay = 1; @@ -238,9 +238,9 @@ namespace LuaGameObject * * @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(E->L, 2, 1); + uint32 delay = Eluna::CHECKVAL(L, 2, 1); if (!delay) delay = 1; diff --git a/GlobalMethods.h b/GlobalMethods.h index 26a102e..e6e7f38 100644 --- a/GlobalMethods.h +++ b/GlobalMethods.h @@ -14,9 +14,9 @@ namespace LuaGlobalFunctions * * @return string engineName */ - int GetLuaEngine(Eluna* E) + int GetLuaEngine(Eluna* /*E*/, lua_State* L) { - Eluna::Push(E->L, "ElunaEngine"); + Eluna::Push(L, "ElunaEngine"); return 1; } @@ -26,9 +26,9 @@ namespace LuaGlobalFunctions * * @return string coreName */ - int GetCoreName(Eluna* E) + int GetCoreName(Eluna* /*E*/, lua_State* L) { - Eluna::Push(E->L, CORE_NAME); + Eluna::Push(L, CORE_NAME); return 1; } @@ -41,9 +41,9 @@ namespace LuaGlobalFunctions * * @return string version */ - int GetCoreVersion(Eluna* E) + int GetCoreVersion(Eluna* /*E*/, lua_State* L) { - Eluna::Push(E->L, CORE_VERSION); + Eluna::Push(L, CORE_VERSION); return 1; } @@ -52,16 +52,16 @@ namespace LuaGlobalFunctions * * @return int32 version : emulator expansion ID */ - int GetCoreExpansion(Eluna* E) + int GetCoreExpansion(Eluna* /*E*/, lua_State* L) { #ifdef CLASSIC - Eluna::Push(E->L, 0); + Eluna::Push(L, 0); #elif defined(TBC) - Eluna::Push(E->L, 1); + Eluna::Push(L, 1); #elif defined(WOTLK) - Eluna::Push(E->L, 2); + Eluna::Push(L, 2); #elif defined(CATA) - Eluna::Push(E->L, 3); + Eluna::Push(L, 3); #endif return 1; } @@ -72,11 +72,11 @@ namespace LuaGlobalFunctions * @param uint32 questId : [Quest] entry ID * @return [Quest] quest */ - int GetQuest(Eluna* E) + int GetQuest(Eluna* /*E*/, lua_State* L) { - uint32 questId = Eluna::CHECKVAL(E->L, 1); + uint32 questId = Eluna::CHECKVAL(L, 1); - Eluna::Push(E->L, eObjectMgr->GetQuestTemplate(questId)); + Eluna::Push(L, eObjectMgr->GetQuestTemplate(questId)); return 1; } @@ -86,10 +86,10 @@ namespace LuaGlobalFunctions * @param uint64 guid : guid of the [Player] * @return [Player] player */ - int GetPlayerByGUID(Eluna* E) + int GetPlayerByGUID(Eluna* /*E*/, lua_State* L) { - uint64 guid = Eluna::CHECKVAL(E->L, 1); - Eluna::Push(E->L, eObjectAccessor->FindPlayer(ObjectGuid(guid))); + uint64 guid = Eluna::CHECKVAL(L, 1); + Eluna::Push(L, eObjectAccessor->FindPlayer(ObjectGuid(guid))); return 1; } @@ -99,10 +99,10 @@ namespace LuaGlobalFunctions * @param string name : name of the [Player] * @return [Player] player */ - int GetPlayerByName(Eluna* E) + int GetPlayerByName(Eluna* /*E*/, lua_State* L) { - const char* name = Eluna::CHECKVAL(E->L, 1); - Eluna::Push(E->L, eObjectAccessor->FindPlayerByName(name)); + const char* name = Eluna::CHECKVAL(L, 1); + Eluna::Push(L, eObjectAccessor->FindPlayerByName(name)); return 1; } @@ -111,13 +111,13 @@ namespace LuaGlobalFunctions * * @return uint32 time */ - int GetGameTime(Eluna* E) + int GetGameTime(Eluna* /*E*/, lua_State* L) { time_t time = eWorld->GetGameTime(); if (time < 0) - Eluna::Push(E->L, int32(time)); + Eluna::Push(L, int32(time)); else - Eluna::Push(E->L, uint32(time)); + Eluna::Push(L, uint32(time)); return 1; } @@ -137,13 +137,13 @@ namespace LuaGlobalFunctions * @param bool onlyGM = false : optional check if GM only * @return table worldPlayers */ - int GetPlayersInWorld(Eluna* E) + int GetPlayersInWorld(Eluna* /*E*/, lua_State* L) { - uint32 team = Eluna::CHECKVAL(E->L, 1, TEAM_NEUTRAL); - bool onlyGM = Eluna::CHECKVAL(E->L, 2, false); + uint32 team = Eluna::CHECKVAL(L, 1, TEAM_NEUTRAL); + bool onlyGM = Eluna::CHECKVAL(L, 2, false); - lua_newtable(E->L); - int tbl = lua_gettop(E->L); + lua_newtable(L); + int tbl = lua_gettop(L); uint32 i = 0; SessionMap const& sessions = eWorld->GetAllSessions(); @@ -158,14 +158,14 @@ namespace LuaGlobalFunctions #endif { ++i; - Eluna::Push(E->L, i); - Eluna::Push(E->L, player); - lua_settable(E->L, tbl); + Eluna::Push(L, i); + Eluna::Push(L, player); + 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; } @@ -186,18 +186,18 @@ namespace LuaGlobalFunctions * @param [TeamId] team : optional check team of the [Player], Alliance, Horde or Neutral (All) * @return table mapPlayers */ - int GetPlayersInMap(Eluna* E) + int GetPlayersInMap(Eluna* /*E*/, lua_State* L) { - uint32 mapID = Eluna::CHECKVAL(E->L, 1); - uint32 instanceID = Eluna::CHECKVAL(E->L, 2, 0); - uint32 team = Eluna::CHECKVAL(E->L, 3, TEAM_NEUTRAL); + uint32 mapID = Eluna::CHECKVAL(L, 1); + uint32 instanceID = Eluna::CHECKVAL(L, 2, 0); + uint32 team = Eluna::CHECKVAL(L, 3, TEAM_NEUTRAL); - lua_newtable(E->L); + lua_newtable(L); Map* map = eMapMgr->FindMap(mapID, instanceID); if (!map) return 1; - int tbl = lua_gettop(E->L); + int tbl = lua_gettop(L); uint32 i = 0; Map::PlayerList const& players = map->GetPlayers(); @@ -213,13 +213,13 @@ namespace LuaGlobalFunctions if (player->GetSession() && (team >= TEAM_NEUTRAL || player->GetTeamId() == team)) { ++i; - Eluna::Push(E->L, i); - Eluna::Push(E->L, player); - lua_settable(E->L, tbl); + Eluna::Push(L, i); + Eluna::Push(L, player); + lua_settable(L, tbl); } } - lua_settop(E->L, tbl); + lua_settop(L, tbl); return 1; } @@ -229,10 +229,10 @@ namespace LuaGlobalFunctions * @param string name : the name of a guild * @return [Guild] guild */ - int GetGuildByName(Eluna* E) + int GetGuildByName(Eluna* /*E*/, lua_State* L) { - const char* name = Eluna::CHECKVAL(E->L, 1); - Eluna::Push(E->L, eGuildMgr->GetGuildByName(name)); + const char* name = Eluna::CHECKVAL(L, 1); + Eluna::Push(L, eGuildMgr->GetGuildByName(name)); return 1; } @@ -243,12 +243,12 @@ namespace LuaGlobalFunctions * @param uint32 instanceId : instance ID to search, use 0 if not instance * @return [Map] map */ - int GetMapById(Eluna* E) + int GetMapById(Eluna* /*E*/, lua_State* L) { - uint32 mapid = Eluna::CHECKVAL(E->L, 1); - uint32 instance = Eluna::CHECKVAL(E->L, 2); + uint32 mapid = Eluna::CHECKVAL(L, 1); + uint32 instance = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, eMapMgr->FindMap(mapid, instance)); + Eluna::Push(L, eMapMgr->FindMap(mapid, instance)); return 1; } @@ -258,11 +258,11 @@ namespace LuaGlobalFunctions * @param uint64 guid : the guid of a [Guild] leader * @return [Guild] guild */ - int GetGuildByLeaderGUID(Eluna* E) + int GetGuildByLeaderGUID(Eluna* /*E*/, lua_State* L) { - uint64 guid = Eluna::CHECKVAL(E->L, 1); + uint64 guid = Eluna::CHECKVAL(L, 1); - Eluna::Push(E->L, eGuildMgr->GetGuildByLeader(ObjectGuid(guid))); + Eluna::Push(L, eGuildMgr->GetGuildByLeader(ObjectGuid(guid))); return 1; } @@ -271,9 +271,9 @@ namespace LuaGlobalFunctions * * @return uint32 count */ - int GetPlayerCount(Eluna* E) + int GetPlayerCount(Eluna* /*E*/, lua_State* L) { - Eluna::Push(E->L, eWorld->GetActiveSessionCount()); + Eluna::Push(L, eWorld->GetActiveSessionCount()); return 1; } @@ -285,10 +285,10 @@ namespace LuaGlobalFunctions * @param uint32 lowguid : low GUID of the [Player] * @return uint64 guid */ - int GetPlayerGUID(Eluna* E) + int GetPlayerGUID(Eluna* /*E*/, lua_State* L) { - uint32 lowguid = Eluna::CHECKVAL(E->L, 1); - Eluna::Push(E->L, MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER)); + uint32 lowguid = Eluna::CHECKVAL(L, 1); + Eluna::Push(L, MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER)); return 1; } @@ -300,10 +300,10 @@ namespace LuaGlobalFunctions * @param uint32 lowguid : low GUID of the [Item] * @return uint64 guid */ - int GetItemGUID(Eluna* E) + int GetItemGUID(Eluna* /*E*/, lua_State* L) { - uint32 lowguid = Eluna::CHECKVAL(E->L, 1); - Eluna::Push(E->L, MAKE_NEW_GUID(lowguid, 0, HIGHGUID_ITEM)); + uint32 lowguid = Eluna::CHECKVAL(L, 1); + Eluna::Push(L, MAKE_NEW_GUID(lowguid, 0, HIGHGUID_ITEM)); return 1; } @@ -316,11 +316,11 @@ namespace LuaGlobalFunctions * @param uint32 entry : entry ID of the [GameObject] * @return uint64 guid */ - int GetObjectGUID(Eluna* E) + int GetObjectGUID(Eluna* /*E*/, lua_State* L) { - uint32 lowguid = Eluna::CHECKVAL(E->L, 1); - uint32 entry = Eluna::CHECKVAL(E->L, 2); - Eluna::Push(E->L, MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT)); + uint32 lowguid = Eluna::CHECKVAL(L, 1); + uint32 entry = Eluna::CHECKVAL(L, 2); + Eluna::Push(L, MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT)); return 1; } @@ -333,11 +333,11 @@ namespace LuaGlobalFunctions * @param uint32 entry : entry ID of the [Creature] * @return uint64 guid */ - int GetUnitGUID(Eluna* E) + int GetUnitGUID(Eluna* /*E*/, lua_State* L) { - uint32 lowguid = Eluna::CHECKVAL(E->L, 1); - uint32 entry = Eluna::CHECKVAL(E->L, 2); - Eluna::Push(E->L, MAKE_NEW_GUID(lowguid, entry, HIGHGUID_UNIT)); + uint32 lowguid = Eluna::CHECKVAL(L, 1); + uint32 entry = Eluna::CHECKVAL(L, 2); + Eluna::Push(L, MAKE_NEW_GUID(lowguid, entry, HIGHGUID_UNIT)); return 1; } @@ -350,11 +350,11 @@ namespace LuaGlobalFunctions * @param uint64 guid : GUID of an [Object] * @return uint32 lowguid : low GUID of the [Object] */ - int GetGUIDLow(Eluna* E) + int GetGUIDLow(Eluna* /*E*/, lua_State* L) { - uint64 guid = Eluna::CHECKVAL(E->L, 1); + uint64 guid = Eluna::CHECKVAL(L, 1); - Eluna::Push(E->L, GUID_LOPART(guid)); + Eluna::Push(L, GUID_LOPART(guid)); return 1; } @@ -380,16 +380,16 @@ namespace LuaGlobalFunctions * @param [LocaleConstant] locale = DEFAULT_LOCALE : locale to return the [Item] name in * @return string itemLink */ - int GetItemLink(Eluna* E) + int GetItemLink(Eluna* /*E*/, lua_State* L) { - uint32 entry = Eluna::CHECKVAL(E->L, 1); - uint8 locale = Eluna::CHECKVAL(E->L, 2, DEFAULT_LOCALE); + uint32 entry = Eluna::CHECKVAL(L, 1); + uint8 locale = Eluna::CHECKVAL(L, 2, DEFAULT_LOCALE); if (locale >= TOTAL_LOCALES) - return luaL_argerror(E->L, 2, "valid LocaleConstant expected"); + return luaL_argerror(L, 2, "valid LocaleConstant expected"); const ItemTemplate* temp = eObjectMgr->GetItemTemplate(entry); if (!temp) - return luaL_argerror(E->L, 1, "valid ItemEntry expected"); + return luaL_argerror(L, 1, "valid ItemEntry expected"); std::string name = temp->Name1; if (ItemLocale const* il = eObjectMgr->GetItemLocale(entry)) @@ -403,7 +403,7 @@ namespace LuaGlobalFunctions #endif "0:0:0:0|h[" << name << "]|h|r"; - Eluna::Push(E->L, oss.str()); + Eluna::Push(L, oss.str()); return 1; } @@ -415,10 +415,10 @@ namespace LuaGlobalFunctions * @param uint64 guid : GUID of an [Object] * @return uint32 typeId : type ID of the [Object] */ - int GetGUIDType(Eluna* E) + int GetGUIDType(Eluna* /*E*/, lua_State* L) { - uint64 guid = Eluna::CHECKVAL(E->L, 1); - Eluna::Push(E->L, GUID_HIPART(guid)); + uint64 guid = Eluna::CHECKVAL(L, 1); + Eluna::Push(L, GUID_HIPART(guid)); return 1; } @@ -431,10 +431,10 @@ namespace LuaGlobalFunctions * @param uint64 guid : GUID of an [Creature] or [GameObject], otherwise returns 0 * @return uint32 entry : entry ID of the [Creature] or [GameObject] */ - int GetGUIDEntry(Eluna* E) + int GetGUIDEntry(Eluna* /*E*/, lua_State* L) { - uint64 guid = Eluna::CHECKVAL(E->L, 1); - Eluna::Push(E->L, GUID_ENPART(guid)); + uint64 guid = Eluna::CHECKVAL(L, 1); + Eluna::Push(L, GUID_ENPART(guid)); return 1; } @@ -460,18 +460,18 @@ namespace LuaGlobalFunctions * @param [LocaleConstant] locale = DEFAULT_LOCALE : locale to return the name in * @return string areaOrZoneName */ - int GetAreaName(Eluna* E) + int GetAreaName(Eluna* /*E*/, lua_State* L) { - uint32 areaOrZoneId = Eluna::CHECKVAL(E->L, 1); - uint8 locale = Eluna::CHECKVAL(E->L, 2, DEFAULT_LOCALE); + uint32 areaOrZoneId = Eluna::CHECKVAL(L, 1); + uint8 locale = Eluna::CHECKVAL(L, 2, DEFAULT_LOCALE); if (locale >= TOTAL_LOCALES) - return luaL_argerror(E->L, 2, "valid LocaleConstant expected"); + return luaL_argerror(L, 2, "valid LocaleConstant expected"); AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaOrZoneId); if (!areaEntry) - return luaL_argerror(E->L, 1, "valid Area or Zone ID expected"); + return luaL_argerror(L, 1, "valid Area or Zone ID expected"); - Eluna::Push(E->L, areaEntry->area_name[locale]); + Eluna::Push(L, areaEntry->area_name[locale]); return 1; } @@ -493,13 +493,13 @@ namespace LuaGlobalFunctions * @param uint32 event : packet event Id, refer to PacketEvents above * @param function function : function to register */ - int RegisterPacketEvent(Eluna* E) + int RegisterPacketEvent(Eluna* E, lua_State* L) { - uint32 entry = Eluna::CHECKVAL(E->L, 1); - uint32 ev = Eluna::CHECKVAL(E->L, 2); - luaL_checktype(E->L, 3, LUA_TFUNCTION); - lua_pushvalue(E->L, 3); - int functionRef = luaL_ref(E->L, LUA_REGISTRYINDEX); + uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 ev = Eluna::CHECKVAL(L, 2); + luaL_checktype(L, 3, LUA_TFUNCTION); + lua_pushvalue(L, 3); + int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef > 0) E->Register(HookMgr::REGTYPE_PACKET, entry, ev, functionRef); return 0; @@ -568,12 +568,12 @@ namespace LuaGlobalFunctions * @param uint32 event : server event Id, refer to ServerEvents above * @param function function : function to register */ - int RegisterServerEvent(Eluna* E) + int RegisterServerEvent(Eluna* E, lua_State* L) { - uint32 ev = Eluna::CHECKVAL(E->L, 1); - luaL_checktype(E->L, 2, LUA_TFUNCTION); - lua_pushvalue(E->L, 2); - int functionRef = luaL_ref(E->L, LUA_REGISTRYINDEX); + uint32 ev = Eluna::CHECKVAL(L, 1); + luaL_checktype(L, 2, LUA_TFUNCTION); + lua_pushvalue(L, 2); + int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef > 0) E->Register(HookMgr::REGTYPE_SERVER, 0, ev, functionRef); return 0; @@ -637,12 +637,12 @@ namespace LuaGlobalFunctions * @param uint32 event : [Player] event Id, refer to PlayerEvents above * @param function function : function to register */ - int RegisterPlayerEvent(Eluna* E) + int RegisterPlayerEvent(Eluna* E, lua_State* L) { - uint32 ev = Eluna::CHECKVAL(E->L, 1); - luaL_checktype(E->L, 2, LUA_TFUNCTION); - lua_pushvalue(E->L, 2); - int functionRef = luaL_ref(E->L, LUA_REGISTRYINDEX); + uint32 ev = Eluna::CHECKVAL(L, 1); + luaL_checktype(L, 2, LUA_TFUNCTION); + lua_pushvalue(L, 2); + int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef > 0) E->Register(HookMgr::REGTYPE_PLAYER, 0, ev, functionRef); return 0; @@ -674,12 +674,12 @@ namespace LuaGlobalFunctions * @param uint32 event : [Guild] event Id, refer to GuildEvents above * @param function function : function to register */ - int RegisterGuildEvent(Eluna* E) + int RegisterGuildEvent(Eluna* E, lua_State* L) { - uint32 ev = Eluna::CHECKVAL(E->L, 1); - luaL_checktype(E->L, 2, LUA_TFUNCTION); - lua_pushvalue(E->L, 2); - int functionRef = luaL_ref(E->L, LUA_REGISTRYINDEX); + uint32 ev = Eluna::CHECKVAL(L, 1); + luaL_checktype(L, 2, LUA_TFUNCTION); + lua_pushvalue(L, 2); + int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef > 0) E->Register(HookMgr::REGTYPE_GUILD, 0, ev, functionRef); return 0; @@ -706,12 +706,12 @@ namespace LuaGlobalFunctions * @param uint32 event : [Group] event Id, refer to GroupEvents above * @param function function : function to register */ - int RegisterGroupEvent(Eluna* E) + int RegisterGroupEvent(Eluna* E, lua_State* L) { - uint32 ev = Eluna::CHECKVAL(E->L, 1); - luaL_checktype(E->L, 2, LUA_TFUNCTION); - lua_pushvalue(E->L, 2); - int functionRef = luaL_ref(E->L, LUA_REGISTRYINDEX); + uint32 ev = Eluna::CHECKVAL(L, 1); + luaL_checktype(L, 2, LUA_TFUNCTION); + lua_pushvalue(L, 2); + int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef > 0) E->Register(HookMgr::REGTYPE_GROUP, 0, ev, functionRef); return 0; @@ -733,13 +733,13 @@ namespace LuaGlobalFunctions * @param uint32 event : [Creature] gossip event Id, refer to GossipEvents above * @param function function : function to register */ - int RegisterCreatureGossipEvent(Eluna* E) + int RegisterCreatureGossipEvent(Eluna* E, lua_State* L) { - uint32 entry = Eluna::CHECKVAL(E->L, 1); - uint32 ev = Eluna::CHECKVAL(E->L, 2); - luaL_checktype(E->L, 3, LUA_TFUNCTION); - lua_pushvalue(E->L, 3); - int functionRef = luaL_ref(E->L, LUA_REGISTRYINDEX); + uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 ev = Eluna::CHECKVAL(L, 2); + luaL_checktype(L, 3, LUA_TFUNCTION); + lua_pushvalue(L, 3); + int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef > 0) E->Register(HookMgr::REGTYPE_CREATURE_GOSSIP, entry, ev, functionRef); return 0; @@ -761,13 +761,13 @@ namespace LuaGlobalFunctions * @param uint32 event : [GameObject] gossip event Id, refer to GossipEvents above * @param function function : function to register */ - int RegisterGameObjectGossipEvent(Eluna* E) + int RegisterGameObjectGossipEvent(Eluna* E, lua_State* L) { - uint32 entry = Eluna::CHECKVAL(E->L, 1); - uint32 ev = Eluna::CHECKVAL(E->L, 2); - luaL_checktype(E->L, 3, LUA_TFUNCTION); - lua_pushvalue(E->L, 3); - int functionRef = luaL_ref(E->L, LUA_REGISTRYINDEX); + uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 ev = Eluna::CHECKVAL(L, 2); + luaL_checktype(L, 3, LUA_TFUNCTION); + lua_pushvalue(L, 3); + int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef > 0) E->Register(HookMgr::REGTYPE_GAMEOBJECT_GOSSIP, entry, ev, functionRef); return 0; @@ -792,13 +792,13 @@ namespace LuaGlobalFunctions * @param uint32 event : [Item] event Id, refer to ItemEvents above * @param function function : function to register */ - int RegisterItemEvent(Eluna* E) + int RegisterItemEvent(Eluna* E, lua_State* L) { - uint32 entry = Eluna::CHECKVAL(E->L, 1); - uint32 ev = Eluna::CHECKVAL(E->L, 2); - luaL_checktype(E->L, 3, LUA_TFUNCTION); - lua_pushvalue(E->L, 3); - int functionRef = luaL_ref(E->L, LUA_REGISTRYINDEX); + uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 ev = Eluna::CHECKVAL(L, 2); + luaL_checktype(L, 3, LUA_TFUNCTION); + lua_pushvalue(L, 3); + int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef > 0) E->Register(HookMgr::REGTYPE_ITEM, entry, ev, functionRef); return 0; @@ -820,13 +820,13 @@ namespace LuaGlobalFunctions * @param uint32 event : [Item] gossip event Id, refer to GossipEvents above * @param function function : function to register */ - int RegisterItemGossipEvent(Eluna* E) + int RegisterItemGossipEvent(Eluna* E, lua_State* L) { - uint32 entry = Eluna::CHECKVAL(E->L, 1); - uint32 ev = Eluna::CHECKVAL(E->L, 2); - luaL_checktype(E->L, 3, LUA_TFUNCTION); - lua_pushvalue(E->L, 3); - int functionRef = luaL_ref(E->L, LUA_REGISTRYINDEX); + uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 ev = Eluna::CHECKVAL(L, 2); + luaL_checktype(L, 3, LUA_TFUNCTION); + lua_pushvalue(L, 3); + int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef > 0) E->Register(HookMgr::REGTYPE_ITEM_GOSSIP, entry, ev, functionRef); return 0; @@ -848,13 +848,13 @@ namespace LuaGlobalFunctions * @param uint32 event : [Player] gossip event Id, refer to GossipEvents above * @param function function : function to register */ - int RegisterPlayerGossipEvent(Eluna* E) + int RegisterPlayerGossipEvent(Eluna* E, lua_State* L) { - uint32 menu_id = Eluna::CHECKVAL(E->L, 1); - uint32 ev = Eluna::CHECKVAL(E->L, 2); - luaL_checktype(E->L, 3, LUA_TFUNCTION); - lua_pushvalue(E->L, 3); - int functionRef = luaL_ref(E->L, LUA_REGISTRYINDEX); + uint32 menu_id = Eluna::CHECKVAL(L, 1); + uint32 ev = Eluna::CHECKVAL(L, 2); + luaL_checktype(L, 3, LUA_TFUNCTION); + lua_pushvalue(L, 3); + int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef > 0) E->Register(HookMgr::REGTYPE_PLAYER_GOSSIP, menu_id, ev, functionRef); return 0; @@ -911,13 +911,13 @@ namespace LuaGlobalFunctions * @param uint32 event : [Creature] event Id, refer to CreatureEvents above * @param function function : function to register */ - int RegisterCreatureEvent(Eluna* E) + int RegisterCreatureEvent(Eluna* E, lua_State* L) { - uint32 entry = Eluna::CHECKVAL(E->L, 1); - uint32 ev = Eluna::CHECKVAL(E->L, 2); - luaL_checktype(E->L, 3, LUA_TFUNCTION); - lua_pushvalue(E->L, 3); - int functionRef = luaL_ref(E->L, LUA_REGISTRYINDEX); + uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 ev = Eluna::CHECKVAL(L, 2); + luaL_checktype(L, 3, LUA_TFUNCTION); + lua_pushvalue(L, 3); + int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef > 0) E->Register(HookMgr::REGTYPE_CREATURE, entry, ev, functionRef); return 0; @@ -950,13 +950,13 @@ namespace LuaGlobalFunctions * @param uint32 event : [GameObject] event Id, refer to GameObjectEvents above * @param function function : function to register */ - int RegisterGameObjectEvent(Eluna* E) + int RegisterGameObjectEvent(Eluna* E, lua_State* L) { - uint32 entry = Eluna::CHECKVAL(E->L, 1); - uint32 ev = Eluna::CHECKVAL(E->L, 2); - luaL_checktype(E->L, 3, LUA_TFUNCTION); - lua_pushvalue(E->L, 3); - int functionRef = luaL_ref(E->L, LUA_REGISTRYINDEX); + uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 ev = Eluna::CHECKVAL(L, 2); + luaL_checktype(L, 3, LUA_TFUNCTION); + lua_pushvalue(L, 3); + int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef > 0) E->Register(HookMgr::REGTYPE_GAMEOBJECT, entry, ev, functionRef); return 0; @@ -979,12 +979,12 @@ namespace LuaGlobalFunctions * @param uint32 event : [Battleground] event Id, refer to BGEvents above * @param function function : function to register */ - int RegisterBGEvent(Eluna* E) + int RegisterBGEvent(Eluna* E, lua_State* L) { - uint32 ev = Eluna::CHECKVAL(E->L, 1); - luaL_checktype(E->L, 2, LUA_TFUNCTION); - lua_pushvalue(E->L, 2); - int functionRef = luaL_ref(E->L, LUA_REGISTRYINDEX); + uint32 ev = Eluna::CHECKVAL(L, 1); + luaL_checktype(L, 2, LUA_TFUNCTION); + lua_pushvalue(L, 2); + int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef > 0) E->Register(HookMgr::REGTYPE_BG, 0, ev, functionRef); return 0; @@ -994,7 +994,7 @@ namespace LuaGlobalFunctions * Reloads the Lua Engine * */ - int ReloadEluna(Eluna* /*E*/) + int ReloadEluna(Eluna* /*E*/, lua_State* /*L*/) { Eluna::reload = true; return 0; @@ -1005,9 +1005,9 @@ namespace LuaGlobalFunctions * * @param string message : message to send */ - int SendWorldMessage(Eluna* E) + int SendWorldMessage(Eluna* /*E*/, lua_State* L) { - const char* message = Eluna::CHECKVAL(E->L, 1); + const char* message = Eluna::CHECKVAL(L, 1); eWorld->SendServerMessage(SERVER_MSG_STRING, message); return 0; } @@ -1018,22 +1018,22 @@ namespace LuaGlobalFunctions * @param string query : sql [Query] to run * @return QueryResult result */ - int WorldDBQuery(Eluna* E) + int WorldDBQuery(Eluna* /*E*/, lua_State* L) { - const char* query = Eluna::CHECKVAL(E->L, 1); + const char* query = Eluna::CHECKVAL(L, 1); #ifdef TRINITY ElunaQuery result = WorldDatabase.Query(query); if (result) - Eluna::Push(E->L, new ElunaQuery(result)); + Eluna::Push(L, new ElunaQuery(result)); else - Eluna::Push(E->L); + Eluna::Push(L); #else ElunaQuery* result = WorldDatabase.QueryNamed(query); if (result) - Eluna::Push(E->L, result); + Eluna::Push(L, result); else - Eluna::Push(E->L); + Eluna::Push(L); #endif return 1; } @@ -1043,9 +1043,9 @@ namespace LuaGlobalFunctions * * @param string query : sql [Query] to execute */ - int WorldDBExecute(Eluna* E) + int WorldDBExecute(Eluna* /*E*/, lua_State* L) { - const char* query = Eluna::CHECKVAL(E->L, 1); + const char* query = Eluna::CHECKVAL(L, 1); WorldDatabase.Execute(query); return 0; } @@ -1056,22 +1056,22 @@ namespace LuaGlobalFunctions * @param string query : sql [Query] to run * @return [Query] result */ - int CharDBQuery(Eluna* E) + int CharDBQuery(Eluna* /*E*/, lua_State* L) { - const char* query = Eluna::CHECKVAL(E->L, 1); + const char* query = Eluna::CHECKVAL(L, 1); #ifdef TRINITY QueryResult result = CharacterDatabase.Query(query); if (result) - Eluna::Push(E->L, new QueryResult(result)); + Eluna::Push(L, new QueryResult(result)); else - Eluna::Push(E->L); + Eluna::Push(L); #else QueryNamedResult* result = CharacterDatabase.QueryNamed(query); if (result) - Eluna::Push(E->L, result); + Eluna::Push(L, result); else - Eluna::Push(E->L); + Eluna::Push(L); #endif return 1; } @@ -1081,9 +1081,9 @@ namespace LuaGlobalFunctions * * @param string query : sql [Query] to execute */ - int CharDBExecute(Eluna* E) + int CharDBExecute(Eluna* /*E*/, lua_State* L) { - const char* query = Eluna::CHECKVAL(E->L, 1); + const char* query = Eluna::CHECKVAL(L, 1); CharacterDatabase.Execute(query); return 0; } @@ -1094,22 +1094,22 @@ namespace LuaGlobalFunctions * @param string query : sql [Query] to run * @return [Query] result */ - int AuthDBQuery(Eluna* E) + int AuthDBQuery(Eluna* /*E*/, lua_State* L) { - const char* query = Eluna::CHECKVAL(E->L, 1); + const char* query = Eluna::CHECKVAL(L, 1); #ifdef TRINITY QueryResult result = LoginDatabase.Query(query); if (result) - Eluna::Push(E->L, new QueryResult(result)); + Eluna::Push(L, new QueryResult(result)); else - Eluna::Push(E->L); + Eluna::Push(L); #else QueryNamedResult* result = LoginDatabase.QueryNamed(query); if (result) - Eluna::Push(E->L, result); + Eluna::Push(L, result); else - Eluna::Push(E->L); + Eluna::Push(L); #endif return 1; } @@ -1119,9 +1119,9 @@ namespace LuaGlobalFunctions * * @param string query : sql [Query] to execute */ - int AuthDBExecute(Eluna* E) + int AuthDBExecute(Eluna* /*E*/, lua_State* L) { - const char* query = Eluna::CHECKVAL(E->L, 1); + const char* query = Eluna::CHECKVAL(L, 1); LoginDatabase.Execute(query); return 0; } @@ -1136,18 +1136,18 @@ namespace LuaGlobalFunctions * @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 */ - int CreateLuaEvent(Eluna* E) + int CreateLuaEvent(Eluna* E, lua_State* L) { - luaL_checktype(E->L, 1, LUA_TFUNCTION); - uint32 delay = Eluna::CHECKVAL(E->L, 2); - uint32 repeats = Eluna::CHECKVAL(E->L, 3); + luaL_checktype(L, 1, LUA_TFUNCTION); + uint32 delay = Eluna::CHECKVAL(L, 2); + uint32 repeats = Eluna::CHECKVAL(L, 3); - lua_pushvalue(E->L, 1); - int functionRef = luaL_ref(E->L, LUA_REGISTRYINDEX); + lua_pushvalue(L, 1); + int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef != LUA_REFNIL && functionRef != LUA_NOREF) { E->eventMgr->globalProcessor->AddEvent(functionRef, delay, repeats); - Eluna::Push(E->L, functionRef); + Eluna::Push(L, functionRef); } return 1; } @@ -1158,10 +1158,10 @@ namespace LuaGlobalFunctions * @param int eventId : event Id to remove * @param bool all_Events = false : remove from all events, not just global */ - int RemoveEventById(Eluna* E) + int RemoveEventById(Eluna* E, lua_State* L) { - int eventId = Eluna::CHECKVAL(E->L, 1); - bool all_Events = Eluna::CHECKVAL(E->L, 1, false); + int eventId = Eluna::CHECKVAL(L, 1); + bool all_Events = Eluna::CHECKVAL(L, 1, false); // not thread safe if (all_Events) @@ -1176,9 +1176,9 @@ namespace LuaGlobalFunctions * * @param bool all_Events = false : remove all events, not just global */ - int RemoveEvents(Eluna* E) + int RemoveEvents(Eluna* E, lua_State* L) { - bool all_Events = Eluna::CHECKVAL(E->L, 1, false); + bool all_Events = Eluna::CHECKVAL(L, 1, false); // not thread safe if (all_Events) @@ -1204,23 +1204,23 @@ namespace LuaGlobalFunctions * @param uint32 phase = 1 : phase to put the [Creature] or [GameObject] in * @return [WorldObject] worldObject : returns [Creature] or [GameObject] */ - int PerformIngameSpawn(Eluna* E) + int PerformIngameSpawn(Eluna* /*E*/, lua_State* L) { - int spawntype = Eluna::CHECKVAL(E->L, 1); - uint32 entry = Eluna::CHECKVAL(E->L, 2); - uint32 mapID = Eluna::CHECKVAL(E->L, 3); - uint32 instanceID = Eluna::CHECKVAL(E->L, 4); - float x = Eluna::CHECKVAL(E->L, 5); - float y = Eluna::CHECKVAL(E->L, 6); - float z = Eluna::CHECKVAL(E->L, 7); - float o = Eluna::CHECKVAL(E->L, 8); - bool save = Eluna::CHECKVAL(E->L, 9, false); - uint32 durorresptime = Eluna::CHECKVAL(E->L, 10, 0); + int spawntype = Eluna::CHECKVAL(L, 1); + uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 mapID = Eluna::CHECKVAL(L, 3); + uint32 instanceID = Eluna::CHECKVAL(L, 4); + float x = Eluna::CHECKVAL(L, 5); + float y = Eluna::CHECKVAL(L, 6); + float z = Eluna::CHECKVAL(L, 7); + float o = Eluna::CHECKVAL(L, 8); + bool save = Eluna::CHECKVAL(L, 9, false); + uint32 durorresptime = Eluna::CHECKVAL(L, 10, 0); #if (!defined(TBC) && !defined(CLASSIC)) - uint32 phase = Eluna::CHECKVAL(E->L, 11, PHASEMASK_NORMAL); + uint32 phase = Eluna::CHECKVAL(L, 11, PHASEMASK_NORMAL); if (!phase) { - Eluna::Push(E->L); + Eluna::Push(L); return 1; } #endif @@ -1229,7 +1229,7 @@ namespace LuaGlobalFunctions Map* map = eMapMgr->FindMap(mapID, instanceID); if (!map) { - Eluna::Push(E->L); + Eluna::Push(L); return 1; } @@ -1240,7 +1240,7 @@ namespace LuaGlobalFunctions CreatureInfo const* cinfo = ObjectMgr::GetCreatureTemplate(entry); if (!cinfo) { - Eluna::Push(E->L); + Eluna::Push(L); return 1; } @@ -1254,14 +1254,14 @@ namespace LuaGlobalFunctions uint32 lowguid = eObjectMgr->GenerateStaticCreatureLowGuid(); if (!lowguid) { - Eluna::Push(E->L); + Eluna::Push(L); return 1; } if (!pCreature->Create(lowguid, pos, cinfo)) { delete pCreature; - Eluna::Push(E->L); + Eluna::Push(L); return 1; } @@ -1283,14 +1283,14 @@ namespace LuaGlobalFunctions if (durorresptime) pCreature->ForcedDespawn(durorresptime); - Eluna::Push(E->L, pCreature); + Eluna::Push(L, pCreature); } else { CreatureInfo const* cinfo = ObjectMgr::GetCreatureTemplate(entry); if (!cinfo) { - Eluna::Push(E->L); + Eluna::Push(L); return 1; } @@ -1305,7 +1305,7 @@ namespace LuaGlobalFunctions { delete pCreature; { - Eluna::Push(E->L); + Eluna::Push(L); return 1; } } @@ -1322,7 +1322,7 @@ namespace LuaGlobalFunctions if (pCreature->IsLinkingEventTrigger()) map->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_RESPAWN, pCreature); - Eluna::Push(E->L, pCreature); + Eluna::Push(L, pCreature); } return 1; @@ -1335,7 +1335,7 @@ namespace LuaGlobalFunctions const GameObjectInfo* gInfo = ObjectMgr::GetGameObjectInfo(entry); if (!gInfo) { - Eluna::Push(E->L); + Eluna::Push(L); return 1; } @@ -1343,7 +1343,7 @@ namespace LuaGlobalFunctions uint32 db_lowGUID = eObjectMgr->GenerateStaticGameObjectLowGuid(); if (!db_lowGUID) { - Eluna::Push(E->L); + Eluna::Push(L); return 1; } @@ -1355,7 +1355,7 @@ namespace LuaGlobalFunctions #endif { delete pGameObj; - Eluna::Push(E->L); + Eluna::Push(L); return 1; } @@ -1375,7 +1375,7 @@ namespace LuaGlobalFunctions if (!pGameObj->LoadFromDB(db_lowGUID, map)) { delete pGameObj; - Eluna::Push(E->L); + Eluna::Push(L); return 1; } @@ -1385,7 +1385,7 @@ namespace LuaGlobalFunctions eObjectMgr->AddGameobjectToGrid(db_lowGUID, eObjectMgr->GetGOData(db_lowGUID)); - Eluna::Push(E->L, pGameObj); + Eluna::Push(L, pGameObj); } else { @@ -1398,7 +1398,7 @@ namespace LuaGlobalFunctions #endif { delete pGameObj; - Eluna::Push(E->L); + Eluna::Push(L); return 1; } @@ -1406,7 +1406,7 @@ namespace LuaGlobalFunctions map->Add(pGameObj); - Eluna::Push(E->L, pGameObj); + Eluna::Push(L, pGameObj); } return 1; } @@ -1414,7 +1414,7 @@ namespace LuaGlobalFunctions Map* map = eMapMgr->FindMap(mapID, instanceID); if (!map) { - Eluna::Push(E->L); + Eluna::Push(L); return 1; } @@ -1428,29 +1428,29 @@ namespace LuaGlobalFunctions if (!creature->Create(eObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, phase, entry, x, y, z, o)) { delete creature; - Eluna::Push(E->L); + Eluna::Push(L); return 1; } creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase); uint32 db_lowguid = creature->GetDBTableGUIDLow(); - if (!creature->LoadCreatureFromDB(db_lowguid, map)) + if (!creaturLoadCreatureFromDB(db_lowguid, map)) { delete creature; - Eluna::Push(E->L); + Eluna::Push(L); return 1; } eObjectMgr->AddCreatureToGrid(db_lowguid, eObjectMgr->GetCreatureData(db_lowguid)); - Eluna::Push(E->L, creature); + Eluna::Push(L, creature); } else { TempSummon* creature = map->SummonCreature(entry, pos, NULL, durorresptime); if (!creature) { - Eluna::Push(E->L); + Eluna::Push(L); return 1; } @@ -1459,7 +1459,7 @@ namespace LuaGlobalFunctions else creature->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN); - Eluna::Push(E->L, creature); + Eluna::Push(L, creature); } return 1; @@ -1470,13 +1470,13 @@ namespace LuaGlobalFunctions const GameObjectTemplate* objectInfo = eObjectMgr->GetGameObjectTemplate(entry); if (!objectInfo) { - Eluna::Push(E->L); + Eluna::Push(L); return 1; } if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId)) { - Eluna::Push(E->L); + Eluna::Push(L); return 1; } @@ -1486,7 +1486,7 @@ namespace LuaGlobalFunctions if (!object->Create(lowguid, objectInfo->entry, map, phase, x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) { delete object; - Eluna::Push(E->L); + Eluna::Push(L); return 1; } @@ -1502,7 +1502,7 @@ namespace LuaGlobalFunctions if (!object->LoadGameObjectFromDB(lowguid, map)) { delete object; - Eluna::Push(E->L); + Eluna::Push(L); return 1; } @@ -1510,11 +1510,11 @@ namespace LuaGlobalFunctions } else map->AddToMap(object); - Eluna::Push(E->L, object); + Eluna::Push(L, object); return 1; } #endif - Eluna::Push(E->L); + Eluna::Push(L); return 1; } @@ -1525,14 +1525,14 @@ namespace LuaGlobalFunctions * @param uint32 size : size of opcode * @return [WorldPacket] packet */ - int CreatePacket(Eluna* E) + int CreatePacket(Eluna* /*E*/, lua_State* L) { - uint32 opcode = Eluna::CHECKVAL(E->L, 1); - uint32 size = Eluna::CHECKVAL(E->L, 2); + uint32 opcode = Eluna::CHECKVAL(L, 1); + uint32 size = Eluna::CHECKVAL(L, 2); if (opcode >= NUM_MSG_TYPES) - return luaL_argerror(E->L, 1, "valid opcode expected"); + return luaL_argerror(L, 1, "valid opcode expected"); - Eluna::Push(E->L, new WorldPacket((OpcodesList)opcode, size)); + Eluna::Push(L, new WorldPacket((OpcodesList)opcode, size)); return 1; } @@ -1545,13 +1545,13 @@ namespace LuaGlobalFunctions * @param uint32 incrtime : combined with maxcount, incrtime tells how often (in seconds) the vendor list is refreshed and the limited [Item] copies are restocked * @param uint32 extendedcost : unique cost of an [Item], such as conquest points for example */ - int AddVendorItem(Eluna* E) + int AddVendorItem(Eluna* /*E*/, lua_State* L) { - uint32 entry = Eluna::CHECKVAL(E->L, 1); - uint32 item = Eluna::CHECKVAL(E->L, 2); - int maxcount = Eluna::CHECKVAL(E->L, 3); - uint32 incrtime = Eluna::CHECKVAL(E->L, 4); - uint32 extendedcost = Eluna::CHECKVAL(E->L, 5); + uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 item = Eluna::CHECKVAL(L, 2); + int maxcount = Eluna::CHECKVAL(L, 3); + uint32 incrtime = Eluna::CHECKVAL(L, 4); + uint32 extendedcost = Eluna::CHECKVAL(L, 5); #ifndef TRINITY if (!eObjectMgr->IsVendorItemValid(false, "npc_vendor", entry, item, maxcount, incrtime, extendedcost, 0)) @@ -1581,12 +1581,12 @@ namespace LuaGlobalFunctions * @param uint32 entry : [Creature] entry Id * @param uint32 item : [Item] entry Id */ - int VendorRemoveItem(Eluna* E) + int VendorRemoveItem(Eluna* /*E*/, lua_State* L) { - uint32 entry = Eluna::CHECKVAL(E->L, 1); - uint32 item = Eluna::CHECKVAL(E->L, 2); + uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 item = Eluna::CHECKVAL(L, 2); if (!eObjectMgr->GetCreatureTemplate(entry)) - return luaL_argerror(E->L, 1, "valid CreatureEntry expected"); + return luaL_argerror(L, 1, "valid CreatureEntry expected"); #ifdef CATA eObjectMgr->RemoveVendorItem(entry, item, 1); @@ -1601,9 +1601,9 @@ namespace LuaGlobalFunctions * * @param uint32 entry : [Creature] entry Id */ - int VendorRemoveAllItems(Eluna* E) + int VendorRemoveAllItems(Eluna* /*E*/, lua_State* L) { - uint32 entry = Eluna::CHECKVAL(E->L, 1); + uint32 entry = Eluna::CHECKVAL(L, 1); VendorItemData const* items = eObjectMgr->GetNpcVendorItemList(entry); if (!items || items->Empty()) @@ -1624,9 +1624,9 @@ namespace LuaGlobalFunctions * * @param [Player] player : [Player] to kick */ - int Kick(Eluna* E) + int Kick(Eluna* /*E*/, lua_State* L) { - Player* player = Eluna::CHECKOBJ(E->L, 1); + Player* player = Eluna::CHECKOBJ(L, 1); player->GetSession()->KickPlayer(); return 0; } @@ -1649,13 +1649,13 @@ namespace LuaGlobalFunctions * @param string reason = "" : ban reason, this is optional * @param string whoBanned = "" : the [Player]'s name that banned the account, character or IP, this is optional */ - int Ban(Eluna* E) + int Ban(Eluna* /*E*/, lua_State* L) { - int banMode = Eluna::CHECKVAL(E->L, 1); - std::string nameOrIP = Eluna::CHECKVAL(E->L, 2); - uint32 duration = Eluna::CHECKVAL(E->L, 3); - const char* reason = Eluna::CHECKVAL(E->L, 4, ""); - const char* whoBanned = Eluna::CHECKVAL(E->L, 5, ""); + int banMode = Eluna::CHECKVAL(L, 1); + std::string nameOrIP = Eluna::CHECKVAL(L, 2); + uint32 duration = Eluna::CHECKVAL(L, 3); + const char* reason = Eluna::CHECKVAL(L, 4, ""); + const char* whoBanned = Eluna::CHECKVAL(L, 5, ""); switch (banMode) { @@ -1688,7 +1688,7 @@ namespace LuaGlobalFunctions * Saves all [Player]s * */ - int SaveAllPlayers(Eluna* /*E*/) + int SaveAllPlayers(Eluna* /*E*/, lua_State* /*L*/) { eObjectAccessor->SaveAllPlayers(); return 0; @@ -1722,18 +1722,18 @@ namespace LuaGlobalFunctions * @param uint32 entry = 0 : entry of an [Item] to send with mail * @param uint32 amount = 0 : amount of the [Item] to send with mail */ - int SendMail(Eluna* E) + int SendMail(Eluna* /*E*/, lua_State* L) { int i = 0; - std::string subject = Eluna::CHECKVAL(E->L, ++i); - std::string text = Eluna::CHECKVAL(E->L, ++i); - uint32 receiverGUIDLow = Eluna::CHECKVAL(E->L, ++i); - uint32 senderGUIDLow = Eluna::CHECKVAL(E->L, ++i, 0); - uint32 stationary = Eluna::CHECKVAL(E->L, ++i, MAIL_STATIONERY_DEFAULT); - uint32 delay = Eluna::CHECKVAL(E->L, ++i, 0); - uint32 money = Eluna::CHECKVAL(E->L, ++i, 0); - uint32 cod = Eluna::CHECKVAL(E->L, ++i, 0); - int argAmount = lua_gettop(E->L); + std::string subject = Eluna::CHECKVAL(L, ++i); + std::string text = Eluna::CHECKVAL(L, ++i); + uint32 receiverGUIDLow = Eluna::CHECKVAL(L, ++i); + uint32 senderGUIDLow = Eluna::CHECKVAL(L, ++i, 0); + uint32 stationary = Eluna::CHECKVAL(L, ++i, MAIL_STATIONERY_DEFAULT); + uint32 delay = Eluna::CHECKVAL(L, ++i, 0); + uint32 money = Eluna::CHECKVAL(L, ++i, 0); + uint32 cod = Eluna::CHECKVAL(L, ++i, 0); + int argAmount = lua_gettop(L); MailSender sender(MAIL_NORMAL, senderGUIDLow, (MailStationery)stationary); MailDraft draft(subject, text); @@ -1756,8 +1756,8 @@ namespace LuaGlobalFunctions uint8 addedItems = 0; while (addedItems <= MAX_MAIL_ITEMS && i + 2 <= argAmount) { - uint32 entry = Eluna::CHECKVAL(E->L, ++i); - uint32 amount = Eluna::CHECKVAL(E->L, ++i); + uint32 entry = Eluna::CHECKVAL(L, ++i); + uint32 amount = Eluna::CHECKVAL(L, ++i); #ifndef TRINITY ItemTemplate const* item_proto = ObjectMgr::GetItemPrototype(entry); @@ -1766,12 +1766,12 @@ namespace LuaGlobalFunctions #endif if (!item_proto) { - luaL_error(E->L, "Item entry %d does not exist", entry); + luaL_error(L, "Item entry %d does not exist", entry); continue; } if (amount < 1 || (item_proto->MaxCount > 0 && amount > uint32(item_proto->MaxCount))) { - luaL_error(E->L, "Item entry %d has invalid amount %d", entry, amount); + luaL_error(L, "Item entry %d has invalid amount %d", entry, amount); continue; } if (Item* item = Item::CreateItem(entry, amount)) @@ -1802,11 +1802,11 @@ namespace LuaGlobalFunctions * @param uint32 b * @return uint32 result */ - int bit_and(Eluna* E) + int bit_and(Eluna* /*E*/, lua_State* L) { - uint32 a = Eluna::CHECKVAL(E->L, 1); - uint32 b = Eluna::CHECKVAL(E->L, 2); - Eluna::Push(E->L, a & b); + uint32 a = Eluna::CHECKVAL(L, 1); + uint32 b = Eluna::CHECKVAL(L, 2); + Eluna::Push(L, a & b); return 1; } @@ -1817,11 +1817,11 @@ namespace LuaGlobalFunctions * @param uint32 b * @return uint32 result */ - int bit_or(Eluna* E) + int bit_or(Eluna* /*E*/, lua_State* L) { - uint32 a = Eluna::CHECKVAL(E->L, 1); - uint32 b = Eluna::CHECKVAL(E->L, 2); - Eluna::Push(E->L, a | b); + uint32 a = Eluna::CHECKVAL(L, 1); + uint32 b = Eluna::CHECKVAL(L, 2); + Eluna::Push(L, a | b); return 1; } @@ -1832,11 +1832,11 @@ namespace LuaGlobalFunctions * @param uint32 b * @return uint32 result */ - int bit_lshift(Eluna* E) + int bit_lshift(Eluna* /*E*/, lua_State* L) { - uint32 a = Eluna::CHECKVAL(E->L, 1); - uint32 b = Eluna::CHECKVAL(E->L, 2); - Eluna::Push(E->L, a << b); + uint32 a = Eluna::CHECKVAL(L, 1); + uint32 b = Eluna::CHECKVAL(L, 2); + Eluna::Push(L, a << b); return 1; } @@ -1847,11 +1847,11 @@ namespace LuaGlobalFunctions * @param uint32 b * @return uint32 result */ - int bit_rshift(Eluna* E) + int bit_rshift(Eluna* /*E*/, lua_State* L) { - uint32 a = Eluna::CHECKVAL(E->L, 1); - uint32 b = Eluna::CHECKVAL(E->L, 2); - Eluna::Push(E->L, a >> b); + uint32 a = Eluna::CHECKVAL(L, 1); + uint32 b = Eluna::CHECKVAL(L, 2); + Eluna::Push(L, a >> b); return 1; } @@ -1862,11 +1862,11 @@ namespace LuaGlobalFunctions * @param uint32 b * @return uint32 result */ - int bit_xor(Eluna* E) + int bit_xor(Eluna* /*E*/, lua_State* L) { - uint32 a = Eluna::CHECKVAL(E->L, 1); - uint32 b = Eluna::CHECKVAL(E->L, 2); - Eluna::Push(E->L, a ^ b); + uint32 a = Eluna::CHECKVAL(L, 1); + uint32 b = Eluna::CHECKVAL(L, 2); + Eluna::Push(L, a ^ b); return 1; } @@ -1876,10 +1876,10 @@ namespace LuaGlobalFunctions * @param uint32 a * @return uint32 result */ - int bit_not(Eluna* E) + int bit_not(Eluna* /*E*/, lua_State* L) { - uint32 a = Eluna::CHECKVAL(E->L, 1); - Eluna::Push(E->L, ~a); + uint32 a = Eluna::CHECKVAL(L, 1); + Eluna::Push(L, ~a); return 1; } @@ -1902,66 +1902,66 @@ namespace LuaGlobalFunctions * @param uint32 pathId = 0 : path Id of the taxi path * @return uint32 actualPathId */ - int AddTaxiPath(Eluna* E) + int AddTaxiPath(Eluna* /*E*/, lua_State* L) { - luaL_checktype(E->L, 1, LUA_TTABLE); - uint32 mountA = Eluna::CHECKVAL(E->L, 2); - uint32 mountH = Eluna::CHECKVAL(E->L, 3); - uint32 price = Eluna::CHECKVAL(E->L, 4, 0); - uint32 pathId = Eluna::CHECKVAL(E->L, 5, 0); - lua_pushvalue(E->L, 1); + luaL_checktype(L, 1, LUA_TTABLE); + uint32 mountA = Eluna::CHECKVAL(L, 2); + uint32 mountH = Eluna::CHECKVAL(L, 3); + uint32 price = Eluna::CHECKVAL(L, 4, 0); + uint32 pathId = Eluna::CHECKVAL(L, 5, 0); + lua_pushvalue(L, 1); std::list nodes; - int start = lua_gettop(E->L); + int start = lua_gettop(L); int end = start; - Eluna::Push(E->L); - while (lua_next(E->L, -2) != 0) + Eluna::Push(L); + while (lua_next(L, -2) != 0) { - luaL_checktype(E->L, -1, LUA_TTABLE); - Eluna::Push(E->L); - while (lua_next(E->L, -2) != 0) + luaL_checktype(L, -1, LUA_TTABLE); + Eluna::Push(L); + while (lua_next(L, -2) != 0) { - lua_insert(E->L, end++); + lua_insert(L, end++); } if (start == end) continue; if (end - start < 4) // no mandatory args, dont add { while (end != start) - if (!lua_isnone(E->L, --end)) - lua_remove(E->L, end); + if (!lua_isnone(L, --end)) + lua_remove(L, end); continue; } while (end - start < 8) // fill optional args with 0 { - Eluna::Push(E->L, 0); - lua_insert(E->L, end++); + Eluna::Push(L, 0); + lua_insert(L, end++); } TaxiPathNodeEntry* entry = new TaxiPathNodeEntry(); // mandatory - entry->mapid = Eluna::CHECKVAL(E->L, start); - entry->x = Eluna::CHECKVAL(E->L, start + 1); - entry->y = Eluna::CHECKVAL(E->L, start + 2); - entry->z = Eluna::CHECKVAL(E->L, start + 3); + entry->mapid = Eluna::CHECKVAL(L, start); + entry->x = Eluna::CHECKVAL(L, start + 1); + entry->y = Eluna::CHECKVAL(L, start + 2); + entry->z = Eluna::CHECKVAL(L, start + 3); // optional - entry->actionFlag = Eluna::CHECKVAL(E->L, start + 4, 0); - entry->delay = Eluna::CHECKVAL(E->L, start + 5, 0); + entry->actionFlag = Eluna::CHECKVAL(L, start + 4, 0); + entry->delay = Eluna::CHECKVAL(L, start + 5, 0); nodes.push_back(*entry); while (end != start) // remove args - if (!lua_isnone(E->L, --end)) - lua_remove(E->L, end); + if (!lua_isnone(L, --end)) + lua_remove(L, end); - lua_pop(E->L, 1); + lua_pop(L, 1); } if (nodes.size() < 2) { - Eluna::Push(E->L); + Eluna::Push(L); return 1; } if (!pathId) @@ -1991,11 +1991,11 @@ namespace LuaGlobalFunctions } if (startNode >= nodeId) { - Eluna::Push(E->L); + Eluna::Push(L); return 1; } sTaxiPathSetBySource[startNode][nodeId - 1] = TaxiPathBySourceAndDestination(pathId, price); - Eluna::Push(E->L, pathId); + Eluna::Push(L, pathId); return 1; } @@ -2004,9 +2004,9 @@ namespace LuaGlobalFunctions * * @param [Corpse] corpse : [Corpse] to add */ - int AddCorpse(Eluna* E) + int AddCorpse(Eluna* /*E*/, lua_State* L) { - Corpse* corpse = Eluna::CHECKOBJ(E->L, 1); + Corpse* corpse = Eluna::CHECKOBJ(L, 1); eObjectAccessor->AddCorpse(corpse); return 0; @@ -2017,11 +2017,11 @@ namespace LuaGlobalFunctions * * @param [Corpse] corpse : [Corpse] to remove */ - int RemoveCorpse(Eluna* E) + int RemoveCorpse(Eluna* /*E*/, lua_State* L) { - Corpse* corpse = Eluna::CHECKOBJ(E->L, 1); + Corpse* corpse = Eluna::CHECKOBJ(L, 1); eObjectAccessor->RemoveCorpse(corpse); - Eluna::CHECKOBJ(E->L, 1)->Invalidate(); + Eluna::CHECKOBJ(L, 1)->Invalidate(); return 1; } @@ -2032,12 +2032,12 @@ namespace LuaGlobalFunctions * @param bool insignia = false : if true, it allows insignia to be looted * @return [Corpse] corpse : returns converted [Corpse] */ - int ConvertCorpseForPlayer(Eluna* E) + int ConvertCorpseForPlayer(Eluna* /*E*/, lua_State* L) { - uint64 guid = Eluna::CHECKVAL(E->L, 1); - bool insignia = Eluna::CHECKVAL(E->L, 2, false); + uint64 guid = Eluna::CHECKVAL(L, 1); + bool insignia = Eluna::CHECKVAL(L, 2, false); - Eluna::Push(E->L, eObjectAccessor->ConvertCorpseForPlayer(ObjectGuid(guid), insignia)); + Eluna::Push(L, eObjectAccessor->ConvertCorpseForPlayer(ObjectGuid(guid), insignia)); return 0; } @@ -2045,7 +2045,7 @@ namespace LuaGlobalFunctions * Removes old [Corpse]s from the world * */ - int RemoveOldCorpses(Eluna* /*E*/) + int RemoveOldCorpses(Eluna* /*E*/, lua_State* L) { eObjectAccessor->RemoveOldCorpses(); return 0; @@ -2057,15 +2057,15 @@ namespace LuaGlobalFunctions * @param uint32 zoneId : zone Id to check for [Weather] * @return [Weather] weather */ - int FindWeather(Eluna* E) + int FindWeather(Eluna* /*E*/, lua_State* L) { - uint32 zoneId = Eluna::CHECKVAL(E->L, 1); + uint32 zoneId = Eluna::CHECKVAL(L, 1); #ifndef TRINITY Weather* weather = eWorld->FindWeather(zoneId); #else Weather* weather = WeatherMgr::FindWeather(zoneId); #endif - Eluna::Push(E->L, weather); + Eluna::Push(L, weather); return 1; } @@ -2075,15 +2075,15 @@ namespace LuaGlobalFunctions * @param uint32 zoneId : zone Id to add [Weather] * @return [Weather] weather */ - int AddWeather(Eluna* E) + int AddWeather(Eluna* /*E*/, lua_State* L) { - uint32 zoneId = Eluna::CHECKVAL(E->L, 1); + uint32 zoneId = Eluna::CHECKVAL(L, 1); #ifndef TRINITY Weather* weather = eWorld->AddWeather(zoneId); #else Weather* weather = WeatherMgr::AddWeather(zoneId); #endif - Eluna::Push(E->L, weather); + Eluna::Push(L, weather); return 1; } @@ -2092,9 +2092,9 @@ namespace LuaGlobalFunctions * * @param uint32 zoneId : zone Id to remove [Weather] */ - int RemoveWeather(Eluna* E) + int RemoveWeather(Eluna* /*E*/, lua_State* L) { - uint32 zoneId = Eluna::CHECKVAL(E->L, 1); + uint32 zoneId = Eluna::CHECKVAL(L, 1); #ifndef TRINITY eWorld->RemoveWeather(zoneId); #else @@ -2108,9 +2108,9 @@ namespace LuaGlobalFunctions * * @param [Player] player : [Player] to send the normal weather to */ - int SendFineWeatherToPlayer(Eluna* E) + int SendFineWeatherToPlayer(Eluna* /*E*/, lua_State* L) { - Player* player = Eluna::CHECKOBJ(E->L, 1); + Player* player = Eluna::CHECKOBJ(L, 1); #ifndef TRINITY Weather::SendFineWeatherUpdateToPlayer(player); #else @@ -2144,12 +2144,12 @@ namespace LuaGlobalFunctions * @param uint8 slot : the slot the [Item] is in within the bag, you can get this with [Item:GetSlot] * @return bool isInventoryPos */ - int IsInventoryPos(Eluna* E) + int IsInventoryPos(Eluna* /*E*/, lua_State* L) { - uint8 bag = Eluna::CHECKVAL(E->L, 1); - uint8 slot = Eluna::CHECKVAL(E->L, 2); + uint8 bag = Eluna::CHECKVAL(L, 1); + uint8 slot = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, Player::IsInventoryPos(bag, slot)); + Eluna::Push(L, Player::IsInventoryPos(bag, slot)); return 1; } @@ -2178,12 +2178,12 @@ namespace LuaGlobalFunctions * @param uint8 slot : the slot the [Item] is in within the bag, you can get this with [Item:GetSlot] * @return bool isEquipmentPosition */ - int IsEquipmentPos(Eluna* E) + int IsEquipmentPos(Eluna* /*E*/, lua_State* L) { - uint8 bag = Eluna::CHECKVAL(E->L, 1); - uint8 slot = Eluna::CHECKVAL(E->L, 2); + uint8 bag = Eluna::CHECKVAL(L, 1); + uint8 slot = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, Player::IsEquipmentPos(bag, slot)); + Eluna::Push(L, Player::IsEquipmentPos(bag, slot)); return 1; } @@ -2212,12 +2212,12 @@ namespace LuaGlobalFunctions * @param uint8 slot : the slot the [Item] is in within the bag, you can get this with [Item:GetSlot] * @return bool isBankPosition */ - int IsBankPos(Eluna* E) + int IsBankPos(Eluna* /*E*/, lua_State* L) { - uint8 bag = Eluna::CHECKVAL(E->L, 1); - uint8 slot = Eluna::CHECKVAL(E->L, 2); + uint8 bag = Eluna::CHECKVAL(L, 1); + uint8 slot = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, Player::IsBankPos(bag, slot)); + Eluna::Push(L, Player::IsBankPos(bag, slot)); return 1; } @@ -2246,12 +2246,12 @@ namespace LuaGlobalFunctions * @param uint8 slot : the slot the [Item] is in within the bag, you can get this with [Item:GetSlot] * @return bool isBagPosition */ - int IsBagPos(Eluna* E) + int IsBagPos(Eluna* /*E*/, lua_State* L) { - uint8 bag = Eluna::CHECKVAL(E->L, 1); - uint8 slot = Eluna::CHECKVAL(E->L, 2); + uint8 bag = Eluna::CHECKVAL(L, 1); + uint8 slot = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, Player::IsBagPos((bag << 8) + slot)); + Eluna::Push(L, Player::IsBagPos((bag << 8) + slot)); return 1; } } diff --git a/GroupMethods.h b/GroupMethods.h index 301613e..1d0836d 100644 --- a/GroupMethods.h +++ b/GroupMethods.h @@ -15,10 +15,10 @@ namespace LuaGroup * @param uint64 guid : guid of a possible leader * @return bool isLeader */ - int IsLeader(Eluna* E, Group* group) + int IsLeader(Eluna* /*E*/, lua_State* L, Group* group) { - uint64 guid = Eluna::CHECKVAL(E->L, 2); - Eluna::Push(E->L, group->IsLeader(ObjectGuid(guid))); + uint64 guid = Eluna::CHECKVAL(L, 2); + Eluna::Push(L, group->IsLeader(ObjectGuid(guid))); return 1; } @@ -27,9 +27,9 @@ namespace LuaGroup * * @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; } @@ -38,9 +38,9 @@ namespace LuaGroup * * @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; } @@ -49,9 +49,9 @@ namespace LuaGroup * * @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; } @@ -61,10 +61,10 @@ namespace LuaGroup * @param [Player] player : [Player] to check * @return bool isMember */ - int IsMember(Eluna* E, Group* group) + int IsMember(Eluna* /*E*/, lua_State* L, Group* group) { - Player* player = Eluna::CHECKOBJ(E->L, 2); - Eluna::Push(E->L, group->IsMember(player->GET_GUID())); + Player* player = Eluna::CHECKOBJ(L, 2); + Eluna::Push(L, group->IsMember(player->GET_GUID())); return 1; } @@ -74,11 +74,11 @@ namespace LuaGroup * @param [Player] player : [Player] to check * @return bool isAssistant */ - int IsAssistant(Eluna* E, Group* group) + int IsAssistant(Eluna* /*E*/, lua_State* L, Group* group) { - Player* player = Eluna::CHECKOBJ(E->L, 2); + Player* player = Eluna::CHECKOBJ(L, 2); - Eluna::Push(E->L, group->IsAssistant(player->GET_GUID())); + Eluna::Push(L, group->IsAssistant(player->GET_GUID())); return 1; } @@ -89,11 +89,11 @@ namespace LuaGroup * @param [Player] player2 : second [Player] to check * @return bool sameSubGroup */ - int SameSubGroup(Eluna* E, Group* group) + int SameSubGroup(Eluna* /*E*/, lua_State* L, Group* group) { - Player* player1 = Eluna::CHECKOBJ(E->L, 2); - Player* player2 = Eluna::CHECKOBJ(E->L, 3); - Eluna::Push(E->L, group->SameSubGroup(player1, player2)); + Player* player1 = Eluna::CHECKOBJ(L, 2); + Player* player2 = Eluna::CHECKOBJ(L, 3); + Eluna::Push(L, group->SameSubGroup(player1, player2)); return 1; } @@ -103,10 +103,10 @@ namespace LuaGroup * @param uint8 subGroup : subGroup ID to check * @return bool hasFreeSlot */ - int HasFreeSlotSubGroup(Eluna* E, Group* group) + int HasFreeSlotSubGroup(Eluna* /*E*/, lua_State* L, Group* group) { - uint8 subGroup = Eluna::CHECKVAL(E->L, 2); - Eluna::Push(E->L, group->HasFreeSlotSubGroup(subGroup)); + uint8 subGroup = Eluna::CHECKVAL(L, 2); + Eluna::Push(L, group->HasFreeSlotSubGroup(subGroup)); return 1; } @@ -116,23 +116,23 @@ namespace LuaGroup * @param [Player] player : [Player] to invite * @return bool invited */ - int AddInvite(Eluna* E, Group* group) + int AddInvite(Eluna* /*E*/, lua_State* L, Group* group) { - Player* player = Eluna::CHECKOBJ(E->L, 2); + Player* player = Eluna::CHECKOBJ(L, 2); - Eluna::Push(E->L, group->AddInvite(player)); + Eluna::Push(L, group->AddInvite(player)); 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; }*/ - /*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; }*/ @@ -141,10 +141,10 @@ namespace LuaGroup * * @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); - int tbl = lua_gettop(E->L); + lua_newtable(L); + int tbl = lua_gettop(L); uint32 i = 0; for (GroupReference* itr = group->GetFirstMember(); itr; itr = itr->next()) @@ -159,12 +159,12 @@ namespace LuaGroup continue; ++i; - Eluna::Push(E->L, i); - Eluna::Push(E->L, member); - lua_settable(E->L, tbl); + Eluna::Push(L, i); + Eluna::Push(L, member); + 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; } @@ -173,12 +173,12 @@ namespace LuaGroup * * @return uint64 leaderGUID */ - int GetLeaderGUID(Eluna* E, Group* group) + int GetLeaderGUID(Eluna* /*E*/, lua_State* L, Group* group) { #ifndef TRINITY - Eluna::Push(E->L, group->GetLeaderGuid()); + Eluna::Push(L, group->GetLeaderGuid()); #else - Eluna::Push(E->L, group->GetLeaderGUID()); + Eluna::Push(L, group->GetLeaderGUID()); #endif return 1; } @@ -188,12 +188,12 @@ namespace LuaGroup * * @return [Player] leader */ - int GetLeader(Eluna* E, Group* group) + int GetLeader(Eluna* /*E*/, lua_State* L, Group* group) { #ifndef TRINITY - Eluna::Push(E->L, eObjectAccessor->FindPlayer(group->GetLeaderGuid())); + Eluna::Push(L, eObjectAccessor->FindPlayer(group->GetLeaderGuid())); #else - Eluna::Push(E->L, eObjectAccessor->FindPlayer(group->GetLeaderGUID())); + Eluna::Push(L, eObjectAccessor->FindPlayer(group->GetLeaderGUID())); #endif return 1; } @@ -203,12 +203,12 @@ namespace LuaGroup * * @return uint64 groupGUID */ - int GetGUID(Eluna* E, Group* group) + int GetGUID(Eluna* /*E*/, lua_State* L, Group* group) { #ifdef CLASSIC - Eluna::Push(E->L, group->GetId()); + Eluna::Push(L, group->GetId()); #else - Eluna::Push(E->L, group->GET_GUID()); + Eluna::Push(L, group->GET_GUID()); #endif return 1; } @@ -219,13 +219,13 @@ namespace LuaGroup * @param string name : the [Player]'s name * @return uint64 memberGUID */ - int GetMemberGUID(Eluna* E, Group* group) + int GetMemberGUID(Eluna* /*E*/, lua_State* L, Group* group) { - const char* name = Eluna::CHECKVAL(E->L, 2); + const char* name = Eluna::CHECKVAL(L, 2); #ifndef TRINITY - Eluna::Push(E->L, group->GetMemberGuid(name)); + Eluna::Push(L, group->GetMemberGuid(name)); #else - Eluna::Push(E->L, group->GetMemberGUID(name)); + Eluna::Push(L, group->GetMemberGUID(name)); #endif return 1; } @@ -235,9 +235,9 @@ namespace LuaGroup * * @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; } @@ -247,11 +247,11 @@ namespace LuaGroup * @param [Player] player : the [Player] to check * @return uint8 subGroupID */ - int GetMemberGroup(Eluna* E, Group* group) + int GetMemberGroup(Eluna* /*E*/, lua_State* L, Group* group) { - Player* player = Eluna::CHECKOBJ(E->L, 2); + Player* player = Eluna::CHECKOBJ(L, 2); - Eluna::Push(E->L, group->GetMemberGroup(player->GET_GUID())); + Eluna::Push(L, group->GetMemberGroup(player->GET_GUID())); return 1; } @@ -260,9 +260,9 @@ namespace LuaGroup * * @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(E->L, 2); + Player* leader = Eluna::CHECKOBJ(L, 2); group->ChangeLeader(leader->GET_GUID()); return 0; @@ -275,11 +275,11 @@ namespace LuaGroup * @param bool ignorePlayersInBg : ignores [Player]s in a battleground * @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(E->L, 2); - bool ignorePlayersInBg = Eluna::CHECKVAL(E->L, 3); - uint64 ignore = Eluna::CHECKVAL(E->L, 4); + WorldPacket* data = Eluna::CHECKOBJ(L, 2); + bool ignorePlayersInBg = Eluna::CHECKVAL(L, 3); + uint64 ignore = Eluna::CHECKVAL(L, 4); group->BroadcastPacket(data, ignorePlayersInBg, -1, ObjectGuid(ignore)); return 0; @@ -302,15 +302,15 @@ namespace LuaGroup * @param [RemoveMethod] method : method used to remove the player * @return bool removed */ - int RemoveMember(Eluna* E, Group* group) + int RemoveMember(Eluna* /*E*/, lua_State* L, Group* group) { - Player* player = Eluna::CHECKOBJ(E->L, 2); - uint32 method = Eluna::CHECKVAL(E->L, 3, 0); + Player* player = Eluna::CHECKOBJ(L, 2); + uint32 method = Eluna::CHECKVAL(L, 3, 0); #ifndef TRINITY - Eluna::Push(E->L, group->RemoveMember(player->GET_GUID(), method)); + Eluna::Push(L, group->RemoveMember(player->GET_GUID(), method)); #else - Eluna::Push(E->L, group->RemoveMember(player->GET_GUID(), (RemoveMethod)method)); + Eluna::Push(L, group->RemoveMember(player->GET_GUID(), (RemoveMethod)method)); #endif return 1; } @@ -319,7 +319,7 @@ namespace LuaGroup * Disbands this [Group] * */ - int Disband(Eluna* /*E*/, Group* group) + int Disband(Eluna* /*E*/, lua_State* /*L*/, Group* group) { group->Disband(); return 0; @@ -329,7 +329,7 @@ namespace LuaGroup * Converts this [Group] to a raid [Group] * */ - int ConvertToRaid(Eluna* /*E*/, Group* group) + int ConvertToRaid(Eluna* /*E*/, lua_State* /*L*/, Group* group) { group->ConvertToRaid(); return 0; @@ -341,10 +341,10 @@ namespace LuaGroup * @param [Player] player : [Player] to move * @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(E->L, 2); - uint8 groupID = Eluna::CHECKVAL(E->L, 3); + Player* player = Eluna::CHECKOBJ(L, 2); + uint8 groupID = Eluna::CHECKVAL(L, 3); group->ChangeMembersGroup(player->GET_GUID(), groupID); return 0; @@ -357,14 +357,14 @@ namespace LuaGroup * @param uint64 target : GUID of the icon target, 0 is to clear the icon * @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(E->L, 2); - uint64 target = Eluna::CHECKVAL(E->L, 3); - uint64 setter = Eluna::CHECKVAL(E->L, 4, 0); + uint8 icon = Eluna::CHECKVAL(L, 2); + uint64 target = Eluna::CHECKVAL(L, 3); + uint64 setter = Eluna::CHECKVAL(L, 4, 0); 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)) group->SetTargetIcon(icon, ObjectGuid(target)); @@ -374,7 +374,7 @@ namespace LuaGroup return 0; } - /*int ConvertToLFG(Eluna* E, Group* group) // TODO: Implementation + /*int ConvertToLFG(Eluna* E, lua_State* L, Group* group) // TODO: Implementation { group->ConvertToLFG(); return 0; diff --git a/GuildMethods.h b/GuildMethods.h index 20dea68..af220e7 100644 --- a/GuildMethods.h +++ b/GuildMethods.h @@ -10,10 +10,10 @@ namespace LuaGuild { /* GETTERS */ - int GetMembers(Eluna* E, Guild* guild) + int GetMembers(Eluna* /*E*/, lua_State* L, Guild* guild) { - lua_newtable(E->L); - int tbl = lua_gettop(E->L); + lua_newtable(L); + int tbl = lua_gettop(L); uint32 i = 0; SessionMap const& sessions = eWorld->GetAllSessions(); @@ -24,76 +24,76 @@ namespace LuaGuild if (player->GetSession() && (player->GetGuildId() == guild->GetId())) { ++i; - Eluna::Push(E->L, i); - Eluna::Push(E->L, player); - lua_settable(E->L, tbl); + Eluna::Push(L, i); + Eluna::Push(L, player); + 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; } - 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; } - int GetLeader(Eluna* E, Guild* guild) + int GetLeader(Eluna* /*E*/, lua_State* L, Guild* guild) { #ifndef TRINITY - Eluna::Push(E->L, eObjectAccessor->FindPlayer(guild->GetLeaderGuid())); + Eluna::Push(L, eObjectAccessor->FindPlayer(guild->GetLeaderGuid())); #else - Eluna::Push(E->L, eObjectAccessor->FindPlayer(guild->GetLeaderGUID())); + Eluna::Push(L, eObjectAccessor->FindPlayer(guild->GetLeaderGUID())); #endif return 1; } - int GetLeaderGUID(Eluna* E, Guild* guild) + int GetLeaderGUID(Eluna* /*E*/, lua_State* L, Guild* guild) { #ifndef TRINITY - Eluna::Push(E->L, guild->GetLeaderGuid()); + Eluna::Push(L, guild->GetLeaderGuid()); #else - Eluna::Push(E->L, guild->GetLeaderGUID()); + Eluna::Push(L, guild->GetLeaderGUID()); #endif 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; } - 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; } - 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; } - int GetInfo(Eluna* E, Guild* guild) + int GetInfo(Eluna* /*E*/, lua_State* L, Guild* guild) { #ifndef TRINITY - Eluna::Push(E->L, guild->GetGINFO()); + Eluna::Push(L, guild->GetGINFO()); #else - Eluna::Push(E->L, guild->GetInfo()); + Eluna::Push(L, guild->GetInfo()); #endif return 1; } /* SETTERS */ #ifndef CATA - int SetLeader(Eluna* E, Guild* guild) + int SetLeader(Eluna* /*E*/, lua_State* L, Guild* guild) { - Player* player = Eluna::CHECKOBJ(E->L, 2); + Player* player = Eluna::CHECKOBJ(L, 2); #ifndef TRINITY guild->SetLeader(player->GET_GUID()); @@ -105,10 +105,10 @@ namespace LuaGuild #endif #ifndef CLASSIC - int SetBankTabText(Eluna* E, Guild* guild) + int SetBankTabText(Eluna* /*E*/, lua_State* L, Guild* guild) { - uint8 tabId = Eluna::CHECKVAL(E->L, 2); - const char* text = Eluna::CHECKVAL(E->L, 3); + uint8 tabId = Eluna::CHECKVAL(L, 2); + const char* text = Eluna::CHECKVAL(L, 3); #ifndef TRINITY guild->SetGuildBankTabText(tabId, text); #else @@ -120,43 +120,43 @@ namespace LuaGuild /* OTHER */ // SendPacketToGuild(packet) - int SendPacket(Eluna* E, Guild* guild) + int SendPacket(Eluna* /*E*/, lua_State* L, Guild* guild) { - WorldPacket* data = Eluna::CHECKOBJ(E->L, 2); + WorldPacket* data = Eluna::CHECKOBJ(L, 2); guild->BroadcastPacket(data); return 0; } // SendPacketToRankedInGuild(packet, rankId) - int SendPacketToRanked(Eluna* E, Guild* guild) + int SendPacketToRanked(Eluna* /*E*/, lua_State* L, Guild* guild) { - WorldPacket* data = Eluna::CHECKOBJ(E->L, 2); - uint8 ranked = Eluna::CHECKVAL(E->L, 3); + WorldPacket* data = Eluna::CHECKOBJ(L, 2); + uint8 ranked = Eluna::CHECKVAL(L, 3); guild->BroadcastPacketToRank(data, ranked); return 0; } - int Disband(Eluna* /*E*/, Guild* guild) + int Disband(Eluna* /*E*/, lua_State* /*L*/, Guild* guild) { guild->Disband(); return 0; } - int AddMember(Eluna* E, Guild* guild) + int AddMember(Eluna* /*E*/, lua_State* L, Guild* guild) { - Player* player = Eluna::CHECKOBJ(E->L, 2); - uint8 rankId = Eluna::CHECKVAL(E->L, 3, GUILD_RANK_NONE); + Player* player = Eluna::CHECKOBJ(L, 2); + uint8 rankId = Eluna::CHECKVAL(L, 3, GUILD_RANK_NONE); guild->AddMember(player->GET_GUID(), rankId); return 0; } - int DeleteMember(Eluna* E, Guild* guild) + int DeleteMember(Eluna* /*E*/, lua_State* L, Guild* guild) { - Player* player = Eluna::CHECKOBJ(E->L, 2); - bool isDisbanding = Eluna::CHECKVAL(E->L, 3, false); + Player* player = Eluna::CHECKOBJ(L, 2); + bool isDisbanding = Eluna::CHECKVAL(L, 3, false); #ifndef TRINITY guild->DelMember(player->GET_GUID(), isDisbanding); @@ -166,10 +166,10 @@ namespace LuaGuild return 0; } - int SetMemberRank(Eluna* E, Guild* guild) + int SetMemberRank(Eluna* /*E*/, lua_State* L, Guild* guild) { - Player* player = Eluna::CHECKOBJ(E->L, 2); - uint8 newRank = Eluna::CHECKVAL(E->L, 3); + Player* player = Eluna::CHECKOBJ(L, 2); + uint8 newRank = Eluna::CHECKVAL(L, 3); guild->ChangeMemberRank(player->GET_GUID(), newRank); return 0; @@ -177,10 +177,10 @@ namespace LuaGuild #ifndef CLASSIC // Move to Player methods - int WithdrawBankMoney(Eluna* E, Guild* guild) + int WithdrawBankMoney(Eluna* /*E*/, lua_State* L, Guild* guild) { - Player* player = Eluna::CHECKOBJ(E->L, 2); - uint32 money = Eluna::CHECKVAL(E->L, 3); + Player* player = Eluna::CHECKOBJ(L, 2); + uint32 money = Eluna::CHECKVAL(L, 3); #ifndef TRINITY if (guild->GetGuildBankMoney() < money) return 0; @@ -192,10 +192,10 @@ namespace LuaGuild } // Move to Player methods - int DepositBankMoney(Eluna* E, Guild* guild) + int DepositBankMoney(Eluna* /*E*/, lua_State* L, Guild* guild) { - Player* player = Eluna::CHECKOBJ(E->L, 2); - uint32 money = Eluna::CHECKVAL(E->L, 3); + Player* player = Eluna::CHECKOBJ(L, 2); + uint32 money = Eluna::CHECKVAL(L, 3); #ifndef TRINITY guild->SetBankMoney(guild->GetGuildBankMoney() + money); diff --git a/ItemMethods.h b/ItemMethods.h index e1e5df3..dfc8792 100644 --- a/ItemMethods.h +++ b/ItemMethods.h @@ -10,136 +10,136 @@ namespace LuaItem { /* 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; } #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; } #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; } - int IsNotBoundToPlayer(Eluna* E, Item* item) + int IsNotBoundToPlayer(Eluna* /*E*/, lua_State* L, Item* item) { - Player* player = Eluna::CHECKOBJ(E->L, 2); + Player* player = Eluna::CHECKOBJ(L, 2); - Eluna::Push(E->L, item->IsBindedNotWith(player)); + Eluna::Push(L, item->IsBindedNotWith(player)); 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; } - 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; } #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; } #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; } - 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; } - int CanBeTraded(Eluna* E, Item* item) + int CanBeTraded(Eluna* /*E*/, lua_State* L, Item* item) { #if (defined(TBC) || defined(CLASSIC)) - Eluna::Push(E->L, item->CanBeTraded()); + Eluna::Push(L, item->CanBeTraded()); #else - bool mail = Eluna::CHECKVAL(E->L, 2, false); - Eluna::Push(E->L, item->CanBeTraded(mail)); + bool mail = Eluna::CHECKVAL(L, 2, false); + Eluna::Push(L, item->CanBeTraded(mail)); #endif 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; } - 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; } - 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; } - int HasQuest(Eluna* E, Item* item) + int HasQuest(Eluna* /*E*/, lua_State* L, Item* item) { - uint32 quest = Eluna::CHECKVAL(E->L, 2); + uint32 quest = Eluna::CHECKVAL(L, 2); #ifndef TRINITY - Eluna::Push(E->L, item->HasQuest(quest)); + Eluna::Push(L, item->HasQuest(quest)); #else - Eluna::Push(E->L, item->hasQuest(quest)); + Eluna::Push(L, item->hasQuest(quest)); #endif 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; } #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; } - 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; } #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; } /* - * 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; * } */ @@ -167,11 +167,11 @@ namespace LuaItem * @param [LocaleConstant] locale = DEFAULT_LOCALE : locale to return the [Item]'s name in * @return string itemLink */ - int GetItemLink(Eluna* E, Item* item) + int GetItemLink(Eluna* /*E*/, lua_State* L, Item* item) { - uint8 locale = Eluna::CHECKVAL(E->L, 2, DEFAULT_LOCALE); + uint8 locale = Eluna::CHECKVAL(L, 2, DEFAULT_LOCALE); 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(); std::string name = temp->Name1; @@ -223,200 +223,200 @@ namespace LuaItem item->GetItemRandomPropertyId() << ":" << item->GetItemSuffixFactor() << ":" << (uint32)item->GetOwner()->getLevel() << "|h[" << name << "]|h|r"; - Eluna::Push(E->L, oss.str()); + Eluna::Push(L, oss.str()); return 1; } - int GetOwnerGUID(Eluna* E, Item* item) + int GetOwnerGUID(Eluna* /*E*/, lua_State* L, Item* item) { #ifndef TRINITY - Eluna::Push(E->L, item->GetOwnerGuid()); + Eluna::Push(L, item->GetOwnerGuid()); #else - Eluna::Push(E->L, item->GetOwnerGUID()); + Eluna::Push(L, item->GetOwnerGUID()); #endif 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; } - 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; } - 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; } - 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; } - 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; } - int GetEnchantmentId(Eluna* E, Item* item) + int GetEnchantmentId(Eluna* /*E*/, lua_State* L, Item* item) { - uint32 enchant_slot = Eluna::CHECKVAL(E->L, 2); + uint32 enchant_slot = Eluna::CHECKVAL(L, 2); 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; } - int GetSpellId(Eluna* E, Item* item) + int GetSpellId(Eluna* /*E*/, lua_State* L, Item* item) { - uint32 index = Eluna::CHECKVAL(E->L, 2); + uint32 index = Eluna::CHECKVAL(L, 2); 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; } - int GetSpellTrigger(Eluna* E, Item* item) + int GetSpellTrigger(Eluna* /*E*/, lua_State* L, Item* item) { - uint32 index = Eluna::CHECKVAL(E->L, 2); + uint32 index = Eluna::CHECKVAL(L, 2); 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; } - 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; } - 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; } - 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; } - 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; } - 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; } - 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; } - 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; } - 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; } - 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; } - 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; } - 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; } - 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; } - 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; } #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; } #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; } #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; } #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; } - int GetBagSize(Eluna* E, Item* item) + int GetBagSize(Eluna* /*E*/, lua_State* L, Item* item) { if (Bag* bag = item->ToBag()) - Eluna::Push(E->L, bag->GetBagSize()); + Eluna::Push(L, bag->GetBagSize()); else - Eluna::Push(E->L, 0); + Eluna::Push(L, 0); return 1; } /* SETTERS */ - int SetOwner(Eluna* E, Item* item) + int SetOwner(Eluna* /*E*/, lua_State* L, Item* item) { - Player* player = Eluna::CHECKOBJ(E->L, 2); + Player* player = Eluna::CHECKOBJ(L, 2); #ifndef TRINITY item->SetOwnerGuid(player->GET_GUID()); #else @@ -425,75 +425,75 @@ namespace LuaItem return 0; } - int SetBinding(Eluna* E, Item* item) + int SetBinding(Eluna* /*E*/, lua_State* L, Item* item) { - bool soulbound = Eluna::CHECKVAL(E->L, 2); + bool soulbound = Eluna::CHECKVAL(L, 2); item->SetBinding(soulbound); return 0; } - int SetCount(Eluna* E, Item* item) + int SetCount(Eluna* /*E*/, lua_State* L, Item* item) { - uint32 count = Eluna::CHECKVAL(E->L, 2); + uint32 count = Eluna::CHECKVAL(L, 2); item->SetCount(count); return 0; } - int SetEnchantment(Eluna* E, Item* item) + int SetEnchantment(Eluna* /*E*/, lua_State* L, Item* item) { Player* owner = item->GetOwner(); if (!owner) { - Eluna::Push(E->L, false); + Eluna::Push(L, false); return 1; } - uint32 enchant = Eluna::CHECKVAL(E->L, 2); + uint32 enchant = Eluna::CHECKVAL(L, 2); if (!sSpellItemEnchantmentStore.LookupEntry(enchant)) { - Eluna::Push(E->L, false); + Eluna::Push(L, false); return 1; } - EnchantmentSlot slot = (EnchantmentSlot)Eluna::CHECKVAL(E->L, 3); + EnchantmentSlot slot = (EnchantmentSlot)Eluna::CHECKVAL(L, 3); 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); item->SetEnchantment(slot, enchant, 0, 0); owner->ApplyEnchantment(item, slot, true); - Eluna::Push(E->L, true); + Eluna::Push(L, true); return 1; } /* OTHER */ - int ClearEnchantment(Eluna* E, Item* item) + int ClearEnchantment(Eluna* /*E*/, lua_State* L, Item* item) { Player* owner = item->GetOwner(); if (!owner) { - Eluna::Push(E->L, false); + Eluna::Push(L, false); return 1; } - EnchantmentSlot slot = (EnchantmentSlot)Eluna::CHECKVAL(E->L, 2); + EnchantmentSlot slot = (EnchantmentSlot)Eluna::CHECKVAL(L, 2); 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)) { - Eluna::Push(E->L, false); + Eluna::Push(L, false); return 1; } owner->ApplyEnchantment(item, slot, false); item->ClearEnchantment(slot); - Eluna::Push(E->L, true); + Eluna::Push(L, true); return 1; } - int SaveToDB(Eluna* /*E*/, Item* item) + int SaveToDB(Eluna* /*E*/, lua_State* /*L*/, Item* item) { #ifndef TRINITY item->SaveToDB(); diff --git a/MapMethods.h b/MapMethods.h index fd20363..3b12168 100644 --- a/MapMethods.h +++ b/MapMethods.h @@ -16,9 +16,9 @@ namespace LuaMap * * @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; } #endif @@ -28,12 +28,12 @@ namespace LuaMap * * @return bool isBattleGround */ - int IsBattleground(Eluna* E, Map* map) + int IsBattleground(Eluna* /*E*/, lua_State* L, Map* map) { #ifndef TRINITY - Eluna::Push(E->L, map->IsBattleGround()); + Eluna::Push(L, map->IsBattleGround()); #else - Eluna::Push(E->L, map->IsBattleground()); + Eluna::Push(L, map->IsBattleground()); #endif return 1; } @@ -43,9 +43,9 @@ namespace LuaMap * * @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; } @@ -54,9 +54,9 @@ namespace LuaMap * * @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; } @@ -66,9 +66,9 @@ namespace LuaMap * * @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; } #endif @@ -78,9 +78,9 @@ namespace LuaMap * * @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; } @@ -89,9 +89,9 @@ namespace LuaMap * * @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; } @@ -103,18 +103,18 @@ namespace LuaMap * @param float y * @return float z */ - int GetHeight(Eluna* E, Map* map) + int GetHeight(Eluna* /*E*/, lua_State* L, Map* map) { - float x = Eluna::CHECKVAL(E->L, 2); - float y = Eluna::CHECKVAL(E->L, 3); + float x = Eluna::CHECKVAL(L, 2); + float y = Eluna::CHECKVAL(L, 3); #if (defined(TBC) || defined(CLASSIC)) float z = map->GetHeight(x, y, MAX_HEIGHT); #else - uint32 phasemask = Eluna::CHECKVAL(E->L, 4, 1); + uint32 phasemask = Eluna::CHECKVAL(L, 4, 1); float z = map->GetHeight(phasemask, x, y, MAX_HEIGHT); #endif if (z != INVALID_HEIGHT) - Eluna::Push(E->L, z); + Eluna::Push(L, z); return 1; } @@ -123,12 +123,12 @@ namespace LuaMap * * @return int32 difficulty */ - int GetDifficulty(Eluna* E, Map* map) + int GetDifficulty(Eluna* /*E*/, lua_State* L, Map* map) { #ifndef CLASSIC - Eluna::Push(E->L, map->GetDifficulty()); + Eluna::Push(L, map->GetDifficulty()); #else - Eluna::Push(E->L, (Difficulty)0); + Eluna::Push(L, (Difficulty)0); #endif return 1; } @@ -138,9 +138,9 @@ namespace LuaMap * * @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; } @@ -150,9 +150,9 @@ namespace LuaMap * * @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; } @@ -161,9 +161,9 @@ namespace LuaMap * * @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; } @@ -175,16 +175,16 @@ namespace LuaMap * @param float z * @return uint32 areaId */ - int GetAreaId(Eluna* E, Map* map) + int GetAreaId(Eluna* /*E*/, lua_State* L, Map* map) { - float x = Eluna::CHECKVAL(E->L, 2); - float y = Eluna::CHECKVAL(E->L, 3); - float z = Eluna::CHECKVAL(E->L, 4); + float x = Eluna::CHECKVAL(L, 2); + float y = Eluna::CHECKVAL(L, 3); + float z = Eluna::CHECKVAL(L, 4); #ifndef TRINITY - Eluna::Push(E->L, map->GetTerrain()->GetAreaId(x, y, z)); + Eluna::Push(L, map->GetTerrain()->GetAreaId(x, y, z)); #else - Eluna::Push(E->L, map->GetAreaId(x, y, z)); + Eluna::Push(L, map->GetAreaId(x, y, z)); #endif return 1; } @@ -194,35 +194,35 @@ namespace LuaMap * * @param uint64 guid */ - int GetWorldObject(Eluna* E, Map* map) + int GetWorldObject(Eluna* /*E*/, lua_State* L, Map* map) { - uint64 guid = Eluna::CHECKVAL(E->L, 2); + uint64 guid = Eluna::CHECKVAL(L, 2); #ifndef TRINITY - Eluna::Push(E->L, map->GetWorldObject(ObjectGuid(guid))); + Eluna::Push(L, map->GetWorldObject(ObjectGuid(guid))); #else switch (GUID_HIPART(guid)) { 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; case HIGHGUID_TRANSPORT: case HIGHGUID_MO_TRANSPORT: 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; case HIGHGUID_VEHICLE: 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; 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; 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; 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; default: break; diff --git a/ObjectMethods.h b/ObjectMethods.h index 8de905d..3dcb3f6 100644 --- a/ObjectMethods.h +++ b/ObjectMethods.h @@ -10,219 +10,219 @@ namespace LuaObject { /* BOOLEAN */ - int HasFlag(Eluna* E, Object* obj) + int HasFlag(Eluna* /*E*/, lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(E->L, 2); - uint32 flag = Eluna::CHECKVAL(E->L, 3); + uint16 index = Eluna::CHECKVAL(L, 2); + uint32 flag = Eluna::CHECKVAL(L, 3); - Eluna::Push(E->L, obj->HasFlag(index, flag)); + Eluna::Push(L, obj->HasFlag(index, flag)); 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; } /* GETTERS */ - int GetInt32Value(Eluna* E, Object* obj) + int GetInt32Value(Eluna* /*E*/, lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(E->L, 2); - Eluna::Push(E->L, obj->GetInt32Value(index)); + uint16 index = Eluna::CHECKVAL(L, 2); + Eluna::Push(L, obj->GetInt32Value(index)); return 1; } - int GetUInt32Value(Eluna* E, Object* obj) + int GetUInt32Value(Eluna* /*E*/, lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(E->L, 2); - Eluna::Push(E->L, obj->GetUInt32Value(index)); + uint16 index = Eluna::CHECKVAL(L, 2); + Eluna::Push(L, obj->GetUInt32Value(index)); return 1; } - int GetFloatValue(Eluna* E, Object* obj) + int GetFloatValue(Eluna* /*E*/, lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(E->L, 2); - Eluna::Push(E->L, obj->GetFloatValue(index)); + uint16 index = Eluna::CHECKVAL(L, 2); + Eluna::Push(L, obj->GetFloatValue(index)); return 1; } - int GetByteValue(Eluna* E, Object* obj) + int GetByteValue(Eluna* /*E*/, lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(E->L, 2); - uint8 offset = Eluna::CHECKVAL(E->L, 3); - Eluna::Push(E->L, obj->GetByteValue(index, offset)); + uint16 index = Eluna::CHECKVAL(L, 2); + uint8 offset = Eluna::CHECKVAL(L, 3); + Eluna::Push(L, obj->GetByteValue(index, offset)); return 1; } - int GetUInt16Value(Eluna* E, Object* obj) + int GetUInt16Value(Eluna* /*E*/, lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(E->L, 2); - uint8 offset = Eluna::CHECKVAL(E->L, 3); - Eluna::Push(E->L, obj->GetUInt16Value(index, offset)); + uint16 index = Eluna::CHECKVAL(L, 2); + uint8 offset = Eluna::CHECKVAL(L, 3); + Eluna::Push(L, obj->GetUInt16Value(index, offset)); 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; } - 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; } - 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; } - 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; } - 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; } - int GetUInt64Value(Eluna* E, Object* obj) + int GetUInt64Value(Eluna* /*E*/, lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(E->L, 2); + uint16 index = Eluna::CHECKVAL(L, 2); obj->GetUInt64Value(index); return 0; } /* SETTERS */ - int SetFlag(Eluna* E, Object* obj) + int SetFlag(Eluna* /*E*/, lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(E->L, 2); - uint32 flag = Eluna::CHECKVAL(E->L, 3); + uint16 index = Eluna::CHECKVAL(L, 2); + uint32 flag = Eluna::CHECKVAL(L, 3); obj->SetFlag(index, flag); return 0; } - int SetInt32Value(Eluna* E, Object* obj) + int SetInt32Value(Eluna* /*E*/, lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(E->L, 2); - int32 value = Eluna::CHECKVAL(E->L, 3); + uint16 index = Eluna::CHECKVAL(L, 2); + int32 value = Eluna::CHECKVAL(L, 3); obj->SetInt32Value(index, value); return 0; } - int SetUInt32Value(Eluna* E, Object* obj) + int SetUInt32Value(Eluna* /*E*/, lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(E->L, 2); - uint32 value = Eluna::CHECKVAL(E->L, 3); + uint16 index = Eluna::CHECKVAL(L, 2); + uint32 value = Eluna::CHECKVAL(L, 3); obj->SetUInt32Value(index, value); return 0; } - int SetFloatValue(Eluna* E, Object* obj) + int SetFloatValue(Eluna* /*E*/, lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(E->L, 2); - float value = Eluna::CHECKVAL(E->L, 3); + uint16 index = Eluna::CHECKVAL(L, 2); + float value = Eluna::CHECKVAL(L, 3); obj->SetFloatValue(index, value); return 0; } - int SetByteValue(Eluna* E, Object* obj) + int SetByteValue(Eluna* /*E*/, lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(E->L, 2); - uint8 offset = Eluna::CHECKVAL(E->L, 3); - uint8 value = Eluna::CHECKVAL(E->L, 4); + uint16 index = Eluna::CHECKVAL(L, 2); + uint8 offset = Eluna::CHECKVAL(L, 3); + uint8 value = Eluna::CHECKVAL(L, 4); obj->SetByteValue(index, offset, value); return 0; } - int SetUInt16Value(Eluna* E, Object* obj) + int SetUInt16Value(Eluna* /*E*/, lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(E->L, 2); - uint8 offset = Eluna::CHECKVAL(E->L, 3); - uint16 value = Eluna::CHECKVAL(E->L, 4); + uint16 index = Eluna::CHECKVAL(L, 2); + uint8 offset = Eluna::CHECKVAL(L, 3); + uint16 value = Eluna::CHECKVAL(L, 4); obj->SetUInt16Value(index, offset, value); return 0; } - int SetInt16Value(Eluna* E, Object* obj) + int SetInt16Value(Eluna* /*E*/, lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(E->L, 2); - uint8 offset = Eluna::CHECKVAL(E->L, 3); - int16 value = Eluna::CHECKVAL(E->L, 4); + uint16 index = Eluna::CHECKVAL(L, 2); + uint8 offset = Eluna::CHECKVAL(L, 3); + int16 value = Eluna::CHECKVAL(L, 4); obj->SetInt16Value(index, offset, value); return 0; } - int SetScale(Eluna* E, Object* obj) + int SetScale(Eluna* /*E*/, lua_State* L, Object* obj) { - float size = Eluna::CHECKVAL(E->L, 2); + float size = Eluna::CHECKVAL(L, 2); obj->SetObjectScale(size); return 0; } - int SetUInt64Value(Eluna* E, Object* obj) + int SetUInt64Value(Eluna* /*E*/, lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(E->L, 2); - uint64 value = Eluna::CHECKVAL(E->L, 3); + uint16 index = Eluna::CHECKVAL(L, 2); + uint64 value = Eluna::CHECKVAL(L, 3); obj->SetUInt64Value(index, value); return 0; } /* OTHER */ - int RemoveFlag(Eluna* E, Object* obj) + int RemoveFlag(Eluna* /*E*/, lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(E->L, 2); - uint32 flag = Eluna::CHECKVAL(E->L, 3); + uint16 index = Eluna::CHECKVAL(L, 2); + uint32 flag = Eluna::CHECKVAL(L, 3); obj->RemoveFlag(index, flag); return 0; } - int UpdateUInt32Value(Eluna* E, Object* obj) + int UpdateUInt32Value(Eluna* /*E*/, lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(E->L, 2); - uint32 value = Eluna::CHECKVAL(E->L, 3); + uint16 index = Eluna::CHECKVAL(L, 2); + uint32 value = Eluna::CHECKVAL(L, 3); obj->UpdateUInt32Value(index, value); 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; } - 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; } - 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; } - 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; } - 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; } }; diff --git a/PlayerMethods.h b/PlayerMethods.h index 4e5ab5d..c091aaa 100644 --- a/PlayerMethods.h +++ b/PlayerMethods.h @@ -11,203 +11,203 @@ namespace LuaPlayer { /* BOOLEAN */ #if (!defined(TBC) && !defined(CLASSIC)) - int CanTitanGrip(Eluna* E, Player* player) + int CanTitanGrip(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->CanTitanGrip()); + Eluna::Push(L, player->CanTitanGrip()); return 1; } - int HasTalent(Eluna* E, Player* player) + int HasTalent(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 talentId = Eluna::CHECKVAL(E->L, 2); - uint8 spec = Eluna::CHECKVAL(E->L, 3); + uint32 talentId = Eluna::CHECKVAL(L, 2); + uint8 spec = Eluna::CHECKVAL(L, 3); if (spec < MAX_TALENT_SPECS) return 1; - Eluna::Push(E->L, player->HasTalent(talentId, spec)); + Eluna::Push(L, player->HasTalent(talentId, spec)); return 1; } - int HasAchieved(Eluna* E, Player* player) + int HasAchieved(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 achievementId = Eluna::CHECKVAL(E->L, 2); + uint32 achievementId = Eluna::CHECKVAL(L, 2); #ifndef TRINITY - Eluna::Push(E->L, player->GetAchievementMgr().HasAchievement(achievementId)); + Eluna::Push(L, player->GetAchievementMgr().HasAchievement(achievementId)); #else - Eluna::Push(E->L, player->HasAchieved(achievementId)); + Eluna::Push(L, player->HasAchieved(achievementId)); #endif return 1; } #endif - int HasQuest(Eluna* E, Player* player) + int HasQuest(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 quest = Eluna::CHECKVAL(E->L, 2); + uint32 quest = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->IsActiveQuest(quest)); + Eluna::Push(L, player->IsActiveQuest(quest)); return 1; } - int HasSkill(Eluna* E, Player* player) + int HasSkill(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 skill = Eluna::CHECKVAL(E->L, 2); + uint32 skill = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->HasSkill(skill)); + Eluna::Push(L, player->HasSkill(skill)); return 1; } - int HasSpell(Eluna* E, Player* player) + int HasSpell(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 id = Eluna::CHECKVAL(E->L, 2); + uint32 id = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->HasSpell(id)); + Eluna::Push(L, player->HasSpell(id)); return 1; } - int HasAtLoginFlag(Eluna* E, Player* player) + int HasAtLoginFlag(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 flag = Eluna::CHECKVAL(E->L, 2); + uint32 flag = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->HasAtLoginFlag((AtLoginFlags)flag)); + Eluna::Push(L, player->HasAtLoginFlag((AtLoginFlags)flag)); return 1; } - int HasQuestForGO(Eluna* E, Player* player) + int HasQuestForGO(Eluna* /*E*/, lua_State* L, Player* player) { - int32 entry = Eluna::CHECKVAL(E->L, 2); + int32 entry = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->HasQuestForGO(entry)); + Eluna::Push(L, player->HasQuestForGO(entry)); return 1; } #ifndef CLASSIC - int HasTitle(Eluna* E, Player* player) + int HasTitle(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 id = Eluna::CHECKVAL(E->L, 2); + uint32 id = Eluna::CHECKVAL(L, 2); CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); if (titleInfo) - Eluna::Push(E->L, player->HasTitle(titleInfo)); + Eluna::Push(L, player->HasTitle(titleInfo)); return 1; } #endif - int HasItem(Eluna* E, Player* player) + int HasItem(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 itemId = Eluna::CHECKVAL(E->L, 2); - uint32 count = Eluna::CHECKVAL(E->L, 3, 1); - bool check_bank = Eluna::CHECKVAL(E->L, 4, false); - Eluna::Push(E->L, player->HasItemCount(itemId, count, check_bank)); + uint32 itemId = Eluna::CHECKVAL(L, 2); + uint32 count = Eluna::CHECKVAL(L, 3, 1); + bool check_bank = Eluna::CHECKVAL(L, 4, false); + Eluna::Push(L, player->HasItemCount(itemId, count, check_bank)); return 1; } - int HasQuestForItem(Eluna* E, Player* player) + int HasQuestForItem(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); + uint32 entry = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->HasQuestForItem(entry)); + Eluna::Push(L, player->HasQuestForItem(entry)); return 1; } - int CanUseItem(Eluna* E, Player* player) + int CanUseItem(Eluna* /*E*/, lua_State* L, Player* player) { - Item* item = Eluna::CHECKOBJ(E->L, 2, false); + Item* item = Eluna::CHECKOBJ(L, 2, false); if (item) - Eluna::Push(E->L, player->CanUseItem(item)); + Eluna::Push(L, player->CanUseItem(item)); else { - uint32 entry = Eluna::CHECKVAL(E->L, 2); + uint32 entry = Eluna::CHECKVAL(L, 2); const ItemTemplate* temp = eObjectMgr->GetItemTemplate(entry); if (temp) - Eluna::Push(E->L, player->CanUseItem(temp)); + Eluna::Push(L, player->CanUseItem(temp)); else - Eluna::Push(E->L, EQUIP_ERR_ITEM_NOT_FOUND); + Eluna::Push(L, EQUIP_ERR_ITEM_NOT_FOUND); } return 1; } - int HasSpellCooldown(Eluna* E, Player* player) + int HasSpellCooldown(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 spellId = Eluna::CHECKVAL(E->L, 2); + uint32 spellId = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->HasSpellCooldown(spellId)); + Eluna::Push(L, player->HasSpellCooldown(spellId)); return 1; } - int CanShareQuest(Eluna* E, Player* player) + int CanShareQuest(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); + uint32 entry = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->CanShareQuest(entry)); + Eluna::Push(L, player->CanShareQuest(entry)); return 1; } - int CanSpeak(Eluna* E, Player* player) + int CanSpeak(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->CanSpeak()); + Eluna::Push(L, player->CanSpeak()); return 1; } - int CanUninviteFromGroup(Eluna* E, Player* player) + int CanUninviteFromGroup(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->CanUninviteFromGroup() == ERR_PARTY_RESULT_OK); + Eluna::Push(L, player->CanUninviteFromGroup() == ERR_PARTY_RESULT_OK); return 1; } #ifndef CLASSIC - int CanFly(Eluna* E, Player* player) + int CanFly(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->CanFly()); + Eluna::Push(L, player->CanFly()); return 1; } #endif #ifdef CLASSIC - int GetHonorStoredKills(Eluna* E, Player* player) + int GetHonorStoredKills(Eluna* /*E*/, lua_State* L, Player* player) { - bool honorable = Eluna::CHECKVAL(E->L, 2, true); + bool honorable = Eluna::CHECKVAL(L, 2, true); - Eluna::Push(E->L, player->GetHonorStoredKills(honorable)); + Eluna::Push(L, player->GetHonorStoredKills(honorable)); return 0; } - int GetRankPoints(Eluna* E, Player* player) + int GetRankPoints(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetRankPoints()); + Eluna::Push(L, player->GetRankPoints()); return 1; } - int GetHonorLastWeekStandingPos(Eluna* E, Player* player) + int GetHonorLastWeekStandingPos(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetHonorLastWeekStandingPos()); + Eluna::Push(L, player->GetHonorLastWeekStandingPos()); return 1; } #endif - int IsInWater(Eluna* E, Player* player) + int IsInWater(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->IsInWater()); + Eluna::Push(L, player->IsInWater()); return 1; } - int IsMoving(Eluna* E, Player* player) // enable for unit when mangos support it + int IsMoving(Eluna* /*E*/, lua_State* L, Player* player) // enable for unit when mangos support it { - Eluna::Push(E->L, player->isMoving()); + Eluna::Push(L, player->isMoving()); return 1; } #ifdef CLASSIC - int UpdateHonor(Eluna* E, Player* player) + int UpdateHonor(Eluna* /*E*/, lua_State* L, Player* player) { player->UpdateHonor(); return 0; } - int ResetHonor(Eluna* E, Player* player) + int ResetHonor(Eluna* /*E*/, lua_State* L, Player* player) { player->ResetHonor(); return 0; } - int ClearHonorInfo(Eluna* E, Player* player) + int ClearHonorInfo(Eluna* /*E*/, lua_State* L, Player* player) { player->ClearHonorInfo(); return 0; @@ -215,622 +215,622 @@ namespace LuaPlayer #endif #ifndef CLASSIC - int IsFlying(Eluna* E, Player* player) // enable for unit when mangos support it + int IsFlying(Eluna* /*E*/, lua_State* L, Player* player) // enable for unit when mangos support it { - Eluna::Push(E->L, player->IsFlying()); + Eluna::Push(L, player->IsFlying()); return 1; } #endif - int IsInGroup(Eluna* E, Player* player) + int IsInGroup(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, (player->GetGroup() != NULL)); + Eluna::Push(L, (player->GetGroup() != NULL)); return 1; } - int IsInGuild(Eluna* E, Player* player) + int IsInGuild(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, (player->GetGuildId() != 0)); + Eluna::Push(L, (player->GetGuildId() != 0)); return 1; } - int IsGM(Eluna* E, Player* player) + int IsGM(Eluna* /*E*/, lua_State* L, Player* player) { #ifndef TRINITY - Eluna::Push(E->L, player->isGameMaster()); + Eluna::Push(L, player->isGameMaster()); #else - Eluna::Push(E->L, player->IsGameMaster()); + Eluna::Push(L, player->IsGameMaster()); #endif return 1; } #ifndef CLASSIC - int IsInArenaTeam(Eluna* E, Player* player) + int IsInArenaTeam(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 type = Eluna::CHECKVAL(E->L, 2); + uint32 type = Eluna::CHECKVAL(L, 2); if (type < MAX_ARENA_SLOT && player->GetArenaTeamId(type)) - Eluna::Push(E->L, true); + Eluna::Push(L, true); else - Eluna::Push(E->L, false); + Eluna::Push(L, false); return 1; } #endif - int IsHorde(Eluna* E, Player* player) + int IsHorde(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, (player->GetTeam() == HORDE)); + Eluna::Push(L, (player->GetTeam() == HORDE)); return 1; } - int IsAlliance(Eluna* E, Player* player) + int IsAlliance(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, (player->GetTeam() == ALLIANCE)); + Eluna::Push(L, (player->GetTeam() == ALLIANCE)); return 1; } - int IsDND(Eluna* E, Player* player) + int IsDND(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->isDND()); + Eluna::Push(L, player->isDND()); return 1; } - int IsAFK(Eluna* E, Player* player) + int IsAFK(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->isAFK()); + Eluna::Push(L, player->isAFK()); return 1; } - int IsFalling(Eluna* E, Player* player) + int IsFalling(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->IsFalling()); + Eluna::Push(L, player->IsFalling()); return 1; } - int IsGroupVisibleFor(Eluna* E, Player* player) + int IsGroupVisibleFor(Eluna* /*E*/, lua_State* L, Player* player) { - Player* target = Eluna::CHECKOBJ(E->L, 2); - Eluna::Push(E->L, player->IsGroupVisibleFor(target)); + Player* target = Eluna::CHECKOBJ(L, 2); + Eluna::Push(L, player->IsGroupVisibleFor(target)); return 1; } - int IsInSameRaidWith(Eluna* E, Player* player) + int IsInSameRaidWith(Eluna* /*E*/, lua_State* L, Player* player) { - Player* target = Eluna::CHECKOBJ(E->L, 2); - Eluna::Push(E->L, player->IsInSameRaidWith(target)); + Player* target = Eluna::CHECKOBJ(L, 2); + Eluna::Push(L, player->IsInSameRaidWith(target)); return 1; } - int IsInSameGroupWith(Eluna* E, Player* player) + int IsInSameGroupWith(Eluna* /*E*/, lua_State* L, Player* player) { - Player* target = Eluna::CHECKOBJ(E->L, 2); - Eluna::Push(E->L, player->IsInSameGroupWith(target)); + Player* target = Eluna::CHECKOBJ(L, 2); + Eluna::Push(L, player->IsInSameGroupWith(target)); return 1; } - int IsHonorOrXPTarget(Eluna* E, Player* player) + int IsHonorOrXPTarget(Eluna* /*E*/, lua_State* L, Player* player) { - Unit* victim = Eluna::CHECKOBJ(E->L, 2); + Unit* victim = Eluna::CHECKOBJ(L, 2); - Eluna::Push(E->L, player->isHonorOrXPTarget(victim)); + Eluna::Push(L, player->isHonorOrXPTarget(victim)); return 1; } - int IsVisibleForPlayer(Eluna* E, Player* player) + int IsVisibleForPlayer(Eluna* /*E*/, lua_State* L, Player* player) { - Player* target = Eluna::CHECKOBJ(E->L, 2); + Player* target = Eluna::CHECKOBJ(L, 2); - Eluna::Push(E->L, player->IsVisibleGloballyFor(target)); + Eluna::Push(L, player->IsVisibleGloballyFor(target)); return 1; } - int IsGMVisible(Eluna* E, Player* player) + int IsGMVisible(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->isGMVisible()); + Eluna::Push(L, player->isGMVisible()); return 1; } - int IsTaxiCheater(Eluna* E, Player* player) + int IsTaxiCheater(Eluna* /*E*/, lua_State* L, Player* player) { #ifdef MANGOS - Eluna::Push(E->L, player->IsTaxiCheater()); + Eluna::Push(L, player->IsTaxiCheater()); #else - Eluna::Push(E->L, player->isTaxiCheater()); + Eluna::Push(L, player->isTaxiCheater()); #endif return 1; } - int IsGMChat(Eluna* E, Player* player) + int IsGMChat(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->isGMChat()); + Eluna::Push(L, player->isGMChat()); return 1; } - int IsAcceptingWhispers(Eluna* E, Player* player) + int IsAcceptingWhispers(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->isAcceptWhispers()); + Eluna::Push(L, player->isAcceptWhispers()); return 1; } - int IsRested(Eluna* E, Player* player) + int IsRested(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->isRested()); + Eluna::Push(L, player->isRested()); return 1; } - int InBattlegroundQueue(Eluna* E, Player* player) + int InBattlegroundQueue(Eluna* /*E*/, lua_State* L, Player* player) { #ifndef TRINITY - Eluna::Push(E->L, player->InBattleGroundQueue()); + Eluna::Push(L, player->InBattleGroundQueue()); #else - Eluna::Push(E->L, player->InBattlegroundQueue()); + Eluna::Push(L, player->InBattlegroundQueue()); #endif return 1; } #ifndef CLASSIC - int InArena(Eluna* E, Player* player) + int InArena(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->InArena()); + Eluna::Push(L, player->InArena()); return 1; } #endif - int InBattleground(Eluna* E, Player* player) + int InBattleground(Eluna* /*E*/, lua_State* L, Player* player) { #ifndef TRINITY - Eluna::Push(E->L, player->InBattleGround()); + Eluna::Push(L, player->InBattleGround()); #else - Eluna::Push(E->L, player->InBattleground()); + Eluna::Push(L, player->InBattleground()); #endif return 1; } - int CanBlock(Eluna* E, Player* player) + int CanBlock(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->CanBlock()); + Eluna::Push(L, player->CanBlock()); return 1; } - int CanParry(Eluna* E, Player* player) + int CanParry(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->CanParry()); + Eluna::Push(L, player->CanParry()); return 1; } - /*int HasReceivedQuestReward(Eluna* E, Player* player) + /*int HasReceivedQuestReward(Eluna* E, lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); + uint32 entry = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->IsQuestRewarded(entry)); + Eluna::Push(L, player->IsQuestRewarded(entry)); return 1; }*/ - /*int IsOutdoorPvPActive(Eluna* E, Player* player) + /*int IsOutdoorPvPActive(Eluna* E, lua_State* L, Player* player) { - Eluna::Push(E->L, player->IsOutdoorPvPActive()); + Eluna::Push(L, player->IsOutdoorPvPActive()); return 1; }*/ - /*int IsImmuneToEnvironmentalDamage(Eluna* E, Player* player) + /*int IsImmuneToEnvironmentalDamage(Eluna* E, lua_State* L, Player* player) { - Eluna::Push(E->L, player->IsImmuneToEnvironmentalDamage()); + Eluna::Push(L, player->IsImmuneToEnvironmentalDamage()); return 1; }*/ - /*int InRandomLfgDungeon(Eluna* E, Player* player) + /*int InRandomLfgDungeon(Eluna* E, lua_State* L, Player* player) { - Eluna::Push(E->L, player->inRandomLfgDungeon()); + Eluna::Push(L, player->inRandomLfgDungeon()); return 1; }*/ - /*int IsUsingLfg(Eluna* E, Player* player) + /*int IsUsingLfg(Eluna* E, lua_State* L, Player* player) { - Eluna::Push(E->L, player->isUsingLfg()); + Eluna::Push(L, player->isUsingLfg()); return 1; }*/ - /*int IsNeverVisible(Eluna* E, Player* player) + /*int IsNeverVisible(Eluna* E, lua_State* L, Player* player) { - Eluna::Push(E->L, player->IsNeverVisible()); + Eluna::Push(L, player->IsNeverVisible()); return 1; }*/ - /*int CanFlyInZone(Eluna* E, Player* player) + /*int CanFlyInZone(Eluna* E, lua_State* L, Player* player) { - uint32 mapid = Eluna::CHECKVAL(E->L, 2); - uint32 zone = Eluna::CHECKVAL(E->L, 2); + uint32 mapid = Eluna::CHECKVAL(L, 2); + uint32 zone = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->IsKnowHowFlyIn(mapid, zone)); + Eluna::Push(L, player->IsKnowHowFlyIn(mapid, zone)); return 1; }*/ - /*int HasPendingBind(Eluna* E, Player* player) + /*int HasPendingBind(Eluna* E, lua_State* L, Player* player) { - Eluna::Push(E->L, player->PendingHasPendingBind()); + Eluna::Push(L, player->PendingHasPendingBind()); return 1; }*/ - /*int IsARecruiter(Eluna* E, Player* player) + /*int IsARecruiter(Eluna* E, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetSession()->IsARecruiter() || (player->GetSession()->GetRecruiterId() != 0)); + Eluna::Push(L, player->GetSession()->IsARecruiter() || (player->GetSession()->GetRecruiterId() != 0)); return 1; }*/ /* GETTERS */ #if (!defined(TBC) && !defined(CLASSIC)) - int GetSpecsCount(Eluna* E, Player* player) + int GetSpecsCount(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetSpecsCount()); + Eluna::Push(L, player->GetSpecsCount()); return 1; } - int GetActiveSpec(Eluna* E, Player* player) + int GetActiveSpec(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetActiveSpec()); + Eluna::Push(L, player->GetActiveSpec()); return 1; } #endif #ifdef WOTLK - int GetPhaseMaskForSpawn(Eluna* E, Player* player) + int GetPhaseMaskForSpawn(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetPhaseMaskForSpawn()); + Eluna::Push(L, player->GetPhaseMaskForSpawn()); return 1; } #endif #ifndef CATA #ifndef CLASSIC - int GetArenaPoints(Eluna* E, Player* player) + int GetArenaPoints(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetArenaPoints()); + Eluna::Push(L, player->GetArenaPoints()); return 1; } - int GetHonorPoints(Eluna* E, Player* player) + int GetHonorPoints(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetHonorPoints()); + Eluna::Push(L, player->GetHonorPoints()); return 1; } #endif - int GetShieldBlockValue(Eluna* E, Player* player) + int GetShieldBlockValue(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetShieldBlockValue()); + Eluna::Push(L, player->GetShieldBlockValue()); return 1; } #endif - int GetSpellCooldownDelay(Eluna* E, Player* player) + int GetSpellCooldownDelay(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 spellId = Eluna::CHECKVAL(E->L, 2); + uint32 spellId = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, uint32(player->GetSpellCooldownDelay(spellId))); + Eluna::Push(L, uint32(player->GetSpellCooldownDelay(spellId))); return 1; } - int GetLatency(Eluna* E, Player* player) + int GetLatency(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetSession()->GetLatency()); + Eluna::Push(L, player->GetSession()->GetLatency()); return 1; } #ifdef TRINITY - int GetChampioningFaction(Eluna* E, Player* player) + int GetChampioningFaction(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetChampioningFaction()); + Eluna::Push(L, player->GetChampioningFaction()); return 1; } #endif - int GetOriginalSubGroup(Eluna* E, Player* player) + int GetOriginalSubGroup(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetOriginalSubGroup()); + Eluna::Push(L, player->GetOriginalSubGroup()); return 1; } - int GetOriginalGroup(Eluna* E, Player* player) + int GetOriginalGroup(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetOriginalGroup()); + Eluna::Push(L, player->GetOriginalGroup()); return 1; } - int GetNextRandomRaidMember(Eluna* E, Player* player) + int GetNextRandomRaidMember(Eluna* /*E*/, lua_State* L, Player* player) { - float radius = Eluna::CHECKVAL(E->L, 2); + float radius = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->GetNextRandomRaidMember(radius)); + Eluna::Push(L, player->GetNextRandomRaidMember(radius)); return 1; } - int GetSubGroup(Eluna* E, Player* player) + int GetSubGroup(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetSubGroup()); + Eluna::Push(L, player->GetSubGroup()); return 1; } - int GetGroupInvite(Eluna* E, Player* player) + int GetGroupInvite(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetGroupInvite()); + Eluna::Push(L, player->GetGroupInvite()); return 1; } - int GetRestTime(Eluna* E, Player* player) + int GetRestTime(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetRestTime()); + Eluna::Push(L, player->GetRestTime()); return 1; } - int GetXPRestBonus(Eluna* E, Player* player) + int GetXPRestBonus(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 xp = Eluna::CHECKVAL(E->L, 2); + uint32 xp = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->GetXPRestBonus(xp)); + Eluna::Push(L, player->GetXPRestBonus(xp)); return 1; } - int GetBattlegroundTypeId(Eluna* E, Player* player) + int GetBattlegroundTypeId(Eluna* /*E*/, lua_State* L, Player* player) { #ifndef TRINITY - Eluna::Push(E->L, player->GetBattleGroundTypeId()); + Eluna::Push(L, player->GetBattleGroundTypeId()); #else - Eluna::Push(E->L, player->GetBattlegroundTypeId()); + Eluna::Push(L, player->GetBattlegroundTypeId()); #endif return 1; } - int GetBattlegroundId(Eluna* E, Player* player) + int GetBattlegroundId(Eluna* /*E*/, lua_State* L, Player* player) { #ifndef TRINITY - Eluna::Push(E->L, player->GetBattleGroundId()); + Eluna::Push(L, player->GetBattleGroundId()); #else - Eluna::Push(E->L, player->GetBattlegroundId()); + Eluna::Push(L, player->GetBattlegroundId()); #endif return 1; } - int GetReputationRank(Eluna* E, Player* player) + int GetReputationRank(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 faction = Eluna::CHECKVAL(E->L, 2); + uint32 faction = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->GetReputationRank(faction)); + Eluna::Push(L, player->GetReputationRank(faction)); return 1; } - int GetDrunkValue(Eluna* E, Player* player) + int GetDrunkValue(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetDrunkValue()); + Eluna::Push(L, player->GetDrunkValue()); return 1; } - int GetSpellCooldowns(Eluna* E, Player* player) + int GetSpellCooldowns(Eluna* /*E*/, lua_State* L, Player* player) { - lua_newtable(E->L); - int tbl = lua_gettop(E->L); + lua_newtable(L); + int tbl = lua_gettop(L); uint32 i = 0; for (SpellCooldowns::const_iterator it = player->GetSpellCooldownMap().begin(); it != player->GetSpellCooldownMap().end(); ++it) { ++i; - Eluna::Push(E->L, it->first); - Eluna::Push(E->L, uint32(it->second.end)); - lua_settable(E->L, tbl); + Eluna::Push(L, it->first); + Eluna::Push(L, uint32(it->second.end)); + lua_settable(L, tbl); } - lua_settop(E->L, tbl); + lua_settop(L, tbl); return 1; } - int GetSkillTempBonusValue(Eluna* E, Player* player) + int GetSkillTempBonusValue(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 skill = Eluna::CHECKVAL(E->L, 2); + uint32 skill = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->GetSkillTempBonusValue(skill)); + Eluna::Push(L, player->GetSkillTempBonusValue(skill)); return 1; } - int GetSkillPermBonusValue(Eluna* E, Player* player) + int GetSkillPermBonusValue(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 skill = Eluna::CHECKVAL(E->L, 2); + uint32 skill = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->GetSkillPermBonusValue(skill)); + Eluna::Push(L, player->GetSkillPermBonusValue(skill)); return 1; } - int GetPureSkillValue(Eluna* E, Player* player) + int GetPureSkillValue(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 skill = Eluna::CHECKVAL(E->L, 2); + uint32 skill = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->GetPureSkillValue(skill)); + Eluna::Push(L, player->GetPureSkillValue(skill)); return 1; } - int GetBaseSkillValue(Eluna* E, Player* player) + int GetBaseSkillValue(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 skill = Eluna::CHECKVAL(E->L, 2); + uint32 skill = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->GetBaseSkillValue(skill)); + Eluna::Push(L, player->GetBaseSkillValue(skill)); return 1; } - int GetSkillValue(Eluna* E, Player* player) + int GetSkillValue(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 skill = Eluna::CHECKVAL(E->L, 2); + uint32 skill = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->GetSkillValue(skill)); + Eluna::Push(L, player->GetSkillValue(skill)); return 1; } - int GetPureMaxSkillValue(Eluna* E, Player* player) + int GetPureMaxSkillValue(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 skill = Eluna::CHECKVAL(E->L, 2); + uint32 skill = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->GetPureMaxSkillValue(skill)); + Eluna::Push(L, player->GetPureMaxSkillValue(skill)); return 1; } - int GetMaxSkillValue(Eluna* E, Player* player) + int GetMaxSkillValue(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 skill = Eluna::CHECKVAL(E->L, 2); + uint32 skill = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->GetMaxSkillValue(skill)); + Eluna::Push(L, player->GetMaxSkillValue(skill)); return 1; } - int GetManaBonusFromIntellect(Eluna* E, Player* player) + int GetManaBonusFromIntellect(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetManaBonusFromIntellect()); + Eluna::Push(L, player->GetManaBonusFromIntellect()); return 1; } - int GetHealthBonusFromStamina(Eluna* E, Player* player) + int GetHealthBonusFromStamina(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetHealthBonusFromStamina()); + Eluna::Push(L, player->GetHealthBonusFromStamina()); return 1; } - int GetDifficulty(Eluna* E, Player* player) + int GetDifficulty(Eluna* /*E*/, lua_State* L, Player* player) { #ifdef TBC - Eluna::Push(E->L, player->GetDifficulty()); + Eluna::Push(L, player->GetDifficulty()); #elif defined(CLASSIC) - Eluna::Push(E->L, (Difficulty)0); + Eluna::Push(L, (Difficulty)0); #else - bool isRaid = Eluna::CHECKVAL(E->L, 2, true); - Eluna::Push(E->L, player->GetDifficulty(isRaid)); + bool isRaid = Eluna::CHECKVAL(L, 2, true); + Eluna::Push(L, player->GetDifficulty(isRaid)); #endif return 1; } - int GetGuildRank(Eluna* E, Player* player) // TODO: Move to Guild Methods + int GetGuildRank(Eluna* /*E*/, lua_State* L, Player* player) // TODO: Move to Guild Methods { - Eluna::Push(E->L, player->GetRank()); + Eluna::Push(L, player->GetRank()); return 1; } - int GetFreeTalentPoints(Eluna* E, Player* player) + int GetFreeTalentPoints(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetFreeTalentPoints()); + Eluna::Push(L, player->GetFreeTalentPoints()); return 1; } - int GetGuildName(Eluna* E, Player* player) + int GetGuildName(Eluna* /*E*/, lua_State* L, Player* player) { if (!player->GetGuildId()) return 1; - Eluna::Push(E->L, eGuildMgr->GetGuildNameById(player->GetGuildId())); + Eluna::Push(L, eGuildMgr->GetGuildNameById(player->GetGuildId())); return 1; } - int GetReputation(Eluna* E, Player* player) + int GetReputation(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 faction = Eluna::CHECKVAL(E->L, 2); + uint32 faction = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->GetReputationMgr().GetReputation(faction)); + Eluna::Push(L, player->GetReputationMgr().GetReputation(faction)); return 1; } - int GetComboTarget(Eluna* E, Player* player) + int GetComboTarget(Eluna* /*E*/, lua_State* L, Player* player) { #ifndef TRINITY - Eluna::Push(E->L, player->GetMap()->GetUnit(player->GetComboTargetGuid())); + Eluna::Push(L, player->GetMap()->GetUnit(player->GetComboTargetGuid())); #else - Eluna::Push(E->L, ObjectAccessor::GetUnit(*player, player->GetComboTarget())); + Eluna::Push(L, ObjectAccessor::GetUnit(*player, player->GetComboTarget())); #endif return 1; } - int GetComboPoints(Eluna* E, Player* player) + int GetComboPoints(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetComboPoints()); + Eluna::Push(L, player->GetComboPoints()); return 1; } - int GetInGameTime(Eluna* E, Player* player) + int GetInGameTime(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetInGameTime()); + Eluna::Push(L, player->GetInGameTime()); return 1; } - int GetQuestStatus(Eluna* E, Player* player) + int GetQuestStatus(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); + uint32 entry = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->GetQuestStatus(entry)); + Eluna::Push(L, player->GetQuestStatus(entry)); return 1; } - int GetQuestRewardStatus(Eluna* E, Player* player) + int GetQuestRewardStatus(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 questId = Eluna::CHECKVAL(E->L, 2); + uint32 questId = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->GetQuestRewardStatus(questId)); + Eluna::Push(L, player->GetQuestRewardStatus(questId)); return 1; } - int GetReqKillOrCastCurrentCount(Eluna* E, Player* player) + int GetReqKillOrCastCurrentCount(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 questId = Eluna::CHECKVAL(E->L, 2); - int32 entry = Eluna::CHECKVAL(E->L, 3); + uint32 questId = Eluna::CHECKVAL(L, 2); + int32 entry = Eluna::CHECKVAL(L, 3); - Eluna::Push(E->L, player->GetReqKillOrCastCurrentCount(questId, entry)); + Eluna::Push(L, player->GetReqKillOrCastCurrentCount(questId, entry)); return 1; } - int GetQuestLevel(Eluna* E, Player* player) + int GetQuestLevel(Eluna* /*E*/, lua_State* L, Player* player) { - Quest* quest = Eluna::CHECKOBJ(E->L, 2); + Quest* quest = Eluna::CHECKOBJ(L, 2); #ifndef TRINITY - Eluna::Push(E->L, player->GetQuestLevelForPlayer(quest)); + Eluna::Push(L, player->GetQuestLevelForPlayer(quest)); #else - Eluna::Push(E->L, player->GetQuestLevel(quest)); + Eluna::Push(L, player->GetQuestLevel(quest)); #endif return 1; } - int GetItemByEntry(Eluna* E, Player* player) + int GetItemByEntry(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); + uint32 entry = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, player->GetItemByEntry(entry)); + Eluna::Push(L, player->GetItemByEntry(entry)); return 1; } - int GetEquippedItemBySlot(Eluna* E, Player* player) + int GetEquippedItemBySlot(Eluna* /*E*/, lua_State* L, Player* player) { - uint8 slot = Eluna::CHECKVAL(E->L, 2); + uint8 slot = Eluna::CHECKVAL(L, 2); if (slot >= EQUIPMENT_SLOT_END) return 1; Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot); - Eluna::Push(E->L, item); + Eluna::Push(L, item); return 1; } - int GetRestType(Eluna* E, Player* player) + int GetRestType(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetRestType()); + Eluna::Push(L, player->GetRestType()); return 1; } - int GetRestBonus(Eluna* E, Player* player) + int GetRestBonus(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetRestBonus()); + Eluna::Push(L, player->GetRestBonus()); return 1; } - int GiveLevel(Eluna* E, Player* player) + int GiveLevel(Eluna* /*E*/, lua_State* L, Player* player) { - uint8 level = Eluna::CHECKVAL(E->L, 2); + uint8 level = Eluna::CHECKVAL(L, 2); player->GiveLevel(level); return 0; } - int GetChatTag(Eluna* E, Player* player) + int GetChatTag(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetChatTag()); + Eluna::Push(L, player->GetChatTag()); return 1; } @@ -859,160 +859,160 @@ namespace LuaPlayer * @param uint8 slot : the slot the [Item] is in within the bag, you can get this with [Item:GetSlot] * @return [Item] item : [Item] or nil */ - int GetItemByPos(Eluna* E, Player* player) + int GetItemByPos(Eluna* /*E*/, lua_State* L, Player* player) { - uint8 bag = Eluna::CHECKVAL(E->L, 2); - uint8 slot = Eluna::CHECKVAL(E->L, 3); + uint8 bag = Eluna::CHECKVAL(L, 2); + uint8 slot = Eluna::CHECKVAL(L, 3); - Eluna::Push(E->L, player->GetItemByPos(bag, slot)); + Eluna::Push(L, player->GetItemByPos(bag, slot)); return 1; } - int GetGossipTextId(Eluna* E, Player* player) + int GetGossipTextId(Eluna* /*E*/, lua_State* L, Player* player) { - WorldObject* obj = Eluna::CHECKOBJ(E->L, 2); - Eluna::Push(E->L, player->GetGossipTextId(obj)); + WorldObject* obj = Eluna::CHECKOBJ(L, 2); + Eluna::Push(L, player->GetGossipTextId(obj)); return 1; } - int GetSelection(Eluna* E, Player* player) + int GetSelection(Eluna* /*E*/, lua_State* L, Player* player) { #ifndef TRINITY - Eluna::Push(E->L, player->GetMap()->GetUnit(player->GetSelectionGuid())); + Eluna::Push(L, player->GetMap()->GetUnit(player->GetSelectionGuid())); #else - Eluna::Push(E->L, player->GetSelectedUnit()); + Eluna::Push(L, player->GetSelectedUnit()); #endif return 1; } - int GetGMRank(Eluna* E, Player* player) + int GetGMRank(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetSession()->GetSecurity()); + Eluna::Push(L, player->GetSession()->GetSecurity()); return 1; } - int GetCoinage(Eluna* E, Player* player) + int GetCoinage(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetMoney()); + Eluna::Push(L, player->GetMoney()); return 1; } - int GetGuildId(Eluna* E, Player* player) + int GetGuildId(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetGuildId()); + Eluna::Push(L, player->GetGuildId()); return 1; } - int GetTeam(Eluna* E, Player* player) + int GetTeam(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetTeamId()); + Eluna::Push(L, player->GetTeamId()); return 1; } - int GetItemCount(Eluna* E, Player* player) + int GetItemCount(Eluna* /*E*/, lua_State* L, Player* player) { - int id = Eluna::CHECKVAL(E->L, 2); - bool checkinBank = Eluna::CHECKVAL(E->L, 3, false); - Eluna::Push(E->L, player->GetItemCount(id, checkinBank)); + int id = Eluna::CHECKVAL(L, 2); + bool checkinBank = Eluna::CHECKVAL(L, 3, false); + Eluna::Push(L, player->GetItemCount(id, checkinBank)); return 1; } - int GetLifetimeKills(Eluna* E, Player* player) + int GetLifetimeKills(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS)); + Eluna::Push(L, player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS)); return 1; } - int GetPlayerIP(Eluna* E, Player* player) + int GetPlayerIP(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetSession()->GetRemoteAddress()); + Eluna::Push(L, player->GetSession()->GetRemoteAddress()); return 1; } - int GetLevelPlayedTime(Eluna* E, Player* player) + int GetLevelPlayedTime(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetLevelPlayedTime()); + Eluna::Push(L, player->GetLevelPlayedTime()); return 1; } - int GetTotalPlayedTime(Eluna* E, Player* player) + int GetTotalPlayedTime(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetTotalPlayedTime()); + Eluna::Push(L, player->GetTotalPlayedTime()); return 1; } - int GetGuild(Eluna* E, Player* player) + int GetGuild(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, eGuildMgr->GetGuildById(player->GetGuildId())); + Eluna::Push(L, eGuildMgr->GetGuildById(player->GetGuildId())); return 1; } - int GetGroup(Eluna* E, Player* player) + int GetGroup(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetGroup()); + Eluna::Push(L, player->GetGroup()); return 1; } - int GetAccountId(Eluna* E, Player* player) + int GetAccountId(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetSession()->GetAccountId()); + Eluna::Push(L, player->GetSession()->GetAccountId()); return 1; } - int GetAccountName(Eluna* E, Player* player) + int GetAccountName(Eluna* /*E*/, lua_State* L, Player* player) { std::string accName; if (eAccountMgr->GetName(player->GetSession()->GetAccountId(), accName)) - Eluna::Push(E->L, accName); + Eluna::Push(L, accName); return 1; } - int GetCorpse(Eluna* E, Player* player) + int GetCorpse(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetCorpse()); + Eluna::Push(L, player->GetCorpse()); return 1; } - int GetDbLocaleIndex(Eluna* E, Player* player) + int GetDbLocaleIndex(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetSession()->GetSessionDbLocaleIndex()); + Eluna::Push(L, player->GetSession()->GetSessionDbLocaleIndex()); return 1; } - int GetDbcLocale(Eluna* E, Player* player) + int GetDbcLocale(Eluna* /*E*/, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetSession()->GetSessionDbcLocale()); + Eluna::Push(L, player->GetSession()->GetSessionDbcLocale()); return 1; } - /*int GetRecruiterId(Eluna* E, Player* player) + /*int GetRecruiterId(Eluna* E, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetSession()->GetRecruiterId()); + Eluna::Push(L, player->GetSession()->GetRecruiterId()); return 1; }*/ - /*int GetSelectedPlayer(Eluna* E, Player* player) + /*int GetSelectedPlayer(Eluna* E, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetSelectedPlayer()); + Eluna::Push(L, player->GetSelectedPlayer()); return 1; }*/ - /*int GetSelectedUnit(Eluna* E, Player* player) + /*int GetSelectedUnit(Eluna* E, lua_State* L, Player* player) { - Eluna::Push(E->L, player->GetSelectedUnit()); + Eluna::Push(L, player->GetSelectedUnit()); return 1; }*/ - /*int GetNearbyGameObject(Eluna* E, Player* player) + /*int GetNearbyGameObject(Eluna* E, lua_State* L, Player* player) { - Eluna::Push(E->L, ChatHandler(player->GetSession()).GetNearbyGameObject()); + Eluna::Push(L, ChatHandler(player->GetSession()).GetNearbyGameObject()); return 1; }*/ /* SETTERS */ - int SetPlayerLock(Eluna* E, Player* player) + int SetPlayerLock(Eluna* /*E*/, lua_State* L, Player* player) { - bool apply = Eluna::CHECKVAL(E->L, 2, true); + bool apply = Eluna::CHECKVAL(L, 2, true); if (apply) { @@ -1027,17 +1027,17 @@ namespace LuaPlayer return 0; } - int SetAtLoginFlag(Eluna* E, Player* player) + int SetAtLoginFlag(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 flag = Eluna::CHECKVAL(E->L, 2); + uint32 flag = Eluna::CHECKVAL(L, 2); player->SetAtLoginFlag((AtLoginFlags)flag); return 0; } - int SetSheath(Eluna* E, Player* player) + int SetSheath(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 sheathed = Eluna::CHECKVAL(E->L, 2); + uint32 sheathed = Eluna::CHECKVAL(L, 2); if (sheathed >= MAX_SHEATH_STATE) return 0; @@ -1045,44 +1045,44 @@ namespace LuaPlayer return 0; } - int SetRestTime(Eluna* E, Player* player) + int SetRestTime(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 value = Eluna::CHECKVAL(E->L, 2); + uint32 value = Eluna::CHECKVAL(L, 2); player->SetRestTime(value); return 0; } - int SetDrunkValue(Eluna* E, Player* player) + int SetDrunkValue(Eluna* /*E*/, lua_State* L, Player* player) { - uint8 newDrunkValue = Eluna::CHECKVAL(E->L, 2); + uint8 newDrunkValue = Eluna::CHECKVAL(L, 2); player->SetDrunkValue(newDrunkValue); return 0; } - int SetFactionForRace(Eluna* E, Player* player) + int SetFactionForRace(Eluna* /*E*/, lua_State* L, Player* player) { - uint8 race = Eluna::CHECKVAL(E->L, 2); + uint8 race = Eluna::CHECKVAL(L, 2); player->setFactionForRace(race); return 0; } - int SetSkill(Eluna* E, Player* player) + int SetSkill(Eluna* /*E*/, lua_State* L, Player* player) { - uint16 id = Eluna::CHECKVAL(E->L, 2); - uint16 step = Eluna::CHECKVAL(E->L, 3); - uint16 currVal = Eluna::CHECKVAL(E->L, 4); - uint16 maxVal = Eluna::CHECKVAL(E->L, 5); + uint16 id = Eluna::CHECKVAL(L, 2); + uint16 step = Eluna::CHECKVAL(L, 3); + uint16 currVal = Eluna::CHECKVAL(L, 4); + uint16 maxVal = Eluna::CHECKVAL(L, 5); player->SetSkill(id, step, currVal, maxVal); return 0; } - int SetGuildRank(Eluna* E, Player* player) // TODO: Move to Guild Methods + int SetGuildRank(Eluna* /*E*/, lua_State* L, Player* player) // TODO: Move to Guild Methods { - uint8 rank = Eluna::CHECKVAL(E->L, 2); + uint8 rank = Eluna::CHECKVAL(L, 2); if (!player->GetGuildId()) return 0; @@ -1091,9 +1091,9 @@ namespace LuaPlayer return 0; } - int SetFreeTalentPoints(Eluna* E, Player* player) + int SetFreeTalentPoints(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 points = Eluna::CHECKVAL(E->L, 2); + uint32 points = Eluna::CHECKVAL(L, 2); player->SetFreeTalentPoints(points); #if (!defined(TBC) && !defined(CLASSIC)) @@ -1102,20 +1102,20 @@ namespace LuaPlayer return 0; } - int SetReputation(Eluna* E, Player* player) + int SetReputation(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 faction = Eluna::CHECKVAL(E->L, 2); - int32 value = Eluna::CHECKVAL(E->L, 3); + uint32 faction = Eluna::CHECKVAL(L, 2); + int32 value = Eluna::CHECKVAL(L, 3); FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction); player->GetReputationMgr().SetReputation(factionEntry, value); return 0; } - int SetQuestStatus(Eluna* E, Player* player) + int SetQuestStatus(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); - uint32 status = Eluna::CHECKVAL(E->L, 3); + uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 status = Eluna::CHECKVAL(L, 3); if (status >= MAX_QUEST_STATUS) return 0; @@ -1123,73 +1123,73 @@ namespace LuaPlayer return 0; } - int SetRestType(Eluna* E, Player* player) + int SetRestType(Eluna* /*E*/, lua_State* L, Player* player) { - int type = Eluna::CHECKVAL(E->L, 2); + int type = Eluna::CHECKVAL(L, 2); player->SetRestType((RestType)type); return 0; } - int SetRestBonus(Eluna* E, Player* player) + int SetRestBonus(Eluna* /*E*/, lua_State* L, Player* player) { - float bonus = Eluna::CHECKVAL(E->L, 2); + float bonus = Eluna::CHECKVAL(L, 2); player->SetRestBonus(bonus); return 0; } - int SetAcceptWhispers(Eluna* E, Player* player) + int SetAcceptWhispers(Eluna* /*E*/, lua_State* L, Player* player) { - bool on = Eluna::CHECKVAL(E->L, 2, true); + bool on = Eluna::CHECKVAL(L, 2, true); player->SetAcceptWhispers(on); return 0; } - int SetPvPDeath(Eluna* E, Player* player) + int SetPvPDeath(Eluna* /*E*/, lua_State* L, Player* player) { - bool on = Eluna::CHECKVAL(E->L, 2, true); + bool on = Eluna::CHECKVAL(L, 2, true); player->SetPvPDeath(on); return 0; } - int SetGMVisible(Eluna* E, Player* player) + int SetGMVisible(Eluna* /*E*/, lua_State* L, Player* player) { - bool on = Eluna::CHECKVAL(E->L, 2, true); + bool on = Eluna::CHECKVAL(L, 2, true); player->SetGMVisible(on); return 0; } - int SetTaxiCheat(Eluna* E, Player* player) + int SetTaxiCheat(Eluna* /*E*/, lua_State* L, Player* player) { - bool on = Eluna::CHECKVAL(E->L, 2, true); + bool on = Eluna::CHECKVAL(L, 2, true); player->SetTaxiCheater(on); return 0; } - int SetGMChat(Eluna* E, Player* player) + int SetGMChat(Eluna* /*E*/, lua_State* L, Player* player) { - bool on = Eluna::CHECKVAL(E->L, 2, true); + bool on = Eluna::CHECKVAL(L, 2, true); player->SetGMChat(on); return 0; } - int SetGameMaster(Eluna* E, Player* player) + int SetGameMaster(Eluna* /*E*/, lua_State* L, Player* player) { - bool on = Eluna::CHECKVAL(E->L, 2, true); + bool on = Eluna::CHECKVAL(L, 2, true); player->SetGameMaster(on); return 0; } - int SetGender(Eluna* E, Player* player) + int SetGender(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 _gender = Eluna::CHECKVAL(E->L, 2); + uint32 _gender = Eluna::CHECKVAL(L, 2); Gender gender; switch (_gender) @@ -1201,7 +1201,7 @@ namespace LuaPlayer gender = GENDER_FEMALE; break; default: - return luaL_argerror(E->L, 2, "valid Gender expected"); + return luaL_argerror(L, 2, "valid Gender expected"); } player->SetByteValue(UNIT_FIELD_BYTES_0, 2, gender); @@ -1212,16 +1212,16 @@ namespace LuaPlayer #ifndef CATA #ifndef CLASSIC - int SetArenaPoints(Eluna* E, Player* player) + int SetArenaPoints(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 arenaP = Eluna::CHECKVAL(E->L, 2); + uint32 arenaP = Eluna::CHECKVAL(L, 2); player->SetArenaPoints(arenaP); return 0; } - int SetHonorPoints(Eluna* E, Player* player) + int SetHonorPoints(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 honorP = Eluna::CHECKVAL(E->L, 2); + uint32 honorP = Eluna::CHECKVAL(L, 2); player->SetHonorPoints(honorP); return 0; } @@ -1229,53 +1229,53 @@ namespace LuaPlayer #endif #ifdef CLASSIC - int SetHonorStoredKills(Eluna* E, Player* player) + int SetHonorStoredKills(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 kills = Eluna::CHECKVAL(E->L, 2); - bool honorable = Eluna::CHECKVAL(E->L, 3, true); + uint32 kills = Eluna::CHECKVAL(L, 2); + bool honorable = Eluna::CHECKVAL(L, 3, true); player->SetHonorStoredKills(kills, honorable); return 0; } - int SetRankPoints(Eluna* E, Player* player) + int SetRankPoints(Eluna* /*E*/, lua_State* L, Player* player) { - float rankPoints = Eluna::CHECKVAL(E->L, 2); + float rankPoints = Eluna::CHECKVAL(L, 2); player->SetRankPoints(rankPoints); return 0; } - int SetHonorLastWeekStandingPos(Eluna* E, Player* player) + int SetHonorLastWeekStandingPos(Eluna* /*E*/, lua_State* L, Player* player) { - int32 standingPos = Eluna::CHECKVAL(E->L, 2); + int32 standingPos = Eluna::CHECKVAL(L, 2); player->SetHonorLastWeekStandingPos(standingPos); return 0; } #endif - int SetLifetimeKills(Eluna* E, Player* player) + int SetLifetimeKills(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 val = Eluna::CHECKVAL(E->L, 2); + uint32 val = Eluna::CHECKVAL(L, 2); player->SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, val); return 0; } - int SetCoinage(Eluna* E, Player* player) + int SetCoinage(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 amt = Eluna::CHECKVAL(E->L, 2); + uint32 amt = Eluna::CHECKVAL(L, 2); player->SetMoney(amt); return 0; } - int SetBindPoint(Eluna* E, Player* player) + int SetBindPoint(Eluna* /*E*/, lua_State* L, Player* player) { - float x = Eluna::CHECKVAL(E->L, 2); - float y = Eluna::CHECKVAL(E->L, 3); - float z = Eluna::CHECKVAL(E->L, 4); - uint32 mapId = Eluna::CHECKVAL(E->L, 5); - uint32 areaId = Eluna::CHECKVAL(E->L, 6); + float x = Eluna::CHECKVAL(L, 2); + float y = Eluna::CHECKVAL(L, 3); + float z = Eluna::CHECKVAL(L, 4); + uint32 mapId = Eluna::CHECKVAL(L, 5); + uint32 areaId = Eluna::CHECKVAL(L, 6); WorldLocation loc(mapId, x, y, z); #ifndef TRINITY @@ -1287,9 +1287,9 @@ namespace LuaPlayer } #ifndef CLASSIC - int SetKnownTitle(Eluna* E, Player* player) + int SetKnownTitle(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 id = Eluna::CHECKVAL(E->L, 2); + uint32 id = Eluna::CHECKVAL(L, 2); CharTitlesEntry const* t = sCharTitlesStore.LookupEntry(id); if (t) player->SetTitle(t, false); @@ -1298,18 +1298,18 @@ namespace LuaPlayer #endif #ifndef TRINITY - int SetFFA(Eluna* E, Player* player) + int SetFFA(Eluna* /*E*/, lua_State* L, Player* player) { - bool apply = Eluna::CHECKVAL(E->L, 2, true); + bool apply = Eluna::CHECKVAL(L, 2, true); player->SetFFAPvP(apply); return 0; } #endif - /*int SetMovement(Eluna* E, Player* player) + /*int SetMovement(Eluna* E, lua_State* L, Player* player) { - int32 pType = Eluna::CHECKVAL(E->L, 2); + int32 pType = Eluna::CHECKVAL(L, 2); player->SetMovement((PlayerMovementType)pType); return 0; @@ -1317,7 +1317,7 @@ namespace LuaPlayer /* OTHER */ #if (!defined(TBC) && !defined(CLASSIC)) - int ResetPetTalents(Eluna* /*E*/, Player* player) + int ResetPetTalents(Eluna* /*E*/, lua_State* L, Player* player) { #ifndef TRINITY Pet* pet = player->GetPet(); @@ -1331,7 +1331,7 @@ namespace LuaPlayer return 0; } - int ResetAchievements(Eluna* /*E*/, Player* player) + int ResetAchievements(Eluna* /*E*/, lua_State* L, Player* player) { #ifndef TRINITY player->GetAchievementMgr().Reset(); @@ -1342,9 +1342,9 @@ namespace LuaPlayer } #endif - int SendShowMailBox(Eluna* E, Player* player) + int SendShowMailBox(Eluna* /*E*/, lua_State* L, Player* player) { - uint64 guid = Eluna::CHECKVAL(E->L, 2, player->GET_GUID()); + uint64 guid = Eluna::CHECKVAL(L, 2, player->GET_GUID()); #if (defined(CLASSIC) || defined(TBC)) WorldPacket data(CMSG_GET_MAIL_LIST, 8); @@ -1358,17 +1358,17 @@ namespace LuaPlayer #ifndef CATA #ifndef CLASSIC - int ModifyArenaPoints(Eluna* E, Player* player) + int ModifyArenaPoints(Eluna* /*E*/, lua_State* L, Player* player) { - int32 amount = Eluna::CHECKVAL(E->L, 2); + int32 amount = Eluna::CHECKVAL(L, 2); player->ModifyArenaPoints(amount); return 0; } - int ModifyHonorPoints(Eluna* E, Player* player) + int ModifyHonorPoints(Eluna* /*E*/, lua_State* L, Player* player) { - int32 amount = Eluna::CHECKVAL(E->L, 2); + int32 amount = Eluna::CHECKVAL(L, 2); player->ModifyHonorPoints(amount); return 0; @@ -1376,21 +1376,21 @@ namespace LuaPlayer #endif #endif - int SaveToDB(Eluna* /*E*/, Player* player) + int SaveToDB(Eluna* /*E*/, lua_State* /*L*/, Player* player) { player->SaveToDB(); return 0; } - int SummonPlayer(Eluna* E, Player* player) + int SummonPlayer(Eluna* /*E*/, lua_State* L, Player* player) { - Player* target = Eluna::CHECKOBJ(E->L, 2); - uint32 map = Eluna::CHECKVAL(E->L, 3); - float x = Eluna::CHECKVAL(E->L, 4); - float y = Eluna::CHECKVAL(E->L, 5); - float z = Eluna::CHECKVAL(E->L, 6); - float zoneId = Eluna::CHECKVAL(E->L, 7); - uint32 delay = Eluna::CHECKVAL(E->L, 8, 0); + Player* target = Eluna::CHECKOBJ(L, 2); + uint32 map = Eluna::CHECKVAL(L, 3); + float x = Eluna::CHECKVAL(L, 4); + float y = Eluna::CHECKVAL(L, 5); + float z = Eluna::CHECKVAL(L, 6); + float zoneId = Eluna::CHECKVAL(L, 7); + uint32 delay = Eluna::CHECKVAL(L, 8, 0); if (!MapManager::IsValidMapCoord(map, x, y, z)) return 0; @@ -1403,9 +1403,9 @@ namespace LuaPlayer return 0; } - int Mute(Eluna* E, Player* player) + int Mute(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 muteseconds = Eluna::CHECKVAL(E->L, 2); + uint32 muteseconds = Eluna::CHECKVAL(L, 2); /*const char* reason = luaL_checkstring(E, 2);*/ // Mangos does not have a reason field in database. uint64 muteTime = time(NULL) + muteseconds; @@ -1414,15 +1414,15 @@ namespace LuaPlayer return 0; } - int CreateCorpse(Eluna* /*E*/, Player* player) + int CreateCorpse(Eluna* /*E*/, lua_State* /*L*/, Player* player) { player->CreateCorpse(); return 0; } - int RewardQuest(Eluna* E, Player* player) + int RewardQuest(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); + uint32 entry = Eluna::CHECKVAL(L, 2); Quest const* quest = eObjectMgr->GetQuestTemplate(entry); if (quest) @@ -1430,9 +1430,9 @@ namespace LuaPlayer return 0; } - int SendAuctionMenu(Eluna* E, Player* player) + int SendAuctionMenu(Eluna* /*E*/, lua_State* L, Player* player) { - Unit* unit = Eluna::CHECKOBJ(E->L, 2); + Unit* unit = Eluna::CHECKOBJ(L, 2); #ifndef TRINITY AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit); @@ -1450,55 +1450,55 @@ namespace LuaPlayer return 0; } - int SendTaxiMenu(Eluna* E, Player* player) + int SendTaxiMenu(Eluna* /*E*/, lua_State* L, Player* player) { - Creature* creature = Eluna::CHECKOBJ(E->L, 2); + Creature* creature = Eluna::CHECKOBJ(L, 2); player->GetSession()->SendTaxiMenu(creature); return 0; } - int SendSpiritResurrect(Eluna* /*E*/, Player* player) + int SendSpiritResurrect(Eluna* /*E*/, lua_State* /*L*/, Player* player) { player->GetSession()->SendSpiritResurrect(); return 0; } - int SendTabardVendorActivate(Eluna* E, Player* player) + int SendTabardVendorActivate(Eluna* /*E*/, lua_State* L, Player* player) { - WorldObject* obj = Eluna::CHECKOBJ(E->L, 2); + WorldObject* obj = Eluna::CHECKOBJ(L, 2); player->GetSession()->SendTabardVendorActivate(obj->GET_GUID()); return 0; } - int SendShowBank(Eluna* E, Player* player) + int SendShowBank(Eluna* /*E*/, lua_State* L, Player* player) { - WorldObject* obj = Eluna::CHECKOBJ(E->L, 2); + WorldObject* obj = Eluna::CHECKOBJ(L, 2); player->GetSession()->SendShowBank(obj->GET_GUID()); return 0; } - int SendListInventory(Eluna* E, Player* player) + int SendListInventory(Eluna* /*E*/, lua_State* L, Player* player) { - WorldObject* obj = Eluna::CHECKOBJ(E->L, 2); + WorldObject* obj = Eluna::CHECKOBJ(L, 2); player->GetSession()->SendListInventory(obj->GET_GUID()); return 0; } - int SendTrainerList(Eluna* E, Player* player) + int SendTrainerList(Eluna* /*E*/, lua_State* L, Player* player) { - WorldObject* obj = Eluna::CHECKOBJ(E->L, 2); + WorldObject* obj = Eluna::CHECKOBJ(L, 2); player->GetSession()->SendTrainerList(obj->GET_GUID()); return 0; } - int SendGuildInvite(Eluna* E, Player* player) + int SendGuildInvite(Eluna* /*E*/, lua_State* L, Player* player) { - Player* plr = Eluna::CHECKOBJ(E->L, 2); + Player* plr = Eluna::CHECKOBJ(L, 2); #ifndef TRINITY player->GetSession()->SendGuildInvite(plr); @@ -1509,15 +1509,15 @@ namespace LuaPlayer return 0; } - int LogoutPlayer(Eluna* E, Player* player) + int LogoutPlayer(Eluna* /*E*/, lua_State* L, Player* player) { - bool save = Eluna::CHECKVAL(E->L, 2, true); + bool save = Eluna::CHECKVAL(L, 2, true); player->GetSession()->LogoutPlayer(save); return 0; } - int RemoveFromBattlegroundRaid(Eluna* /*E*/, Player* player) + int RemoveFromBattlegroundRaid(Eluna* /*E*/, lua_State* /*L*/, Player* player) { #ifndef TRINITY player->RemoveFromBattleGroundRaid(); @@ -1527,11 +1527,11 @@ namespace LuaPlayer return 0; } - int UnbindInstance(Eluna* E, Player* player) + int UnbindInstance(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 map = Eluna::CHECKVAL(E->L, 2); + uint32 map = Eluna::CHECKVAL(L, 2); #ifndef CLASSIC - uint32 difficulty = Eluna::CHECKVAL(E->L, 3); + uint32 difficulty = Eluna::CHECKVAL(L, 3); if (difficulty < MAX_DIFFICULTY) player->UnbindInstance(map, (Difficulty)difficulty); @@ -1541,95 +1541,95 @@ namespace LuaPlayer return 0; } - int LeaveBattleground(Eluna* E, Player* player) + int LeaveBattleground(Eluna* /*E*/, lua_State* L, Player* player) { - bool teleToEntryPoint = Eluna::CHECKVAL(E->L, 2, true); + bool teleToEntryPoint = Eluna::CHECKVAL(L, 2, true); player->LeaveBattleground(teleToEntryPoint); return 0; } - int DurabilityRepair(Eluna* E, Player* player) + int DurabilityRepair(Eluna* /*E*/, lua_State* L, Player* player) { - uint16 position = Eluna::CHECKVAL(E->L, 2); - bool cost = Eluna::CHECKVAL(E->L, 3, true); - float discountMod = Eluna::CHECKVAL(E->L, 4); - bool guildBank = Eluna::CHECKVAL(E->L, 5, false); + uint16 position = Eluna::CHECKVAL(L, 2); + bool cost = Eluna::CHECKVAL(L, 3, true); + float discountMod = Eluna::CHECKVAL(L, 4); + bool guildBank = Eluna::CHECKVAL(L, 5, false); #ifdef CLASSIC - Eluna::Push(E->L, player->DurabilityRepair(position, cost, discountMod)); + Eluna::Push(L, player->DurabilityRepair(position, cost, discountMod)); #else - Eluna::Push(E->L, player->DurabilityRepair(position, cost, discountMod, guildBank)); + Eluna::Push(L, player->DurabilityRepair(position, cost, discountMod, guildBank)); #endif return 1; } - int DurabilityRepairAll(Eluna* E, Player* player) + int DurabilityRepairAll(Eluna* /*E*/, lua_State* L, Player* player) { - bool cost = Eluna::CHECKVAL(E->L, 2, true); - float discountMod = Eluna::CHECKVAL(E->L, 3); - bool guildBank = Eluna::CHECKVAL(E->L, 4, false); + bool cost = Eluna::CHECKVAL(L, 2, true); + float discountMod = Eluna::CHECKVAL(L, 3); + bool guildBank = Eluna::CHECKVAL(L, 4, false); #ifdef CLASSIC - Eluna::Push(E->L, player->DurabilityRepairAll(cost, discountMod)); + Eluna::Push(L, player->DurabilityRepairAll(cost, discountMod)); #else - Eluna::Push(E->L, player->DurabilityRepairAll(cost, discountMod, guildBank)); + Eluna::Push(L, player->DurabilityRepairAll(cost, discountMod, guildBank)); #endif return 1; } - int DurabilityPointLossForEquipSlot(Eluna* E, Player* player) + int DurabilityPointLossForEquipSlot(Eluna* /*E*/, lua_State* L, Player* player) { - int32 slot = Eluna::CHECKVAL(E->L, 2); + int32 slot = Eluna::CHECKVAL(L, 2); if (slot >= EQUIPMENT_SLOT_START && slot < EQUIPMENT_SLOT_END) player->DurabilityPointLossForEquipSlot((EquipmentSlots)slot); return 0; } - int DurabilityPointsLossAll(Eluna* E, Player* player) + int DurabilityPointsLossAll(Eluna* /*E*/, lua_State* L, Player* player) { - int32 points = Eluna::CHECKVAL(E->L, 2); - bool inventory = Eluna::CHECKVAL(E->L, 3, true); + int32 points = Eluna::CHECKVAL(L, 2); + bool inventory = Eluna::CHECKVAL(L, 3, true); player->DurabilityPointsLossAll(points, inventory); return 0; } - int DurabilityPointsLoss(Eluna* E, Player* player) + int DurabilityPointsLoss(Eluna* /*E*/, lua_State* L, Player* player) { - Item* item = Eluna::CHECKOBJ(E->L, 2); - int32 points = Eluna::CHECKVAL(E->L, 3); + Item* item = Eluna::CHECKOBJ(L, 2); + int32 points = Eluna::CHECKVAL(L, 3); player->DurabilityPointsLoss(item, points); return 0; } - int DurabilityLoss(Eluna* E, Player* player) + int DurabilityLoss(Eluna* /*E*/, lua_State* L, Player* player) { - Item* item = Eluna::CHECKOBJ(E->L, 2); - double percent = Eluna::CHECKVAL(E->L, 3); + Item* item = Eluna::CHECKOBJ(L, 2); + double percent = Eluna::CHECKVAL(L, 3); player->DurabilityLoss(item, percent); return 0; } - int DurabilityLossAll(Eluna* E, Player* player) + int DurabilityLossAll(Eluna* /*E*/, lua_State* L, Player* player) { - double percent = Eluna::CHECKVAL(E->L, 2); - bool inventory = Eluna::CHECKVAL(E->L, 3, true); + double percent = Eluna::CHECKVAL(L, 2); + bool inventory = Eluna::CHECKVAL(L, 3, true); player->DurabilityLossAll(percent, inventory); return 0; } - int KillPlayer(Eluna* /*E*/, Player* player) + int KillPlayer(Eluna* /*E*/, lua_State* /*L*/, Player* player) { player->KillPlayer(); return 0; } - int RemoveFromGroup(Eluna* /*E*/, Player* player) + int RemoveFromGroup(Eluna* /*E*/, lua_State* /*L*/, Player* player) { if (!player->GetGroup()) return 0; @@ -1638,23 +1638,23 @@ namespace LuaPlayer return 0; } - int ResetTalentsCost(Eluna* E, Player* player) + int ResetTalentsCost(Eluna* /*E*/, lua_State* L, Player* player) { #ifdef CATA - Eluna::Push(E->L, player->GetNextResetTalentsCost()); + Eluna::Push(L, player->GetNextResetTalentsCost()); #else #ifdef TRINITY - Eluna::Push(E->L, player->ResetTalentsCost()); + Eluna::Push(L, player->ResetTalentsCost()); #else - Eluna::Push(E->L, player->resetTalentsCost()); + Eluna::Push(L, player->resetTalentsCost()); #endif #endif return 1; } - int ResetTalents(Eluna* E, Player* player) + int ResetTalents(Eluna* /*E*/, lua_State* L, Player* player) { - bool no_cost = Eluna::CHECKVAL(E->L, 2, true); + bool no_cost = Eluna::CHECKVAL(L, 2, true); #ifdef CATA player->ResetTalents(no_cost); @@ -1671,11 +1671,11 @@ namespace LuaPlayer return 0; } - int RemoveSpell(Eluna* E, Player* player) + int RemoveSpell(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); - bool disabled = Eluna::CHECKVAL(E->L, 3, false); - bool learn_low_rank = Eluna::CHECKVAL(E->L, 4, true); + uint32 entry = Eluna::CHECKVAL(L, 2); + bool disabled = Eluna::CHECKVAL(L, 3, false); + bool learn_low_rank = Eluna::CHECKVAL(L, 4, true); #ifdef TRINITY player->RemoveSpell(entry, disabled, learn_low_rank); @@ -1685,87 +1685,87 @@ namespace LuaPlayer return 0; } - int ClearComboPoints(Eluna* /*E*/, Player* player) + int ClearComboPoints(Eluna* /*E*/, lua_State* /*L*/, Player* player) { player->ClearComboPoints(); return 0; } - int AddComboPoints(Eluna* E, Player* player) + int AddComboPoints(Eluna* /*E*/, lua_State* L, Player* player) { - Unit* target = Eluna::CHECKOBJ(E->L, 2); - int8 count = Eluna::CHECKVAL(E->L, 3); + Unit* target = Eluna::CHECKOBJ(L, 2); + int8 count = Eluna::CHECKVAL(L, 3); player->AddComboPoints(target, count); return 0; } - int TalkedToCreature(Eluna* E, Player* player) + int TalkedToCreature(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); - Creature* creature = Eluna::CHECKOBJ(E->L, 3); + uint32 entry = Eluna::CHECKVAL(L, 2); + Creature* creature = Eluna::CHECKOBJ(L, 3); player->TalkedToCreature(entry, creature->GET_GUID()); return 0; } - int KilledMonsterCredit(Eluna* E, Player* player) + int KilledMonsterCredit(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); + uint32 entry = Eluna::CHECKVAL(L, 2); player->KilledMonsterCredit(entry, player->GET_GUID()); return 0; } - int GroupEventHappens(Eluna* E, Player* player) + int GroupEventHappens(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 questId = Eluna::CHECKVAL(E->L, 2); - WorldObject* obj = Eluna::CHECKOBJ(E->L, 3); + uint32 questId = Eluna::CHECKVAL(L, 2); + WorldObject* obj = Eluna::CHECKOBJ(L, 3); player->GroupEventHappens(questId, obj); return 0; } - int AreaExploredOrEventHappens(Eluna* E, Player* player) + int AreaExploredOrEventHappens(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 questId = Eluna::CHECKVAL(E->L, 2); + uint32 questId = Eluna::CHECKVAL(L, 2); player->AreaExploredOrEventHappens(questId); return 0; } - int FailQuest(Eluna* E, Player* player) + int FailQuest(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); + uint32 entry = Eluna::CHECKVAL(L, 2); player->FailQuest(entry); return 0; } - int IncompleteQuest(Eluna* E, Player* player) + int IncompleteQuest(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); + uint32 entry = Eluna::CHECKVAL(L, 2); player->IncompleteQuest(entry); return 0; } - int CompleteQuest(Eluna* E, Player* player) + int CompleteQuest(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); + uint32 entry = Eluna::CHECKVAL(L, 2); player->CompleteQuest(entry); return 0; } - int Whisper(Eluna* E, Player* player) + int Whisper(Eluna* /*E*/, lua_State* L, Player* player) { - std::string text = Eluna::CHECKVAL(E->L, 2); - uint32 lang = Eluna::CHECKVAL(E->L, 3); + std::string text = Eluna::CHECKVAL(L, 2); + uint32 lang = Eluna::CHECKVAL(L, 3); #ifdef TRINITY - Player* receiver = Eluna::CHECKOBJ(E->L, 4); + Player* receiver = Eluna::CHECKOBJ(L, 4); #else - uint64 guid = Eluna::CHECKVAL(E->L, 4); + uint64 guid = Eluna::CHECKVAL(L, 4); #endif #ifdef TRINITY player->Whisper(text, (Language)lang, receiver); @@ -1775,18 +1775,18 @@ namespace LuaPlayer return 0; } - int TextEmote(Eluna* E, Player* player) + int TextEmote(Eluna* /*E*/, lua_State* L, Player* player) { - std::string text = Eluna::CHECKVAL(E->L, 2); + std::string text = Eluna::CHECKVAL(L, 2); player->TextEmote(text); return 0; } - int Yell(Eluna* E, Player* player) + int Yell(Eluna* /*E*/, lua_State* L, Player* player) { - std::string text = Eluna::CHECKVAL(E->L, 2); - uint32 lang = Eluna::CHECKVAL(E->L, 3); + std::string text = Eluna::CHECKVAL(L, 2); + uint32 lang = Eluna::CHECKVAL(L, 3); #ifdef TRINITY player->Yell(text, (Language)lang); #else @@ -1795,10 +1795,10 @@ namespace LuaPlayer return 0; } - int Say(Eluna* E, Player* player) + int Say(Eluna* /*E*/, lua_State* L, Player* player) { - std::string text = Eluna::CHECKVAL(E->L, 2); - uint32 lang = Eluna::CHECKVAL(E->L, 3); + std::string text = Eluna::CHECKVAL(L, 2); + uint32 lang = Eluna::CHECKVAL(L, 3); #ifdef TRINITY player->Say(text, (Language)lang); #else @@ -1807,39 +1807,39 @@ namespace LuaPlayer return 0; } - int GiveXP(Eluna* E, Player* player) + int GiveXP(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 xp = Eluna::CHECKVAL(E->L, 2); - Unit* victim = Eluna::CHECKOBJ(E->L, 3, false); + uint32 xp = Eluna::CHECKVAL(L, 2); + Unit* victim = Eluna::CHECKOBJ(L, 3, false); player->GiveXP(xp, victim); return 0; } - int ToggleDND(Eluna* /*E*/, Player* player) + int ToggleDND(Eluna* /*E*/, lua_State* /*L*/, Player* player) { player->ToggleDND(); return 0; } - int ToggleAFK(Eluna* /*E*/, Player* player) + int ToggleAFK(Eluna* /*E*/, lua_State* /*L*/, Player* player) { player->ToggleAFK(); return 0; } - int EquipItem(Eluna* E, Player* player) + int EquipItem(Eluna* /*E*/, lua_State* L, Player* player) { uint16 dest = 0; - Item* item = Eluna::CHECKOBJ(E->L, 2, false); - uint32 slot = Eluna::CHECKVAL(E->L, 3); + Item* item = Eluna::CHECKOBJ(L, 2, false); + uint32 slot = Eluna::CHECKVAL(L, 3); if (slot >= INVENTORY_SLOT_BAG_END) return 1; if (!item) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); + uint32 entry = Eluna::CHECKVAL(L, 2); item = Item::CreateItem(entry, 1, player); if (!item) return 1; @@ -1863,28 +1863,28 @@ namespace LuaPlayer player->RemoveItem(item->GetBagSlot(), item->GetSlot(), true); } - Eluna::Push(E->L, player->EquipItem(dest, item, true)); + Eluna::Push(L, player->EquipItem(dest, item, true)); return 1; } - int CanEquipItem(Eluna* E, Player* player) + int CanEquipItem(Eluna* /*E*/, lua_State* L, Player* player) { - Item* item = Eluna::CHECKOBJ(E->L, 2, false); - uint32 slot = Eluna::CHECKVAL(E->L, 3); + Item* item = Eluna::CHECKOBJ(L, 2, false); + uint32 slot = Eluna::CHECKVAL(L, 3); if (slot >= EQUIPMENT_SLOT_END) { - Eluna::Push(E->L, false); + Eluna::Push(L, false); return 1; } if (!item) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); + uint32 entry = Eluna::CHECKVAL(L, 2); uint16 dest; InventoryResult msg = player->CanEquipNewItem(slot, dest, entry, false); if (msg != EQUIP_ERR_OK) { - Eluna::Push(E->L, false); + Eluna::Push(L, false); return 1; } } @@ -1894,18 +1894,18 @@ namespace LuaPlayer InventoryResult msg = player->CanEquipItem(slot, dest, item, false); if (msg != EQUIP_ERR_OK) { - Eluna::Push(E->L, false); + Eluna::Push(L, false); return 1; } } - Eluna::Push(E->L, true); + Eluna::Push(L, true); return 1; } #ifndef CLASSIC - int UnsetKnownTitle(Eluna* E, Player* player) + int UnsetKnownTitle(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 id = Eluna::CHECKVAL(E->L, 2); + uint32 id = Eluna::CHECKVAL(L, 2); CharTitlesEntry const* t = sCharTitlesStore.LookupEntry(id); if (t) player->SetTitle(t, true); @@ -1913,15 +1913,15 @@ namespace LuaPlayer } #endif - int AdvanceSkillsToMax(Eluna* /*E*/, Player* player) + int AdvanceSkillsToMax(Eluna* /*E*/, lua_State* /*L*/, Player* player) { player->UpdateSkillsToMaxSkillsForLevel(); return 0; } - int AdvanceAllSkills(Eluna* E, Player* player) + int AdvanceAllSkills(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 step = Eluna::CHECKVAL(E->L, 2); + uint32 step = Eluna::CHECKVAL(L, 2); if (!step) return 0; @@ -1946,10 +1946,10 @@ namespace LuaPlayer return 0; } - int AdvanceSkill(Eluna* E, Player* player) + int AdvanceSkill(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 _skillId = Eluna::CHECKVAL(E->L, 2); - uint32 _step = Eluna::CHECKVAL(E->L, 3); + uint32 _skillId = Eluna::CHECKVAL(L, 2); + uint32 _step = Eluna::CHECKVAL(L, 3); if (_skillId && _step) { if (player->HasSkill(_skillId)) @@ -1958,13 +1958,13 @@ namespace LuaPlayer return 0; } - int Teleport(Eluna* E, Player* player) + int Teleport(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 mapId = Eluna::CHECKVAL(E->L, 2); - float x = Eluna::CHECKVAL(E->L, 3); - float y = Eluna::CHECKVAL(E->L, 4); - float z = Eluna::CHECKVAL(E->L, 5); - float o = Eluna::CHECKVAL(E->L, 6); + uint32 mapId = Eluna::CHECKVAL(L, 2); + float x = Eluna::CHECKVAL(L, 3); + float y = Eluna::CHECKVAL(L, 4); + float z = Eluna::CHECKVAL(L, 5); + float o = Eluna::CHECKVAL(L, 6); #ifndef TRINITY if (player->IsTaxiFlying()) #else @@ -1974,25 +1974,25 @@ namespace LuaPlayer player->GetMotionMaster()->MovementExpired(); player->m_taxi.ClearTaxiDestinations(); } - Eluna::Push(E->L, player->TeleportTo(mapId, x, y, z, o)); + Eluna::Push(L, player->TeleportTo(mapId, x, y, z, o)); return 1; } - int AddLifetimeKills(Eluna* E, Player* player) + int AddLifetimeKills(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 val = Eluna::CHECKVAL(E->L, 2); + uint32 val = Eluna::CHECKVAL(L, 2); uint32 currentKills = player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS); player->SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, currentKills + val); return 0; } - int AddItem(Eluna* E, Player* player) + int AddItem(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 itemId = Eluna::CHECKVAL(E->L, 2); - uint32 itemCount = Eluna::CHECKVAL(E->L, 3); + uint32 itemId = Eluna::CHECKVAL(L, 2); + uint32 itemCount = Eluna::CHECKVAL(L, 3); #ifndef TRINITY - Eluna::Push(E->L, player->StoreNewItemInInventorySlot(itemId, itemCount)); + Eluna::Push(L, player->StoreNewItemInInventorySlot(itemId, itemCount)); #else uint32 noSpaceForCount = 0; ItemPosCountVec dest; @@ -2006,18 +2006,18 @@ namespace LuaPlayer Item* item = player->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); if (item) player->SendNewItem(item, itemCount, true, false); - Eluna::Push(E->L, item); + Eluna::Push(L, item); #endif return 1; } - int RemoveItem(Eluna* E, Player* player) + int RemoveItem(Eluna* /*E*/, lua_State* L, Player* player) { - Item* item = Eluna::CHECKOBJ(E->L, 2, false); - uint32 itemCount = Eluna::CHECKVAL(E->L, 3); + Item* item = Eluna::CHECKOBJ(L, 2, false); + uint32 itemCount = Eluna::CHECKVAL(L, 3); if (!item) { - uint32 itemId = Eluna::CHECKVAL(E->L, 2); + uint32 itemId = Eluna::CHECKVAL(L, 2); player->DestroyItemCount(itemId, itemCount, true); } else @@ -2025,14 +2025,14 @@ namespace LuaPlayer bool all = itemCount >= item->GetCount(); player->DestroyItemCount(item, itemCount, true); if (all) - Eluna::CHECKOBJ(E->L, 2)->Invalidate(); + Eluna::CHECKOBJ(L, 2)->Invalidate(); } return 0; } - int RemoveLifetimeKills(Eluna* E, Player* player) + int RemoveLifetimeKills(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 val = Eluna::CHECKVAL(E->L, 2); + uint32 val = Eluna::CHECKVAL(L, 2); uint32 currentKills = player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS); if (val > currentKills) val = currentKills; @@ -2040,65 +2040,65 @@ namespace LuaPlayer return 0; } - int ResetSpellCooldown(Eluna* E, Player* player) + int ResetSpellCooldown(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 spellId = Eluna::CHECKVAL(E->L, 2); - bool update = Eluna::CHECKVAL(E->L, 3, true); + uint32 spellId = Eluna::CHECKVAL(L, 2); + bool update = Eluna::CHECKVAL(L, 3, true); player->RemoveSpellCooldown(spellId, update); return 0; } - int ResetTypeCooldowns(Eluna* E, Player* player) + int ResetTypeCooldowns(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 category = Eluna::CHECKVAL(E->L, 2); - bool update = Eluna::CHECKVAL(E->L, 3, true); + uint32 category = Eluna::CHECKVAL(L, 2); + bool update = Eluna::CHECKVAL(L, 3, true); player->RemoveSpellCategoryCooldown(category, update); return 0; } - int ResetAllCooldowns(Eluna* /*E*/, Player* player) + int ResetAllCooldowns(Eluna* /*E*/, lua_State* /*L*/, Player* player) { player->RemoveAllSpellCooldown(); return 0; } - int SendClearCooldowns(Eluna* E, Player* player) + int SendClearCooldowns(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 spellId = Eluna::CHECKVAL(E->L, 2); - Unit* target = Eluna::CHECKOBJ(E->L, 3); + uint32 spellId = Eluna::CHECKVAL(L, 2); + Unit* target = Eluna::CHECKOBJ(L, 3); player->SendClearCooldown(spellId, target); return 0; } - int SendBroadcastMessage(Eluna* E, Player* player) + int SendBroadcastMessage(Eluna* /*E*/, lua_State* L, Player* player) { - const char* message = Eluna::CHECKVAL(E->L, 2); + const char* message = Eluna::CHECKVAL(L, 2); if (std::string(message).length() > 0) ChatHandler(player->GetSession()).SendSysMessage(message); return 0; } - int SendAreaTriggerMessage(Eluna* E, Player* player) + int SendAreaTriggerMessage(Eluna* /*E*/, lua_State* L, Player* player) { - std::string msg = Eluna::CHECKVAL(E->L, 2); + std::string msg = Eluna::CHECKVAL(L, 2); if (msg.length() > 0) player->GetSession()->SendAreaTriggerMessage("%s", msg.c_str()); return 0; } - int SendNotification(Eluna* E, Player* player) + int SendNotification(Eluna* /*E*/, lua_State* L, Player* player) { - std::string msg = Eluna::CHECKVAL(E->L, 2); + std::string msg = Eluna::CHECKVAL(L, 2); if (msg.length() > 0) player->GetSession()->SendNotification("%s", msg.c_str()); return 0; } - int SendPacket(Eluna* E, Player* player) + int SendPacket(Eluna* /*E*/, lua_State* L, Player* player) { - WorldPacket* data = Eluna::CHECKOBJ(E->L, 2); - bool selfOnly = Eluna::CHECKVAL(E->L, 3, true); + WorldPacket* data = Eluna::CHECKOBJ(L, 2); + bool selfOnly = Eluna::CHECKVAL(L, 3, true); if (selfOnly) player->GetSession()->SendPacket(data); else @@ -2106,12 +2106,12 @@ namespace LuaPlayer return 0; } - int SendAddonMessage(Eluna* E, Player* player) + int SendAddonMessage(Eluna* /*E*/, lua_State* L, Player* player) { - std::string prefix = Eluna::CHECKVAL(E->L, 2); - std::string message = Eluna::CHECKVAL(E->L, 3); - uint8 channel = Eluna::CHECKVAL(E->L, 4); - Player* receiver = Eluna::CHECKOBJ(E->L, 5); + std::string prefix = Eluna::CHECKVAL(L, 2); + std::string message = Eluna::CHECKVAL(L, 3); + uint8 channel = Eluna::CHECKVAL(L, 4); + Player* receiver = Eluna::CHECKOBJ(L, 5); std::string fullmsg = prefix + "\t" + message; @@ -2130,30 +2130,30 @@ namespace LuaPlayer return 0; } - int SendVendorWindow(Eluna* E, Player* player) + int SendVendorWindow(Eluna* /*E*/, lua_State* L, Player* player) { - Unit* sendTo = Eluna::CHECKOBJ(E->L, 2); + Unit* sendTo = Eluna::CHECKOBJ(L, 2); player->GetSession()->SendListInventory(sendTo->GET_GUID()); return 0; } - int KickPlayer(Eluna* /*E*/, Player* player) + int KickPlayer(Eluna* /*E*/, lua_State* /*L*/, Player* player) { player->GetSession()->KickPlayer(); return 0; } - int ModifyMoney(Eluna* E, Player* player) + int ModifyMoney(Eluna* /*E*/, lua_State* L, Player* player) { - int32 amt = Eluna::CHECKVAL(E->L, 2); + int32 amt = Eluna::CHECKVAL(L, 2); player->ModifyMoney(amt); return 1; } - int LearnSpell(Eluna* E, Player* player) + int LearnSpell(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 id = Eluna::CHECKVAL(E->L, 2); + uint32 id = Eluna::CHECKVAL(L, 2); #ifdef TRINITY player->LearnSpell(id, false); @@ -2163,24 +2163,24 @@ namespace LuaPlayer return 0; } - int ResurrectPlayer(Eluna* E, Player* player) + int ResurrectPlayer(Eluna* /*E*/, lua_State* L, Player* player) { - float percent = Eluna::CHECKVAL(E->L, 2, 100.0f); - bool sickness = Eluna::CHECKVAL(E->L, 3, false); + float percent = Eluna::CHECKVAL(L, 2, 100.0f); + bool sickness = Eluna::CHECKVAL(L, 3, false); player->ResurrectPlayer(percent, sickness); player->SpawnCorpseBones(); return 0; } - int GossipMenuAddItem(Eluna* E, Player* player) + int GossipMenuAddItem(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 _icon = Eluna::CHECKVAL(E->L, 2); - const char* msg = Eluna::CHECKVAL(E->L, 3); - uint32 _sender = Eluna::CHECKVAL(E->L, 4); - uint32 _intid = Eluna::CHECKVAL(E->L, 5); - bool _code = Eluna::CHECKVAL(E->L, 6, false); - const char* _promptMsg = Eluna::CHECKVAL(E->L, 7, ""); - uint32 _money = Eluna::CHECKVAL(E->L, 8, 0); + uint32 _icon = Eluna::CHECKVAL(L, 2); + const char* msg = Eluna::CHECKVAL(L, 3); + uint32 _sender = Eluna::CHECKVAL(L, 4); + uint32 _intid = Eluna::CHECKVAL(L, 5); + bool _code = Eluna::CHECKVAL(L, 6, false); + const char* _promptMsg = Eluna::CHECKVAL(L, 7, ""); + uint32 _money = Eluna::CHECKVAL(L, 8, 0); #ifndef TRINITY #ifndef CLASSIC player->PlayerTalkClass->GetGossipMenu().AddMenuItem(_icon, msg, _sender, _intid, _promptMsg, _money, _code); @@ -2193,7 +2193,7 @@ namespace LuaPlayer return 0; } - int GossipComplete(Eluna* /*E*/, Player* player) + int GossipComplete(Eluna* /*E*/, lua_State* /*L*/, Player* player) { #ifndef TRINITY player->PlayerTalkClass->CloseGossip(); @@ -2203,28 +2203,28 @@ namespace LuaPlayer return 0; } - int GossipSendMenu(Eluna* E, Player* player) + int GossipSendMenu(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 _npcText = Eluna::CHECKVAL(E->L, 2); - WorldObject* sender = Eluna::CHECKOBJ(E->L, 3); + uint32 _npcText = Eluna::CHECKVAL(L, 2); + WorldObject* sender = Eluna::CHECKOBJ(L, 3); if (sender->GetTypeId() == TYPEID_PLAYER) { - uint32 menu_id = Eluna::CHECKVAL(E->L, 4); + uint32 menu_id = Eluna::CHECKVAL(L, 4); player->PlayerTalkClass->GetGossipMenu().SetMenuId(menu_id); } player->PlayerTalkClass->SendGossipMenu(_npcText, sender->GET_GUID()); return 0; } - int GossipClearMenu(Eluna* /*E*/, Player* player) + int GossipClearMenu(Eluna* /*E*/, lua_State* /*L*/, Player* player) { player->PlayerTalkClass->ClearMenus(); return 0; } - int PlaySoundToPlayer(Eluna* E, Player* player) + int PlaySoundToPlayer(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 soundId = Eluna::CHECKVAL(E->L, 2); + uint32 soundId = Eluna::CHECKVAL(L, 2); SoundEntriesEntry const* soundEntry = sSoundEntriesStore.LookupEntry(soundId); if (!soundEntry) return 0; @@ -2233,9 +2233,9 @@ namespace LuaPlayer return 0; } - int StartTaxi(Eluna* E, Player* player) + int StartTaxi(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 pathId = Eluna::CHECKVAL(E->L, 2); + uint32 pathId = Eluna::CHECKVAL(L, 2); if (pathId >= sTaxiPathNodesByPath.size()) return 0; @@ -2253,14 +2253,14 @@ namespace LuaPlayer return 0; } - int GossipSendPOI(Eluna* E, Player* player) + int GossipSendPOI(Eluna* /*E*/, lua_State* L, Player* player) { - float x = Eluna::CHECKVAL(E->L, 2); - float y = Eluna::CHECKVAL(E->L, 3); - uint32 icon = Eluna::CHECKVAL(E->L, 4); - uint32 flags = Eluna::CHECKVAL(E->L, 5); - uint32 data = Eluna::CHECKVAL(E->L, 6); - std::string iconText = Eluna::CHECKVAL(E->L, 6); + float x = Eluna::CHECKVAL(L, 2); + float y = Eluna::CHECKVAL(L, 3); + uint32 icon = Eluna::CHECKVAL(L, 4); + uint32 flags = Eluna::CHECKVAL(L, 5); + uint32 data = Eluna::CHECKVAL(L, 6); + std::string iconText = Eluna::CHECKVAL(L, 6); WorldPacket packet(SMSG_GOSSIP_POI, 4 + 4 + 4 + 4 + 4 + 10); packet << flags; @@ -2273,9 +2273,9 @@ namespace LuaPlayer return 0; } - int GossipAddQuests(Eluna* E, Player* player) + int GossipAddQuests(Eluna* /*E*/, lua_State* L, Player* player) { - WorldObject* source = Eluna::CHECKOBJ(E->L, 2); + WorldObject* source = Eluna::CHECKOBJ(L, 2); if (source->GetTypeId() == TYPEID_UNIT) { @@ -2290,10 +2290,10 @@ namespace LuaPlayer return 0; } - int SendQuestTemplate(Eluna* E, Player* player) + int SendQuestTemplate(Eluna* /*E*/, lua_State* L, Player* player) { - uint32 questId = Eluna::CHECKVAL(E->L, 2); - bool activeAccept = Eluna::CHECKVAL(E->L, 3, true); + uint32 questId = Eluna::CHECKVAL(L, 2); + bool activeAccept = Eluna::CHECKVAL(L, 3, true); Quest const* quest = eObjectMgr->GetQuestTemplate(questId); if (!quest) @@ -2303,84 +2303,84 @@ namespace LuaPlayer return 0; } - int SpawnBones(Eluna* /*E*/, Player* player) + int SpawnBones(Eluna* /*E*/, lua_State* /*L*/, Player* player) { player->SpawnCorpseBones(); return 0; } - int RemovedInsignia(Eluna* E, Player* player) + int RemovedInsignia(Eluna* /*E*/, lua_State* L, Player* player) { - Player* looter = Eluna::CHECKOBJ(E->L, 2); + Player* looter = Eluna::CHECKOBJ(L, 2); player->RemovedInsignia(looter); return 0; } - /*int BindToInstance(Eluna* E, Player* player) + /*int BindToInstance(Eluna* E, lua_State* L, Player* player) { player->BindToInstance(); return 0; }*/ - /*int AddTalent(Eluna* E, Player* player) + /*int AddTalent(Eluna* E, lua_State* L, Player* player) { - uint32 spellId = Eluna::CHECKVAL(E->L, 2); - uint8 spec = Eluna::CHECKVAL(E->L, 3); - bool learning = Eluna::CHECKVAL(E->L, 4, true); + uint32 spellId = Eluna::CHECKVAL(L, 2); + uint8 spec = Eluna::CHECKVAL(L, 3); + bool learning = Eluna::CHECKVAL(L, 4, true); if (spec >= MAX_TALENT_SPECS) - Eluna::Push(E->L, false); + Eluna::Push(L, false); else - Eluna::Push(E->L, player->AddTalent(spellId, spec, learning)); + Eluna::Push(L, player->AddTalent(spellId, spec, learning)); return 1; }*/ - /*int GainSpellComboPoints(Eluna* E, Player* player) + /*int GainSpellComboPoints(Eluna* E, lua_State* L, Player* player) { - int8 count = Eluna::CHECKVAL(E->L, 2); + int8 count = Eluna::CHECKVAL(L, 2); player->GainSpellComboPoints(count); return 0; }*/ - /*int KillGOCredit(Eluna* E, Player* player) + /*int KillGOCredit(Eluna* E, lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); - uint64 guid = Eluna::CHECKVAL(E->L, 3); + uint32 entry = Eluna::CHECKVAL(L, 2); + uint64 guid = Eluna::CHECKVAL(L, 3); player->KillCreditGO(entry, guid); return 0; }*/ - /*int KilledPlayerCredit(Eluna* E, Player* player) + /*int KilledPlayerCredit(Eluna* E, lua_State* L, Player* player) { player->KilledPlayerCredit(); return 0; }*/ - /*int RemoveRewardedQuest(Eluna* E, Player* player) + /*int RemoveRewardedQuest(Eluna* E, lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); + uint32 entry = Eluna::CHECKVAL(L, 2); player->RemoveRewardedQuest(entry); return 0; }*/ - /*int RemoveActiveQuest(Eluna* E, Player* player) + /*int RemoveActiveQuest(Eluna* E, lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); + uint32 entry = Eluna::CHECKVAL(L, 2); player->RemoveActiveQuest(entry); return 0; }*/ - /*int SummonPet(Eluna* E, Player* player) + /*int SummonPet(Eluna* E, lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); - float x = Eluna::CHECKVAL(E->L, 3); - float y = Eluna::CHECKVAL(E->L, 4); - float z = Eluna::CHECKVAL(E->L, 5); - float o = Eluna::CHECKVAL(E->L, 6); - uint32 petType = Eluna::CHECKVAL(E->L, 7); - uint32 despwtime = Eluna::CHECKVAL(E->L, 8); + uint32 entry = Eluna::CHECKVAL(L, 2); + float x = Eluna::CHECKVAL(L, 3); + float y = Eluna::CHECKVAL(L, 4); + float z = Eluna::CHECKVAL(L, 5); + float o = Eluna::CHECKVAL(L, 6); + uint32 petType = Eluna::CHECKVAL(L, 7); + uint32 despwtime = Eluna::CHECKVAL(L, 8); if (petType >= MAX_PET_TYPE) return 0; @@ -2389,10 +2389,10 @@ namespace LuaPlayer return 0; }*/ - /*int RemovePet(Eluna* E, Player* player) + /*int RemovePet(Eluna* E, lua_State* L, Player* player) { - int mode = Eluna::CHECKVAL(E->L, 2, PET_SAVE_AS_DELETED); - bool returnreagent = Eluna::CHECKVAL(E->L, 2, false); + int mode = Eluna::CHECKVAL(L, 2, PET_SAVE_AS_DELETED); + bool returnreagent = Eluna::CHECKVAL(L, 2, false); if (!player->GetPet()) return 0; diff --git a/QuestMethods.h b/QuestMethods.h index e2ec308..1aa762a 100644 --- a/QuestMethods.h +++ b/QuestMethods.h @@ -46,13 +46,13 @@ namespace LuaQuest * @param uint32 flag : all available flags can be seen above * @return bool hasFlag */ - int HasFlag(Eluna* E, Quest* quest) + int HasFlag(Eluna* /*E*/, lua_State* L, Quest* quest) { - uint32 flag = Eluna::CHECKVAL(E->L, 2); + uint32 flag = Eluna::CHECKVAL(L, 2); #ifndef TRINITY - Eluna::Push(E->L, quest->HasQuestFlag((QuestFlags)flag)); + Eluna::Push(L, quest->HasQuestFlag((QuestFlags)flag)); #else - Eluna::Push(E->L, quest->HasFlag(flag)); + Eluna::Push(L, quest->HasFlag(flag)); #endif return 1; } @@ -63,9 +63,9 @@ namespace LuaQuest * * @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; } #endif @@ -75,9 +75,9 @@ namespace LuaQuest * * @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; } @@ -86,9 +86,9 @@ namespace LuaQuest * * @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; } @@ -97,9 +97,9 @@ namespace LuaQuest * * @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; } @@ -108,9 +108,9 @@ namespace LuaQuest * * @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; } @@ -119,9 +119,9 @@ namespace LuaQuest * * @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; } @@ -130,9 +130,9 @@ namespace LuaQuest * * @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; } @@ -141,9 +141,9 @@ namespace LuaQuest * * @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; } @@ -152,12 +152,12 @@ namespace LuaQuest * * @return uint32 flags */ - int GetFlags(Eluna* E, Quest* quest) + int GetFlags(Eluna* /*E*/, lua_State* L, Quest* quest) { #ifndef TRINITY - Eluna::Push(E->L, quest->GetQuestFlags()); + Eluna::Push(L, quest->GetQuestFlags()); #else - Eluna::Push(E->L, quest->GetFlags()); + Eluna::Push(L, quest->GetFlags()); #endif return 1; } @@ -169,15 +169,15 @@ namespace LuaQuest * * @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; } - /*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; }*/ }; diff --git a/SpellMethods.h b/SpellMethods.h index f1944fa..f462642 100644 --- a/SpellMethods.h +++ b/SpellMethods.h @@ -14,9 +14,9 @@ namespace LuaSpell * * @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; } @@ -25,9 +25,9 @@ namespace LuaSpell * * @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; } @@ -36,9 +36,9 @@ namespace LuaSpell * * @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; } @@ -47,9 +47,9 @@ namespace LuaSpell * * @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; } @@ -58,9 +58,9 @@ namespace LuaSpell * * @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; } @@ -69,12 +69,12 @@ namespace LuaSpell * * @return int32 duration */ - int GetDuration(Eluna* E, Spell* spell) + int GetDuration(Eluna* /*E*/, lua_State* L, Spell* spell) { #ifndef TRINITY - Eluna::Push(E->L, GetSpellDuration(spell->m_spellInfo)); + Eluna::Push(L, GetSpellDuration(spell->m_spellInfo)); #else - Eluna::Push(E->L, spell->GetSpellInfo()->GetDuration()); + Eluna::Push(L, spell->GetSpellInfo()->GetDuration()); #endif return 1; } @@ -86,7 +86,7 @@ namespace LuaSpell * @return float y : y 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 if (!(spell->m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)) @@ -99,9 +99,9 @@ namespace LuaSpell float x, y, z; spell->m_targets.GetDstPos()->GetPosition(x, y, z); #endif - Eluna::Push(E->L, x); - Eluna::Push(E->L, y); - Eluna::Push(E->L, z); + Eluna::Push(L, x); + Eluna::Push(L, y); + Eluna::Push(L, z); return 3; } @@ -111,28 +111,28 @@ namespace LuaSpell * * @return [Object] target */ - int GetTarget(Eluna* E, Spell* spell) + int GetTarget(Eluna* /*E*/, lua_State* L, Spell* spell) { #ifndef TRINITY if (GameObject* target = spell->m_targets.getGOTarget()) - Eluna::Push(E->L, target); + Eluna::Push(L, target); 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())) - Eluna::Push(E->L, target); + Eluna::Push(L, target); else if (Unit* target = spell->m_targets.getUnitTarget()) - Eluna::Push(E->L, target); + Eluna::Push(L, target); #else if (GameObject* target = spell->m_targets.GetGOTarget()) - Eluna::Push(E->L, target); + Eluna::Push(L, target); 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()) - Eluna::Push(E->L, target); + Eluna::Push(L, target); 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()) - Eluna::Push(E->L, target); + Eluna::Push(L, target); #endif return 1; } @@ -142,9 +142,9 @@ namespace LuaSpell * * @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(E->L, 2); + bool repeat = Eluna::CHECKVAL(L, 2); spell->SetAutoRepeat(repeat); 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 */ - int Cast(Eluna* E, Spell* spell) + int Cast(Eluna* /*E*/, lua_State* L, Spell* spell) { - bool skipCheck = Eluna::CHECKVAL(E->L, 2, false); + bool skipCheck = Eluna::CHECKVAL(L, 2, false); spell->cast(skipCheck); return 0; } @@ -165,7 +165,7 @@ namespace LuaSpell * Cancels the [Spell]. * */ - int Cancel(Eluna* /*E*/, Spell* spell) + int Cancel(Eluna* /*E*/, lua_State* /*L*/, Spell* spell) { spell->cancel(); return 0; @@ -175,7 +175,7 @@ namespace LuaSpell * Finishes the [Spell]. * */ - int Finish(Eluna* /*E*/, Spell* spell) + int Finish(Eluna* /*E*/, lua_State* /*L*/, Spell* spell) { spell->finish(); return 0; diff --git a/UnitMethods.h b/UnitMethods.h index 6b1d597..ac2ad98 100644 --- a/UnitMethods.h +++ b/UnitMethods.h @@ -10,496 +10,496 @@ namespace LuaUnit { /* BOOLEAN */ - int Attack(Eluna* E, Unit* unit) + int Attack(Eluna* /*E*/, lua_State* L, Unit* unit) { - Unit* who = Eluna::CHECKOBJ(E->L, 2); - bool meleeAttack = Eluna::CHECKVAL(E->L, 3, false); + Unit* who = Eluna::CHECKOBJ(L, 2); + bool meleeAttack = Eluna::CHECKVAL(L, 3, false); - Eluna::Push(E->L, unit->Attack(who, meleeAttack)); + Eluna::Push(L, unit->Attack(who, meleeAttack)); return 1; } - int AttackStop(Eluna* E, Unit* unit) + int AttackStop(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->AttackStop()); + Eluna::Push(L, unit->AttackStop()); return 1; } - int IsStandState(Eluna* E, Unit* unit) + int IsStandState(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->IsStandState()); + Eluna::Push(L, unit->IsStandState()); return 1; } - int IsMounted(Eluna* E, Unit* unit) + int IsMounted(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->IsMounted()); + Eluna::Push(L, unit->IsMounted()); return 1; } - int IsRooted(Eluna* E, Unit* unit) + int IsRooted(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef TRINITY - Eluna::Push(E->L, unit->isInRoots() || unit->HasUnitMovementFlag(MOVEMENTFLAG_ROOT)); + Eluna::Push(L, unit->isInRoots() || unit->HasUnitMovementFlag(MOVEMENTFLAG_ROOT)); #endif #ifdef CMANGOS - Eluna::Push(E->L, unit->isInRoots() || unit->IsRooted()); + Eluna::Push(L, unit->isInRoots() || unit->IsRooted()); #endif #ifdef MANGOS - Eluna::Push(E->L, unit->IsInRoots() || unit->IsRooted()); + Eluna::Push(L, unit->IsInRoots() || unit->IsRooted()); #endif return 1; } - int IsFullHealth(Eluna* E, Unit* unit) + int IsFullHealth(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->IsFullHealth()); + Eluna::Push(L, unit->IsFullHealth()); return 1; } - int IsWithinDistInMap(Eluna* E, Unit* unit) + int IsWithinDistInMap(Eluna* /*E*/, lua_State* L, Unit* unit) { - WorldObject* obj = Eluna::CHECKOBJ(E->L, 2); - float radius = Eluna::CHECKVAL(E->L, 3); + WorldObject* obj = Eluna::CHECKOBJ(L, 2); + float radius = Eluna::CHECKVAL(L, 3); - Eluna::Push(E->L, unit->IsWithinDistInMap(obj, radius)); + Eluna::Push(L, unit->IsWithinDistInMap(obj, radius)); return 1; } - int IsInAccessiblePlaceFor(Eluna* E, Unit* unit) + int IsInAccessiblePlaceFor(Eluna* /*E*/, lua_State* L, Unit* unit) { - Creature* creature = Eluna::CHECKOBJ(E->L, 2); + Creature* creature = Eluna::CHECKOBJ(L, 2); #ifndef TRINITY - Eluna::Push(E->L, unit->isInAccessablePlaceFor(creature)); + Eluna::Push(L, unit->isInAccessablePlaceFor(creature)); #else - Eluna::Push(E->L, unit->isInAccessiblePlaceFor(creature)); + Eluna::Push(L, unit->isInAccessiblePlaceFor(creature)); #endif return 1; } - int IsAuctioneer(Eluna* E, Unit* unit) + int IsAuctioneer(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifndef TRINITY - Eluna::Push(E->L, unit->isAuctioner()); + Eluna::Push(L, unit->isAuctioner()); #else - Eluna::Push(E->L, unit->IsAuctioner()); + Eluna::Push(L, unit->IsAuctioner()); #endif return 1; } - int IsGuildMaster(Eluna* E, Unit* unit) + int IsGuildMaster(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isGuildMaster()); + Eluna::Push(L, unit->isGuildMaster()); #else - Eluna::Push(E->L, unit->IsGuildMaster()); + Eluna::Push(L, unit->IsGuildMaster()); #endif return 1; } - int IsInnkeeper(Eluna* E, Unit* unit) + int IsInnkeeper(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isInnkeeper()); + Eluna::Push(L, unit->isInnkeeper()); #else - Eluna::Push(E->L, unit->IsInnkeeper()); + Eluna::Push(L, unit->IsInnkeeper()); #endif return 1; } - int IsTrainer(Eluna* E, Unit* unit) + int IsTrainer(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isTrainer()); + Eluna::Push(L, unit->isTrainer()); #else - Eluna::Push(E->L, unit->IsTrainer()); + Eluna::Push(L, unit->IsTrainer()); #endif return 1; } - int IsGossip(Eluna* E, Unit* unit) + int IsGossip(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isGossip()); + Eluna::Push(L, unit->isGossip()); #else - Eluna::Push(E->L, unit->IsGossip()); + Eluna::Push(L, unit->IsGossip()); #endif return 1; } - int IsTaxi(Eluna* E, Unit* unit) + int IsTaxi(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isTaxi()); + Eluna::Push(L, unit->isTaxi()); #else - Eluna::Push(E->L, unit->IsTaxi()); + Eluna::Push(L, unit->IsTaxi()); #endif return 1; } - int IsSpiritHealer(Eluna* E, Unit* unit) + int IsSpiritHealer(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isSpiritHealer()); + Eluna::Push(L, unit->isSpiritHealer()); #else - Eluna::Push(E->L, unit->IsSpiritHealer()); + Eluna::Push(L, unit->IsSpiritHealer()); #endif return 1; } - int IsSpiritGuide(Eluna* E, Unit* unit) + int IsSpiritGuide(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isSpiritGuide()); + Eluna::Push(L, unit->isSpiritGuide()); #else - Eluna::Push(E->L, unit->IsSpiritGuide()); + Eluna::Push(L, unit->IsSpiritGuide()); #endif return 1; } - int IsTabardDesigner(Eluna* E, Unit* unit) + int IsTabardDesigner(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isTabardDesigner()); + Eluna::Push(L, unit->isTabardDesigner()); #else - Eluna::Push(E->L, unit->IsTabardDesigner()); + Eluna::Push(L, unit->IsTabardDesigner()); #endif return 1; } - int IsServiceProvider(Eluna* E, Unit* unit) + int IsServiceProvider(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isServiceProvider()); + Eluna::Push(L, unit->isServiceProvider()); #else - Eluna::Push(E->L, unit->IsServiceProvider()); + Eluna::Push(L, unit->IsServiceProvider()); #endif return 1; } - int IsSpiritService(Eluna* E, Unit* unit) + int IsSpiritService(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isSpiritService()); + Eluna::Push(L, unit->isSpiritService()); #else - Eluna::Push(E->L, unit->IsSpiritService()); + Eluna::Push(L, unit->IsSpiritService()); #endif return 1; } - int IsAlive(Eluna* E, Unit* unit) + int IsAlive(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isAlive()); + Eluna::Push(L, unit->isAlive()); #else - Eluna::Push(E->L, unit->IsAlive()); + Eluna::Push(L, unit->IsAlive()); #endif return 1; } - int IsDead(Eluna* E, Unit* unit) + int IsDead(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef MANGOS - Eluna::Push(E->L, unit->IsDead()); + Eluna::Push(L, unit->IsDead()); #else - Eluna::Push(E->L, unit->isDead()); + Eluna::Push(L, unit->isDead()); #endif return 1; } - int IsDying(Eluna* E, Unit* unit) + int IsDying(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef MANGOS - Eluna::Push(E->L, unit->IsDying()); + Eluna::Push(L, unit->IsDying()); #else - Eluna::Push(E->L, unit->isDying()); + Eluna::Push(L, unit->isDying()); #endif return 1; } - int IsBanker(Eluna* E, Unit* unit) + int IsBanker(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isBanker()); + Eluna::Push(L, unit->isBanker()); #else - Eluna::Push(E->L, unit->IsBanker()); + Eluna::Push(L, unit->IsBanker()); #endif return 1; } - int IsVendor(Eluna* E, Unit* unit) + int IsVendor(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isVendor()); + Eluna::Push(L, unit->isVendor()); #else - Eluna::Push(E->L, unit->IsVendor()); + Eluna::Push(L, unit->IsVendor()); #endif return 1; } - int IsBattleMaster(Eluna* E, Unit* unit) + int IsBattleMaster(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isBattleMaster()); + Eluna::Push(L, unit->isBattleMaster()); #else - Eluna::Push(E->L, unit->IsBattleMaster()); + Eluna::Push(L, unit->IsBattleMaster()); #endif return 1; } - int IsCharmed(Eluna* E, Unit* unit) + int IsCharmed(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isCharmed()); + Eluna::Push(L, unit->isCharmed()); #else - Eluna::Push(E->L, unit->IsCharmed()); + Eluna::Push(L, unit->IsCharmed()); #endif return 1; } - int IsArmorer(Eluna* E, Unit* unit) + int IsArmorer(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isArmorer()); + Eluna::Push(L, unit->isArmorer()); #else - Eluna::Push(E->L, unit->IsArmorer()); + Eluna::Push(L, unit->IsArmorer()); #endif return 1; } - int IsAttackingPlayer(Eluna* E, Unit* unit) + int IsAttackingPlayer(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->isAttackingPlayer()); + Eluna::Push(L, unit->isAttackingPlayer()); return 1; } - int IsPvPFlagged(Eluna* E, Unit* unit) + int IsPvPFlagged(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->IsPvP()); + Eluna::Push(L, unit->IsPvP()); return 1; } #ifndef CLASSIC - int IsOnVehicle(Eluna* E, Unit* unit) + int IsOnVehicle(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifndef TRINITY - Eluna::Push(E->L, unit->IsBoarded()); + Eluna::Push(L, unit->IsBoarded()); #else - Eluna::Push(E->L, unit->GetVehicle()); + Eluna::Push(L, unit->GetVehicle()); #endif return 1; } #endif - int IsInCombat(Eluna* E, Unit* unit) + int IsInCombat(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isInCombat()); + Eluna::Push(L, unit->isInCombat()); #else - Eluna::Push(E->L, unit->IsInCombat()); + Eluna::Push(L, unit->IsInCombat()); #endif return 1; } - int IsUnderWater(Eluna* E, Unit* unit) + int IsUnderWater(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->IsUnderWater()); + Eluna::Push(L, unit->IsUnderWater()); return 1; } - int IsInWater(Eluna* E, Unit* unit) + int IsInWater(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->IsInWater()); + Eluna::Push(L, unit->IsInWater()); return 1; } - int IsStopped(Eluna* E, Unit* unit) + int IsStopped(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->IsStopped()); + Eluna::Push(L, unit->IsStopped()); return 1; } - int IsQuestGiver(Eluna* E, Unit* unit) + int IsQuestGiver(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef CMANGOS - Eluna::Push(E->L, unit->isQuestGiver()); + Eluna::Push(L, unit->isQuestGiver()); #else - Eluna::Push(E->L, unit->IsQuestGiver()); + Eluna::Push(L, unit->IsQuestGiver()); #endif return 1; } - int HealthBelowPct(Eluna* E, Unit* unit) + int HealthBelowPct(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->HealthBelowPct(Eluna::CHECKVAL(E->L, 2))); + Eluna::Push(L, unit->HealthBelowPct(Eluna::CHECKVAL(L, 2))); return 1; } - int HealthAbovePct(Eluna* E, Unit* unit) + int HealthAbovePct(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->HealthAbovePct(Eluna::CHECKVAL(E->L, 2))); + Eluna::Push(L, unit->HealthAbovePct(Eluna::CHECKVAL(L, 2))); return 1; } - int HasAura(Eluna* E, Unit* unit) + int HasAura(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 spell = Eluna::CHECKVAL(E->L, 2); + uint32 spell = Eluna::CHECKVAL(L, 2); - Eluna::Push(E->L, unit->HasAura(spell)); + Eluna::Push(L, unit->HasAura(spell)); return 1; } - int HasUnitState(Eluna* E, Unit* unit) + int HasUnitState(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 state = Eluna::CHECKVAL(E->L, 2); + uint32 state = Eluna::CHECKVAL(L, 2); #ifndef TRINITY - Eluna::Push(E->L, unit->hasUnitState(state)); + Eluna::Push(L, unit->hasUnitState(state)); #else - Eluna::Push(E->L, unit->HasUnitState(state)); + Eluna::Push(L, unit->HasUnitState(state)); #endif return 1; } - /*int IsVisible(Eluna* E, Unit* unit) + /*int IsVisible(Eluna* E, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->IsVisible()); + Eluna::Push(L, unit->IsVisible()); return 1; }*/ - /*int IsMoving(Eluna* E, Unit* unit) + /*int IsMoving(Eluna* E, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->isMoving()); + Eluna::Push(L, unit->isMoving()); return 1; }*/ - /*int IsFlying(Eluna* E, Unit* unit) + /*int IsFlying(Eluna* E, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->IsFlying()); + Eluna::Push(L, unit->IsFlying()); return 1; }*/ /* GETTERS */ - int GetOwner(Eluna* E, Unit* unit) + int GetOwner(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->GetOwner()); + Eluna::Push(L, unit->GetOwner()); return 1; } - int GetOwnerGUID(Eluna* E, Unit* unit) + int GetOwnerGUID(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifndef TRINITY - Eluna::Push(E->L, unit->GetOwnerGuid()); + Eluna::Push(L, unit->GetOwnerGuid()); #else - Eluna::Push(E->L, unit->GetOwnerGUID()); + Eluna::Push(L, unit->GetOwnerGUID()); #endif return 1; } - int GetMountId(Eluna* E, Unit* unit) + int GetMountId(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->GetMountID()); + Eluna::Push(L, unit->GetMountID()); return 1; } - int GetCreatorGUID(Eluna* E, Unit* unit) + int GetCreatorGUID(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifndef TRINITY - Eluna::Push(E->L, unit->GetCreatorGuid()); + Eluna::Push(L, unit->GetCreatorGuid()); #else - Eluna::Push(E->L, unit->GetCreatorGUID()); + Eluna::Push(L, unit->GetCreatorGUID()); #endif return 1; } - int GetMinionGUID(Eluna* E, Unit* unit) + int GetMinionGUID(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifndef TRINITY - Eluna::Push(E->L, unit->GetPetGuid()); + Eluna::Push(L, unit->GetPetGuid()); #else - Eluna::Push(E->L, unit->GetPetGUID()); + Eluna::Push(L, unit->GetPetGUID()); #endif return 1; } - int GetCharmerGUID(Eluna* E, Unit* unit) + int GetCharmerGUID(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifndef TRINITY - Eluna::Push(E->L, unit->GetCharmerGuid()); + Eluna::Push(L, unit->GetCharmerGuid()); #else - Eluna::Push(E->L, unit->GetCharmerGUID()); + Eluna::Push(L, unit->GetCharmerGUID()); #endif return 1; } - int GetCharmGUID(Eluna* E, Unit* unit) + int GetCharmGUID(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifndef TRINITY - Eluna::Push(E->L, unit->GetCharmGuid()); + Eluna::Push(L, unit->GetCharmGuid()); #else - Eluna::Push(E->L, unit->GetCharmGUID()); + Eluna::Push(L, unit->GetCharmGUID()); #endif return 1; } - int GetPetGUID(Eluna* E, Unit* unit) + int GetPetGUID(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifndef TRINITY - Eluna::Push(E->L, unit->GetPetGuid()); + Eluna::Push(L, unit->GetPetGuid()); #else - Eluna::Push(E->L, unit->GetPetGUID()); + Eluna::Push(L, unit->GetPetGUID()); #endif return 1; } - int GetControllerGUID(Eluna* E, Unit* unit) + int GetControllerGUID(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifndef TRINITY - Eluna::Push(E->L, unit->GetCharmerOrOwnerGuid()); + Eluna::Push(L, unit->GetCharmerOrOwnerGuid()); #else - Eluna::Push(E->L, unit->GetCharmerOrOwnerGUID()); + Eluna::Push(L, unit->GetCharmerOrOwnerGUID()); #endif return 1; } - int GetControllerGUIDS(Eluna* E, Unit* unit) + int GetControllerGUIDS(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifndef TRINITY - Eluna::Push(E->L, unit->GetCharmerOrOwnerOrOwnGuid()); + Eluna::Push(L, unit->GetCharmerOrOwnerOrOwnGuid()); #else - Eluna::Push(E->L, unit->GetCharmerOrOwnerOrOwnGUID()); + Eluna::Push(L, unit->GetCharmerOrOwnerOrOwnGUID()); #endif return 1; } - int GetStat(Eluna* E, Unit* unit) + int GetStat(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 stat = Eluna::CHECKVAL(E->L, 2); + uint32 stat = Eluna::CHECKVAL(L, 2); if (stat >= MAX_STATS) return 1; - Eluna::Push(E->L, unit->GetStat((Stats)stat)); + Eluna::Push(L, unit->GetStat((Stats)stat)); return 1; } - int GetBaseSpellPower(Eluna* E, Unit* unit) + int GetBaseSpellPower(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 spellschool = Eluna::CHECKVAL(E->L, 2); + uint32 spellschool = Eluna::CHECKVAL(L, 2); if (spellschool >= MAX_SPELL_SCHOOL) return 1; - Eluna::Push(E->L, unit->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + spellschool)); + Eluna::Push(L, unit->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + spellschool)); return 1; } - int GetVictim(Eluna* E, Unit* unit) + int GetVictim(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifndef TRINITY - Eluna::Push(E->L, unit->getVictim()); + Eluna::Push(L, unit->getVictim()); #else - Eluna::Push(E->L, unit->GetVictim()); + Eluna::Push(L, unit->GetVictim()); #endif return 1; } @@ -520,47 +520,47 @@ namespace LuaUnit * @param [CurrentSpellTypes] spellType * @return [Spell] castedSpell */ - int GetCurrentSpell(Eluna* E, Unit* unit) + int GetCurrentSpell(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 type = Eluna::CHECKVAL(E->L, 2); + uint32 type = Eluna::CHECKVAL(L, 2); if (type >= CURRENT_MAX_SPELL) - return luaL_argerror(E->L, 2, "valid CurrentSpellTypes expected"); + return luaL_argerror(L, 2, "valid CurrentSpellTypes expected"); - Eluna::Push(E->L, unit->GetCurrentSpell(type)); + Eluna::Push(L, unit->GetCurrentSpell(type)); return 1; } - int GetStandState(Eluna* E, Unit* unit) + int GetStandState(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->getStandState()); + Eluna::Push(L, unit->getStandState()); return 0; } - int GetDisplayId(Eluna* E, Unit* unit) + int GetDisplayId(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->GetDisplayId()); + Eluna::Push(L, unit->GetDisplayId()); return 1; } - int GetNativeDisplayId(Eluna* E, Unit* unit) + int GetNativeDisplayId(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->GetNativeDisplayId()); + Eluna::Push(L, unit->GetNativeDisplayId()); return 1; } - int GetLevel(Eluna* E, Unit* unit) + int GetLevel(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->getLevel()); + Eluna::Push(L, unit->getLevel()); return 1; } - int GetHealth(Eluna* E, Unit* unit) + int GetHealth(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->GetHealth()); + Eluna::Push(L, unit->GetHealth()); return 1; } - Powers PowerSelectorHelper(Eluna* E, Unit* unit, int powerType = -1) + Powers PowerSelectorHelper(Eluna* /*E*/, lua_State* L, Unit* unit, int powerType = -1) { #ifdef TRINITY if (powerType == -1) @@ -571,90 +571,90 @@ namespace LuaUnit #endif if (powerType < 0 || powerType >= int(MAX_POWERS)) - luaL_argerror(E->L, 2, "valid Powers expected"); + luaL_argerror(L, 2, "valid Powers expected"); return (Powers)powerType; } - int GetPower(Eluna* E, Unit* unit) + int GetPower(Eluna* E, lua_State* L, Unit* unit) { - int type = Eluna::CHECKVAL(E->L, 2, -1); - Powers power = PowerSelectorHelper(E, unit, type); + int type = Eluna::CHECKVAL(L, 2, -1); + Powers power = PowerSelectorHelper(E, L, unit, type); - Eluna::Push(E->L, unit->GetPower(power)); + Eluna::Push(L, unit->GetPower(power)); return 1; } - int GetMaxPower(Eluna* E, Unit* unit) + int GetMaxPower(Eluna* E, lua_State* L, Unit* unit) { - int type = Eluna::CHECKVAL(E->L, 2, -1); - Powers power = PowerSelectorHelper(E, unit, type); + int type = Eluna::CHECKVAL(L, 2, -1); + Powers power = PowerSelectorHelper(E, L, unit, type); - Eluna::Push(E->L, unit->GetMaxPower(power)); + Eluna::Push(L, unit->GetMaxPower(power)); return 1; } - int GetPowerPct(Eluna* E, Unit* unit) + int GetPowerPct(Eluna* E, lua_State* L, Unit* unit) { - int type = Eluna::CHECKVAL(E->L, 2, -1); - Powers power = PowerSelectorHelper(E, unit, type); + int type = Eluna::CHECKVAL(L, 2, -1); + Powers power = PowerSelectorHelper(E, L, unit, type); #if (!defined(TRINITY) && defined(WOTLK)) float percent = ((float)unit->GetPower(power) / (float)unit->GetMaxPower(power)) * 100.0f; #else float percent = ((float)unit->GetPower(power) / (float)unit->GetMaxPower(power)) * 100.0f; #endif - Eluna::Push(E->L, percent); + Eluna::Push(L, percent); return 1; } - int GetPowerType(Eluna* E, Unit* unit) + int GetPowerType(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef TRINITY - Eluna::Push(E->L, unit->getPowerType()); + Eluna::Push(L, unit->getPowerType()); #else - Eluna::Push(E->L, unit->GetPowerType()); + Eluna::Push(L, unit->GetPowerType()); #endif return 1; } - int GetMaxHealth(Eluna* E, Unit* unit) + int GetMaxHealth(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->GetMaxHealth()); + Eluna::Push(L, unit->GetMaxHealth()); return 1; } - int GetHealthPct(Eluna* E, Unit* unit) + int GetHealthPct(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifndef TRINITY - Eluna::Push(E->L, unit->GetHealthPercent()); + Eluna::Push(L, unit->GetHealthPercent()); #else - Eluna::Push(E->L, unit->GetHealthPct()); + Eluna::Push(L, unit->GetHealthPct()); #endif return 1; } - int GetGender(Eluna* E, Unit* unit) + int GetGender(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->getGender()); + Eluna::Push(L, unit->getGender()); return 1; } - int GetRace(Eluna* E, Unit* unit) + int GetRace(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->getRace()); + Eluna::Push(L, unit->getRace()); return 1; } - int GetClass(Eluna* E, Unit* unit) + int GetClass(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->getClass()); + Eluna::Push(L, unit->getClass()); return 1; } - int GetCreatureType(Eluna* E, Unit* unit) + int GetCreatureType(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->GetCreatureType()); + Eluna::Push(L, unit->GetCreatureType()); return 1; } @@ -679,17 +679,17 @@ namespace LuaUnit * @param [LocaleConstant] locale = DEFAULT_LOCALE * @return string className : class name or nil */ - int GetClassAsString(Eluna* E, Unit* unit) + int GetClassAsString(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint8 locale = Eluna::CHECKVAL(E->L, 2, DEFAULT_LOCALE); + uint8 locale = Eluna::CHECKVAL(L, 2, DEFAULT_LOCALE); if (locale >= TOTAL_LOCALES) - return luaL_argerror(E->L, 2, "valid LocaleConstant expected"); + return luaL_argerror(L, 2, "valid LocaleConstant expected"); const ChrClassesEntry* entry = sChrClassesStore.LookupEntry(unit->getClass()); if (!entry) return 1; - Eluna::Push(E->L, entry->name[locale]); + Eluna::Push(L, entry->name[locale]); return 1; } @@ -714,46 +714,46 @@ namespace LuaUnit * @param [LocaleConstant] locale = DEFAULT_LOCALE : locale to return the race name in * @return string raceName : race name or nil */ - int GetRaceAsString(Eluna* E, Unit* unit) + int GetRaceAsString(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint8 locale = Eluna::CHECKVAL(E->L, 2, DEFAULT_LOCALE); + uint8 locale = Eluna::CHECKVAL(L, 2, DEFAULT_LOCALE); if (locale >= TOTAL_LOCALES) - return luaL_argerror(E->L, 2, "valid LocaleConstant expected"); + return luaL_argerror(L, 2, "valid LocaleConstant expected"); const ChrRacesEntry* entry = sChrRacesStore.LookupEntry(unit->getRace()); if (!entry) return 1; - Eluna::Push(E->L, entry->name[locale]); + Eluna::Push(L, entry->name[locale]); return 1; } - int GetFaction(Eluna* E, Unit* unit) + int GetFaction(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->getFaction()); + Eluna::Push(L, unit->getFaction()); return 1; } - int GetAura(Eluna* E, Unit* unit) + int GetAura(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 spellID = Eluna::CHECKVAL(E->L, 2); + uint32 spellID = Eluna::CHECKVAL(L, 2); #ifndef TRINITY - Eluna::Push(E->L, unit->GetAura(spellID, EFFECT_INDEX_0)); + Eluna::Push(L, unit->GetAura(spellID, EFFECT_INDEX_0)); #else - Eluna::Push(E->L, unit->GetAura(spellID)); + Eluna::Push(L, unit->GetAura(spellID)); #endif return 1; } - int GetCombatTime(Eluna* E, Unit* unit) + int GetCombatTime(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->GetCombatTimer()); + Eluna::Push(L, unit->GetCombatTimer()); return 1; } - int GetFriendlyUnitsInRange(Eluna* E, Unit* unit) + int GetFriendlyUnitsInRange(Eluna* /*E*/, lua_State* L, Unit* unit) { - float range = Eluna::CHECKVAL(E->L, 2, SIZE_OF_GRIDS); + float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); std::list list; #ifndef TRINITY @@ -768,24 +768,24 @@ namespace LuaUnit ElunaUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID()); list.remove_if(guidCheck); - lua_newtable(E->L); - int tbl = lua_gettop(E->L); + lua_newtable(L); + int tbl = lua_gettop(L); uint32 i = 0; for (std::list::const_iterator it = list.begin(); it != list.end(); ++it) { - Eluna::Push(E->L, ++i); - Eluna::Push(E->L, *it); - lua_settable(E->L, tbl); + Eluna::Push(L, ++i); + Eluna::Push(L, *it); + lua_settable(L, tbl); } - lua_settop(E->L, tbl); + lua_settop(L, tbl); return 1; } - int GetUnfriendlyUnitsInRange(Eluna* E, Unit* unit) + int GetUnfriendlyUnitsInRange(Eluna* /*E*/, lua_State* L, Unit* unit) { - float range = Eluna::CHECKVAL(E->L, 2, SIZE_OF_GRIDS); + float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); std::list list; #ifndef TRINITY @@ -800,46 +800,46 @@ namespace LuaUnit ElunaUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID()); list.remove_if(guidCheck); - lua_newtable(E->L); - int tbl = lua_gettop(E->L); + lua_newtable(L); + int tbl = lua_gettop(L); uint32 i = 0; for (std::list::const_iterator it = list.begin(); it != list.end(); ++it) { - Eluna::Push(E->L, ++i); - Eluna::Push(E->L, *it); - lua_settable(E->L, tbl); + Eluna::Push(L, ++i); + Eluna::Push(L, *it); + lua_settable(L, tbl); } - lua_settop(E->L, tbl); + lua_settop(L, tbl); return 1; } #if (!defined(TBC) && !defined(CLASSIC)) - int GetVehicleKit(Eluna* E, Unit* unit) + int GetVehicleKit(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifndef TRINITY - Eluna::Push(E->L, unit->GetVehicleInfo()); + Eluna::Push(L, unit->GetVehicleInfo()); #else - Eluna::Push(E->L, unit->GetVehicleKit()); + Eluna::Push(L, unit->GetVehicleKit()); #endif return 1; } /* - int GetVehicle(Eluna* E, Unit* unit) + int GetVehicle(Eluna* E, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->GetVehicle()); + Eluna::Push(L, unit->GetVehicle()); return 1; } */ - int GetCritterGUID(Eluna* E, Unit* unit) + int GetCritterGUID(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifndef TRINITY - Eluna::Push(E->L, unit->GetCritterGuid()); + Eluna::Push(L, unit->GetCritterGuid()); #else - Eluna::Push(E->L, unit->GetCritterGUID()); + Eluna::Push(L, unit->GetCritterGUID()); #endif return 1; } @@ -866,24 +866,24 @@ namespace LuaUnit * @param [UnitMoveType] type * @return float speed */ - int GetSpeed(Eluna* E, Unit* unit) + int GetSpeed(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 type = Eluna::CHECKVAL(E->L, 2); + uint32 type = Eluna::CHECKVAL(L, 2); if (type >= MAX_MOVE_TYPE) - return luaL_argerror(E->L, 2, "valid UnitMoveType expected"); + return luaL_argerror(L, 2, "valid UnitMoveType expected"); #ifndef TRINITY - Eluna::Push(E->L, unit->GetSpeedRate((UnitMoveType)type)); + Eluna::Push(L, unit->GetSpeedRate((UnitMoveType)type)); #else - Eluna::Push(E->L, unit->GetSpeed((UnitMoveType)type)); + Eluna::Push(L, unit->GetSpeed((UnitMoveType)type)); #endif return 1; } /* SETTERS */ - int SetOwnerGUID(Eluna* E, Unit* unit) + int SetOwnerGUID(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint64 guid = Eluna::CHECKVAL(E->L, 2); + uint64 guid = Eluna::CHECKVAL(L, 2); #ifndef TRINITY unit->SetOwnerGuid(ObjectGuid(guid)); @@ -893,27 +893,27 @@ namespace LuaUnit return 0; } - int SetPvP(Eluna* E, Unit* unit) + int SetPvP(Eluna* /*E*/, lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(E->L, 2, true); + bool apply = Eluna::CHECKVAL(L, 2, true); unit->SetPvP(apply); return 0; } - int SetSheath(Eluna* E, Unit* unit) + int SetSheath(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 sheathed = Eluna::CHECKVAL(E->L, 2); + uint32 sheathed = Eluna::CHECKVAL(L, 2); if (sheathed >= MAX_SHEATH_STATE) - return luaL_argerror(E->L, 2, "valid SheathState expected"); + return luaL_argerror(L, 2, "valid SheathState expected"); unit->SetSheath((SheathState)sheathed); return 0; } - int SetName(Eluna* E, Unit* unit) + int SetName(Eluna* /*E*/, lua_State* L, Unit* unit) { - const char* name = Eluna::CHECKVAL(E->L, 2); + const char* name = Eluna::CHECKVAL(L, 2); if (std::string(name).length() > 0) unit->SetName(name); return 0; @@ -942,13 +942,13 @@ namespace LuaUnit * @param float rate * @param bool forced = false */ - int SetSpeed(Eluna* E, Unit* unit) + int SetSpeed(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 type = Eluna::CHECKVAL(E->L, 2); - float rate = Eluna::CHECKVAL(E->L, 3); - bool forced = Eluna::CHECKVAL(E->L, 4, false); + uint32 type = Eluna::CHECKVAL(L, 2); + float rate = Eluna::CHECKVAL(L, 3); + bool forced = Eluna::CHECKVAL(L, 4, false); if (type >= MAX_MOVE_TYPE) - return luaL_argerror(E->L, 2, "valid UnitMoveType expected"); + return luaL_argerror(L, 2, "valid UnitMoveType expected"); #ifndef TRINITY unit->SetSpeedRate((UnitMoveType)type, rate, forced); #else @@ -957,59 +957,59 @@ namespace LuaUnit return 0; } - int SetFaction(Eluna* E, Unit* unit) + int SetFaction(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 factionId = Eluna::CHECKVAL(E->L, 2); + uint32 factionId = Eluna::CHECKVAL(L, 2); unit->setFaction(factionId); return 0; } - int SetLevel(Eluna* E, Unit* unit) + int SetLevel(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 newLevel = Eluna::CHECKVAL(E->L, 2); + uint32 newLevel = Eluna::CHECKVAL(L, 2); unit->SetLevel(newLevel); return 0; } - int SetHealth(Eluna* E, Unit* unit) + int SetHealth(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 amt = Eluna::CHECKVAL(E->L, 2); + uint32 amt = Eluna::CHECKVAL(L, 2); unit->SetHealth(amt); return 0; } - int SetMaxHealth(Eluna* E, Unit* unit) + int SetMaxHealth(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 amt = Eluna::CHECKVAL(E->L, 2); + uint32 amt = Eluna::CHECKVAL(L, 2); unit->SetMaxHealth(amt); return 0; } - int SetPower(Eluna* E, Unit* unit) + int SetPower(Eluna* E, lua_State* L, Unit* unit) { - int type = Eluna::CHECKVAL(E->L, 2, -1); - uint32 amt = Eluna::CHECKVAL(E->L, 3); - Powers power = PowerSelectorHelper(E, unit, type); + int type = Eluna::CHECKVAL(L, 2, -1); + uint32 amt = Eluna::CHECKVAL(L, 3); + Powers power = PowerSelectorHelper(E, L, unit, type); unit->SetPower(power, amt); return 0; } - int SetMaxPower(Eluna* E, Unit* unit) + int SetMaxPower(Eluna* E, lua_State* L, Unit* unit) { - int type = Eluna::CHECKVAL(E->L, 2, -1); - uint32 amt = Eluna::CHECKVAL(E->L, 3); - Powers power = PowerSelectorHelper(E, unit, type); + int type = Eluna::CHECKVAL(L, 2, -1); + uint32 amt = Eluna::CHECKVAL(L, 3); + Powers power = PowerSelectorHelper(E, L, unit, type); unit->SetMaxPower(power, amt); return 0; } - int SetPowerType(Eluna* E, Unit* unit) + int SetPowerType(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 type = Eluna::CHECKVAL(E->L, 2); + uint32 type = Eluna::CHECKVAL(L, 2); if (type >= int(MAX_POWERS)) - return luaL_argerror(E->L, 2, "valid Powers expected"); + return luaL_argerror(L, 2, "valid Powers expected"); #ifdef TRINITY unit->setPowerType((Powers)type); @@ -1019,37 +1019,37 @@ namespace LuaUnit return 0; } - int SetDisplayId(Eluna* E, Unit* unit) + int SetDisplayId(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 model = Eluna::CHECKVAL(E->L, 2); + uint32 model = Eluna::CHECKVAL(L, 2); unit->SetDisplayId(model); return 0; } - int SetNativeDisplayId(Eluna* E, Unit* unit) + int SetNativeDisplayId(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 model = Eluna::CHECKVAL(E->L, 2); + uint32 model = Eluna::CHECKVAL(L, 2); unit->SetNativeDisplayId(model); return 0; } - int SetFacing(Eluna* E, Unit* unit) + int SetFacing(Eluna* /*E*/, lua_State* L, Unit* unit) { - float o = Eluna::CHECKVAL(E->L, 2); + float o = Eluna::CHECKVAL(L, 2); unit->SetFacingTo(o); return 0; } - int SetFacingToObject(Eluna* E, Unit* unit) + int SetFacingToObject(Eluna* /*E*/, lua_State* L, Unit* unit) { - WorldObject* obj = Eluna::CHECKOBJ(E->L, 2); + WorldObject* obj = Eluna::CHECKOBJ(L, 2); unit->SetFacingToObject(obj); return 0; } - int SetCreatorGUID(Eluna* E, Unit* unit) + int SetCreatorGUID(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint64 guid = Eluna::CHECKVAL(E->L, 2); + uint64 guid = Eluna::CHECKVAL(L, 2); #ifndef TRINITY unit->SetOwnerGuid(ObjectGuid(guid)); #else @@ -1058,9 +1058,9 @@ namespace LuaUnit return 0; } - int SetMinionGUID(Eluna* E, Unit* unit) + int SetMinionGUID(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint64 guid = Eluna::CHECKVAL(E->L, 2); + uint64 guid = Eluna::CHECKVAL(L, 2); #ifndef TRINITY unit->SetPetGuid(ObjectGuid(guid)); #else @@ -1069,9 +1069,9 @@ namespace LuaUnit return 0; } - int SetCharmerGUID(Eluna* E, Unit* unit) + int SetCharmerGUID(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint64 guid = Eluna::CHECKVAL(E->L, 2); + uint64 guid = Eluna::CHECKVAL(L, 2); #ifndef TRINITY unit->SetCharmerGuid(ObjectGuid(guid)); #else @@ -1080,9 +1080,9 @@ namespace LuaUnit return 0; } - int SetPetGUID(Eluna* E, Unit* unit) + int SetPetGUID(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint64 guid = Eluna::CHECKVAL(E->L, 2); + uint64 guid = Eluna::CHECKVAL(L, 2); #ifndef TRINITY unit->SetPetGuid(ObjectGuid(guid)); #else @@ -1091,9 +1091,9 @@ namespace LuaUnit return 0; } - int SetWaterWalk(Eluna* E, Unit* unit) + int SetWaterWalk(Eluna* /*E*/, lua_State* L, Unit* unit) { - bool enable = Eluna::CHECKVAL(E->L, 2, true); + bool enable = Eluna::CHECKVAL(L, 2, true); #ifndef TRINITY unit->SetWaterWalk(enable); #else @@ -1102,17 +1102,17 @@ namespace LuaUnit return 0; } - int SetStandState(Eluna* E, Unit* unit) + int SetStandState(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint8 state = Eluna::CHECKVAL(E->L, 2); + uint8 state = Eluna::CHECKVAL(L, 2); unit->SetStandState(state); return 0; } #if (!defined(TBC) && !defined(CLASSIC)) - int SetFFA(Eluna* E, Unit* unit) + int SetFFA(Eluna* /*E*/, lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(E->L, 2, true); + bool apply = Eluna::CHECKVAL(L, 2, true); #ifndef TRINITY unit->SetFFAPvP(apply); @@ -1133,9 +1133,9 @@ namespace LuaUnit return 0; } - int SetSanctuary(Eluna* E, Unit* unit) + int SetSanctuary(Eluna* /*E*/, lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(E->L, 2, true); + bool apply = Eluna::CHECKVAL(L, 2, true); if (apply) { @@ -1149,17 +1149,17 @@ namespace LuaUnit return 0; } - int SetPhaseMask(Eluna* E, Unit* unit) + int SetPhaseMask(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 phaseMask = Eluna::CHECKVAL(E->L, 2); - bool Update = Eluna::CHECKVAL(E->L, 3, true); + uint32 phaseMask = Eluna::CHECKVAL(L, 2); + bool Update = Eluna::CHECKVAL(L, 3, true); unit->SetPhaseMask(phaseMask, Update); return 0; } - int SetCritterGUID(Eluna* E, Unit* unit) + int SetCritterGUID(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint64 guid = Eluna::CHECKVAL(E->L, 2); + uint64 guid = Eluna::CHECKVAL(L, 2); #ifndef TRINITY unit->SetCritterGuid(ObjectGuid(guid)); #else @@ -1169,50 +1169,50 @@ namespace LuaUnit } #endif - /*int SetStunned(Eluna* E, Unit* unit) + /*int SetStunned(Eluna* E, lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(E->L, 2, true); + bool apply = Eluna::CHECKVAL(L, 2, true); unit->SetControlled(apply, UNIT_STATE_STUNNED); return 0; }*/ - /*int SetRooted(Eluna* E, Unit* unit) + /*int SetRooted(Eluna* E, lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(E->L, 2, true); + bool apply = Eluna::CHECKVAL(L, 2, true); unit->SetControlled(apply, UNIT_STATE_ROOT); return 0; }*/ - /*int SetConfused(Eluna* E, Unit* unit) + /*int SetConfused(Eluna* E, lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(E->L, 2, true); + bool apply = Eluna::CHECKVAL(L, 2, true); unit->SetControlled(apply, UNIT_STATE_CONFUSED); return 0; }*/ - /*int SetFeared(Eluna* E, Unit* unit) + /*int SetFeared(Eluna* E, lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(E->L, 2, true); + bool apply = Eluna::CHECKVAL(L, 2, true); unit->SetControlled(apply, UNIT_STATE_FLEEING); return 0; }*/ - /*int SetCanFly(Eluna* E, Unit* unit) + /*int SetCanFly(Eluna* E, lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(E->L, 2, true); + bool apply = Eluna::CHECKVAL(L, 2, true); unit->SetCanFly(apply); return 0; }*/ - /*int SetVisible(Eluna* E, Unit* unit) + /*int SetVisible(Eluna* E, lua_State* L, Unit* unit) { - bool x = Eluna::CHECKVAL(E->L, 2, true); + bool x = Eluna::CHECKVAL(L, 2, true); unit->SetVisible(x); return 0; }*/ /* OTHER */ - int ClearThreatList(Eluna* /*E*/, Unit* unit) + int ClearThreatList(Eluna* /*E*/, lua_State* L, Unit* unit) { #ifdef MANGOS unit->GetThreatManager().clearReferences(); @@ -1222,15 +1222,15 @@ namespace LuaUnit return 0; } - int Mount(Eluna* E, Unit* unit) + int Mount(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 displayId = Eluna::CHECKVAL(E->L, 2); + uint32 displayId = Eluna::CHECKVAL(L, 2); unit->Mount(displayId); return 0; } - int Dismount(Eluna* /*E*/, Unit* unit) + int Dismount(Eluna* /*E*/, lua_State* L, Unit* unit) { if (unit->IsMounted()) { @@ -1246,35 +1246,35 @@ namespace LuaUnit return 0; } - int Emote(Eluna* E, Unit* unit) + int Emote(Eluna* /*E*/, lua_State* L, Unit* unit) { - unit->HandleEmoteCommand(Eluna::CHECKVAL(E->L, 2)); + unit->HandleEmoteCommand(Eluna::CHECKVAL(L, 2)); return 0; } - int CountPctFromCurHealth(Eluna* E, Unit* unit) + int CountPctFromCurHealth(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->CountPctFromCurHealth(Eluna::CHECKVAL(E->L, 2))); + Eluna::Push(L, unit->CountPctFromCurHealth(Eluna::CHECKVAL(L, 2))); return 1; } - int CountPctFromMaxHealth(Eluna* E, Unit* unit) + int CountPctFromMaxHealth(Eluna* /*E*/, lua_State* L, Unit* unit) { - Eluna::Push(E->L, unit->CountPctFromMaxHealth(Eluna::CHECKVAL(E->L, 2))); + Eluna::Push(L, unit->CountPctFromMaxHealth(Eluna::CHECKVAL(L, 2))); return 1; } - int SendChatMessageToPlayer(Eluna* E, Unit* unit) + int SendChatMessageToPlayer(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint8 type = Eluna::CHECKVAL(E->L, 2); - uint32 lang = Eluna::CHECKVAL(E->L, 3); - std::string msg = Eluna::CHECKVAL(E->L, 4); - Player* target = Eluna::CHECKOBJ(E->L, 5); + uint8 type = Eluna::CHECKVAL(L, 2); + uint32 lang = Eluna::CHECKVAL(L, 3); + std::string msg = Eluna::CHECKVAL(L, 4); + Player* target = Eluna::CHECKOBJ(L, 5); if (type >= MAX_CHAT_MSG_TYPE) - return luaL_argerror(E->L, 2, "valid ChatMsg expected"); + return luaL_argerror(L, 2, "valid ChatMsg expected"); if (lang >= LANGUAGES_COUNT) - return luaL_argerror(E->L, 3, "valid Language expected"); + return luaL_argerror(L, 3, "valid Language expected"); WorldPacket data; #ifdef TRINITY @@ -1293,35 +1293,35 @@ namespace LuaUnit // unit->GetMotionMaster()->Clear(); // all // } - int MoveStop(Eluna* /*E*/, Unit* unit) + int MoveStop(Eluna* /*E*/, lua_State* L, Unit* unit) { unit->StopMoving(); return 0; } - int MoveExpire(Eluna* E, Unit* unit) + int MoveExpire(Eluna* /*E*/, lua_State* L, Unit* unit) { - bool reset = Eluna::CHECKVAL(E->L, 2, true); + bool reset = Eluna::CHECKVAL(L, 2, true); unit->GetMotionMaster()->MovementExpired(reset); return 0; } - int MoveClear(Eluna* E, Unit* unit) + int MoveClear(Eluna* /*E*/, lua_State* L, Unit* unit) { - bool reset = Eluna::CHECKVAL(E->L, 2, true); + bool reset = Eluna::CHECKVAL(L, 2, true); unit->GetMotionMaster()->Clear(reset); return 0; } - int MoveIdle(Eluna* /*E*/, Unit* unit) + int MoveIdle(Eluna* /*E*/, lua_State* L, Unit* unit) { unit->GetMotionMaster()->MoveIdle(); return 0; } - int MoveRandom(Eluna* E, Unit* unit) + int MoveRandom(Eluna* /*E*/, lua_State* L, Unit* unit) { - float radius = Eluna::CHECKVAL(E->L, 2); + float radius = Eluna::CHECKVAL(L, 2); float x, y, z; unit->GetPosition(x, y, z); #ifndef TRINITY @@ -1332,75 +1332,75 @@ namespace LuaUnit return 0; } - int MoveHome(Eluna* /*E*/, Unit* unit) + int MoveHome(Eluna* /*E*/, lua_State* L, Unit* unit) { unit->GetMotionMaster()->MoveTargetedHome(); return 0; } - int MoveFollow(Eluna* E, Unit* unit) + int MoveFollow(Eluna* /*E*/, lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(E->L, 2); - float dist = Eluna::CHECKVAL(E->L, 3, 0.0f); - float angle = Eluna::CHECKVAL(E->L, 4, 0.0f); + Unit* target = Eluna::CHECKOBJ(L, 2); + float dist = Eluna::CHECKVAL(L, 3, 0.0f); + float angle = Eluna::CHECKVAL(L, 4, 0.0f); unit->GetMotionMaster()->MoveFollow(target, dist, angle); return 0; } - int MoveChase(Eluna* E, Unit* unit) + int MoveChase(Eluna* /*E*/, lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(E->L, 2); - float dist = Eluna::CHECKVAL(E->L, 3, 0.0f); - float angle = Eluna::CHECKVAL(E->L, 4, 0.0f); + Unit* target = Eluna::CHECKOBJ(L, 2); + float dist = Eluna::CHECKVAL(L, 3, 0.0f); + float angle = Eluna::CHECKVAL(L, 4, 0.0f); unit->GetMotionMaster()->MoveChase(target, dist, angle); return 0; } - int MoveConfused(Eluna* /*E*/, Unit* unit) + int MoveConfused(Eluna* /*E*/, lua_State* L, Unit* unit) { unit->GetMotionMaster()->MoveConfused(); return 0; } - int MoveFleeing(Eluna* E, Unit* unit) + int MoveFleeing(Eluna* /*E*/, lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(E->L, 2); - uint32 time = Eluna::CHECKVAL(E->L, 3, 0); + Unit* target = Eluna::CHECKOBJ(L, 2); + uint32 time = Eluna::CHECKVAL(L, 3, 0); unit->GetMotionMaster()->MoveFleeing(target, time); return 0; } - int MoveTo(Eluna* E, Unit* unit) + int MoveTo(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 id = Eluna::CHECKVAL(E->L, 2); - float x = Eluna::CHECKVAL(E->L, 3); - float y = Eluna::CHECKVAL(E->L, 4); - float z = Eluna::CHECKVAL(E->L, 5); - bool genPath = Eluna::CHECKVAL(E->L, 6, true); + uint32 id = Eluna::CHECKVAL(L, 2); + float x = Eluna::CHECKVAL(L, 3); + float y = Eluna::CHECKVAL(L, 4); + float z = Eluna::CHECKVAL(L, 5); + bool genPath = Eluna::CHECKVAL(L, 6, true); unit->GetMotionMaster()->MovePoint(id, x, y, z, genPath); return 0; } #if (!defined(TBC) && !defined(CLASSIC)) - int MoveJump(Eluna* E, Unit* unit) + int MoveJump(Eluna* /*E*/, lua_State* L, Unit* unit) { - float x = Eluna::CHECKVAL(E->L, 2); - float y = Eluna::CHECKVAL(E->L, 3); - float z = Eluna::CHECKVAL(E->L, 4); - float zSpeed = Eluna::CHECKVAL(E->L, 5); - float maxHeight = Eluna::CHECKVAL(E->L, 6); - uint32 id = Eluna::CHECKVAL(E->L, 7, 0); + float x = Eluna::CHECKVAL(L, 2); + float y = Eluna::CHECKVAL(L, 3); + float z = Eluna::CHECKVAL(L, 4); + float zSpeed = Eluna::CHECKVAL(L, 5); + float maxHeight = Eluna::CHECKVAL(L, 6); + uint32 id = Eluna::CHECKVAL(L, 7, 0); unit->GetMotionMaster()->MoveJump(x, y, z, zSpeed, maxHeight, id); return 0; } #endif - int SendUnitWhisper(Eluna* E, Unit* unit) + int SendUnitWhisper(Eluna* /*E*/, lua_State* L, Unit* unit) { - const char* msg = Eluna::CHECKVAL(E->L, 2); - uint32 lang = Eluna::CHECKVAL(E->L, 3); - Player* receiver = Eluna::CHECKOBJ(E->L, 4); - bool bossWhisper = Eluna::CHECKVAL(E->L, 5, false); + const char* msg = Eluna::CHECKVAL(L, 2); + uint32 lang = Eluna::CHECKVAL(L, 3); + Player* receiver = Eluna::CHECKOBJ(L, 4); + bool bossWhisper = Eluna::CHECKVAL(L, 5, false); if (std::string(msg).length() > 0) #ifdef TRINITY unit->Whisper(msg, (Language)lang, receiver, bossWhisper); @@ -1410,11 +1410,11 @@ namespace LuaUnit return 0; } - int SendUnitEmote(Eluna* E, Unit* unit) + int SendUnitEmote(Eluna* /*E*/, lua_State* L, Unit* unit) { - const char* msg = Eluna::CHECKVAL(E->L, 2); - Unit* receiver = Eluna::CHECKOBJ(E->L, 3, false); - bool bossEmote = Eluna::CHECKVAL(E->L, 4, false); + const char* msg = Eluna::CHECKVAL(L, 2); + Unit* receiver = Eluna::CHECKOBJ(L, 3, false); + bool bossEmote = Eluna::CHECKVAL(L, 4, false); if (std::string(msg).length() > 0) #ifdef TRINITY unit->TextEmote(msg, receiver, bossEmote); @@ -1424,10 +1424,10 @@ namespace LuaUnit return 0; } - int SendUnitSay(Eluna* E, Unit* unit) + int SendUnitSay(Eluna* /*E*/, lua_State* L, Unit* unit) { - const char* msg = Eluna::CHECKVAL(E->L, 2); - uint32 language = Eluna::CHECKVAL(E->L, 3); + const char* msg = Eluna::CHECKVAL(L, 2); + uint32 language = Eluna::CHECKVAL(L, 3); if (std::string(msg).length() > 0) #ifdef TRINITY unit->Say(msg, (Language)language, unit); @@ -1437,10 +1437,10 @@ namespace LuaUnit return 0; } - int SendUnitYell(Eluna* E, Unit* unit) + int SendUnitYell(Eluna* /*E*/, lua_State* L, Unit* unit) { - const char* msg = Eluna::CHECKVAL(E->L, 2); - uint32 language = Eluna::CHECKVAL(E->L, 3); + const char* msg = Eluna::CHECKVAL(L, 2); + uint32 language = Eluna::CHECKVAL(L, 3); if (std::string(msg).length() > 0) #ifdef TRINITY unit->Yell(msg, (Language)language, unit); @@ -1450,17 +1450,17 @@ namespace LuaUnit return 0; } - int DeMorph(Eluna* /*E*/, Unit* unit) + int DeMorph(Eluna* /*E*/, lua_State* L, Unit* unit) { unit->DeMorph(); return 0; } - int CastSpell(Eluna* E, Unit* unit) + int CastSpell(Eluna* /*E*/, lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(E->L, 2); - uint32 spell = Eluna::CHECKVAL(E->L, 3); - bool triggered = Eluna::CHECKVAL(E->L, 4, false); + Unit* target = Eluna::CHECKOBJ(L, 2); + uint32 spell = Eluna::CHECKVAL(L, 3); + bool triggered = Eluna::CHECKVAL(L, 4, false); SpellEntry const* spellEntry = sSpellStore.LookupEntry(spell); if (!spellEntry) return 0; @@ -1482,52 +1482,52 @@ namespace LuaUnit * @param [Item] castItem = nil * @param uint64 originalCaster = 0 */ - int CastCustomSpell(Eluna* E, Unit* unit) + int CastCustomSpell(Eluna* /*E*/, lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(E->L, 2); - uint32 spell = Eluna::CHECKVAL(E->L, 3); - bool triggered = Eluna::CHECKVAL(E->L, 4, false); - bool has_bp0 = !lua_isnoneornil(E->L, 5); - int32 bp0 = Eluna::CHECKVAL(E->L, 5, 0); - bool has_bp1 = !lua_isnoneornil(E->L, 6); - int32 bp1 = Eluna::CHECKVAL(E->L, 6, 0); - bool has_bp2 = !lua_isnoneornil(E->L, 7); - int32 bp2 = Eluna::CHECKVAL(E->L, 7, 0); - Item* castItem = Eluna::CHECKOBJ(E->L, 8, false); - uint64 originalCaster = Eluna::CHECKVAL(E->L, 9, 0); + Unit* target = Eluna::CHECKOBJ(L, 2); + uint32 spell = Eluna::CHECKVAL(L, 3); + bool triggered = Eluna::CHECKVAL(L, 4, false); + bool has_bp0 = !lua_isnoneornil(L, 5); + int32 bp0 = Eluna::CHECKVAL(L, 5, 0); + bool has_bp1 = !lua_isnoneornil(L, 6); + int32 bp1 = Eluna::CHECKVAL(L, 6, 0); + bool has_bp2 = !lua_isnoneornil(L, 7); + int32 bp2 = Eluna::CHECKVAL(L, 7, 0); + Item* castItem = Eluna::CHECKOBJ(L, 8, false); + uint64 originalCaster = Eluna::CHECKVAL(L, 9, 0); unit->CastCustomSpell(target, spell, has_bp0 ? &bp0 : NULL, has_bp1 ? &bp1 : NULL, has_bp2 ? &bp2 : NULL, triggered, castItem, NULL, ObjectGuid(originalCaster)); return 0; } - int CastSpellAoF(Eluna* E, Unit* unit) + int CastSpellAoF(Eluna* /*E*/, lua_State* L, Unit* unit) { - float _x = Eluna::CHECKVAL(E->L, 2); - float _y = Eluna::CHECKVAL(E->L, 3); - float _z = Eluna::CHECKVAL(E->L, 4); - uint32 spell = Eluna::CHECKVAL(E->L, 5); - bool triggered = Eluna::CHECKVAL(E->L, 6, true); + float _x = Eluna::CHECKVAL(L, 2); + float _y = Eluna::CHECKVAL(L, 3); + float _z = Eluna::CHECKVAL(L, 4); + uint32 spell = Eluna::CHECKVAL(L, 5); + bool triggered = Eluna::CHECKVAL(L, 6, true); unit->CastSpell(_x, _y, _z, spell, triggered); return 0; } - int ClearInCombat(Eluna* /*E*/, Unit* unit) + int ClearInCombat(Eluna* /*E*/, lua_State* L, Unit* unit) { unit->ClearInCombat(); return 0; } - int StopSpellCast(Eluna* E, Unit* unit) + int StopSpellCast(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 spellId = Eluna::CHECKVAL(E->L, 2, 0); + uint32 spellId = Eluna::CHECKVAL(L, 2, 0); unit->CastStop(spellId); return 0; } - int InterruptSpell(Eluna* E, Unit* unit) + int InterruptSpell(Eluna* /*E*/, lua_State* L, Unit* unit) { - int spellType = Eluna::CHECKVAL(E->L, 2); - bool delayed = Eluna::CHECKVAL(E->L, 3, true); + int spellType = Eluna::CHECKVAL(L, 2); + bool delayed = Eluna::CHECKVAL(L, 3, true); switch (spellType) { case 0: @@ -1543,17 +1543,17 @@ namespace LuaUnit spellType = CURRENT_AUTOREPEAT_SPELL; break; default: - return luaL_argerror(E->L, 2, "valid CurrentSpellTypes expected"); + return luaL_argerror(L, 2, "valid CurrentSpellTypes expected"); } unit->InterruptSpell((CurrentSpellTypes)spellType, delayed); return 0; } - int AddAura(Eluna* E, Unit* unit) + int AddAura(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 spellId = Eluna::CHECKVAL(E->L, 2); - Unit* target = Eluna::CHECKOBJ(E->L, 3); + uint32 spellId = Eluna::CHECKVAL(L, 2); + Unit* target = Eluna::CHECKOBJ(L, 3); SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); if (!spellInfo) return 1; @@ -1577,30 +1577,30 @@ namespace LuaUnit holder->AddAura(aur, SpellEffIndex(i)); } } - Eluna::Push(E->L, target->AddSpellAuraHolder(holder)); + Eluna::Push(L, target->AddSpellAuraHolder(holder)); #else - Eluna::Push(E->L, unit->AddAura(spellId, target)); + Eluna::Push(L, unit->AddAura(spellId, target)); #endif return 1; } - int RemoveAura(Eluna* E, Unit* unit) + int RemoveAura(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 spellId = Eluna::CHECKVAL(E->L, 2); + uint32 spellId = Eluna::CHECKVAL(L, 2); unit->RemoveAurasDueToSpell(spellId); return 0; } - int RemoveAllAuras(Eluna* /*E*/, Unit* unit) + int RemoveAllAuras(Eluna* /*E*/, lua_State* L, Unit* unit) { unit->RemoveAllAuras(); return 0; } - int PlayDirectSound(Eluna* E, Unit* unit) + int PlayDirectSound(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 soundId = Eluna::CHECKVAL(E->L, 2); - Player* player = Eluna::CHECKOBJ(E->L, 3, false); + uint32 soundId = Eluna::CHECKVAL(L, 2); + Player* player = Eluna::CHECKOBJ(L, 3, false); if (!sSoundEntriesStore.LookupEntry(soundId)) return 0; @@ -1611,10 +1611,10 @@ namespace LuaUnit return 0; } - int PlayDistanceSound(Eluna* E, Unit* unit) + int PlayDistanceSound(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 soundId = Eluna::CHECKVAL(E->L, 2); - Player* player = Eluna::CHECKOBJ(E->L, 3, false); + uint32 soundId = Eluna::CHECKVAL(L, 2); + Player* player = Eluna::CHECKOBJ(L, 3, false); if (!sSoundEntriesStore.LookupEntry(soundId)) return 0; @@ -1625,9 +1625,9 @@ namespace LuaUnit return 0; } - int AddUnitState(Eluna* E, Unit* unit) + int AddUnitState(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 state = Eluna::CHECKVAL(E->L, 2); + uint32 state = Eluna::CHECKVAL(L, 2); #ifndef TRINITY unit->addUnitState(state); @@ -1637,9 +1637,9 @@ namespace LuaUnit return 0; } - int ClearUnitState(Eluna* E, Unit* unit) + int ClearUnitState(Eluna* /*E*/, lua_State* L, Unit* unit) { - uint32 state = Eluna::CHECKVAL(E->L, 2); + uint32 state = Eluna::CHECKVAL(L, 2); #ifndef TRINITY unit->clearUnitState(state); @@ -1649,12 +1649,12 @@ namespace LuaUnit return 0; } - int NearTeleport(Eluna* E, Unit* unit) + int NearTeleport(Eluna* /*E*/, lua_State* L, Unit* unit) { - float x = Eluna::CHECKVAL(E->L, 2); - float y = Eluna::CHECKVAL(E->L, 3); - float z = Eluna::CHECKVAL(E->L, 4); - float o = Eluna::CHECKVAL(E->L, 5); + float x = Eluna::CHECKVAL(L, 2); + float y = Eluna::CHECKVAL(L, 3); + float z = Eluna::CHECKVAL(L, 4); + float o = Eluna::CHECKVAL(L, 5); unit->NearTeleportTo(x, y, z, o); return 1; @@ -1683,15 +1683,15 @@ namespace LuaUnit * @param [SpellSchools] school = MAX_SPELL_SCHOOL : school the damage is done in or MAX_SPELL_SCHOOL for direct damage * @param uint32 spell = 0 : spell that inflicts the damage */ - int DealDamage(Eluna* E, Unit* unit) + int DealDamage(Eluna* /*E*/, lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(E->L, 2); - uint32 damage = Eluna::CHECKVAL(E->L, 3); - bool durabilityloss = Eluna::CHECKVAL(E->L, 4, true); - uint32 school = Eluna::CHECKVAL(E->L, 5, MAX_SPELL_SCHOOL); - uint32 spell = Eluna::CHECKVAL(E->L, 6, 0); + Unit* target = Eluna::CHECKOBJ(L, 2); + uint32 damage = Eluna::CHECKVAL(L, 3); + bool durabilityloss = Eluna::CHECKVAL(L, 4, true); + uint32 school = Eluna::CHECKVAL(L, 5, MAX_SPELL_SCHOOL); + uint32 spell = Eluna::CHECKVAL(L, 6, 0); if (school > MAX_SPELL_SCHOOL) - return luaL_argerror(E->L, 6, "valid SpellSchool expected"); + return luaL_argerror(L, 6, "valid SpellSchool expected"); // flat melee damage without resistence/etc reduction if (school == MAX_SPELL_SCHOOL) @@ -1754,12 +1754,12 @@ namespace LuaUnit * @param uint32 amount : amount to heal * @param bool critical = false : if true, heal is logged as critical */ - int DealHeal(Eluna* E, Unit* unit) + int DealHeal(Eluna* /*E*/, lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(E->L, 2); - uint32 spell = Eluna::CHECKVAL(E->L, 3); - uint32 amount = Eluna::CHECKVAL(E->L, 4); - bool critical = Eluna::CHECKVAL(E->L, 5, false); + Unit* target = Eluna::CHECKOBJ(L, 2); + uint32 spell = Eluna::CHECKVAL(L, 3); + uint32 amount = Eluna::CHECKVAL(L, 4); + bool critical = Eluna::CHECKVAL(L, 5, false); #ifndef TRINITY if (const SpellInfo* info = sSpellStore.LookupEntry(spell)) @@ -1777,10 +1777,10 @@ namespace LuaUnit * @param [Unit] target : [Unit] to kill * @param bool durLoss = true : when true, the target's items suffer durability loss */ - int Kill(Eluna* E, Unit* unit) + int Kill(Eluna* /*E*/, lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(E->L, 2); - bool durLoss = Eluna::CHECKVAL(E->L, 3, true); + Unit* target = Eluna::CHECKOBJ(L, 2); + bool durLoss = Eluna::CHECKVAL(L, 3, true); #ifndef TRINITY unit->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, durLoss); @@ -1812,16 +1812,16 @@ namespace LuaUnit * @param [SpellSchoolMask] schoolMask = 0 : [SpellSchoolMask] of the threat causer * @param uint32 spell = 0 : spell entry used for threat */ - int AddThreat(Eluna* E, Unit* unit) + int AddThreat(Eluna* /*E*/, lua_State* L, Unit* unit) { - Unit* victim = Eluna::CHECKOBJ(E->L, 2); - float threat = Eluna::CHECKVAL(E->L, 3, true); - uint32 schoolMask = Eluna::CHECKVAL(E->L, 3, 0); - uint32 spell = Eluna::CHECKVAL(E->L, 3, 0); + Unit* victim = Eluna::CHECKOBJ(L, 2); + float threat = Eluna::CHECKVAL(L, 3, true); + uint32 schoolMask = Eluna::CHECKVAL(L, 3, 0); + uint32 spell = Eluna::CHECKVAL(L, 3, 0); if (schoolMask > SPELL_SCHOOL_MASK_ALL) { - return luaL_argerror(E->L, 3, "valid SpellSchoolMask expected"); + return luaL_argerror(L, 3, "valid SpellSchoolMask expected"); } #ifdef TRINITY @@ -1832,33 +1832,33 @@ namespace LuaUnit return 0; } - /*int RestoreDisplayId(Eluna* E, Unit* unit) + /*int RestoreDisplayId(Eluna* E, lua_State* L, Unit* unit) { unit->RestoreDisplayId(); return 0; }*/ - /*int RestoreFaction(Eluna* E, Unit* unit) + /*int RestoreFaction(Eluna* E, lua_State* L, Unit* unit) { unit->RestoreFaction(); return 0; }*/ - /*int RemoveBindSightAuras(Eluna* E, Unit* unit) + /*int RemoveBindSightAuras(Eluna* E, lua_State* L, Unit* unit) { unit->RemoveBindSightAuras(); return 0; }*/ - /*int RemoveCharmAuras(Eluna* E, Unit* unit) + /*int RemoveCharmAuras(Eluna* E, lua_State* L, Unit* unit) { unit->RemoveCharmAuras(); return 0; }*/ - /*int DisableMelee(Eluna* E, Unit* unit) + /*int DisableMelee(Eluna* E, lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(E->L, 2, true); + bool apply = Eluna::CHECKVAL(L, 2, true); if (apply) unit->AddUnitState(UNIT_STATE_CANNOT_AUTOATTACK); @@ -1867,14 +1867,14 @@ namespace LuaUnit return 0; }*/ - /*int SummonGuardian(Eluna* E, Unit* unit) + /*int SummonGuardian(Eluna* E, lua_State* L, Unit* unit) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); - float x = Eluna::CHECKVAL(E->L, 3); - float y = Eluna::CHECKVAL(E->L, 4); - float z = Eluna::CHECKVAL(E->L, 5); - float o = Eluna::CHECKVAL(E->L, 6); - uint32 desp = Eluna::CHECKVAL(E->L, 7, 0); + uint32 entry = Eluna::CHECKVAL(L, 2); + float x = Eluna::CHECKVAL(L, 3); + float y = Eluna::CHECKVAL(L, 4); + float z = Eluna::CHECKVAL(L, 5); + float o = Eluna::CHECKVAL(L, 6); + uint32 desp = Eluna::CHECKVAL(L, 7, 0); SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(61); if (!properties) @@ -1903,7 +1903,7 @@ namespace LuaUnit } summon->AI()->EnterEvadeMode(); - Eluna::Push(E->L, summon); + Eluna::Push(L, summon); return 1; }*/ }; diff --git a/VehicleMethods.h b/VehicleMethods.h index 4091e1b..2ff01d4 100644 --- a/VehicleMethods.h +++ b/VehicleMethods.h @@ -12,50 +12,50 @@ namespace LuaVehicle { /* BOOLEAN */ - int IsOnBoard(Eluna* E, Vehicle* vehicle) + int IsOnBoard(Eluna* /*E*/, lua_State* L, Vehicle* vehicle) { - Unit* passenger = Eluna::CHECKOBJ(E->L, 2); + Unit* passenger = Eluna::CHECKOBJ(L, 2); #ifndef TRINITY - Eluna::Push(E->L, vehicle->HasOnBoard(passenger)); + Eluna::Push(L, vehicle->HasOnBoard(passenger)); #else - Eluna::Push(E->L, passenger->IsOnVehicle(vehicle->GetBase())); + Eluna::Push(L, passenger->IsOnVehicle(vehicle->GetBase())); #endif return 1; } /* GETTERS */ - int GetOwner(Eluna* E, Vehicle* vehicle) + int GetOwner(Eluna* /*E*/, lua_State* L, Vehicle* vehicle) { #ifndef TRINITY - Eluna::Push(E->L, vehicle->GetOwner()); + Eluna::Push(L, vehicle->GetOwner()); #else - Eluna::Push(E->L, vehicle->GetBase()); + Eluna::Push(L, vehicle->GetBase()); #endif return 1; } - int GetEntry(Eluna* E, Vehicle* vehicle) + int GetEntry(Eluna* /*E*/, lua_State* L, Vehicle* vehicle) { #ifndef TRINITY - Eluna::Push(E->L, vehicle->GetVehicleEntry()->m_ID); + Eluna::Push(L, vehicle->GetVehicleEntry()->m_ID); #else - Eluna::Push(E->L, vehicle->GetVehicleInfo()->m_ID); + Eluna::Push(L, vehicle->GetVehicleInfo()->m_ID); #endif return 1; } - int GetPassenger(Eluna* E, Vehicle* vehicle) + int GetPassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle) { - int8 seatId = Eluna::CHECKVAL(E->L, 2); - Eluna::Push(E->L, vehicle->GetPassenger(seatId)); + int8 seatId = Eluna::CHECKVAL(L, 2); + Eluna::Push(L, vehicle->GetPassenger(seatId)); return 1; } /* OTHER */ - int AddPassenger(Eluna* E, Vehicle* vehicle) + int AddPassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle) { - Unit* passenger = Eluna::CHECKOBJ(E->L, 2); - int8 seatId = Eluna::CHECKVAL(E->L, 3); + Unit* passenger = Eluna::CHECKOBJ(L, 2); + int8 seatId = Eluna::CHECKVAL(L, 3); #ifndef TRINITY if (vehicle->CanBoard(passenger)) vehicle->Board(passenger, seatId); @@ -65,9 +65,9 @@ namespace LuaVehicle return 0; } - int RemovePassenger(Eluna* E, Vehicle* vehicle) + int RemovePassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle) { - Unit* passenger = Eluna::CHECKOBJ(E->L, 2); + Unit* passenger = Eluna::CHECKOBJ(L, 2); #ifndef TRINITY vehicle->UnBoard(passenger, false); #else diff --git a/WeatherMethods.h b/WeatherMethods.h index df55dc9..f050dd1 100644 --- a/WeatherMethods.h +++ b/WeatherMethods.h @@ -14,9 +14,9 @@ namespace LuaWeather * * @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; } @@ -38,10 +38,10 @@ namespace LuaWeather * @param WeatherType type : the [WeatherType], see above available weather types * @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(E->L, 2); - float grade = Eluna::CHECKVAL(E->L, 3); + uint32 weatherType = Eluna::CHECKVAL(L, 2); + float grade = Eluna::CHECKVAL(L, 3); weather->SetWeather((WeatherType)weatherType, grade); return 0; @@ -52,9 +52,9 @@ namespace LuaWeather * * @param [Player] player */ - int SendWeatherUpdateToPlayer(Eluna* E, Weather* weather) + int SendWeatherUpdateToPlayer(Eluna* /*E*/, lua_State* L, Weather* weather) { - Player* player = Eluna::CHECKOBJ(E->L, 2); + Player* player = Eluna::CHECKOBJ(L, 2); weather->SendWeatherUpdateToPlayer(player); return 0; @@ -70,9 +70,9 @@ namespace LuaWeather * * @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; } @@ -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 */ - 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; } }; diff --git a/WorldObjectMethods.h b/WorldObjectMethods.h index 54e0fb8..1dd6ad9 100644 --- a/WorldObjectMethods.h +++ b/WorldObjectMethods.h @@ -14,9 +14,9 @@ namespace LuaWorldObject * * @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; } @@ -25,9 +25,9 @@ namespace LuaWorldObject * * @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; } @@ -37,9 +37,9 @@ namespace LuaWorldObject * * @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; } #endif @@ -49,9 +49,9 @@ namespace LuaWorldObject * * @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; } @@ -60,9 +60,9 @@ namespace LuaWorldObject * * @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; } @@ -71,9 +71,9 @@ namespace LuaWorldObject * * @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; } @@ -82,9 +82,9 @@ namespace LuaWorldObject * * @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; } @@ -93,9 +93,9 @@ namespace LuaWorldObject * * @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; } @@ -104,9 +104,9 @@ namespace LuaWorldObject * * @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; } @@ -115,9 +115,9 @@ namespace LuaWorldObject * * @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; } @@ -126,9 +126,9 @@ namespace LuaWorldObject * * @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; } @@ -140,12 +140,12 @@ namespace LuaWorldObject * @return float z : z coordinate (height) 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(E->L, obj->GetPositionY()); - Eluna::Push(E->L, obj->GetPositionZ()); - Eluna::Push(E->L, obj->GetOrientation()); + Eluna::Push(L, obj->GetPositionX()); + Eluna::Push(L, obj->GetPositionY()); + Eluna::Push(L, obj->GetPositionZ()); + Eluna::Push(L, obj->GetOrientation()); return 4; } @@ -156,9 +156,9 @@ namespace LuaWorldObject * * @return [Player] nearestPlayer */ - int GetNearestPlayer(Eluna* E, WorldObject* obj) + int GetNearestPlayer(Eluna* /*E*/, lua_State* L, WorldObject* obj) { - float range = Eluna::CHECKVAL(E->L, 2, SIZE_OF_GRIDS); + float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); Unit* target = NULL; ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_PLAYER); @@ -170,7 +170,7 @@ namespace LuaWorldObject obj->VisitNearbyObject(range, searcher); #endif - Eluna::Push(E->L, target); + Eluna::Push(L, target); return 1; } @@ -182,10 +182,10 @@ namespace LuaWorldObject * * @return [GameObject] nearestGameObject */ - int GetNearestGameObject(Eluna* E, WorldObject* obj) + int GetNearestGameObject(Eluna* /*E*/, lua_State* L, WorldObject* obj) { - float range = Eluna::CHECKVAL(E->L, 2, SIZE_OF_GRIDS); - uint32 entry = Eluna::CHECKVAL(E->L, 3, 0); + float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); + uint32 entry = Eluna::CHECKVAL(L, 3, 0); GameObject* target = NULL; ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_GAMEOBJECT, entry); @@ -197,7 +197,7 @@ namespace LuaWorldObject obj->VisitNearbyObject(range, searcher); #endif - Eluna::Push(E->L, target); + Eluna::Push(L, target); return 1; } @@ -209,10 +209,10 @@ namespace LuaWorldObject * * @return [Creature] nearestCreature */ - int GetNearestCreature(Eluna* E, WorldObject* obj) + int GetNearestCreature(Eluna* /*E*/, lua_State* L, WorldObject* obj) { - float range = Eluna::CHECKVAL(E->L, 2, SIZE_OF_GRIDS); - uint32 entry = Eluna::CHECKVAL(E->L, 3, 0); + float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); + uint32 entry = Eluna::CHECKVAL(L, 3, 0); Creature* target = NULL; ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_UNIT, entry); @@ -224,7 +224,7 @@ namespace LuaWorldObject obj->VisitNearbyObject(range, searcher); #endif - Eluna::Push(E->L, target); + Eluna::Push(L, target); return 1; } @@ -235,9 +235,9 @@ namespace LuaWorldObject * * @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(E->L, 2, SIZE_OF_GRIDS); + float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); std::list list; ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_PLAYER); @@ -249,18 +249,18 @@ namespace LuaWorldObject obj->VisitNearbyObject(range, searcher); #endif - lua_newtable(E->L); - int tbl = lua_gettop(E->L); + lua_newtable(L); + int tbl = lua_gettop(L); uint32 i = 0; for (std::list::const_iterator it = list.begin(); it != list.end(); ++it) { - Eluna::Push(E->L, ++i); - Eluna::Push(E->L, *it); - lua_settable(E->L, tbl); + Eluna::Push(L, ++i); + Eluna::Push(L, *it); + lua_settable(L, tbl); } - lua_settop(E->L, tbl); + lua_settop(L, tbl); return 1; } @@ -272,10 +272,10 @@ namespace LuaWorldObject * * @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(E->L, 2, SIZE_OF_GRIDS); - uint32 entry = Eluna::CHECKVAL(E->L, 3, 0); + float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); + uint32 entry = Eluna::CHECKVAL(L, 3, 0); std::list list; ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_UNIT, entry); @@ -287,18 +287,18 @@ namespace LuaWorldObject obj->VisitNearbyObject(range, searcher); #endif - lua_newtable(E->L); - int tbl = lua_gettop(E->L); + lua_newtable(L); + int tbl = lua_gettop(L); uint32 i = 0; for (std::list::const_iterator it = list.begin(); it != list.end(); ++it) { - Eluna::Push(E->L, ++i); - Eluna::Push(E->L, *it); - lua_settable(E->L, tbl); + Eluna::Push(L, ++i); + Eluna::Push(L, *it); + lua_settable(L, tbl); } - lua_settop(E->L, tbl); + lua_settop(L, tbl); return 1; } @@ -310,10 +310,10 @@ namespace LuaWorldObject * * @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(E->L, 2, SIZE_OF_GRIDS); - uint32 entry = Eluna::CHECKVAL(E->L, 3, 0); + float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); + uint32 entry = Eluna::CHECKVAL(L, 3, 0); std::list list; ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_GAMEOBJECT, entry); @@ -325,18 +325,18 @@ namespace LuaWorldObject obj->VisitNearbyObject(range, searcher); #endif - lua_newtable(E->L); - int tbl = lua_gettop(E->L); + lua_newtable(L); + int tbl = lua_gettop(L); uint32 i = 0; for (std::list::const_iterator it = list.begin(); it != list.end(); ++it) { - Eluna::Push(E->L, ++i); - Eluna::Push(E->L, *it); - lua_settable(E->L, tbl); + Eluna::Push(L, ++i); + Eluna::Push(L, *it); + lua_settable(L, tbl); } - lua_settop(E->L, tbl); + lua_settop(L, tbl); return 1; } @@ -351,12 +351,12 @@ namespace LuaWorldObject * * @return [WorldObject] worldObject */ - int GetNearObject(Eluna* E, WorldObject* obj) + int GetNearObject(Eluna* /*E*/, lua_State* L, WorldObject* obj) { - float range = Eluna::CHECKVAL(E->L, 2, SIZE_OF_GRIDS); - uint16 type = Eluna::CHECKVAL(E->L, 3, 0); // TypeMask - uint32 entry = Eluna::CHECKVAL(E->L, 4, 0); - uint32 hostile = Eluna::CHECKVAL(E->L, 5, 0); // 0 none, 1 hostile, 2 friendly + float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); + uint16 type = Eluna::CHECKVAL(L, 3, 0); // TypeMask + uint32 entry = Eluna::CHECKVAL(L, 4, 0); + uint32 hostile = Eluna::CHECKVAL(L, 5, 0); // 0 none, 1 hostile, 2 friendly float x, y, z; obj->GetPosition(x, y, z); @@ -371,7 +371,7 @@ namespace LuaWorldObject obj->VisitNearbyObject(range, searcher); #endif - Eluna::Push(E->L, target); + Eluna::Push(L, target); return 1; } @@ -386,12 +386,12 @@ namespace LuaWorldObject * * @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(E->L, 2, SIZE_OF_GRIDS); - uint16 type = Eluna::CHECKVAL(E->L, 3, 0); // TypeMask - uint32 entry = Eluna::CHECKVAL(E->L, 4, 0); - uint32 hostile = Eluna::CHECKVAL(E->L, 5, 0); // 0 none, 1 hostile, 2 friendly + float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); + uint16 type = Eluna::CHECKVAL(L, 3, 0); // TypeMask + uint32 entry = Eluna::CHECKVAL(L, 4, 0); + uint32 hostile = Eluna::CHECKVAL(L, 5, 0); // 0 none, 1 hostile, 2 friendly float x, y, z; obj->GetPosition(x, y, z); @@ -406,18 +406,18 @@ namespace LuaWorldObject obj->VisitNearbyObject(range, searcher); #endif - lua_newtable(E->L); - int tbl = lua_gettop(E->L); + lua_newtable(L); + int tbl = lua_gettop(L); uint32 i = 0; for (std::list::const_iterator it = list.begin(); it != list.end(); ++it) { - Eluna::Push(E->L, ++i); - Eluna::Push(E->L, *it); - lua_settable(E->L, tbl); + Eluna::Push(L, ++i); + Eluna::Push(L, *it); + lua_settable(L, tbl); } - lua_settop(E->L, tbl); + lua_settop(L, tbl); return 1; } @@ -434,17 +434,17 @@ namespace LuaWorldObject * * @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(E->L, 2, false); + WorldObject* target = Eluna::CHECKOBJ(L, 2, false); if (target && target->IsInWorld()) - Eluna::Push(E->L, obj->GetDistance(target)); + Eluna::Push(L, obj->GetDistance(target)); else { - float X = Eluna::CHECKVAL(E->L, 2); - float Y = Eluna::CHECKVAL(E->L, 3); - float Z = Eluna::CHECKVAL(E->L, 4); - Eluna::Push(E->L, obj->GetDistance(X, Y, Z)); + float X = Eluna::CHECKVAL(L, 2); + float Y = Eluna::CHECKVAL(L, 3); + float Z = Eluna::CHECKVAL(L, 4); + Eluna::Push(L, obj->GetDistance(X, Y, Z)); } return 1; } @@ -459,17 +459,17 @@ namespace LuaWorldObject * @return float y * @return float z */ - int GetRelativePoint(Eluna* E, WorldObject* obj) + int GetRelativePoint(Eluna* /*E*/, lua_State* L, WorldObject* obj) { - float dist = Eluna::CHECKVAL(E->L, 2); - float rad = Eluna::CHECKVAL(E->L, 3); + float dist = Eluna::CHECKVAL(L, 2); + float rad = Eluna::CHECKVAL(L, 3); float x, y, z; obj->GetClosePoint(x, y, z, 0.0f, dist, rad); - Eluna::Push(E->L, x); - Eluna::Push(E->L, y); - Eluna::Push(E->L, z); + Eluna::Push(L, x); + Eluna::Push(L, y); + Eluna::Push(L, z); return 3; } @@ -486,17 +486,17 @@ namespace LuaWorldObject * * @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(E->L, 2, false); + WorldObject* target = Eluna::CHECKOBJ(L, 2, false); if (target && target->IsInWorld()) - Eluna::Push(E->L, obj->GetAngle(target)); + Eluna::Push(L, obj->GetAngle(target)); else { - float x = Eluna::CHECKVAL(E->L, 2); - float y = Eluna::CHECKVAL(E->L, 3); - Eluna::Push(E->L, obj->GetAngle(x, y)); + float x = Eluna::CHECKVAL(L, 2); + float y = Eluna::CHECKVAL(L, 3); + Eluna::Push(L, obj->GetAngle(x, y)); } return 1; } @@ -506,9 +506,9 @@ namespace LuaWorldObject * * @param [WorldPacket] packet */ - int SendPacket(Eluna* E, WorldObject* obj) + int SendPacket(Eluna* /*E*/, lua_State* L, WorldObject* obj) { - WorldPacket* data = Eluna::CHECKOBJ(E->L, 2); + WorldPacket* data = Eluna::CHECKOBJ(L, 2); obj->SendMessageToSet(data, true); return 0; } @@ -524,18 +524,18 @@ namespace LuaWorldObject * @param uint32 respawnDelay = 30 : respawn time in seconds * @return [GameObject] gameObject */ - int SummonGameObject(Eluna* E, WorldObject* obj) + int SummonGameObject(Eluna* /*E*/, lua_State* L, WorldObject* obj) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); - float x = Eluna::CHECKVAL(E->L, 3); - float y = Eluna::CHECKVAL(E->L, 4); - float z = Eluna::CHECKVAL(E->L, 5); - float o = Eluna::CHECKVAL(E->L, 6); - uint32 respawnDelay = Eluna::CHECKVAL(E->L, 7, 30); + uint32 entry = Eluna::CHECKVAL(L, 2); + float x = Eluna::CHECKVAL(L, 3); + float y = Eluna::CHECKVAL(L, 4); + float z = Eluna::CHECKVAL(L, 5); + float o = Eluna::CHECKVAL(L, 6); + uint32 respawnDelay = Eluna::CHECKVAL(L, 7, 30); #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 - 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 return 1; } @@ -552,15 +552,15 @@ namespace LuaWorldObject * @param uint32 despawnTimer : despawn time in seconds * @return [Creature] spawnedCreature */ - int SpawnCreature(Eluna* E, WorldObject* obj) + int SpawnCreature(Eluna* /*E*/, lua_State* L, WorldObject* obj) { - uint32 entry = Eluna::CHECKVAL(E->L, 2); - float x = Eluna::CHECKVAL(E->L, 3); - float y = Eluna::CHECKVAL(E->L, 4); - float z = Eluna::CHECKVAL(E->L, 5); - float o = Eluna::CHECKVAL(E->L, 6); - uint32 spawnType = Eluna::CHECKVAL(E->L, 7, 8); - uint32 despawnTimer = Eluna::CHECKVAL(E->L, 8, 0); + uint32 entry = Eluna::CHECKVAL(L, 2); + float x = Eluna::CHECKVAL(L, 3); + float y = Eluna::CHECKVAL(L, 4); + float z = Eluna::CHECKVAL(L, 5); + float o = Eluna::CHECKVAL(L, 6); + uint32 spawnType = Eluna::CHECKVAL(L, 7, 8); + uint32 despawnTimer = Eluna::CHECKVAL(L, 8, 0); TempSummonType type; switch (spawnType) @@ -602,9 +602,9 @@ namespace LuaWorldObject break; #endif 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; } @@ -621,18 +621,18 @@ namespace LuaWorldObject * @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 */ - int RegisterEvent(Eluna* E, WorldObject* obj) + int RegisterEvent(Eluna* /*E*/, lua_State* L, WorldObject* obj) { - luaL_checktype(E->L, 2, LUA_TFUNCTION); - uint32 delay = Eluna::CHECKVAL(E->L, 3); - uint32 repeats = Eluna::CHECKVAL(E->L, 4); + luaL_checktype(L, 2, LUA_TFUNCTION); + uint32 delay = Eluna::CHECKVAL(L, 3); + uint32 repeats = Eluna::CHECKVAL(L, 4); - lua_pushvalue(E->L, 2); - int functionRef = luaL_ref(E->L, LUA_REGISTRYINDEX); + lua_pushvalue(L, 2); + int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef != LUA_REFNIL && functionRef != LUA_NOREF) { obj->elunaEvents->AddEvent(functionRef, delay, repeats); - Eluna::Push(E->L, functionRef); + Eluna::Push(L, functionRef); } return 1; } @@ -642,9 +642,9 @@ namespace LuaWorldObject * * @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(E->L, 2); + int eventId = Eluna::CHECKVAL(L, 2); obj->elunaEvents->RemoveEvent(eventId); return 0; } @@ -653,7 +653,7 @@ namespace LuaWorldObject * 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(); return 0; @@ -671,18 +671,18 @@ namespace LuaWorldObject * @param float z * @return bool isInLoS */ - int IsWithinLoS(Eluna* E, WorldObject* obj) + int IsWithinLoS(Eluna* /*E*/, lua_State* L, WorldObject* obj) { - WorldObject* target = Eluna::CHECKOBJ(E->L, 2, false); + WorldObject* target = Eluna::CHECKOBJ(L, 2, false); if (target) - Eluna::Push(E->L, obj->IsWithinLOSInMap(target)); + Eluna::Push(L, obj->IsWithinLOSInMap(target)); else { - float x = Eluna::CHECKVAL(E->L, 2); - float y = Eluna::CHECKVAL(E->L, 3); - float z = Eluna::CHECKVAL(E->L, 4); - Eluna::Push(E->L, obj->IsWithinLOS(x, y, z)); + float x = Eluna::CHECKVAL(L, 2); + float y = Eluna::CHECKVAL(L, 3); + float z = Eluna::CHECKVAL(L, 4); + Eluna::Push(L, obj->IsWithinLOS(x, y, z)); } return 1; diff --git a/WorldPacketMethods.h b/WorldPacketMethods.h index 4bc4650..f404d7a 100644 --- a/WorldPacketMethods.h +++ b/WorldPacketMethods.h @@ -14,9 +14,9 @@ namespace LuaPacket * * @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; } @@ -25,9 +25,9 @@ namespace LuaPacket * * @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; } @@ -36,11 +36,11 @@ namespace LuaPacket * * @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(E->L, 2); + uint32 opcode = Eluna::CHECKVAL(L, 2); 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); return 0; } @@ -50,11 +50,11 @@ namespace LuaPacket * * @return int8 value */ - int ReadByte(Eluna* E, WorldPacket* packet) + int ReadByte(Eluna* /*E*/, lua_State* L, WorldPacket* packet) { int8 _byte; (*packet) >> _byte; - Eluna::Push(E->L, _byte); + Eluna::Push(L, _byte); return 1; } @@ -63,11 +63,11 @@ namespace LuaPacket * * @return uint8 value */ - int ReadUByte(Eluna* E, WorldPacket* packet) + int ReadUByte(Eluna* /*E*/, lua_State* L, WorldPacket* packet) { uint8 _ubyte; (*packet) >> _ubyte; - Eluna::Push(E->L, _ubyte); + Eluna::Push(L, _ubyte); return 1; } @@ -76,11 +76,11 @@ namespace LuaPacket * * @return int16 value */ - int ReadShort(Eluna* E, WorldPacket* packet) + int ReadShort(Eluna* /*E*/, lua_State* L, WorldPacket* packet) { int16 _short; (*packet) >> _short; - Eluna::Push(E->L, _short); + Eluna::Push(L, _short); return 1; } @@ -89,11 +89,11 @@ namespace LuaPacket * * @return uint16 value */ - int ReadUShort(Eluna* E, WorldPacket* packet) + int ReadUShort(Eluna* /*E*/, lua_State* L, WorldPacket* packet) { uint16 _ushort; (*packet) >> _ushort; - Eluna::Push(E->L, _ushort); + Eluna::Push(L, _ushort); return 1; } @@ -102,11 +102,11 @@ namespace LuaPacket * * @return int32 value */ - int ReadLong(Eluna* E, WorldPacket* packet) + int ReadLong(Eluna* /*E*/, lua_State* L, WorldPacket* packet) { int32 _long; (*packet) >> _long; - Eluna::Push(E->L, _long); + Eluna::Push(L, _long); return 1; } @@ -115,11 +115,11 @@ namespace LuaPacket * * @return uint32 value */ - int ReadULong(Eluna* E, WorldPacket* packet) + int ReadULong(Eluna* /*E*/, lua_State* L, WorldPacket* packet) { uint32 _ulong; (*packet) >> _ulong; - Eluna::Push(E->L, _ulong); + Eluna::Push(L, _ulong); return 1; } @@ -128,11 +128,11 @@ namespace LuaPacket * * @return float value */ - int ReadFloat(Eluna* E, WorldPacket* packet) + int ReadFloat(Eluna* /*E*/, lua_State* L, WorldPacket* packet) { float _val; (*packet) >> _val; - Eluna::Push(E->L, _val); + Eluna::Push(L, _val); return 1; } @@ -141,11 +141,11 @@ namespace LuaPacket * * @return double value */ - int ReadDouble(Eluna* E, WorldPacket* packet) + int ReadDouble(Eluna* /*E*/, lua_State* L, WorldPacket* packet) { double _val; (*packet) >> _val; - Eluna::Push(E->L, _val); + Eluna::Push(L, _val); return 1; } @@ -154,11 +154,11 @@ namespace LuaPacket * * @return uint64 value : value returned as string */ - int ReadGUID(Eluna* E, WorldPacket* packet) + int ReadGUID(Eluna* /*E*/, lua_State* L, WorldPacket* packet) { uint64 guid; (*packet) >> guid; - Eluna::Push(E->L, guid); + Eluna::Push(L, guid); return 1; } @@ -167,11 +167,11 @@ namespace LuaPacket * * @return string value */ - int ReadString(Eluna* E, WorldPacket* packet) + int ReadString(Eluna* /*E*/, lua_State* L, WorldPacket* packet) { std::string _val; (*packet) >> _val; - Eluna::Push(E->L, _val); + Eluna::Push(L, _val); return 1; } @@ -180,9 +180,9 @@ namespace LuaPacket * * @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(E->L, 2); + uint64 guid = Eluna::CHECKVAL(L, 2); (*packet) << guid; return 0; } @@ -192,9 +192,9 @@ namespace LuaPacket * * @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(E->L, 2); + std::string _val = Eluna::CHECKVAL(L, 2); (*packet) << _val; return 0; } @@ -204,9 +204,9 @@ namespace LuaPacket * * @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(E->L, 2); + int8 byte = Eluna::CHECKVAL(L, 2); (*packet) << byte; return 0; } @@ -216,9 +216,9 @@ namespace LuaPacket * * @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(E->L, 2); + uint8 byte = Eluna::CHECKVAL(L, 2); (*packet) << byte; return 0; } @@ -228,9 +228,9 @@ namespace LuaPacket * * @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(E->L, 2); + int16 _short = Eluna::CHECKVAL(L, 2); (*packet) << _short; return 0; } @@ -240,9 +240,9 @@ namespace LuaPacket * * @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(E->L, 2); + uint16 _ushort = Eluna::CHECKVAL(L, 2); (*packet) << _ushort; return 0; } @@ -252,9 +252,9 @@ namespace LuaPacket * * @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(E->L, 2); + int32 _long = Eluna::CHECKVAL(L, 2); (*packet) << _long; return 0; } @@ -264,9 +264,9 @@ namespace LuaPacket * * @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(E->L, 2); + uint32 _ulong = Eluna::CHECKVAL(L, 2); (*packet) << _ulong; return 0; } @@ -276,9 +276,9 @@ namespace LuaPacket * * @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(E->L, 2); + float _val = Eluna::CHECKVAL(L, 2); (*packet) << _val; return 0; } @@ -288,9 +288,9 @@ namespace LuaPacket * * @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(E->L, 2); + double _val = Eluna::CHECKVAL(L, 2); (*packet) << _val; return 0; }