Files
coa-details/framework/framework.lua
T
terciob19 c29e9875de - fixed issue with panic mode where sometimes his effects isn't triggered.
- added new small tutorial bubles for common tasks.
- tutorials now are account wide and not trigger on new characters.
- small improvements on details framework.
- added new hook type: HOOK_BUFF, triggered with buff or debuff parser.
- new skin: simple gray.
- added a minimap button and a button on addons interface panel.
new Api: instance:LockInstance (boolean)
2014-01-02 11:21:22 -02:00

137 lines
4.2 KiB
Lua

--> details main objects
local _detalhes = _G._detalhes
local gump = _detalhes.gump
local _type = type
local _unpack = unpack
local _
gump.LabelNameCounter = 1
gump.PictureNameCounter = 1
gump.debug = false
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> points
function gump:CheckPoints (v1, v2, v3, v4, v5, object)
--bg_esq:SetPoint ("topleft", DmgRankFrame, 10, -215)
if (not v1 and not v2) then
return "topleft", object.widget:GetParent(), "topleft", 0, 0
end
if (_type (v1) == "string") then
local frameGlobal = _G [v1]
if (frameGlobal and frameGlobal.GetObjectType) then
return gump:CheckPoints (frameGlobal, v2, v3, v4, v5, object)
end
elseif (_type (v2) == "string") then
local frameGlobal = _G [v2]
if (frameGlobal and frameGlobal.GetObjectType) then
return gump:CheckPoints (v1, frameGlobal, v3, v4, v5, object)
end
end
if (_type (v1) == "string" and _type (v2) == "table") then --> :setpoint ("left", frame, _, _, _)
if (not v3 or _type (v3) == "number") then --> :setpoint ("left", frame, 10, 10)
v1, v2, v3, v4, v5 = v1, v2, v1, v3, v4
--else
--> :setpoint ("left", frame, "left", 10, 10)
end
elseif (_type (v1) == "string" and _type (v2) == "number") then --> :setpoint ("topleft", x, y)
v1, v2, v3, v4, v5 = v1, object.widget:GetParent(), v1, v2, v3
elseif (_type (v1) == "number") then --> :setpoint (x, y)
v1, v2, v3, v4, v5 = "topleft", object.widget:GetParent(), "topleft", v1, v2
elseif (_type (v1) == "table") then --> :setpoint (frame, x, y)
v1, v2, v3, v4, v5 = "topleft", v1, "topleft", v2, v3
end
if (not v2) then
v2 = object.widget:GetParent()
elseif (v2.dframework) then
v2 = v2.widget
end
return v1 or "topleft", v2, v3 or "topleft", v4 or 0, v5 or 0
end
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> color scheme
function gump:NewColor (_colorname, _colortable, _green, _blue, _alpha)
if (_type (_colorname) ~= "string") then
return _detalhes:NewError ("color name must be a string.")
end
if (gump.alias_text_colors [_colorname]) then
return _detalhes:NewError (_colorname .. " already exists.")
end
if (_type (_colortable) == "table") then
if (_colortable[1] and _colortable[2] and _colortable[3]) then
_colortable[4] = _colortable[4] or 1
gump.alias_text_colors [_colorname] = _colortable
else
return _detalhes:NewError ("invalid color table.")
end
elseif (_colortable and _green and _blue) then
_alpha = _alpha or 1
gump.alias_text_colors [_colorname] = {_colortable, _green, _blue, _alpha}
else
return _detalhes:NewError ("invalid parameter.")
end
return true
end
function gump:IsHtmlColor (color)
return gump.alias_text_colors [color]
end
local tn = tonumber
function gump:ParseColors (_arg1, _arg2, _arg3, _arg4)
if (_type (_arg1) == "table") then
_arg1, _arg2, _arg3, _arg4 = _unpack (_arg1)
elseif (_type (_arg1) == "string") then
if (string.find (_arg1, "#")) then
_arg1 = _arg1:gsub ("#","")
if (string.len (_arg1) == 8) then --alpha
_arg1, _arg2, _arg3, _arg4 = tn ("0x" .. _arg1:sub (3, 4))/255, tn ("0x" .. _arg1:sub (5, 6))/255, tn ("0x" .. _arg1:sub (7, 8))/255, tn ("0x" .. _arg1:sub (1, 2))/255
else
_arg1, _arg2, _arg3, _arg4 = tn ("0x" .. _arg1:sub (1, 2))/255, tn ("0x" .. _arg1:sub (3, 4))/255, tn ("0x" .. _arg1:sub (5, 6))/255, 1
end
else
local color = gump.alias_text_colors [_arg1]
if (color) then
_arg1, _arg2, _arg3, _arg4 = _unpack (color)
else
_arg1, _arg2, _arg3, _arg4 = _unpack (gump.alias_text_colors.none)
end
end
end
if (not _arg1) then
_arg1 = 1
end
if (not _arg2) then
_arg2 = 1
end
if (not _arg3) then
_arg3 = 1
end
if (not _arg4) then
_arg4 = 1
end
return _arg1, _arg2, _arg3, _arg4
end