Mercurial > wow > mylilpony
diff libMyLilPony/libMyLilPony_miscFunctions.lua @ 50:22011265a16f 1.2.0-b1
Updated and fixed for draenor xpack (patch 6.0) API changes
author | syzler |
---|---|
date | Sat, 07 Mar 2015 02:52:57 -0500 |
parents | 21764271e02f |
children | 64e8f8e5fa41 |
line wrap: on
line diff
--- a/libMyLilPony/libMyLilPony_miscFunctions.lua Fri Sep 21 01:50:56 2012 -0400 +++ b/libMyLilPony/libMyLilPony_miscFunctions.lua Sat Mar 07 02:52:57 2015 -0500 @@ -51,6 +51,16 @@ return buffs; end +--- Performs case-sensitive 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.StringMatch(subject, pattern) + if subject == nil and pattern == nil then return true end + if subject == nil or pattern == nil then return false end + return string.match(subject, pattern); +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. @@ -63,13 +73,29 @@ 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. +--- Calls a mount if a specified condition checks out. +-- @param unused The type of companion to be called (e.g. "MOUNT"). +-- @param slotID The slot ID of the mount to be called. -- @param condition An optional Boolean condition. -function MyLilPony.CallCompanion(companionType, companionNumber, condition) +function MyLilPony.CallCompanion(unused, slotID, condition) if condition == nil or condition then - CallCompanion(companionType, companionNumber); + C_MountJournal.Summon(slotID); + end +end + +--- Iterates over all known and non-hidden (i.e. not dead or opposite faction) mount slot IDs. +-- @return A list of valid mount slot IDs. +function MyLilPony.EnumerateKnownMountSlotIDs() + local countMounts = C_MountJournal.GetNumMounts(); + local x = 1; + return function() + for i = x, countMounts do + local _, _, _, _, _, _, _, _, _, hidden, known = C_MountJournal.GetMountInfo(i); + if known and not hidden then + x = i + 1; + return i; + end + end end end