Mercurial > wow > mylilpony
view libMyLilPony/libMyLilPony_miscFunctions.lua @ 1:7dfbf42c2d60
Initial commit of MyLilPony
author | syzler |
---|---|
date | Mon, 04 Apr 2011 04:43:05 +0000 |
parents | |
children | d96c15f7477b |
line wrap: on
line source
-- libMyLilPony -- Copyright (c) 2011 Syzler -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- Misc helper functions used in the library 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"); if id ~= nil then buffs[id] = id; end end return buffs; end 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 local lSub = string.lower(subject); local lPat = string.lower(pattern); return string.match(lSub, lPat); end function MyLilPony.CallCompanion(companionType, companionNumber, condition) if condition == nil or condition then CallCompanion(companionType, companionNumber); end end function MyLilPony.CanFlyHere() if IsFlyableArea() then SetMapToCurrentZone(); local continent = GetCurrentMapContinent(); if continent == 4 then -- Northrend: requires Cold Weather Flying return IsSpellKnown(54197); elseif (continent == 1 or continent == 2) then -- Old World: requires Flight Master's License return IsSpellKnown(90267); end return true; end return false; end function MyLilPony.Print(msg) DEFAULT_CHAT_FRAME:AddMessage("|cff8ed6f0"..msg); end function MyLilPony.Log(msg) if MYLILPONY_DEBUG_LOGGING then DEFAULT_CHAT_FRAME:AddMessage("|cff8ed6f0"..format("MyLilPony: %s", msg)); end end