Fix calling Eluna functions from coroutines.

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

View File

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