api: use C for config

This commit is contained in:
shagu
2017-02-26 20:42:08 +01:00
parent e20e4ef385
commit 1766dd4ba0
30 changed files with 603 additions and 603 deletions
+16 -16
View File
@@ -1,13 +1,13 @@
pfUI:RegisterModule("pet", function ()
-- do not go further on disabled UFs
if pfUI_config.unitframes.disable == "1" then return end
if C.unitframes.disable == "1" then return end
local default_border = pfUI_config.appearance.border.default
if pfUI_config.appearance.border.unitframes ~= "-1" then
default_border = pfUI_config.appearance.border.unitframes
local default_border = C.appearance.border.default
if C.appearance.border.unitframes ~= "-1" then
default_border = C.appearance.border.unitframes
end
local spacing = pfUI_config.unitframes.pet.pspace
local spacing = C.unitframes.pet.pspace
pfUI.uf.pet = CreateFrame("Button","pfPet",UIParent)
pfUI.uf.pet.label = "pet"
@@ -86,14 +86,14 @@ pfUI:RegisterModule("pet", function ()
end
local r, g, b = .2, .2, .2
if pfUI_config.unitframes.pastel == "1" then
if C.unitframes.pastel == "1" then
r, g, b = (color.r + .5) * .5, (color.g + .5) * .5, (color.b + .5) * .5
else
r, g, b = color.r, color.g, color.b
end
if pfUI_config.unitframes.custom == "1" then
local cr, cg, cb, ca = pfUI.api.strsplit(",", pfUI_config.unitframes.customcolor)
if C.unitframes.custom == "1" then
local cr, cg, cb, ca = pfUI.api.strsplit(",", C.unitframes.customcolor)
pfUI.uf.pet.hp.bar:SetStatusBarColor(tonumber(cr), tonumber(cg), tonumber(cb), hp / hpmax / 4 + .75)
else
pfUI.uf.pet.hp.bar:SetStatusBarColor(r, g, b, hp / hpmax / 4 + .75)
@@ -118,9 +118,9 @@ pfUI:RegisterModule("pet", function ()
local hpDiff = abs(hpReal - hpDisplay)
if hpDisplay < hpReal then
pfUI.uf.pet.hp.bar:SetValue(hpDisplay + ceil(hpDiff / pfUI_config.unitframes.animation_speed))
pfUI.uf.pet.hp.bar:SetValue(hpDisplay + ceil(hpDiff / C.unitframes.animation_speed))
elseif hpDisplay > hpReal then
pfUI.uf.pet.hp.bar:SetValue(hpDisplay - ceil(hpDiff / pfUI_config.unitframes.animation_speed))
pfUI.uf.pet.hp.bar:SetValue(hpDisplay - ceil(hpDiff / C.unitframes.animation_speed))
else
pfUI.uf.pet.hp.bar:SetValue(hpReal)
end
@@ -131,9 +131,9 @@ pfUI:RegisterModule("pet", function ()
local powerDiff = abs(powerReal - powerDisplay)
if powerDisplay < powerReal then
pfUI.uf.pet.power.bar:SetValue(powerDisplay + ceil(powerDiff / pfUI_config.unitframes.animation_speed))
pfUI.uf.pet.power.bar:SetValue(powerDisplay + ceil(powerDiff / C.unitframes.animation_speed))
elseif powerDisplay > powerReal then
pfUI.uf.pet.power.bar:SetValue(powerDisplay - ceil(powerDiff / pfUI_config.unitframes.animation_speed))
pfUI.uf.pet.power.bar:SetValue(powerDisplay - ceil(powerDiff / C.unitframes.animation_speed))
else
pfUI.uf.pet.power.bar:SetValue(powerReal)
end
@@ -172,10 +172,10 @@ pfUI:RegisterModule("pet", function ()
pfUI.uf.pet.power.bar:SetAllPoints(pfUI.uf.pet.power)
pfUI.uf.pet.power.bar:SetMinMaxValues(0, 100)
pfUI.uf:CreatePortrait(pfUI.uf.pet, pfUI_config.unitframes.pet.portrait, spacing)
pfUI.uf:CreatePortrait(pfUI.uf.pet, C.unitframes.pet.portrait, spacing)
pfUI.uf.pet.hp.text = pfUI.uf.pet.hp.bar:CreateFontString("Status", "OVERLAY", "GameFontNormal")
pfUI.uf.pet.hp.text:SetFont(pfUI.font_square, pfUI_config.global.font_size - 2, "OUTLINE")
pfUI.uf.pet.hp.text:SetFont(pfUI.font_square, C.global.font_size - 2, "OUTLINE")
pfUI.uf.pet.hp.text:ClearAllPoints()
pfUI.uf.pet.hp.text:SetAllPoints(pfUI.uf.pet.hp.bar)
pfUI.uf.pet.hp.text:SetPoint("CENTER", 0, 0)
@@ -201,7 +201,7 @@ pfUI:RegisterModule("pet", function ()
pfUI.uf.pet.buff.buffs[i] = CreateFrame("Button", "pfUITargetBuff" .. i, pfUI.uf.pet)
pfUI.uf.pet.buff.buffs[i].stacks = pfUI.uf.pet.buff.buffs[i]:CreateFontString(nil, "OVERLAY", pfUI.uf.pet.buff.buffs[i])
pfUI.uf.pet.buff.buffs[i].stacks:SetFont(pfUI.font_square, pfUI_config.global.font_size, "OUTLINE")
pfUI.uf.pet.buff.buffs[i].stacks:SetFont(pfUI.font_square, C.global.font_size, "OUTLINE")
pfUI.uf.pet.buff.buffs[i].stacks:SetPoint("BOTTOMRIGHT", pfUI.uf.pet.buff.buffs[i], 2, -2)
pfUI.uf.pet.buff.buffs[i].stacks:SetJustifyH("LEFT")
pfUI.uf.pet.buff.buffs[i].stacks:SetShadowColor(0, 0, 0)
@@ -264,7 +264,7 @@ pfUI:RegisterModule("pet", function ()
pfUI.uf.pet.debuff.debuffs[i] = CreateFrame("Button", "pfUITargetDebuff" .. i, pfUI.uf.pet)
pfUI.uf.pet.debuff.debuffs[i].stacks = pfUI.uf.pet.debuff.debuffs[i]:CreateFontString(nil, "OVERLAY", pfUI.uf.pet.debuff.debuffs[i])
pfUI.uf.pet.debuff.debuffs[i].stacks:SetFont(pfUI.font_square, pfUI_config.global.font_size, "OUTLINE")
pfUI.uf.pet.debuff.debuffs[i].stacks:SetFont(pfUI.font_square, C.global.font_size, "OUTLINE")
pfUI.uf.pet.debuff.debuffs[i].stacks:SetPoint("BOTTOMRIGHT", pfUI.uf.pet.debuff.debuffs[i], 2, -2)
pfUI.uf.pet.debuff.debuffs[i].stacks:SetJustifyH("LEFT")
pfUI.uf.pet.debuff.debuffs[i].stacks:SetShadowColor(0, 0, 0)