Mercurial > wow > mylilpony
changeset 7:d96c15f7477b
Updated documentation for API.
author | syzler |
---|---|
date | Tue, 05 Apr 2011 02:05:57 +0000 |
parents | 21d6611a1307 |
children | 96d096f25339 |
files | .pkgmeta libMyLilPony/libMyLilPony_miscFunctions.lua libMyLilPony/libMyLilPony_mountData.lua libMyLilPony/libMyLilPony_mountFunctions.lua |
diffstat | 4 files changed, 31 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/.pkgmeta Tue Apr 05 01:11:23 2011 +0000 +++ b/.pkgmeta Tue Apr 05 02:05:57 2011 +0000 @@ -1,1 +0,0 @@ -license-output: LICENSE.txt
--- a/libMyLilPony/libMyLilPony_miscFunctions.lua Tue Apr 05 01:11:23 2011 +0000 +++ b/libMyLilPony/libMyLilPony_miscFunctions.lua Tue Apr 05 02:05:57 2011 +0000 @@ -16,8 +16,10 @@ -- Misc helper functions used in the library +--- Gets a hashtable of buffs on the specified unit. +-- @param unit The unit frame name (e.g. "target", "player", "focus") of the unit whose buffs are to be retrieved. +-- @returns a hashtable of buff spell IDs keyed on the ID. function MyLilPony.GetUnitBuffs(unit) - -- build a hashtable of buffs on the unit local buffs = {}; for i = 1, 40 do local _, _, _, _, _, _, _, _, _, _, id = UnitAura(unit, i, "HELPFUL"); @@ -28,6 +30,10 @@ return buffs; end +--- Performs case-insensitive string pattern matching. +-- @param subject The string on which the pattern matching is performed. +-- @param pattern The pattern to be matched. +-- @returns The match result captures, the entire string if there are no captures, or nil if the subject is not a match. function MyLilPony.StringMatchIgnoreCase(subject, pattern) if subject == nil and pattern == nil then return true end if subject == nil or pattern == nil then return false end @@ -36,12 +42,19 @@ return string.match(lSub, lPat); end +--- Calls a companion if a specified condition checks out. +-- @param companionType The type of companion to be called (e.g. "MOUNT"). +-- @param companionNumber The slot number of the companion to be called. +-- @param condition An optional Boolean condition. function MyLilPony.CallCompanion(companionType, companionNumber, condition) if condition == nil or condition then CallCompanion(companionType, companionNumber); end end +--- Gets a value indicating whether or not the current character is able to fly at the current location. +-- This function checks whether or not the current location is a flyable area, and then additionally checks for knowledge of the proper flying skill (e.g. Cold Weather Flying for Northrend). +-- @returns A Boolean value indicating whether or not the current character is able to fly at the current location. function MyLilPony.CanFlyHere() if IsFlyableArea() then SetMapToCurrentZone();
--- a/libMyLilPony/libMyLilPony_mountData.lua Tue Apr 05 01:11:23 2011 +0000 +++ b/libMyLilPony/libMyLilPony_mountData.lua Tue Apr 05 02:05:57 2011 +0000 @@ -87,26 +87,41 @@ [75207] = "V"; -- abyssal seahorse }; +--- Checks whether or not the specified spell ID is a ground mount. +-- @param spellId The spell ID of the mount to be checked. +-- @return A Boolean value indicating whether or not the specified spell is a ground mount. function MyLilPony.IsGroundMount(spellId) local entry = MyLilPony_Mounts[spellId]; return entry ~= nil and string.match(entry, "G"); end +--- Checks whether or not the specified spell ID is a flying mount. +-- @param spellId The spell ID of the mount to be checked. +-- @return A Boolean value indicating whether or not the specified spell is a flying mount. function MyLilPony.IsFlyingMount(spellId) local entry = MyLilPony_Mounts[spellId]; return entry ~= nil and string.match(entry, "A"); end +--- Checks whether or not the specified spell ID is an aquatic mount. +-- @param spellId The spell ID of the mount to be checked. +-- @return A Boolean value indicating whether or not the specified spell is an aquatic mount. function MyLilPony.IsAquaticMount(spellId) local entry = MyLilPony_Mounts[spellId]; return entry ~= nil and string.match(entry, "S"); end +--- Checks whether or not the specified spell ID is a Temple of Ahn'Qiraj mount. +-- @param spellId The spell ID of the mount to be checked. +-- @return A Boolean value indicating whether or not the specified spell is a Temple of Ahn'Qiraj mount. function MyLilPony.IsAhnQirajMount(spellId) local entry = MyLilPony_Mounts[spellId]; return entry ~= nil and string.match(entry, "Q"); end +--- Checks whether or not the specified spell ID is a Vash'jir mount. +-- @param spellId The spell ID of the mount to be checked. +-- @return A Boolean value indicating whether or not the specified spell is a Vash'jir mount. function MyLilPony.IsVashjirMount(spellId) local entry = MyLilPony_Mounts[spellId]; return entry ~= nil and string.match(entry, "V");
--- a/libMyLilPony/libMyLilPony_mountFunctions.lua Tue Apr 05 01:11:23 2011 +0000 +++ b/libMyLilPony/libMyLilPony_mountFunctions.lua Tue Apr 05 02:05:57 2011 +0000 @@ -165,7 +165,7 @@ -- Does nothing if the specified unit's mount is already summoned. -- @param unit The unit frame name (e.g. "target", "player", "focus") of the unit whose mount is desired. -- @return A Boolean value indicating whether or not a mount was successfully summoned. --- @usage MyLilPony.CallMountByMatch("target") +-- @usage MyLilPony.CallMountByMatch("target"); function MyLilPony.CallMountByMatch(unit) local result = false; local unitBuffs = MyLilPony.GetUnitBuffs(unit); @@ -189,7 +189,7 @@ -- local _, name, _, _, summoned = GetCompanionInfo("MOUNT", i); -- return not summoned and string.match(name, pattern); -- end --- return MyLilPony.CallMountByFilter(filter); +-- MyLilPony.CallMountByFilter(filter); function MyLilPony.CallMountByFilter(filter) local countMounts = GetNumCompanions("MOUNT"); if countMounts > 0 then