Add Creature documentation.

This commit is contained in:
Patman64
2014-08-20 22:32:46 -04:00
parent 1f73d61424
commit 6a44dab525
2 changed files with 536 additions and 157 deletions

View File

@@ -7,16 +7,32 @@
#ifndef CREATUREMETHODS_H #ifndef CREATUREMETHODS_H
#define CREATUREMETHODS_H #define CREATUREMETHODS_H
/***
* Non-[Player] controlled [Unit]s.
*/
namespace LuaCreature namespace LuaCreature
{ {
/* BOOLEAN */ /* BOOLEAN */
/**
* Returns `true` if the [Creature] is set to not give reputation when killed,
* and returns `false` otherwise.
*
* @return bool reputationDisabled
*/
int IsReputationGainDisabled(lua_State* L, Creature* creature) int IsReputationGainDisabled(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->IsReputationGainDisabled()); Eluna::Push(L, creature->IsReputationGainDisabled());
return 1; return 1;
} }
int IsRegeneratingHealth(lua_State* L, Creature* creature) /**
* Returns `true` if the [Creature] can regenerate its health out-of-combat,
* and returns `false` otherwise.
*
* @return bool regeneratesHealth
*/
int CanRegenerateHealth(lua_State* L, Creature* creature)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(L, creature->IsRegeneratingHealth()); Eluna::Push(L, creature->IsRegeneratingHealth());
@@ -26,7 +42,14 @@ namespace LuaCreature
return 1; return 1;
} }
int HasInvolvedQuest(lua_State* L, Creature* creature) /**
* Returns `true` if the [Creature] completes the [Quest] with the ID `quest_id`,
* and returns `false` otherwise.
*
* @param uint32 questID: the ID of a [Quest]
* @return bool completesQuest
*/
int CanCompleteQuest(lua_State* L, Creature* creature)
{ {
uint32 quest_id = Eluna::CHECKVAL<uint32>(L, 2); uint32 quest_id = Eluna::CHECKVAL<uint32>(L, 2);
@@ -38,18 +61,34 @@ namespace LuaCreature
return 1; return 1;
} }
/**
* Returns `true` if the [Creature] can be targeted for attack,
* and returns `false` otherwise.
*
* @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(lua_State* L, Creature* creature) int IsTargetableForAttack(lua_State* L, Creature* creature)
{ {
bool inversAlive = Eluna::CHECKVAL<bool>(L, 2); bool mustBeDead = Eluna::CHECKVAL<bool>(L, 2, false);
#ifdef MANGOS #ifdef MANGOS
Eluna::Push(L, creature->IsTargetableForAttack(inversAlive)); Eluna::Push(L, creature->IsTargetableForAttack(mustBeDead));
#else #else
Eluna::Push(L, creature->isTargetableForAttack(inversAlive)); Eluna::Push(L, creature->isTargetableForAttack(mustBeDead));
#endif #endif
return 1; return 1;
} }
/**
* Returns `true` if the [Creature] can assist `friend` in combat against `enemy`,
* and returns `false` otherwise.
*
* @param Unit friend: the Unit we will be assisting
* @param Unit enemy: the Unit that we would attack if we assist `friend`
* @param bool checkFaction = true: if `true`, the [Creature] must be the same faction as `friend` to assist
* @return bool canAssist
*/
int CanAssistTo(lua_State* L, Creature* creature) int CanAssistTo(lua_State* L, Creature* creature)
{ {
Unit* u = Eluna::CHECKOBJ<Unit>(L, 2); Unit* u = Eluna::CHECKOBJ<Unit>(L, 2);
@@ -60,12 +99,24 @@ namespace LuaCreature
return 1; return 1;
} }
/**
* Returns `true` if the [Creature] has searched for combat assistance already,
* and returns `false` otherwise.
*
* @return bool searchedForAssistance
*/
int HasSearchedAssistance(lua_State* L, Creature* creature) int HasSearchedAssistance(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->HasSearchedAssistance()); Eluna::Push(L, creature->HasSearchedAssistance());
return 1; return 1;
} }
/**
* Returns `true` if the [Creature] will give its loot to `player`,
* and returns `false` otherwise.
*
* @return bool tapped
*/
int IsTappedBy(lua_State* L, Creature* creature) int IsTappedBy(lua_State* L, Creature* creature)
{ {
Player* player = Eluna::CHECKOBJ<Player>(L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
@@ -78,6 +129,12 @@ namespace LuaCreature
return 1; return 1;
} }
/**
* Returns `true` if the [Creature] will give its loot to a [Player] or [Group],
* and returns `false` otherwise.
*
* @return bool hasLootRecipient
*/
int HasLootRecipient(lua_State* L, Creature* creature) int HasLootRecipient(lua_State* L, Creature* creature)
{ {
#ifndef TRINITY #ifndef TRINITY
@@ -88,37 +145,60 @@ namespace LuaCreature
return 1; return 1;
} }
int IsCombatAllowed(lua_State* L, Creature* creature) /**
* Returns `true` if the [Creature] can start attacking nearby hostile [Unit]s,
* and returns `false` otherwise.
*
* @return bool canInitiateAttack
*/
int CanAggro(lua_State* L, Creature* creature)
{ {
#ifndef TRINITY Eluna::Push(L, creature->CanInitiateAttack());
if (CreatureAI* ai = creature->AI())
Eluna::Push(L, ai->IsCombatMovement());
else
Eluna::Push(L, false);
#else
Eluna::Push(L, !creature->HasReactState(REACT_PASSIVE));
#endif
return 1; return 1;
} }
/**
* Returns `true` if the [Creature] can move through deep water,
* and returns `false` otherwise.
*
* @return bool canSwim
*/
int CanSwim(lua_State* L, Creature* creature) int CanSwim(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->CanSwim()); Eluna::Push(L, creature->CanSwim());
return 1; return 1;
} }
/**
* Returns `true` if the [Creature] can move on land,
* and returns `false` otherwise.
*
* @return bool canWalk
*/
int CanWalk(lua_State* L, Creature* creature) int CanWalk(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->CanWalk()); Eluna::Push(L, creature->CanWalk());
return 1; return 1;
} }
/**
* Returns `true` if the [Creature] is returning to its spawn position from combat,
* and returns `false` otherwise.
*
* @return bool inEvadeMode
*/
int IsInEvadeMode(lua_State* L, Creature* creature) int IsInEvadeMode(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->IsInEvadeMode()); Eluna::Push(L, creature->IsInEvadeMode());
return 1; return 1;
} }
/**
* Returns `true` if the [Creature]'s rank is Elite or Rare Elite,
* and returns `false` otherwise.
*
* @return bool isElite
*/
int IsElite(lua_State* L, Creature* creature) int IsElite(lua_State* L, Creature* creature)
{ {
#ifndef TRINITY #ifndef TRINITY
@@ -129,24 +209,48 @@ namespace LuaCreature
return 1; return 1;
} }
/**
* Returns `true` if the [Creature] is a city guard,
* and returns `false` otherwise.
*
* @return bool isGuard
*/
int IsGuard(lua_State* L, Creature* creature) int IsGuard(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->IsGuard()); Eluna::Push(L, creature->IsGuard());
return 1; return 1;
} }
/**
* Returns `true` if the [Creature] is a civilian,
* and returns `false` otherwise.
*
* @return bool isCivilian
*/
int IsCivilian(lua_State* L, Creature* creature) int IsCivilian(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->IsCivilian()); Eluna::Push(L, creature->IsCivilian());
return 1; return 1;
} }
/**
* Returns `true` if the [Creature] is the leader of a player faction,
* and returns `false` otherwise.
*
* @return bool isLeader
*/
int IsRacialLeader(lua_State* L, Creature* creature) int IsRacialLeader(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->IsRacialLeader()); Eluna::Push(L, creature->IsRacialLeader());
return 1; return 1;
} }
/**
* Returns `true` if the [Creature]'s rank is Boss,
* and returns `false` otherwise.
*
* @return bool isWorldBoss
*/
int IsWorldBoss(lua_State* L, Creature* creature) int IsWorldBoss(lua_State* L, Creature* creature)
{ {
#ifndef TRINITY #ifndef TRINITY
@@ -157,6 +261,13 @@ namespace LuaCreature
return 1; return 1;
} }
/**
* Returns `true` if the [Creature] cannot cast `spellId` due to a category cooldown,
* and returns `false` otherwise.
*
* @param uint32 spellId: the ID of a [Spell]
* @return bool hasCooldown
*/
int HasCategoryCooldown(lua_State* L, Creature* creature) int HasCategoryCooldown(lua_State* L, Creature* creature)
{ {
uint32 spell = Eluna::CHECKVAL<uint32>(L, 2); uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
@@ -165,6 +276,13 @@ namespace LuaCreature
return 1; return 1;
} }
/**
* Returns `true` if the [Creature] can cast `spellId` when mind-controlled,
* and returns `false` otherwise.
*
* @param uint32 spellId: the ID of a [Spell]
* @return bool hasSpell
*/
int HasSpell(lua_State* L, Creature* creature) int HasSpell(lua_State* L, Creature* creature)
{ {
uint32 id = Eluna::CHECKVAL<uint32>(L, 2); uint32 id = Eluna::CHECKVAL<uint32>(L, 2);
@@ -173,6 +291,13 @@ namespace LuaCreature
return 1; return 1;
} }
/**
* Returns `true` if the [Creature] starts the [Quest] `questId`,
* and returns `false` otherwise.
*
* @param uint32 questId: the ID of a [Quest]
* @return bool hasQuest
*/
int HasQuest(lua_State* L, Creature* creature) int HasQuest(lua_State* L, Creature* creature)
{ {
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2); uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
@@ -185,6 +310,13 @@ namespace LuaCreature
return 1; return 1;
} }
/**
* Returns `true` if the [Creature] has `spellId` on cooldown,
* and returns `false` otherwise.
*
* @param uint32 spellId: the ID of a [Spell]
* @return bool hasCooldown
*/
int HasSpellCooldown(lua_State* L, Creature* creature) int HasSpellCooldown(lua_State* L, Creature* creature)
{ {
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2); uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
@@ -193,60 +325,94 @@ namespace LuaCreature
return 1; return 1;
} }
/**
* Returns `true` if the [Creature] can fly,
* and returns `false` otherwise.
*
* @return bool canFly
*/
int CanFly(lua_State* L, Creature* creature) int CanFly(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->CanFly()); Eluna::Push(L, creature->CanFly());
return 1; return 1;
} }
/*int IsTrigger(lua_State* L, Creature* creature) #ifdef TRINITY
int IsTrigger(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->IsTrigger()); Eluna::Push(L, creature->IsTrigger());
return 1; return 1;
}*/ }
/*int IsDamageEnoughForLootingAndReward(lua_State* L, Creature* creature) int IsDamageEnoughForLootingAndReward(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->IsDamageEnoughForLootingAndReward()); Eluna::Push(L, creature->IsDamageEnoughForLootingAndReward());
return 1; return 1;
}*/ }
/*int CanStartAttack(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); Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
bool force = Eluna::CHECKVAL<bool>(L, 3, true); bool force = Eluna::CHECKVAL<bool>(L, 3, true);
Eluna::Push(L, creature->CanStartAttack(target, force)); Eluna::Push(L, creature->CanStartAttack(target, force));
return 1; return 1;
}*/ }
/*int HasLootMode(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); uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
Eluna::Push(L, creature->HasLootMode(lootMode)); Eluna::Push(L, creature->HasLootMode(lootMode));
return 1; return 1;
}*/ }
#endif
/* GETTERS */ /* GETTERS */
/**
* Returns the time it takes for this [Creature] to respawn once killed.
*
* This value does not usually change over a [Creature]'s lifespan,
* but can be modified by [Creature:SetRespawnDelay].
*
* @return uint32 respawnDelay: the respawn delay, in seconds
*/
int GetRespawnDelay(lua_State* L, Creature* creature) int GetRespawnDelay(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->GetRespawnDelay()); Eluna::Push(L, creature->GetRespawnDelay());
return 1; return 1;
} }
int GetRespawnRadius(lua_State* L, Creature* creature) /**
* Returns the radius the [Creature] is permitted to wander from its
* respawn point.
*
* @return float wanderRadius
*/
int GetWanderRadius(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->GetRespawnRadius()); Eluna::Push(L, creature->GetRespawnRadius());
return 1; return 1;
} }
/**
* Returns the default movement type for this [Creature].
*
* @return MovementGeneratorType defaultMovementType
*/
int GetDefaultMovementType(lua_State* L, Creature* creature) int GetDefaultMovementType(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->GetDefaultMovementType()); Eluna::Push(L, creature->GetDefaultMovementType());
return 1; return 1;
} }
/**
* Returns the aggro range of the [Creature] for `target`.
*
* @param Unit target
* @return float aggroRange
*/
int GetAggroRange(lua_State* L, Creature* creature) int GetAggroRange(lua_State* L, Creature* creature)
{ {
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2); Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
@@ -261,6 +427,15 @@ namespace LuaCreature
return 1; return 1;
} }
/**
* Returns the effective aggro range of the [Creature] for `target`.
*
* If this is smaller than the minimum aggro range set in the config file,
* that is used as the aggro range instead.
*
* @param Unit target
* @return float attackDistance
*/
int GetAttackDistance(lua_State* L, Creature* creature) int GetAttackDistance(lua_State* L, Creature* creature)
{ {
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2); Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
@@ -269,6 +444,11 @@ namespace LuaCreature
return 1; return 1;
} }
/**
* Returns the [Group] that can loot this [Creature].
*
* @return Group lootRecipientGroup: the group or `nil`
*/
int GetLootRecipientGroup(lua_State* L, Creature* creature) int GetLootRecipientGroup(lua_State* L, Creature* creature)
{ {
#ifndef TRINITY #ifndef TRINITY
@@ -279,30 +459,67 @@ namespace LuaCreature
return 1; return 1;
} }
/**
* Returns the [Player] that can loot this [Creature].
*
* @return Player lootRecipient: the player or `nil`
*/
int GetLootRecipient(lua_State* L, Creature* creature) int GetLootRecipient(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->GetLootRecipient()); Eluna::Push(L, creature->GetLootRecipient());
return 1; return 1;
} }
/**
* Returns the [Creature]'s script name.
*
* This is used by the core to apply C++ scripts to the Creature.
*
* It is not used by Eluna.
*
* @return string scriptName
*/
int GetScriptName(lua_State* L, Creature* creature) int GetScriptName(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->GetScriptName()); Eluna::Push(L, creature->GetScriptName());
return 1; return 1;
} }
/**
* Returns the [Creature]'s AI name.
*
* This is used by the core to override the Creature's default AI.
*
* If the Creature is scripted by Eluna, this field is overriden.
*
* @return string AIName
*/
int GetAIName(lua_State* L, Creature* creature) int GetAIName(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->GetAIName()); Eluna::Push(L, creature->GetAIName());
return 1; return 1;
} }
/**
* Returns the [Creature]'s script ID.
*
* Every script name is assigned a unique ID by the core.
* This returns the ID for this [Creature]'s script name.
*
* @return uint32 scriptID
*/
int GetScriptId(lua_State* L, Creature* creature) int GetScriptId(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->GetScriptId()); Eluna::Push(L, creature->GetScriptId());
return 1; return 1;
} }
/**
* Returns the [Creature]'s cooldown for `spellID`.
*
* @param uint32 spellID
* @return uint32 cooldown: the cooldown, in milliseconds
*/
int GetCreatureSpellCooldownDelay(lua_State* L, Creature* creature) int GetCreatureSpellCooldownDelay(lua_State* L, Creature* creature)
{ {
uint32 spell = Eluna::CHECKVAL<uint32>(L, 2); uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
@@ -311,12 +528,26 @@ namespace LuaCreature
return 1; return 1;
} }
/**
* Returns the delay between when the [Creature] dies and when its body despawns.
*
* @return uint32 corpseDelay: the delay, in seconds
*/
int GetCorpseDelay(lua_State* L, Creature* creature) int GetCorpseDelay(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->GetCorpseDelay()); Eluna::Push(L, creature->GetCorpseDelay());
return 1; return 1;
} }
/**
* Returns position the [Creature] returns to when evading from combat
* or respawning.
*
* @return float x
* @return float y
* @return float z
* @return float o
*/
int GetHomePosition(lua_State* L, Creature* creature) int GetHomePosition(lua_State* L, Creature* creature)
{ {
float x, y, z, o; float x, y, z, o;
@@ -333,6 +564,23 @@ namespace LuaCreature
return 4; return 4;
} }
/**
* Returns a target from the [Creature]'s threat list based on the
* supplied arguments.
*
* For example, if you wanted to select the third-farthest [Player]
* within 50 yards that has the [Aura] "Corrupted Blood" (ID 24328),
* you could use this function like so:
*
* target = creature:GetAITarget(4, true, 3, 50, 24328)
*
* @param SelectAggroTarget targetType: how the threat list should be sorted
* @param bool playerOnly: if `true`, skips targets that aren't [Player]s
* @param uint32 position: if `targetType` is not random, used as an offset into the threat list
* @param float distance: if positive, the maximum distance for the target. If negative, the minimum distance
* @param int32 aura 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(lua_State* L, Creature* creature) int GetAITarget(lua_State* L, Creature* creature)
{ {
uint32 targetType = Eluna::CHECKVAL<uint32>(L, 2); uint32 targetType = Eluna::CHECKVAL<uint32>(L, 2);
@@ -414,6 +662,11 @@ namespace LuaCreature
return 1; return 1;
} }
/**
* Returns all [Unit]s in the [Creature]'s threat list.
*
* @return table targets
*/
int GetAITargets(lua_State* L, Creature* creature) int GetAITargets(lua_State* L, Creature* creature)
{ {
lua_newtable(L); lua_newtable(L);
@@ -442,6 +695,11 @@ namespace LuaCreature
return 1; return 1;
} }
/**
* Returns the number of [Unit]s in this [Creature]'s threat list.
*
* @return int targetsCount
*/
int GetAITargetsCount(lua_State* L, Creature* creature) int GetAITargetsCount(lua_State* L, Creature* creature)
{ {
#ifdef MANGOS #ifdef MANGOS
@@ -452,6 +710,14 @@ namespace LuaCreature
return 1; return 1;
} }
/**
* Returns the [Creature]'s NPC flags.
*
* These are used to control whether the NPC is a vendor, can repair items,
* can give quests, etc.
*
* @return NPCFlags npcFlags
*/
int GetNPCFlags(lua_State* L, Creature* creature) int GetNPCFlags(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->GetUInt32Value(UNIT_NPC_FLAGS)); Eluna::Push(L, creature->GetUInt32Value(UNIT_NPC_FLAGS));
@@ -459,6 +725,11 @@ namespace LuaCreature
} }
#ifndef CATA #ifndef CATA
/**
* Returns the [Creature]'s shield block value.
*
* @return uint32 shieldBlockValue
*/
int GetShieldBlockValue(lua_State* L, Creature* creature) int GetShieldBlockValue(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->GetShieldBlockValue()); Eluna::Push(L, creature->GetShieldBlockValue());
@@ -466,13 +737,21 @@ namespace LuaCreature
} }
#endif #endif
/*int GetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features #ifdef TRINITY
int GetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
{ {
Eluna::Push(L, creature->GetLootMode()); Eluna::Push(L, creature->GetLootMode());
return 1; return 1;
}*/ }
#endif
/* SETTERS */ /* SETTERS */
/**
* Sets the [Creature]'s NPC flags to `flags`.
*
* @param NPCFlags flags
*/
int SetNPCFlags(lua_State* L, Creature* creature) int SetNPCFlags(lua_State* L, Creature* creature)
{ {
uint32 flags = Eluna::CHECKVAL<uint32>(L, 2); uint32 flags = Eluna::CHECKVAL<uint32>(L, 2);
@@ -481,6 +760,11 @@ namespace LuaCreature
return 0; return 0;
} }
/**
* Sets the [Creature]'s death state to `deathState`.
*
* @param DeathState deathState
*/
int SetDeathState(lua_State* L, Creature* creature) int SetDeathState(lua_State* L, Creature* creature)
{ {
int32 state = Eluna::CHECKVAL<int32>(L, 2); int32 state = Eluna::CHECKVAL<int32>(L, 2);
@@ -493,6 +777,11 @@ namespace LuaCreature
return 0; return 0;
} }
/**
* Sets whether the [Creature] is currently walking or running.
*
* @param bool enable: `true` to enable walking, `false` for running
*/
int SetWalk(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); bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -501,19 +790,32 @@ namespace LuaCreature
return 0; return 0;
} }
int SetAllowedCombat(lua_State* L, Creature* creature) /**
* Sets whether the [Creature] can be aggroed by movement or not.
*
* @param bool allow: `true` to allow aggro, `false` to disable aggro
*/
int SetAggroEnabled(lua_State* L, Creature* creature)
{ {
bool allow = Eluna::CHECKVAL<bool>(L, 2); bool allow = Eluna::CHECKVAL<bool>(L, 2);
#ifndef TRINITY if (allow)
if (CreatureAI* ai = creature->AI()) {
ai->SetCombatMovement(allow); creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE);
#else }
creature->SetReactState(allow ? REACT_AGGRESSIVE : REACT_PASSIVE); else
#endif {
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE);
}
return 0; return 0;
} }
/**
* Sets whether the [Creature] gives reputation or not.
*
* @param bool disable: `true` to disable reputation, `false` to enable
*/
int SetDisableReputationGain(lua_State* L, Creature* creature) int SetDisableReputationGain(lua_State* L, Creature* creature)
{ {
bool disable = Eluna::CHECKVAL<bool>(L, 2, true); bool disable = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -522,13 +824,24 @@ namespace LuaCreature
return 0; return 0;
} }
/**
* Sets the [Creature] as in combat with all [Player]s in the dungeon instance.
*
* This is used by raid bosses to prevent Players from using out-of-combat
* actions once the encounter has begun.
*/
int SetInCombatWithZone(lua_State* /*L*/, Creature* creature) int SetInCombatWithZone(lua_State* /*L*/, Creature* creature)
{ {
creature->SetInCombatWithZone(); creature->SetInCombatWithZone();
return 0; return 0;
} }
int SetRespawnRadius(lua_State* L, Creature* creature) /**
* Sets the distance the [Creature] can wander from it's spawn point.
*
* @param float distance
*/
int SetWanderRadius(lua_State* L, Creature* creature)
{ {
float dist = Eluna::CHECKVAL<float>(L, 2); float dist = Eluna::CHECKVAL<float>(L, 2);
@@ -536,6 +849,11 @@ namespace LuaCreature
return 0; return 0;
} }
/**
* Sets the time it takes for the [Creature] to respawn when killed.
*
* @param uint32 delay: the delay, in seconds
*/
int SetRespawnDelay(lua_State* L, Creature* creature) int SetRespawnDelay(lua_State* L, Creature* creature)
{ {
uint32 delay = Eluna::CHECKVAL<uint32>(L, 2); uint32 delay = Eluna::CHECKVAL<uint32>(L, 2);
@@ -544,6 +862,11 @@ namespace LuaCreature
return 0; return 0;
} }
/**
* Sets the default movement type of the [Creature].
*
* @param MovementGeneratorType type
*/
int SetDefaultMovementType(lua_State* L, Creature* creature) int SetDefaultMovementType(lua_State* L, Creature* creature)
{ {
int32 type = Eluna::CHECKVAL<int32>(L, 2); int32 type = Eluna::CHECKVAL<int32>(L, 2);
@@ -552,6 +875,11 @@ namespace LuaCreature
return 0; return 0;
} }
/**
* Sets whether the [Creature] can search for assistance at low health or not.
*
* @param bool enable: `true` to disable searching, `false` to allow
*/
int SetNoSearchAssistance(lua_State* L, Creature* creature) int SetNoSearchAssistance(lua_State* L, Creature* creature)
{ {
bool val = Eluna::CHECKVAL<bool>(L, 2, true); bool val = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -560,6 +888,11 @@ namespace LuaCreature
return 0; return 0;
} }
/**
* Sets whether the [Creature] can call nearby enemies for help in combat or not.
*
* @param bool enable: `true` to disable calling for help, `false` to enable
*/
int SetNoCallAssistance(lua_State* L, Creature* creature) int SetNoCallAssistance(lua_State* L, Creature* creature)
{ {
bool val = Eluna::CHECKVAL<bool>(L, 2, true); bool val = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -568,6 +901,11 @@ namespace LuaCreature
return 0; return 0;
} }
/**
* Sets whether the creature is hovering or not.
*
* @param bool enable: `true` to enable hovering, `false` to disable
*/
int SetHover(lua_State* L, Creature* creature) int SetHover(lua_State* L, Creature* creature)
{ {
bool enable = Eluna::CHECKVAL<bool>(L, 2, true); bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -580,24 +918,11 @@ namespace LuaCreature
return 0; return 0;
} }
/*int SetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
{
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
creature->SetLootMode(lootMode);
return 0;
}*/
/*int SetDisableGravity(lua_State* L, Creature* creature)
{
bool disable = Eluna::CHECKVAL<bool>(L, 2, true);
bool packetOnly = Eluna::CHECKVAL<bool>(L, 3, false);
Eluna::Push(L, creature->SetDisableGravity(disable, packetOnly));
return 1;
}*/
/* OTHER */ /* OTHER */
/**
* Despawn this [Creature].
*/
int DespawnOrUnsummon(lua_State* L, Creature* creature) int DespawnOrUnsummon(lua_State* L, Creature* creature)
{ {
uint32 msTimeToDespawn = Eluna::CHECKVAL<uint32>(L, 2, 0); uint32 msTimeToDespawn = Eluna::CHECKVAL<uint32>(L, 2, 0);
@@ -610,18 +935,27 @@ namespace LuaCreature
return 0; return 0;
} }
/**
* Respawn this [Creature].
*/
int Respawn(lua_State* /*L*/, Creature* creature) int Respawn(lua_State* /*L*/, Creature* creature)
{ {
creature->Respawn(); creature->Respawn();
return 0; return 0;
} }
/**
* Remove this [Creature]'s corpse.
*/
int RemoveCorpse(lua_State* /*L*/, Creature* creature) int RemoveCorpse(lua_State* /*L*/, Creature* creature)
{ {
creature->RemoveCorpse(); creature->RemoveCorpse();
return 0; return 0;
} }
/**
* Make the [Creature] start following it's waypoint path.
*/
int MoveWaypoint(lua_State* /*L*/, Creature* creature) int MoveWaypoint(lua_State* /*L*/, Creature* creature)
{ {
#ifndef TRINITY #ifndef TRINITY
@@ -632,12 +966,20 @@ namespace LuaCreature
return 0; return 0;
} }
/**
* Make the [Creature] call for assistance in combat from other nearby [Creature]s.
*/
int CallAssistance(lua_State* /*L*/, Creature* creature) int CallAssistance(lua_State* /*L*/, Creature* creature)
{ {
creature->CallAssistance(); creature->CallAssistance();
return 0; return 0;
} }
/**
* Make the [Creature] call for help in combat from friendly [Creature]s within `radius`.
*
* @param float radius
*/
int CallForHelp(lua_State* L, Creature* creature) int CallForHelp(lua_State* L, Creature* creature)
{ {
float radius = Eluna::CHECKVAL<float>(L, 2); float radius = Eluna::CHECKVAL<float>(L, 2);
@@ -646,12 +988,20 @@ namespace LuaCreature
return 0; return 0;
} }
/**
* Make the [Creature] flee combat to get assistance from a nearby friendly [Creature].
*/
int FleeToGetAssistance(lua_State* /*L*/, Creature* creature) int FleeToGetAssistance(lua_State* /*L*/, Creature* creature)
{ {
creature->DoFleeToGetAssistance(); creature->DoFleeToGetAssistance();
return 0; return 0;
} }
/**
* Make the [Creature] attack `target`.
*
* @param Unit target
*/
int AttackStart(lua_State* L, Creature* creature) int AttackStart(lua_State* L, Creature* creature)
{ {
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2); Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
@@ -660,12 +1010,20 @@ namespace LuaCreature
return 0; return 0;
} }
/**
* Save the [Creature] in the database.
*/
int SaveToDB(lua_State* /*L*/, Creature* creature) int SaveToDB(lua_State* /*L*/, Creature* creature)
{ {
creature->SaveToDB(); creature->SaveToDB();
return 0; return 0;
} }
/**
* Make the [Creature] try to find a new target.
*
* This should be called every update cycle for the Creature's AI.
*/
int SelectVictim(lua_State* L, Creature* creature) int SelectVictim(lua_State* L, Creature* creature)
{ {
#ifndef TRINITY #ifndef TRINITY
@@ -676,6 +1034,12 @@ namespace LuaCreature
return 1; return 1;
} }
/**
* Transform the [Creature] into another Creature.
*
* @param uint32 entry: the Creature ID to transform into
* @param uint32 dataGUIDLow: use this Creature's model and equipment instead of the defaults
*/
int UpdateEntry(lua_State* L, Creature* creature) int UpdateEntry(lua_State* L, Creature* creature)
{ {
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2); uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
@@ -689,26 +1053,28 @@ namespace LuaCreature
return 0; return 0;
} }
/*int ResetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features #ifdef TRINITY
int ResetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
{ {
creature->ResetLootMode(); creature->ResetLootMode();
return 0; return 0;
}*/ }
/*int RemoveLootMode(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); uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
creature->RemoveLootMode(lootMode); creature->RemoveLootMode(lootMode);
return 0; return 0;
}*/ }
/*int AddLootMode(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); uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
creature->AddLootMode(lootMode); creature->AddLootMode(lootMode);
return 0; return 0;
}*/ }
#endif
}; };
#endif #endif

