libtipscan: add new tooltip scanning library

This commit is contained in:
Road-block
2018-07-31 21:23:01 +02:00
committed by shagu
parent 1cebe52e29
commit 44ffb10024
14 changed files with 260 additions and 110 deletions
+885
View File
@@ -0,0 +1,885 @@
pfUI.api = { }
-- load pfUI environment
setfenv(1, pfUI:GetEnvironment())
-- [ strsplit ]
-- Splits a string using a delimiter.
-- 'delimiter' [string] characters that will be interpreted as delimiter
-- characters (bytes) in the string.
-- 'subject' [string] String to split.
-- return: [list] a list of strings.
function pfUI.api.strsplit(delimiter, subject)
local delimiter, fields = delimiter or ":", {}
local pattern = string.format("([^%s]+)", delimiter)
string.gsub(subject, pattern, function(c) fields[table.getn(fields)+1] = c end)
return unpack(fields)
end
-- [ UnitInRange ]
-- Returns whether a party/raid member is nearby.
-- It takes care of the rangecheck module if existing.
-- unit [string] A unit to query (string, unitID)
-- return: [bool] "1" if in range otherwise "nil"
local RangeCache = {}
function pfUI.api.UnitInRange(unit)
if not UnitExists(unit) or not UnitIsVisible(unit) then
return nil
elseif CheckInteractDistance(unit, 4) then
return 1
else
return librange:UnitInSpellRange(unit)
end
end
-- [ UnitHasBuff ]
-- Returns whether a unit has the given buff or not.
-- unit [string] A unit to query (string, unitID)
-- buff [string] The texture of the buff.
-- return: [bool] true if unit has buff otherwise "nil"
function pfUI.api.UnitHasBuff(unit, buff)
local hasbuff = nil
for i=1,32 do
if UnitBuff(unit, i) == buff then
hasbuff = true
break
end
end
return hasbuff
end
-- [[ GetUnitColor ]]
-- Returns an escape string for the unit aswell as the RGB values
-- unit [string] the unitstring
-- return: [table] string, r, g, b
function pfUI.api.GetUnitColor(unitstr)
local _, class = UnitClass(unitstr)
local r, g, b = .8, .8, .8
if RAID_CLASS_COLORS[class] then
r, g, b = RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b
end
return string.format("|cff%02x%02x%02x", r * 255, g * 255, b * 255), r, g, b
end
-- [ strvertical ]
-- Creates vertical text using linebreaks. Multibyte char friendly.
-- 'str' [string] String to columnize.
-- return: [string] the string tranformed to a column.
function pfUI.api.strvertical(str)
local _, len = string.gsub(str,"[^\128-\193]", "")
if (len == string.len(str)) then
return string.gsub(str, "(.)", "%1\n")
else
return string.gsub(str,"([%z\1-\127\194-\244][\128-\191]*)", "%1\n")
end
end
-- [ round ]
-- Rounds a float number into specified places after comma.
-- 'input' [float] the number that should be rounded.
-- 'places' [int] amount of places after the comma.
-- returns: [float] rounded number.
function pfUI.api.round(input, places)
if not places then places = 0 end
if type(input) == "number" and type(places) == "number" then
local pow = 1
for i = 1, places do pow = pow * 10 end
return floor(input * pow + 0.5) / pow
end
end
-- [ clamp ]
-- Clamps a number between given range.
-- 'x' [number] the number that should be clamped.
-- 'min' [number] minimum value.
-- 'max' [number] maximum value.
-- returns: [number] clamped value: 'x', 'min' or 'max' value itself.
function pfUI.api.clamp(x, min, max)
if type(x) == "number" and type(min) == "number" and type(max) == "number" then
return x < min and min or x > max and max or x
else
return x
end
end
-- [ modf ]
-- Returns integral and fractional part of a number.
-- 'f' [float] the number to breakdown.
-- returns: [int],[float] whole and fractional part.
function pfUI.api.modf(f)
if math.modf then return math.modf(f) end
if f > 0 then
return math.floor(f), math.mod(f,1)
end
return math.ceil(f), math.mod(f,1)
end
-- [ SanitizePattern ]
-- Sanitizes and convert patterns into gfind compatible ones.
-- 'pattern' [string] unformatted pattern
-- returns: [string] simplified gfind compatible pattern
function pfUI.api.SanitizePattern(pattern)
-- escape brackets
pattern = gsub(pattern, "%(", "%%(")
pattern = gsub(pattern, "%)", "%%)")
-- remove bad capture indexes
pattern = gsub(pattern, "%d%$s","s") -- %1$s to %s
pattern = gsub(pattern, "%d%$d","d") -- %1$d to %d
pattern = gsub(pattern, "%ds","s") -- %2s to %s
-- add capture to all findings
pattern = gsub(pattern, "%%s", "(.+)")
pattern = gsub(pattern, "%%d", "(%%d+)")
return pattern
end
-- [ GetItemLinkByName ]
-- Returns an itemLink for the given itemname
-- 'name' [string] name of the item
-- returns: [string] entire itemLink for the given item
function pfUI.api.GetItemLinkByName(name)
for itemID = 1, 25818 do
local itemName, hyperLink, itemQuality = GetItemInfo(itemID)
if (itemName and itemName == name) then
local _, _, _, hex = GetItemQualityColor(tonumber(itemQuality))
return hex.. "|H"..hyperLink.."|h["..itemName.."]|h|r"
end
end
end
-- [ GetItemCount ]
-- Returns information about how many of a given item the player has.
-- 'itemName' [string] name of the item
-- returns: [int] the number of the given item
function pfUI.api.GetItemCount(itemName)
local count = 0
for bag = 4, 0, -1 do
for slot = 1, GetContainerNumSlots(bag) do
local _, itemCount = GetContainerItemInfo(bag, slot);
if itemCount then
local itemLink = GetContainerItemLink(bag,slot)
local _, _, itemParse = strfind(itemLink, "(%d+):")
local queryName, _, _, _, _, _ = GetItemInfo(itemParse)
if queryName and queryName ~= "" then
if queryName == itemName then
count = count + itemCount;
end
end
end
end
end
return count
end
-- [ GetBagFamily ]
-- Returns information about the type of a bag such as Soul Bags or Quivers.
-- Available bagtypes are "BAG", "KEYRING", "SOULBAG", "QUIVER" and "SPECIAL"
-- 'bag' [int] the bag id
-- returns: [string] the type of the bag, e.g "QUIVER"
function pfUI.api.GetBagFamily(bag)
if bag == -2 then return "KEYRING" end
if bag == 0 then return "BAG" end
local _, _, id = strfind(GetInventoryItemLink("player", ContainerIDToInventoryID(bag)) or "", "item:(%d+)")
if id then
local _, _, _, _, itemType, subType = GetItemInfo(id)
local bagsubtype = L["bagtypes"][subType]
if bagsubtype == "DEFAULT" then return "BAG" end
if bagsubtype == "SOULBAG" then return "SOULBAG" end
if bagsubtype == "QUIVER" then return "QUIVER" end
if bagsubtype == nil then return "SPECIAL" end
end
return nil
end
-- [ Abbreviate ]
-- Abbreviates a number from 1234 to 1.23k
-- 'number' [number] the number that should be abbreviated
-- 'returns: [string] the abbreviated value
function pfUI.api.Abbreviate(number)
if pfUI_config.unitframes.abbrevnum == "1" then
if number > 1000000 then
return pfUI.api.round(number/1000000,2) .. "m"
elseif number > 1000 then
return pfUI.api.round(number/1000,2) .. "k"
end
end
return number
end
-- [ SendChatMessageWide ]
-- Sends a message to widest audience the player can broadcast to
-- 'msg' [string] the message to send
function pfUI.api.SendChatMessageWide(msg)
local channel = "SAY"
if UnitInRaid("player") then
if ( IsRaidLeader() or IsRaidOfficer() ) then
channel = "RAID_WARNING"
else
channel = "RAID"
end
elseif UnitExists("party1") then
channel = "PARTY"
end
SendChatMessage(msg,channel)
end
-- [ GroupInfoByName ]
-- Gets the unit id by name
-- 'name' [string] party or raid member
-- 'group' [string] "raid" or "party"
-- returns: [table] {name='name',unitId='unitId',Id=Id,lclass='lclass',class='class'}
do -- create a scope so we don't have to worry about upvalue collisions
local party, raid, unitinfo = {}, {}, {}
party[0] = "player" -- fake unit
for i=1, MAX_PARTY_MEMBERS do
party[i] = "party"..i
end
for i=1, MAX_RAID_MEMBERS do
raid[i] = "raid"..i
end
function pfUI.api.GroupInfoByName(name,group)
unitinfo = pfUI.api.wipe(unitinfo)
if group == "party" then
for i=0, MAX_PARTY_MEMBERS do
local unitName = UnitName(party[i])
if unitName == name then
local lclass,class = UnitClass(party[i])
if not (lclass and class) then
lclass,class = _G.UNKNOWN, "UNKNOWN"
end
unitinfo.name,unitinfo.unitId,unitinfo.Id,unitinfo.lclass,unitinfo.class =
unitName,party[i],i,lclass,class
return unitinfo
end
end
elseif group == "raid" then
for i=1, MAX_RAID_MEMBERS do
local unitName = UnitName(raid[i])
if unitName == name then
local lclass,class = UnitClass(raid[i])
if not (lclass and class) then
lclass,class = _G.UNKNOWN, "UNKNOWN"
end
unitinfo.name,unitinfo.unitId,unitinfo.Id,unitinfo.lclass,unitinfo.class =
unitName,raid[i],i,lclass,class
return unitinfo
end
end
end
-- fallback for GetMasterLootCandidate not updating immediately for leavers
unitinfo.lclass,unitinfo.class = _G.UNKNOWN, "UNKNOWN"
return unitinfo
end
end
-- [ hooksecurefunc ]
-- Hooks a global function and injects custom code
-- 'name' [string] name of the function that should be hooked
-- 'func' [function] function containing the custom code
-- 'append' [bool] optional variable, used to append custom
-- code instead of prepending it
function pfUI.api.hooksecurefunc(name, func, append)
if not _G[name] then return end
pfUI.hooks[tostring(func)] = {}
pfUI.hooks[tostring(func)]["old"] = _G[name]
pfUI.hooks[tostring(func)]["new"] = func
if append then
pfUI.hooks[tostring(func)]["function"] = function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
pfUI.hooks[tostring(func)]["old"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
pfUI.hooks[tostring(func)]["new"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
end
else
pfUI.hooks[tostring(func)]["function"] = function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
pfUI.hooks[tostring(func)]["new"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
pfUI.hooks[tostring(func)]["old"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
end
end
_G[name] = pfUI.hooks[tostring(func)]["function"]
end
function pfUI.api.HookScript(f, script, func)
local prev = f:GetScript(script)
f:SetScript(script, function(...)
if prev then prev() end
func()
end)
end
-- [ QueueFunction ]
-- Add functions to a FIFO queue for execution after a short delay.
-- '...' [vararg] function, [arguments]
local timer
function pfUI.api.QueueFunction(...)
if not (timer) then
timer = CreateFrame("frame")
timer.queue = {}
timer.interval = TOOLTIP_UPDATE_TIME
timer.DeQueue = function()
local item = table.remove(timer.queue,1)
if (item) then
item[1](unpack(item[2]))
end
if table.getn(timer.queue) == 0 then
timer:Hide() -- no need to run the OnUpdate when the queue is empty
end
end
timer:SetScript("OnUpdate",function()
this.sinceLast = (this.sinceLast or 0) + arg1
while (this.sinceLast > this.interval) do
this.DeQueue()
this.sinceLast = this.sinceLast - this.interval
end
end)
end
assert(type(arg[1])=="function","QueueFunction: arg1 is not a function")
local func = table.remove(arg, 1)
table.insert(timer.queue,{func,arg})
timer:Show() -- start the OnUpdate
end
-- [ Create Gold String ]
-- Transforms a amount of copper into a fully fledged gold string
-- 'money' [int] the amount of coppy (GetMoney())
-- return: [string] a colorized string which is split into
-- gold,silver and copper values.
function pfUI.api.CreateGoldString(money)
if type(money) ~= "number" then return "-" end
local gold = floor(money/ 100 / 100)
local silver = floor(mod((money/100),100))
local copper = floor(mod(money,100))
local string = ""
if gold > 0 then string = string .. "|cffffffff" .. gold .. "|cffffd700g" end
if silver > 0 then string = string .. "|cffffffff " .. silver .. "|cffc7c7cfs" end
string = string .. "|cffffffff " .. copper .. "|cffeda55fc"
return string
end
-- [ Enable Movable ]
-- Set all necessary functions to make a already existing frame movable.
-- 'name' [frame/string] Name of the Frame that should be movable
-- 'addon' [string] Addon that must be loaded before being able to access the frame
-- 'blacklist' [table] A list of frames that should be deactivated for mouse usage
function pfUI.api.EnableMovable(name, addon, blacklist)
if addon then
local scan = CreateFrame("Frame")
scan:RegisterEvent("ADDON_LOADED")
scan:SetScript("OnEvent", function()
if arg1 == addon then
local frame = _G[name]
if blacklist then
for _, disable in pairs(blacklist) do
_G[disable]:EnableMouse(false)
end
end
frame:SetMovable(true)
frame:EnableMouse(true)
frame:SetScript("OnMouseDown",function()
this:StartMoving()
end)
frame:SetScript("OnMouseUp",function()
this:StopMovingOrSizing()
end)
this:UnregisterAllEvents()
end
end)
else
if blacklist then
for _, disable in pairs(blacklist) do
_G[disable]:EnableMouse(false)
end
end
local frame = name
if type(name) == "string" then frame = _G[name] end
frame:SetMovable(true)
frame:EnableMouse(true)
frame:SetScript("OnMouseDown",function()
this:StartMoving()
end)
frame:SetScript("OnMouseUp",function()
this:StopMovingOrSizing()
end)
end
end
-- [ Copy Table ]
-- By default a table assignment only will be a reference instead of a copy.
-- This is used to create a replicate of the actual table.
-- 'src' [table] the table that should be copied.
-- return: [table] the replicated table.
function pfUI.api.CopyTable(src)
local lookup_table = {}
local function _copy(src)
if type(src) ~= "table" then
return src
elseif lookup_table[src] then
return lookup_table[src]
end
local new_table = {}
lookup_table[src] = new_table
for index, value in pairs(src) do
new_table[_copy(index)] = _copy(value)
end
return setmetatable(new_table, getmetatable(src))
end
return _copy(src)
end
-- [ Wipe Table ]
-- Empties a table and returns it
-- 'src' [table] the table that should be emptied.
-- return: [table] the emptied table.
function pfUI.api.wipe(src)
-- notes: table.insert, table.remove will have undefined behavior
-- when used on tables emptied this way because Lua removes nil
-- entries from tables after an indeterminate time.
-- Instead of table.insert(t,v) use t[table.getn(t)+1]=v as table.getn collapses nil entries.
-- There are no issues with hash tables, t[k]=v where k is not a number behaves as expected.
local mt = getmetatable(src) or {}
if mt.__mode == nil or mt.__mode ~= "kv" then
mt.__mode = "kv"
src=setmetatable(src,mt)
end
for k in pairs(src) do
src[k] = nil
end
return src
end
-- [ Update Movable ]
-- Loads and update the configured position of the specified frame.
-- It also creates an entry in the movables table.
-- 'frame' [frame] the frame that should be updated.
-- 'init' [bool] treats the current position as initial data
function pfUI.api.UpdateMovable(frame, init)
local name = frame:GetName()
if pfUI_config.global.offscreen == "0" then
frame:SetClampedToScreen(true)
end
if not pfUI.movables[name] then
pfUI.movables[name] = frame
end
-- update position data
if not frame.posdata or init then
frame.posdata = { scale = frame:GetScale(), pos = {} }
for i=1,frame:GetNumPoints() do
frame.posdata.pos[i] = { frame:GetPoint(i) }
end
end
if pfUI_config["position"][frame:GetName()] then
if pfUI_config["position"][frame:GetName()]["scale"] then
frame:SetScale(pfUI_config["position"][frame:GetName()].scale)
end
if pfUI_config["position"][frame:GetName()]["xpos"] then
frame:ClearAllPoints()
frame:SetPoint("TOPLEFT", pfUI_config["position"][frame:GetName()].xpos, pfUI_config["position"][frame:GetName()].ypos)
end
elseif frame.posdata and frame.posdata.pos[1] then
frame:ClearAllPoints()
frame:SetScale(frame.posdata.scale)
for id, point in pairs(frame.posdata.pos) do
frame:SetPoint(unpack(point))
end
end
end
-- [ Remove Movable ]
-- Removes a Frame from the movable list.
-- 'frame' [frame] the frame that should be removed.
function pfUI.api.RemoveMovable(frame)
local name = frame:GetName()
pfUI.movables[name] = nil
end
-- [ Load Movable ]
-- Loads the positions of a Frame.
-- 'frame' [frame] the frame that should be positioned.
function pfUI.api.LoadMovable(frame)
if pfUI_config["position"][frame:GetName()] then
if pfUI_config["position"][frame:GetName()]["scale"] then
frame:SetScale(pfUI_config["position"][frame:GetName()].scale)
end
if pfUI_config["position"][frame:GetName()]["xpos"] then
frame:ClearAllPoints()
frame:SetPoint("TOPLEFT", pfUI_config["position"][frame:GetName()].xpos, pfUI_config["position"][frame:GetName()].ypos)
end
end
end
-- [ Save Movable ]
-- Save the positions of a Frame.
-- 'frame' [frame] the frame that should be saved.
function pfUI.api.SaveMovable(frame)
local _, _, _, xpos, ypos = frame:GetPoint()
if not C.position[frame:GetName()] then
C.position[frame:GetName()] = {}
end
C.position[frame:GetName()]["xpos"] = round(xpos)
C.position[frame:GetName()]["ypos"] = round(ypos)
end
-- [ SetAutoPoint ]
-- Automatically places the frame according to screen position of the parent.
-- 'frame' [frame] the frame that should be moved.
-- 'parent' [frame] the frame's anchor point
-- 'spacing' [number] the padding that should be used between the
-- frame and its parent frame
function pfUI.api.SetAutoPoint(frame, parent, spacing)
--[[
a b max
+-----------------+
| 1 | 2 | 3 |
|-----+-----+-----| c
| 4 | 5 | 6 |
|-----+-----+-----| d
| 7 | 8 | 9 |
+-----------------+
0
]]--
local a = GetScreenWidth() / 3
local b = GetScreenWidth() / 3 * 2
local c = GetScreenHeight() / 3 * 2
local d = GetScreenHeight() / 3
local x, y = parent:GetCenter()
local off = spacing or 0
frame:ClearAllPoints()
if x < a and y > c then
-- TOPLEFT
frame:SetPoint("TOPLEFT", parent, "BOTTOMLEFT", 0, -off)
elseif x > a and x < b and y > c then
-- TOP
frame:SetPoint("TOP", parent, "BOTTOM", 0, -off)
elseif x > b and y > c then
-- TOPRIGHT
frame:SetPoint("TOPRIGHT", parent, "BOTTOMRIGHT", 0, -off)
elseif x < a and y > d and y < c then
-- LEFT
frame:SetPoint("LEFT", parent, "RIGHT", off, 0)
elseif x > a and x < b and y > d and y < c then
-- CENTER
frame:SetPoint("BOTTOM", parent, "TOP", 0, off)
elseif x > b and y > d and y < c then
-- RIGHT
frame:SetPoint("RIGHT", parent, "LEFT", -off, 0)
elseif x < a and y < d then
-- BOTTOMLEFT
frame:SetPoint("BOTTOMLEFT", parent, "TOPLEFT", 0, off)
elseif x > a and x < b and y < d then
-- BOTTOM
frame:SetPoint("BOTTOM", parent, "TOP", 0, off)
elseif x > b and y < d then
-- BOTTOMRIGHT
frame:SetPoint("BOTTOMRIGHT", parent, "TOPRIGHT", 0, off)
end
end
-- [ GetDefaultColors ]
-- Queries the pfUI setting strings and extract its color codes
-- returns r,g,b,a
local color_cache = {}
function pfUI.api.GetStringColor(colorstr)
if not color_cache[colorstr] then
local r, g, b, a = pfUI.api.strsplit(",", colorstr)
color_cache[colorstr] = { r, g, b, a }
end
return unpack(color_cache[colorstr])
end
-- [ Create Backdrop ]
-- Creates a pfUI compatible frame as backdrop element
-- 'f' [frame] the frame which should get a backdrop.
-- 'inset' [int] backdrop inset, defaults to border size.
-- 'legacy' [bool] use legacy backdrop instead of creating frames.
-- 'transp' [number] set default transparency
function pfUI.api.CreateBackdrop(f, inset, legacy, transp, backdropSetting)
-- exit if now frame was given
if not f then return end
-- use default inset if nothing is given
local border = inset
if not border then
border = tonumber(pfUI_config.appearance.border.default)
end
local br, bg, bb, ba = pfUI.api.GetStringColor(pfUI_config.appearance.border.background)
local er, eg, eb, ea = pfUI.api.GetStringColor(pfUI_config.appearance.border.color)
if transp and transp < tonumber(ba) then ba = transp end
-- use legacy backdrop handling
if legacy then
local backdrop = pfUI.backdrop
if backdropSetting then backdrop = backdropSetting end
f:SetBackdrop(backdrop)
f:SetBackdropColor(br, bg, bb, ba)
f:SetBackdropBorderColor(er, eg, eb , ea)
return
end
-- increase clickable area if available
if f.SetHitRectInsets then
f:SetHitRectInsets(-border,-border,-border,-border)
end
-- use new backdrop behaviour
if not f.backdrop then
f:SetBackdrop(nil)
local backdrop = pfUI.backdrop
local b = CreateFrame("Frame", nil, f)
if tonumber(border) > 1 then
local border = tonumber(border) - 1
backdrop.insets = {left = -1, right = -1, top = -1, bottom = -1}
b:SetPoint("TOPLEFT", f, "TOPLEFT", -border, border)
b:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", border, -border)
else
local border = tonumber(border)
backdrop.insets = {left = 0, right = 0, top = 0, bottom = 0}
b:SetPoint("TOPLEFT", f, "TOPLEFT", -border, border)
b:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", border, -border)
end
local level = f:GetFrameLevel()
if level < 1 then
b:SetFrameLevel(level)
else
b:SetFrameLevel(level - 1)
end
f.backdrop = b
b:SetBackdrop(backdrop)
end
local b = f.backdrop
b:SetBackdropColor(br, bg, bb, ba)
b:SetBackdropBorderColor(er, eg, eb , ea)
end
-- [ Bar Layout Options ] --
-- 'barsize' size of bar in number of buttons
-- returns: array of options as strings for pfUI.gui.bar
function pfUI.api.BarLayoutOptions(barsize)
assert(barsize > 0 and barsize <= NUM_ACTIONBAR_BUTTONS,"BarLayoutOptions: barsize "..tostring(barsize).." is invalid")
local options = {}
for i,layout in ipairs(pfGridmath[barsize]) do
options[i] = string.format("%d x %d",layout[1],layout[2])
end
return options
end
-- [ Bar Layout Formfactor ] --
-- 'option' string option as used in pfUI_config.bars[bar].option
-- returns: integer formfactor
local formfactors = {} -- we'll use memoization so we only compute once, then lookup.
setmetatable(formfactors, {__mode = "v"}) -- weak table so values not referenced are collected on next gc
function pfUI.api.BarLayoutFormfactor(option)
if formfactors[option] then
return formfactors[option]
else
for barsize,_ in ipairs(pfGridmath) do
local options = pfUI.api.BarLayoutOptions(barsize)
for i,opt in ipairs(options) do
if opt == option then
formfactors[option] = i
return formfactors[option]
end
end
end
end
end
-- [ Bar Layout Size ] --
-- 'bar' frame reference,
-- 'barsize' integer number of buttons,
-- 'formfactor' string formfactor in cols x rows,
-- 'visiblesize' integer buttons actually spawned
function pfUI.api.BarLayoutSize(bar,barsize,formfactor,iconsize,bordersize,visiblesize)
assert(barsize > 0 and barsize <= NUM_ACTIONBAR_BUTTONS,"BarLayoutSize: barsize "..tostring(barsize).." is invalid")
local formfactor = pfUI.api.BarLayoutFormfactor(formfactor)
local cols, rows = unpack(pfGridmath[barsize][formfactor])
if (visiblesize) and (visiblesize < barsize) then
cols = math.min(cols,visiblesize)
rows = math.min(math.ceil(visiblesize/cols),visiblesize)
end
local width = (iconsize + bordersize*3) * cols - bordersize
local height = (iconsize + bordersize*3) * rows - bordersize
bar._size = {width,height}
return bar._size
end
-- [ Bar Button Anchor ] --
-- 'button' frame reference
-- 'basename' name of button frame without index
-- 'buttonindex' index number of button on bar
-- 'formfactor' string formfactor in cols x rows
function pfUI.api.BarButtonAnchor(button,basename,buttonindex,barsize,formfactor,iconsize,bordersize)
assert(barsize > 0 and barsize <= NUM_ACTIONBAR_BUTTONS,"BarButtonAnchor: barsize "..tostring(barsize).." is invalid")
local formfactor = pfUI.api.BarLayoutFormfactor(formfactor)
local parent = button:GetParent()
local cols, rows = unpack(pfGridmath[barsize][formfactor])
if buttonindex == 1 then
button._anchor = {"TOPLEFT", parent, "TOPLEFT", bordersize, -bordersize}
else
local col = buttonindex-((math.ceil(buttonindex/cols)-1)*cols)
button._anchor = col==1 and {"TOP",getglobal(basename..(buttonindex-cols)),"BOTTOM",0,-(bordersize*3)} or {"LEFT",getglobal(basename..(buttonindex-1)),"RIGHT",(bordersize*3),0}
end
return button._anchor
end
-- [ Create Autohide ] --
-- 'frame' the frame that should be hidden
function pfUI.api.CreateAutohide(frame)
if not frame then return end
frame.hover = CreateFrame("Frame", frame:GetName() .. "Autohide", frame)
frame.hover:SetParent(frame)
frame.hover:SetAllPoints(frame)
frame.hover.parent = frame
frame.hover:RegisterEvent("PLAYER_LEAVING_WORLD")
frame.hover:SetScript("OnEvent", function()
this:Hide()
end)
frame.hover:SetScript("OnUpdate", function()
if MouseIsOver(this, 10, -10, -10, 10) then
this.activeTo = GetTime() + tonumber(pfUI_config.bars.hide_time)
this.parent:SetAlpha(1)
elseif this.activeTo then
if this.activeTo < GetTime() and this.parent:GetAlpha() > 0 then
this.parent:SetAlpha(this.parent:GetAlpha() - 0.1)
end
else
this.activeTo = GetTime() + tonumber(pfUI_config.bars.hide_time)
end
end)
end
-- [ GetColoredTime ] --
-- 'remaining' the time in seconds that should be converted
-- return a colored string including a time unit (m/h/d)
function pfUI.api.GetColoredTimeString(remaining)
if not remaining then return "" end
if remaining > 99 * 60 * 60 then
local r,g,b,a = pfUI.api.GetStringColor(C.appearance.cd.daycolor)
return "|cff" .. string.format("%02x%02x%02x", r*255, g*255, b*255) .. round(remaining / 60 / 60 / 24) .. "|rd"
elseif remaining > 99 * 60 then
local r,g,b,a = pfUI.api.GetStringColor(C.appearance.cd.hourcolor)
return "|cff" .. string.format("%02x%02x%02x", r*255, g*255, b*255) .. round(remaining / 60 / 60) .. "|rh"
elseif remaining > 99 then
local r,g,b,a = pfUI.api.GetStringColor(C.appearance.cd.minutecolor)
return "|cff" .. string.format("%02x%02x%02x", r*255, g*255, b*255) .. round(remaining / 60) .. "|rm"
elseif remaining <= 5 then
local r,g,b,a = pfUI.api.GetStringColor(C.appearance.cd.lowcolor)
return "|cff" .. string.format("%02x%02x%02x", r*255, g*255, b*255) .. round(remaining)
elseif remaining >= 0 then
local r, g, b, a = pfUI.api.GetStringColor(C.appearance.cd.normalcolor)
return "|cff" .. string.format("%02x%02x%02x", r*255, g*255, b*255) .. round(remaining)
else
return ""
end
end
-- [ GetColorGradient ] --
-- 'perc' percentage (0-1)
-- 'color1' table or r,g,b tuple
-- 'color2' table or r,g,b tuple
-- ..
-- 'colorN' table or r,g,b tuple
-- return r,g,b and hexcolor
local color_tuples = {}
function pfUI.api.GetColorGradient(perc, ...)
local num = arg.n
local r,g,b,hex
assert(tonumber(perc), "GetColorGradient: "..tostring(perc).." is not a number")
assert((type(arg[1])=="number" and num>5) or (type(arg[1])=="table" and num>1), "GetColorGradient: needs at least 2 colors")
perc = pfUI.api.clamp(perc,0,1)
if type(arg[1])=="number" then -- called with r,g,b tuples
-- shortcircuit the edge cases
if perc == 1 then
r,g,b = arg[num-2], arg[num-1], arg[num]
hex = string.format("|cff%02x%02x%02x", r*255, g*255, b*255)
return r,g,b,hex
elseif perc == 0 then
r,g,b = arg[1], arg[2], arg[3]
hex = string.format("|cff%02x%02x%02x", r*255, g*255, b*255)
return r,g,b,hex
end
num = num/3
local segment, relativepercent = pfUI.api.modf(perc*(num-1))
local r1,g1,b1, r2,g2,b2
r1,g1,b1 = arg[segment*3+1], arg[segment*3+2], arg[segment*3+3]
r2,g2,b2 = arg[segment*3+4], arg[segment*3+5], arg[segment*3+6]
if not r2 or not g2 or not b2 then
r,g,b = r1,g1,b1
hex = string.format("|cff%02x%02x%02x", r*255, g*255, b*255)
return r,g,b,hex
else
r,g,b = r1 + (r2-r1)*relativepercent, g1 + (g2-g1)*relativepercent, b1 + (b2-b1)*relativepercent
hex = string.format("|cff%02x%02x%02x", r*255, g*255, b*255)
return r,g,b,hex
end
elseif type(arg[1])=="table" then -- called with color tables
-- shortcircuit the edge cases
if perc == 1 then
r,g,b = arg[num][1] or arg[num].r, arg[num][2] or arg[num].g, arg[num][3] or arg[num].b
hex = string.format("|cff%02x%02x%02x", r*255, g*255, b*255)
return r,g,b,hex
elseif perc == 0 then
r,g,b = arg[1][1] or arg[1].r, arg[1][2] or arg[1].g, arg[1][3] or arg[1].b
hex = string.format("|cff%02x%02x%02x", r*255, g*255, b*255)
return r,g,b,hex
end
pfUI.api.wipe(color_tuples)
for _,c in ipairs(arg) do
local r,g,b = c[1] or c.r, c[2] or c.g, c[3] or c.b
color_tuples[table.getn(color_tuples)+1] = r
color_tuples[table.getn(color_tuples)+1] = g
color_tuples[table.getn(color_tuples)+1] = b
end
return pfUI.api.GetColorGradient(perc,unpack(color_tuples))
end
end
+923
View File
@@ -0,0 +1,923 @@
function pfUI:UpdateConfig(group, subgroup, entry, value)
-- create empty config if not existing
if not pfUI_config then
pfUI_config = {}
end
-- check for missing config groups
if not pfUI_config[group] then
pfUI_config[group] = {}
end
-- update config
if not subgroup and entry and value and not pfUI_config[group][entry] then
pfUI_config[group][entry] = value
end
-- check for missing config subgroups
if subgroup and not pfUI_config[group][subgroup] then
pfUI_config[group][subgroup] = {}
end
-- update config in subgroup
if subgroup and entry and value and not pfUI_config[group][subgroup][entry] then
pfUI_config[group][subgroup][entry] = value
end
end
function pfUI:LoadConfig()
-- MODULE SUBGROUP ENTRY VALUE
pfUI:UpdateConfig("global", nil, "language", GetLocale())
pfUI:UpdateConfig("global", nil, "profile", "default")
pfUI:UpdateConfig("global", nil, "pixelperfect", "0")
pfUI:UpdateConfig("global", nil, "hdgraphic", "0")
pfUI:UpdateConfig("global", nil, "offscreen", "0")
pfUI:UpdateConfig("global", nil, "font_default", "Interface\\AddOns\\pfUI\\fonts\\Myriad-Pro.ttf")
pfUI:UpdateConfig("global", nil, "font_size", "12")
pfUI:UpdateConfig("global", nil, "font_unit", "Interface\\AddOns\\pfUI\\fonts\\BigNoodleTitling.ttf")
pfUI:UpdateConfig("global", nil, "font_unit_size", "12")
pfUI:UpdateConfig("global", nil, "font_combat", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("global", nil, "force_region", "1")
pfUI:UpdateConfig("global", nil, "errors_limit", "1")
pfUI:UpdateConfig("global", nil, "errors_hide", "0")
pfUI:UpdateConfig("global", nil, "hidebuff", "0")
pfUI:UpdateConfig("global", nil, "hidewbuff", "0")
pfUI:UpdateConfig("global", nil, "twentyfour", "1")
pfUI:UpdateConfig("global", nil, "autosell", "0")
pfUI:UpdateConfig("global", nil, "autorepair", "0")
pfUI:UpdateConfig("gui", nil, "reloadmarker", "0")
pfUI:UpdateConfig("buffs", nil, "buffs", "1")
pfUI:UpdateConfig("buffs", nil, "debuffs", "1")
pfUI:UpdateConfig("buffs", nil, "weapons", "1")
pfUI:UpdateConfig("buffs", nil, "separateweapons", "0")
pfUI:UpdateConfig("buffs", nil, "size", "24")
pfUI:UpdateConfig("buffs", nil, "spacing", "5")
pfUI:UpdateConfig("buffs", nil, "wepbuffrowsize", "2")
pfUI:UpdateConfig("buffs", nil, "buffrowsize", "16")
pfUI:UpdateConfig("buffs", nil, "debuffrowsize", "16")
pfUI:UpdateConfig("buffs", nil, "textinside", "0")
pfUI:UpdateConfig("buffs", nil, "fontsize", "-1")
pfUI:UpdateConfig("appearance", "border", "background", "0,0,0,1")
pfUI:UpdateConfig("appearance", "border", "color", "0.2,0.2,0.2,1")
pfUI:UpdateConfig("appearance", "border", "default", "3")
pfUI:UpdateConfig("appearance", "border", "actionbars", "-1")
pfUI:UpdateConfig("appearance", "border", "unitframes", "-1")
pfUI:UpdateConfig("appearance", "border", "panels", "-1")
pfUI:UpdateConfig("appearance", "border", "chat", "-1")
pfUI:UpdateConfig("appearance", "border", "bags", "-1")
pfUI:UpdateConfig("appearance", "cd", "lowcolor", "1,.2,.2,1")
pfUI:UpdateConfig("appearance", "cd", "normalcolor", "1,1,1,1")
pfUI:UpdateConfig("appearance", "cd", "minutecolor", ".2,1,1,1")
pfUI:UpdateConfig("appearance", "cd", "hourcolor", ".2,.5,1,1")
pfUI:UpdateConfig("appearance", "cd", "daycolor", ".2,.2,1,1")
pfUI:UpdateConfig("appearance", "cd", "threshold", "2")
pfUI:UpdateConfig("appearance", "cd", "font_size", "12")
pfUI:UpdateConfig("appearance", "cd", "debuffs", "1")
pfUI:UpdateConfig("appearance", "cd", "blizzard", "1")
pfUI:UpdateConfig("appearance", "cd", "foreign", "0")
pfUI:UpdateConfig("appearance", "castbar", "castbarcolor", ".7,.7,.9,.8")
pfUI:UpdateConfig("appearance", "castbar", "channelcolor", ".9,.9,.7,.8")
pfUI:UpdateConfig("appearance", "infight", "screen", "0")
pfUI:UpdateConfig("appearance", "bags", "borderlimit", "1")
pfUI:UpdateConfig("appearance", "bags", "borderonlygear", "0")
pfUI:UpdateConfig("appearance", "bags", "movable", "0")
pfUI:UpdateConfig("appearance", "bags", "hidechat", "0")
pfUI:UpdateConfig("appearance", "bags", "icon_size", "-1")
pfUI:UpdateConfig("appearance", "bags", "bagrowlength", "10")
pfUI:UpdateConfig("appearance", "bags", "bankrowlength", "10")
pfUI:UpdateConfig("appearance", "minimap", "mouseoverzone", "0")
pfUI:UpdateConfig("appearance", "minimap", "coordsloc", "bottomleft")
pfUI:UpdateConfig("appearance", "minimap", "tracking_size", "16")
pfUI:UpdateConfig("appearance", "minimap", "tracking_pulse", "1")
pfUI:UpdateConfig("appearance", "worldmap", "mapreveal", "0")
pfUI:UpdateConfig("appearance", "worldmap", "mapreveal_color", ".4,.4,.4,1")
pfUI:UpdateConfig("loot", nil, "autoresize", "1")
pfUI:UpdateConfig("loot", nil, "autopickup", "1")
pfUI:UpdateConfig("loot", nil, "mousecursor", "1")
pfUI:UpdateConfig("loot", nil, "advancedloot", "1")
pfUI:UpdateConfig("loot", nil, "rollannounce", "0")
pfUI:UpdateConfig("loot", nil, "raritytimer", "1")
pfUI:UpdateConfig("unitframes", nil, "disable", "0")
pfUI:UpdateConfig("unitframes", nil, "pastel", "1")
pfUI:UpdateConfig("unitframes", nil, "custom", "0")
pfUI:UpdateConfig("unitframes", nil, "customcolor", ".2,.2,.2,1")
pfUI:UpdateConfig("unitframes", nil, "custombg", "0")
pfUI:UpdateConfig("unitframes", nil, "custombgcolor", ".5,.2,.2,1")
pfUI:UpdateConfig("unitframes", nil, "animation_speed", "5")
pfUI:UpdateConfig("unitframes", nil, "portraitalpha", "0.1")
pfUI:UpdateConfig("unitframes", nil, "always2dportrait", "0")
pfUI:UpdateConfig("unitframes", nil, "portraittexture", "1")
pfUI:UpdateConfig("unitframes", nil, "layout", "default")
pfUI:UpdateConfig("unitframes", nil, "rangecheck", "0")
pfUI:UpdateConfig("unitframes", nil, "rangechecki", "4")
pfUI:UpdateConfig("unitframes", nil, "combosize", "6")
pfUI:UpdateConfig("unitframes", nil, "abbrevnum", "1")
pfUI:UpdateConfig("unitframes", nil, "selfingroup", "0")
pfUI:UpdateConfig("unitframes", nil, "raidforgroup", "0")
pfUI:UpdateConfig("unitframes", nil, "show_hots", "0")
pfUI:UpdateConfig("unitframes", nil, "all_hots", "0")
pfUI:UpdateConfig("unitframes", nil, "show_procs", "0")
pfUI:UpdateConfig("unitframes", nil, "show_totems", "0")
pfUI:UpdateConfig("unitframes", nil, "all_procs", "0")
pfUI:UpdateConfig("unitframes", nil, "debuffs_class", "0")
pfUI:UpdateConfig("unitframes", nil, "indicator_size", "10")
pfUI:UpdateConfig("unitframes", nil, "clickcast", "")
pfUI:UpdateConfig("unitframes", nil, "clickcast_shift", "")
pfUI:UpdateConfig("unitframes", nil, "clickcast_alt", "")
pfUI:UpdateConfig("unitframes", nil, "clickcast_ctrl", "")
pfUI:UpdateConfig("unitframes", "player", "showPVPMinimap", "0")
pfUI:UpdateConfig("unitframes", "player", "energy", "1")
pfUI:UpdateConfig("unitframes", "player", "visible", "1")
pfUI:UpdateConfig("unitframes", "player", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "player", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "player", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "player", "width", "200")
pfUI:UpdateConfig("unitframes", "player", "height", "50")
pfUI:UpdateConfig("unitframes", "player", "pheight", "10")
pfUI:UpdateConfig("unitframes", "player", "pwidth", "-1")
pfUI:UpdateConfig("unitframes", "player", "panchor", "TOP")
pfUI:UpdateConfig("unitframes", "player", "pspace", "-3")
pfUI:UpdateConfig("unitframes", "player", "buffs", "top")
pfUI:UpdateConfig("unitframes", "player", "buffsize", "20")
pfUI:UpdateConfig("unitframes", "player", "bufflimit", "32")
pfUI:UpdateConfig("unitframes", "player", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "player", "debuffs", "top")
pfUI:UpdateConfig("unitframes", "player", "debuffsize", "20")
pfUI:UpdateConfig("unitframes", "player", "debufflimit", "32")
pfUI:UpdateConfig("unitframes", "player", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "player", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "player", "verticalbar", "0")
pfUI:UpdateConfig("unitframes", "player", "buff_indicator", "0")
pfUI:UpdateConfig("unitframes", "player", "debuff_indicator", "0")
pfUI:UpdateConfig("unitframes", "player", "clickcast", "0")
pfUI:UpdateConfig("unitframes", "player", "faderange", "0")
pfUI:UpdateConfig("unitframes", "player", "glowaggro", "1")
pfUI:UpdateConfig("unitframes", "player", "glowcombat", "1")
pfUI:UpdateConfig("unitframes", "player", "showtooltip", "1")
pfUI:UpdateConfig("unitframes", "player", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "player", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "player", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "player", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "player", "txthpleft", "unit")
pfUI:UpdateConfig("unitframes", "player", "txthpcenter", "none")
pfUI:UpdateConfig("unitframes", "player", "txthpright", "healthdyn")
pfUI:UpdateConfig("unitframes", "player", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "player", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "player", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "player", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "player", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "player", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "target", "visible", "1")
pfUI:UpdateConfig("unitframes", "target", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "target", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "target", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "target", "width", "200")
pfUI:UpdateConfig("unitframes", "target", "height", "50")
pfUI:UpdateConfig("unitframes", "target", "pheight", "10")
pfUI:UpdateConfig("unitframes", "target", "pwidth", "-1")
pfUI:UpdateConfig("unitframes", "target", "panchor", "TOP")
pfUI:UpdateConfig("unitframes", "target", "pspace", "-3")
pfUI:UpdateConfig("unitframes", "target", "buffs", "top")
pfUI:UpdateConfig("unitframes", "target", "buffsize", "20")
pfUI:UpdateConfig("unitframes", "target", "bufflimit", "32")
pfUI:UpdateConfig("unitframes", "target", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "target", "debuffs", "top")
pfUI:UpdateConfig("unitframes", "target", "debuffsize", "20")
pfUI:UpdateConfig("unitframes", "target", "debufflimit", "32")
pfUI:UpdateConfig("unitframes", "target", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "target", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "target", "verticalbar", "0")
pfUI:UpdateConfig("unitframes", "target", "buff_indicator", "0")
pfUI:UpdateConfig("unitframes", "target", "debuff_indicator", "0")
pfUI:UpdateConfig("unitframes", "target", "clickcast", "0")
pfUI:UpdateConfig("unitframes", "target", "faderange", "0")
pfUI:UpdateConfig("unitframes", "target", "glowaggro", "1")
pfUI:UpdateConfig("unitframes", "target", "glowcombat", "1")
pfUI:UpdateConfig("unitframes", "target", "showtooltip", "1")
pfUI:UpdateConfig("unitframes", "target", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "target", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "target", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "target", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "target", "animation", "0")
pfUI:UpdateConfig("unitframes", "target", "txthpleft", "unit")
pfUI:UpdateConfig("unitframes", "target", "txthpcenter", "none")
pfUI:UpdateConfig("unitframes", "target", "txthpright", "healthdyn")
pfUI:UpdateConfig("unitframes", "target", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "target", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "target", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "target", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "target", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "target", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "focus", "visible", "1")
pfUI:UpdateConfig("unitframes", "focus", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "focus", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "focus", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "focus", "width", "120")
pfUI:UpdateConfig("unitframes", "focus", "height", "34")
pfUI:UpdateConfig("unitframes", "focus", "pheight", "4")
pfUI:UpdateConfig("unitframes", "focus", "pwidth", "-1")
pfUI:UpdateConfig("unitframes", "focus", "panchor", "TOP")
pfUI:UpdateConfig("unitframes", "focus", "pspace", "-3")
pfUI:UpdateConfig("unitframes", "focus", "buffs", "top")
pfUI:UpdateConfig("unitframes", "focus", "buffsize", "12")
pfUI:UpdateConfig("unitframes", "focus", "bufflimit", "32")
pfUI:UpdateConfig("unitframes", "focus", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "focus", "debuffs", "top")
pfUI:UpdateConfig("unitframes", "focus", "debuffsize", "12")
pfUI:UpdateConfig("unitframes", "focus", "debufflimit", "32")
pfUI:UpdateConfig("unitframes", "focus", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "focus", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "focus", "verticalbar", "0")
pfUI:UpdateConfig("unitframes", "focus", "buff_indicator", "0")
pfUI:UpdateConfig("unitframes", "focus", "debuff_indicator", "0")
pfUI:UpdateConfig("unitframes", "focus", "clickcast", "0")
pfUI:UpdateConfig("unitframes", "focus", "faderange", "0")
pfUI:UpdateConfig("unitframes", "focus", "glowaggro", "1")
pfUI:UpdateConfig("unitframes", "focus", "glowcombat", "1")
pfUI:UpdateConfig("unitframes", "focus", "showtooltip", "1")
pfUI:UpdateConfig("unitframes", "focus", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "focus", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "focus", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "focus", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "focus", "txthpleft", "unit")
pfUI:UpdateConfig("unitframes", "focus", "txthpcenter", "none")
pfUI:UpdateConfig("unitframes", "focus", "txthpright", "healthdyn")
pfUI:UpdateConfig("unitframes", "focus", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "focus", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "focus", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "focus", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "focus", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "focus", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "group", "visible", "1")
pfUI:UpdateConfig("unitframes", "group", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "group", "portrait", "off")
pfUI:UpdateConfig("unitframes", "group", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "group", "width", "164")
pfUI:UpdateConfig("unitframes", "group", "height", "32")
pfUI:UpdateConfig("unitframes", "group", "pheight", "4")
pfUI:UpdateConfig("unitframes", "group", "pwidth", "-1")
pfUI:UpdateConfig("unitframes", "group", "panchor", "TOP")
pfUI:UpdateConfig("unitframes", "group", "pspace", "-3")
pfUI:UpdateConfig("unitframes", "group", "buffs", "bottom")
pfUI:UpdateConfig("unitframes", "group", "buffsize", "8")
pfUI:UpdateConfig("unitframes", "group", "bufflimit", "16")
pfUI:UpdateConfig("unitframes", "group", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "group", "debuffs", "bottom")
pfUI:UpdateConfig("unitframes", "group", "debuffsize", "8")
pfUI:UpdateConfig("unitframes", "group", "debufflimit", "8")
pfUI:UpdateConfig("unitframes", "group", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "group", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "group", "verticalbar", "0")
pfUI:UpdateConfig("unitframes", "group", "buff_indicator", "1")
pfUI:UpdateConfig("unitframes", "group", "debuff_indicator", "1")
pfUI:UpdateConfig("unitframes", "group", "clickcast", "0")
pfUI:UpdateConfig("unitframes", "group", "faderange", "1")
pfUI:UpdateConfig("unitframes", "group", "glowaggro", "1")
pfUI:UpdateConfig("unitframes", "group", "glowcombat", "0")
pfUI:UpdateConfig("unitframes", "group", "showtooltip", "1")
pfUI:UpdateConfig("unitframes", "group", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "group", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "group", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "group", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "group", "hide_in_raid", "0")
pfUI:UpdateConfig("unitframes", "group", "txthpleft", "unit")
pfUI:UpdateConfig("unitframes", "group", "txthpcenter", "none")
pfUI:UpdateConfig("unitframes", "group", "txthpright", "healthmiss")
pfUI:UpdateConfig("unitframes", "group", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "group", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "group", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "group", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "group", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "group", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "grouptarget", "visible", "1")
pfUI:UpdateConfig("unitframes", "grouptarget", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "grouptarget", "portrait", "off")
pfUI:UpdateConfig("unitframes", "grouptarget", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "grouptarget", "width", "120")
pfUI:UpdateConfig("unitframes", "grouptarget", "height", "16")
pfUI:UpdateConfig("unitframes", "grouptarget", "pheight", "0")
pfUI:UpdateConfig("unitframes", "grouptarget", "pwidth", "-1")
pfUI:UpdateConfig("unitframes", "grouptarget", "panchor", "TOP")
pfUI:UpdateConfig("unitframes", "grouptarget", "pspace", "-3")
pfUI:UpdateConfig("unitframes", "grouptarget", "buffs", "off")
pfUI:UpdateConfig("unitframes", "grouptarget", "buffsize", "16")
pfUI:UpdateConfig("unitframes", "grouptarget", "bufflimit", "16")
pfUI:UpdateConfig("unitframes", "grouptarget", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "grouptarget", "debuffs", "off")
pfUI:UpdateConfig("unitframes", "grouptarget", "debuffsize", "16")
pfUI:UpdateConfig("unitframes", "grouptarget", "debufflimit", "16")
pfUI:UpdateConfig("unitframes", "grouptarget", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "grouptarget", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "grouptarget", "verticalbar", "0")
pfUI:UpdateConfig("unitframes", "grouptarget", "buff_indicator", "0")
pfUI:UpdateConfig("unitframes", "grouptarget", "debuff_indicator", "0")
pfUI:UpdateConfig("unitframes", "grouptarget", "clickcast", "0")
pfUI:UpdateConfig("unitframes", "grouptarget", "faderange", "1")
pfUI:UpdateConfig("unitframes", "grouptarget", "glowaggro", "1")
pfUI:UpdateConfig("unitframes", "grouptarget", "glowcombat", "0")
pfUI:UpdateConfig("unitframes", "grouptarget", "showtooltip", "1")
pfUI:UpdateConfig("unitframes", "grouptarget", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "grouptarget", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "grouptarget", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "grouptarget", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "grouptarget", "txthpleft", "unit")
pfUI:UpdateConfig("unitframes", "grouptarget", "txthpcenter", "none")
pfUI:UpdateConfig("unitframes", "grouptarget", "txthpright", "healthperc")
pfUI:UpdateConfig("unitframes", "grouptarget", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "grouptarget", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "grouptarget", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "grouptarget", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "grouptarget", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "grouptarget", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "grouppet", "visible", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "grouppet", "portrait", "off")
pfUI:UpdateConfig("unitframes", "grouppet", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "grouppet", "width", "100")
pfUI:UpdateConfig("unitframes", "grouppet", "height", "14")
pfUI:UpdateConfig("unitframes", "grouppet", "pheight", "0")
pfUI:UpdateConfig("unitframes", "grouppet", "pwidth", "-1")
pfUI:UpdateConfig("unitframes", "grouppet", "panchor", "TOP")
pfUI:UpdateConfig("unitframes", "grouppet", "pspace", "-3")
pfUI:UpdateConfig("unitframes", "grouppet", "buffs", "off")
pfUI:UpdateConfig("unitframes", "grouppet", "buffsize", "16")
pfUI:UpdateConfig("unitframes", "grouppet", "bufflimit", "16")
pfUI:UpdateConfig("unitframes", "grouppet", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "grouppet", "debuffs", "off")
pfUI:UpdateConfig("unitframes", "grouppet", "debuffsize", "16")
pfUI:UpdateConfig("unitframes", "grouppet", "debufflimit", "16")
pfUI:UpdateConfig("unitframes", "grouppet", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "grouppet", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "grouppet", "verticalbar", "0")
pfUI:UpdateConfig("unitframes", "grouppet", "buff_indicator", "0")
pfUI:UpdateConfig("unitframes", "grouppet", "debuff_indicator", "0")
pfUI:UpdateConfig("unitframes", "grouppet", "clickcast", "0")
pfUI:UpdateConfig("unitframes", "grouppet", "faderange", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "glowaggro", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "glowcombat", "0")
pfUI:UpdateConfig("unitframes", "grouppet", "showtooltip", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "txthpleft", "unit")
pfUI:UpdateConfig("unitframes", "grouppet", "txthpcenter", "none")
pfUI:UpdateConfig("unitframes", "grouppet", "txthpright", "healthperc")
pfUI:UpdateConfig("unitframes", "grouppet", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "grouppet", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "grouppet", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "grouppet", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "grouppet", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "grouppet", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "raid", "visible", "1")
pfUI:UpdateConfig("unitframes", "raid", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "raid", "portrait", "off")
pfUI:UpdateConfig("unitframes", "raid", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "raid", "width", "50")
pfUI:UpdateConfig("unitframes", "raid", "height", "26")
pfUI:UpdateConfig("unitframes", "raid", "pheight", "4")
pfUI:UpdateConfig("unitframes", "raid", "pwidth", "-1")
pfUI:UpdateConfig("unitframes", "raid", "panchor", "TOP")
pfUI:UpdateConfig("unitframes", "raid", "pspace", "-3")
pfUI:UpdateConfig("unitframes", "raid", "buffs", "off")
pfUI:UpdateConfig("unitframes", "raid", "buffsize", "16")
pfUI:UpdateConfig("unitframes", "raid", "bufflimit", "16")
pfUI:UpdateConfig("unitframes", "raid", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "raid", "debuffs", "off")
pfUI:UpdateConfig("unitframes", "raid", "debuffsize", "16")
pfUI:UpdateConfig("unitframes", "raid", "debufflimit", "16")
pfUI:UpdateConfig("unitframes", "raid", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "raid", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "raid", "verticalbar", "0")
pfUI:UpdateConfig("unitframes", "raid", "buff_indicator", "1")
pfUI:UpdateConfig("unitframes", "raid", "debuff_indicator", "1")
pfUI:UpdateConfig("unitframes", "raid", "clickcast", "0")
pfUI:UpdateConfig("unitframes", "raid", "faderange", "1")
pfUI:UpdateConfig("unitframes", "raid", "glowaggro", "1")
pfUI:UpdateConfig("unitframes", "raid", "glowcombat", "0")
pfUI:UpdateConfig("unitframes", "raid", "showtooltip", "1")
pfUI:UpdateConfig("unitframes", "raid", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "raid", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "raid", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "raid", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "raid", "txthpleft", "name")
pfUI:UpdateConfig("unitframes", "raid", "txthpcenter", "none")
pfUI:UpdateConfig("unitframes", "raid", "txthpright", "healthmiss")
pfUI:UpdateConfig("unitframes", "raid", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "raid", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "raid", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "raid", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "raid", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "raid", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "ttarget", "visible", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "ttarget", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "ttarget", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "ttarget", "width", "100")
pfUI:UpdateConfig("unitframes", "ttarget", "height", "20")
pfUI:UpdateConfig("unitframes", "ttarget", "pheight", "3")
pfUI:UpdateConfig("unitframes", "ttarget", "pwidth", "-1")
pfUI:UpdateConfig("unitframes", "ttarget", "panchor", "TOP")
pfUI:UpdateConfig("unitframes", "ttarget", "pspace", "-3")
pfUI:UpdateConfig("unitframes", "ttarget", "buffs", "off")
pfUI:UpdateConfig("unitframes", "ttarget", "buffsize", "16")
pfUI:UpdateConfig("unitframes", "ttarget", "bufflimit", "16")
pfUI:UpdateConfig("unitframes", "ttarget", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "ttarget", "debuffs", "off")
pfUI:UpdateConfig("unitframes", "ttarget", "debuffsize", "16")
pfUI:UpdateConfig("unitframes", "ttarget", "debufflimit", "16")
pfUI:UpdateConfig("unitframes", "ttarget", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "ttarget", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "ttarget", "verticalbar", "0")
pfUI:UpdateConfig("unitframes", "ttarget", "buff_indicator", "0")
pfUI:UpdateConfig("unitframes", "ttarget", "debuff_indicator", "0")
pfUI:UpdateConfig("unitframes", "ttarget", "clickcast", "0")
pfUI:UpdateConfig("unitframes", "ttarget", "faderange", "0")
pfUI:UpdateConfig("unitframes", "ttarget", "glowaggro", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "glowcombat", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "showtooltip", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "txthpleft", "none")
pfUI:UpdateConfig("unitframes", "ttarget", "txthpcenter", "name")
pfUI:UpdateConfig("unitframes", "ttarget", "txthpright", "none")
pfUI:UpdateConfig("unitframes", "ttarget", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "ttarget", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "ttarget", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "ttarget", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "ttarget", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "ttarget", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "pet", "visible", "1")
pfUI:UpdateConfig("unitframes", "pet", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "pet", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "pet", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "pet", "width", "100")
pfUI:UpdateConfig("unitframes", "pet", "height", "16")
pfUI:UpdateConfig("unitframes", "pet", "pheight", "4")
pfUI:UpdateConfig("unitframes", "pet", "pwidth", "-1")
pfUI:UpdateConfig("unitframes", "pet", "panchor", "TOP")
pfUI:UpdateConfig("unitframes", "pet", "pspace", "-3")
pfUI:UpdateConfig("unitframes", "pet", "buffs", "top")
pfUI:UpdateConfig("unitframes", "pet", "buffsize", "12")
pfUI:UpdateConfig("unitframes", "pet", "bufflimit", "16")
pfUI:UpdateConfig("unitframes", "pet", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "pet", "debuffs", "top")
pfUI:UpdateConfig("unitframes", "pet", "debuffsize", "12")
pfUI:UpdateConfig("unitframes", "pet", "debufflimit", "16")
pfUI:UpdateConfig("unitframes", "pet", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "pet", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "pet", "verticalbar", "0")
pfUI:UpdateConfig("unitframes", "pet", "buff_indicator", "0")
pfUI:UpdateConfig("unitframes", "pet", "debuff_indicator", "0")
pfUI:UpdateConfig("unitframes", "pet", "clickcast", "0")
pfUI:UpdateConfig("unitframes", "pet", "faderange", "0")
pfUI:UpdateConfig("unitframes", "pet", "glowaggro", "1")
pfUI:UpdateConfig("unitframes", "pet", "glowcombat", "1")
pfUI:UpdateConfig("unitframes", "pet", "showtooltip", "1")
pfUI:UpdateConfig("unitframes", "pet", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "pet", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "pet", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "pet", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "pet", "txthpleft", "none")
pfUI:UpdateConfig("unitframes", "pet", "txthpcenter", "name")
pfUI:UpdateConfig("unitframes", "pet", "txthpright", "none")
pfUI:UpdateConfig("unitframes", "pet", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "pet", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "pet", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "pet", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "pet", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "pet", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "ptarget", "visible", "0")
pfUI:UpdateConfig("unitframes", "ptarget", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "ptarget", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "ptarget", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "ptarget", "width", "100")
pfUI:UpdateConfig("unitframes", "ptarget", "height", "4")
pfUI:UpdateConfig("unitframes", "ptarget", "pheight", "-1")
pfUI:UpdateConfig("unitframes", "ptarget", "pwidth", "-1")
pfUI:UpdateConfig("unitframes", "ptarget", "panchor", "TOP")
pfUI:UpdateConfig("unitframes", "ptarget", "pspace", "-3")
pfUI:UpdateConfig("unitframes", "ptarget", "buffs", "off")
pfUI:UpdateConfig("unitframes", "ptarget", "buffsize", "16")
pfUI:UpdateConfig("unitframes", "ptarget", "bufflimit", "16")
pfUI:UpdateConfig("unitframes", "ptarget", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "ptarget", "debuffs", "off")
pfUI:UpdateConfig("unitframes", "ptarget", "debuffsize", "16")
pfUI:UpdateConfig("unitframes", "ptarget", "debufflimit", "16")
pfUI:UpdateConfig("unitframes", "ptarget", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "ptarget", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "ptarget", "verticalbar", "0")
pfUI:UpdateConfig("unitframes", "ptarget", "buff_indicator", "0")
pfUI:UpdateConfig("unitframes", "ptarget", "debuff_indicator", "0")
pfUI:UpdateConfig("unitframes", "ptarget", "clickcast", "0")
pfUI:UpdateConfig("unitframes", "ptarget", "faderange", "0")
pfUI:UpdateConfig("unitframes", "ptarget", "glowaggro", "1")
pfUI:UpdateConfig("unitframes", "ptarget", "glowcombat", "1")
pfUI:UpdateConfig("unitframes", "ptarget", "showtooltip", "1")
pfUI:UpdateConfig("unitframes", "ptarget", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "ptarget", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "ptarget", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "ptarget", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "ptarget", "txthpleft", "none")
pfUI:UpdateConfig("unitframes", "ptarget", "txthpcenter", "name")
pfUI:UpdateConfig("unitframes", "ptarget", "txthpright", "none")
pfUI:UpdateConfig("unitframes", "ptarget", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "ptarget", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "ptarget", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "ptarget", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "ptarget", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "ptarget", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "fallback", "visible", "1")
pfUI:UpdateConfig("unitframes", "fallback", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "fallback", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "fallback", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "fallback", "width", "200")
pfUI:UpdateConfig("unitframes", "fallback", "height", "50")
pfUI:UpdateConfig("unitframes", "fallback", "pheight", "10")
pfUI:UpdateConfig("unitframes", "fallback", "pwidth", "-1")
pfUI:UpdateConfig("unitframes", "fallback", "panchor", "TOP")
pfUI:UpdateConfig("unitframes", "fallback", "pspace", "-3")
pfUI:UpdateConfig("unitframes", "fallback", "buffs", "top")
pfUI:UpdateConfig("unitframes", "fallback", "buffsize", "20")
pfUI:UpdateConfig("unitframes", "fallback", "bufflimit", "16")
pfUI:UpdateConfig("unitframes", "fallback", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "fallback", "debuffs", "top")
pfUI:UpdateConfig("unitframes", "fallback", "debuffsize", "20")
pfUI:UpdateConfig("unitframes", "fallback", "debufflimit", "16")
pfUI:UpdateConfig("unitframes", "fallback", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "fallback", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "fallback", "verticalbar", "0")
pfUI:UpdateConfig("unitframes", "fallback", "buff_indicator", "0")
pfUI:UpdateConfig("unitframes", "fallback", "debuff_indicator", "0")
pfUI:UpdateConfig("unitframes", "fallback", "clickcast", "0")
pfUI:UpdateConfig("unitframes", "fallback", "faderange", "0")
pfUI:UpdateConfig("unitframes", "fallback", "glowaggro", "1")
pfUI:UpdateConfig("unitframes", "fallback", "glowcombat", "1")
pfUI:UpdateConfig("unitframes", "fallback", "showtooltip", "1")
pfUI:UpdateConfig("unitframes", "fallback", "healthcolor", "1")
pfUI:UpdateConfig("unitframes", "fallback", "powercolor", "1")
pfUI:UpdateConfig("unitframes", "fallback", "levelcolor", "1")
pfUI:UpdateConfig("unitframes", "fallback", "classcolor", "1")
pfUI:UpdateConfig("unitframes", "fallback", "txthpleft", "unit")
pfUI:UpdateConfig("unitframes", "fallback", "txthpcenter", "none")
pfUI:UpdateConfig("unitframes", "fallback", "txthpright", "healthdyn")
pfUI:UpdateConfig("unitframes", "fallback", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "fallback", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "fallback", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "fallback", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "fallback", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "fallback", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("bars", nil, "icon_size", "20")
pfUI:UpdateConfig("bars", nil, "background", "1")
pfUI:UpdateConfig("bars", nil, "glowrange", "1")
pfUI:UpdateConfig("bars", nil, "rangecolor", "1,0.1,0.1,1")
pfUI:UpdateConfig("bars", nil, "showmacro", "1")
pfUI:UpdateConfig("bars", nil, "showkeybind", "1")
pfUI:UpdateConfig("bars", nil, "showequipped", "1")
pfUI:UpdateConfig("bars", nil, "hunterbar", "0")
pfUI:UpdateConfig("bars", nil, "keydown", "0")
pfUI:UpdateConfig("bars", nil, "pagemaster", "0")
pfUI:UpdateConfig("bars", nil, "showcastable", "0")
pfUI:UpdateConfig("bars", nil, "hide_time", "1")
pfUI:UpdateConfig("bars", nil, "hide_actionmain", "0")
pfUI:UpdateConfig("bars", nil, "hide_bottomleft", "0")
pfUI:UpdateConfig("bars", nil, "hide_bottomright", "0")
pfUI:UpdateConfig("bars", nil, "hide_right", "0")
pfUI:UpdateConfig("bars", nil, "hide_tworight", "0")
pfUI:UpdateConfig("bars", nil, "hide_shapeshift", "0")
pfUI:UpdateConfig("bars", nil, "hide_pet", "0")
pfUI:UpdateConfig("bars", "actionmain", "formfactor", "12 x 1")
pfUI:UpdateConfig("bars", "bottomleft", "formfactor", "12 x 1")
pfUI:UpdateConfig("bars", "bottomright", "formfactor", "6 x 2")
pfUI:UpdateConfig("bars", "right", "formfactor", "6 x 2")
pfUI:UpdateConfig("bars", "tworight", "formfactor", "1 x 12")
pfUI:UpdateConfig("bars", "shapeshift", "formfactor", "10 x 1")
pfUI:UpdateConfig("bars", "pet", "formfactor", "10 x 1")
pfUI:UpdateConfig("panel", nil, "use_unitfonts", "0")
pfUI:UpdateConfig("panel", nil, "hide_leftchat", "0")
pfUI:UpdateConfig("panel", nil, "hide_rightchat", "0")
pfUI:UpdateConfig("panel", nil, "hide_minimap", "0")
pfUI:UpdateConfig("panel", nil, "hide_microbar", "0")
pfUI:UpdateConfig("panel", "left", "left", "guild")
pfUI:UpdateConfig("panel", "left", "center", "durability")
pfUI:UpdateConfig("panel", "left", "right", "friends")
pfUI:UpdateConfig("panel", "right", "left", "fps")
pfUI:UpdateConfig("panel", "right", "center", "time")
pfUI:UpdateConfig("panel", "right", "right", "gold")
pfUI:UpdateConfig("panel", "other", "minimap", "zone")
pfUI:UpdateConfig("panel", "micro", "enable", "0")
pfUI:UpdateConfig("panel", "xp", "showalways", "0")
pfUI:UpdateConfig("panel", "bag", "ignorespecial", "1")
pfUI:UpdateConfig("castbar", "player", "hide_blizz", "1")
pfUI:UpdateConfig("castbar", "player", "hide_pfui", "0")
pfUI:UpdateConfig("castbar", "target", "hide_pfui", "0")
pfUI:UpdateConfig("castbar", nil, "use_unitfonts", "0")
pfUI:UpdateConfig("tooltip", nil, "position", "chat")
pfUI:UpdateConfig("tooltip", nil, "cursoralign", "native")
pfUI:UpdateConfig("tooltip", nil, "cursoroffset", "20")
pfUI:UpdateConfig("tooltip", nil, "extguild", "1")
pfUI:UpdateConfig("tooltip", nil, "alpha", "0.8")
pfUI:UpdateConfig("tooltip", "compare", "basestats", "1")
pfUI:UpdateConfig("tooltip", "compare", "showalways", "0")
pfUI:UpdateConfig("tooltip", "vendor", "showalways", "0")
pfUI:UpdateConfig("chat", "text", "input_width", "0")
pfUI:UpdateConfig("chat", "text", "input_height", "0")
pfUI:UpdateConfig("chat", "text", "outline", "1")
pfUI:UpdateConfig("chat", "text", "mouseover", "0")
pfUI:UpdateConfig("chat", "text", "bracket", "[]")
pfUI:UpdateConfig("chat", "text", "time", "0")
pfUI:UpdateConfig("chat", "text", "timeformat", "%H:%M:%S")
pfUI:UpdateConfig("chat", "text", "timebracket", "[]")
pfUI:UpdateConfig("chat", "text", "timecolor", ".8,.8,.8,1")
pfUI:UpdateConfig("chat", "text", "channelnumonly", "1")
pfUI:UpdateConfig("chat", "text", "detecturl", "1")
pfUI:UpdateConfig("chat", "text", "classcolor", "1")
pfUI:UpdateConfig("chat", "left", "width", "380")
pfUI:UpdateConfig("chat", "left", "height", "180")
pfUI:UpdateConfig("chat", "right", "enable", "0")
pfUI:UpdateConfig("chat", "right", "alwaysshow", "0")
pfUI:UpdateConfig("chat", "right", "width", "380")
pfUI:UpdateConfig("chat", "right", "height", "180")
pfUI:UpdateConfig("chat", "global", "hidecombat", "0")
pfUI:UpdateConfig("chat", "global", "tabdock", "1")
pfUI:UpdateConfig("chat", "global", "tabmouse", "0")
pfUI:UpdateConfig("chat", "global", "chatflash", "1")
pfUI:UpdateConfig("chat", "global", "custombg", "0")
pfUI:UpdateConfig("chat", "global", "background", ".2,.2,.2,.5")
pfUI:UpdateConfig("chat", "global", "border", ".4,.4,.4,.5")
pfUI:UpdateConfig("chat", "global", "whispermod", "1")
pfUI:UpdateConfig("chat", "global", "whisper", "1,.7,1,1")
pfUI:UpdateConfig("chat", "global", "sticky", "1")
pfUI:UpdateConfig("chat", "global", "fadeout", "0")
pfUI:UpdateConfig("chat", "global", "fadetime", "300")
pfUI:UpdateConfig("chat", "global", "scrollspeed", "1")
pfUI:UpdateConfig("chat", "bubbles", "alpha", ".75")
pfUI:UpdateConfig("nameplates", nil, "use_unitfonts", "0")
pfUI:UpdateConfig("nameplates", nil, "legacy", "0")
pfUI:UpdateConfig("nameplates", nil, "overlap", "0")
pfUI:UpdateConfig("nameplates", nil, "showcastbar", "1")
pfUI:UpdateConfig("nameplates", nil, "spellname", "0")
pfUI:UpdateConfig("nameplates", nil, "showdebuffs", "0")
pfUI:UpdateConfig("nameplates", nil, "clickthrough", "0")
pfUI:UpdateConfig("nameplates", nil, "rightclick", "1")
pfUI:UpdateConfig("nameplates", nil, "clickthreshold", "0.5")
pfUI:UpdateConfig("nameplates", nil, "enemyclassc", "1")
pfUI:UpdateConfig("nameplates", nil, "friendclassc", "1")
pfUI:UpdateConfig("nameplates", nil, "raidiconsize", "16")
pfUI:UpdateConfig("nameplates", nil, "players", "0")
pfUI:UpdateConfig("nameplates", nil, "critters", "0")
pfUI:UpdateConfig("nameplates", nil, "totems", "0")
pfUI:UpdateConfig("nameplates", nil, "showhp", "0")
pfUI:UpdateConfig("nameplates", nil, "vpos", "-10")
pfUI:UpdateConfig("nameplates", nil, "width", "120")
pfUI:UpdateConfig("nameplates", nil, "heighthealth", "8")
pfUI:UpdateConfig("nameplates", nil, "heightcast", "8")
pfUI:UpdateConfig("nameplates", nil, "cpdisplay", "0")
pfUI:UpdateConfig("nameplates", nil, "targethighlight", "0")
pfUI:UpdateConfig("thirdparty", nil, "chatbg", "1")
pfUI:UpdateConfig("thirdparty", nil, "showmeter", "0")
pfUI:UpdateConfig("thirdparty", "dpsmate", "skin", "1")
pfUI:UpdateConfig("thirdparty", "dpsmate", "dock", "1")
pfUI:UpdateConfig("thirdparty", "swstats", "skin", "1")
pfUI:UpdateConfig("thirdparty", "swstats", "dock", "1")
pfUI:UpdateConfig("thirdparty", "ktm", "skin", "1")
pfUI:UpdateConfig("thirdparty", "ktm", "dock", "1")
pfUI:UpdateConfig("thirdparty", "wim", "enable", "1")
pfUI:UpdateConfig("thirdparty", "healcomm", "enable", "1")
pfUI:UpdateConfig("thirdparty", "sortbags", "enable", "1")
pfUI:UpdateConfig("thirdparty", "flightmap", "enable", "1")
pfUI:UpdateConfig("thirdparty", "atlasloot", "enable", "1")
pfUI:UpdateConfig("thirdparty", "druidmana", "enable", "1")
pfUI:UpdateConfig("position", nil, nil, nil)
pfUI:UpdateConfig("disabled", nil, nil, nil)
pfUI:UpdateConfig("gm", nil, "disable", "1")
pfUI:UpdateConfig("gm", nil, "server", "elysium")
end
function pfUI:MigrateConfig()
-- config version
local major, minor, fix = pfUI.api.strsplit(".", tostring(pfUI_config.version))
local major = tonumber(major) or 0
local minor = tonumber(minor) or 0
local fix = tonumber(fix) or 0
local function checkversion(chkmajor, chkminor, chkfix)
local chkversion = chkmajor + chkminor/100 + chkfix/10000
local curversion = major + minor/100 + fix/10000
return curversion <= chkversion and true or nil
end
-- migrating to new fonts (1.5 -> 1.6)
if checkversion(1, 6, 0) then
-- migrate font_default
if pfUI_config.global.font_default == "arial" then
pfUI_config.global.font_default = "Myriad-Pro"
elseif pfUI_config.global.font_default == "homespun" then
pfUI_config.global.font_default = "Homespun"
elseif pfUI_config.global.font_default == "diediedie" then
pfUI_config.global.font_default = "DieDieDie"
end
-- migrate font_square
if pfUI_config.global.font_square == "arial" then
pfUI_config.global.font_square = "Myriad-Pro"
elseif pfUI_config.global.font_square == "homespun" then
pfUI_config.global.font_square = "Homespun"
elseif pfUI_config.global.font_square == "diediedie" then
pfUI_config.global.font_square = "DieDieDie"
end
-- migrate font_combat
if pfUI_config.global.font_combat == "arial" then
pfUI_config.global.font_combat = "Myriad-Pro"
elseif pfUI_config.global.font_combat == "homespun" then
pfUI_config.global.font_combat = "Homespun"
elseif pfUI_config.global.font_combat == "diediedie" then
pfUI_config.global.font_combat = "DieDieDie"
end
end
-- migrating to new loot config section (> 2.0.5)
if checkversion(2, 0, 5) then
if pfUI_config.appearance.loot and pfUI_config.appearance.loot.autoresize then
pfUI_config.loot.autoresize = pfUI_config.appearance.loot.autoresize
pfUI_config.appearance.loot.autoresize = nil
pfUI_config.appearance.loot = nil
end
end
-- migrating to new unitframes (> 2.5)
if checkversion(2, 5, 0) then
-- migrate clickcast settings
if pfUI_config.unitframes.raid.clickcast_ctrl then
pfUI_config.unitframes.clickcast = pfUI_config.unitframes.raid.clickcast
pfUI_config.unitframes.clickcast_shift = pfUI_config.unitframes.raid.clickcast_shift
pfUI_config.unitframes.clickcast_alt = pfUI_config.unitframes.raid.clickcast_alt
pfUI_config.unitframes.clickcast_ctrl = pfUI_config.unitframes.raid.clickcast_ctrl
pfUI_config.unitframes.raid.clickcast = "0"
pfUI_config.unitframes.raid.clickcast_shift = nil
pfUI_config.unitframes.raid.clickcast_alt = nil
pfUI_config.unitframes.raid.clickcast_ctrl = nil
end
-- migrate buffsizes
if pfUI_config.unitframes.buff_size then
pfUI_config.unitframes.player.buffsize = pfUI_config.unitframes.buff_size
pfUI_config.unitframes.target.buffsize = pfUI_config.unitframes.buff_size
pfUI_config.unitframes.buff_size = nil
end
-- migrate debuffsizes
if pfUI_config.unitframes.debuff_size then
pfUI_config.unitframes.player.debuffsize = pfUI_config.unitframes.debuff_size
pfUI_config.unitframes.target.debuffsize = pfUI_config.unitframes.debuff_size
pfUI_config.unitframes.debuff_size = nil
end
end
-- migrating to new fontnames (> 2.6)
if checkversion(2, 6, 0) then
-- migrate font_combat
if pfUI_config.global.font_square then
pfUI_config.global.font_unit = pfUI_config.global.font_square
pfUI_config.global.font_square = nil
end
end
-- migrating old to new font layout (> 3.0.0)
if checkversion(3, 0, 0) then
-- migrate font_default
if not strfind(pfUI_config.global.font_default, "\\") then
pfUI_config.global.font_default = "Interface\\AddOns\\pfUI\\fonts\\" .. pfUI_config.global.font_default .. ".ttf"
end
-- migrate font_unit
if not strfind(pfUI_config.global.font_unit, "\\") then
pfUI_config.global.font_unit = "Interface\\AddOns\\pfUI\\fonts\\" .. pfUI_config.global.font_unit .. ".ttf"
end
-- migrate font_combat
if not strfind(pfUI_config.global.font_combat, "\\") then
pfUI_config.global.font_combat = "Interface\\AddOns\\pfUI\\fonts\\" .. pfUI_config.global.font_combat .. ".ttf"
end
end
-- migrating old to new unitframe texts (> 3.0.0)
if checkversion(3, 0, 0) then
local unitframes = { "player", "target", "focus", "group", "grouptarget", "grouppet", "raid", "ttarget", "pet", "ptarget", "fallback" }
for _, unitframe in pairs(unitframes) do
if pfUI_config.unitframes[unitframe].txtleft then
pfUI_config.unitframes[unitframe].txthpleft = pfUI_config.unitframes[unitframe].txtleft
pfUI_config.unitframes[unitframe].txtleft = nil
end
if pfUI_config.unitframes[unitframe].txtcenter then
pfUI_config.unitframes[unitframe].txthpcenter = pfUI_config.unitframes[unitframe].txtcenter
pfUI_config.unitframes[unitframe].txtcenter = nil
end
if pfUI_config.unitframes[unitframe].txtright then
pfUI_config.unitframes[unitframe].txthpright = pfUI_config.unitframes[unitframe].txtright
pfUI_config.unitframes[unitframe].txtright = nil
end
end
end
-- migrating animation_speed (> 3.1.2)
if checkversion(3, 1, 2) then
if tonumber(pfUI_config.unitframes.animation_speed) >= 13 then
pfUI_config.unitframes.animation_speed = "13"
elseif tonumber(pfUI_config.unitframes.animation_speed) >= 8 then
pfUI_config.unitframes.animation_speed = "8"
elseif tonumber(pfUI_config.unitframes.animation_speed) >= 5 then
pfUI_config.unitframes.animation_speed = "5"
elseif tonumber(pfUI_config.unitframes.animation_speed) >= 3 then
pfUI_config.unitframes.animation_speed = "3"
elseif tonumber(pfUI_config.unitframes.animation_speed) >= 2 then
pfUI_config.unitframes.animation_speed = "2"
elseif tonumber(pfUI_config.unitframes.animation_speed) >= 1 then
pfUI_config.unitframes.animation_speed = "1"
else
pfUI_config.unitframes.animation_speed = "5"
end
end
-- migrating rangecheck interval (> 3.2.2)
if checkversion(3, 2, 2) then
if tonumber(pfUI_config.unitframes.rangechecki) <= 1 then
pfUI_config.unitframes.rangechecki = "2"
end
end
-- migrating legacy buff/debuff naming (> 3.5.0)
if checkversion(3, 5, 0) then
local unitframes = { "player", "target", "focus", "group", "grouptarget", "grouppet", "raid", "ttarget", "pet", "ptarget", "fallback" }
for _, unitframe in pairs(unitframes) do
local entry = pfUI_config.unitframes[unitframe]
if entry.buffs and entry.buffs == "hide" then entry.buffs = "off" end
if entry.debuffs and entry.debuffs == "hide" then entry.debuffs = "off" end
end
end
-- migrating glow settings (> 3.5.1)
if checkversion(3, 5, 0) then
local common = { "player", "target", "ttarget", "pet", "ptarget"}
for _, unitframe in pairs(common) do
if pfUI_config.appearance.infight.group == "1" then
pfUI_config.unitframes[unitframe].glowcombat = "1"
pfUI_config.unitframes[unitframe].glowaggro = "1"
else
pfUI_config.unitframes[unitframe].glowcombat = "0"
pfUI_config.unitframes[unitframe].glowaggro = "0"
end
end
if pfUI_config.appearance.infight.group == "1" then
pfUI_config.unitframes["group"].glowcombat = "1"
pfUI_config.unitframes["group"].glowaggro = "1"
else
pfUI_config.unitframes["group"].glowcombat = "0"
pfUI_config.unitframes["group"].glowaggro = "0"
end
end
-- migrating old buff settings (> 3.6.1)
if checkversion(3, 6, 1) then
pfUI_config.buffs.weapons = pfUI_config.global.hidewbuff == "1" and "0" or "1"
pfUI_config.buffs.buffs = pfUI_config.global.hidebuff == "1" and "0" or "1"
pfUI_config.buffs.debuffs = pfUI_config.global.hidebuff == "1" and "0" or "1"
end
pfUI_config.version = pfUI.version.string
end
+2 -4
View File
@@ -289,13 +289,11 @@ hooksecurefunc("CastSpellByName", function(spellName, target)
end
end, true)
local scanner = CreateFrame("GameTooltip", "pfSpellScanner", nil, "GameTooltipTemplate")
scanner:SetOwner(WorldFrame, "ANCHOR_NONE")
local scanner = libtipscan:GetScanner("libcast")
hooksecurefunc("UseAction", function(slot, target, button)
if GetActionText(slot) or not IsCurrentAction(slot) then return end
scanner:ClearLines()
scanner:SetAction(slot)
local spellName = pfSpellScannerTextLeft1:GetText()
local spellName = scanner:Line(1)
CastCustom(spellName)
end, true)
+7 -13
View File
@@ -12,12 +12,12 @@ setfenv(1, pfUI:GetEnvironment())
-- start, duration, timeleft
local libdebuff = CreateFrame("Frame", "pfdebuffsScanner", UIParent)
local scanner = libtipscan:GetScanner("libdebuff")
function libdebuff:GetDebuffName(unit, index)
libdebuff.scanner:SetOwner(UIParent, "ANCHOR_NONE")
libdebuff.scanner:SetUnitDebuff(unit, index)
local text = getglobal("pfDebuffNameScanTextLeft1")
return ( text ) and text:GetText() or ""
scanner:SetUnitDebuff(unit, index)
local text = scanner:Line(1)
return ( text ) and text or ""
end
function libdebuff:GetDebuffInfo(unit, effect)
@@ -140,8 +140,6 @@ function libdebuff:AddEffect(unit, unitlevel, effect, duration)
end
end
libdebuff.scanner = CreateFrame('GameTooltip', "pfDebuffNameScan", UIParent, "GameTooltipTemplate")
-- scan for debuff application
libdebuff:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE")
libdebuff:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE")
@@ -217,25 +215,21 @@ end)
-- Gather Data by User Actions
hooksecurefunc("CastSpell", function(id, bookType)
local effect = GetSpellName(id, bookType)
local _, rank = GetSpellInfo(id, bookType)
local _, rank = libspell.GetSpellInfo(id, bookType)
local duration = libdebuff:GetDuration(effect, rank)
libdebuff:AddPending(UnitName("target"), UnitLevel("target"), effect, duration)
end, true)
hooksecurefunc("CastSpellByName", function(effect, target)
local _, rank = GetSpellInfo(effect)
local _, rank = libspell.GetSpellInfo(effect)
local duration = libdebuff:GetDuration(effect, rank)
libdebuff:AddPending(UnitName("target"), UnitLevel("target"), effect, duration)
end, true)
local scanner = CreateFrame("GameTooltip", "pfDebuffSpellScanner", nil, "GameTooltipTemplate")
scanner:SetOwner(WorldFrame, "ANCHOR_NONE")
hooksecurefunc("UseAction", function(slot, target, button)
if GetActionText(slot) or not IsCurrentAction(slot) then return end
scanner:ClearLines()
scanner:SetAction(slot)
local effect = pfDebuffSpellScannerTextLeft1:IsVisible() and pfDebuffSpellScannerTextLeft1:GetText()
local rank = pfDebuffSpellScannerTextRight1:IsVisible() and pfDebuffSpellScannerTextRight1:GetText()
local effect, rank = scanner:Line(1)
local duration = libdebuff:GetDuration(effect, rank)
libdebuff:AddPending(UnitName("target"), UnitLevel("target"), effect, duration)
end, true)
+124
View File
@@ -0,0 +1,124 @@
-- load pfUI environment
setfenv(1, pfUI:GetEnvironment())
local scanner = libtipscan:GetScanner("libspell")
local libspell = {}
-- [ GetSpellMaxRank ]
-- Returns the maximum rank of a players spell.
-- 'name' [string] spellname to query
-- return: [string],[number] maximum rank in characters and the number
-- e.g "Rank 1" and "1"
local spellmaxrank = {}
function libspell.GetSpellMaxRank(name)
if spellmaxrank[name] then return unpack(spellmaxrank[name]) end
local rank = { 0, nil}
for i = 1, GetNumSpellTabs() do
local _, _, offset, num = GetSpellTabInfo(i)
local bookType = BOOKTYPE_SPELL
for id = offset + 1, offset + num do
local spellName, spellRank = GetSpellName(id, bookType)
if spellName == name then
if not rank[2] then rank[2] = spellRank end
local _, _, numRank = string.find(spellRank, " (%d+)$")
if numRank and tonumber(numRank) > rank[1] then
rank = { tonumber(numRank), spellRank}
end
end
end
end
spellmaxrank[name] = { rank[2], rank[1] }
return rank[2], rank[1]
end
-- [ GetSpellIndex ]
-- Returns the spellbook index and bookid of the given spell.
-- 'name' [string] spellname to query
-- 'rank' [string] rank to query (optional)
-- return: [number],[string] spell index and spellbook id
local spellindex = {}
function libspell.GetSpellIndex(name, rank)
if spellindex[name..(rank or "")] then return unpack(spellindex[name..(rank or "")]) end
if not rank then rank = libspell.GetSpellMaxRank(name) end
for i = 1, GetNumSpellTabs() do
local _, _, offset, num = GetSpellTabInfo(i)
local bookType = BOOKTYPE_SPELL
for id = offset + 1, offset + num do
local spellName, spellRank = GetSpellName(id, bookType)
if rank and rank == spellRank and name == spellName then
spellindex[name..rank] = { id, bookType }
return id, bookType
elseif not rank and name == spellName then
spellindex[name] = { id, bookType }
return id, bookType
end
end
end
spellindex[name..(rank or "")] = { nil }
return nil
end
-- [ GetSpellInfo ]
-- Returns several information about a spell.
-- 'index' [string/number] Spellname or Index of a spell in the spellbook
-- 'bookType' [string] Type of spellbook (optional)
-- return:
-- [string] Name of the spell
-- [string] Secondary text associated with the spell
-- (e.g."Rank 5", "Racial", etc.)
-- [string] Path to an icon texture for the spell
-- [number] Casting time of the spell in milliseconds
-- [number] Minimum range from the target required to cast the spell
-- [number] Maximum range from the target at which you can cast the spell
local spellinfo = {}
function libspell.GetSpellInfo(index, bookType)
if spellinfo[index] then return unpack(spellinfo[index]) end
local name, rank, id
local icon = ""
local castingTime = 0
local minRange = 0
local maxRange = 0
if type(index) == "string" then
local _, _, sname, srank = string.find(index, '(.+)%((.+)%)')
name = sname or index
rank = srank or libspell.GetSpellMaxRank(name)
id, bookType = libspell.GetSpellIndex(name, rank)
else
name, rank = GetSpellName(index, bookType)
id, bookType = libspell.GetSpellIndex(name, rank)
end
if name and id then
texture = GetSpellTexture(id, bookType)
end
if id then
scanner:SetSpell(id, bookType)
local _,sec = scanner:Find(gsub(SPELL_CAST_TIME_SEC, "%%.3g", "%(.+%)"))
local _,min = scanner:Find(gsub(SPELL_CAST_TIME_MIN, "%%.3g", "%(.+%)"))
local _,range = scanner:Find(gsub(SPELL_RANGE, "%%s", "%(.+%)"))
castingTime = (tonumber(sec) or tonumber(min) or 0) * 1000
if range then
local _, _, min, max = string.find(range, "(.+)-(.+)")
if min and max then
minRange = tonumber(min)
maxRange = tonumber(max)
else
minRange = 0
maxRange = tonumber(range)
end
end
end
spellinfo[index] = { name, rank, icon, castingTime, minRange, maxRange }
return name, rank, icon, castingTime, minRange, maxRange
end
-- add libspell to pfUI API
pfUI.api.libspell = libspell
+194
View File
@@ -0,0 +1,194 @@
-- load pfUI environment
setfenv(1, pfUI:GetEnvironment())
--[[ libtipscan ]]--
-- A pfUI library that provides tooltip scanner.
--
-- libtipscan:GetScanner(name)
-- returns or resets a scanner for use with tooltip methods
--
-- libtipscan:List()
-- prints a list of all active scanners
--
-- The scanner tooltip returned by :GetScanner has all the Set____ GameTooltip methods with a built-in full clear
-- In addition the scanner has the following custom methods
-- <scanner>:Clear()
-- empties the scanner tooltip
-- <scanner>:Text()
-- return a table with all the left, right texts in {[line] = {left, right}} format
-- <scanner>:Find(text, [exact])
-- returns true (linenumber) and [the text found or the captures made if text is a pattern]
-- exact is optional flag making it look only for exact matches
-- <scanner>:Color(r,g,b)
-- returns true (linenumber) if the r,g,b color tuple is found as text color on the scanner
-- accepts color table as argument as well (eg. <scanner>:Color(RED_FONT_COLOR) )
-- <scanner>:Line(line_number)
-- returns left, right text from that tooltip line
-- <scanner>:List()
-- prints a list of all available scanner methods
local libtipscan = {}
local baseName = "pfUIScan"
local methods = {
"SetBagItem", "SetAction", "SetAuctionItem", "SetAuctionSellItem", "SetBuybackItem",
"SetCraftItem", "SetCraftSpell", "SetHyperlink", "SetInboxItem", "SetInventoryItem",
"SetLootItem", "SetLootRollItem", "SetMerchantItem", "SetPetAction", "SetPlayerBuff",
"SetQuestItem", "SetQuestLogItem", "SetQuestRewardSpell", "SetSendMailItem", "SetShapeshift",
"SetSpell", "SetTalent", "SetTrackingSpell", "SetTradePlayerItem", "SetTradeSkillItem", "SetTradeTargetItem",
"SetTrainerService", "SetUnit", "SetUnitBuff", "SetUnitDebuff",
}
local extra_methods = {
"Clear", "Find", "Line", "Text", "List",
}
local clearText = function(...)
for i=1,arg.n do
local region = arg[i]
if region:IsObjectType("FontString") and region.SetText then
region:SetTextColor(0,0,0)
region:SetText()
end
end
end
local clearTooltip = function(obj)
clearText(obj:GetRegions())
obj:ClearLines()
return obj
end
local getText = function(obj)
local name = obj:GetName()
local text = {}
for i=1, obj:NumLines() do
local left, right = _G[string.format("%sTextLeft%d",name,i)]:GetText(), _G[string.format("%sTextRight%d",name,i)]:GetText()
left = left and left ~= "" and left or nil
right = right and right ~= "" and right or nil
if left or right then
text[i] = {left, right}
end
end
return text
end
local stripPos = function(...)
if arg[1] then
table.remove(arg,1)
table.remove(arg,1)
end
return unpack(arg)
end
local findText = function(obj, text, exact)
local name = obj:GetName()
for i=1, obj:NumLines() do
local left, right = _G[string.format("%sTextLeft%d",name,i)]:GetText(), _G[string.format("%sTextRight%d",name,i)]:GetText()
if exact then
if (left and left == text) or (right and right == text) then
return i, text
end
else
if left and (string.find(left, text)) then
return i, stripPos(string.find(left,text))
end
if right and (string.find(right, text)) then
return i, stripPos(string.find(right,text))
end
end
end
end
local lineText = function(obj, line)
local name = obj:GetName()
if line <= obj:NumLines() then
local left, right = _G[string.format("%sTextLeft%d",name,line)]:GetText(), _G[string.format("%sTextRight%d",name,line)]:GetText()
if left or right then
return left, right
end
end
end
local findColor = function(obj, r,g,b)
local name = obj:GetName()
if type(r) == "table" then
r,g,b = r.r or r[1], r.g or r[2], r.b or r[3]
end
for i=1, obj:NumLines() do
local tr, tg, tb
local left, right = _G[string.format("%sTextLeft%d",name,i)], _G[string.format("%sTextRight%d",name,i)]
if left then
tr, tg, tb = left:GetTextColor()
tr, tg, tb = round(tr,1), round(tg,1), round(tb,1)
end
if tr and (tr == r and tg == g and tb == b) then
return i
end
if right then
tr, tg, tb = right:GetTextColor()
tr, tg, tb = round(tr,1), round(tg,1), round(tb,1)
end
if tr and (tr == r and tg == g and tb == b) then
return i
end
end
end
libtipscan._registry = setmetatable({},{__index = function(t,k)
local v = CreateFrame("GameTooltip", string.format("%s%s",baseName,k), nil, "GameTooltipTemplate")
v:SetOwner(v,"ANCHOR_NONE")
v:SetScript("OnHide", function ()
this:SetOwner(this,"ANCHOR_NONE")
end)
function v:Clear()
clearTooltip(self)
end
function v:Text()
return getText(self)
end
function v:Find(text, exact)
return findText(self, text, exact)
end
function v:Color(r,g,b)
return findColor(self,r,g,b)
end
function v:Line(line)
return lineText(self, line)
end
for _,method in ipairs(methods) do
local method = method
local old = v[method]
v[method] = function(v, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
if v:IsShown() then
v:Hide()
end
v:Clear()
return old(v, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
end
end
function v:List()
table.sort(methods)
for _,method in ipairs(methods) do
print(method)
end
for _,method in ipairs(extra_methods) do
print(method)
end
end
rawset(t,k,v)
return v
end})
function libtipscan:GetScanner(type)
local scanner = self._registry[type]
scanner:Clear()
return scanner
end
function libtipscan:List()
for name, scanner in pairs(self._registry) do
print(name)
end
end
-- add libtipscan to pfUI API
pfUI.api.libtipscan = libtipscan
+822
View File
@@ -0,0 +1,822 @@
-- load pfUI environment
setfenv(1, pfUI:GetEnvironment())
function pfUI.api.CreateTabChild(self, title, bwidth, bheight, bottom, static)
-- create tab button
local b = CreateFrame("Button", "pfConfig" .. title .. "Button", self, "UIPanelButtonTemplate")
b:SetText(title)
-- setup env
local childcount = table.getn(self.childs) + 1
local button_width = bwidth
local button_height = bheight or 20
local border = 4
if not button_width then
button_width = 150
elseif button_width == true then
button_width = _G["pfConfig" .. title .. "ButtonText"]:GetStringWidth() + 4 * border
end
-- set dimensions
b:SetHeight(button_height)
b:SetWidth(button_width)
b:SetID(childcount)
if not self.align or self.align == "LEFT" then
local outside = self.outside and -2 * border - button_width or 0
if bottom then
b:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", border + outside, (self.bottomcount-1) * (button_height) + (self.bottomcount * border) )
else
b:SetPoint("TOPLEFT", self, "TOPLEFT", border + outside, -(childcount-1) * (button_height) - (childcount * border) )
end
elseif self.align == "TOP" then
local outside = self.outside and 2 * border + button_height or 0
local prev_button = self.buttons[getn(self.buttons)]
if prev_button then
b:SetPoint("TOPLEFT", prev_button, "TOPRIGHT", border, 0)
else
b:SetPoint("TOPLEFT", self, "TOPLEFT", border + (self.outside and -border), -border + outside )
end
end
SkinButton(b,.2,1,.8)
if childcount ~= 1 then
b:SetTextColor(.5,.5,.5)
else
b:SetTextColor(.2,1,.8)
end
b:SetScript("OnClick", function()
for k,v in pairs(self.childs) do
v:Hide()
end
self.childs[this:GetID()]:Show()
for k,v in pairs(self.buttons) do
v.active = false
v:SetTextColor(.5,.5,.5)
end
self.buttons[this:GetID()]:SetTextColor(.2,1,.8)
end)
self.buttons[childcount] = b
self.bottomcount = bottom and self.bottomcount + 1 or self.bottomcount
-- create child frame
local child, scrollchild = nil, nil
if not static then
child = CreateScrollFrame("pfConfig" .. title .. "Frame", self)
scrollchild = CreateScrollChild("pfConfig" .. title .. "ScrollChild", child)
else
child = CreateFrame("Frame", "pfConfig" .. title .. "Frame", self)
end
if childcount ~= 1 then child:Hide() end
if not self.align or self.align == "LEFT" then
child:SetPoint("TOPLEFT", self, "TOPLEFT", button_width + 2*border + 5, -border -5)
child:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -border -5 , border + 5)
elseif self.align == "TOP" then
if self.outside then
child:SetPoint("TOPLEFT", self, "TOPLEFT", 5, -5)
child:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -5, 5)
end
end
local backdrop = CreateFrame("Frame", nil, child)
backdrop:SetFrameLevel(1)
backdrop:SetPoint("TOPLEFT", child, "TOPLEFT", -5, 5)
backdrop:SetPoint("BOTTOMRIGHT", child, "BOTTOMRIGHT", 5, -5)
CreateBackdrop(backdrop, nil, true)
local ret = scrollchild or child
ret.button = b
table.insert(self.childs, child)
return ret
end
function pfUI.api.CreateTabFrame(parent, align, outside)
local f = CreateFrame("Frame", nil, parent)
f:SetPoint("TOPLEFT", parent, "TOPLEFT", -5, 5)
f:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", 5, -5)
-- setup env
f.childs = { }
f.buttons = { }
f.align = align
f.outside = outside
f.bottomcount = 1
-- Create Child Frame
f.CreateTabChild = pfUI.api.CreateTabChild
return f
end
function pfUI.api.CreateScrollFrame(name, parent)
local f = CreateFrame("ScrollFrame", name, parent)
local br, bg, bb, ba = pfUI.api.GetStringColor(pfUI_config.appearance.border.background)
f.Scroll = function(self, step)
local current = self:GetVerticalScroll()
local new = current + step*-25
local max = self:GetVerticalScrollRange() + 25
if max > 25 then
if new < 0 then
self:SetVerticalScroll(0)
elseif new > max then
self:SetVerticalScroll(max)
else
self:SetVerticalScroll(new)
end
end
self:UpdateScrollState()
end
f:EnableMouseWheel(1)
f.deco_up = CreateFrame("Frame", nil, f)
f.deco_up:SetPoint("TOPLEFT", f, "TOPLEFT", -4, 4)
f.deco_up:SetPoint("BOTTOMRIGHT", f, "TOPRIGHT", 4, -25)
f.deco_up.fader = f.deco_up:CreateTexture("OVERLAY")
f.deco_up.fader:SetTexture(1,1,1,1)
f.deco_up.fader:SetGradientAlpha("VERTICAL", br, bg, bb, 0, br, bg, bb, 1)
f.deco_up.fader:SetAllPoints(f.deco_up)
f.deco_up_indicator = CreateFrame("Button", nil, f.deco_up)
f.deco_up_indicator:SetFrameLevel(128)
f.deco_up_indicator:Hide()
f.deco_up_indicator:SetPoint("TOP", f.deco_up, "TOP", 0, -6)
f.deco_up_indicator:SetHeight(12)
f.deco_up_indicator:SetWidth(12)
f.deco_up_indicator.modifier = 0.03
f.deco_up_indicator:SetScript("OnClick", function()
local f = this:GetParent():GetParent()
f:Scroll(3)
end)
f.deco_up_indicator:SetScript("OnUpdate", function()
local alpha = this:GetAlpha()
local fpsmod = GetFramerate() / 30
if alpha >= .75 then
this.modifier = -0.03 / fpsmod
elseif alpha <= .25 then
this.modifier = 0.03 / fpsmod
end
this:SetAlpha(alpha + this.modifier)
end)
f.deco_up_indicator.tex = f.deco_up_indicator:CreateTexture("OVERLAY")
f.deco_up_indicator.tex:SetTexture("Interface\\AddOns\\pfUI\\img\\up")
f.deco_up_indicator.tex:SetAllPoints(f.deco_up_indicator)
f.deco_down = CreateFrame("Frame", nil, f)
f.deco_down:SetPoint("BOTTOMLEFT", f, "BOTTOMLEFT", -4, -4)
f.deco_down:SetPoint("TOPRIGHT", f, "BOTTOMRIGHT", 4, 25)
f.deco_down.fader = f.deco_down:CreateTexture("OVERLAY")
f.deco_down.fader:SetTexture(1,1,1,1)
f.deco_down.fader:SetGradientAlpha("VERTICAL", br, bg, bb, 1, br, bg, bb, 0)
f.deco_down.fader:SetAllPoints(f.deco_down)
f.deco_down_indicator = CreateFrame("Button", nil, f.deco_down)
f.deco_down_indicator:SetFrameLevel(128)
f.deco_down_indicator:Hide()
f.deco_down_indicator:SetPoint("BOTTOM", f.deco_down, "BOTTOM", 0, 6)
f.deco_down_indicator:SetHeight(12)
f.deco_down_indicator:SetWidth(12)
f.deco_down_indicator.modifier = 0.03
f.deco_down_indicator:SetScript("OnClick", function()
local f = this:GetParent():GetParent()
f:Scroll(-3)
end)
f.deco_down_indicator:SetScript("OnUpdate", function()
local alpha = this:GetAlpha()
local fpsmod = GetFramerate() / 30
if alpha >= .75 then
this.modifier = -0.03 / fpsmod
elseif alpha <= .25 then
this.modifier = 0.03 / fpsmod
end
this:SetAlpha(alpha + this.modifier)
end)
f.deco_down_indicator.tex = f.deco_down_indicator:CreateTexture("OVERLAY")
f.deco_down_indicator.tex:SetTexture("Interface\\AddOns\\pfUI\\img\\down")
f.deco_down_indicator.tex:SetAllPoints(f.deco_down_indicator)
f.UpdateScrollState = function(self)
-- Update Scroll Indicators: Hide/Show if required.
local current = floor(self:GetVerticalScroll())
local max = floor(self:GetVerticalScrollRange() + 25)
if current > 0 then
self.deco_up_indicator:Show()
else
self.deco_up_indicator:Hide()
end
if max > 25 and current < max then
self.deco_down_indicator:Show()
self.deco_down_indicator:SetAlpha(.75)
else
self.deco_down_indicator:Hide()
end
end
f:SetScript("OnMouseWheel", function()
this:Scroll(arg1)
end)
return f
end
function pfUI.api.CreateScrollChild(name, parent)
local f = CreateFrame("Frame", name, parent)
-- dummy values required
f:SetWidth(1)
f:SetHeight(1)
f:SetAllPoints(parent)
parent:SetScrollChild(f)
-- OnShow is fired too early, postpone to the first frame draw
f:SetScript("OnUpdate", function()
this:GetParent():UpdateScrollState()
this:SetScript("OnUpdate", nil)
end)
return f
end
-- [ EnableClickRotate ]
-- Enables Modelframes to be rotated by click-drag
-- 'frame' [frame] the modelframe that should be used
function pfUI.api.EnableClickRotate(frame)
frame:EnableMouse(true)
frame:SetScript("OnUpdate", function()
if this.rotate then
local x,_ = GetCursorPosition()
if this.curx > x then
this.rotation = this.rotation - abs(x-this.curx) * 0.025
elseif this.curx < x then
this.rotation = this.rotation + abs(x-this.curx) * 0.025
end
this:SetRotation(this.rotation)
this.curx, this.cury = x, y
end
end)
frame:SetScript("OnMouseDown", function()
if arg1 == "LeftButton" then
this.rotate = true
this.curx, this.cury = GetCursorPosition()
end
end)
frame:SetScript("OnMouseUp", function()
this.rotate, this.curx, this.cury = nil, nil, nil
end)
end
-- [ Skin Button ]
-- Applies pfUI skin to buttons:
-- 'button' [frame/string] the button that should be skinned.
-- 'cr' [int] mouseover color (red), defaults to classcolor.
-- 'cg' [int] mouseover color (green), defaults to classcolor.
-- 'cb' [int] mouseover color (blue), defaults to classcolor.
function pfUI.api.SkinButton(button, cr, cg, cb)
local b = getglobal(button)
if not b then b = button end
if not b then return end
if not cr or not cg or not cb then
_, class = UnitClass("player")
local color = RAID_CLASS_COLORS[class]
cr, cg, cb = color.r , color.g, color.b
end
pfUI.api.CreateBackdrop(b, nil, true)
b:SetNormalTexture(nil)
b:SetHighlightTexture(nil)
b:SetPushedTexture(nil)
b:SetDisabledTexture(nil)
local funce = b:GetScript("OnEnter")
local funcl = b:GetScript("OnLeave")
b:SetScript("OnEnter", function()
if funce then funce() end
pfUI.api.CreateBackdrop(b, nil, true)
b:SetBackdropBorderColor(cr,cg,cb,1)
end)
b:SetScript("OnLeave", function()
if funcl then funcl() end
pfUI.api.CreateBackdrop(b, nil, true)
end)
b:SetFont(pfUI.font_default, pfUI_config.global.font_size, "OUTLINE")
end
function pfUI.api.SkinNextPrevButton(frame, direction)
StripTextures(frame)
frame:SetNormalTexture(nil)
frame:SetPushedTexture(nil)
frame:SetHighlightTexture(nil)
frame:SetDisabledTexture(nil)
CreateBackdrop(frame)
SetAllPointsOffset(frame.backdrop, frame, 4)
if not frame.icon then
frame.icon = frame:CreateTexture(nil, "ARTWORK")
frame.icon:SetAlpha(.8)
SetAllPointsOffset(frame.icon, frame, 10)
end
if direction == "next" then
frame.icon:SetTexture("Interface\\AddOns\\pfUI\\img\\right")
elseif direction == "prev" then
frame.icon:SetTexture("Interface\\AddOns\\pfUI\\img\\left")
end
frame:SetScript("OnMouseDown", function()
if frame:IsEnabled() == 1 then
this.icon:SetPoint("CENTER", -1, -1)
end
end)
frame:SetScript("OnMouseUp", function()
this.icon:SetPoint("CENTER", 0, 0)
end)
if not frame.hooked then
frame.hooked = true
local oldEnable = frame.Enable
function frame.Enable(self,btn)
self.icon:SetAlpha(.8)
if oldEnable then oldEnable(self, btn) end
end
local oldDisable = frame.Disable
function frame.Disable(self,btn)
self.icon:SetAlpha(.4)
if oldDisable then oldDisable(self, btn) end
end
end
end
-- [ Skin Rotate Button]
-- Applies pfUI skin to rotation buttons like in character pane:
-- 'button' [frame/string] the button that should be skinned.
function pfUI.api.SkinRotateButton(button)
pfUI.api.CreateBackdrop(button)
local _, class = UnitClass("player")
local color = RAID_CLASS_COLORS[class]
local cr, cg, cb = color.r , color.g, color.b
button:SetWidth(button:GetWidth() - 18)
button:SetHeight(button:GetHeight() - 18)
button:GetNormalTexture():SetTexCoord(0.3, 0.29, 0.3, 0.65, 0.69, 0.29, 0.69, 0.65);
button:GetPushedTexture():SetTexCoord(0.3, 0.29, 0.3, 0.65, 0.69, 0.29, 0.69, 0.65);
button:GetHighlightTexture():SetTexture(cr, cg, cb, .25);
button:GetPushedTexture():SetAllPoints(button:GetNormalTexture());
button:GetHighlightTexture():SetAllPoints(button:GetNormalTexture());
end
-- [ Skin Close Button ]
-- Applies pfUI close skin to buttons and can also be positioned
-- 'button' [frame] the button that should be skinned.
-- 'parentFrame' [frame] will anchor to the top right of the parent.
-- 'offsetX' [integer] offsets the button horizontally
-- 'offsetY' [integer] offsets the button vertically
function pfUI.api.SkinCloseButton(button, parentFrame, offsetX, offsetY)
SkinButton(button)
button:SetWidth(15)
button:SetHeight(15)
if parentFrame then
button:ClearAllPoints()
button:SetPoint("TOPRIGHT", parentFrame, "TOPRIGHT", offsetX, offsetY)
end
button.texture = button:CreateTexture("pfQuestionDialogCloseTex")
button.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\close")
button.texture:ClearAllPoints()
button.texture:SetAllPoints(button)
button.texture:SetVertexColor(1,.25,.25,1)
end
function pfUI.api.SkinScrollbar(frame)
--StripTextures(frame)
local name = frame:GetName()
local up = _G[name .. "ScrollUpButton"]
local down = _G[name .. "ScrollDownButton"]
local thumb = frame:GetThumbTexture()
if not frame.thumb then
thumb:SetTexture(nil)
frame.thumb = frame:CreateTexture(nil, "ARTWORK")
frame.thumb:SetTexture(.8,.8,.8,.8)
frame.thumb:SetPoint("TOPLEFT", thumb, "TOPLEFT", 1, -4)
frame.thumb:SetPoint("BOTTOMRIGHT", thumb, "BOTTOMRIGHT", -1, 4)
end
if not frame.bg then
frame.bg = CreateFrame("Frame", nil, frame)
frame.bg:SetPoint("TOPLEFT", up, "BOTTOMLEFT", 0, -3)
frame.bg:SetPoint("BOTTOMRIGHT", down, "TOPRIGHT", 0, 3)
CreateBackdrop(frame.bg)
end
if up then
up:SetNormalTexture(nil)
up:SetPushedTexture(nil)
up:SetHighlightTexture(nil)
up:SetDisabledTexture(nil)
CreateBackdrop(up)
if not up.icon then
StripTextures(up)
up.icon = up:CreateTexture(nil, "ARTWORK")
up.icon:SetTexture("Interface\\AddOns\\pfUI\\img\\up")
up.icon:SetAlpha(.8)
SetAllPointsOffset(up.icon, up, 3)
end
end
if down then
down:SetNormalTexture(nil)
down:SetPushedTexture(nil)
down:SetHighlightTexture(nil)
down:SetDisabledTexture(nil)
CreateBackdrop(down)
if not down.icon then
StripTextures(down)
down.icon = up:CreateTexture(nil, "ARTWORK")
down.icon:SetTexture("Interface\\AddOns\\pfUI\\img\\down")
down.icon:SetAlpha(.8)
SetAllPointsOffset(down.icon, down, 3)
end
end
end
-- [ CenterFrame ]
-- Clears points and centers a frame
-- 'frame' [frame] the frame that should be centered.
-- 'relativeFrame' [frame] frame that should be used for centering if not use ui parent.
function pfUI.api.CenterFrame(frame, relativeFrame)
frame:ClearAllPoints()
if relativeFrame then
frame:SetPoint("CENTER", relativeFrame, "CENTER", 0, 0)
else
frame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
end
end
-- [ StripTextures ]
-- Strips all textures off a frame.
-- 'frame' [frame] the frame that should be stripped.
function pfUI.api.StripTextures(frame, hide)
for i,v in ipairs({frame:GetRegions()}) do
if v.SetTexture then
v:SetTexture(nil)
if hide then
v:Hide()
end
end
end
end
function pfUI.api.SetAllPointsOffset(frame, parent, offset)
frame:SetPoint("TOPLEFT", parent, "TOPLEFT", offset, -offset)
frame:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", -offset, offset)
end
function pfUI.api.SkinCheckbox(frame)
frame:SetNormalTexture("")
frame:SetPushedTexture("")
frame:SetHighlightTexture("")
frame:SetWidth(18)
frame:SetHeight(18)
CreateBackdrop(frame)
frame.backdrop:SetPoint("TOPLEFT", frame, "TOPLEFT", 4, -4)
frame.backdrop:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -4, 4)
end
function pfUI.api.SkinDropDown(frame)
CreateBackdrop(frame)
frame.backdrop:SetPoint("TOPLEFT", 15, -1)
frame.backdrop:SetPoint("BOTTOMRIGHT", -15, 6)
for i,v in ipairs({frame:GetRegions()}) do
if v.SetTexture then v:Hide() end
end
local button = _G[frame:GetName() .. "Button"]
button:SetNormalTexture(nil)
button:SetPushedTexture(nil)
button:SetHighlightTexture(nil)
button:SetDisabledTexture(nil)
CreateBackdrop(button)
button.backdrop:ClearAllPoints()
button.backdrop:SetWidth(18)
button.backdrop:SetHeight(18)
button.backdrop:SetPoint("RIGHT", button, "RIGHT", -2, 0)
if not button.icon then
StripTextures(button)
button.icon = button:CreateTexture(nil, "ARTWORK")
button.icon:SetTexture("Interface\\AddOns\\pfUI\\img\\down")
button.icon:SetAlpha(.8)
SetAllPointsOffset(button.icon, button.backdrop, 5)
end
if not cr or not cg or not cb then
_, class = UnitClass("player")
local color = RAID_CLASS_COLORS[class]
cr, cg, cb = color.r , color.g, color.b
end
local funce = button:GetScript("OnEnter")
button:SetScript("OnEnter", function()
if funce then funce() end
this.backdrop:SetBackdropBorderColor(cr,cg,cb,1)
end)
local funcl = button:GetScript("OnLeave")
button:SetScript("OnLeave", function()
if funcl then funcl() end
this.backdrop:SetBackdropBorderColor(pfUI.api.GetStringColor(pfUI_config.appearance.border.color))
end)
local funcc = button:GetScript("OnClick")
button:SetScript("OnClick", function()
if funcc then funcc() end
UIDropDownMenu_JustifyText("RIGHT", this:GetParent())
DropDownList1:SetPoint("TOPLEFT", this:GetParent().backdrop, "BOTTOMLEFT", 0, -4)
DropDownList1:SetPoint("TOPRIGHT", this:GetParent().backdrop, "BOTTOMRIGHT", 0, -4)
CreateBackdrop(DropDownList1Backdrop, nil, true, .8)
DropDownList1.maxWidth = this:GetWidth()
for i=1, UIDROPDOWNMENU_MAXBUTTONS do
_G["DropDownList1Button" .. i]:SetWidth(this:GetWidth())
end
end)
end
function pfUI.api.SkinTab(frame, fixed)
frame:SetHeight(20)
StripTextures(frame)
CreateBackdrop(frame)
if not fixed then
frame:SetScript("OnShow", function()
this:SetWidth(this:GetTextWidth() + 20)
if this.GetFontString and this:GetFontString() then
this:GetFontString():SetPoint("CENTER", 0, 0)
end
end)
end
end
-- [ GetCloseButton ]
-- Get the close button from a frame.
-- 'frame' [frame] the frame that should be searched for the button.
function pfUI.api.GetCloseButton(frame)
for i,v in ipairs({frame:GetChildren()}) do
if v.GetObjectType and v:GetObjectType() == "Button" and v.GetNormalTexture and v:GetNormalTexture() then
if v:GetNormalTexture().GetTexture and v:GetNormalTexture():GetTexture() == "Interface\\Buttons\\UI-Panel-MinimizeButton-Up" then
return v
end
end
end
return nil
end
-- [ Question Dialog ]
-- Creates a pfUI user dialog popup:
-- 'text' [string] text that will be displayed.
-- 'yes' [function] function that is triggered on 'Okay' button.
-- 'no' [function] function that is triggered on 'Cancel' button.
-- 'editbox' [bool] if set, a inputfield will be shown. it can be.
-- accessed with "GetParent().input".
function pfUI.api.CreateQuestionDialog(text, yes, no, editbox)
-- do not allow multiple instances of question dialogs
if pfQuestionDialog and pfQuestionDialog:IsShown() then
pfQuestionDialog:Hide()
pfQuestionDialog = nil
return
end
local yes, no = yes, no
local yescap, nocap = YES, NO
if yes and type(yes) == "table" then
yescap = yes[1]
yes = yes[2]
end
if no and type(no) == "table" then
nocap = no[1]
no = no[2]
end
if not text then text = "Are you sure?" end
local border = tonumber(pfUI_config.appearance.border.default)
local padding = 15
-- frame
local question = CreateFrame("Frame", "pfQuestionDialog", UIParent)
question:ClearAllPoints()
question:SetPoint("CENTER", 0, 0)
question:SetFrameStrata("TOOLTIP")
question:SetMovable(true)
question:EnableMouse(true)
question:SetScript("OnMouseDown",function()
this:StartMoving()
end)
question:SetScript("OnMouseUp",function()
this:StopMovingOrSizing()
end)
pfUI.api.CreateBackdrop(question, nil, nil, .85)
-- text
question.text = question:CreateFontString("Status", "LOW", "GameFontNormal")
question.text:SetFontObject(GameFontWhite)
question.text:SetPoint("TOPLEFT", question, "TOPLEFT", padding, -padding)
question.text:SetPoint("TOPRIGHT", question, "TOPRIGHT", -padding, -padding)
question.text:SetText(text)
-- editbox
if editbox then
question.input = CreateFrame("EditBox", "pfQuestionDialogEdit", question)
pfUI.api.CreateBackdrop(question.input)
question.input:SetTextColor(.2,1,.8,1)
question.input:SetJustifyH("CENTER")
question.input:SetAutoFocus(false)
question.input:SetPoint("TOPLEFT", question.text, "BOTTOMLEFT", border, -padding)
question.input:SetPoint("TOPRIGHT", question.text, "BOTTOMRIGHT", -border, -padding)
question.input:SetHeight(20)
question.input:SetFontObject(GameFontNormal)
question.input:SetScript("OnEscapePressed", function() this:ClearFocus() end)
end
-- buttons
question.yes = CreateFrame("Button", "pfQuestionDialogYes", question, "UIPanelButtonTemplate")
pfUI.api.SkinButton(question.yes)
question.yes:SetWidth(100)
question.yes:SetHeight(22)
question.yes:SetText(yescap)
question.yes:SetScript("OnClick", function()
if yes then yes() end
this:GetParent():Hide()
end)
if question.input then
question.yes:SetPoint("TOPRIGHT", question.input, "BOTTOM", -3*border, -padding)
else
question.yes:SetPoint("TOPRIGHT", question.text, "BOTTOM", -3*border, -padding)
end
question.no = CreateFrame("Button", "pfQuestionDialogNo", question, "UIPanelButtonTemplate")
pfUI.api.SkinButton(question.no)
question.no:SetWidth(100)
question.no:SetHeight(22)
question.no:SetText(nocap)
question.no:SetScript("OnClick", function()
if no then no() end
this:GetParent():Hide()
end)
if question.input then
question.no:SetPoint("TOPLEFT", question.input, "BOTTOM", 3*border, -padding)
else
question.no:SetPoint("TOPLEFT", question.text, "BOTTOM", 3*border, -padding)
end
question.close = CreateFrame("Button", "pfQuestionDialogClose", question)
question.close:SetPoint("TOPRIGHT", -border, -border)
pfUI.api.CreateBackdrop(question.close)
question.close:SetHeight(10)
question.close:SetWidth(10)
question.close.texture = question.close:CreateTexture("pfQuestionDialogCloseTex")
question.close.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\close")
question.close.texture:ClearAllPoints()
question.close.texture:SetAllPoints(question.close)
question.close.texture:SetVertexColor(1,.25,.25,1)
question.close:SetScript("OnEnter", function ()
this.backdrop:SetBackdropBorderColor(1,.25,.25,1)
end)
question.close:SetScript("OnLeave", function ()
pfUI.api.CreateBackdrop(this)
end)
question.close:SetScript("OnClick", function()
this:GetParent():Hide()
end)
-- resize window
local textspace = question.text:GetHeight() + padding
local inputspace = 0
if question.input then inputspace = question.input:GetHeight() + padding end
local buttonspace = question.no:GetHeight() + padding
question:SetHeight(textspace + inputspace + buttonspace + padding)
local width = 200
if question.text:GetStringWidth() > 200 then width = question.text:GetStringWidth() end
question:SetWidth( width + 2*padding)
end
-- [ Question Dialog ]
-- Creates a pfUI infobox popup window:
-- 'text' [string] text that will be displayed.
-- 'time' [number] time in seconds till the popup will be faded
-- 'parent' [frame] frame which will be used as parent for the dialog (defaults to UIParent)
-- 'height' [number] manual height of the popup (defaults to 100)
function pfUI.api.CreateInfoBox(text, time, parent, height)
if not text then return end
if not time then time = 5 end
if not parent then parent = UIParent end
if not height then height = 100 end
local infobox = pfInfoBox
if not infobox then
infobox = CreateFrame("Button", "pfInfoBox", UIParent)
infobox:Hide()
infobox:SetScript("OnUpdate", function()
local time = infobox.lastshow + infobox.duration - GetTime()
infobox.timeout:SetValue(time)
if GetTime() > infobox.lastshow + infobox.duration then
infobox:SetAlpha(infobox:GetAlpha()-0.05)
if infobox:GetAlpha() <= 0.1 then
infobox:Hide()
infobox:SetAlpha(1)
end
elseif MouseIsOver(this) then
this:SetAlpha(max(0.4, this:GetAlpha() - .1))
else
this:SetAlpha(min(1, this:GetAlpha() + .1))
end
end)
infobox:SetScript("OnClick", function()
this:Hide()
end)
infobox.text = infobox:CreateFontString("Status", "HIGH", "GameFontNormal")
infobox.text:ClearAllPoints()
infobox.text:SetFontObject(GameFontWhite)
infobox.timeout = CreateFrame("StatusBar", nil, infobox)
infobox.timeout:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar")
infobox.timeout:SetStatusBarColor(.3,1,.8,1)
infobox:ClearAllPoints()
infobox.text:SetAllPoints(infobox)
infobox.text:SetFont(pfUI.font_default, 14, "OUTLINE")
pfUI.api.CreateBackdrop(infobox)
infobox:SetPoint("TOP", 0, -25)
infobox.timeout:ClearAllPoints()
infobox.timeout:SetPoint("TOPLEFT", infobox, "TOPLEFT", 3, -3)
infobox.timeout:SetPoint("TOPRIGHT", infobox, "TOPRIGHT", -3, 3)
infobox.timeout:SetHeight(2)
end
infobox.text:SetText(text)
infobox.timeout:SetMinMaxValues(0, time)
infobox.timeout:SetValue(time)
infobox.duration = time
infobox.lastshow = GetTime()
infobox:SetWidth(infobox.text:GetStringWidth() + 50)
infobox:SetParent(parent)
infobox:SetHeight(height)
infobox:SetFrameStrata("FULLSCREEN_DIALOG")
infobox:Show()
end
+1862
View File
File diff suppressed because it is too large Load Diff