Updated method documentation and cleaned up

Method documentation should be completed. Only thing left now is polishing up (fixing typos, update wording, add enumerator data to method documentation that doesn't have it, etc)..

Cleaned whitespaces

Corrected/Fixed up some comments

Removed all known documented method comments in LuaFunctions.cpp. Commented out methods are now marked as undocumented until they are uncommented & documented in their respective header files.

Removed 'Getter, Setter, Boolean, Other' comments in method files

Documented VehicleMethods, the rest of PlayerMethods, UnitMethods, CreatureMethods and GuildMethods.

Refer to #101 for more information
This commit is contained in:
Tommy
2015-09-16 04:14:32 -04:00
parent 34439b2ff3
commit 9d9e72e598
20 changed files with 1323 additions and 757 deletions

View File

@@ -67,8 +67,7 @@ public:
BindingMap(lua_State* L) :
L(L),
maxBindingID(0)
{
}
{ }
/*
* Insert a new binding from `key` to `ref`, which lasts for `shots`-many pushes.

View File

@@ -14,8 +14,6 @@
*/
namespace LuaCreature
{
/* BOOLEAN */
/**
* Returns `true` if the [Creature] is set to not give reputation when killed,
* and returns `false` otherwise.
@@ -368,12 +366,25 @@ namespace LuaCreature
return 1;
}
/**
* Returns true if the [Creature] is damaged enough for looting
*
* @return bool isDamagedEnough
*/
int IsDamageEnoughForLootingAndReward(Eluna* /*E*/, lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->IsDamageEnoughForLootingAndReward());
return 1;
}
/**
* Returns true if the [Creature] can start attacking specified target
*
* Does not work on most targets
*
* @param [Unit] target
* @param bool force = true : force [Creature] to attack
*/
int CanStartAttack(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement core side
{
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
@@ -383,6 +394,12 @@ namespace LuaCreature
return 1;
}
/**
* Returns true if [Creature] has the specified loot mode
*
* @param uint16 lootMode
* @return bool hasLootMode
*/
int HasLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
{
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
@@ -392,8 +409,6 @@ namespace LuaCreature
}
#endif
/* GETTERS */
/**
* Returns the time it takes for this [Creature] to respawn once killed.
*
@@ -853,8 +868,6 @@ namespace LuaCreature
return 1;
}
/* SETTERS */
/**
* Sets the [Creature]'s NPC flags to `flags`.
*
@@ -1091,8 +1104,6 @@ namespace LuaCreature
return 0;
}
/* OTHER */
/**
* Despawn this [Creature].
*
@@ -1129,7 +1140,7 @@ namespace LuaCreature
}
/**
* Make the [Creature] start following it's waypoint path.
* Make the [Creature] start following its waypoint path.
*/
int MoveWaypoint(Eluna* /*E*/, lua_State* /*L*/, Creature* creature)
{
@@ -1229,12 +1240,20 @@ namespace LuaCreature
}
#ifdef TRINITY
/**
* Resets [Creature]'s loot mode to default
*/
int ResetLootMode(Eluna* /*E*/, lua_State* /*L*/, Creature* creature) // TODO: Implement LootMode features
{
creature->ResetLootMode();
return 0;
}
/**
* Removes specified loot mode from [Creature]
*
* @param uint16 lootMode
*/
int RemoveLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
{
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
@@ -1243,6 +1262,11 @@ namespace LuaCreature
return 0;
}
/**
* Adds a loot mode to the [Creature]
*
* @param uint16 lootMode
*/
int AddLootMode(Eluna* /*E*/, lua_State* L, Creature* creature) // TODO: Implement LootMode features
{
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);

View File

@@ -28,7 +28,6 @@ namespace LuaQuery
luaL_argerror(L, 2, "invalid field index");
}
/* BOOLEAN */
/**
* Returns `true` if the specified column of the current row is `NULL`, otherwise `false`.
*
@@ -48,7 +47,6 @@ namespace LuaQuery
return 1;
}
/* GETTERS */
/**
* Returns the number of columns in the result set.
*
@@ -247,8 +245,6 @@ namespace LuaQuery
return 1;
}
/* OTHER */
/**
* Advances the [ElunaQuery] to the next row in the result set.
*

View File

@@ -70,7 +70,7 @@ void Eluna::OnDisband(Guild* guild)
CallAllFunctions(GuildEventBindings, key);
}
void Eluna::OnMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, bool isRepair) // isRepair not a part of Mangos, implement?
void Eluna::OnMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, bool isRepair)
{
START_HOOK(GUILD_EVENT_ON_MONEY_WITHDRAW);
Push(guild);

View File

@@ -12,7 +12,6 @@
*/
namespace LuaGuild
{
/* GETTERS */
/**
* Returns a table with the [Player]s in this [Guild]
*
@@ -139,7 +138,6 @@ namespace LuaGuild
return 1;
}
/* SETTERS */
#ifndef CATA
/**
* Sets the leader of this [Guild]
@@ -179,7 +177,6 @@ namespace LuaGuild
}
#endif
/* OTHER */
// SendPacketToGuild(packet)
/**
* Sends a [WorldPacket] to all the [Player]s in the [Guild]
@@ -272,6 +269,12 @@ namespace LuaGuild
#ifndef CLASSIC
// Move to Player methods
/**
* Windraws money from the [Guild] bank
*
* @param [Player] player
* @param uint32 money
*/
int WithdrawBankMoney(Eluna* /*E*/, lua_State* L, Guild* guild)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
@@ -287,6 +290,12 @@ namespace LuaGuild
}
// Move to Player methods
/**
* Deposits money to the [Guild] bank
*
* @param [Player] player
* @param uint32 money
*/
int DepositBankMoney(Eluna* /*E*/, lua_State* L, Guild* guild)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);