View File

@@ -708,90 +708,103 @@ ElunaRegister<Player> PlayerMethods[] =
ElunaRegister<Creature> CreatureMethods[] = ElunaRegister<Creature> CreatureMethods[] =
{ {
// Getters // Getters
{ "GetAITarget", &LuaCreature::GetAITarget }, // :GetAITarget(type[, playeronly, position, distance, aura]) - Get an unit in threat list. type can be 0 (random), 1 (topaggro), 2 (botaggro), 3 (nearest), 4 (farthest). If for example type 1 is used and position is 4, the 5th top aggro is selected, 0 is the top aggro (default). For random target position means the amount of top targets to choose from. positive distance tells that target should be within given radius, negative means target shouldnt be inside given radius. positive aura means target needs to have the aura, negative means target should not have the aura { "GetAITarget", &LuaCreature::GetAITarget },
{ "GetAITargets", &LuaCreature::GetAITargets }, // :GetAITargets() - Get units in threat list { "GetAITargets", &LuaCreature::GetAITargets },
{ "GetAITargetsCount", &LuaCreature::GetAITargetsCount }, // :GetAITargetsCount() - Get threat list size { "GetAITargetsCount", &LuaCreature::GetAITargetsCount },
{ "GetHomePosition", &LuaCreature::GetHomePosition }, // :GetHomePosition() - Returns x,y,z,o of spawn position { "GetHomePosition", &LuaCreature::GetHomePosition },
{ "GetCorpseDelay", &LuaCreature::GetCorpseDelay }, // :GetCorpseDelay() - Returns corpse delay { "GetCorpseDelay", &LuaCreature::GetCorpseDelay },
{ "GetCreatureSpellCooldownDelay", &LuaCreature::GetCreatureSpellCooldownDelay }, // :GetCreatureSpellCooldownDelay(spellId) - Returns spell cooldown delay { "GetCreatureSpellCooldownDelay", &LuaCreature::GetCreatureSpellCooldownDelay },
{ "GetScriptId", &LuaCreature::GetScriptId }, // :GetScriptId() - Returns creature's script ID { "GetScriptId", &LuaCreature::GetScriptId },
{ "GetAIName", &LuaCreature::GetAIName }, // :GetAIName() - Returns creature's AI name { "GetAIName", &LuaCreature::GetAIName },
{ "GetScriptName", &LuaCreature::GetScriptName }, // :GetScriptName() - Returns creature's script name { "GetScriptName", &LuaCreature::GetScriptName },
{ "GetAttackDistance", &LuaCreature::GetAttackDistance }, // :GetAttackDistance(unit) - Returns attack distance to unit { "GetAttackDistance", &LuaCreature::GetAttackDistance },
{ "GetAggroRange", &LuaCreature::GetAggroRange }, // :GetAggroRange(unit) - Returns aggro distance to unit { "GetAggroRange", &LuaCreature::GetAggroRange },
{ "GetDefaultMovementType", &LuaCreature::GetDefaultMovementType }, // :GetDefaultMovementType() - Returns default movement type { "GetDefaultMovementType", &LuaCreature::GetDefaultMovementType },
{ "GetRespawnDelay", &LuaCreature::GetRespawnDelay }, // :GetRespawnDelay() - Returns respawn delay { "GetRespawnDelay", &LuaCreature::GetRespawnDelay },
{ "GetRespawnRadius", &LuaCreature::GetRespawnRadius }, // :GetRespawnRadius() - Returns respawn radius { "GetWanderRadius", &LuaCreature::GetWanderRadius },
// {"GetWaypointPath", &LuaCreature::GetWaypointPath}, // :GetWaypointPath() - Returns waypoint path ID #ifdef TRINITY
// {"GetCurrentWaypointId", &LuaCreature::GetCurrentWaypointId}, // :GetCurrentWaypointId() - Returns waypoint ID { "GetWaypointPath", &LuaCreature::GetWaypointPath },
// {"GetLootMode", &LuaCreature::GetLootMode}, // :GetLootMode() - Returns loot mode { "GetCurrentWaypointId", &LuaCreature::GetCurrentWaypointId },
{ "GetLootRecipient", &LuaCreature::GetLootRecipient }, // :GetLootRecipient() - Returns loot receiver { "GetLootMode", &LuaCreature::GetLootMode },
{ "GetLootRecipientGroup", &LuaCreature::GetLootRecipientGroup }, // :GetLootRecipientGroup() - Returns loot receiver group #endif
{ "GetNPCFlags", &LuaCreature::GetNPCFlags }, // :GetNPCFlags() - Returns NPC flags { "GetLootRecipient", &LuaCreature::GetLootRecipient },
{ "GetLootRecipientGroup", &LuaCreature::GetLootRecipientGroup },
{ "GetNPCFlags", &LuaCreature::GetNPCFlags },
#ifndef CATA #ifndef CATA
{ "GetShieldBlockValue", &LuaCreature::GetShieldBlockValue }, // :GetShieldBlockValue() - Returns block value { "GetShieldBlockValue", &LuaCreature::GetShieldBlockValue },
#endif #endif
// Setters // Setters
{ "SetHover", &LuaCreature::SetHover }, // :SetHover([enable]) - Sets hover on or off { "SetHover", &LuaCreature::SetHover },
// {"SetDisableGravity", &LuaCreature::SetDisableGravity}, // :SetDisableGravity([disable, packetOnly]) - Disables or enables gravity #ifdef TRINITY
{ "SetAllowedCombat", &LuaCreature::SetAllowedCombat }, // :SetAllowedCombat(allow) - Allows the creature to attack or not {"SetDisableGravity", &LuaCreature::SetDisableGravity },
{ "SetNoCallAssistance", &LuaCreature::SetNoCallAssistance }, // :SetNoCallAssistance([noCall]) - Sets call assistance to false or true #endif
{ "SetNoSearchAssistance", &LuaCreature::SetNoSearchAssistance }, // :SetNoSearchAssistance([noSearch]) - Sets assistance searhing to false or true { "SetAggroEnabled", &LuaCreature::SetAggroEnabled },
{ "SetDefaultMovementType", &LuaCreature::SetDefaultMovementType }, // :SetDefaultMovementType(type) - Sets default movement type { "SetNoCallAssistance", &LuaCreature::SetNoCallAssistance },
{ "SetRespawnDelay", &LuaCreature::SetRespawnDelay }, // :SetRespawnDelay(delay) - Sets the respawn delay { "SetNoSearchAssistance", &LuaCreature::SetNoSearchAssistance },
{ "SetRespawnRadius", &LuaCreature::SetRespawnRadius }, // :SetRespawnRadius(dist) - Sets the respawn radius { "SetDefaultMovementType", &LuaCreature::SetDefaultMovementType },
{ "SetInCombatWithZone", &LuaCreature::SetInCombatWithZone }, // :SetInCombatWithZone() - Sets the creature in combat with everyone in zone { "SetRespawnDelay", &LuaCreature::SetRespawnDelay },
{ "SetDisableReputationGain", &LuaCreature::SetDisableReputationGain }, // :SetDisableReputationGain([disable]) - Disables or enables reputation gain from creature { "SetWanderRadius", &LuaCreature::SetWanderRadius },
// {"SetLootMode", &LuaCreature::SetLootMode}, // :SetLootMode(lootMode) - Sets the lootmode { "SetInCombatWithZone", &LuaCreature::SetInCombatWithZone },
{ "SetNPCFlags", &LuaCreature::SetNPCFlags }, // :SetNPCFlags(flags) - Sets NPC flags { "SetDisableReputationGain", &LuaCreature::SetDisableReputationGain },
{ "SetDeathState", &LuaCreature::SetDeathState }, // :SetDeathState(value) - 0 = alive 1 = just died 2 = corpse 3 = dead #ifdef TRINITY
{ "SetWalk", &LuaCreature::SetWalk }, // :SetWalk([enable]) - If false, creature runs, otherwise walks { "SetLootMode", &LuaCreature::SetLootMode },
#endif
{ "SetNPCFlags", &LuaCreature::SetNPCFlags },
{ "SetDeathState", &LuaCreature::SetDeathState },
{ "SetWalk", &LuaCreature::SetWalk },
// Booleans // Booleans
{ "IsWorldBoss", &LuaCreature::IsWorldBoss }, // :IsWorldBoss() - Returns true if the creature is a WorldBoss, false if not { "IsWorldBoss", &LuaCreature::IsWorldBoss },
{ "IsRacialLeader", &LuaCreature::IsRacialLeader }, // :IsRacialLeader() - Returns true if the creature is a racial leader, false if not { "IsRacialLeader", &LuaCreature::IsRacialLeader },
{ "IsCivilian", &LuaCreature::IsCivilian }, // :IsCivilian() - Returns true if the creature is a civilian, false if not { "IsCivilian", &LuaCreature::IsCivilian },
// {"IsTrigger", &LuaCreature::IsTrigger}, // :IsTrigger() - Returns true if the creature is a trigger, false if not #ifdef TRINITY
{ "IsGuard", &LuaCreature::IsGuard }, // :IsGuard() - Returns true if the creature is a guard, false if not { "IsTrigger", &LuaCreature::IsTrigger },
{ "IsElite", &LuaCreature::IsElite }, // :IsElite() - Returns true if the creature is an elite, false if not #endif
{ "IsInEvadeMode", &LuaCreature::IsInEvadeMode }, // :IsInEvadeMode() - Returns true if the creature is in evade mode, false if not { "IsGuard", &LuaCreature::IsGuard },
{ "HasCategoryCooldown", &LuaCreature::HasCategoryCooldown }, // :HasCategoryCooldown(spellId) - Returns true if the creature has a cooldown for the spell's category { "IsElite", &LuaCreature::IsElite },
{ "CanWalk", &LuaCreature::CanWalk }, // :CanWalk() - Returns true if the creature can walk { "IsInEvadeMode", &LuaCreature::IsInEvadeMode },
{ "CanSwim", &LuaCreature::CanSwim }, // :CanSwim() - Returns true if the creature can swim { "HasCategoryCooldown", &LuaCreature::HasCategoryCooldown },
{ "IsCombatAllowed", &LuaCreature::IsCombatAllowed }, // :IsCombatAllowed() - Returns true if the creature has combat allowed { "CanWalk", &LuaCreature::CanWalk },
// {"CanStartAttack", &LuaCreature::CanStartAttack}, // :CanStartAttack(unit[, force]) - Returns true if the creature can attack the unit { "CanSwim", &LuaCreature::CanSwim },
{ "HasSearchedAssistance", &LuaCreature::HasSearchedAssistance }, // :HasSearchedAssistance() - Returns true if the creature has searched assistance { "CanAggro", &LuaCreature::CanAggro },
{ "IsTappedBy", &LuaCreature::IsTappedBy }, // :IsTappedBy(player) #ifdef TRINITY
{ "HasLootRecipient", &LuaCreature::HasLootRecipient }, // :HasLootRecipient() - Returns true if the creature has a loot recipient { "CanStartAttack", &LuaCreature::CanStartAttack },
{ "CanAssistTo", &LuaCreature::CanAssistTo }, // :CanAssistTo(unit, enemy[, checkfaction]) - Returns true if the creature can assist unit with enemy #endif
{ "IsTargetableForAttack", &LuaCreature::IsTargetableForAttack }, // :IsTargetableForAttack([inversAlive]) - Returns true if the creature can be attacked { "HasSearchedAssistance", &LuaCreature::HasSearchedAssistance },
{ "HasInvolvedQuest", &LuaCreature::HasInvolvedQuest }, // :HasInvolvedQuest(questId) - Returns true if the creature can finish the quest for players { "IsTappedBy", &LuaCreature::IsTappedBy },
{ "IsRegeneratingHealth", &LuaCreature::IsRegeneratingHealth }, // :IsRegeneratingHealth() - Returns true if the creature is regenerating health { "HasLootRecipient", &LuaCreature::HasLootRecipient },
{ "IsReputationGainDisabled", &LuaCreature::IsReputationGainDisabled }, // :IsReputationGainDisabled() - Returns true if the creature has reputation gain disabled { "CanAssistTo", &LuaCreature::CanAssistTo },
// {"IsDamageEnoughForLootingAndReward", &LuaCreature::IsDamageEnoughForLootingAndReward}, // :IsDamageEnoughForLootingAndReward() { "IsTargetableForAttack", &LuaCreature::IsTargetableForAttack },
// {"HasLootMode", &LuaCreature::HasLootMode}, { "CanCompleteQuest", &LuaCreature::CanCompleteQuest },
{ "HasSpell", &LuaCreature::HasSpell }, // :HasSpell(id) { "CanRegenerateHealth", &LuaCreature::CanRegenerateHealth },
{ "HasQuest", &LuaCreature::HasQuest }, // :HasQuest(id) { "IsReputationGainDisabled", &LuaCreature::IsReputationGainDisabled },
{ "HasSpellCooldown", &LuaCreature::HasSpellCooldown }, // :HasSpellCooldown(spellId) - Returns true if the spell is on cooldown #ifdef TRINITY
{ "CanFly", &LuaCreature::CanFly }, // :CanFly() - Returns true if the creature can fly { "IsDamageEnoughForLootingAndReward", &LuaCreature::IsDamageEnoughForLootingAndReward },
{ "HasLootMode", &LuaCreature::HasLootMode },
#endif
{ "HasSpell", &LuaCreature::HasSpell },
{ "HasQuest", &LuaCreature::HasQuest },
{ "HasSpellCooldown", &LuaCreature::HasSpellCooldown },
{ "CanFly", &LuaCreature::CanFly },
// Other // Other
{ "FleeToGetAssistance", &LuaCreature::FleeToGetAssistance }, // :FleeToGetAssistance() - Creature flees for assistance { "FleeToGetAssistance", &LuaCreature::FleeToGetAssistance },
{ "CallForHelp", &LuaCreature::CallForHelp }, // :CallForHelp(radius) - Creature calls for help from units in radius { "CallForHelp", &LuaCreature::CallForHelp },
{ "CallAssistance", &LuaCreature::CallAssistance }, // :CallAssistance() - Creature calls for assistance { "CallAssistance", &LuaCreature::CallAssistance },
{ "RemoveCorpse", &LuaCreature::RemoveCorpse }, // :RemoveCorpse([setSpawnTime]) - Removes corpse { "RemoveCorpse", &LuaCreature::RemoveCorpse },
{ "DespawnOrUnsummon", &LuaCreature::DespawnOrUnsummon }, // :DespawnOrUnsummon([Delay]) - Despawns the creature after delay if given { "DespawnOrUnsummon", &LuaCreature::DespawnOrUnsummon },
{ "Respawn", &LuaCreature::Respawn }, // :Respawn([force]) - Respawns the creature { "Respawn", &LuaCreature::Respawn },
// {"AddLootMode", &LuaCreature::AddLootMode}, // :AddLootMode(lootMode) { "AttackStart", &LuaCreature::AttackStart },
// {"SendCreatureTalk", &LuaCreature::SendCreatureTalk}, // :SendCreatureTalk(id, playerGUID) - Sends a chat message to a playerGUID (player) by id. Id can be found in creature_text under the 'group_id' column #ifdef TRINITY
{ "AttackStart", &LuaCreature::AttackStart }, // :AttackStart(target) - Creature attacks the specified target {"AddLootMode", &LuaCreature::AddLootMode},
// {"ResetLootMode", &LuaCreature::ResetLootMode}, { "ResetLootMode", &LuaCreature::ResetLootMode },
// {"RemoveLootMode", &LuaCreature::RemoveLootMode}, { "RemoveLootMode", &LuaCreature::RemoveLootMode },
{ "SaveToDB", &LuaCreature::SaveToDB }, // :SaveToDB() - Saves to database #endif
{ "SelectVictim", &LuaCreature::SelectVictim }, // :SelectVictim() - Selects a victim { "SaveToDB", &LuaCreature::SaveToDB },
{ "MoveWaypoint", &LuaCreature::MoveWaypoint }, // :MoveWaypoint() { "SelectVictim", &LuaCreature::SelectVictim },
{ "UpdateEntry", &LuaCreature::UpdateEntry }, // :UpdateEntry(entry[, dataGuidLow]) - Sets the creature's data from the given entry and guid. Guid can be left out. { "MoveWaypoint", &LuaCreature::MoveWaypoint },
{ "UpdateEntry", &LuaCreature::UpdateEntry },
{ NULL, NULL }, { NULL, NULL },
}; };