Mercurial > wow > mylilpony
comparison libMyLilPony/libMyLilPony_miscFunctions.lua @ 52:64e8f8e5fa41
Simplified some functions since mount type is can be determined from slot ID
| author | syzler |
|---|---|
| date | Sat, 07 Mar 2015 14:15:17 -0500 |
| parents | 22011265a16f |
| children | 81145a681a59 |
comparison
equal
deleted
inserted
replaced
| 51:9d3c8c1e84f3 | 52:64e8f8e5fa41 |
|---|---|
| 1 -- Copyright (c) 2011, Syzler | 1 -- Copyright (c) 2015, Syzler |
| 2 -- All rights reserved. | 2 -- All rights reserved. |
| 3 -- | 3 -- |
| 4 -- Redistribution and use in source and binary forms, with or without | 4 -- Redistribution and use in source and binary forms, with or without |
| 5 -- modification, are permitted provided that the following conditions | 5 -- modification, are permitted provided that the following conditions |
| 6 -- are met: | 6 -- are met: |
| 37 -- Misc helper functions used in the library | 37 -- Misc helper functions used in the library |
| 38 ------------------------------------------------------------------------ | 38 ------------------------------------------------------------------------ |
| 39 | 39 |
| 40 --- Gets a hashtable of buffs on the specified unit. | 40 --- Gets a hashtable of buffs on the specified unit. |
| 41 -- @param unit The unit frame name (e.g. "target", "player", "focus") of the unit whose buffs are to be retrieved. | 41 -- @param unit The unit frame name (e.g. "target", "player", "focus") of the unit whose buffs are to be retrieved. |
| 42 -- @returns a hashtable of buff spell IDs keyed on the ID. | 42 -- @returns A hashtable of buff spell IDs keyed on the ID. |
| 43 function MyLilPony.GetUnitBuffs(unit) | 43 function MyLilPony.GetUnitBuffs(unit) |
| 44 local buffs = {}; | 44 local buffs = {}; |
| 45 for i = 1, 40 do | 45 for i = 1, 40 do |
| 46 local _, _, _, _, _, _, _, _, _, _, id = UnitAura(unit, i, "HELPFUL"); | 46 local _, _, _, _, _, _, _, _, _, _, id = UnitAura(unit, i, "HELPFUL"); |
| 47 if id ~= nil then | 47 if id ~= nil then |
| 72 local lPat = string.lower(pattern); | 72 local lPat = string.lower(pattern); |
| 73 return string.match(lSub, lPat); | 73 return string.match(lSub, lPat); |
| 74 end | 74 end |
| 75 | 75 |
| 76 --- Calls a mount if a specified condition checks out. | 76 --- Calls a mount if a specified condition checks out. |
| 77 -- @param slotID The slot ID of the mount to be called. | |
| 78 -- @param condition An optional Boolean condition. | |
| 79 -- @returns True if a mount was summoned, or False otherwise. | |
| 80 function MyLilPony.CallMount(slotID, condition) | |
| 81 if condition == nil or condition then | |
| 82 C_MountJournal.Summon(slotID); | |
| 83 return true; | |
| 84 end | |
| 85 return false; | |
| 86 end | |
| 87 | |
| 88 --- OBSOLETE. Calls a mount if a specified condition checks out. | |
| 77 -- @param unused The type of companion to be called (e.g. "MOUNT"). | 89 -- @param unused The type of companion to be called (e.g. "MOUNT"). |
| 78 -- @param slotID The slot ID of the mount to be called. | 90 -- @param slotID The slot ID of the mount to be called. |
| 79 -- @param condition An optional Boolean condition. | 91 -- @param condition An optional Boolean condition. |
| 80 function MyLilPony.CallCompanion(unused, slotID, condition) | 92 function MyLilPony.CallCompanion(unused, slotID, condition) |
| 81 if condition == nil or condition then | 93 MyLilPony.CallMount(slotID, condition); |
| 82 C_MountJournal.Summon(slotID); | |
| 83 end | |
| 84 end | 94 end |
| 85 | 95 |
| 86 --- Iterates over all known and non-hidden (i.e. not dead or opposite faction) mount slot IDs. | 96 --- 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. | 97 -- @return A list of valid mount slot IDs. |
| 88 function MyLilPony.EnumerateKnownMountSlotIDs() | 98 function MyLilPony.EnumerateKnownMountSlotIDs() |