View File

@@ -12,7 +12,6 @@
*/
namespace LuaItem
{
/* BOOLEAN */
/**
* Returns 'true' if the [Item] is soulbound, 'false' otherwise
*
@@ -231,15 +230,11 @@ namespace LuaItem
return 1;
}
/*
* int IsRefundExpired(Eluna* E, lua_State* L, Item* item)// TODO: Implement core support
* {
* Eluna::Push(L, item->IsRefundExpired());
* return 1;
* }
*/
/* GETTERS */
/*int IsRefundExpired(Eluna* E, lua_State* L, Item* item)// TODO: Implement core support
{
Eluna::Push(L, item->IsRefundExpired());
return 1;
}*/
/**
* Returns the chat link of the [Item]
@@ -295,12 +290,8 @@ namespace LuaItem
}
if (suffix)
{
//std::string test(suffix[(name != temp->Name1) ? loc_idx : DEFAULT_LOCALE]);
//if (!test.empty())
//{
name += ' ';
name += suffix[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)];
/*}*/
}
}
#endif
@@ -631,7 +622,6 @@ namespace LuaItem
return 1;
}
/* SETTERS */
/**
* Sets the [Player] specified as the owner of the [Item]
*

View File

@@ -169,7 +169,6 @@ CreatureUniqueBindings(NULL)
OpenLua();
// Replace this with map insert if making multithread version
//
// Set event manager. Must be after setting sEluna
// on multithread have a map of state pointers and here insert this pointer to the map and then save a pointer of that pointer to the EventMgr

View File

@@ -139,7 +139,7 @@ private:
static std::string lua_requirepath;
uint32 event_level;
// When a hook pushes arguments to be passed to event handlers
// When a hook pushes arguments to be passed to event handlers,
// this is used to keep track of how many arguments were pushed.
uint8 push_counter;
bool enabled;
@@ -160,8 +160,8 @@ private:
void CloseLua();
void DestroyBindStores();
void CreateBindStores();
bool ExecuteCall(int params, int res);
void InvalidateObjects();
bool ExecuteCall(int params, int res);
// Use ReloadEluna() to make eluna reload
// This is called on world update to reload eluna

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,6 @@
*/
namespace LuaObject
{
/* BOOLEAN */
/**
* Returns `true` if the specified flag is set, otherwise `false`.
*
@@ -52,7 +51,6 @@ namespace LuaObject
return 1;
}
/* GETTERS */
/**
* Returns the data at the specified index, casted to a signed 32-bit integer.
*
@@ -224,7 +222,6 @@ namespace LuaObject
return 0;
}
/* SETTERS */
/**
* Sets the specified flag in the data value at the specified index.
*
@@ -376,7 +373,6 @@ namespace LuaObject
return 0;
}
/* OTHER */
/**
* Removes a flag from the value at the specified index.
*

View File

@@ -39,7 +39,6 @@ void Eluna::OnLearnTalents(Player* pPlayer, uint32 talentId, uint32 talentRank,
CallAllFunctions(PlayerEventBindings, key);
}
// Player
bool Eluna::OnCommand(Player* player, const char* text)
{
// If from console, player is NULL

View File

@@ -12,7 +12,6 @@
*/
namespace LuaPlayer
{
/* BOOLEAN */
#if (!defined(TBC) && !defined(CLASSIC))
/**
* Returns 'true' if the [Player] can Titan Grip, 'false' otherwise.
@@ -102,6 +101,12 @@ namespace LuaPlayer
return 1;
}
/**
* Returns true if [Player] has specified login flag
*
* @param uint32 flag
* @return bool hasLoginFlag
*/
int HasAtLoginFlag(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 flag = Eluna::CHECKVAL<uint32>(L, 2);
@@ -110,6 +115,12 @@ namespace LuaPlayer
return 1;
}
/**
* Returns true if [Player] has [Quest] for [GameObject]
*
* @param int32 entry : entry of a [GameObject]
* @return bool hasQuest
*/
int HasQuestForGO(Eluna* /*E*/, lua_State* L, Player* player)
{
int32 entry = Eluna::CHECKVAL<int32>(L, 2);
@@ -260,6 +271,12 @@ namespace LuaPlayer
#endif
#ifdef CLASSIC
/**
* Returns [Player] kills
*
* @param bool honorable = true : if victims are honorable
* @return uint32 kills
*/
int GetHonorStoredKills(Eluna* /*E*/, lua_State* L, Player* player)
{
bool honorable = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -268,12 +285,22 @@ namespace LuaPlayer
return 1;
}
/**
* Returns rank points
*
* @return float rankPoints
*/
int GetRankPoints(Eluna* /*E*/, lua_State* L, Player* player)
{
Eluna::Push(L, player->GetRankPoints());
return 1;
}
/**
* Returns last week's standing position
*
* @return int32 standingPos
*/
int GetHonorLastWeekStandingPos(Eluna* /*E*/, lua_State* L, Player* player)
{
Eluna::Push(L, player->GetHonorLastWeekStandingPos());
@@ -705,7 +732,6 @@ namespace LuaPlayer
return 1;
}*/
/* GETTERS */
#if (!defined(TBC) && !defined(CLASSIC))
/**
* Returns the amount of available specs the [Player] currently has
@@ -869,12 +895,23 @@ namespace LuaPlayer
return 1;
}
/**
* Returns [Group] invitation
*
* @return [Group] group
*/
int GetGroupInvite(Eluna* /*E*/, lua_State* L, Player* player)
{
Eluna::Push(L, player->GetGroupInvite());
return 1;
}
/**
* Returns rested experience bonus
*
* @param uint32 xp
* @return uint32 xpBonus
*/
int GetXPRestBonus(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 xp = Eluna::CHECKVAL<uint32>(L, 2);
@@ -938,6 +975,12 @@ namespace LuaPlayer
return 1;
}
/**
* Returns skill temporary bonus value
*
* @param uint32 skill
* @param int16 bonusVal
*/
int GetSkillTempBonusValue(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
@@ -946,6 +989,12 @@ namespace LuaPlayer
return 1;
}
/**
* Returns skill permanent bonus value
*
* @param uint32 skill
* @param int16 bonusVal
*/
int GetSkillPermBonusValue(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
@@ -954,6 +1003,12 @@ namespace LuaPlayer
return 1;
}
/**
* Returns skill value without bonus'
*
* @param uint32 skill
* @return uint16 pureVal
*/
int GetPureSkillValue(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
@@ -962,6 +1017,12 @@ namespace LuaPlayer
return 1;
}
/**
* Returns base skill value
*
* @param uint32 skill
* @return uint16 baseVal
*/
int GetBaseSkillValue(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
@@ -970,6 +1031,12 @@ namespace LuaPlayer
return 1;
}
/**
* Returns skill value
*
* @param uint32 skill
* @return uint16 val
*/
int GetSkillValue(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
@@ -978,6 +1045,12 @@ namespace LuaPlayer
return 1;
}
/**
* Returns max value of specified skill without bonus'
*
* @param uint32 skill
* @return uint16 pureVal
*/
int GetPureMaxSkillValue(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
@@ -986,6 +1059,12 @@ namespace LuaPlayer
return 1;
}
/**
* Returns max value of specified skill
*
* @param uint32 skill
* @return uint16 val
*/
int GetMaxSkillValue(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
@@ -994,18 +1073,34 @@ namespace LuaPlayer
return 1;
}
/**
* Returns mana bonus from amount of intellect
*
* @return float bonus
*/
int GetManaBonusFromIntellect(Eluna* /*E*/, lua_State* L, Player* player)
{
Eluna::Push(L, player->GetManaBonusFromIntellect());
return 1;
}
/**
* Returns health bonus from amount of stamina
*
* @return float bonus
*/
int GetHealthBonusFromStamina(Eluna* /*E*/, lua_State* L, Player* player)
{
Eluna::Push(L, player->GetHealthBonusFromStamina());
return 1;
}
/**
* Returns raid or dungeon difficulty
*
* @param bool isRaid = true : argument is TrinityCore only
* @return int32 difficulty
*/
int GetDifficulty(Eluna* /*E*/, lua_State* L, Player* player)
{
#ifdef TBC
@@ -1068,6 +1163,11 @@ namespace LuaPlayer
return 1;
}
/**
* Returns [Unit] target combo points are on
*
* @return [Unit] target
*/
int GetComboTarget(Eluna* /*E*/, lua_State* L, Player* player)
{
#ifndef TRINITY
@@ -1078,6 +1178,11 @@ namespace LuaPlayer
return 1;
}
/**
* Returns [Player]'s combo points
*
* @return uint8 comboPoints
*/
int GetComboPoints(Eluna* /*E*/, lua_State* L, Player* player)
{
Eluna::Push(L, player->GetComboPoints());
@@ -1123,6 +1228,13 @@ namespace LuaPlayer
return 1;
}
/**
* Returns [Quest] required [Creature] or [GameObject] count
*
* @param uint32 quest : entry of a quest
* @param int32 entry : entry of required [Creature]
* @return uint16 count
*/
int GetReqKillOrCastCurrentCount(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
@@ -1178,6 +1290,11 @@ namespace LuaPlayer
return 1;
}
/**
* Returns active GM chat tag
*
* @return uint8 tag
*/
int GetChatTag(Eluna* /*E*/, lua_State* L, Player* player)
{
Eluna::Push(L, player->GetChatTag());
@@ -1483,8 +1600,6 @@ namespace LuaPlayer
return 1;
}*/
/* SETTERS */
/**
* Locks the player controls and disallows all movement and casting.
*
@@ -1561,6 +1676,14 @@ namespace LuaPlayer
return 0;
}
/**
* Sets (increases) skill of the [Player]
*
* @param uint16 id
* @param uint16 step
* @param uint16 currVal
* @param uint16 maxVal
*/
int SetSkill(Eluna* /*E*/, lua_State* L, Player* player)
{
uint16 id = Eluna::CHECKVAL<uint16>(L, 2);
@@ -1620,6 +1743,12 @@ namespace LuaPlayer
return 0;
}
/**
* Sets [Quest] state
*
* @param uint32 entry : entry of a quest
* @param uint32 status
*/
int SetQuestStatus(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
@@ -1657,6 +1786,11 @@ namespace LuaPlayer
return 0;
}
/**
* Toggles PvP Death
*
* @param bool on = true
*/
int SetPvPDeath(Eluna* /*E*/, lua_State* L, Player* player)
{
bool on = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -1691,6 +1825,11 @@ namespace LuaPlayer
return 0;
}
/**
* Toggle Blizz (GM) tag
*
* @param bool on = true
*/
int SetGMChat(Eluna* /*E*/, lua_State* L, Player* player)
{
bool on = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -1772,6 +1911,12 @@ namespace LuaPlayer
#endif
#ifdef CLASSIC
/**
* Sets kills
*
* @param uint32 kills
* @param bool honorable = true : if victims were honorable
*/
int SetHonorStoredKills(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 kills = Eluna::CHECKVAL<uint32>(L, 2);
@@ -1781,6 +1926,11 @@ namespace LuaPlayer
return 0;
}
/**
* Sets rank points
*
* @param float rankPoints
*/
int SetRankPoints(Eluna* /*E*/, lua_State* L, Player* player)
{
float rankPoints = Eluna::CHECKVAL<float>(L, 2);
@@ -1789,6 +1939,11 @@ namespace LuaPlayer
return 0;
}
/**
* Sets last week's honor standing position
*
* @param int32 standingPos
*/
int SetHonorLastWeekStandingPos(Eluna* /*E*/, lua_State* L, Player* player)
{
int32 standingPos = Eluna::CHECKVAL<int32>(L, 2);
@@ -1887,7 +2042,6 @@ namespace LuaPlayer
return 0;
}*/
/* OTHER */
#if (!defined(TBC) && !defined(CLASSIC))
/**
* Resets the [Player]s pets talent points
@@ -2028,6 +2182,9 @@ namespace LuaPlayer
return 0;
}
/**
* Creates the [Player]'s corpse
*/
int CreateCorpse(Eluna* /*E*/, lua_State* /*L*/, Player* player)
{
player->CreateCorpse();
@@ -2261,6 +2418,15 @@ namespace LuaPlayer
return 0;
}
/**
* Repairs [Item] at specified position. Returns total repair cost
*
* @param uint16 position
* @param bool cost = true
* @param float discountMod
* @param bool guildBank = false
* @return uint32 totalCost
*/
int DurabilityRepair(Eluna* /*E*/, lua_State* L, Player* player)
{
uint16 position = Eluna::CHECKVAL<uint16>(L, 2);
@@ -2276,6 +2442,14 @@ namespace LuaPlayer
return 1;
}
/**
* Repairs all [Item]s. Returns total repair cost
*
* @param bool cost = true
* @param float discountMod = 1
* @param bool guidBank = false
* @return uint32 totalCost
*/
int DurabilityRepairAll(Eluna* /*E*/, lua_State* L, Player* player)
{
bool cost = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -2290,6 +2464,11 @@ namespace LuaPlayer
return 1;
}
/**
* Sets durability loss for an [Item] in the specified slot
*
* @param int32 slot
*/
int DurabilityPointLossForEquipSlot(Eluna* /*E*/, lua_State* L, Player* player)
{
int32 slot = Eluna::CHECKVAL<int32>(L, 2);
@@ -2299,6 +2478,14 @@ namespace LuaPlayer
return 0;
}
/**
* Sets durability loss on all [Item]s equipped
*
* If inventory is true, sets durability loss for [Item]s in bags
*
* @param int32 points
* @param bool inventory = true
*/
int DurabilityPointsLossAll(Eluna* /*E*/, lua_State* L, Player* player)
{
int32 points = Eluna::CHECKVAL<int32>(L, 2);
@@ -2308,6 +2495,12 @@ namespace LuaPlayer
return 0;
}
/**
* Sets durability loss for the specified [Item]
*
* @param [Item] item
* @param int32 points
*/
int DurabilityPointsLoss(Eluna* /*E*/, lua_State* L, Player* player)
{
Item* item = Eluna::CHECKOBJ<Item>(L, 2);
@@ -2317,6 +2510,12 @@ namespace LuaPlayer
return 0;
}
/**
* Damages specified [Item]
*
* @param [Item] item
* @param double percent
*/
int DurabilityLoss(Eluna* /*E*/, lua_State* L, Player* player)
{
Item* item = Eluna::CHECKOBJ<Item>(L, 2);
@@ -2326,6 +2525,12 @@ namespace LuaPlayer
return 0;
}
/**
* Damages all [Item]s equipped. If inventory is true, damages [Item]s in bags
*
* @param double percent
* @param bool inventory = true
*/
int DurabilityLossAll(Eluna* /*E*/, lua_State* L, Player* player)
{
double percent = Eluna::CHECKVAL<double>(L, 2);
@@ -2399,6 +2604,13 @@ namespace LuaPlayer
return 0;
}
/**
* Removes the [Spell] from the [Player]
*
* @param uint32 entry : entry of a [Spell]
* @param bool disabled = false
* @param bool learnLowRank = true
*/
int RemoveSpell(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
@@ -2422,6 +2634,12 @@ namespace LuaPlayer
return 0;
}
/**
* Adds combo points to the [Player]
*
* @param [Unit] target
* @param int8 count
*/
int AddComboPoints(Eluna* /*E*/, lua_State* L, Player* player)
{
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
@@ -2431,6 +2649,12 @@ namespace LuaPlayer
return 0;
}
/**
* Gives [Quest] monster talked to credit
*
* @param uint32 entry : entry of a [Creature]
* @param [Creature] creature
*/
int TalkedToCreature(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
@@ -2440,6 +2664,11 @@ namespace LuaPlayer
return 0;
}
/**
* Gives [Quest] monster killed credit
*
* @param uint32 entry : entry of a [Creature]
*/
int KilledMonsterCredit(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
@@ -2448,6 +2677,12 @@ namespace LuaPlayer
return 0;
}
/**
* Completes a [Quest] if in a [Group]
*
* @param uint32 quest : entry of a quest
* @param [WorldObject] obj
*/
int GroupEventHappens(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
@@ -2457,6 +2692,11 @@ namespace LuaPlayer
return 0;
}
/**
* Completes the [Quest] if a [Quest] area is explored, or completes the [Quest]
*
* @param uint32 quest : entry of a [Quest]
*/
int AreaExploredOrEventHappens(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
@@ -2466,9 +2706,9 @@ namespace LuaPlayer
}
/**
* Sets the given quest entry failed for the [Player].
* Sets the given [Quest] entry failed for the [Player].
*
* @param uint32 entry : quest entry
* @param uint32 entry : entry of a [Quest]
*/
int FailQuest(Eluna* /*E*/, lua_State* L, Player* player)
{
@@ -2715,6 +2955,14 @@ namespace LuaPlayer
return 0;
}
/**
* Sends whisper text from the [Player]
*
* @param string text
* @param uint32 lang : language the [Player] will speak
* @param [Player] receiver : is the [Player] that will receive the whisper, if TrinityCore
* @param uint64 guid : is the GUID of a [Player] that will receive the whisper, not TrinityCore
*/
int Whisper(Eluna* /*E*/, lua_State* L, Player* player)
{
std::string text = Eluna::CHECKVAL<std::string>(L, 2);
@@ -2745,6 +2993,12 @@ namespace LuaPlayer
return 0;
}
/**
* Sends yell text from the [Player]
*
* @param string text : text for the [Player] to yells
* @param uint32 lang : language the [Player] will speak
*/
int Yell(Eluna* /*E*/, lua_State* L, Player* player)
{
std::string text = Eluna::CHECKVAL<std::string>(L, 2);
@@ -2757,6 +3011,12 @@ namespace LuaPlayer
return 0;
}
/**
* Sends say text from the [Player]
*
* @param string text : text for the [Player] to say
* @param uint32 lang : language the [Player] will speak
*/
int Say(Eluna* /*E*/, lua_State* L, Player* player)
{
std::string text = Eluna::CHECKVAL<std::string>(L, 2);
@@ -2769,6 +3029,12 @@ namespace LuaPlayer
return 0;
}
/**
* Gives the [Player] experience
*
* @param uint32 xp : experience to give
* @param [Unit] victim = nil
*/
int GiveXP(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 xp = Eluna::CHECKVAL<uint32>(L, 2);
@@ -3063,6 +3329,11 @@ namespace LuaPlayer
return 0;
}
/**
* Removes specified amount of lifetime kills
*
* @param uint32 val : kills to remove
*/
int RemoveLifetimeKills(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 val = Eluna::CHECKVAL<uint32>(L, 2);
@@ -3073,6 +3344,12 @@ namespace LuaPlayer
return 0;
}
/**
* Resets cooldown of the specified spell
*
* @param uint32 spellId
* @param bool update = true
*/
int ResetSpellCooldown(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
@@ -3085,6 +3362,12 @@ namespace LuaPlayer
return 0;
}
/**
* Resets cooldown of the specified category
*
* @param uint32 category
* @param bool update = true
*/
int ResetTypeCooldowns(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 category = Eluna::CHECKVAL<uint32>(L, 2);
@@ -3103,7 +3386,7 @@ namespace LuaPlayer
}
/**
* Resets all of the [Player]s cooldowns
* Resets all of the [Player]'s cooldowns
*/
int ResetAllCooldowns(Eluna* /*E*/, lua_State* /*L*/, Player* player)
{
@@ -3115,6 +3398,12 @@ namespace LuaPlayer
return 0;
}
/**
* Clears a cooldown of the specified spell
*
* @param uint32 spellId : entry of a spell
* @param [Unit] target
*/
int SendClearCooldowns(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
@@ -3127,6 +3416,7 @@ namespace LuaPlayer
#endif
return 0;
}
/**
* Sends a Broadcast Message to the [Player]
*
@@ -3183,6 +3473,16 @@ namespace LuaPlayer
return 0;
}
/**
* Sends addon message to the [Player] receiver
*
* @param string prefix
* @param string message
* @param uint8 channel
* @param [Player] receiver
* @param string fullMsg
*
*/
int SendAddonMessage(Eluna* /*E*/, lua_State* L, Player* player)
{
std::string prefix = Eluna::CHECKVAL<std::string>(L, 2);
@@ -3371,6 +3671,13 @@ namespace LuaPlayer
return 0;
}
/**
* Plays sound to [Player]
*
* See [Unit]:PlayDirectSound
*
* @param uint32 sound : entry of a sound
*/
int PlaySoundToPlayer(Eluna* /*E*/, lua_State* L, Player* player)
{
uint32 soundId = Eluna::CHECKVAL<uint32>(L, 2);
@@ -3395,6 +3702,16 @@ namespace LuaPlayer
return 0;
}
/**
* Sends POI to the location on your map
*
* @param float x
* @param float y
* @param uint32 icon : map icon to show
* @param uint32 flags
* @param uint32 data
* @param string iconText
*/
int GossipSendPOI(Eluna* /*E*/, lua_State* L, Player* player)
{
float x = Eluna::CHECKVAL<float>(L, 2);
@@ -3456,12 +3773,20 @@ namespace LuaPlayer
return 0;
}
/**
* Converts [Player]'s corpse to bones
*/
int SpawnBones(Eluna* /*E*/, lua_State* /*L*/, Player* player)
{
player->SpawnCorpseBones();
return 0;
}
/**
* Loots [Player]'s bones for insignia
*
* @param [Player] looter
*/
int RemovedInsignia(Eluna* /*E*/, lua_State* L, Player* player)
{
Player* looter = Eluna::CHECKOBJ<Player>(L, 2);

View File

@@ -85,7 +85,7 @@ void Eluna::OnLuaStateOpen()
CallAllFunctions(ServerEventBindings, key);
}
// areatrigger
// AreaTrigger
bool Eluna::OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger)
{
START_HOOK_WITH_RETVAL(TRIGGER_EVENT_ON_TRIGGER, false);
@@ -94,7 +94,7 @@ bool Eluna::OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger)
return CallAllFunctionsBool(ServerEventBindings, key);
}
// weather
// Weather
void Eluna::OnChange(Weather* weather, uint32 zone, WeatherState state, float grade)
{
START_HOOK(WEATHER_EVENT_ON_CHANGE);

View File

@@ -12,7 +12,13 @@
*/
namespace LuaUnit
{
/* BOOLEAN */
/**
* The [Unit] tries to attack a given target
*
* @param [Unit] who : [Unit] to attack
* @param bool meleeAttack = false: attack with melee or not
* @return didAttack : if the [Unit] did not attack
*/
int Attack(Eluna* /*E*/, lua_State* L, Unit* unit)
{
Unit* who = Eluna::CHECKOBJ<Unit>(L, 2);
@@ -22,6 +28,11 @@ namespace LuaUnit
return 1;
}
/**
* The [Unit] stops attacking its target
*
* @return bool isAttacking : if the [Unit] wasn't attacking already
*/
int AttackStop(Eluna* /*E*/, lua_State* L, Unit* unit)
{
Eluna::Push(L, unit->AttackStop());
@@ -590,8 +601,6 @@ namespace LuaUnit
return 1;
}*/
/* GETTERS */
/**
* Returns the [Unit]'s owner.
*
@@ -719,6 +728,12 @@ namespace LuaUnit
return 1;
}
/**
* Returns [Unit]'s specified stat
*
* @param uint32 statType
* @return float stat
*/
int GetStat(Eluna* /*E*/, lua_State* L, Unit* unit)
{
uint32 stat = Eluna::CHECKVAL<uint32>(L, 2);
@@ -730,6 +745,12 @@ namespace LuaUnit
return 1;
}
/**
* Returns the [Unit]'s base spell power
*
* @param uint32 spellSchool
* @return uint32 spellPower
*/
int GetBaseSpellPower(Eluna* /*E*/, lua_State* L, Unit* unit)
{
uint32 spellschool = Eluna::CHECKVAL<uint32>(L, 2);
@@ -1142,6 +1163,11 @@ namespace LuaUnit
return 1;
}
/**
* Returns the [Unit]'s combat timer
*
* @return uint32 combatTimer
*/
int GetCombatTime(Eluna* /*E*/, lua_State* L, Unit* unit)
{
Eluna::Push(L, unit->GetCombatTimer());
@@ -1225,6 +1251,11 @@ namespace LuaUnit
}
#if (!defined(TBC) && !defined(CLASSIC))
/**
* Returns [Unit]'s [Vehicle] methods
*
* @return [Vehicle] vehicle
*/
int GetVehicleKit(Eluna* /*E*/, lua_State* L, Unit* unit)
{
#ifndef TRINITY
@@ -1243,6 +1274,11 @@ namespace LuaUnit
}
*/
/**
* Returns the Critter Guid
*
* @return uint64 critterGuid
*/
int GetCritterGUID(Eluna* /*E*/, lua_State* L, Unit* unit)
{
#ifndef TRINITY
@@ -1327,8 +1363,6 @@ namespace LuaUnit
return 1;
}
/* SETTERS */
/**
* Sets the [Unit]'s owner GUID to given GUID.
*
@@ -1636,6 +1670,11 @@ namespace LuaUnit
return 0;
}
/**
* Sets creator GUID
*
* @param uint64 guid
*/
int SetCreatorGUID(Eluna* /*E*/, lua_State* L, Unit* unit)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
@@ -1647,6 +1686,11 @@ namespace LuaUnit
return 0;
}
/**
* Sets charmer GUID
*
* @param uint64 guid
*/
int SetCharmerGUID(Eluna* /*E*/, lua_State* L, Unit* unit)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
@@ -1658,6 +1702,11 @@ namespace LuaUnit
return 0;
}
/**
* Sets pet GUID
*
* @param uint64 guid
*/
int SetPetGUID(Eluna* /*E*/, lua_State* L, Unit* unit)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
@@ -1669,6 +1718,11 @@ namespace LuaUnit
return 0;
}
/**
* Toggles (Sets) [Unit]'s water walking
*
* @param bool enable = true
*/
int SetWaterWalk(Eluna* /*E*/, lua_State* L, Unit* unit)
{
bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -1680,6 +1734,11 @@ namespace LuaUnit
return 0;
}
/**
* Sets the [Unit]'s stand state
*
* @param uint8 state : stand state
*/
int SetStandState(Eluna* /*E*/, lua_State* L, Unit* unit)
{
uint8 state = Eluna::CHECKVAL<uint8>(L, 2);
@@ -1832,8 +1891,6 @@ namespace LuaUnit
return 0;
}*/
/* OTHER */
/**
* Clears the [Unit]'s threat list.
*/
@@ -1890,18 +1947,36 @@ namespace LuaUnit
return 0;
}
/**
* Returns calculated percentage from Health
*
* @return int32 percentage
*/
int CountPctFromCurHealth(Eluna* /*E*/, lua_State* L, Unit* unit)
{
Eluna::Push(L, unit->CountPctFromCurHealth(Eluna::CHECKVAL<int32>(L, 2)));
return 1;
}
/**
* Returns calculated percentage from Max Health
*
* @return int32 percentage
*/
int CountPctFromMaxHealth(Eluna* /*E*/, lua_State* L, Unit* unit)
{
Eluna::Push(L, unit->CountPctFromMaxHealth(Eluna::CHECKVAL<int32>(L, 2)));
return 1;
}
/**
* Sends chat message to [Player]
*
* @param uint8 type : chat, whisper, etc
* @param uint32 lang : language to speak
* @param string msg
* @param [Player] target
*/
int SendChatMessageToPlayer(Eluna* /*E*/, lua_State* L, Unit* unit)
{
uint8 type = Eluna::CHECKVAL<uint8>(L, 2);
@@ -1924,19 +1999,27 @@ namespace LuaUnit
return 0;
}
// static void PrepareMove(Unit* unit)
// {
// unit->GetMotionMaster()->MovementExpired(); // Chase
// unit->StopMoving(); // Some
// unit->GetMotionMaster()->Clear(); // all
// }
/*static void PrepareMove(Unit* unit)
{
unit->GetMotionMaster()->MovementExpired(); // Chase
unit->StopMoving(); // Some
unit->GetMotionMaster()->Clear(); // all
}*/
/**
* Stops the [Unit]'s movement
*/
int MoveStop(Eluna* /*E*/, lua_State* /*L*/, Unit* unit)
{
unit->StopMoving();
return 0;
}
/**
* The [Unit]'s movement expires and clears movement
*
* @param bool reset = true : cleans movement
*/
int MoveExpire(Eluna* /*E*/, lua_State* L, Unit* unit)
{
bool reset = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -1944,6 +2027,11 @@ namespace LuaUnit
return 0;
}
/**
* Clears the [Unit]'s movement
*
* @param bool reset = true : clean movement
*/
int MoveClear(Eluna* /*E*/, lua_State* L, Unit* unit)
{
bool reset = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -1951,12 +2039,20 @@ namespace LuaUnit
return 0;
}
/**
* The [Unit] will be idle
*/
int MoveIdle(Eluna* /*E*/, lua_State* /*L*/, Unit* unit)
{
unit->GetMotionMaster()->MoveIdle();
return 0;
}
/**
* The [Unit] will move at random
*
* @param float radius : limit on how far the [Unit] will move at random
*/
int MoveRandom(Eluna* /*E*/, lua_State* L, Unit* unit)
{
float radius = Eluna::CHECKVAL<float>(L, 2);
@@ -1970,12 +2066,22 @@ namespace LuaUnit
return 0;
}
/**
* The [Unit] will move to its set home location
*/
int MoveHome(Eluna* /*E*/, lua_State* /*L*/, Unit* unit)
{
unit->GetMotionMaster()->MoveTargetedHome();
return 0;
}
/**
* The [Unit] will follow the target
*
* @param [Unit] target : target to follow
* @param float dist = 0 : distance to start following
* @param float angle = 0
*/
int MoveFollow(Eluna* /*E*/, lua_State* L, Unit* unit)
{
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
@@ -1985,6 +2091,13 @@ namespace LuaUnit
return 0;
}
/**
* The [Unit] will chase the target
*
* @param [Unit] target : target to chase
* @param float dist = 0 : distance start chasing
* @param float angle = 0
*/
int MoveChase(Eluna* /*E*/, lua_State* L, Unit* unit)
{
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
@@ -1994,12 +2107,21 @@ namespace LuaUnit
return 0;
}
/**
* The [Unit] will move confused
*/
int MoveConfused(Eluna* /*E*/, lua_State* /*L*/, Unit* unit)
{
unit->GetMotionMaster()->MoveConfused();
return 0;
}
/**
* The [Unit] will flee
*
* @param [Unit] target
* @param uint32 time = 0 : flee delay
*/
int MoveFleeing(Eluna* /*E*/, lua_State* L, Unit* unit)
{
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
@@ -2008,6 +2130,15 @@ namespace LuaUnit
return 0;
}
/**
* The [Unit] will move to the coordinates
*
* @param uint32 id : unique waypoint Id
* @param float x
* @param float y
* @param float z
* @param bool genPath = true : if true, generates path
*/
int MoveTo(Eluna* /*E*/, lua_State* L, Unit* unit)
{
uint32 id = Eluna::CHECKVAL<uint32>(L, 2);
@@ -2020,6 +2151,16 @@ namespace LuaUnit
}
#if (!defined(TBC) && !defined(CLASSIC))
/**
* Makes the [Unit] jump to the coordinates
*
* @param float x
* @param float y
* @param float z
* @param float zSpeed : start velocity
* @param float maxHeight : maximum height
* @param uint32 id = 0 : unique movement Id
*/
int MoveJump(Eluna* /*E*/, lua_State* L, Unit* unit)
{
float x = Eluna::CHECKVAL<float>(L, 2);
@@ -2033,6 +2174,14 @@ namespace LuaUnit
}
#endif
/**
* The [Unit] will whisper the message to a [Player]
*
* @param string msg : message for the [Unit] to emote
* @param lang : language for the [Unit] to speak
* @param [Player] receiver : specific [Unit] to receive the message
* @param bool bossWhisper = false : is a boss whisper
*/
int SendUnitWhisper(Eluna* /*E*/, lua_State* L, Unit* unit)
{
const char* msg = Eluna::CHECKVAL<const char*>(L, 2);
@@ -2048,6 +2197,13 @@ namespace LuaUnit
return 0;
}
/**
* The [Unit] will emote the message
*
* @param string msg : message for the [Unit] to emote
* @param [Unit] receiver = nil : specific [Unit] to receive the message
* @param bool bossEmote = false : is a boss emote
*/
int SendUnitEmote(Eluna* /*E*/, lua_State* L, Unit* unit)
{
const char* msg = Eluna::CHECKVAL<const char*>(L, 2);
@@ -2062,6 +2218,12 @@ namespace LuaUnit
return 0;
}
/**
* The [Unit] will say the message
*
* @param string msg : message for the [Unit] to say
* @param uint32 language : language for the [Unit] to speak
*/
int SendUnitSay(Eluna* /*E*/, lua_State* L, Unit* unit)
{
const char* msg = Eluna::CHECKVAL<const char*>(L, 2);
@@ -2075,6 +2237,12 @@ namespace LuaUnit
return 0;
}
/**
* The [Unit] will yell the message
*
* @param string msg : message for the [Unit] to yell
* @param uint32 language : language for the [Unit] to speak
*/
int SendUnitYell(Eluna* /*E*/, lua_State* L, Unit* unit)
{
const char* msg = Eluna::CHECKVAL<const char*>(L, 2);
@@ -2168,12 +2336,20 @@ namespace LuaUnit
return 0;
}
/**
* Clears the [Unit]'s combat
*/
int ClearInCombat(Eluna* /*E*/, lua_State* /*L*/, Unit* unit)
{
unit->ClearInCombat();
return 0;
}
/**
* Stops the [Unit]'s current spell cast
*
* @param uint32 spell = 0 : entry of a spell
*/
int StopSpellCast(Eluna* /*E*/, lua_State* L, Unit* unit)
{
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2, 0);
@@ -2181,6 +2357,14 @@ namespace LuaUnit
return 0;
}
/**
* Interrupts [Unit]'s spell state, casting, etc.
*
* if spell is not interruptible, it will return
*
* @param int32 spellType : type of spell to interrupt
* @param bool delayed = true : skips if the spell is delayed
*/
int InterruptSpell(Eluna* /*E*/, lua_State* L, Unit* unit)
{
int spellType = Eluna::CHECKVAL<int>(L, 2);
@@ -2271,6 +2455,12 @@ namespace LuaUnit
return 0;
}
/**
* The [Unit] plays a sound to a [Player], if no [Player] it will play the sound to everyone near
*
* @param uint32 sound : entry of a sound
* @param [Player] player : [Player] to play the sound to
*/
int PlayDirectSound(Eluna* /*E*/, lua_State* L, Unit* unit)
{
uint32 soundId = Eluna::CHECKVAL<uint32>(L, 2);
@@ -2285,6 +2475,15 @@ namespace LuaUnit
return 0;
}
/**
* The [Unit] plays a sound to a [Player]
*
* If no [Player] it will play the sound to everyone near
* Sound will fade the further you are
*
* @param uint32 sound : entry of a sound
* @param [Player] player : [Player] to play the sound to
*/
int PlayDistanceSound(Eluna* /*E*/, lua_State* L, Unit* unit)
{
uint32 soundId = Eluna::CHECKVAL<uint32>(L, 2);

View File

@@ -23,7 +23,6 @@ using namespace Hooks;
return;\
LOCK_ELUNA
// Vehicle
void Eluna::OnInstall(Vehicle* vehicle)
{
START_HOOK(VEHICLE_EVENT_ON_INSTALL);

View File

@@ -14,7 +14,12 @@
*/
namespace LuaVehicle
{
/* BOOLEAN */
/**
* Returns true if the [Unit] passenger is on board
*
* @param [Unit] passenger
* @return bool isOnBoard
*/
int IsOnBoard(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
{
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
@@ -26,7 +31,11 @@ namespace LuaVehicle
return 1;
}
/* GETTERS */
/**
* Returns the [Vehicle]'s owner
*
* @return [Unit] owner
*/
int GetOwner(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
{
#ifndef TRINITY
@@ -37,6 +46,11 @@ namespace LuaVehicle
return 1;
}
/**
* Returns the [Vehicle]'s entry
*
* @return uint32 entry
*/
int GetEntry(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
{
#ifndef TRINITY
@@ -47,6 +61,12 @@ namespace LuaVehicle
return 1;
}
/**
* Returns the [Vehicle]'s passenger in the specified seat
*
* @param int8 seat
* @return [Unit] passenger
*/
int GetPassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
{
int8 seatId = Eluna::CHECKVAL<int8>(L, 2);
@@ -54,7 +74,12 @@ namespace LuaVehicle
return 1;
}
/* OTHER */
/**
* Adds [Unit] passenger to a specified seat in the [Vehicle]
*
* @param [Unit] passenger
* @param int8 seat
*/
int AddPassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
{
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
@@ -68,6 +93,11 @@ namespace LuaVehicle
return 0;
}
/**
* Removes [Unit] passenger from the [Vehicle]
*
* @param [Unit] passenger
*/
int RemovePassenger(Eluna* /*E*/, lua_State* L, Vehicle* vehicle)
{
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
@@ -80,6 +110,6 @@ namespace LuaVehicle
}
}
#endif
#endif
#endif
#endif // CLASSIC
#endif // TBC
#endif // VEHICLEMETHODS_H