From b559d026582d1c3fd82b4ee2c6c42ff2dcbc5acd Mon Sep 17 00:00:00 2001 From: Aldori Date: Wed, 17 Sep 2025 09:01:24 -0400 Subject: [PATCH] Feat(Documentation): Add missing documentation for all methods and classes (#315) --- src/LuaEngine/methods/AchievementMethods.h | 5 + src/LuaEngine/methods/ChatHandlerMethods.h | 7 + src/LuaEngine/methods/CreatureMethods.h | 12 ++ src/LuaEngine/methods/GameObjectMethods.h | 3 +- .../methods/GemPropertiesEntryMethods.h | 7 + src/LuaEngine/methods/GlobalMethods.h | 29 +-- src/LuaEngine/methods/GroupMethods.h | 2 + src/LuaEngine/methods/GuildMethods.h | 10 +- src/LuaEngine/methods/ItemMethods.h | 20 ++ src/LuaEngine/methods/ItemTemplateMethods.h | 7 + src/LuaEngine/methods/LootMethods.h | 2 +- src/LuaEngine/methods/PlayerMethods.h | 32 ++- src/LuaEngine/methods/QuestMethods.h | 2 + src/LuaEngine/methods/RollMethods.h | 7 + src/LuaEngine/methods/SpellEntryMethods.h | 150 +++++++++++++- src/LuaEngine/methods/SpellInfoMethods.h | 195 +++++++++++++++++- src/LuaEngine/methods/TicketMethods.h | 44 ++-- src/LuaEngine/methods/UnitMethods.h | 15 +- src/LuaEngine/methods/VehicleMethods.h | 2 + src/LuaEngine/methods/WorldObjectMethods.h | 2 + 20 files changed, 498 insertions(+), 55 deletions(-) diff --git a/src/LuaEngine/methods/AchievementMethods.h b/src/LuaEngine/methods/AchievementMethods.h index e508f09..330fc55 100644 --- a/src/LuaEngine/methods/AchievementMethods.h +++ b/src/LuaEngine/methods/AchievementMethods.h @@ -7,6 +7,11 @@ #ifndef ACHIEVEMENTMETHODS_H #define ACHIEVEMENTMETHODS_H +/*** + * Represents an entry from the game's achievement database (e.g., achievement earned for completing certain tasks). + * + * Inherits all methods from: none + */ namespace LuaAchievement { /** diff --git a/src/LuaEngine/methods/ChatHandlerMethods.h b/src/LuaEngine/methods/ChatHandlerMethods.h index aa9f795..4e877a6 100644 --- a/src/LuaEngine/methods/ChatHandlerMethods.h +++ b/src/LuaEngine/methods/ChatHandlerMethods.h @@ -9,6 +9,13 @@ #include "Chat.h" +/*** + * Provides access to in-game and console chat commands, messages, and selection context for command execution. + * + * Used primarily in GM scripts or command handlers to send messages, check permissions, and access selected targets. + * + * Inherits all methods from: none + */ namespace LuaChatHandler { /** diff --git a/src/LuaEngine/methods/CreatureMethods.h b/src/LuaEngine/methods/CreatureMethods.h index b7c1def..81c6fcf 100644 --- a/src/LuaEngine/methods/CreatureMethods.h +++ b/src/LuaEngine/methods/CreatureMethods.h @@ -835,6 +835,12 @@ namespace LuaCreature return 1; } + /** + * Returns the loot mode flags for the specified [Creature]. + * + * @param [Creature] creature : the creature whose loot mode to get + * @return uint16 lootMode : the loot mode bitmask of the creature + */ int GetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features { Eluna::Push(L, creature->GetLootMode()); @@ -936,6 +942,12 @@ namespace LuaCreature return 0; } + /** + * Sets the loot mode flags for the specified [Creature]. + * + * @param [Creature] creature : the creature whose loot mode to set + * @param uint16 lootMode : the loot mode bitmask to apply + */ int SetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features { uint16 lootMode = Eluna::CHECKVAL(L, 2); diff --git a/src/LuaEngine/methods/GameObjectMethods.h b/src/LuaEngine/methods/GameObjectMethods.h index 513a92b..98efedf 100644 --- a/src/LuaEngine/methods/GameObjectMethods.h +++ b/src/LuaEngine/methods/GameObjectMethods.h @@ -8,6 +8,8 @@ #define GAMEOBJECTMETHODS_H /*** + * Represents a game object in the world, such as doors, chests, and other interactive objects. + * * Inherits all methods from: [Object], [WorldObject] */ namespace LuaGameObject @@ -224,7 +226,6 @@ namespace LuaGameObject * @param uint32 amount = 1 : amount of the [Item] to add to the loot * @return uint32 itemGUIDlow : low GUID of the [Item] */ - int AddLoot(lua_State* L, GameObject* go) { int i = 1; diff --git a/src/LuaEngine/methods/GemPropertiesEntryMethods.h b/src/LuaEngine/methods/GemPropertiesEntryMethods.h index 06bd069..17979a2 100644 --- a/src/LuaEngine/methods/GemPropertiesEntryMethods.h +++ b/src/LuaEngine/methods/GemPropertiesEntryMethods.h @@ -7,6 +7,13 @@ #ifndef GEMPROPERTIESENTRYMETHODS_H #define GEMPROPERTIESENTRYMETHODS_H +/*** + * Represents static gem data used in item enhancement, including spell enchantments triggered by socketed gems. + * + * Provides access to gem-related properties from the DBC table `GemProperties.dbc`. + * + * Inherits all methods from: none + */ namespace LuaGemPropertiesEntry { diff --git a/src/LuaEngine/methods/GlobalMethods.h b/src/LuaEngine/methods/GlobalMethods.h index 462b241..7cb78a7 100644 --- a/src/LuaEngine/methods/GlobalMethods.h +++ b/src/LuaEngine/methods/GlobalMethods.h @@ -105,7 +105,6 @@ namespace LuaGlobalFunctions * - for TrinityCore returns the realmID as it is in the conf file. * @return uint32 realm ID */ - int GetRealmID(lua_State* L) { Eluna::Push(L, sConfigMgr->GetOption("RealmID", 1)); @@ -362,6 +361,12 @@ namespace LuaGlobalFunctions return 1; } + /** + * Returns the [ItemTemplate] for the specified item ID. The ItemTemplate contains all static data about an item, such as name, quality, stats, required level, and more. + * + * @param uint32 itemID : the item entry ID from `item_template` to look up + * @return [ItemTemplate] itemTemplate + */ int GetItemTemplate(lua_State* L) { uint32 entry = Eluna::CHECKVAL(L, 1); @@ -3453,15 +3458,14 @@ namespace LuaGlobalFunctions } /** - * Return the entrance position (x, y, z, o) of the specified dungeon map id + * Return the entrance position (x, y, z, o) of the specified dungeon map id. * * @param uint32 mapId * - * return uint32 pos_x - * return uint32 pos_y - * return uint32 pos_z - * return uint32 pos_o - * + * @return uint32 pos_x + * @return uint32 pos_y + * @return uint32 pos_z + * @return uint32 pos_o */ int GetMapEntrance(lua_State* L) { @@ -3497,15 +3501,14 @@ namespace LuaGlobalFunctions } /** - * Returns the instance of the specified DBC (DatabaseClient) store. + * Returns an entry from the specified DBC (DatabaseClient) store. * - * This function retrieves the DBC store associated with the provided name - * and pushes it onto the Lua stack. + * This function looks up an entry in a DBC file by name and ID, and pushes it onto the Lua stack. * - * @param const char* dbcName : The name of the DBC store to retrieve. - * @param uint32 id : The ID used to look up within the specified DBC store. + * @param string dbcName : The name of the DBC store (e.g., "ItemDisplayInfo") + * @param uint32 id : The ID used to look up within the specified DBC store * - * @return [DBCStore] store : The requested DBC store instance. + * @return [DBCStore] store : The requested DBC store instance */ int LookupEntry(lua_State* L) { diff --git a/src/LuaEngine/methods/GroupMethods.h b/src/LuaEngine/methods/GroupMethods.h index ee7d39c..bd5dbac 100644 --- a/src/LuaEngine/methods/GroupMethods.h +++ b/src/LuaEngine/methods/GroupMethods.h @@ -8,6 +8,8 @@ #define GROUPMETHODS_H /*** + * Represents a player group in the game, such as a party or raid. + * * Inherits all methods from: none */ namespace LuaGroup diff --git a/src/LuaEngine/methods/GuildMethods.h b/src/LuaEngine/methods/GuildMethods.h index 87ab13a..5977c2a 100644 --- a/src/LuaEngine/methods/GuildMethods.h +++ b/src/LuaEngine/methods/GuildMethods.h @@ -8,6 +8,8 @@ #define GUILDMETHODS_H /*** + * Represents a player guild. Used to manage guild members, ranks, guild bank. + * * Inherits all methods from: none */ namespace LuaGuild @@ -275,25 +277,25 @@ namespace LuaGuild * Send message to [Guild] from specific [Player]. * * @param [Player] player : the [Player] is the author of the message - * @param bool officierOnly : send message only on officier channel + * @param bool officerOnly : send message only on officer channel * @param string msg : the message you need to send * @param uint32 lang : language the [Player] will speak */ int SendMessage(lua_State* L, Guild* guild) { Player* player = Eluna::CHECKOBJ(L, 2); - bool officierOnly = Eluna::CHECKVAL(L, 3, false); + bool officerOnly = Eluna::CHECKVAL(L, 3, false); std::string msg = Eluna::CHECKVAL(L, 4); uint32 language = Eluna::CHECKVAL(L, 5, false); - guild->BroadcastToGuild(player->GetSession(), officierOnly, msg, language); + guild->BroadcastToGuild(player->GetSession(), officerOnly, msg, language); return 0; } /** * Invites [Guild] members to events based on level and rank filters. * - * @param Player player : who sends the invitation + * @param [Player] player : who sends the invitation * @param uint32 minLevel : the required min level * @param uint32 maxLevel : the required max level * @param uint32 minRank : the required min rank diff --git a/src/LuaEngine/methods/ItemMethods.h b/src/LuaEngine/methods/ItemMethods.h index 2476594..018cf9a 100644 --- a/src/LuaEngine/methods/ItemMethods.h +++ b/src/LuaEngine/methods/ItemMethods.h @@ -8,6 +8,8 @@ #define ITEMMETHODS_H /*** + * Represents an instance of an item in the game world. + * * Inherits all methods from: [Object] */ namespace LuaItem @@ -298,6 +300,12 @@ namespace LuaItem return 1; } + /** + * Returns the GUID of the [Player] who owns the specified [Item]. + * + * @param [Item] item + * @return uint64 ownerGUID + */ int GetOwnerGUID(lua_State* L, Item* item) { Eluna::Push(L, item->GetOwnerGUID()); @@ -551,6 +559,12 @@ namespace LuaItem return 1; } + /** + * Returns the number of stat entries defined on the [Item]'s [ItemTemplate]. This reflects how many stat slots (e.g., Strength, Stamina, etc.) are defined for the item. + * + * @param [Item] item + * @return uint32 statsCount + */ int GetStatsCount(lua_State* L, Item* item) { Eluna::Push(L, item->GetTemplate()->StatsCount); @@ -568,6 +582,12 @@ namespace LuaItem return 1; } + /** + * Returns the random suffix ID of the specified [Item]. This corresponds to the `RandomSuffix` field from the item's [ItemTemplate], which controls the applied suffix (e.g., "of the Bear", "of the Eagle"). + * + * @param [Item] item + * @return uint32 randomSuffixId + */ int GetRandomSuffix(lua_State* L, Item* item) { Eluna::Push(L, item->GetTemplate()->RandomSuffix); diff --git a/src/LuaEngine/methods/ItemTemplateMethods.h b/src/LuaEngine/methods/ItemTemplateMethods.h index b7ffe3d..6b8e1c9 100644 --- a/src/LuaEngine/methods/ItemTemplateMethods.h +++ b/src/LuaEngine/methods/ItemTemplateMethods.h @@ -9,6 +9,13 @@ #include "Chat.h" +/*** + * Represents item data defined in the database and DBCs, such as stats, quality, class restrictions, and display info. + * + * Used to access read-only metadata about items (not specific item instances in bags or equipment). + * + * Inherits all methods from: none + */ namespace LuaItemTemplate { /** diff --git a/src/LuaEngine/methods/LootMethods.h b/src/LuaEngine/methods/LootMethods.h index 0b74b1c..db3faaf 100644 --- a/src/LuaEngine/methods/LootMethods.h +++ b/src/LuaEngine/methods/LootMethods.h @@ -354,7 +354,7 @@ namespace LuaLoot /** * Returns the [Player] GUID that owns this loot for round robin distribution. * - * @return ObjectGUID roundRobinPlayer : the player GUID + * @return ObjectGuid roundRobinPlayer : the player GUID */ int GetRoundRobinPlayer(lua_State* L, Loot* loot) { diff --git a/src/LuaEngine/methods/PlayerMethods.h b/src/LuaEngine/methods/PlayerMethods.h index 0a68ac6..3b51411 100644 --- a/src/LuaEngine/methods/PlayerMethods.h +++ b/src/LuaEngine/methods/PlayerMethods.h @@ -531,6 +531,13 @@ namespace LuaPlayer return 1; } + /** + * Returns `true` if the [Player] is in the same group and visible to the specified [Player], `false` otherwise. + * + * @param [Player] player : the source player + * @param [Player] target : the player to check visibility from + * @return bool isGroupVisible + */ int IsGroupVisibleFor(lua_State* L, Player* player) { Player* target = Eluna::CHECKOBJ(L, 2); @@ -592,6 +599,12 @@ namespace LuaPlayer return 1; } + /** + * Returns `true` if the [Player] is currently visible to other players, `false` if hidden via GM invisibility. + * + * @param [Player] player + * @return bool isVisible + */ int IsGMVisible(lua_State* L, Player* player) { Eluna::Push(L, player->isGMVisible()); @@ -609,6 +622,12 @@ namespace LuaPlayer return 1; } + /** + * Returns `true` if the [Player] has GM chat enabled, `false` otherwise. + * + * @param [Player] player + * @return bool isGMChat + */ int IsGMChat(lua_State* L, Player* player) { Eluna::Push(L, player->isGMChat()); @@ -3123,6 +3142,12 @@ namespace LuaPlayer return 1; } + /** + * Adds a specified number of lifetime honorable kills to the [Player]. + * + * @param [Player] player + * @param uint32 kills + */ int AddLifetimeKills(lua_State* L, Player* player) { uint32 val = Eluna::CHECKVAL(L, 2); @@ -3417,9 +3442,10 @@ namespace LuaPlayer } /** - * Get glyphId of the glyph slot specified by `slotIndex` off the [Player]'s current talent specialization.` - * @param uint32 slotIndex - * @return glyphId of the glyph in the selected glyph slot or 0 in case the glyph slot is empty + * Returns the glyph ID in the specified glyph slot of the [Player]'s current talent specialization. + * + * @param [uint32] slotIndex + * @return [uint32] glyphId */ int GetGlyph(lua_State* L, Player* player) { diff --git a/src/LuaEngine/methods/QuestMethods.h b/src/LuaEngine/methods/QuestMethods.h index 5b46d36..879d9f4 100644 --- a/src/LuaEngine/methods/QuestMethods.h +++ b/src/LuaEngine/methods/QuestMethods.h @@ -8,6 +8,8 @@ #define QUESTMETHODS_H /*** + * Represents a quest in the game, including its objectives, rewards, and conditions. + * * Inherits all methods from: none */ namespace LuaQuest diff --git a/src/LuaEngine/methods/RollMethods.h b/src/LuaEngine/methods/RollMethods.h index d36fe11..952461e 100644 --- a/src/LuaEngine/methods/RollMethods.h +++ b/src/LuaEngine/methods/RollMethods.h @@ -9,6 +9,13 @@ #include "Group.h" +/*** + * Represents a group loot roll session for an item, including player votes and roll statistics. + * + * Provides access to the item being rolled, player vote types, and counts of each roll type (Need, Greed, Pass). + * + * Inherits all methods from: none + */ namespace LuaRoll { /** diff --git a/src/LuaEngine/methods/SpellEntryMethods.h b/src/LuaEngine/methods/SpellEntryMethods.h index cd262bc..b458182 100644 --- a/src/LuaEngine/methods/SpellEntryMethods.h +++ b/src/LuaEngine/methods/SpellEntryMethods.h @@ -7,6 +7,13 @@ #ifndef SPELLENTRYMETHODS_H #define SPELLENTRYMETHODS_H +/*** + * Represents spell data loaded from the DBCs, including effects, costs, attributes, and requirements. + * + * Used for inspecting the properties of any spell in the game, such as mana cost, targets, or effects. + * + * Inherits all methods from: none + */ namespace LuaSpellEntry { /** @@ -152,6 +159,13 @@ namespace LuaSpellEntry return 1; } + /** + * Returns the stance restriction bitmask for which the [SpellEntry] cannot be used. + * + * This mask indicates which shapeshift forms (stances) prevent the spell from being cast. + * + * @return uint32 stancesNotMask + */ int GetStancesNot(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->StancesNot); @@ -180,66 +194,143 @@ namespace LuaSpellEntry return 1; } + /** + * Returns the SpellFocus ID required to cast this [SpellEntry]. + * + * Some spells require proximity to a specific game object (e.g., a brazier or altar). + * + * @return uint32 spellFocusId + */ int GetRequiresSpellFocus(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->RequiresSpellFocus); return 1; } + /** + * Returns the facing flags for this [SpellEntry]. + * + * Indicates whether the caster must be facing the target or meet other orientation constraints. + * + * @return uint32 facingFlags + */ int GetFacingCasterFlags(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->FacingCasterFlags); return 1; } + /** + * Returns the required caster aura state for this [SpellEntry]. + * + * The spell can only be cast if the caster has a specific aura state active. + * + * @return uint32 casterAuraState + */ int GetCasterAuraState(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->CasterAuraState); return 1; } + /** + * Returns the required target aura state for this [SpellEntry]. + * + * The spell can only be cast if the target has a specific aura state active. + * + * @return uint32 targetAuraState + */ int GetTargetAuraState(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->TargetAuraState); return 1; } + /** + * Returns the forbidden caster aura state for this [SpellEntry]. + * + * The spell cannot be cast if the caster has this aura state active. + * + * @return uint32 casterAuraStateNot + */ int GetCasterAuraStateNot(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->CasterAuraStateNot); return 1; } + /** + * Returns the forbidden target aura state for this [SpellEntry]. + * + * The spell cannot be cast if the target has this aura state active. + * + * @return uint32 targetAuraStateNot + */ int GetTargetAuraStateNot(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->TargetAuraStateNot); return 1; } + /** + * Returns the required aura spell ID that must be on the caster. + * + * The spell can only be cast if the caster has an aura from this spell. + * + * @return uint32 casterAuraSpellId + */ int GetCasterAuraSpell(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->CasterAuraSpell); return 1; } + /** + * Returns the required aura spell ID that must be on the target. + * + * The spell can only be cast if the target has an aura from this spell. + * + * @return uint32 targetAuraSpellId + */ int GetTargetAuraSpell(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->TargetAuraSpell); return 1; } + /** + * Returns the aura spell ID that must NOT be on the caster. + * + * The spell cannot be cast if the caster has an aura from this spell. + * + * @return uint32 excludeCasterAuraSpellId + */ int GetExcludeCasterAuraSpell(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->ExcludeCasterAuraSpell); return 1; } + /** + * Returns the aura spell ID that must NOT be on the target. + * + * The spell cannot be cast if the target has an aura from this spell. + * + * @return uint32 excludeTargetAuraSpellId + */ int GetExcludeTargetAuraSpell(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->ExcludeTargetAuraSpell); return 1; } + /** + * Returns the casting time index of this [SpellEntry]. + * + * This index is used to look up the base casting time in SpellCastTimes.dbc. + * + * @return uint32 castingTimeIndex + */ int GetCastingTimeIndex(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->CastingTimeIndex); @@ -268,24 +359,52 @@ namespace LuaSpellEntry return 1; } + /** + * Returns the interrupt flags for this [SpellEntry]. + * + * Determines what can interrupt this spell while casting (e.g., movement, taking damage). + * + * @return uint32 interruptFlags + */ int GetInterruptFlags(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->InterruptFlags); return 1; } + /** + * Returns the aura interrupt flags for this [SpellEntry]. + * + * Indicates what actions will break or remove the aura applied by this spell. + * + * @return uint32 auraInterruptFlags + */ int GetAuraInterruptFlags(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->AuraInterruptFlags); return 1; } + /** + * Returns the channel interrupt flags for this [SpellEntry]. + * + * Specifies conditions under which a channeled spell will be interrupted (e.g., moving or turning). + * + * @return uint32 channelInterruptFlags + */ int GetChannelInterruptFlags(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->ChannelInterruptFlags); return 1; } + /** + * Returns the proc flags for this [SpellEntry]. + * + * Determines the types of actions or triggers that can cause this spell to proc. + * + * @return uint32 procFlags + */ int GetProcFlags(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->ProcFlags); @@ -899,6 +1018,14 @@ namespace LuaSpellEntry return 1; } + /** + * Returns a table of [SpellFamilyFlags] for each effect of this [SpellEntry]. + * + * These flags are used to categorize spell effects for use with spell group logic. + * The table contains up to 3 bitmask entries, one per effect. + * + * @return table effectSpellClassMask : table of [SpellFamilyFlags] per effect + */ int GetEffectSpellClassMask(lua_State* L, SpellEntry* entry) { lua_newtable(L); @@ -1055,13 +1182,26 @@ namespace LuaSpellEntry return 1; } - + /** + * Returns the spell family name of this [SpellEntry]. + * + * This identifies the broader category or class of spells (e.g., Mage, Warrior, Rogue). + * + * @return uint32 spellFamilyName + */ int GetSpellFamilyName(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->SpellFamilyName); return 1; } + /** + * Returns the spell family flags of this [SpellEntry]. + * + * These bitflags represent specific characteristics or subcategories of spells within a family. + * + * @return uint64 spellFamilyFlags + */ int GetSpellFamilyFlags(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->SpellFamilyFlags); @@ -1143,6 +1283,13 @@ namespace LuaSpellEntry return 1; } + /** + * Returns the Area Group ID associated with this [SpellEntry]. + * + * AreaGroupId is used to restrict spell usage to specific zones or areas. + * + * @return uint32 areaGroupId + */ int GetAreaGroupId(lua_State* L, SpellEntry* entry) { Eluna::Push(L, entry->AreaGroupId); @@ -2256,4 +2403,3 @@ namespace LuaSpellEntry } #endif - diff --git a/src/LuaEngine/methods/SpellInfoMethods.h b/src/LuaEngine/methods/SpellInfoMethods.h index dc4c305..4b4cdab 100644 --- a/src/LuaEngine/methods/SpellInfoMethods.h +++ b/src/LuaEngine/methods/SpellInfoMethods.h @@ -7,6 +7,14 @@ #ifndef SPELLINFOMETHODS_H #define SPELLINFOMETHODS_H +/*** + * Represents spell metadata used for behavior, targeting, attributes, mechanics, auras, and conditions. + * + * Unlike [SpellEntry], this class includes helper functions and logic used to determine spell behavior in-game. + * Used for checking if a spell is passive, area-targeted, profession-related, or has specific effects or auras. + * + * Inherits all methods from: none + */ namespace LuaSpellInfo { @@ -391,13 +399,13 @@ namespace LuaSpellInfo } /** - * Checks if the [SpellInfo] requires to be triggered by the caster of another specified spell. + * Checks if the [SpellInfo] requires to be triggered by the caster of another specified [SpellInfo]. * * Certain spells or abilities can only be activated or become effective when they are triggered by the caster - * of another specific spell (the triggeringSpell). This function examines if the spell or ability represented + * of another specific spell (the `triggeringSpell`). This function examines if the spell or ability represented * by [SpellInfo] has such requirement. * - * @param triggeringSpell The spell by the casting of which the ability or spell represented by [SpellInfo] is triggered. + * @param [SpellInfo] triggeringSpell : the spell by the casting of which the ability or spell represented by [SpellInfo] is triggered * @return [bool] needs_to_be_triggered_by_caster */ int NeedsToBeTriggeredByCaster(lua_State* L, SpellInfo* spell_info) @@ -528,24 +536,45 @@ namespace LuaSpellInfo return 1; } + /** + * Returns `true` if the [SpellInfo] allows casting on dead targets, `false` otherwise. + * + * @return bool allowsDeadTarget + */ int IsAllowingDeadTarget(lua_State* L, SpellInfo* spell_info) { Eluna::Push(L, spell_info->IsAllowingDeadTarget()); return 1; } + /** + * Returns `true` if the [SpellInfo] can be cast while in combat, `false` otherwise. + * + * @return bool usableInCombat + */ int CanBeUsedInCombat(lua_State* L, SpellInfo* spell_info) { Eluna::Push(L, spell_info->CanBeUsedInCombat()); return 1; } + /** + * Returns `true` if the [SpellInfo] is considered a positive (beneficial) spell, `false` otherwise. + * + * @return bool isPositive + */ int IsPositive(lua_State* L, SpellInfo* spell_info) { Eluna::Push(L, spell_info->IsPositive()); return 1; } + /** + * Returns `true` if the specified effect index of the [SpellInfo] is positive, `false` otherwise. + * + * @param uint8 effIndex + * @return bool isPositiveEffect + */ int IsPositiveEffect(lua_State* L, SpellInfo* spell_info) { uint8 effIndex = Eluna::CHECKVAL(L, 2); @@ -553,37 +582,66 @@ namespace LuaSpellInfo return 1; } + /** + * Returns `true` if the [SpellInfo] is a channeled spell, `false` otherwise. + * + * @return bool isChanneled + */ int IsChanneled(lua_State* L, SpellInfo* spell_info) { Eluna::Push(L, spell_info->IsChanneled()); return 1; } + /** + * Returns `true` if the [SpellInfo] requires combo points to cast, `false` otherwise. + * + * @return bool needsComboPoints + */ int NeedsComboPoints(lua_State* L, SpellInfo* spell_info) { Eluna::Push(L, spell_info->NeedsComboPoints()); return 1; } + /** + * Returns `true` if the [SpellInfo] breaks stealth when cast, `false` otherwise. + * + * @return bool breaksStealth + */ int IsBreakingStealth(lua_State* L, SpellInfo* spell_info) { Eluna::Push(L, spell_info->IsBreakingStealth()); return 1; } + /** + * Returns `true` if the [SpellInfo] is a ranged weapon attack (e.g., shoot, throw), `false` otherwise. + * + * @return bool isRangedWeaponSpell + */ int IsRangedWeaponSpell(lua_State* L, SpellInfo* spell_info) { Eluna::Push(L, spell_info->IsRangedWeaponSpell()); return 1; } + /** + * Returns `true` if the [SpellInfo] is an auto-repeat ranged spell (e.g., auto-shot), `false` otherwise. + * + * @return bool isAutoRepeat + */ int IsAutoRepeatRangedSpell(lua_State* L, SpellInfo* spell_info) { Eluna::Push(L, spell_info->IsAutoRepeatRangedSpell()); return 1; } - + /** + * Returns `true` if the [SpellInfo] is affected by spell modifiers (e.g., talents, auras), `false` otherwise. + * + * @return bool isAffectedByMods + */ int IsAffectedBySpellMods(lua_State* L, SpellInfo* spell_info) { Eluna::Push(L, spell_info->IsAffectedBySpellMods()); @@ -598,6 +656,12 @@ namespace LuaSpellInfo } */ + /** + * Returns `true` if the [SpellInfo] can pierce through an immunity aura defined by the given [SpellInfo], `false` otherwise. + * + * @param [SpellInfo] auraSpellInfo : the spell representing the immunity aura + * @return bool canPierce + */ int CanPierceImmuneAura(lua_State* L, SpellInfo* spell_info) { const SpellInfo* auraSpellInfo = Eluna::CHECKOBJ(L, 2); @@ -605,6 +669,12 @@ namespace LuaSpellInfo return 1; } + /** + * Returns `true` if the [SpellInfo] can dispel the specified aura [SpellInfo], `false` otherwise. + * + * @param [SpellInfo] auraSpellInfo : the aura spell to check + * @return bool canDispel + */ int CanDispelAura(lua_State* L, SpellInfo* spell_info) { const SpellInfo* auraSpellInfo = Eluna::CHECKOBJ(L, 2); @@ -612,12 +682,23 @@ namespace LuaSpellInfo return 1; } + /** + * Returns `true` if the [SpellInfo] only affects a single target, `false` if it affects multiple or area targets. + * + * @return bool isSingleTarget + */ int IsSingleTarget(lua_State* L, SpellInfo* spell_info) { Eluna::Push(L, spell_info->IsSingleTarget()); return 1; } + /** + * Returns `true` if the [SpellInfo] is mutually exclusive with the specified [SpellInfo] due to specific aura exclusivity rules. + * + * @param [SpellInfo] otherSpellInfo : the spell to compare exclusivity with + * @return bool isExclusive + */ int IsAuraExclusiveBySpecificWith(lua_State* L, SpellInfo* spell_info) { const SpellInfo* spellInfo = Eluna::CHECKOBJ(L, 2); @@ -625,6 +706,12 @@ namespace LuaSpellInfo return 1; } + /** + * Returns `true` if the [SpellInfo] is exclusive with the specified [SpellInfo] per caster, based on aura exclusivity rules. + * + * @param [SpellInfo] otherSpellInfo : the spell to compare exclusivity with + * @return bool isExclusivePerCaster + */ int IsAuraExclusiveBySpecificPerCasterWith(lua_State* L, SpellInfo* spell_info) { const SpellInfo* spellInfo = Eluna::CHECKOBJ(L, 2); @@ -632,6 +719,12 @@ namespace LuaSpellInfo return 1; } + /** + * Returns `true` if the [SpellInfo] can be cast while in the specified shapeshift form. + * + * @param uint32 form : the shapeshift form to check + * @return bool isAllowed + */ int CheckShapeshift(lua_State* L, SpellInfo* spell_info) { uint32 form = Eluna::CHECKVAL(L, 2); @@ -639,6 +732,16 @@ namespace LuaSpellInfo return 1; } + /** + * Returns `true` if the [SpellInfo] can be cast in the specified location. + * + * @param uint32 map_id : required map ID + * @param uint32 zone_id : required zone ID + * @param uint32 area_id : required area ID + * @param [Player] player : the [Player] casting the spell + * @param bool strict = false : whether all conditions must strictly match + * @return bool isAllowed + */ int CheckLocation(lua_State* L, SpellInfo* spell_info) { uint32 map_id = Eluna::CHECKVAL(L, 2); @@ -651,6 +754,14 @@ namespace LuaSpellInfo return 1; } + /** + * Returns `true` if the target is valid for the [SpellInfo]. + * + * @param [Unit] caster : the [Unit] casting the spell + * @param [WorldObject] target : the intended target + * @param bool implicit = true : whether implicit target checks should apply + * @return bool isValid + */ int CheckTarget(lua_State* L, SpellInfo* spell_info) { const Unit* caster = Eluna::CHECKOBJ(L, 2); @@ -661,6 +772,14 @@ namespace LuaSpellInfo return 1; } + /** + * Returns `true` if the [SpellInfo] can be explicitly cast on the given [target] with the optional [Item]. + * + * @param [Unit] caster : the [Unit] attempting to cast the spell + * @param [WorldObject] target : the intended target of the spell + * @param [Item] item : optional item used in the cast + * @return bool isValid + */ int CheckExplicitTarget(lua_State* L, SpellInfo* spell_info) { const Unit* caster = Eluna::CHECKOBJ(L, 2); @@ -671,6 +790,12 @@ namespace LuaSpellInfo return 1; } + /** + * Returns `true` if the [SpellInfo] can affect the [Unit] based on its creature type. + * + * @param [Unit] target : the [Unit] whose creature type is evaluated + * @return bool isValid + */ int CheckTargetCreatureType(lua_State* L, SpellInfo* spell_info) { const Unit* target = Eluna::CHECKOBJ(L, 2); @@ -679,18 +804,38 @@ namespace LuaSpellInfo return 1; } + /** + * Returns the school mask of the [SpellInfo]. + * + * The school mask is a bitmask representing the spell's school(s), such as arcane, fire, frost, etc. + * + * @return uint32 schoolMask + */ int GetSchoolMask(lua_State* L, SpellInfo* spell_info) { Eluna::Push(L, spell_info->GetSchoolMask()); return 1; } + /** + * Returns a combined mechanic mask of all effects for the [SpellInfo]. + * + * The mechanic mask is a bitmask representing all mechanics applied by the spell’s effects. + * + * @return uint32 mechanicMask + */ int GetAllEffectsMechanicMask(lua_State* L, SpellInfo* spell_info) { Eluna::Push(L, spell_info->GetAllEffectsMechanicMask()); return 1; } + /** + * Returns the mechanic mask of a specific effect of the [SpellInfo]. + * + * @param uint32 effIndex + * @return uint32 mechanicMask + */ int GetEffectMechanicMask(lua_State* L, SpellInfo* spell_info) { uint32 effIndex = Eluna::CHECKVAL(L, 2); @@ -699,6 +844,12 @@ namespace LuaSpellInfo return 1; } + /** + * Returns the mechanic mask for the [SpellInfo] based on an effect bitmask. + * + * @param uint32 effectmask : bitmask of effects to include + * @return uint32 mechanicMask + */ int GetSpellMechanicMaskByEffectMask(lua_State* L, SpellInfo* spell_info) { uint32 effectmask = Eluna::CHECKVAL(L, 2); @@ -707,6 +858,12 @@ namespace LuaSpellInfo return 1; } + /** + * Returns the mechanic of the specified effect index in the [SpellInfo]. + * + * @param uint32 effIndex + * @return uint32 mechanic + */ int GetEffectMechanic(lua_State* L, SpellInfo* spell_info) { uint32 effIndex = Eluna::CHECKVAL(L, 2); @@ -715,6 +872,14 @@ namespace LuaSpellInfo return 1; } + /** + * Returns the dispel mask for the [SpellInfo]. + * + * The dispel mask is a bitmask representing the types of dispels that can remove the spell's effects. + * + * @param uint32 type : optional type of dispel to check. If not provided, uses the spell's own dispel type. + * @return uint32 dispelMask + */ int GetDispelMask(lua_State* L, SpellInfo* spell_info) { uint32 type = Eluna::CHECKVAL(L, 2, false); @@ -723,18 +888,39 @@ namespace LuaSpellInfo return 1; } + /** + * Returns the explicit target mask of the [SpellInfo]. + * + * This mask defines what types of targets the spell can explicitly target. + * + * @return uint32 targetMask + */ int GetExplicitTargetMask(lua_State* L, SpellInfo* spell_info) { Eluna::Push(L, spell_info->GetExplicitTargetMask()); return 1; } + /** + * Returns the aura state requirement for the [SpellInfo]. + * + * Used to check whether a specific aura state must be active to cast the spell. + * + * @return uint32 auraState + */ int GetAuraState(lua_State* L, SpellInfo* spell_info) { Eluna::Push(L, spell_info->GetAuraState()); return 1; } + /** + * Returns the spell specific type of the [SpellInfo]. + * + * Useful for identifying special types such as food, bandages, portals, etc. + * + * @return uint32 spellSpecific + */ int GetSpellSpecific(lua_State* L, SpellInfo* spell_info) { Eluna::Push(L, spell_info->GetSpellSpecific()); @@ -742,4 +928,3 @@ namespace LuaSpellInfo } } #endif - diff --git a/src/LuaEngine/methods/TicketMethods.h b/src/LuaEngine/methods/TicketMethods.h index 44a5001..d0a0f1c 100644 --- a/src/LuaEngine/methods/TicketMethods.h +++ b/src/LuaEngine/methods/TicketMethods.h @@ -8,7 +8,7 @@ #define TICKETMETHODS_H /*** - * An instance of a spell, created when the spell is cast by a [Unit]. + * Represents a support ticket created by a [Player] using the in-game ticket system. * * Inherits all methods from: none */ @@ -17,7 +17,7 @@ namespace LuaTicket /** * Returns true if the [Ticket] is closed or false. * - * @return bool is_closed + * @return bool isClosed */ int IsClosed(lua_State* L, GmTicket* ticket) { @@ -28,7 +28,7 @@ namespace LuaTicket /** * Returns true if the [Ticket] is completed or false. * - * @return bool is_completed + * @return bool isCompleted */ int IsCompleted(lua_State* L, GmTicket* ticket) { @@ -39,9 +39,9 @@ namespace LuaTicket /** * Return true if this GUID is the same as the [Player] who created the [Ticket] or false. * - * @param guid playerGuid : desired playerGuid + * @param ObjectGuid playerGuid * - * @return bool same_guid + * @return bool isSamePlayer */ int IsFromPlayer(lua_State* L, GmTicket* ticket) { @@ -54,7 +54,7 @@ namespace LuaTicket /** * Return true if the [Ticket] is assigned or false. * - * @return bool is_assigned + * @return bool isAssigned */ int IsAssigned(lua_State* L, GmTicket* ticket) { @@ -63,11 +63,11 @@ namespace LuaTicket } /** - * Return true if the [Ticket] is assigned to the GUID or false. + * Return true if the [Ticket] is assigned to the [Player] or false. * - * @param guid playerGuid : desired playerGuid + * @param ObjectGuid playerGuid * - * @return bool is_assigned_to + * @return bool isAssignedTo */ int IsAssignedTo(lua_State* L, GmTicket* ticket) { @@ -78,11 +78,11 @@ namespace LuaTicket } /** - * Return true if the [Ticket] is not assigned to the GUID or false. + * Return true if the [Ticket] is not assigned to the [Player] or false. * - * @param guid playerGuid : desired playerGuid + * @param ObjectGuid playerGuid * - * @return bool is_assigned_not_to + * @return bool isAssignedNotTo */ int IsAssignedNotTo(lua_State* L, GmTicket* ticket) { @@ -95,7 +95,7 @@ namespace LuaTicket /** * Return the [Ticket] id. * - * @return unint32 ticket_id + * @return uint32 ticketId */ int GetId(lua_State* L, GmTicket* ticket) { @@ -117,7 +117,7 @@ namespace LuaTicket /** * Return the [Player] name from the [Ticket]. * - * @return string player_name + * @return string playerName */ int GetPlayerName(lua_State* L, GmTicket* ticket) { @@ -139,7 +139,7 @@ namespace LuaTicket /** * Returns the assigned [Player]. * - * @return [Player] assigned_player + * @return [Player] assignedPlayer */ int GetAssignedPlayer(lua_State* L, GmTicket* ticket) { @@ -150,7 +150,7 @@ namespace LuaTicket /** * Returns the assigned guid. * - * @return [ObjectGUID] assigned_guid + * @return uint32 assignedGuid */ int GetAssignedToGUID(lua_State* L, GmTicket* ticket) { @@ -161,7 +161,7 @@ namespace LuaTicket /** * Returns the last modified time from the [Ticket]. * - * @return uint64 last_modified + * @return uint64 lastModifiedTime */ int GetLastModifiedTime(lua_State* L, GmTicket* ticket) { @@ -172,8 +172,8 @@ namespace LuaTicket /** * Assign the [Ticket] to a player via his GUID. * - * @param guid playerGuid : desired playerGuid - * @param bool isAdmin : true if the guid is an Admin or false (default false) + * @param ObjectGuid playerGuid + * @param bool isAdmin : true if the [Player] is an Admin or false (default false) */ int SetAssignedTo(lua_State* L, GmTicket* ticket) { @@ -186,7 +186,7 @@ namespace LuaTicket /** * Set [Ticket] resolved by player via his GUID. * - * @param guid playerGuid : desired playerGuid + * @param ObjectGuid playerGuid */ int SetResolvedBy(lua_State* L, GmTicket* ticket) { @@ -234,7 +234,7 @@ namespace LuaTicket } /** - * Set [Ticket] is viewed. + * Set [Ticket] as viewed. * */ int SetViewed(lua_State* /*L*/, GmTicket* ticket) @@ -244,7 +244,7 @@ namespace LuaTicket } /** - * Set [Ticket] is unassigned. + * Set [Ticket] as unassigned. * */ int SetUnassigned(lua_State* /*L*/, GmTicket* ticket) diff --git a/src/LuaEngine/methods/UnitMethods.h b/src/LuaEngine/methods/UnitMethods.h index 6f4ccdb..9db85cd 100644 --- a/src/LuaEngine/methods/UnitMethods.h +++ b/src/LuaEngine/methods/UnitMethods.h @@ -8,6 +8,8 @@ #define UNITMETHODS_H /*** + * Represents a non-[Player] controlled [Unit] (i.e. NPCs). + * * Inherits all methods from: [Object], [WorldObject] */ namespace LuaUnit @@ -1175,13 +1177,11 @@ namespace LuaUnit return 1; } - /* - int GetVehicle(lua_State* L, Unit* unit) + /*int GetVehicle(lua_State* L, Unit* unit) { Eluna::Push(L, unit->GetVehicle()); return 1; - } - */ + }*/ /** * Returns the Critter Guid @@ -1793,6 +1793,13 @@ namespace LuaUnit return 0; } + /** + * Sets the [Unit]'s critter companion by GUID. + * + * This method assigns the specified [ObjectGuid] as the critter (non-combat pet) companion of the [Unit]. + * + * @param [ObjectGuid] guid : The GUID of the critter to set + */ int SetCritterGUID(lua_State* L, Unit* unit) { ObjectGuid guid = Eluna::CHECKVAL(L, 2); diff --git a/src/LuaEngine/methods/VehicleMethods.h b/src/LuaEngine/methods/VehicleMethods.h index 54a2183..833b671 100644 --- a/src/LuaEngine/methods/VehicleMethods.h +++ b/src/LuaEngine/methods/VehicleMethods.h @@ -8,6 +8,8 @@ #define VEHICLEMETHODS_H /*** + * Represents a vehicle in the game, which can carry passengers and provide special abilities or movement. + * * Inherits all methods from: none */ namespace LuaVehicle diff --git a/src/LuaEngine/methods/WorldObjectMethods.h b/src/LuaEngine/methods/WorldObjectMethods.h index d4a0217..b90ebc7 100644 --- a/src/LuaEngine/methods/WorldObjectMethods.h +++ b/src/LuaEngine/methods/WorldObjectMethods.h @@ -8,6 +8,8 @@ #define WORLDOBJECTMETHODS_H /*** + * Represents a [WorldObject] in the game world. + * * Inherits all methods from: [Object] */ namespace LuaWorldObject