Files
pfUI/pfUI.lua
T
2016-06-19 00:01:11 +02:00

129 lines
2.8 KiB
Lua

SLASH_RELOAD1 = '/rl';
function SlashCmdList.RELOAD(msg, editbox)
ReloadUI()
end
SLASH_PFUI1 = '/pfui';
function SlashCmdList.PFUI(msg, editbox)
if pfUI.gui:IsShown() then
pfUI.gui:Hide()
else
pfUI.gui:Show()
end
end
pfUI = CreateFrame("Frame",nil,UIParent)
pfUI:RegisterEvent("ADDON_LOADED")
pfUI:SetScript("OnEvent", function()
if arg1 == "pfUI" then
pfUI:Debug("pfUI module loader:")
for i,m in pairs(this.modules) do
if not pfUI[m] then
pfUI.module[m]()
pfUI:Debug("=> " .. m)
end
end
end
end)
pfUI.module = {}
pfUI.modules = {}
function pfUI:RegisterModule(n, f)
pfUI.module[n] = f
table.insert(pfUI.modules, n)
end
function pfUI:Debug(msg)
if pfUI_config.debug == 1 then
DEFAULT_CHAT_FRAME:AddMessage(msg)
end
end
pfUI.backdrop = {
bgFile = "Interface\\AddOns\\pfUI\\img\\bg", tile = true, tileSize = 8,
edgeFile = "Interface\\AddOns\\pfUI\\img\\border", edgeSize = 8,
insets = {left = 0, right = 0, top = 0, bottom = 0},
}
pfUI.backdrop_gitter = {
bgFile = "Interface\\AddOns\\pfUI\\img\\gitter", tile = true, tileSize = 8,
}
pfUI.backdrop_col = {
bgFile = "Interface\\AddOns\\pfUI\\img\\bg", tile = true, tileSize = 8,
edgeFile = "Interface\\AddOns\\pfUI\\img\\border_col", edgeSize = 8,
insets = {left = 0, right = 0, top = 0, bottom = 0},
}
pfUI.backdrop_underline = {
edgeFile = "Interface\\AddOns\\pfUI\\img\\underline", edgeSize = 8,
insets = {left = 0, right = 0, top = 0, bottom = 0},
}
pfUI_playerDB = {}
pfUI_config = {
debug = 1,
["unitframes"] = {
animation_speed = 5,
portrait = 1,
buff_size = "22",
debuff_size = "22",
layout = "default",
["player"] = {
width = 200,
height = 50,
pheight = 10,
},
["target"] = {
width = 200,
height = 50,
pheight = 10,
},
},
["bars"] = {
icon_size = "22",
border = 2,
},
["panel"] = {
["left"] = {
left = "guild",
center = "durability",
right = "friends",
},
["right"] = {
left = "fps",
center = "time",
right = "gold",
},
["other"] = {
minimap = "zone",
},
},
["tooltip"] = {
position = "bottom"
},
["position"] = {
}
}
pfUI.utils = CreateFrame("Frame",nil,UIParent)
function pfUI.utils:loadPosition(frame)
if pfUI_config["position"][frame:GetName()] then
frame:ClearAllPoints()
frame:SetPoint("TOPLEFT", pfUI_config["position"][frame:GetName()].xpos, pfUI_config["position"][frame:GetName()].ypos)
end
end
message = function (msg)
DEFAULT_CHAT_FRAME:AddMessage("|cffcccc33INFO: |cffffff55"..msg)
end
ScriptErrors:SetScript("OnShow", function(msg)
DEFAULT_CHAT_FRAME:AddMessage("|cffcc3333ERROR: |cffff5555"..ScriptErrors_Message:GetText())
ScriptErrors:Hide()
end)
pfUI.uf = CreateFrame("Frame",nil,UIParent)