Change Eluna to a global variable

Remove Eluna* from being passed. You can now get it through Eluna::GetEluna(L)
Change function call cleanup to lua_settop instead of manual loop
Explicitly delete the copy constructor and copy assignment operators
This commit is contained in:
Rochet2
2017-03-19 15:48:48 +02:00
parent 8d3433f4b5
commit b7c379a42c
23 changed files with 990 additions and 976 deletions

View File

@@ -26,7 +26,7 @@ namespace LuaAura
*
* @return [Unit] caster
*/
int GetCaster(Eluna* /*E*/, lua_State* L, Aura* aura)
int GetCaster(lua_State* L, Aura* aura)
{
Eluna::Push(L, aura->GetCaster());
return 1;
@@ -37,7 +37,7 @@ namespace LuaAura
*
* @return string caster_guid : the GUID of the Unit as a decimal string
*/
int GetCasterGUID(Eluna* /*E*/, lua_State* L, Aura* aura)
int GetCasterGUID(lua_State* L, Aura* aura)
{
#ifndef TRINITY
Eluna::Push(L, aura->GetCasterGuid());
@@ -52,7 +52,7 @@ namespace LuaAura
*
* @return uint32 caster_level
*/
int GetCasterLevel(Eluna* /*E*/, lua_State* L, Aura* aura)
int GetCasterLevel(lua_State* L, Aura* aura)
{
Eluna::Push(L, aura->GetCaster()->getLevel());
return 1;
@@ -63,7 +63,7 @@ namespace LuaAura
*
* @return int32 duration : amount of time left in milliseconds
*/
int GetDuration(Eluna* /*E*/, lua_State* L, Aura* aura)
int GetDuration(lua_State* L, Aura* aura)
{
#ifndef TRINITY
Eluna::Push(L, aura->GetAuraDuration());
@@ -78,7 +78,7 @@ namespace LuaAura
*
* @return uint32 aura_id
*/
int GetAuraId(Eluna* /*E*/, lua_State* L, Aura* aura)
int GetAuraId(lua_State* L, Aura* aura)
{
Eluna::Push(L, aura->GetId());
return 1;
@@ -92,7 +92,7 @@ namespace LuaAura
*
* @return int32 max_duration : the maximum duration of the Aura, in milliseconds
*/
int GetMaxDuration(Eluna* /*E*/, lua_State* L, Aura* aura)
int GetMaxDuration(lua_State* L, Aura* aura)
{
#ifndef TRINITY
Eluna::Push(L, aura->GetAuraMaxDuration());
@@ -109,7 +109,7 @@ namespace LuaAura
*
* @return uint32 stack_amount
*/
int GetStackAmount(Eluna* /*E*/, lua_State* L, Aura* aura)
int GetStackAmount(lua_State* L, Aura* aura)
{
Eluna::Push(L, aura->GetStackAmount());
return 1;
@@ -120,7 +120,7 @@ namespace LuaAura
*
* @return [Unit] owner
*/
int GetOwner(Eluna* /*E*/, lua_State* L, Aura* aura)
int GetOwner(lua_State* L, Aura* aura)
{
#ifndef TRINITY
Eluna::Push(L, aura->GetTarget());
@@ -135,7 +135,7 @@ namespace LuaAura
*
* @param int32 duration : the new duration of the Aura, in milliseconds
*/
int SetDuration(Eluna* /*E*/, lua_State* L, Aura* aura)
int SetDuration(lua_State* L, Aura* aura)
{
int32 duration = Eluna::CHECKVAL<int32>(L, 2);
#ifndef TRINITY
@@ -159,7 +159,7 @@ namespace LuaAura
*
* @param int32 duration : the new maximum duration of the Aura, in milliseconds
*/
int SetMaxDuration(Eluna* /*E*/, lua_State* L, Aura* aura)
int SetMaxDuration(lua_State* L, Aura* aura)
{
int32 duration = Eluna::CHECKVAL<int32>(L, 2);
#ifndef TRINITY
@@ -183,7 +183,7 @@ namespace LuaAura
*
* @param uint32 amount
*/
int SetStackAmount(Eluna* /*E*/, lua_State* L, Aura* aura)
int SetStackAmount(lua_State* L, Aura* aura)
{
uint8 amount = Eluna::CHECKVAL<uint8>(L, 2);
#ifndef TRINITY
@@ -197,7 +197,7 @@ namespace LuaAura
/**
* Remove this [Aura] from the [Unit] it is applied to.
*/
int Remove(Eluna* /*E*/, lua_State* L, Aura* aura)
int Remove(lua_State* L, Aura* aura)
{
#ifndef TRINITY
aura->GetTarget()->RemoveSpellAuraHolder(aura->GetHolder(), AURA_REMOVE_BY_CANCEL);

View File

@@ -19,7 +19,7 @@ namespace LuaBattleGround
*
* @return string name
*/
int GetName(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetName(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetName());
return 1;
@@ -31,7 +31,7 @@ namespace LuaBattleGround
* @param [Team] team : team ID
* @return uint32 count
*/
int GetAlivePlayersCountByTeam(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetAlivePlayersCountByTeam(lua_State* L, BattleGround* bg)
{
uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
@@ -44,7 +44,7 @@ namespace LuaBattleGround
*
* @return [Map] map
*/
int GetMap(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetMap(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetBgMap());
return 1;
@@ -56,7 +56,7 @@ namespace LuaBattleGround
* @param uint32 kills : amount of kills
* @return uint32 bonusHonor
*/
int GetBonusHonorFromKillCount(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetBonusHonorFromKillCount(lua_State* L, BattleGround* bg)
{
uint32 kills = Eluna::CHECKVAL<uint32>(L, 2);
@@ -69,7 +69,7 @@ namespace LuaBattleGround
*
* @return [BattleGroundBracketId] bracketId
*/
int GetBracketId(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetBracketId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetBracketId());
return 1;
@@ -80,7 +80,7 @@ namespace LuaBattleGround
*
* @return uint32 endTime
*/
int GetEndTime(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetEndTime(lua_State* L, BattleGround* bg)
{
#ifdef CATA
Eluna::Push(L, bg->GetRemainingTime());
@@ -96,7 +96,7 @@ namespace LuaBattleGround
* @param [Team] team : team ID
* @return uint32 freeSlots
*/
int GetFreeSlotsForTeam(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetFreeSlotsForTeam(lua_State* L, BattleGround* bg)
{
uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
@@ -109,7 +109,7 @@ namespace LuaBattleGround
*
* @return uint32 instanceId
*/
int GetInstanceId(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetInstanceId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetInstanceID());
return 1;
@@ -120,7 +120,7 @@ namespace LuaBattleGround
*
* @return uint32 mapId
*/
int GetMapId(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetMapId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMapId());
return 1;
@@ -131,7 +131,7 @@ namespace LuaBattleGround
*
* @return [BattleGroundTypeId] typeId
*/
int GetTypeId(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetTypeId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetTypeID());
return 1;
@@ -142,7 +142,7 @@ namespace LuaBattleGround
*
* @return uint32 maxLevel
*/
int GetMaxLevel(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetMaxLevel(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMaxLevel());
return 1;
@@ -153,7 +153,7 @@ namespace LuaBattleGround
*
* @return uint32 minLevel
*/
int GetMinLevel(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetMinLevel(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMinLevel());
return 1;
@@ -164,7 +164,7 @@ namespace LuaBattleGround
*
* @return uint32 maxPlayerCount
*/
int GetMaxPlayers(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetMaxPlayers(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMaxPlayers());
return 1;
@@ -175,7 +175,7 @@ namespace LuaBattleGround
*
* @return uint32 minPlayerCount
*/
int GetMinPlayers(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetMinPlayers(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMinPlayers());
return 1;
@@ -186,7 +186,7 @@ namespace LuaBattleGround
*
* @return uint32 maxTeamPlayerCount
*/
int GetMaxPlayersPerTeam(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetMaxPlayersPerTeam(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMaxPlayersPerTeam());
return 1;
@@ -197,7 +197,7 @@ namespace LuaBattleGround
*
* @return uint32 minTeamPlayerCount
*/
int GetMinPlayersPerTeam(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetMinPlayersPerTeam(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMinPlayersPerTeam());
return 1;
@@ -208,7 +208,7 @@ namespace LuaBattleGround
*
* @return [Team] team
*/
int GetWinner(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetWinner(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetWinner());
return 1;
@@ -219,7 +219,7 @@ namespace LuaBattleGround
*
* @return [BattleGroundStatus] status
*/
int GetStatus(Eluna* /*E*/, lua_State* L, BattleGround* bg)
int GetStatus(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetStatus());
return 1;

View File

@@ -19,7 +19,7 @@ namespace LuaCorpse
*
* @return uint64 ownerGUID
*/
int GetOwnerGUID(Eluna* /*E*/, lua_State* L, Corpse* corpse)
int GetOwnerGUID(lua_State* L, Corpse* corpse)
{
#ifndef TRINITY
Eluna::Push(L, corpse->GetOwnerGuid());
@@ -34,7 +34,7 @@ namespace LuaCorpse
*
* @return uint32 ghostTime
*/
int GetGhostTime(Eluna* /*E*/, lua_State* L, Corpse* corpse)
int GetGhostTime(lua_State* L, Corpse* corpse)
{
Eluna::Push(L, corpse->GetGhostTime());
return 1;
@@ -52,7 +52,7 @@ namespace LuaCorpse
*
* @return [CorpseType] corpseType
*/
int GetType(Eluna* /*E*/, lua_State* L, Corpse* corpse)
int GetType(lua_State* L, Corpse* corpse)
{
Eluna::Push(L, corpse->GetType());
return 1;
@@ -63,7 +63,7 @@ namespace LuaCorpse
*
* See [Corpse:GetGhostTime].
*/
int ResetGhostTime(Eluna* /*E*/, lua_State* /*L*/, Corpse* corpse)
int ResetGhostTime(lua_State* /*L*/, Corpse* corpse)
{
corpse->ResetGhostTime();
return 0;
@@ -72,7 +72,7 @@ namespace LuaCorpse
/**
* Saves the [Corpse] to the database.
*/
int SaveToDB(Eluna* /*E*/, lua_State* /*L*/, Corpse* corpse)
int SaveToDB(lua_State* /*L*/, Corpse* corpse)
{
corpse->SaveToDB();
return 0;

View File

@@ -20,7 +20,7 @@ namespace LuaCreature
*
* @return bool reputationDisabled
*/
int IsReputationGainDisabled(Eluna* /*E*/, lua_State* L, Creature* creature)
int IsReputationGainDisabled(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->IsReputationGainDisabled());
return 1;
@@ -32,7 +32,7 @@ namespace LuaCreature
*
* @return bool regeneratesHealth
*/
int CanRegenerateHealth(Eluna* /*E*/, lua_State* L, Creature* creature)
int CanRegenerateHealth(lua_State* L, Creature* creature)
{
#ifndef TRINITY
Eluna::Push(L, creature->IsRegeneratingHealth());
@@ -49,7 +49,7 @@ namespace LuaCreature
* @param uint32 questID : the ID of a [Quest]
* @return bool completesQuest
*/
int CanCompleteQuest(Eluna* /*E*/, lua_State* L, Creature* creature)
int CanCompleteQuest(lua_State* L, Creature* creature)
{
uint32 quest_id = Eluna::CHECKVAL<uint32>(L, 2);
@@ -68,7 +68,7 @@ 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*/, lua_State* L, Creature* creature)
int IsTargetableForAttack(lua_State* L, Creature* creature)
{
bool mustBeDead = Eluna::CHECKVAL<bool>(L, 2, false);
@@ -89,7 +89,7 @@ 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*/, lua_State* L, Creature* creature)
int CanAssistTo(lua_State* L, Creature* creature)
{
Unit* u = Eluna::CHECKOBJ<Unit>(L, 2);
Unit* enemy = Eluna::CHECKOBJ<Unit>(L, 3);
@@ -105,7 +105,7 @@ namespace LuaCreature
*
* @return bool searchedForAssistance
*/
int HasSearchedAssistance(Eluna* /*E*/, lua_State* L, Creature* creature)
int HasSearchedAssistance(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->HasSearchedAssistance());
return 1;
@@ -117,7 +117,7 @@ namespace LuaCreature
*
* @return bool tapped
*/
int IsTappedBy(Eluna* /*E*/, lua_State* L, Creature* creature)
int IsTappedBy(lua_State* L, Creature* creature)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
@@ -135,7 +135,7 @@ namespace LuaCreature
*
* @return bool hasLootRecipient
*/
int HasLootRecipient(Eluna* /*E*/, lua_State* L, Creature* creature)
int HasLootRecipient(lua_State* L, Creature* creature)
{
#ifndef TRINITY
Eluna::Push(L, creature->HasLootRecipient());
@@ -151,7 +151,7 @@ namespace LuaCreature
*
* @return bool canAggro
*/
int CanAggro(Eluna* /*E*/, lua_State* L, Creature* creature)
int CanAggro(lua_State* L, Creature* creature)
{
#ifdef TRINITY
Eluna::Push(L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC));
@@ -168,7 +168,7 @@ namespace LuaCreature
*
* @return bool canSwim
*/
int CanSwim(Eluna* /*E*/, lua_State* L, Creature* creature)
int CanSwim(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->CanSwim());
return 1;
@@ -180,7 +180,7 @@ namespace LuaCreature
*
* @return bool canWalk
*/
int CanWalk(Eluna* /*E*/, lua_State* L, Creature* creature)
int CanWalk(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->CanWalk());
return 1;
@@ -192,7 +192,7 @@ namespace LuaCreature
*
* @return bool inEvadeMode
*/
int IsInEvadeMode(Eluna* /*E*/, lua_State* L, Creature* creature)
int IsInEvadeMode(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->IsInEvadeMode());
return 1;
@@ -204,7 +204,7 @@ namespace LuaCreature
*
* @return bool isElite
*/
int IsElite(Eluna* /*E*/, lua_State* L, Creature* creature)
int IsElite(lua_State* L, Creature* creature)
{
#ifndef TRINITY
Eluna::Push(L, creature->IsElite());
@@ -220,7 +220,7 @@ namespace LuaCreature
*
* @return bool isGuard
*/
int IsGuard(Eluna* /*E*/, lua_State* L, Creature* creature)
int IsGuard(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->IsGuard());
return 1;
@@ -232,7 +232,7 @@ namespace LuaCreature
*
* @return bool isCivilian
*/
int IsCivilian(Eluna* /*E*/, lua_State* L, Creature* creature)
int IsCivilian(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->IsCivilian());
return 1;
@@ -244,7 +244,7 @@ namespace LuaCreature
*
* @return bool isLeader
*/
int IsRacialLeader(Eluna* /*E*/, lua_State* L, Creature* creature)
int IsRacialLeader(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->IsRacialLeader());
return 1;
@@ -256,7 +256,7 @@ namespace LuaCreature
*
* @return bool isWorldBoss
*/
int IsWorldBoss(Eluna* /*E*/, lua_State* L, Creature* creature)
int IsWorldBoss(lua_State* L, Creature* creature)
{
#ifndef TRINITY
Eluna::Push(L, creature->IsWorldBoss());
@@ -273,7 +273,7 @@ namespace LuaCreature
* @param uint32 spellId : the ID of a [Spell]
* @return bool hasCooldown
*/
int HasCategoryCooldown(Eluna* /*E*/, lua_State* L, Creature* creature)
int HasCategoryCooldown(lua_State* L, Creature* creature)
{
uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
@@ -295,7 +295,7 @@ namespace LuaCreature
* @param uint32 spellId : the ID of a [Spell]
* @return bool hasSpell
*/
int HasSpell(Eluna* /*E*/, lua_State* L, Creature* creature)
int HasSpell(lua_State* L, Creature* creature)
{
uint32 id = Eluna::CHECKVAL<uint32>(L, 2);
@@ -310,7 +310,7 @@ namespace LuaCreature
* @param uint32 questId : the ID of a [Quest]
* @return bool hasQuest
*/
int HasQuest(Eluna* /*E*/, lua_State* L, Creature* creature)
int HasQuest(lua_State* L, Creature* creature)
{
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
@@ -329,7 +329,7 @@ namespace LuaCreature
* @param uint32 spellId : the ID of a [Spell]
* @return bool hasCooldown
*/
int HasSpellCooldown(Eluna* /*E*/, lua_State* L, Creature* creature)
int HasSpellCooldown(lua_State* L, Creature* creature)
{
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
@@ -347,7 +347,7 @@ namespace LuaCreature
*
* @return bool canFly
*/
int CanFly(Eluna* /*E*/, lua_State* L, Creature* creature)
int CanFly(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->CanFly());
return 1;
@@ -360,7 +360,7 @@ namespace LuaCreature
*
* @return bool canFly
*/
int IsTrigger(Eluna* /*E*/, lua_State* L, Creature* creature)
int IsTrigger(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->IsTrigger());
return 1;
@@ -371,7 +371,7 @@ namespace LuaCreature
*
* @return bool isDamagedEnough
*/
int IsDamageEnoughForLootingAndReward(Eluna* /*E*/, lua_State* L, Creature* creature)
int IsDamageEnoughForLootingAndReward(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->IsDamageEnoughForLootingAndReward());
return 1;
@@ -385,7 +385,7 @@ namespace LuaCreature
* @param [Unit] target
* @param bool force = true : force [Creature] to attack
*/
int CanStartAttack(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement core side
int CanStartAttack(lua_State* L, Creature* creature) // TODO: Implement core side
{
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
bool force = Eluna::CHECKVAL<bool>(L, 3, true);
@@ -400,7 +400,7 @@ namespace LuaCreature
* @param uint16 lootMode
* @return bool hasLootMode
*/
int HasLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
int HasLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
{
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
@@ -417,7 +417,7 @@ namespace LuaCreature
*
* @return uint32 respawnDelay : the respawn delay, in seconds
*/
int GetRespawnDelay(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetRespawnDelay(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->GetRespawnDelay());
return 1;
@@ -429,7 +429,7 @@ namespace LuaCreature
*
* @return float wanderRadius
*/
int GetWanderRadius(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetWanderRadius(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->GetRespawnRadius());
return 1;
@@ -441,7 +441,7 @@ namespace LuaCreature
*
* @return uint32 pathId
*/
int GetWaypointPath(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetWaypointPath(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->GetWaypointPath());
return 1;
@@ -453,7 +453,7 @@ namespace LuaCreature
*
* @return uint32 wpId
*/
int GetCurrentWaypointId(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetCurrentWaypointId(lua_State* L, Creature* creature)
{
#ifdef TRINITY
Eluna::Push(L, creature->GetCurrentWaypointID());
@@ -468,7 +468,7 @@ namespace LuaCreature
*
* @return [MovementGeneratorType] defaultMovementType
*/
int GetDefaultMovementType(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetDefaultMovementType(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->GetDefaultMovementType());
return 1;
@@ -480,7 +480,7 @@ namespace LuaCreature
* @param [Unit] target
* @return float aggroRange
*/
int GetAggroRange(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetAggroRange(lua_State* L, Creature* creature)
{
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
@@ -503,7 +503,7 @@ namespace LuaCreature
* @param [Unit] target
* @return float attackDistance
*/
int GetAttackDistance(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetAttackDistance(lua_State* L, Creature* creature)
{
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
@@ -516,7 +516,7 @@ namespace LuaCreature
*
* @return [Group] lootRecipientGroup : the group or `nil`
*/
int GetLootRecipientGroup(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetLootRecipientGroup(lua_State* L, Creature* creature)
{
#ifndef TRINITY
Eluna::Push(L, creature->GetGroupLootRecipient());
@@ -531,7 +531,7 @@ namespace LuaCreature
*
* @return [Player] lootRecipient : the player or `nil`
*/
int GetLootRecipient(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetLootRecipient(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->GetLootRecipient());
return 1;
@@ -546,7 +546,7 @@ namespace LuaCreature
*
* @return string scriptName
*/
int GetScriptName(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetScriptName(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->GetScriptName());
return 1;
@@ -561,7 +561,7 @@ namespace LuaCreature
*
* @return string AIName
*/
int GetAIName(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetAIName(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->GetAIName());
return 1;
@@ -575,7 +575,7 @@ namespace LuaCreature
*
* @return uint32 scriptID
*/
int GetScriptId(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetScriptId(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->GetScriptId());
return 1;
@@ -587,7 +587,7 @@ namespace LuaCreature
* @param uint32 spellID
* @return uint32 cooldown : the cooldown, in milliseconds
*/
int GetCreatureSpellCooldownDelay(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetCreatureSpellCooldownDelay(lua_State* L, Creature* creature)
{
uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
@@ -607,7 +607,7 @@ namespace LuaCreature
*
* @return uint32 corpseDelay : the delay, in seconds
*/
int GetCorpseDelay(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetCorpseDelay(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->GetCorpseDelay());
return 1;
@@ -622,7 +622,7 @@ namespace LuaCreature
* @return float z
* @return float o
*/
int GetHomePosition(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetHomePosition(lua_State* L, Creature* creature)
{
float x, y, z, o;
#ifndef TRINITY
@@ -647,7 +647,7 @@ namespace LuaCreature
* @param float z
* @param float o
*/
int SetHomePosition(Eluna* /*E*/, lua_State* L, Creature* creature)
int SetHomePosition(lua_State* L, Creature* creature)
{
float x = Eluna::CHECKVAL<float>(L, 2);
float y = Eluna::CHECKVAL<float>(L, 3);
@@ -689,7 +689,7 @@ 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*/, lua_State* L, Creature* creature)
int GetAITarget(lua_State* L, Creature* creature)
{
uint32 targetType = Eluna::CHECKVAL<uint32>(L, 2);
bool playerOnly = Eluna::CHECKVAL<bool>(L, 3, false);
@@ -777,7 +777,7 @@ namespace LuaCreature
*
* @return table targets
*/
int GetAITargets(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetAITargets(lua_State* L, Creature* creature)
{
lua_newtable(L);
int tbl = lua_gettop(L);
@@ -810,7 +810,7 @@ namespace LuaCreature
*
* @return int targetsCount
*/
int GetAITargetsCount(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetAITargetsCount(lua_State* L, Creature* creature)
{
#ifdef MANGOS
Eluna::Push(L, creature->GetThreatManager().getThreatList().size());
@@ -828,7 +828,7 @@ namespace LuaCreature
*
* @return [NPCFlags] npcFlags
*/
int GetNPCFlags(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetNPCFlags(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->GetUInt32Value(UNIT_NPC_FLAGS));
return 1;
@@ -840,7 +840,7 @@ namespace LuaCreature
*
* @return uint32 shieldBlockValue
*/
int GetShieldBlockValue(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetShieldBlockValue(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->GetShieldBlockValue());
return 1;
@@ -848,7 +848,7 @@ namespace LuaCreature
#endif
#ifdef TRINITY
int GetLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
int GetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
{
Eluna::Push(L, creature->GetLootMode());
return 1;
@@ -860,7 +860,7 @@ namespace LuaCreature
*
* @return uint32 dbguid
*/
int GetDBTableGUIDLow(Eluna* /*E*/, lua_State* L, Creature* creature)
int GetDBTableGUIDLow(lua_State* L, Creature* creature)
{
#ifdef TRINITY
Eluna::Push(L, creature->GetSpawnId());
@@ -876,7 +876,7 @@ namespace LuaCreature
*
* @param [NPCFlags] flags
*/
int SetNPCFlags(Eluna* /*E*/, lua_State* L, Creature* creature)
int SetNPCFlags(lua_State* L, Creature* creature)
{
uint32 flags = Eluna::CHECKVAL<uint32>(L, 2);
@@ -890,7 +890,7 @@ namespace LuaCreature
*
* @param bool enable = true
*/
int SetDisableGravity(Eluna* /*E*/, lua_State* L, Creature* creature)
int SetDisableGravity(lua_State* L, Creature* creature)
{
bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -903,7 +903,7 @@ namespace LuaCreature
}
#ifdef TRINITY
int SetLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
int SetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
{
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
@@ -917,7 +917,7 @@ namespace LuaCreature
*
* @param [DeathState] deathState
*/
int SetDeathState(Eluna* /*E*/, lua_State* L, Creature* creature)
int SetDeathState(lua_State* L, Creature* creature)
{
int32 state = Eluna::CHECKVAL<int32>(L, 2);
@@ -934,7 +934,7 @@ namespace LuaCreature
*
* @param bool enable = true : `true` to enable walking, `false` for running
*/
int SetWalk(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Move same to Player ?
int SetWalk(lua_State* L, Creature* creature) // TODO: Move same to Player ?
{
bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -949,7 +949,7 @@ namespace LuaCreature
* @param uint32 off_hand : off hand [Item]'s entry
* @param uint32 ranged : ranged [Item]'s entry
*/
int SetEquipmentSlots(Eluna* /*E*/, lua_State* L, Creature* creature)
int SetEquipmentSlots(lua_State* L, Creature* creature)
{
uint32 main_hand = Eluna::CHECKVAL<uint32>(L, 2);
uint32 off_hand = Eluna::CHECKVAL<uint32>(L, 3);
@@ -972,7 +972,7 @@ namespace LuaCreature
*
* @param bool allow = true : `true` to allow aggro, `false` to disable aggro
*/
int SetAggroEnabled(Eluna* /*E*/, lua_State* L, Creature* creature)
int SetAggroEnabled(lua_State* L, Creature* creature)
{
bool allow = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -996,7 +996,7 @@ namespace LuaCreature
*
* @param bool disable = true : `true` to disable reputation, `false` to enable
*/
int SetDisableReputationGain(Eluna* /*E*/, lua_State* L, Creature* creature)
int SetDisableReputationGain(lua_State* L, Creature* creature)
{
bool disable = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -1010,7 +1010,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*/, lua_State* /*L*/, Creature* creature)
int SetInCombatWithZone(lua_State* /*L*/, Creature* creature)
{
creature->SetInCombatWithZone();
return 0;
@@ -1021,7 +1021,7 @@ namespace LuaCreature
*
* @param float distance
*/
int SetWanderRadius(Eluna* /*E*/, lua_State* L, Creature* creature)
int SetWanderRadius(lua_State* L, Creature* creature)
{
float dist = Eluna::CHECKVAL<float>(L, 2);
@@ -1034,7 +1034,7 @@ namespace LuaCreature
*
* @param uint32 delay : the delay, in seconds
*/
int SetRespawnDelay(Eluna* /*E*/, lua_State* L, Creature* creature)
int SetRespawnDelay(lua_State* L, Creature* creature)
{
uint32 delay = Eluna::CHECKVAL<uint32>(L, 2);
@@ -1047,7 +1047,7 @@ namespace LuaCreature
*
* @param [MovementGeneratorType] type
*/
int SetDefaultMovementType(Eluna* /*E*/, lua_State* L, Creature* creature)
int SetDefaultMovementType(lua_State* L, Creature* creature)
{
int32 type = Eluna::CHECKVAL<int32>(L, 2);
@@ -1060,7 +1060,7 @@ namespace LuaCreature
*
* @param bool enable = true : `true` to disable searching, `false` to allow
*/
int SetNoSearchAssistance(Eluna* /*E*/, lua_State* L, Creature* creature)
int SetNoSearchAssistance(lua_State* L, Creature* creature)
{
bool val = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -1073,7 +1073,7 @@ namespace LuaCreature
*
* @param bool enable = true : `true` to disable calling for help, `false` to enable
*/
int SetNoCallAssistance(Eluna* /*E*/, lua_State* L, Creature* creature)
int SetNoCallAssistance(lua_State* L, Creature* creature)
{
bool val = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -1086,7 +1086,7 @@ namespace LuaCreature
*
* @param bool enable = true : `true` to enable hovering, `false` to disable
*/
int SetHover(Eluna* /*E*/, lua_State* L, Creature* creature)
int SetHover(lua_State* L, Creature* creature)
{
bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -1116,7 +1116,7 @@ namespace LuaCreature
*
* @param uint32 delay = 0 : dely to despawn in milliseconds
*/
int DespawnOrUnsummon(Eluna* /*E*/, lua_State* L, Creature* creature)
int DespawnOrUnsummon(lua_State* L, Creature* creature)
{
uint32 msTimeToDespawn = Eluna::CHECKVAL<uint32>(L, 2, 0);
@@ -1131,7 +1131,7 @@ namespace LuaCreature
/**
* Respawn this [Creature].
*/
int Respawn(Eluna* /*E*/, lua_State* /*L*/, Creature* creature)
int Respawn(lua_State* /*L*/, Creature* creature)
{
creature->Respawn();
return 0;
@@ -1140,7 +1140,7 @@ namespace LuaCreature
/**
* Remove this [Creature]'s corpse.
*/
int RemoveCorpse(Eluna* /*E*/, lua_State* /*L*/, Creature* creature)
int RemoveCorpse(lua_State* /*L*/, Creature* creature)
{
creature->RemoveCorpse();
return 0;
@@ -1149,7 +1149,7 @@ namespace LuaCreature
/**
* Make the [Creature] start following its waypoint path.
*/
int MoveWaypoint(Eluna* /*E*/, lua_State* /*L*/, Creature* creature)
int MoveWaypoint(lua_State* /*L*/, Creature* creature)
{
#ifndef TRINITY
creature->GetMotionMaster()->MoveWaypoint();
@@ -1162,7 +1162,7 @@ namespace LuaCreature
/**
* Make the [Creature] call for assistance in combat from other nearby [Creature]s.
*/
int CallAssistance(Eluna* /*E*/, lua_State* /*L*/, Creature* creature)
int CallAssistance(lua_State* /*L*/, Creature* creature)
{
creature->CallAssistance();
return 0;
@@ -1173,7 +1173,7 @@ namespace LuaCreature
*
* @param float radius
*/
int CallForHelp(Eluna* /*E*/, lua_State* L, Creature* creature)
int CallForHelp(lua_State* L, Creature* creature)
{
float radius = Eluna::CHECKVAL<float>(L, 2);
@@ -1184,7 +1184,7 @@ namespace LuaCreature
/**
* Make the [Creature] flee combat to get assistance from a nearby friendly [Creature].
*/
int FleeToGetAssistance(Eluna* /*E*/, lua_State* /*L*/, Creature* creature)
int FleeToGetAssistance(lua_State* /*L*/, Creature* creature)
{
creature->DoFleeToGetAssistance();
return 0;
@@ -1195,7 +1195,7 @@ namespace LuaCreature
*
* @param [Unit] target
*/
int AttackStart(Eluna* /*E*/, lua_State* L, Creature* creature)
int AttackStart(lua_State* L, Creature* creature)
{
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
@@ -1206,7 +1206,7 @@ namespace LuaCreature
/**
* Save the [Creature] in the database.
*/
int SaveToDB(Eluna* /*E*/, lua_State* /*L*/, Creature* creature)
int SaveToDB(lua_State* /*L*/, Creature* creature)
{
creature->SaveToDB();
return 0;
@@ -1217,7 +1217,7 @@ namespace LuaCreature
*
* This should be called every update cycle for the Creature's AI.
*/
int SelectVictim(Eluna* /*E*/, lua_State* L, Creature* creature)
int SelectVictim(lua_State* L, Creature* creature)
{
#ifndef TRINITY
Eluna::Push(L, creature->SelectHostileTarget());
@@ -1233,7 +1233,7 @@ 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*/, lua_State* L, Creature* creature)
int UpdateEntry(lua_State* L, Creature* creature)
{
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
uint32 dataGuidLow = Eluna::CHECKVAL<uint32>(L, 3, 0);
@@ -1250,7 +1250,7 @@ namespace LuaCreature
/**
* Resets [Creature]'s loot mode to default
*/
int ResetLootMode(Eluna* /*E*/, lua_State* /*L*/, Creature* creature) // TODO: Implement LootMode features
int ResetLootMode(lua_State* /*L*/, Creature* creature) // TODO: Implement LootMode features
{
creature->ResetLootMode();
return 0;
@@ -1261,7 +1261,7 @@ namespace LuaCreature
*
* @param uint16 lootMode
*/
int RemoveLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
int RemoveLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
{
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
@@ -1274,7 +1274,7 @@ namespace LuaCreature
*
* @param uint16 lootMode
*/
int AddLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
int AddLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
{
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);

View File

@@ -40,7 +40,7 @@ namespace LuaQuery
* @param uint32 column
* @return bool isNull
*/
int IsNull(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
int IsNull(lua_State* L, ElunaQuery* result)
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
@@ -58,7 +58,7 @@ namespace LuaQuery
*
* @return uint32 columnCount
*/
int GetColumnCount(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
int GetColumnCount(lua_State* L, ElunaQuery* result)
{
Eluna::Push(L, RESULT->GetFieldCount());
return 1;
@@ -69,7 +69,7 @@ namespace LuaQuery
*
* @return uint32 rowCount
*/
int GetRowCount(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
int GetRowCount(lua_State* L, ElunaQuery* result)
{
if (RESULT->GetRowCount() > (uint32)-1)
Eluna::Push(L, (uint32)-1);
@@ -84,7 +84,7 @@ namespace LuaQuery
* @param uint32 column
* @return bool data
*/
int GetBool(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
int GetBool(lua_State* L, ElunaQuery* result)
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
@@ -98,7 +98,7 @@ namespace LuaQuery
* @param uint32 column
* @return uint8 data
*/
int GetUInt8(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
int GetUInt8(lua_State* L, ElunaQuery* result)
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
@@ -112,7 +112,7 @@ namespace LuaQuery
* @param uint32 column
* @return uint16 data
*/
int GetUInt16(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
int GetUInt16(lua_State* L, ElunaQuery* result)
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
@@ -126,7 +126,7 @@ namespace LuaQuery
* @param uint32 column
* @return uint32 data
*/
int GetUInt32(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
int GetUInt32(lua_State* L, ElunaQuery* result)
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
@@ -140,7 +140,7 @@ namespace LuaQuery
* @param uint32 column
* @return uint64 data
*/
int GetUInt64(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
int GetUInt64(lua_State* L, ElunaQuery* result)
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
@@ -154,7 +154,7 @@ namespace LuaQuery
* @param uint32 column
* @return int8 data
*/
int GetInt8(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
int GetInt8(lua_State* L, ElunaQuery* result)
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
@@ -168,7 +168,7 @@ namespace LuaQuery
* @param uint32 column
* @return int16 data
*/
int GetInt16(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
int GetInt16(lua_State* L, ElunaQuery* result)
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
@@ -182,7 +182,7 @@ namespace LuaQuery
* @param uint32 column
* @return int32 data
*/
int GetInt32(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
int GetInt32(lua_State* L, ElunaQuery* result)
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
@@ -196,7 +196,7 @@ namespace LuaQuery
* @param uint32 column
* @return int64 data
*/
int GetInt64(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
int GetInt64(lua_State* L, ElunaQuery* result)
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
@@ -210,7 +210,7 @@ namespace LuaQuery
* @param uint32 column
* @return float data
*/
int GetFloat(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
int GetFloat(lua_State* L, ElunaQuery* result)
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
@@ -224,7 +224,7 @@ namespace LuaQuery
* @param uint32 column
* @return double data
*/
int GetDouble(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
int GetDouble(lua_State* L, ElunaQuery* result)
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
@@ -238,7 +238,7 @@ namespace LuaQuery
* @param uint32 column
* @return string data
*/
int GetString(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
int GetString(lua_State* L, ElunaQuery* result)
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
@@ -260,7 +260,7 @@ namespace LuaQuery
*
* @return bool hadNextRow
*/
int NextRow(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
int NextRow(lua_State* L, ElunaQuery* result)
{
Eluna::Push(L, RESULT->NextRow());
return 1;
@@ -283,7 +283,7 @@ namespace LuaQuery
*
* @return table rowData : table filled with row columns and data where `T[column] = data`
*/
int GetRow(Eluna* /*E*/, lua_State* L, ElunaQuery* result)
int GetRow(lua_State* L, ElunaQuery* result)
{
lua_newtable(L);
int tbl = lua_gettop(L);

View File

@@ -20,42 +20,33 @@ extern "C"
class ElunaGlobal
{
public:
struct ElunaRegister
{
const char* name;
int(*mfunc)(Eluna*, lua_State*);
};
static int thunk(lua_State* L)
{
ElunaRegister* l = static_cast<ElunaRegister*>(lua_touserdata(L, lua_upvalueindex(1)));
Eluna* E = static_cast<Eluna*>(lua_touserdata(L, lua_upvalueindex(2)));
int args = lua_gettop(L);
int expected = l->mfunc(E, L);
args = lua_gettop(L) - args;
luaL_Reg* l = static_cast<luaL_Reg*>(lua_touserdata(L, lua_upvalueindex(1)));
int top = lua_gettop(L);
int expected = l->func(L);
int args = lua_gettop(L) - top;
if (args < 0 || args > expected)
{
ELUNA_LOG_ERROR("[Eluna]: %s returned unexpected amount of arguments %i out of %i. Report to devs", l->name, args, expected);
ASSERT(false);
}
for (; args < expected; ++args)
lua_pushnil(L);
lua_settop(L, top + expected);
return expected;
}
static void SetMethods(Eluna* E, ElunaRegister* methodTable)
static void SetMethods(Eluna* E, luaL_Reg* methodTable)
{
ASSERT(E);
ASSERT(methodTable);
lua_pushglobaltable(E->L);
for (; methodTable && methodTable->name && methodTable->mfunc; ++methodTable)
for (; methodTable && methodTable->name && methodTable->func; ++methodTable)
{
lua_pushstring(E->L, methodTable->name);
lua_pushlightuserdata(E->L, (void*)methodTable);
lua_pushlightuserdata(E->L, (void*)E);
lua_pushcclosure(E->L, thunk, 2);
lua_pushcclosure(E->L, thunk, 1);
lua_settable(E->L, -3);
}
@@ -118,7 +109,7 @@ template<typename T>
struct ElunaRegister
{
const char* name;
int(*mfunc)(Eluna*, lua_State*, T*);
int(*mfunc)(lua_State*, T*);
};
template<typename T>
@@ -247,8 +238,7 @@ public:
{
lua_pushstring(E->L, methodTable->name);
lua_pushlightuserdata(E->L, (void*)methodTable);
lua_pushlightuserdata(E->L, (void*)E);
lua_pushcclosure(E->L, CallMethod, 2);
lua_pushcclosure(E->L, CallMethod, 1);
lua_settable(E->L, -3);
}
@@ -356,19 +346,16 @@ public:
if (!obj)
return 0;
ElunaRegister<T>* l = static_cast<ElunaRegister<T>*>(lua_touserdata(L, lua_upvalueindex(1)));
Eluna* E = static_cast<Eluna*>(lua_touserdata(L, lua_upvalueindex(2)));
int top = lua_gettop(L);
int expected = l->mfunc(E, L, obj);
int expected = l->mfunc(L, obj);
int args = lua_gettop(L) - top;
if (args < 0 || args > expected)
{
ELUNA_LOG_ERROR("[Eluna]: %s returned unexpected amount of arguments %i out of %i. Report to devs", l->name, args, expected);
ASSERT(false);
}
if (args == expected)
return expected;
lua_settop(L, top);
return 0;
lua_settop(L, top + expected);
return expected;
}
// Metamethods ("virtual")

View File

@@ -18,7 +18,7 @@ namespace LuaGameObject
* @param uint32 questId : quest entry Id to check
* @return bool hasQuest
*/
int HasQuest(Eluna* /*E*/, lua_State* L, GameObject* go)
int HasQuest(lua_State* L, GameObject* go)
{
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
@@ -35,7 +35,7 @@ namespace LuaGameObject
*
* @return bool isSpawned
*/
int IsSpawned(Eluna* /*E*/, lua_State* L, GameObject* go)
int IsSpawned(lua_State* L, GameObject* go)
{
Eluna::Push(L, go->isSpawned());
return 1;
@@ -46,7 +46,7 @@ namespace LuaGameObject
*
* @return bool isTransport
*/
int IsTransport(Eluna* /*E*/, lua_State* L, GameObject* go)
int IsTransport(lua_State* L, GameObject* go)
{
Eluna::Push(L, go->IsTransport());
return 1;
@@ -57,13 +57,13 @@ namespace LuaGameObject
*
* @return bool isActive
*/
int IsActive(Eluna* /*E*/, lua_State* L, GameObject* go)
int IsActive(lua_State* L, GameObject* go)
{
Eluna::Push(L, go->isActiveObject());
return 1;
}
/*int IsDestructible(Eluna* E, lua_State* L, GameObject* go) // TODO: Implementation core side
/*int IsDestructible(lua_State* L, GameObject* go) // TODO: Implementation core side
{
Eluna::Push(L, go->IsDestructibleBuilding());
return 1;
@@ -74,7 +74,7 @@ namespace LuaGameObject
*
* @return uint32 displayId
*/
int GetDisplayId(Eluna* /*E*/, lua_State* L, GameObject* go)
int GetDisplayId(lua_State* L, GameObject* go)
{
Eluna::Push(L, go->GetDisplayId());
return 1;
@@ -95,7 +95,7 @@ namespace LuaGameObject
*
* @return [GOState] goState
*/
int GetGoState(Eluna* /*E*/, lua_State* L, GameObject* go)
int GetGoState(lua_State* L, GameObject* go)
{
Eluna::Push(L, go->GetGoState());
return 1;
@@ -117,7 +117,7 @@ namespace LuaGameObject
*
* @return [LootState] lootState
*/
int GetLootState(Eluna* /*E*/, lua_State* L, GameObject* go)
int GetLootState(lua_State* L, GameObject* go)
{
Eluna::Push(L, go->getLootState());
return 1;
@@ -128,7 +128,7 @@ namespace LuaGameObject
*
* @return [Player] player
*/
int GetLootRecipient(Eluna* /*E*/, lua_State* L, GameObject* go)
int GetLootRecipient(lua_State* L, GameObject* go)
{
Eluna::Push(L, go->GetLootRecipient());
return 1;
@@ -139,7 +139,7 @@ namespace LuaGameObject
*
* @return [Group] group
*/
int GetLootRecipientGroup(Eluna* /*E*/, lua_State* L, GameObject* go)
int GetLootRecipientGroup(lua_State* L, GameObject* go)
{
#ifdef TRINITY
Eluna::Push(L, go->GetLootRecipientGroup());
@@ -154,7 +154,7 @@ namespace LuaGameObject
*
* @return uint32 dbguid
*/
int GetDBTableGUIDLow(Eluna* /*E*/, lua_State* L, GameObject* go)
int GetDBTableGUIDLow(lua_State* L, GameObject* go)
{
#ifdef TRINITY
Eluna::Push(L, go->GetSpawnId());
@@ -179,7 +179,7 @@ namespace LuaGameObject
*
* @param [GOState] state : all available go states can be seen above
*/
int SetGoState(Eluna* /*E*/, lua_State* L, GameObject* go)
int SetGoState(lua_State* L, GameObject* go)
{
uint32 state = Eluna::CHECKVAL<uint32>(L, 2, 0);
@@ -209,7 +209,7 @@ namespace LuaGameObject
*
* @param [LootState] state : all available loot states can be seen above
*/
int SetLootState(Eluna* /*E*/, lua_State* L, GameObject* go)
int SetLootState(lua_State* L, GameObject* go)
{
uint32 state = Eluna::CHECKVAL<uint32>(L, 2, 0);
@@ -229,7 +229,7 @@ namespace LuaGameObject
* Saves [GameObject] to the database
*
*/
int SaveToDB(Eluna* /*E*/, lua_State* /*L*/, GameObject* go)
int SaveToDB(lua_State* /*L*/, GameObject* go)
{
go->SaveToDB();
return 0;
@@ -242,7 +242,7 @@ namespace LuaGameObject
*
* @param bool deleteFromDB : if true, it will delete the [GameObject] from the database
*/
int RemoveFromWorld(Eluna* /*E*/, lua_State* L, GameObject* go)
int RemoveFromWorld(lua_State* L, GameObject* go)
{
bool deldb = Eluna::CHECKVAL<bool>(L, 2, false);
@@ -276,7 +276,7 @@ namespace LuaGameObject
*
* @param uint32 delay = 0 : cooldown time in seconds to restore the [GameObject] back to normal. 0 for infinite duration
*/
int UseDoorOrButton(Eluna* /*E*/, lua_State* L, GameObject* go)
int UseDoorOrButton(lua_State* L, GameObject* go)
{
uint32 delay = Eluna::CHECKVAL<uint32>(L, 2, 0);
@@ -289,7 +289,7 @@ namespace LuaGameObject
*
* The gameobject may be automatically respawned by the core
*/
int Despawn(Eluna* /*E*/, lua_State* L, GameObject* go)
int Despawn(lua_State* L, GameObject* go)
{
go->SetLootState(GO_JUST_DEACTIVATED);
return 0;
@@ -298,7 +298,7 @@ namespace LuaGameObject
/**
* Respawns a [GameObject]
*/
int Respawn(Eluna* /*E*/, lua_State* L, GameObject* go)
int Respawn(lua_State* L, GameObject* go)
{
go->Respawn();
return 0;
@@ -311,7 +311,7 @@ namespace LuaGameObject
*
* @param int32 delay = 0 : cooldown time in seconds to respawn or despawn the object. 0 means never
*/
int SetRespawnTime(Eluna* /*E*/, lua_State* L, GameObject* go)
int SetRespawnTime(lua_State* L, GameObject* go)
{
int32 respawn = Eluna::CHECKVAL<int32>(L, 2);

File diff suppressed because it is too large Load Diff

View File

@@ -18,7 +18,7 @@ namespace LuaGroup
* @param uint64 guid : guid of a possible leader
* @return bool isLeader
*/
int IsLeader(Eluna* /*E*/, lua_State* L, Group* group)
int IsLeader(lua_State* L, Group* group)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
Eluna::Push(L, group->IsLeader(ObjectGuid(guid)));
@@ -30,7 +30,7 @@ namespace LuaGroup
*
* @return bool isFull
*/
int IsFull(Eluna* /*E*/, lua_State* L, Group* group)
int IsFull(lua_State* L, Group* group)
{
Eluna::Push(L, group->IsFull());
return 1;
@@ -41,7 +41,7 @@ namespace LuaGroup
*
* @return bool isRaid
*/
int IsRaidGroup(Eluna* /*E*/, lua_State* L, Group* group)
int IsRaidGroup(lua_State* L, Group* group)
{
Eluna::Push(L, group->isRaidGroup());
return 1;
@@ -52,7 +52,7 @@ namespace LuaGroup
*
* @return bool isBG
*/
int IsBGGroup(Eluna* /*E*/, lua_State* L, Group* group)
int IsBGGroup(lua_State* L, Group* group)
{
Eluna::Push(L, group->isBGGroup());
return 1;
@@ -64,7 +64,7 @@ namespace LuaGroup
* @param uint64 guid : guid of a player
* @return bool isMember
*/
int IsMember(Eluna* /*E*/, lua_State* L, Group* group)
int IsMember(lua_State* L, Group* group)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
Eluna::Push(L, group->IsMember(ObjectGuid(guid)));
@@ -77,7 +77,7 @@ namespace LuaGroup
* @param uint64 guid : guid of a player
* @return bool isAssistant
*/
int IsAssistant(Eluna* /*E*/, lua_State* L, Group* group)
int IsAssistant(lua_State* L, Group* group)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
Eluna::Push(L, group->IsAssistant(ObjectGuid(guid)));
@@ -91,7 +91,7 @@ namespace LuaGroup
* @param [Player] player2 : second [Player] to check
* @return bool sameSubGroup
*/
int SameSubGroup(Eluna* /*E*/, lua_State* L, Group* group)
int SameSubGroup(lua_State* L, Group* group)
{
Player* player1 = Eluna::CHECKOBJ<Player>(L, 2);
Player* player2 = Eluna::CHECKOBJ<Player>(L, 3);
@@ -105,7 +105,7 @@ namespace LuaGroup
* @param uint8 subGroup : subGroup ID to check
* @return bool hasFreeSlot
*/
int HasFreeSlotSubGroup(Eluna* /*E*/, lua_State* L, Group* group)
int HasFreeSlotSubGroup(lua_State* L, Group* group)
{
uint8 subGroup = Eluna::CHECKVAL<uint8>(L, 2);
@@ -125,7 +125,7 @@ namespace LuaGroup
* @param [Player] player : [Player] to add to the group
* @return bool added : true if member was added
*/
int AddMember(Eluna* /*E*/, lua_State* L, Group* group)
int AddMember(lua_State* L, Group* group)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
@@ -150,13 +150,13 @@ namespace LuaGroup
return 1;
}
/*int IsLFGGroup(Eluna* E, lua_State* L, Group* group) // TODO: Implementation
/*int IsLFGGroup(lua_State* L, Group* group) // TODO: Implementation
{
Eluna::Push(L, group->isLFGGroup());
return 1;
}*/
/*int IsBFGroup(Eluna* E, lua_State* L, Group* group) // TODO: Implementation
/*int IsBFGroup(lua_State* L, Group* group) // TODO: Implementation
{
Eluna::Push(L, group->isBFGroup());
return 1;
@@ -167,7 +167,7 @@ namespace LuaGroup
*
* @return table groupPlayers : table of [Player]s
*/
int GetMembers(Eluna* /*E*/, lua_State* L, Group* group)
int GetMembers(lua_State* L, Group* group)
{
lua_newtable(L);
int tbl = lua_gettop(L);
@@ -199,7 +199,7 @@ namespace LuaGroup
*
* @return uint64 leaderGUID
*/
int GetLeaderGUID(Eluna* /*E*/, lua_State* L, Group* group)
int GetLeaderGUID(lua_State* L, Group* group)
{
#ifndef TRINITY
Eluna::Push(L, group->GetLeaderGuid());
@@ -214,7 +214,7 @@ namespace LuaGroup
*
* @return uint64 groupGUID
*/
int GetGUID(Eluna* /*E*/, lua_State* L, Group* group)
int GetGUID(lua_State* L, Group* group)
{
#ifdef CLASSIC
Eluna::Push(L, group->GetId());
@@ -230,7 +230,7 @@ namespace LuaGroup
* @param string name : the [Player]'s name
* @return uint64 memberGUID
*/
int GetMemberGUID(Eluna* /*E*/, lua_State* L, Group* group)
int GetMemberGUID(lua_State* L, Group* group)
{
const char* name = Eluna::CHECKVAL<const char*>(L, 2);
#ifndef TRINITY
@@ -246,7 +246,7 @@ namespace LuaGroup
*
* @return uint32 memberCount
*/
int GetMembersCount(Eluna* /*E*/, lua_State* L, Group* group)
int GetMembersCount(lua_State* L, Group* group)
{
Eluna::Push(L, group->GetMembersCount());
return 1;
@@ -258,7 +258,7 @@ namespace LuaGroup
* @param uint64 guid : guid of the player
* @return uint8 subGroupID : a valid subgroup ID or MAX_RAID_SUBGROUPS+1
*/
int GetMemberGroup(Eluna* /*E*/, lua_State* L, Group* group)
int GetMemberGroup(lua_State* L, Group* group)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
Eluna::Push(L, group->GetMemberGroup(ObjectGuid(guid)));
@@ -270,7 +270,7 @@ namespace LuaGroup
*
* @param uint64 guid : guid of the new leader
*/
int SetLeader(Eluna* /*E*/, lua_State* L, Group* group)
int SetLeader(lua_State* L, Group* group)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
group->ChangeLeader(ObjectGuid(guid));
@@ -285,7 +285,7 @@ namespace LuaGroup
* @param bool ignorePlayersInBg : ignores [Player]s in a battleground
* @param uint64 ignore : ignore a [Player] by their GUID
*/
int SendPacket(Eluna* /*E*/, lua_State* L, Group* group)
int SendPacket(lua_State* L, Group* group)
{
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
bool ignorePlayersInBg = Eluna::CHECKVAL<bool>(L, 3);
@@ -316,7 +316,7 @@ namespace LuaGroup
* @param [RemoveMethod] method : method used to remove the player
* @return bool removed
*/
int RemoveMember(Eluna* /*E*/, lua_State* L, Group* group)
int RemoveMember(lua_State* L, Group* group)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
uint32 method = Eluna::CHECKVAL<uint32>(L, 3, 0);
@@ -333,7 +333,7 @@ namespace LuaGroup
* Disbands this [Group]
*
*/
int Disband(Eluna* /*E*/, lua_State* /*L*/, Group* group)
int Disband(lua_State* /*L*/, Group* group)
{
group->Disband();
return 0;
@@ -343,7 +343,7 @@ namespace LuaGroup
* Converts this [Group] to a raid [Group]
*
*/
int ConvertToRaid(Eluna* /*E*/, lua_State* /*L*/, Group* group)
int ConvertToRaid(lua_State* /*L*/, Group* group)
{
group->ConvertToRaid();
return 0;
@@ -355,7 +355,7 @@ namespace LuaGroup
* @param uint64 guid : guid of the player to move
* @param uint8 groupID : the subGroup's ID
*/
int SetMembersGroup(Eluna* /*E*/, lua_State* L, Group* group)
int SetMembersGroup(lua_State* L, Group* group)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
uint8 subGroup = Eluna::CHECKVAL<uint8>(L, 3);
@@ -380,7 +380,7 @@ 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*/, lua_State* L, Group* group)
int SetTargetIcon(lua_State* L, Group* group)
{
uint8 icon = Eluna::CHECKVAL<uint8>(L, 2);
uint64 target = Eluna::CHECKVAL<uint64>(L, 3);
@@ -397,7 +397,7 @@ namespace LuaGroup
return 0;
}
/*int ConvertToLFG(Eluna* E, lua_State* L, Group* group) // TODO: Implementation
/*int ConvertToLFG(lua_State* L, Group* group) // TODO: Implementation
{
group->ConvertToLFG();
return 0;

View File

@@ -19,7 +19,7 @@ namespace LuaGuild
*
* @return table guildPlayers : table of [Player]s
*/
int GetMembers(Eluna* /*E*/, lua_State* L, Guild* guild)
int GetMembers(lua_State* L, Guild* guild)
{
lua_newtable(L);
int tbl = lua_gettop(L);
@@ -60,7 +60,7 @@ namespace LuaGuild
*
* @return uint32 memberCount
*/
int GetMemberCount(Eluna* /*E*/, lua_State* L, Guild* guild)
int GetMemberCount(lua_State* L, Guild* guild)
{
#ifdef TRINITY
Eluna::Push(L, guild->GetMemberCount());
@@ -75,7 +75,7 @@ namespace LuaGuild
*
* @return [Player] leader
*/
int GetLeader(Eluna* /*E*/, lua_State* L, Guild* guild)
int GetLeader(lua_State* L, Guild* guild)
{
#ifndef TRINITY
Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGuid()));
@@ -90,7 +90,7 @@ namespace LuaGuild
*
* @return uint64 leaderGUID
*/
int GetLeaderGUID(Eluna* /*E*/, lua_State* L, Guild* guild)
int GetLeaderGUID(lua_State* L, Guild* guild)
{
#ifndef TRINITY
Eluna::Push(L, guild->GetLeaderGuid());
@@ -105,7 +105,7 @@ namespace LuaGuild
*
* @return uint32 entryId
*/
int GetId(Eluna* /*E*/, lua_State* L, Guild* guild)
int GetId(lua_State* L, Guild* guild)
{
Eluna::Push(L, guild->GetId());
return 1;
@@ -116,7 +116,7 @@ namespace LuaGuild
*
* @return string guildName
*/
int GetName(Eluna* /*E*/, lua_State* L, Guild* guild)
int GetName(lua_State* L, Guild* guild)
{
Eluna::Push(L, guild->GetName());
return 1;
@@ -127,7 +127,7 @@ namespace LuaGuild
*
* @return string guildMOTD
*/
int GetMOTD(Eluna* /*E*/, lua_State* L, Guild* guild)
int GetMOTD(lua_State* L, Guild* guild)
{
Eluna::Push(L, guild->GetMOTD());
return 1;
@@ -138,7 +138,7 @@ namespace LuaGuild
*
* @return string guildInfo
*/
int GetInfo(Eluna* /*E*/, lua_State* L, Guild* guild)
int GetInfo(lua_State* L, Guild* guild)
{
#ifndef TRINITY
Eluna::Push(L, guild->GetGINFO());
@@ -154,7 +154,7 @@ namespace LuaGuild
*
* @param [Player] leader : the [Player] leader to change
*/
int SetLeader(Eluna* /*E*/, lua_State* L, Guild* guild)
int SetLeader(lua_State* L, Guild* guild)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
@@ -174,7 +174,7 @@ namespace LuaGuild
* @param uint8 tabId : the ID of the tab specified
* @param string info : the information to be set to the bank tab
*/
int SetBankTabText(Eluna* /*E*/, lua_State* L, Guild* guild)
int SetBankTabText(lua_State* L, Guild* guild)
{
uint8 tabId = Eluna::CHECKVAL<uint8>(L, 2);
const char* text = Eluna::CHECKVAL<const char*>(L, 3);
@@ -193,7 +193,7 @@ namespace LuaGuild
*
* @param [WorldPacket] packet : the [WorldPacket] to be sent to the [Player]s
*/
int SendPacket(Eluna* /*E*/, lua_State* L, Guild* guild)
int SendPacket(lua_State* L, Guild* guild)
{
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
@@ -212,7 +212,7 @@ namespace LuaGuild
* @param [WorldPacket] packet : the [WorldPacket] to be sent to the [Player]s
* @param uint8 rankId : the rank ID
*/
int SendPacketToRanked(Eluna* /*E*/, lua_State* L, Guild* guild)
int SendPacketToRanked(lua_State* L, Guild* guild)
{
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
uint8 ranked = Eluna::CHECKVAL<uint8>(L, 3);
@@ -228,7 +228,7 @@ namespace LuaGuild
/**
* Disbands the [Guild]
*/
int Disband(Eluna* /*E*/, lua_State* /*L*/, Guild* guild)
int Disband(lua_State* /*L*/, Guild* guild)
{
guild->Disband();
return 0;
@@ -242,7 +242,7 @@ namespace LuaGuild
* @param [Player] player : the [Player] to be added to the guild
* @param uint8 rankId : the rank ID
*/
int AddMember(Eluna* /*E*/, lua_State* L, Guild* guild)
int AddMember(lua_State* L, Guild* guild)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint8 rankId = Eluna::CHECKVAL<uint8>(L, 3, GUILD_RANK_NONE);
@@ -262,7 +262,7 @@ namespace LuaGuild
* @param [Player] player : the [Player] to be removed from the guild
* @param bool isDisbanding : default 'false', should only be set to 'true' if the guild is triggered to disband
*/
int DeleteMember(Eluna* /*E*/, lua_State* L, Guild* guild)
int DeleteMember(lua_State* L, Guild* guild)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
bool isDisbanding = Eluna::CHECKVAL<bool>(L, 3, false);
@@ -282,7 +282,7 @@ namespace LuaGuild
* @param [Player] player : the [Player] to be promoted/demoted
* @param uint8 rankId : the rank ID
*/
int SetMemberRank(Eluna* /*E*/, lua_State* L, Guild* guild)
int SetMemberRank(lua_State* L, Guild* guild)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint8 newRank = Eluna::CHECKVAL<uint8>(L, 3);
@@ -304,7 +304,7 @@ namespace LuaGuild
* @param [Player] player
* @param uint32 money
*/
int WithdrawBankMoney(Eluna* /*E*/, lua_State* L, Guild* guild)
int WithdrawBankMoney(lua_State* L, Guild* guild)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint32 money = Eluna::CHECKVAL<uint32>(L, 3);
@@ -325,7 +325,7 @@ namespace LuaGuild
* @param [Player] player
* @param uint32 money
*/
int DepositBankMoney(Eluna* /*E*/, lua_State* L, Guild* guild)
int DepositBankMoney(lua_State* L, Guild* guild)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint32 money = Eluna::CHECKVAL<uint32>(L, 3);

View File

@@ -17,7 +17,7 @@ namespace LuaItem
*
* @return bool isSoulBound
*/
int IsSoulBound(Eluna* /*E*/, lua_State* L, Item* item)
int IsSoulBound(lua_State* L, Item* item)
{
Eluna::Push(L, item->IsSoulBound());
return 1;
@@ -29,7 +29,7 @@ namespace LuaItem
*
* @return bool isAccountBound
*/
int IsBoundAccountWide(Eluna* /*E*/, lua_State* L, Item* item)
int IsBoundAccountWide(lua_State* L, Item* item)
{
Eluna::Push(L, item->IsBoundAccountWide());
return 1;
@@ -41,7 +41,7 @@ namespace LuaItem
*
* @return bool isBoundByEnchant
*/
int IsBoundByEnchant(Eluna* /*E*/, lua_State* L, Item* item)
int IsBoundByEnchant(lua_State* L, Item* item)
{
Eluna::Push(L, item->IsBoundByEnchant());
return 1;
@@ -53,7 +53,7 @@ namespace LuaItem
* @param [Player] player : the [Player] object to check the item against
* @return bool isNotBound
*/
int IsNotBoundToPlayer(Eluna* /*E*/, lua_State* L, Item* item)
int IsNotBoundToPlayer(lua_State* L, Item* item)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
@@ -66,7 +66,7 @@ namespace LuaItem
*
* @return bool isLocked
*/
int IsLocked(Eluna* /*E*/, lua_State* L, Item* item)
int IsLocked(lua_State* L, Item* item)
{
Eluna::Push(L, item->IsLocked());
return 1;
@@ -77,7 +77,7 @@ namespace LuaItem
*
* @return bool isBag
*/
int IsBag(Eluna* /*E*/, lua_State* L, Item* item)
int IsBag(lua_State* L, Item* item)
{
Eluna::Push(L, item->IsBag());
return 1;
@@ -89,7 +89,7 @@ namespace LuaItem
*
* @return bool isCurrencyToken
*/
int IsCurrencyToken(Eluna* /*E*/, lua_State* L, Item* item)
int IsCurrencyToken(lua_State* L, Item* item)
{
Eluna::Push(L, item->IsCurrencyToken());
return 1;
@@ -101,7 +101,7 @@ namespace LuaItem
*
* @return bool isNotEmptyBag
*/
int IsNotEmptyBag(Eluna* /*E*/, lua_State* L, Item* item)
int IsNotEmptyBag(lua_State* L, Item* item)
{
Eluna::Push(L, item->IsNotEmptyBag());
return 1;
@@ -112,7 +112,7 @@ namespace LuaItem
*
* @return bool isBroken
*/
int IsBroken(Eluna* /*E*/, lua_State* L, Item* item)
int IsBroken(lua_State* L, Item* item)
{
Eluna::Push(L, item->IsBroken());
return 1;
@@ -123,7 +123,7 @@ namespace LuaItem
*
* @return bool isTradeable
*/
int CanBeTraded(Eluna* /*E*/, lua_State* L, Item* item)
int CanBeTraded(lua_State* L, Item* item)
{
#if (defined(TBC) || defined(CLASSIC))
Eluna::Push(L, item->CanBeTraded());
@@ -139,7 +139,7 @@ namespace LuaItem
*
* @return bool isInTrade
*/
int IsInTrade(Eluna* /*E*/, lua_State* L, Item* item)
int IsInTrade(lua_State* L, Item* item)
{
Eluna::Push(L, item->IsInTrade());
return 1;
@@ -150,7 +150,7 @@ namespace LuaItem
*
* @return bool isInBag
*/
int IsInBag(Eluna* /*E*/, lua_State* L, Item* item)
int IsInBag(lua_State* L, Item* item)
{
Eluna::Push(L, item->IsInBag());
return 1;
@@ -161,7 +161,7 @@ namespace LuaItem
*
* @return bool isEquipped
*/
int IsEquipped(Eluna* /*E*/, lua_State* L, Item* item)
int IsEquipped(lua_State* L, Item* item)
{
Eluna::Push(L, item->IsEquipped());
return 1;
@@ -173,7 +173,7 @@ namespace LuaItem
* @param uint32 questId : the [Quest] id to be checked
* @return bool hasQuest
*/
int HasQuest(Eluna* /*E*/, lua_State* L, Item* item)
int HasQuest(lua_State* L, Item* item)
{
uint32 quest = Eluna::CHECKVAL<uint32>(L, 2);
#ifndef TRINITY
@@ -189,7 +189,7 @@ namespace LuaItem
*
* @return bool isPotion
*/
int IsPotion(Eluna* /*E*/, lua_State* L, Item* item)
int IsPotion(lua_State* L, Item* item)
{
Eluna::Push(L, item->IsPotion());
return 1;
@@ -201,7 +201,7 @@ namespace LuaItem
*
* @return bool isWeaponVellum
*/
int IsWeaponVellum(Eluna* /*E*/, lua_State* L, Item* item)
int IsWeaponVellum(lua_State* L, Item* item)
{
Eluna::Push(L, item->IsWeaponVellum());
return 1;
@@ -212,7 +212,7 @@ namespace LuaItem
*
* @return bool isArmorVellum
*/
int IsArmorVellum(Eluna* /*E*/, lua_State* L, Item* item)
int IsArmorVellum(lua_State* L, Item* item)
{
Eluna::Push(L, item->IsArmorVellum());
return 1;
@@ -224,13 +224,13 @@ namespace LuaItem
*
* @return bool isConjuredConsumable
*/
int IsConjuredConsumable(Eluna* /*E*/, lua_State* L, Item* item)
int IsConjuredConsumable(lua_State* L, Item* item)
{
Eluna::Push(L, item->IsConjuredConsumable());
return 1;
}
/*int IsRefundExpired(Eluna* E, lua_State* L, Item* item)// TODO: Implement core support
/*int IsRefundExpired(lua_State* L, Item* item)// TODO: Implement core support
{
Eluna::Push(L, item->IsRefundExpired());
return 1;
@@ -257,7 +257,7 @@ namespace LuaItem
* @param [LocaleConstant] locale = DEFAULT_LOCALE : locale to return the [Item]'s name in
* @return string itemLink
*/
int GetItemLink(Eluna* /*E*/, lua_State* L, Item* item)
int GetItemLink(lua_State* L, Item* item)
{
uint8 locale = Eluna::CHECKVAL<uint8>(L, 2, DEFAULT_LOCALE);
if (locale >= TOTAL_LOCALES)
@@ -313,7 +313,7 @@ namespace LuaItem
return 1;
}
int GetOwnerGUID(Eluna* /*E*/, lua_State* L, Item* item)
int GetOwnerGUID(lua_State* L, Item* item)
{
#ifndef TRINITY
Eluna::Push(L, item->GetOwnerGuid());
@@ -328,7 +328,7 @@ namespace LuaItem
*
* @return [Player] player : the [Player] who owns the [Item]
*/
int GetOwner(Eluna* /*E*/, lua_State* L, Item* item)
int GetOwner(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetOwner());
return 1;
@@ -339,7 +339,7 @@ namespace LuaItem
*
* @return uint32 count
*/
int GetCount(Eluna* /*E*/, lua_State* L, Item* item)
int GetCount(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetCount());
return 1;
@@ -350,7 +350,7 @@ namespace LuaItem
*
* @return uint32 maxCount
*/
int GetMaxStackCount(Eluna* /*E*/, lua_State* L, Item* item)
int GetMaxStackCount(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetMaxStackCount());
return 1;
@@ -361,7 +361,7 @@ namespace LuaItem
*
* @return uint8 slot
*/
int GetSlot(Eluna* /*E*/, lua_State* L, Item* item)
int GetSlot(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetSlot());
return 1;
@@ -372,7 +372,7 @@ namespace LuaItem
*
* @return uint8 bagSlot
*/
int GetBagSlot(Eluna* /*E*/, lua_State* L, Item* item)
int GetBagSlot(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetBagSlot());
return 1;
@@ -384,7 +384,7 @@ namespace LuaItem
* @param [EnchantmentSlot] enchantSlot : the enchant slot specified
* @return uint32 enchantId : the id of the enchant slot specified
*/
int GetEnchantmentId(Eluna* /*E*/, lua_State* L, Item* item)
int GetEnchantmentId(lua_State* L, Item* item)
{
uint32 enchant_slot = Eluna::CHECKVAL<uint32>(L, 2);
@@ -401,7 +401,7 @@ namespace LuaItem
* @param uint32 spellIndex : the spell index specified
* @return uint32 spellId : the id of the spell
*/
int GetSpellId(Eluna* /*E*/, lua_State* L, Item* item)
int GetSpellId(lua_State* L, Item* item)
{
uint32 index = Eluna::CHECKVAL<uint32>(L, 2);
if (index >= MAX_ITEM_PROTO_SPELLS)
@@ -417,7 +417,7 @@ namespace LuaItem
* @param uint32 spellIndex : the spell index specified
* @return uint32 spellTrigger : the spell trigger of the specified index
*/
int GetSpellTrigger(Eluna* /*E*/, lua_State* L, Item* item)
int GetSpellTrigger(lua_State* L, Item* item)
{
uint32 index = Eluna::CHECKVAL<uint32>(L, 2);
if (index >= MAX_ITEM_PROTO_SPELLS)
@@ -432,7 +432,7 @@ namespace LuaItem
*
* @return uint32 class
*/
int GetClass(Eluna* /*E*/, lua_State* L, Item* item)
int GetClass(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->Class);
return 1;
@@ -443,7 +443,7 @@ namespace LuaItem
*
* @return uint32 subClass
*/
int GetSubClass(Eluna* /*E*/, lua_State* L, Item* item)
int GetSubClass(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->SubClass);
return 1;
@@ -454,7 +454,7 @@ namespace LuaItem
*
* @return string name
*/
int GetName(Eluna* /*E*/, lua_State* L, Item* item)
int GetName(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->Name1);
return 1;
@@ -465,7 +465,7 @@ namespace LuaItem
*
* @return uint32 displayId
*/
int GetDisplayId(Eluna* /*E*/, lua_State* L, Item* item)
int GetDisplayId(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->DisplayInfoID);
return 1;
@@ -476,7 +476,7 @@ namespace LuaItem
*
* @return uint32 quality
*/
int GetQuality(Eluna* /*E*/, lua_State* L, Item* item)
int GetQuality(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->Quality);
return 1;
@@ -487,7 +487,7 @@ namespace LuaItem
*
* @return uint32 count
*/
int GetBuyCount(Eluna* /*E*/, lua_State* L, Item* item)
int GetBuyCount(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->BuyCount);
return 1;
@@ -498,7 +498,7 @@ namespace LuaItem
*
* @return uint32 price
*/
int GetBuyPrice(Eluna* /*E*/, lua_State* L, Item* item)
int GetBuyPrice(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->BuyPrice);
return 1;
@@ -509,7 +509,7 @@ namespace LuaItem
*
* @return uint32 price
*/
int GetSellPrice(Eluna* /*E*/, lua_State* L, Item* item)
int GetSellPrice(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->SellPrice);
return 1;
@@ -520,7 +520,7 @@ namespace LuaItem
*
* @return uint32 inventoryType
*/
int GetInventoryType(Eluna* /*E*/, lua_State* L, Item* item)
int GetInventoryType(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->InventoryType);
return 1;
@@ -531,7 +531,7 @@ namespace LuaItem
*
* @return uint32 allowableClass
*/
int GetAllowableClass(Eluna* /*E*/, lua_State* L, Item* item)
int GetAllowableClass(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->AllowableClass);
return 1;
@@ -542,7 +542,7 @@ namespace LuaItem
*
* @return uint32 allowableRace
*/
int GetAllowableRace(Eluna* /*E*/, lua_State* L, Item* item)
int GetAllowableRace(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->AllowableRace);
return 1;
@@ -553,7 +553,7 @@ namespace LuaItem
*
* @return uint32 itemLevel
*/
int GetItemLevel(Eluna* /*E*/, lua_State* L, Item* item)
int GetItemLevel(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->ItemLevel);
return 1;
@@ -564,14 +564,14 @@ namespace LuaItem
*
* @return uint32 requiredLevel
*/
int GetRequiredLevel(Eluna* /*E*/, lua_State* L, Item* item)
int GetRequiredLevel(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->RequiredLevel);
return 1;
}
#ifdef WOTLK
int GetStatsCount(Eluna* /*E*/, lua_State* L, Item* item)
int GetStatsCount(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->StatsCount);
return 1;
@@ -583,14 +583,14 @@ namespace LuaItem
*
* @return uint32 randomPropertyId
*/
int GetRandomProperty(Eluna* /*E*/, lua_State* L, Item* item)
int GetRandomProperty(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->RandomProperty);
return 1;
}
#ifndef CLASSIC
int GetRandomSuffix(Eluna* /*E*/, lua_State* L, Item* item)
int GetRandomSuffix(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->RandomSuffix);
return 1;
@@ -602,7 +602,7 @@ namespace LuaItem
*
* @return uint32 itemSetId
*/
int GetItemSet(Eluna* /*E*/, lua_State* L, Item* item)
int GetItemSet(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->ItemSet);
return 1;
@@ -613,7 +613,7 @@ namespace LuaItem
*
* @return uint32 bagSize
*/
int GetBagSize(Eluna* /*E*/, lua_State* L, Item* item)
int GetBagSize(lua_State* L, Item* item)
{
if (Bag* bag = item->ToBag())
Eluna::Push(L, bag->GetBagSize());
@@ -627,7 +627,7 @@ namespace LuaItem
*
* @param [Player] player : the [Player] specified
*/
int SetOwner(Eluna* /*E*/, lua_State* L, Item* item)
int SetOwner(lua_State* L, Item* item)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
#ifndef TRINITY
@@ -643,7 +643,7 @@ namespace LuaItem
*
* @param bool setBinding
*/
int SetBinding(Eluna* /*E*/, lua_State* L, Item* item)
int SetBinding(lua_State* L, Item* item)
{
bool soulbound = Eluna::CHECKVAL<bool>(L, 2);
@@ -656,7 +656,7 @@ namespace LuaItem
*
* @param uint32 count
*/
int SetCount(Eluna* /*E*/, lua_State* L, Item* item)
int SetCount(lua_State* L, Item* item)
{
uint32 count = Eluna::CHECKVAL<uint32>(L, 2);
item->SetCount(count);
@@ -670,7 +670,7 @@ namespace LuaItem
* @param uint32 enchantSlot : the slot for the enchant to be applied to
* @return bool enchantmentSuccess : if enchantment is successfully set to specified slot, returns 'true', otherwise 'false'
*/
int SetEnchantment(Eluna* /*E*/, lua_State* L, Item* item)
int SetEnchantment(lua_State* L, Item* item)
{
Player* owner = item->GetOwner();
if (!owner)
@@ -704,7 +704,7 @@ namespace LuaItem
* @param uint32 enchantSlot : the slot for the enchant to be removed from
* @return bool enchantmentRemoved : if enchantment is successfully removed from specified slot, returns 'true', otherwise 'false'
*/
int ClearEnchantment(Eluna* /*E*/, lua_State* L, Item* item)
int ClearEnchantment(lua_State* L, Item* item)
{
Player* owner = item->GetOwner();
if (!owner)
@@ -732,7 +732,7 @@ namespace LuaItem
/**
* Saves the [Item] to the database
*/
int SaveToDB(Eluna* /*E*/, lua_State* /*L*/, Item* item)
int SaveToDB(lua_State* /*L*/, Item* item)
{
#ifndef TRINITY
item->SaveToDB();

View File

@@ -232,6 +232,10 @@ void Eluna::OpenLua()
}
L = luaL_newstate();
lua_pushlightuserdata(L, this);
lua_setfield(L, LUA_REGISTRYINDEX, ELUNA_STATE_PTR);
CreateBindStores();
// open base lua libraries

View File

@@ -112,6 +112,7 @@ struct LuaScript
};
#define ELUNA_OBJECT_STORE "Eluna Object Store"
#define ELUNA_STATE_PTR "Eluna State Ptr"
#define LOCK_ELUNA Eluna::Guard __guard(Eluna::GetLock())
#ifndef TRINITY
@@ -154,8 +155,8 @@ private:
~Eluna();
// Prevent copy
Eluna(Eluna const&);
Eluna& operator=(const Eluna&);
Eluna(Eluna const&) = delete;
Eluna& operator=(const Eluna&) = delete;
void OpenLua();
void CloseLua();
@@ -247,6 +248,17 @@ public:
static void ReloadEluna() { LOCK_ELUNA; reload = true; }
static LockType& GetLock() { return lock; };
static bool IsInitialized() { return initialized; }
// Never returns nullptr
static Eluna* GetEluna(lua_State* L)
{
lua_pushstring(L, ELUNA_STATE_PTR);
lua_rawget(L, LUA_REGISTRYINDEX);
ASSERT(lua_islightuserdata(L, -1));
Eluna* E = static_cast<Eluna*>(lua_touserdata(L, -1));
lua_pop(L, 1);
ASSERT(E);
return E;
}
// Static pushes, can be used by anything, including methods.
static void Push(lua_State* luastate); // nil

View File

@@ -37,7 +37,7 @@ extern "C"
#include "VehicleMethods.h"
#include "BattleGroundMethods.h"
ElunaGlobal::ElunaRegister GlobalMethods[] =
luaL_Reg GlobalMethods[] =
{
// Hooks
{ "RegisterPacketEvent", &LuaGlobalFunctions::RegisterPacketEvent },

View File

@@ -23,7 +23,7 @@ namespace LuaMap
*
* @return bool isArena
*/
int IsArena(Eluna* /*E*/, lua_State* L, Map* map)
int IsArena(lua_State* L, Map* map)
{
Eluna::Push(L, map->IsBattleArena());
return 1;
@@ -35,7 +35,7 @@ namespace LuaMap
*
* @return bool isBattleGround
*/
int IsBattleground(Eluna* /*E*/, lua_State* L, Map* map)
int IsBattleground(lua_State* L, Map* map)
{
#ifndef TRINITY
Eluna::Push(L, map->IsBattleGround());
@@ -50,7 +50,7 @@ namespace LuaMap
*
* @return bool isDungeon
*/
int IsDungeon(Eluna* /*E*/, lua_State* L, Map* map)
int IsDungeon(lua_State* L, Map* map)
{
Eluna::Push(L, map->IsDungeon());
return 1;
@@ -61,7 +61,7 @@ namespace LuaMap
*
* @return bool isEmpty
*/
int IsEmpty(Eluna* /*E*/, lua_State* L, Map* map)
int IsEmpty(lua_State* L, Map* map)
{
Eluna::Push(L, map->isEmpty());
return 1;
@@ -73,7 +73,7 @@ namespace LuaMap
*
* @return bool isHeroic
*/
int IsHeroic(Eluna* /*E*/, lua_State* L, Map* map)
int IsHeroic(lua_State* L, Map* map)
{
Eluna::Push(L, map->IsHeroic());
return 1;
@@ -85,7 +85,7 @@ namespace LuaMap
*
* @return bool isRaid
*/
int IsRaid(Eluna* /*E*/, lua_State* L, Map* map)
int IsRaid(lua_State* L, Map* map)
{
Eluna::Push(L, map->IsRaid());
return 1;
@@ -96,7 +96,7 @@ namespace LuaMap
*
* @return string mapName
*/
int GetName(Eluna* /*E*/, lua_State* L, Map* map)
int GetName(lua_State* L, Map* map)
{
Eluna::Push(L, map->GetMapName());
return 1;
@@ -111,7 +111,7 @@ namespace LuaMap
* @param float y
* @return float z
*/
int GetHeight(Eluna* /*E*/, lua_State* L, Map* map)
int GetHeight(lua_State* L, Map* map)
{
float x = Eluna::CHECKVAL<float>(L, 2);
float y = Eluna::CHECKVAL<float>(L, 3);
@@ -133,7 +133,7 @@ namespace LuaMap
*
* @return int32 difficulty
*/
int GetDifficulty(Eluna* /*E*/, lua_State* L, Map* map)
int GetDifficulty(lua_State* L, Map* map)
{
#ifndef CLASSIC
Eluna::Push(L, map->GetDifficulty());
@@ -148,7 +148,7 @@ namespace LuaMap
*
* @return uint32 instanceId
*/
int GetInstanceId(Eluna* /*E*/, lua_State* L, Map* map)
int GetInstanceId(lua_State* L, Map* map)
{
Eluna::Push(L, map->GetInstanceId());
return 1;
@@ -159,7 +159,7 @@ namespace LuaMap
*
* @return uint32 playerCount
*/
int GetPlayerCount(Eluna* /*E*/, lua_State* L, Map* map)
int GetPlayerCount(lua_State* L, Map* map)
{
Eluna::Push(L, map->GetPlayersCountExceptGMs());
return 1;
@@ -170,7 +170,7 @@ namespace LuaMap
*
* @return uint32 mapId
*/
int GetMapId(Eluna* /*E*/, lua_State* L, Map* map)
int GetMapId(lua_State* L, Map* map)
{
Eluna::Push(L, map->GetId());
return 1;
@@ -184,7 +184,7 @@ namespace LuaMap
* @param float z
* @return uint32 areaId
*/
int GetAreaId(Eluna* /*E*/, lua_State* L, Map* map)
int GetAreaId(lua_State* L, Map* map)
{
float x = Eluna::CHECKVAL<float>(L, 2);
float y = Eluna::CHECKVAL<float>(L, 3);
@@ -203,7 +203,7 @@ namespace LuaMap
*
* @param uint64 guid
*/
int GetWorldObject(Eluna* /*E*/, lua_State* L, Map* map)
int GetWorldObject(lua_State* L, Map* map)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
@@ -257,7 +257,7 @@ namespace LuaMap
* @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*/, lua_State* L, Map* map)
int SetWeather(lua_State* L, Map* map)
{
uint32 zoneId = Eluna::CHECKVAL<uint32>(L, 2);
uint32 weatherType = Eluna::CHECKVAL<uint32>(L, 3);
@@ -284,7 +284,7 @@ namespace LuaMap
*
* @return table instance_data : instance data table, or `nil`
*/
int GetInstanceData(Eluna* E, lua_State* L, Map* map)
int GetInstanceData(lua_State* L, Map* map)
{
#ifdef TRINITY
ElunaInstanceAI* iAI = NULL;
@@ -295,7 +295,7 @@ namespace LuaMap
#endif
if (iAI)
sEluna->PushInstanceData(L, iAI, false);
Eluna::GetEluna(L)->PushInstanceData(L, iAI, false);
else
Eluna::Push(L); // nil
@@ -305,7 +305,7 @@ namespace LuaMap
/**
* Saves the [Map]'s instance data to the database.
*/
int SaveInstanceData(Eluna* E, lua_State* L, Map* map)
int SaveInstanceData(lua_State* L, Map* map)
{
#ifdef TRINITY
ElunaInstanceAI* iAI = NULL;

View File

@@ -31,7 +31,7 @@ namespace LuaObject
* @param uint32 flag : the flag to check for in the flags data
* @return bool hasFlag
*/
int HasFlag(Eluna* /*E*/, lua_State* L, Object* obj)
int HasFlag(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint32 flag = Eluna::CHECKVAL<uint32>(L, 3);
@@ -45,7 +45,7 @@ namespace LuaObject
*
* @return bool inWorld
*/
int IsInWorld(Eluna* /*E*/, lua_State* L, Object* obj)
int IsInWorld(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->IsInWorld());
return 1;
@@ -57,7 +57,7 @@ namespace LuaObject
* @param uint16 index
* @return int32 value
*/
int GetInt32Value(Eluna* /*E*/, lua_State* L, Object* obj)
int GetInt32Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
Eluna::Push(L, obj->GetInt32Value(index));
@@ -70,7 +70,7 @@ namespace LuaObject
* @param uint16 index
* @return uint32 value
*/
int GetUInt32Value(Eluna* /*E*/, lua_State* L, Object* obj)
int GetUInt32Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
Eluna::Push(L, obj->GetUInt32Value(index));
@@ -83,7 +83,7 @@ namespace LuaObject
* @param uint16 index
* @return float value
*/
int GetFloatValue(Eluna* /*E*/, lua_State* L, Object* obj)
int GetFloatValue(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
Eluna::Push(L, obj->GetFloatValue(index));
@@ -99,7 +99,7 @@ namespace LuaObject
* @param uint8 offset : should be 0, 1, 2, or 3
* @return uint8 value
*/
int GetByteValue(Eluna* /*E*/, lua_State* L, Object* obj)
int GetByteValue(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
@@ -116,7 +116,7 @@ namespace LuaObject
* @param uint8 offset : should be 0 or 1
* @return uint16 value
*/
int GetUInt16Value(Eluna* /*E*/, lua_State* L, Object* obj)
int GetUInt16Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
@@ -131,7 +131,7 @@ namespace LuaObject
*
* @return float scale
*/
int GetScale(Eluna* /*E*/, lua_State* L, Object* obj)
int GetScale(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->GetObjectScale());
return 1;
@@ -144,7 +144,7 @@ namespace LuaObject
*
* @return uint32 entry
*/
int GetEntry(Eluna* /*E*/, lua_State* L, Object* obj)
int GetEntry(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->GetEntry());
return 1;
@@ -162,7 +162,7 @@ namespace LuaObject
*
* @return uint64 guid
*/
int GetGUID(Eluna* /*E*/, lua_State* L, Object* obj)
int GetGUID(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->GET_GUID());
return 1;
@@ -180,7 +180,7 @@ namespace LuaObject
*
* @return uint32 guidLow
*/
int GetGUIDLow(Eluna* /*E*/, lua_State* L, Object* obj)
int GetGUIDLow(lua_State* L, Object* obj)
{
#ifdef TRINITY
Eluna::Push(L, obj->GetGUID().GetCounter());
@@ -207,7 +207,7 @@ namespace LuaObject
*
* @return uint8 typeID
*/
int GetTypeId(Eluna* /*E*/, lua_State* L, Object* obj)
int GetTypeId(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->GetTypeId());
return 1;
@@ -219,7 +219,7 @@ namespace LuaObject
* @param uint16 index
* @return uint64 value
*/
int GetUInt64Value(Eluna* /*E*/, lua_State* L, Object* obj)
int GetUInt64Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
obj->GetUInt64Value(index);
@@ -236,7 +236,7 @@ namespace LuaObject
* @param uint16 index
* @param uint32 value
*/
int SetFlag(Eluna* /*E*/, lua_State* L, Object* obj)
int SetFlag(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint32 flag = Eluna::CHECKVAL<uint32>(L, 3);
@@ -251,7 +251,7 @@ namespace LuaObject
* @param uint16 index
* @param int32 value
*/
int SetInt32Value(Eluna* /*E*/, lua_State* L, Object* obj)
int SetInt32Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
int32 value = Eluna::CHECKVAL<int32>(L, 3);
@@ -265,7 +265,7 @@ namespace LuaObject
* @param uint16 index
* @param uint32 value
*/
int SetUInt32Value(Eluna* /*E*/, lua_State* L, Object* obj)
int SetUInt32Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint32 value = Eluna::CHECKVAL<uint32>(L, 3);
@@ -279,7 +279,7 @@ namespace LuaObject
* @param uint16 index
* @param uint32 value
*/
int UpdateUInt32Value(Eluna* /*E*/, lua_State* L, Object* obj)
int UpdateUInt32Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint32 value = Eluna::CHECKVAL<uint32>(L, 3);
@@ -293,7 +293,7 @@ namespace LuaObject
* @param uint16 index
* @param float value
*/
int SetFloatValue(Eluna* /*E*/, lua_State* L, Object* obj)
int SetFloatValue(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
float value = Eluna::CHECKVAL<float>(L, 3);
@@ -309,7 +309,7 @@ namespace LuaObject
* @param uint8 offset : should be 0, 1, 2, or 3
* @param uint8 value
*/
int SetByteValue(Eluna* /*E*/, lua_State* L, Object* obj)
int SetByteValue(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
@@ -325,7 +325,7 @@ namespace LuaObject
* @param uint8 offset : should be 0 or 1
* @param uint16 value
*/
int SetUInt16Value(Eluna* /*E*/, lua_State* L, Object* obj)
int SetUInt16Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
@@ -341,7 +341,7 @@ namespace LuaObject
* @param uint8 offset : should be 0 or 1
* @param int16 value
*/
int SetInt16Value(Eluna* /*E*/, lua_State* L, Object* obj)
int SetInt16Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
@@ -355,7 +355,7 @@ namespace LuaObject
*
* @param float scale
*/
int SetScale(Eluna* /*E*/, lua_State* L, Object* obj)
int SetScale(lua_State* L, Object* obj)
{
float size = Eluna::CHECKVAL<float>(L, 2);
@@ -369,7 +369,7 @@ namespace LuaObject
* @param uint16 index
* @param uint64 value
*/
int SetUInt64Value(Eluna* /*E*/, lua_State* L, Object* obj)
int SetUInt64Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint64 value = Eluna::CHECKVAL<uint64>(L, 3);
@@ -383,7 +383,7 @@ namespace LuaObject
* @param uint16 index
* @param uint32 flag
*/
int RemoveFlag(Eluna* /*E*/, lua_State* L, Object* obj)
int RemoveFlag(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint32 flag = Eluna::CHECKVAL<uint32>(L, 3);
@@ -399,7 +399,7 @@ namespace LuaObject
*
* @return [Corpse] corpse : the [Object] as a [Corpse], or `nil`
*/
int ToCorpse(Eluna* /*E*/, lua_State* L, Object* obj)
int ToCorpse(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->ToCorpse());
return 1;
@@ -412,7 +412,7 @@ namespace LuaObject
*
* @return [GameObject] gameObject : the [Object] as a [GameObject], or `nil`
*/
int ToGameObject(Eluna* /*E*/, lua_State* L, Object* obj)
int ToGameObject(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->ToGameObject());
return 1;
@@ -425,7 +425,7 @@ namespace LuaObject
*
* @return [Unit] unit : the [Object] as a [Unit], or `nil`
*/
int ToUnit(Eluna* /*E*/, lua_State* L, Object* obj)
int ToUnit(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->ToUnit());
return 1;
@@ -438,7 +438,7 @@ namespace LuaObject
*
* @return [Creature] creature : the [Object] as a [Creature], or `nil`
*/
int ToCreature(Eluna* /*E*/, lua_State* L, Object* obj)
int ToCreature(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->ToCreature());
return 1;
@@ -451,7 +451,7 @@ namespace LuaObject
*
* @return [Player] player : the [Object] as a [Player], or `nil`
*/
int ToPlayer(Eluna* /*E*/, lua_State* L, Object* obj)
int ToPlayer(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->ToPlayer());
return 1;

File diff suppressed because it is too large Load Diff

View File

@@ -49,7 +49,7 @@ namespace LuaQuest
* @param [QuestFlags] flag : all available flags can be seen above
* @return bool hasFlag
*/
int HasFlag(Eluna* /*E*/, lua_State* L, Quest* quest)
int HasFlag(lua_State* L, Quest* quest)
{
uint32 flag = Eluna::CHECKVAL<uint32>(L, 2);
#ifndef TRINITY
@@ -66,7 +66,7 @@ namespace LuaQuest
*
* @return bool isDaily
*/
int IsDaily(Eluna* /*E*/, lua_State* L, Quest* quest)
int IsDaily(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->IsDaily());
return 1;
@@ -78,7 +78,7 @@ namespace LuaQuest
*
* @return bool isRepeatable
*/
int IsRepeatable(Eluna* /*E*/, lua_State* L, Quest* quest)
int IsRepeatable(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->IsRepeatable());
return 1;
@@ -89,7 +89,7 @@ namespace LuaQuest
*
* @return uint32 entryId
*/
int GetId(Eluna* /*E*/, lua_State* L, Quest* quest)
int GetId(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->GetQuestId());
return 1;
@@ -100,7 +100,7 @@ namespace LuaQuest
*
* @return uint32 level
*/
int GetLevel(Eluna* /*E*/, lua_State* L, Quest* quest)
int GetLevel(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->GetQuestLevel());
return 1;
@@ -111,7 +111,7 @@ namespace LuaQuest
*
* @return uint32 minLevel
*/
int GetMinLevel(Eluna* /*E*/, lua_State* L, Quest* quest)
int GetMinLevel(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->GetMinLevel());
return 1;
@@ -122,7 +122,7 @@ namespace LuaQuest
*
* @return int32 entryId
*/
int GetNextQuestId(Eluna* /*E*/, lua_State* L, Quest* quest)
int GetNextQuestId(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->GetNextQuestId());
return 1;
@@ -133,7 +133,7 @@ namespace LuaQuest
*
* @return int32 entryId
*/
int GetPrevQuestId(Eluna* /*E*/, lua_State* L, Quest* quest)
int GetPrevQuestId(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->GetPrevQuestId());
return 1;
@@ -144,7 +144,7 @@ namespace LuaQuest
*
* @return int32 entryId
*/
int GetNextQuestInChain(Eluna* /*E*/, lua_State* L, Quest* quest)
int GetNextQuestInChain(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->GetNextQuestInChain());
return 1;
@@ -155,7 +155,7 @@ namespace LuaQuest
*
* @return [QuestFlags] flags
*/
int GetFlags(Eluna* /*E*/, lua_State* L, Quest* quest)
int GetFlags(lua_State* L, Quest* quest)
{
#ifndef TRINITY
Eluna::Push(L, quest->GetQuestFlags());
@@ -172,13 +172,13 @@ namespace LuaQuest
*
* @return uint32 type
*/
int GetType(Eluna* /*E*/, lua_State* L, Quest* quest)
int GetType(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->GetType());
return 1;
}
/*int GetMaxLevel(Eluna* E, lua_State* L, Quest* quest)
/*int GetMaxLevel(lua_State* L, Quest* quest)
{
Eluna::Push(L, quest->GetMaxLevel());
return 1;

View File

@@ -19,7 +19,7 @@ namespace LuaSpell
*
* @return bool isAutoRepeating
*/
int IsAutoRepeat(Eluna* /*E*/, lua_State* L, Spell* spell)
int IsAutoRepeat(lua_State* L, Spell* spell)
{
Eluna::Push(L, spell->IsAutoRepeat());
return 1;
@@ -30,7 +30,7 @@ namespace LuaSpell
*
* @return [Unit] caster
*/
int GetCaster(Eluna* /*E*/, lua_State* L, Spell* spell)
int GetCaster(lua_State* L, Spell* spell)
{
Eluna::Push(L, spell->GetCaster());
return 1;
@@ -41,7 +41,7 @@ namespace LuaSpell
*
* @return int32 castTime
*/
int GetCastTime(Eluna* /*E*/, lua_State* L, Spell* spell)
int GetCastTime(lua_State* L, Spell* spell)
{
Eluna::Push(L, spell->GetCastTime());
return 1;
@@ -52,7 +52,7 @@ namespace LuaSpell
*
* @return uint32 entryId
*/
int GetEntry(Eluna* /*E*/, lua_State* L, Spell* spell)
int GetEntry(lua_State* L, Spell* spell)
{
Eluna::Push(L, spell->m_spellInfo->Id);
return 1;
@@ -63,7 +63,7 @@ namespace LuaSpell
*
* @return uint32 powerCost
*/
int GetPowerCost(Eluna* /*E*/, lua_State* L, Spell* spell)
int GetPowerCost(lua_State* L, Spell* spell)
{
Eluna::Push(L, spell->GetPowerCost());
return 1;
@@ -74,7 +74,7 @@ namespace LuaSpell
*
* @return int32 duration
*/
int GetDuration(Eluna* /*E*/, lua_State* L, Spell* spell)
int GetDuration(lua_State* L, Spell* spell)
{
#ifndef TRINITY
Eluna::Push(L, GetSpellDuration(spell->m_spellInfo));
@@ -91,7 +91,7 @@ namespace LuaSpell
* @return float y : y coordinate of the [Spell]
* @return float z : z coordinate of the [Spell]
*/
int GetTargetDest(Eluna* /*E*/, lua_State* L, Spell* spell)
int GetTargetDest(lua_State* L, Spell* spell)
{
#ifndef TRINITY
if (!(spell->m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION))
@@ -122,7 +122,7 @@ namespace LuaSpell
*
* @return [Object] target
*/
int GetTarget(Eluna* /*E*/, lua_State* L, Spell* spell)
int GetTarget(lua_State* L, Spell* spell)
{
#ifndef TRINITY
if (GameObject* target = spell->m_targets.getGOTarget())
@@ -153,7 +153,7 @@ namespace LuaSpell
*
* @param bool repeat : set variable to 'true' for spell to automatically repeat
*/
int SetAutoRepeat(Eluna* /*E*/, lua_State* L, Spell* spell)
int SetAutoRepeat(lua_State* L, Spell* spell)
{
bool repeat = Eluna::CHECKVAL<bool>(L, 2);
spell->SetAutoRepeat(repeat);
@@ -165,7 +165,7 @@ 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*/, lua_State* L, Spell* spell)
int Cast(lua_State* L, Spell* spell)
{
bool skipCheck = Eluna::CHECKVAL<bool>(L, 2, false);
spell->cast(skipCheck);
@@ -175,7 +175,7 @@ namespace LuaSpell
/**
* Cancels the [Spell].
*/
int Cancel(Eluna* /*E*/, lua_State* /*L*/, Spell* spell)
int Cancel(lua_State* /*L*/, Spell* spell)
{
spell->cancel();
return 0;
@@ -184,7 +184,7 @@ namespace LuaSpell
/**
* Finishes the [Spell].
*/
int Finish(Eluna* /*E*/, lua_State* /*L*/, Spell* spell)
int Finish(lua_State* /*L*/, Spell* spell)
{
spell->finish();
return 0;

File diff suppressed because it is too large Load Diff

View File

@@ -20,7 +20,7 @@ namespace LuaVehicle
* @param [Unit] passenger
* @return bool isOnBoard
*/
int IsOnBoard(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
int IsOnBoard(lua_State* L, Vehicle* vehicle)
{
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
#ifndef TRINITY
@@ -36,7 +36,7 @@ namespace LuaVehicle
*
* @return [Unit] owner
*/
int GetOwner(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
int GetOwner(lua_State* L, Vehicle* vehicle)
{
#ifndef TRINITY
Eluna::Push(L, vehicle->GetOwner());
@@ -51,7 +51,7 @@ namespace LuaVehicle
*
* @return uint32 entry
*/
int GetEntry(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
int GetEntry(lua_State* L, Vehicle* vehicle)
{
#ifndef TRINITY
Eluna::Push(L, vehicle->GetVehicleEntry()->m_ID);
@@ -67,7 +67,7 @@ namespace LuaVehicle
* @param int8 seat
* @return [Unit] passenger
*/
int GetPassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
int GetPassenger(lua_State* L, Vehicle* vehicle)
{
int8 seatId = Eluna::CHECKVAL<int8>(L, 2);
Eluna::Push(L, vehicle->GetPassenger(seatId));
@@ -80,7 +80,7 @@ namespace LuaVehicle
* @param [Unit] passenger
* @param int8 seat
*/
int AddPassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
int AddPassenger(lua_State* L, Vehicle* vehicle)
{
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
int8 seatId = Eluna::CHECKVAL<int8>(L, 3);
@@ -98,7 +98,7 @@ namespace LuaVehicle
*
* @param [Unit] passenger
*/
int RemovePassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
int RemovePassenger(lua_State* L, Vehicle* vehicle)
{
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
#ifndef TRINITY

View File

@@ -17,7 +17,7 @@ namespace LuaWorldObject
*
* @return string name
*/
int GetName(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetName(lua_State* L, WorldObject* obj)
{
Eluna::Push(L, obj->GetName());
return 1;
@@ -28,7 +28,7 @@ namespace LuaWorldObject
*
* @return [Map] mapObject
*/
int GetMap(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetMap(lua_State* L, WorldObject* obj)
{
Eluna::Push(L, obj->GetMap());
return 1;
@@ -40,7 +40,7 @@ namespace LuaWorldObject
*
* @return uint32 phase
*/
int GetPhaseMask(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetPhaseMask(lua_State* L, WorldObject* obj)
{
Eluna::Push(L, obj->GetPhaseMask());
return 1;
@@ -52,7 +52,7 @@ namespace LuaWorldObject
* @param uint32 phaseMask
* @param bool update = true : update visibility to nearby objects
*/
int SetPhaseMask(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int SetPhaseMask(lua_State* L, WorldObject* obj)
{
uint32 phaseMask = Eluna::CHECKVAL<uint32>(L, 2);
bool update = Eluna::CHECKVAL<bool>(L, 3, true);
@@ -66,7 +66,7 @@ namespace LuaWorldObject
*
* @return uint32 instanceId
*/
int GetInstanceId(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetInstanceId(lua_State* L, WorldObject* obj)
{
Eluna::Push(L, obj->GetInstanceId());
return 1;
@@ -77,7 +77,7 @@ namespace LuaWorldObject
*
* @return uint32 areaId
*/
int GetAreaId(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetAreaId(lua_State* L, WorldObject* obj)
{
Eluna::Push(L, obj->GetAreaId());
return 1;
@@ -88,7 +88,7 @@ namespace LuaWorldObject
*
* @return uint32 zoneId
*/
int GetZoneId(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetZoneId(lua_State* L, WorldObject* obj)
{
Eluna::Push(L, obj->GetZoneId());
return 1;
@@ -99,7 +99,7 @@ namespace LuaWorldObject
*
* @return uint32 mapId
*/
int GetMapId(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetMapId(lua_State* L, WorldObject* obj)
{
Eluna::Push(L, obj->GetMapId());
return 1;
@@ -110,7 +110,7 @@ namespace LuaWorldObject
*
* @return float x
*/
int GetX(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetX(lua_State* L, WorldObject* obj)
{
Eluna::Push(L, obj->GetPositionX());
return 1;
@@ -121,7 +121,7 @@ namespace LuaWorldObject
*
* @return float y
*/
int GetY(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetY(lua_State* L, WorldObject* obj)
{
Eluna::Push(L, obj->GetPositionY());
return 1;
@@ -132,7 +132,7 @@ namespace LuaWorldObject
*
* @return float z
*/
int GetZ(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetZ(lua_State* L, WorldObject* obj)
{
Eluna::Push(L, obj->GetPositionZ());
return 1;
@@ -143,7 +143,7 @@ namespace LuaWorldObject
*
* @return float orientation / facing
*/
int GetO(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetO(lua_State* L, WorldObject* obj)
{
Eluna::Push(L, obj->GetOrientation());
return 1;
@@ -157,7 +157,7 @@ namespace LuaWorldObject
* @return float z : z coordinate (height) of the [WorldObject]
* @return float o : facing / orientation of the [WorldObject]
*/
int GetLocation(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetLocation(lua_State* L, WorldObject* obj)
{
Eluna::Push(L, obj->GetPositionX());
Eluna::Push(L, obj->GetPositionY());
@@ -175,7 +175,7 @@ namespace LuaWorldObject
*
* @return [Player] nearestPlayer
*/
int GetNearestPlayer(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetNearestPlayer(lua_State* L, WorldObject* obj)
{
float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
uint32 hostile = Eluna::CHECKVAL<uint32>(L, 3, 0);
@@ -204,7 +204,7 @@ namespace LuaWorldObject
*
* @return [GameObject] nearestGameObject
*/
int GetNearestGameObject(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetNearestGameObject(lua_State* L, WorldObject* obj)
{
float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
uint32 entry = Eluna::CHECKVAL<uint32>(L, 3, 0);
@@ -234,7 +234,7 @@ namespace LuaWorldObject
*
* @return [Creature] nearestCreature
*/
int GetNearestCreature(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetNearestCreature(lua_State* L, WorldObject* obj)
{
float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
uint32 entry = Eluna::CHECKVAL<uint32>(L, 3, 0);
@@ -264,7 +264,7 @@ namespace LuaWorldObject
*
* @return table playersInRange : table of [Player]s
*/
int GetPlayersInRange(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetPlayersInRange(lua_State* L, WorldObject* obj)
{
float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
uint32 hostile = Eluna::CHECKVAL<uint32>(L, 3, 0);
@@ -305,7 +305,7 @@ namespace LuaWorldObject
*
* @return table creaturesInRange : table of [Creature]s
*/
int GetCreaturesInRange(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetCreaturesInRange(lua_State* L, WorldObject* obj)
{
float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
uint32 entry = Eluna::CHECKVAL<uint32>(L, 3, 0);
@@ -346,7 +346,7 @@ namespace LuaWorldObject
*
* @return table gameObjectsInRange : table of [GameObject]s
*/
int GetGameObjectsInRange(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetGameObjectsInRange(lua_State* L, WorldObject* obj)
{
float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
uint32 entry = Eluna::CHECKVAL<uint32>(L, 3, 0);
@@ -389,7 +389,7 @@ namespace LuaWorldObject
*
* @return [WorldObject] worldObject
*/
int GetNearObject(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetNearObject(lua_State* L, WorldObject* obj)
{
float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
uint16 type = Eluna::CHECKVAL<uint16>(L, 3, 0); // TypeMask
@@ -426,7 +426,7 @@ namespace LuaWorldObject
*
* @return table worldObjectList : table of [WorldObject]s
*/
int GetNearObjects(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetNearObjects(lua_State* L, WorldObject* obj)
{
float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
uint16 type = Eluna::CHECKVAL<uint16>(L, 3, 0); // TypeMask
@@ -477,7 +477,7 @@ namespace LuaWorldObject
*
* @return float dist : the distance in yards
*/
int GetDistance(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetDistance(lua_State* L, WorldObject* obj)
{
WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2, false);
if (target && target->IsInWorld())
@@ -507,7 +507,7 @@ namespace LuaWorldObject
*
* @return float dist : the distance in yards
*/
int GetExactDistance(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetExactDistance(lua_State* L, WorldObject* obj)
{
float x, y, z;
obj->GetPosition(x, y, z);
@@ -545,7 +545,7 @@ namespace LuaWorldObject
*
* @return float dist : the distance in yards
*/
int GetDistance2d(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetDistance2d(lua_State* L, WorldObject* obj)
{
WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2, false);
if (target && target->IsInWorld())
@@ -573,7 +573,7 @@ namespace LuaWorldObject
*
* @return float dist : the distance in yards
*/
int GetExactDistance2d(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetExactDistance2d(lua_State* L, WorldObject* obj)
{
float x, y, z;
obj->GetPosition(x, y, z);
@@ -605,7 +605,7 @@ namespace LuaWorldObject
* @return float y
* @return float z
*/
int GetRelativePoint(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetRelativePoint(lua_State* L, WorldObject* obj)
{
float dist = Eluna::CHECKVAL<float>(L, 2);
float rad = Eluna::CHECKVAL<float>(L, 3);
@@ -633,7 +633,7 @@ namespace LuaWorldObject
*
* @return float angle : angle in radians in range 0..2*pi
*/
int GetAngle(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int GetAngle(lua_State* L, WorldObject* obj)
{
WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2, false);
@@ -653,7 +653,7 @@ namespace LuaWorldObject
*
* @param [WorldPacket] packet
*/
int SendPacket(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int SendPacket(lua_State* L, WorldObject* obj)
{
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
#ifdef CMANGOS
@@ -675,7 +675,7 @@ namespace LuaWorldObject
* @param uint32 respawnDelay = 30 : respawn time in seconds
* @return [GameObject] gameObject
*/
int SummonGameObject(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int SummonGameObject(lua_State* L, WorldObject* obj)
{
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
float x = Eluna::CHECKVAL<float>(L, 3);
@@ -718,7 +718,7 @@ namespace LuaWorldObject
* @param uint32 despawnTimer = 0 : despawn time in milliseconds
* @return [Creature] spawnedCreature
*/
int SpawnCreature(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int SpawnCreature(lua_State* L, WorldObject* obj)
{
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
float x = Eluna::CHECKVAL<float>(L, 3);
@@ -787,7 +787,7 @@ 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*/, lua_State* L, WorldObject* obj)
int RegisterEvent(lua_State* L, WorldObject* obj)
{
luaL_checktype(L, 2, LUA_TFUNCTION);
uint32 delay = Eluna::CHECKVAL<uint32>(L, 3);
@@ -808,7 +808,7 @@ namespace LuaWorldObject
*
* @param int eventId : event Id to remove
*/
int RemoveEventById(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int RemoveEventById(lua_State* L, WorldObject* obj)
{
int eventId = Eluna::CHECKVAL<int>(L, 2);
obj->elunaEvents->SetState(eventId, LUAEVENT_STATE_ABORT);
@@ -819,7 +819,7 @@ namespace LuaWorldObject
* Removes all timed events from a [WorldObject]
*
*/
int RemoveEvents(Eluna* /*E*/, lua_State* /*L*/, WorldObject* obj)
int RemoveEvents(lua_State* /*L*/, WorldObject* obj)
{
obj->elunaEvents->SetStates(LUAEVENT_STATE_ABORT);
return 0;
@@ -837,7 +837,7 @@ namespace LuaWorldObject
* @param float z
* @return bool isInLoS
*/
int IsWithinLoS(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int IsWithinLoS(lua_State* L, WorldObject* obj)
{
WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2, false);
@@ -865,7 +865,7 @@ namespace LuaWorldObject
* @param uint32 music : entry of a music
* @param [Player] player = nil : [Player] to play the music to
*/
int PlayMusic(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int PlayMusic(lua_State* L, WorldObject* obj)
{
uint32 musicid = Eluna::CHECKVAL<uint32>(L, 2);
Player* player = Eluna::CHECKOBJ<Player>(L, 3, false);
@@ -897,7 +897,7 @@ namespace LuaWorldObject
* @param uint32 sound : entry of a sound
* @param [Player] player = nil : [Player] to play the sound to
*/
int PlayDirectSound(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int PlayDirectSound(lua_State* L, WorldObject* obj)
{
uint32 soundId = Eluna::CHECKVAL<uint32>(L, 2);
Player* player = Eluna::CHECKOBJ<Player>(L, 3, false);
@@ -923,7 +923,7 @@ namespace LuaWorldObject
* @param uint32 sound : entry of a sound
* @param [Player] player = nil : [Player] to play the sound to
*/
int PlayDistanceSound(Eluna* /*E*/, lua_State* L, WorldObject* obj)
int PlayDistanceSound(lua_State* L, WorldObject* obj)
{
uint32 soundId = Eluna::CHECKVAL<uint32>(L, 2);
Player* player = Eluna::CHECKOBJ<Player>(L, 3, false);

View File

@@ -25,7 +25,7 @@ namespace LuaPacket
*
* @return uint16 opcode
*/
int GetOpcode(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int GetOpcode(lua_State* L, WorldPacket* packet)
{
Eluna::Push(L, packet->GetOpcode());
return 1;
@@ -36,7 +36,7 @@ namespace LuaPacket
*
* @return uint32 size
*/
int GetSize(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int GetSize(lua_State* L, WorldPacket* packet)
{
Eluna::Push(L, packet->size());
return 1;
@@ -47,7 +47,7 @@ namespace LuaPacket
*
* @param [Opcodes] opcode : see Opcodes.h for all known opcodes
*/
int SetOpcode(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int SetOpcode(lua_State* L, WorldPacket* packet)
{
uint32 opcode = Eluna::CHECKVAL<uint32>(L, 2);
if (opcode >= NUM_MSG_TYPES)
@@ -61,7 +61,7 @@ namespace LuaPacket
*
* @return int8 value
*/
int ReadByte(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadByte(lua_State* L, WorldPacket* packet)
{
int8 _byte;
(*packet) >> _byte;
@@ -74,7 +74,7 @@ namespace LuaPacket
*
* @return uint8 value
*/
int ReadUByte(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadUByte(lua_State* L, WorldPacket* packet)
{
uint8 _ubyte;
(*packet) >> _ubyte;
@@ -87,7 +87,7 @@ namespace LuaPacket
*
* @return int16 value
*/
int ReadShort(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadShort(lua_State* L, WorldPacket* packet)
{
int16 _short;
(*packet) >> _short;
@@ -100,7 +100,7 @@ namespace LuaPacket
*
* @return uint16 value
*/
int ReadUShort(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadUShort(lua_State* L, WorldPacket* packet)
{
uint16 _ushort;
(*packet) >> _ushort;
@@ -113,7 +113,7 @@ namespace LuaPacket
*
* @return int32 value
*/
int ReadLong(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadLong(lua_State* L, WorldPacket* packet)
{
int32 _long;
(*packet) >> _long;
@@ -126,7 +126,7 @@ namespace LuaPacket
*
* @return uint32 value
*/
int ReadULong(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadULong(lua_State* L, WorldPacket* packet)
{
uint32 _ulong;
(*packet) >> _ulong;
@@ -139,7 +139,7 @@ namespace LuaPacket
*
* @return float value
*/
int ReadFloat(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadFloat(lua_State* L, WorldPacket* packet)
{
float _val;
(*packet) >> _val;
@@ -152,7 +152,7 @@ namespace LuaPacket
*
* @return double value
*/
int ReadDouble(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadDouble(lua_State* L, WorldPacket* packet)
{
double _val;
(*packet) >> _val;
@@ -165,7 +165,7 @@ namespace LuaPacket
*
* @return uint64 value : value returned as string
*/
int ReadGUID(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadGUID(lua_State* L, WorldPacket* packet)
{
uint64 guid;
(*packet) >> guid;
@@ -178,7 +178,7 @@ namespace LuaPacket
*
* @return string value
*/
int ReadString(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadString(lua_State* L, WorldPacket* packet)
{
std::string _val;
(*packet) >> _val;
@@ -191,7 +191,7 @@ namespace LuaPacket
*
* @param uint64 value : the value to be written to the [WorldPacket]
*/
int WriteGUID(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteGUID(lua_State* L, WorldPacket* packet)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
(*packet) << guid;
@@ -203,7 +203,7 @@ namespace LuaPacket
*
* @param string value : the string to be written to the [WorldPacket]
*/
int WriteString(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteString(lua_State* L, WorldPacket* packet)
{
std::string _val = Eluna::CHECKVAL<std::string>(L, 2);
(*packet) << _val;
@@ -215,7 +215,7 @@ namespace LuaPacket
*
* @param int8 value : the int8 value to be written to the [WorldPacket]
*/
int WriteByte(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteByte(lua_State* L, WorldPacket* packet)
{
int8 byte = Eluna::CHECKVAL<int8>(L, 2);
(*packet) << byte;
@@ -227,7 +227,7 @@ namespace LuaPacket
*
* @param uint8 value : the uint8 value to be written to the [WorldPacket]
*/
int WriteUByte(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteUByte(lua_State* L, WorldPacket* packet)
{
uint8 byte = Eluna::CHECKVAL<uint8>(L, 2);
(*packet) << byte;
@@ -239,7 +239,7 @@ namespace LuaPacket
*
* @param int16 value : the int16 value to be written to the [WorldPacket]
*/
int WriteShort(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteShort(lua_State* L, WorldPacket* packet)
{
int16 _short = Eluna::CHECKVAL<int16>(L, 2);
(*packet) << _short;
@@ -251,7 +251,7 @@ namespace LuaPacket
*
* @param uint16 value : the uint16 value to be written to the [WorldPacket]
*/
int WriteUShort(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteUShort(lua_State* L, WorldPacket* packet)
{
uint16 _ushort = Eluna::CHECKVAL<uint16>(L, 2);
(*packet) << _ushort;
@@ -263,7 +263,7 @@ namespace LuaPacket
*
* @param int32 value : the int32 value to be written to the [WorldPacket]
*/
int WriteLong(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteLong(lua_State* L, WorldPacket* packet)
{
int32 _long = Eluna::CHECKVAL<int32>(L, 2);
(*packet) << _long;
@@ -275,7 +275,7 @@ namespace LuaPacket
*
* @param uint32 value : the uint32 value to be written to the [WorldPacket]
*/
int WriteULong(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteULong(lua_State* L, WorldPacket* packet)
{
uint32 _ulong = Eluna::CHECKVAL<uint32>(L, 2);
(*packet) << _ulong;
@@ -287,7 +287,7 @@ namespace LuaPacket
*
* @param float value : the float value to be written to the [WorldPacket]
*/
int WriteFloat(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteFloat(lua_State* L, WorldPacket* packet)
{
float _val = Eluna::CHECKVAL<float>(L, 2);
(*packet) << _val;
@@ -299,7 +299,7 @@ namespace LuaPacket
*
* @param double value : the double value to be written to the [WorldPacket]
*/
int WriteDouble(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteDouble(lua_State* L, WorldPacket* packet)
{
double _val = Eluna::CHECKVAL<double>(L, 2);
(*packet) << _val;