Mercurial > wow > mylilpony
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 49:d29ceeeab123 | 50:22011265a16f |
|---|---|
| 49 end | 49 end |
| 50 end | 50 end |
| 51 return buffs; | 51 return buffs; |
| 52 end | 52 end |
| 53 | 53 |
| 54 --- Performs case-sensitive string pattern matching. | |
| 55 -- @param subject The string on which the pattern matching is performed. | |
| 56 -- @param pattern The pattern to be matched. | |
| 57 -- @returns The match result captures, the entire string if there are no captures, or nil if the subject is not a match. | |
| 58 function MyLilPony.StringMatch(subject, pattern) | |
| 59 if subject == nil and pattern == nil then return true end | |
| 60 if subject == nil or pattern == nil then return false end | |
| 61 return string.match(subject, pattern); | |
| 62 end | |
| 63 | |
| 54 --- Performs case-insensitive string pattern matching. | 64 --- Performs case-insensitive string pattern matching. |
| 55 -- @param subject The string on which the pattern matching is performed. | 65 -- @param subject The string on which the pattern matching is performed. |
| 56 -- @param pattern The pattern to be matched. | 66 -- @param pattern The pattern to be matched. |
| 57 -- @returns The match result captures, the entire string if there are no captures, or nil if the subject is not a match. | 67 -- @returns The match result captures, the entire string if there are no captures, or nil if the subject is not a match. |
| 58 function MyLilPony.StringMatchIgnoreCase(subject, pattern) | 68 function MyLilPony.StringMatchIgnoreCase(subject, pattern) |
| 61 local lSub = string.lower(subject); | 71 local lSub = string.lower(subject); |
| 62 local lPat = string.lower(pattern); | 72 local lPat = string.lower(pattern); |
| 63 return string.match(lSub, lPat); | 73 return string.match(lSub, lPat); |
| 64 end | 74 end |
| 65 | 75 |
| 66 --- Calls a companion if a specified condition checks out. | 76 --- Calls a mount if a specified condition checks out. |
| 67 -- @param companionType The type of companion to be called (e.g. "MOUNT"). | 77 -- @param unused The type of companion to be called (e.g. "MOUNT"). |
| 68 -- @param companionNumber The slot number of the companion to be called. | 78 -- @param slotID The slot ID of the mount to be called. |
| 69 -- @param condition An optional Boolean condition. | 79 -- @param condition An optional Boolean condition. |
| 70 function MyLilPony.CallCompanion(companionType, companionNumber, condition) | 80 function MyLilPony.CallCompanion(unused, slotID, condition) |
| 71 if condition == nil or condition then | 81 if condition == nil or condition then |
| 72 CallCompanion(companionType, companionNumber); | 82 C_MountJournal.Summon(slotID); |
| 83 end | |
| 84 end | |
| 85 | |
| 86 --- Iterates over all known and non-hidden (i.e. not dead or opposite faction) mount slot IDs. | |
| 87 -- @return A list of valid mount slot IDs. | |
| 88 function MyLilPony.EnumerateKnownMountSlotIDs() | |
| 89 local countMounts = C_MountJournal.GetNumMounts(); | |
| 90 local x = 1; | |
| 91 return function() | |
| 92 for i = x, countMounts do | |
| 93 local _, _, _, _, _, _, _, _, _, hidden, known = C_MountJournal.GetMountInfo(i); | |
| 94 if known and not hidden then | |
| 95 x = i + 1; | |
| 96 return i; | |
| 97 end | |
| 98 end | |
| 73 end | 99 end |
| 74 end | 100 end |
| 75 | 101 |
| 76 --- Gets a value indicating whether or not the current character is able to fly at the current location. | 102 --- Gets a value indicating whether or not the current character is able to fly at the current location. |
| 77 -- 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). | 103 -- 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). |
