diff --git a/Bindings.xml b/Bindings.xml
new file mode 100644
index 00000000..2b9adda8
--- /dev/null
+++ b/Bindings.xml
@@ -0,0 +1,11 @@
+
+
+ _detalhes.tabela_historico:resetar()
+
+
+ DetailsKeyBindScrollDown()
+
+
+ DetailsKeyBindScrollUp()
+
+
\ No newline at end of file
diff --git a/Details.toc b/Details.toc
index 9c0fdde2..bde3de3b 100644
--- a/Details.toc
+++ b/Details.toc
@@ -12,6 +12,7 @@ locales\Details-ptBR.lua
locales\Details-enUS.lua
boot.lua
+indent.lua
core\util.lua
functions\profiles.lua
diff --git a/Libs/NickTag-1.0/NickTag-1.0.lua b/Libs/NickTag-1.0/NickTag-1.0.lua
index 4ef36557..f2334d80 100644
--- a/Libs/NickTag-1.0/NickTag-1.0.lua
+++ b/Libs/NickTag-1.0/NickTag-1.0.lua
@@ -791,7 +791,7 @@ end
elseif (not _table) then
return "", {0, 1, 0, 1}
end
- return _table [CONST_INDEX_AVATAR_PATH] or default "", _table [CONST_INDEX_AVATAR_TEXCOORD] or {0, 1, 0, 1}
+ return _table [CONST_INDEX_AVATAR_PATH] or default or "", _table [CONST_INDEX_AVATAR_TEXCOORD] or {0, 1, 0, 1}
end
end
diff --git a/Libs/libs.xml b/Libs/libs.xml
index abeb96bf..5bc88c23 100644
--- a/Libs/libs.xml
+++ b/Libs/libs.xml
@@ -10,7 +10,6 @@
-
diff --git a/boot.lua b/boot.lua
index 564e02cb..6a279bf6 100644
--- a/boot.lua
+++ b/boot.lua
@@ -5,10 +5,10 @@
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> global name declaration
-
+
_ = nil
_detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0", "LibHotCorners")
- _detalhes.userversion = "v1.13.1"
+ _detalhes.userversion = "v1.13.5" --options iniciando junto
_detalhes.version = "Alpha 017"
_detalhes.realversion = 17
@@ -34,8 +34,6 @@ do
_detalhes.parser_frame:Hide()
--> armazena os escudos - Shields information for absorbs
_detalhes.escudos = {}
- --> armazena os overwirtes de spells pelo usuario
- _detalhes.SpellOverwriteUser = {}
--> armazena as funções dos frames - Frames functions
_detalhes.gump = {}
--> armazena as funções para inicialização dos dados - Metatable functions
@@ -260,6 +258,13 @@ do
_detalhes:Msg ("|cffb0b0b0you can always reset the addon running the command '/details reinstall' if it does fail to load after being updated.|r")
end
_detalhes:ScheduleTimer ("WelcomeMsgLogon", 8)
-
+
+ --> key binds
+ --> header
+ _G ["BINDING_HEADER_Details"] = "Details!"
+ --> keys
+ _G ["BINDING_NAME_DETAILS_RESET_SEGMENTS"] = "Reset Segments"
+ _G ["BINDING_NAME_DETAILS_SCROLL_UP"] = "Scroll Up All Windows"
+ _G ["BINDING_NAME_DETAILS_SCROLL_DOWN"] = "Scroll Down All Windows"
end
diff --git a/classes/classe_combate.lua b/classes/classe_combate.lua
index af2a9690..1f1d726f 100644
--- a/classes/classe_combate.lua
+++ b/classes/classe_combate.lua
@@ -89,7 +89,7 @@ function combate:NovaTabela (iniciada, _tabela_overall, combatId, ...)
esta_tabela.frags_need_refresh = false
--> time data container
- esta_tabela.TimeData = _detalhes.timeContainer:CreateTimeTable()
+ esta_tabela.TimeData = _detalhes:TimeDataCreateCombatTables()
--> Skill cache (not used)
esta_tabela.CombatSkillCache = {}
@@ -165,10 +165,10 @@ function combate:NovaTabela (iniciada, _tabela_overall, combatId, ...)
return esta_tabela
end
-function combate:GetTimeData (dataType)
- --if (not dataType) then
- return self.TimeData
- --end
+function combate:GetTimeData (name)
+
+ return self.TimeData [name]
+
end
function combate:TravarTempos()
@@ -236,6 +236,8 @@ function combate:GetCombatTime()
end
end
+--[[global]] DETAILS_TOTALS_ONLYGROUP = true
+
function combate:GetTotal (attribute, subAttribute, onlyGroup)
if (attribute == 1 or attribute == 2) then
if (onlyGroup) then
diff --git a/classes/classe_instancia.lua b/classes/classe_instancia.lua
index 6066ab19..ffcb63ce 100644
--- a/classes/classe_instancia.lua
+++ b/classes/classe_instancia.lua
@@ -61,7 +61,16 @@ local segmentos = _detalhes.segmentos
------------------------------------------------------------------------------------------------------------------------
---> chama a função para ser executada em todas as instâncias
+--> API: call a function to all enabled instances
+function _detalhes:InstanceCall (funcao, ...)
+ for index, instance in _ipairs (_detalhes.tabela_instancias) do
+ if (instance:IsAtiva()) then --> only enabled
+ funcao (instance, ...)
+ end
+ end
+end
+
+--> chama a função para ser executada em todas as instâncias (internal)
function _detalhes:InstanciaCallFunction (funcao, ...)
for index, instancia in _ipairs (_detalhes.tabela_instancias) do
if (instancia:IsAtiva()) then --> só reabre se ela estiver ativa
@@ -70,7 +79,7 @@ function _detalhes:InstanciaCallFunction (funcao, ...)
end
end
---> chama a função para ser executada em todas as instâncias
+--> chama a função para ser executada em todas as instâncias (internal)
function _detalhes:InstanciaCallFunctionOffline (funcao, ...)
for index, instancia in _ipairs (_detalhes.tabela_instancias) do
funcao (_, instancia, ...)
@@ -330,6 +339,12 @@ end
end
end
+ self:SetCombatAlpha (nil, nil, true)
+
+ --if (self.hide_out_of_combat and not UnitAffectingCombat ("player")) then
+ -- self:SetWindowAlphaForCombat (true, true)
+ --end
+
if (not temp and not _detalhes.initializing) then
_detalhes:SendEvent ("DETAILS_INSTANCE_OPEN", nil, self)
end
diff --git a/classes/classe_instancia_include.lua b/classes/classe_instancia_include.lua
index f3e48b65..1d99ca29 100644
--- a/classes/classe_instancia_include.lua
+++ b/classes/classe_instancia_include.lua
@@ -54,6 +54,8 @@ _detalhes.instance_defaults = {
hide_icon = false,
--anchor side of main window toolbar (1 = top 2 = bottom)
toolbar_side = 1,
+ --micro displays side
+ micro_displays_side = 2,
--stretch button anchor side (1 = top 2 = bottom)
stretch_button_side = 1,
--where plugins icon will be placed on main window toolbar (1 = left 2 = right)
@@ -139,6 +141,9 @@ _detalhes.instance_defaults = {
color_buttons = {1, 1, 1, 1},
--hide in combat
hide_in_combat = false,
+ hide_out_of_combat = false,
+
+ hide_in_combat_type = 1,
hide_in_combat_alpha = 0,
--strata
strata = "LOW",
diff --git a/core/control.lua b/core/control.lua
index 8e95a060..23dcf203 100644
--- a/core/control.lua
+++ b/core/control.lua
@@ -323,9 +323,8 @@
--> hide / alpha in combat
for index, instancia in ipairs (_detalhes.tabela_instancias) do
if (instancia.ativa) then
- if (instancia.hide_in_combat) then
- instancia:SetWindowAlphaForCombat (true)
- end
+
+ instancia:SetCombatAlpha (nil, nil, true)
if (instancia.auto_switch_to) then
--salva o estado atual
@@ -572,9 +571,9 @@
--> hide / alpha in combat
for index, instancia in ipairs (_detalhes.tabela_instancias) do
if (instancia.ativa) then
- if (instancia.hide_in_combat) then
- instancia:SetWindowAlphaForCombat (false)
- end
+
+ instancia:SetCombatAlpha (nil, nil, true)
+
if (instancia.auto_switch_to_old) then
instancia:SwitchBack()
end
diff --git a/core/parser.lua b/core/parser.lua
index 224b02f4..e2c3cc14 100644
--- a/core/parser.lua
+++ b/core/parser.lua
@@ -2740,6 +2740,7 @@
_detalhes:IniciarColetaDeLixo (true)
_detalhes:WipePets()
_detalhes:SchedulePetUpdate (1)
+ _detalhes:InstanceCall (_detalhes.SetCombatAlpha, nil, nil, true)
end
else
_detalhes.in_group = IsInGroup() or IsInRaid()
@@ -2749,6 +2750,7 @@
_detalhes:WipePets()
_detalhes:SchedulePetUpdate (1)
_table_wipe (_detalhes.details_users)
+ _detalhes:InstanceCall (_detalhes.SetCombatAlpha, nil, nil, true)
else
_detalhes:SchedulePetUpdate (2)
_detalhes:CheckDetailsUsers()
@@ -2815,6 +2817,7 @@
_detalhes.popup = _G.GameCooltip
end
+ _detalhes.in_group = IsInGroup() or IsInRaid()
--_detalhes:ApplyBasicKeys()
@@ -2822,7 +2825,7 @@
--> write into details object all basic keys
_detalhes:ApplyBasicKeys()
--> check if is first run
- _detalhes:IsFirstRun()
+ _detalhes:LoadGlobalAndCharacterData()
--> load all the saved combats
_detalhes:LoadCombatTables()
--> load the profiles
diff --git a/core/plugins_statusbar.lua b/core/plugins_statusbar.lua
index 7d25fe3b..d750bc22 100644
--- a/core/plugins_statusbar.lua
+++ b/core/plugins_statusbar.lua
@@ -78,7 +78,14 @@
--> functions to set the three statusbar places: left, center and right
function _detalhes.StatusBar:SetCenterPlugin (instance, childObject, fromStartup)
childObject.frame:Show()
- childObject.frame:SetPoint ("center", instance.baseframe.rodape.StatusBarCenterAnchor, "center")
+ childObject.frame:ClearAllPoints()
+
+ if (instance.micro_displays_side == 2) then --> default - bottom
+ childObject.frame:SetPoint ("center", instance.baseframe.rodape.StatusBarCenterAnchor, "center")
+ elseif (instance.micro_displays_side == 1) then --> top side
+ childObject.frame:SetPoint ("center", instance.baseframe.cabecalho.StatusBarCenterAnchor, "center")
+ end
+
_detalhes.StatusBar:AlignPluginText (childObject, 2)
instance.StatusBar.center = childObject
@@ -102,7 +109,14 @@
end
childObject.frame:Show()
- childObject.frame:SetPoint ("left", instance.baseframe.rodape.StatusBarLeftAnchor, "left")
+ childObject.frame:ClearAllPoints()
+
+ if (instance.micro_displays_side == 2) then --> default - bottom
+ childObject.frame:SetPoint ("left", instance.baseframe.rodape.StatusBarLeftAnchor, "left")
+ elseif (instance.micro_displays_side == 1) then --> top side
+ childObject.frame:SetPoint ("left", instance.baseframe.cabecalho.StatusBarLeftAnchor, "left")
+ end
+
_detalhes.StatusBar:AlignPluginText (childObject, 1)
instance.StatusBar.left = childObject
@@ -121,7 +135,14 @@
function _detalhes.StatusBar:SetRightPlugin (instance, childObject, fromStartup)
childObject.frame:Show()
- childObject.frame:SetPoint ("right", instance.baseframe.rodape.direita, "right", -20, 10)
+ childObject.frame:ClearAllPoints()
+
+ if (instance.micro_displays_side == 2) then --> default - bottom
+ childObject.frame:SetPoint ("right", instance.baseframe.rodape.direita, "right", -20, 10)
+ elseif (instance.micro_displays_side == 1) then --> top side
+ childObject.frame:SetPoint ("right", instance.baseframe.cabecalho.StatusBarRightAnchor, "right")
+ end
+
_detalhes.StatusBar:AlignPluginText (childObject, 3)
instance.StatusBar.right = childObject
diff --git a/core/util.lua b/core/util.lua
index 2fee711e..8c32a4a5 100644
--- a/core/util.lua
+++ b/core/util.lua
@@ -258,7 +258,7 @@
--> is in combat yet?
function _detalhes:EstaEmCombate()
- _detalhes.tabela_vigente.TimeData:Record()
+ _detalhes:TimeDataTick()
if (_detalhes.zone_type == "pvp" or _InCombatLockdown()) then
return true
diff --git a/framework/button.lua b/framework/button.lua
index d61c7dff..0b3e3896 100644
--- a/framework/button.lua
+++ b/framework/button.lua
@@ -283,10 +283,10 @@ local ButtonMetaFunctions = {}
_rawset (self, "func", cleanfunction)
end
- if (param1) then
+ if (param1 ~= nil) then
_rawset (self, "param1", param1)
end
- if (param2) then
+ if (param2 ~= nil) then
_rawset (self, "param2", param2)
end
diff --git a/framework/panel.lua b/framework/panel.lua
index 64218c5b..458ad30b 100644
--- a/framework/panel.lua
+++ b/framework/panel.lua
@@ -551,8 +551,286 @@ function gump:NewPanel (parent, container, name, member, w, h, backdrop, backdro
return PanelObject
end
-------------color pick
+------------fill panel
+local button_on_enter = function (self)
+ self.MyObject._icon:SetBlendMode ("ADD")
+end
+local button_on_leave = function (self)
+ self.MyObject._icon:SetBlendMode ("BLEND")
+end
+
+function gump:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_row, autowidth, options)
+
+ local panel = gump:NewPanel (parent, parent, name, member, w, h)
+ panel.backdrop = nil
+
+ options = options or {rowheight = 20}
+ panel.rows = {}
+
+ for index, t in ipairs (rows) do
+ local thisrow = gump:NewPanel (panel, panel, "$parentHeader_" .. name .. index, nil, 1, 20)
+ thisrow.backdrop = {bgFile = [[Interface\DialogFrame\UI-DialogBox-Gold-Background]]}
+ thisrow.color = "silver"
+ thisrow.type = t.type
+ thisrow.func = t.func
+ thisrow.name = t.name
+ thisrow.notext = t.notext
+ thisrow.icon = t.icon
+ thisrow.iconalign = t.iconalign
+
+ local text = gump:NewLabel (thisrow, nil, name .. "$parentLabel", "text")
+ text:SetPoint ("left", thisrow, "left", 2, 0)
+ text:SetText (t.name)
+
+ tinsert (panel.rows, thisrow)
+ end
+
+ local cur_width = 0
+ local row_width = w / #rows
+
+ local anchors = {}
+
+ for index, row in ipairs (panel.rows) do
+ if (autowidth) then
+ row:SetWidth (row_width)
+ row:SetPoint ("topleft", panel, "topleft", cur_width, 0)
+ tinsert (anchors, cur_width)
+ cur_width = cur_width + row_width + 1
+ else
+ row:SetPoint ("topleft", panel, "topleft", cur_width, 0)
+ row.width = rows [index].width
+ tinsert (anchors, cur_width)
+ cur_width = cur_width + rows [index].width + 1
+ end
+ end
+
+ if (autowidth) then
+ panel.rows [#panel.rows]:SetWidth (row_width - #rows + 1)
+ else
+ panel.rows [#panel.rows]:SetWidth (rows [#rows].width - #rows + 1)
+ end
+
+ local refresh_fillbox = function (self)
+ local offset = FauxScrollFrame_GetOffset (self)
+ local filled_lines = total_lines()
+
+ for index = 1, #self.lines do
+
+ local row = self.lines [index]
+ if (index <= filled_lines) then
+
+ local real_index = index + offset
+
+ local results = fill_row (real_index)
+
+ if (results [1]) then
+
+ row:Show()
+
+ for i = 1, #row.row_widgets do
+
+ row.row_widgets [i].index = real_index
+
+ if (panel.rows [i].type == "icon") then
+
+ local result = results [i]:gsub (".-%\\", "")
+ row.row_widgets [i].icon.texture = results [i]
+
+ elseif (panel.rows [i].type == "button") then
+
+ if (type (results [i]) == "table") then
+
+ if (results [i].text) then
+ row.row_widgets [i]:SetText (results [i].text)
+ end
+
+ if (results [i].icon) then
+ row.row_widgets [i]._icon:SetTexture (results [i].icon)
+ end
+
+ if (results [i].func) then
+ row.row_widgets [i]:SetClickFunction (results [i].func, real_index, results [i].value)
+ end
+
+ else
+ row.row_widgets [i]:SetText (results [i])
+ end
+
+ else
+ --< text
+ row.row_widgets [i]:SetText (results [i])
+
+ end
+ end
+
+ else
+ row:Hide()
+ for i = 1, #row.row_widgets do
+ row.row_widgets [i]:SetText ("")
+ if (panel.rows [i].type == "icon") then
+ row.row_widgets [i].icon.texture = ""
+ end
+ end
+ end
+ else
+ row:Hide()
+ for i = 1, #row.row_widgets do
+ row.row_widgets [i]:SetText ("")
+ if (panel.rows [i].type == "icon") then
+ row.row_widgets [i].icon.texture = ""
+ end
+ end
+ end
+ end
+ end
+
+ function panel:Refresh()
+ local filled_lines = total_lines()
+ local scroll_total_lines = #panel.scrollframe
+ local line_height = options.rowheight
+
+ FauxScrollFrame_Update (panel.scrollframe, filled_lines, scroll_total_lines, line_height)
+ refresh_fillbox (panel.scrollframe)
+ end
+
+ local scrollframe = CreateFrame ("scrollframe", name .. "Scroll", panel.widget, "FauxScrollFrameTemplate")
+ scrollframe:SetScript ("OnVerticalScroll", function (self, offset) FauxScrollFrame_OnVerticalScroll (self, offset, 20, panel.Refresh) end)
+ scrollframe:SetPoint ("topleft", panel.widget, "topleft", 0, -21)
+ scrollframe:SetPoint ("topright", panel.widget, "topright", -23, -21)
+ scrollframe:SetPoint ("bottomleft", panel.widget, "bottomleft")
+ scrollframe:SetPoint ("bottomright", panel.widget, "bottomright", -23, 0)
+ scrollframe:SetSize (w, h)
+ panel.scrollframe = scrollframe
+ scrollframe.lines = {}
+
+ --create lines
+ local size = options.rowheight
+ local amount = math.floor (((h-21) / size))
+
+
+ for i = 1, amount do
+
+ local row = gump:NewPanel (scrollframe, nil, "$parentRow_" .. i, nil, 1, size)
+ row.backdrop = {bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]]}
+ row.color = {1, 1, 1, .2}
+ row:SetPoint ("topleft", scrollframe, "topleft", 0, (i-1) * size * -1)
+ row:SetPoint ("topright", scrollframe, "topright", 0, (i-1) * size * -1)
+ tinsert (scrollframe.lines, row)
+
+ row.row_widgets = {}
+
+ for o = 1, #rows do
+
+ local _type = panel.rows [o].type
+
+ if (_type == "text") then
+
+ --> create text
+ local text = gump:NewLabel (row, nil, name .. "$parentLabel" .. o, "text" .. o)
+ text:SetPoint ("left", row, "left", anchors [o], 0)
+
+ --> insert in the table
+ tinsert (row.row_widgets, text)
+
+ elseif (_type == "entry") then
+
+ --> create editbox
+ local editbox = gump:NewTextEntry (row, nil, "$parentEntry" .. o, "entry", panel.rows [o].width, 20, panel.rows [o].func, i, o)
+ editbox.align = "left"
+ editbox:SetHook ("OnEnterPressed", function()
+ editbox.widget.focuslost = true
+ editbox:ClearFocus()
+ editbox.func (editbox.index, editbox.text)
+ return true
+ end)
+ editbox:SetPoint ("left", row, "left", anchors [o], 0)
+ editbox:SetBackdrop ({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = 1})
+ editbox:SetBackdropColor (1, 1, 1, 0.1)
+ editbox:SetBackdropBorderColor (1, 1, 1, 0.1)
+
+ --> insert in the table
+ tinsert (row.row_widgets, editbox)
+
+ elseif (_type == "button") then
+
+ --> create button
+ local button = gump:NewButton (row, nil, "$parentButton" .. o, "button", 60, 20)
+
+ --[
+ local func = function()
+ panel.rows [o].func (button.index, o)
+ panel:Refresh()
+ end
+ button:SetClickFunction (func)
+ --]]
+
+ button:SetPoint ("left", row, "left", anchors [o], 0)
+
+ --> create icon and the text
+ local icon = gump:NewImage (button, nil, 20, 20)
+ local text = gump:NewLabel (button)
+
+ button._icon = icon
+ button._text = text
+
+ button:SetHook ("OnEnter", button_on_enter)
+ button:SetHook ("OnLeave", button_on_leave)
+
+ if (panel.rows [o].icon) then
+ icon.texture = panel.rows [o].icon
+ if (panel.rows [o].iconalign) then
+ if (panel.rows [o].iconalign == "center") then
+ icon:SetPoint ("center", button, "center")
+ elseif (panel.rows [o].iconalign == "right") then
+ icon:SetPoint ("right", button, "right")
+ end
+ else
+ icon:SetPoint ("left", button, "left")
+ end
+ end
+
+ if (panel.rows [o].name and not panel.rows [o].notext) then
+ text:SetPoint ("left", icon, "right", 2, 0)
+ text.text = panel.rows [o].name
+ end
+
+ --> inser in the table
+ tinsert (row.row_widgets, button)
+
+ elseif (_type == "icon") then
+
+ --> create button and icon
+ local iconbutton = gump:NewButton (row, nil, "$parentIconButton" .. o, "iconbutton", 20, 20)
+ iconbutton:InstallCustomTexture()
+ local icon = gump:NewImage (iconbutton, nil, 20, 20, "artwork", nil, "icon", "$parentIcon" .. o)
+ iconbutton:SetPoint ("left", row, "left", anchors [o], 0)
+ icon:SetPoint ("left", iconbutton, "left", 0, 0)
+
+ --> set functions
+ local function iconcallback (texture)
+ iconbutton.icon.texture = texture
+ panel.rows [o].func (iconbutton.index, texture)
+ end
+
+ iconbutton:SetClickFunction (function()
+ gump:IconPick (iconcallback)
+ return true
+ end)
+
+ --> insert in the table
+ tinsert (row.row_widgets, iconbutton)
+
+ end
+
+ end
+ end
+
+ return panel
+end
+
+
+------------color pick
local color_pick_func = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = OpacitySliderFrame:GetValue()
@@ -588,7 +866,6 @@ function gump:ColorPick (frame, r, g, b, alpha, callback)
end
------------icon pick
-
function gump:IconPick (callback)
if (not gump.IconPickFrame) then
diff --git a/framework/picture.lua b/framework/picture.lua
index f8264838..f8447bc6 100644
--- a/framework/picture.lua
+++ b/framework/picture.lua
@@ -269,6 +269,10 @@ function gump:NewImage (parent, texture, w, h, layer, coords, member, name)
end
end
+ if (coords and type (coords) == "table" and coords [4]) then
+ ImageObject.image:SetTexCoord (unpack (coords))
+ end
+
setmetatable (ImageObject, ImageMetaFunctions)
return ImageObject
diff --git a/framework/textentry.lua b/framework/textentry.lua
index 77133d52..4695f017 100644
--- a/framework/textentry.lua
+++ b/framework/textentry.lua
@@ -268,6 +268,7 @@ local TextEntryMetaFunctions = {}
textentry.mouse_over = true
if (textentry:IsEnabled()) then
+ textentry.current_bordercolor = textentry.current_bordercolor or {textentry:GetBackdropBorderColor()}
textentry:SetBackdropBorderColor (0.5, 0.5, 0.5, 1)
end
@@ -295,7 +296,7 @@ local TextEntryMetaFunctions = {}
textentry.mouse_over = false
if (textentry:IsEnabled()) then
- textentry:SetBackdropBorderColor(0.3, 0.3, 0.3, 0.8)
+ textentry:SetBackdropBorderColor (unpack (textentry.current_bordercolor))
end
local parent = textentry:GetParent().MyObject
@@ -360,8 +361,8 @@ local TextEntryMetaFunctions = {}
end
end
- textentry:SetText("")
- textentry.MyObject.currenttext = ""
+ --textentry:SetText("")
+ --textentry.MyObject.currenttext = ""
textentry.focuslost = true
textentry:ClearFocus()
end
@@ -491,9 +492,11 @@ function gump:NewTextEntry (parent, container, name, member, w, h, func, param1,
--> misc
TextEntryObject.container = container
TextEntryObject.have_tooltip = nil
-
+
TextEntryObject.editbox = CreateFrame ("EditBox", name, parent, "DetailsEditBoxTemplate2")
TextEntryObject.widget = TextEntryObject.editbox
+
+ TextEntryObject.editbox:SetTextInsets (3, 0, 0, -3)
if (not APITextEntryFunctions) then
APITextEntryFunctions = true
@@ -559,4 +562,138 @@ function gump:NewTextEntry (parent, container, name, member, w, h, func, param1,
return TextEntryObject
+end
+
+local SpellEntryOnEditFocusGained = function (self)
+ local start_build_cache = _detalhes:BuildSpellListSlow()
+ if (start_build_cache) then
+ DetailsLoadSpellCacheProgress:SetPoint ("left", self, "right", 2, 0)
+ end
+end
+
+local SpellEntryOnClickMenu = function (_, _, SpellID, editbox)
+ editbox:SetText (SpellID)
+ editbox:PressEnter()
+ editbox.HaveMenu = false
+ GameCooltip:ShowMe (false)
+end
+
+local SpellEntryOnTextChanged = function (editbox, userChanged)
+
+ if (not userChanged) then
+ return
+ elseif (not _detalhes.spellcachefull) then
+ return
+ end
+
+ editbox = editbox.MyObject
+
+ local text = editbox:GetText()
+ text = _detalhes:trim (text)
+ text = string.lower (text)
+
+ local LetterIndex = string.sub (text, 1, 1)
+ local LetterIndex_CacheContainer = _detalhes.spellcachefull [LetterIndex]
+
+ if (LetterIndex_CacheContainer) then
+
+ local GameCooltip = _G.GameCooltip
+
+ _detalhes:CooltipPreset (1)
+ GameCooltip:SetType ("menu")
+ GameCooltip:SetOwner (editbox.widget)
+ GameCooltip:SetOption ("NoLastSelectedBar", true)
+ GameCooltip:SetOption ("TextSize", 9)
+
+ local i = 1
+
+ for SpellID, SpellTable in pairs (LetterIndex_CacheContainer) do
+ if (string.lower (SpellTable[1]):find (text)) then
+
+ GameCooltip:AddMenu (1, SpellEntryOnClickMenu, SpellID, editbox, nil, SpellID..": "..SpellTable[1], SpellTable[2], true)
+
+ if (i > 20) then
+ break
+ else
+ i = i + 1
+ end
+ end
+ end
+
+ editbox.HaveMenu = true
+ GameCooltip.buttonOver = true
+ GameCooltip:ShowCooltip()
+ end
+
+end
+
+function gump:NewSpellEntry (parent, func, w, h, param1, param2, member, name)
+ local editbox = gump:NewTextEntry (parent, parent, name, member, w, h, func, param1, param2)
+
+ editbox:SetHook ("OnEditFocusGained", SpellEntryOnEditFocusGained)
+ editbox:SetHook ("OnTextChanged", SpellEntryOnTextChanged)
+
+ return editbox
+end
+
+
+local function_gettext = function (self)
+ return self.editbox:GetText()
+end
+local function_settext = function (self, text)
+ return self.editbox:SetText (text)
+end
+local function_clearfocus = function (self)
+ return self.editbox:ClearFocus()
+end
+local function_setfocus = function (self)
+ return self.editbox:SetFocus (true)
+end
+
+function gump:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent)
+
+ if (name:find ("$parent")) then
+ name = name:gsub ("$parent", parent:GetName())
+ end
+
+ local borderframe = CreateFrame ("Frame", name, parent)
+ borderframe:SetSize (w, h)
+
+ if (member) then
+ parent [member] = borderframe
+ end
+
+ local scrollframe = CreateFrame ("ScrollFrame", name, borderframe, "DetailsEditBoxMultiLineTemplate")
+
+ scrollframe:SetScript ("OnSizeChanged", function (self)
+ scrollframe.editbox:SetSize (self:GetSize())
+ end)
+
+ scrollframe:SetPoint ("topleft", borderframe, "topleft", 10, -10)
+ scrollframe:SetPoint ("bottomright", borderframe, "bottomright", -30, 10)
+
+ scrollframe.editbox:SetMultiLine (true)
+ scrollframe.editbox:SetJustifyH ("left")
+ scrollframe.editbox:SetJustifyV ("top")
+ scrollframe.editbox:SetMaxBytes (40960)
+ scrollframe.editbox:SetMaxLetters (20000)
+
+ borderframe.GetText = function_gettext
+ borderframe.SetText = function_settext
+ borderframe.ClearFocus = function_clearfocus
+ borderframe.SetFocus = function_setfocus
+
+ if (not nointent) then
+ IndentationLib.enable (scrollframe.editbox, nil, 4)
+ end
+
+ borderframe:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
+ tile = 1, tileSize = 16, edgeSize = 16, insets = {left = 5, right = 5, top = 5, bottom = 5}})
+ borderframe:SetBackdropColor (0.090195, 0.090195, 0.188234, 1)
+ borderframe:SetBackdropBorderColor (1, 1, 1, 1)
+
+ borderframe.scroll = scrollframe
+ borderframe.editbox = scrollframe.editbox
+
+ return borderframe
end
\ No newline at end of file
diff --git a/framework/textentry.xml b/framework/textentry.xml
index fdecd680..252d1c3e 100644
--- a/framework/textentry.xml
+++ b/framework/textentry.xml
@@ -33,4 +33,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/functions/attributes.lua b/functions/attributes.lua
index 4f1b24ec..3302e0b1 100644
--- a/functions/attributes.lua
+++ b/functions/attributes.lua
@@ -6,10 +6,42 @@ do
--> Globals
--[[global]] DETAILS_ATTRIBUTE_DAMAGE = 1
+
+ --[[global]] DETAILS_SUBATTRIBUTE_DAMAGEDONE = 1
+ --[[global]] DETAILS_SUBATTRIBUTE_DPS = 2
+ --[[global]] DETAILS_SUBATTRIBUTE_DAMAGETAKEN = 3
+ --[[global]] DETAILS_SUBATTRIBUTE_FRIENDLYFIRE = 4
+ --[[global]] DETAILS_SUBATTRIBUTE_FRAGS = 5
+ --[[global]] DETAILS_SUBATTRIBUTE_ENEMIES = 6
+ --[[global]] DETAILS_SUBATTRIBUTE_VOIDZONES = 7
+
--[[global]] DETAILS_ATTRIBUTE_HEAL = 2
+
+ --[[global]] DETAILS_SUBATTRIBUTE_HEALDONE = 1
+ --[[global]] DETAILS_SUBATTRIBUTE_HPS = 2
+ --[[global]] DETAILS_SUBATTRIBUTE_OVERHEAL = 3
+ --[[global]] DETAILS_SUBATTRIBUTE_HEALTAKEN = 4
+ --[[global]] DETAILS_SUBATTRIBUTE_HEALENEMY = 5
+ --[[global]] DETAILS_SUBATTRIBUTE_HEALPREVENTED = 6
+
--[[global]] DETAILS_ATTRIBUTE_ENERGY = 3
+
+ --[[global]] DETAILS_SUBATTRIBUTE_REGENMANA = 1
+ --[[global]] DETAILS_SUBATTRIBUTE_REGENRAGE = 2
+ --[[global]] DETAILS_SUBATTRIBUTE_REGENENERGY = 3
+ --[[global]] DETAILS_SUBATTRIBUTE_REGENRUNE = 4
+
--[[global]] DETAILS_ATTRIBUTE_MISC = 4
+ --[[global]] DETAILS_SUBATTRIBUTE_CCBREAK = 1
+ --[[global]] DETAILS_SUBATTRIBUTE_RESS = 2
+ --[[global]] DETAILS_SUBATTRIBUTE_INTERRUPT = 3
+ --[[global]] DETAILS_SUBATTRIBUTE_DISPELL = 4
+ --[[global]] DETAILS_SUBATTRIBUTE_DEATH = 5
+ --[[global]] DETAILS_SUBATTRIBUTE_DCOOLDOWN = 6
+ --[[global]] DETAILS_SUBATTRIBUTE_BUFFUPTIME = 7
+ --[[global]] DETAILS_SUBATTRIBUTE_DEBUFFUPTIME = 8
+
_detalhes.atributos_capture = {
"damage", --damage done
"damage", --dps
diff --git a/functions/loaddata.lua b/functions/loaddata.lua
index db06a7e3..bdb4d723 100644
--- a/functions/loaddata.lua
+++ b/functions/loaddata.lua
@@ -81,9 +81,9 @@ end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> On Details! Load:
- --> check if this is a first run, reset, or else.
+ --> check if this is a first run, reset, or just load the saved data.
-function _detalhes:IsFirstRun()
+function _detalhes:LoadGlobalAndCharacterData()
--> check and build the default container for character database
if (not _detalhes_database) then
@@ -270,15 +270,15 @@ function _detalhes:LoadConfig()
--> custom
_detalhes.custom = _detalhes_global.custom
- --> parser
+ --> initialize parser
_detalhes.capture_current = {}
for captureType, captureValue in pairs (_detalhes.capture_real) do
_detalhes.capture_current [captureType] = captureValue
end
-
- --> spells overwrite
- _detalhes.SpellOverwriteUser = _detalhes_global.SpellOverwriteUser or _detalhes.SpellOverwriteUser
+ --> initialize spell cache
+ _detalhes:ClearSpellCache()
+
--> version first run
if (not _detalhes_database.last_version or _detalhes_database.last_version ~= _detalhes.userversion) then
_detalhes.is_version_first_run = true
diff --git a/functions/profiles.lua b/functions/profiles.lua
index f7848c06..9c6d785a 100644
--- a/functions/profiles.lua
+++ b/functions/profiles.lua
@@ -605,6 +605,8 @@ local default_global_data = {
__profiles = {},
custom = {},
savedStyles = {},
+ savedCustomSpells = {},
+ savedTimeCaptures = {},
tutorial = {logons = 0, unlock_button = 0, version_announce = 0, main_help_button = 0, alert_frames = {false, false, false, false, false, false}, },
}
diff --git a/functions/savedata.lua b/functions/savedata.lua
index 05dc1e52..91e60863 100644
--- a/functions/savedata.lua
+++ b/functions/savedata.lua
@@ -435,6 +435,8 @@ function _detalhes:SaveConfig()
_detalhes_database.tabela_instancias = _detalhes.tabela_instancias
_detalhes_database.tabela_historico = _detalhes.tabela_historico
+ _detalhes:TimeDataCleanUpTemporary()
+
--> buffs
_detalhes.Buffs:SaveBuffs()
@@ -476,8 +478,5 @@ function _detalhes:SaveConfig()
_detalhes_database.last_realversion = _detalhes.realversion --> core number
_detalhes_database.last_version = _detalhes.userversion --> version
_detalhes_global.got_first_run = true
-
- --> overwrite spells
- _detalhes_global.SpellOverwriteUser = _detalhes.SpellOverwriteUser
end
diff --git a/functions/skins.lua b/functions/skins.lua
index 2b991cb6..4311424d 100644
--- a/functions/skins.lua
+++ b/functions/skins.lua
@@ -138,7 +138,7 @@ local _
-- the four anchors:
icon_point_anchor = {-37, 0},
left_corner_anchor = {-107, 0},
- close_button_anchor = {5, -6},
+ close_button_anchor = {3, -5},
right_corner_anchor = {96, 0},
icon_point_anchor_bottom = {-37, 12},
@@ -146,8 +146,12 @@ local _
close_button_anchor_bottom = {5, 6},
right_corner_anchor_bottom = {96, 0},
- close_button_size = {32, 32},
+ close_button_size = {26, 26},
+ instance_cprops = {
+ resetbutton_info = {always_small = true},
+ instance_button_anchor = {-19, 1},
+ }
})
-- 0.00048828125
diff --git a/functions/slash.lua b/functions/slash.lua
index 3908ca3f..ca8d91bf 100644
--- a/functions/slash.lua
+++ b/functions/slash.lua
@@ -394,6 +394,16 @@ function SlashCmdList.DETAILS (msg, editbox)
print ("Instances opened: " .. _detalhes.opened_windows)
--> debug, get a guid of something
+ elseif (command == "backdrop") then --> localize-me
+ local f = MacroFrameTextBackground
+ local backdrop = MacroFrameTextBackground:GetBackdrop()
+
+ vardump (backdrop)
+ vardump (backdrop.insets)
+
+ print ("bgcolor:",f:GetBackdropColor())
+ print ("bordercolor",f:GetBackdropBorderColor())
+
elseif (command == "myguid") then --> localize-me
local g = UnitGUID ("player")
@@ -405,6 +415,10 @@ function SlashCmdList.DETAILS (msg, editbox)
print (serial)
--tonumber((UnitGUID("target")):sub(-12, -9), 16))
+
+ elseif (command == "callfunction") then
+
+ _detalhes:InstanceCall (_detalhes.SetCombatAlpha, nil, nil, true)
elseif (command == "guid") then --> localize-me
diff --git a/functions/spellcache.lua b/functions/spellcache.lua
index c8598d91..a9ef1762 100644
--- a/functions/spellcache.lua
+++ b/functions/spellcache.lua
@@ -49,15 +49,73 @@ do
end
--> user overwrites
- for spellId, spellTable in pairs (_detalhes.SpellOverwriteUser) do
- local name, _, icon = _GetSpellInfo (spellId)
- _rawset (_detalhes.spellcache, spellId, {spellTable.name or name, 1, spellTable.icon or icon})
+ -- [1] spellid [2] spellname [3] spellicon
+ for index, spellTable in ipairs (_detalhes.savedCustomSpells) do
+ _rawset (_detalhes.spellcache, spellTable [1], {spellTable [2], 1, spellTable [3]})
end
end
- --> initialize spell cache
- _detalhes:ClearSpellCache()
-
+ function _detalhes:UserCustomSpellUpdate (index, name, icon)
+ local t = _detalhes.savedCustomSpells [index]
+ if (t) then
+ t [2], t [3] = name or t [2], icon or t [3]
+ return _rawset (_detalhes.spellcache, t [1], {t [2], 1, t [3]})
+ else
+ return false
+ end
+ end
+
+ function _detalhes:FillUserCustomSpells()
+ local spells = {
+ [124464] = {name = GetSpellInfo (124464) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> shadow word: pain mastery proc (priest)
+ [124465] = {name = GetSpellInfo (124465) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> vampiric touch mastery proc (priest)
+ [124468] = {name = GetSpellInfo (124468) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> mind flay mastery proc (priest)
+
+ [121414] = {name = GetSpellInfo (121414) .. " (Glaive #1)"}, --> glaive toss (hunter)
+ [120761] = {name = GetSpellInfo (120761) .. " (Glaive #2)"}, --> glaive toss (hunter)
+
+ [77451] = {name = GetSpellInfo (77451) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> lava burst (shaman)
+ [45284] = {name = GetSpellInfo (45284) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> lightningbolt (shaman)
+
+ [131079] = {name = GetSpellInfo (131079) .. " (Icy Veins)"}, --> frostbolt with icy veins glyph (mage)
+ [131080] = {name = GetSpellInfo (131080) .. " (Icy Veins)"}, --> ice lance with icy veins glyph (mage)
+ [131081] = {name = GetSpellInfo (131081) .. " (Icy Veins)"}, --> frostfire with icy veins glyph (mage)
+ }
+
+ for spellid, t in pairs (spells) do
+ local _, _, icon = GetSpellInfo (spellid)
+ _detalhes:UserCustomSpellAdd (spellid, t.name, icon)
+ end
+ end
+
+ function _detalhes:UserCustomSpellAdd (spellid, name, icon)
+ local is_overwrite = false
+ for index, t in ipairs (_detalhes.savedCustomSpells) do
+ if (t [1] == spellid) then
+ t[2] = name
+ t[3] = icon
+ is_overwrite = true
+ break
+ end
+ end
+ if (not is_overwrite) then
+ tinsert (_detalhes.savedCustomSpells, {spellid, name, icon})
+ end
+ return _rawset (_detalhes.spellcache, spellid, {name, 1, icon})
+ end
+
+ function _detalhes:UserCustomSpellRemove (index)
+ local t = _detalhes.savedCustomSpells [index]
+ if (t) then
+ local spellid = t [1]
+ local name, _, icon = _GetSpellInfo (spellid)
+ _rawset (_detalhes.spellcache, spellid, {name, 1, icon})
+ return tremove (_detalhes.savedCustomSpells, index)
+ end
+
+ return false
+ end
+
--> overwrite for API GetSpellInfo function
_detalhes.getspellinfo = function (spellid) return _unpack (_detalhes.spellcache[spellid]) end
@@ -69,6 +127,72 @@ do
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> Cache All Spells
+
+ function _detalhes:BuildSpellListSlow()
+
+ local load_frame = _G.DetailsLoadSpellCache
+ if (load_frame and (load_frame.completed or load_frame.inprogress)) then
+ return false
+ end
+
+ local step = 1
+ local max = 160000
+
+ if (not load_frame) then
+ load_frame = CreateFrame ("frame", "DetailsLoadSpellCache", UIParent)
+ load_frame:SetFrameStrata ("DIALOG")
+
+ local progress_label = load_frame:CreateFontString ("DetailsLoadSpellCacheProgress", "overlay", "GameFontHighlightSmall")
+ progress_label:SetText ("Loading Spells: 0%")
+ function _detalhes:BuildSpellListSlowTick()
+ progress_label:SetText ("Loading Spells: " .. load_frame:GetProgress() .. "%")
+ end
+ load_frame.tick = _detalhes:ScheduleRepeatingTimer ("BuildSpellListSlowTick", 1)
+
+ function load_frame:GetProgress()
+ return math.floor (step / max * 100)
+ end
+ end
+
+ local SpellCache = {a={}, b={}, c={}, d={}, e={}, f={}, g={}, h={}, i={}, j={}, k={}, l={}, m={}, n={}, o={}, p={}, q={}, r={}, s={}, t={}, u={}, v={}, w={}, x={}, y={}, z={}}
+ local _string_lower = string.lower
+ local _string_sub = string.sub
+ local blizzGetSpellInfo = GetSpellInfo
+
+ load_frame.inprogress = true
+
+ _detalhes.spellcachefull = SpellCache
+
+ load_frame:SetScript ("OnUpdate", function()
+ for spellid = step, step+500 do
+ local name, _, icon = blizzGetSpellInfo (spellid)
+ if (name) then
+ local LetterIndex = _string_lower (_string_sub (name, 1, 1)) --> get the first letter
+ local CachedIndex = SpellCache [LetterIndex]
+ if (CachedIndex) then
+ CachedIndex [spellid] = {name, icon}
+ end
+ end
+ end
+
+ step = step + 500
+
+ if (step > max) then
+ step = max
+ _G.DetailsLoadSpellCache.completed = true
+ _G.DetailsLoadSpellCache.inprogress = false
+ _detalhes:CancelTimer (_G.DetailsLoadSpellCache.tick)
+ DetailsLoadSpellCacheProgress:Hide()
+ load_frame:SetScript ("OnUpdate", nil)
+ end
+
+ end)
+
+
+
+ return true
+ end
+
function _detalhes:BuildSpellList()
local SpellCache = {a={}, b={}, c={}, d={}, e={}, f={}, g={}, h={}, i={}, j={}, k={}, l={}, m={}, n={}, o={}, p={}, q={}, r={}, s={}, t={}, u={}, v={}, w={}, x={}, y={}, z={}}
@@ -96,4 +220,6 @@ do
collectgarbage()
end
+
+
end
\ No newline at end of file
diff --git a/functions/spells.lua b/functions/spells.lua
index 9f269625..a549072c 100644
--- a/functions/spells.lua
+++ b/functions/spells.lua
@@ -1942,9 +1942,7 @@ do
local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
_detalhes.SpellOverwrite = {
- [124464] = {name = GetSpellInfo (124464) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> shadow word: pain mastery proc (priest)
- [124465] = {name = GetSpellInfo (124465) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> vampiric touch mastery proc (priest)
- [124468] = {name = GetSpellInfo (124468) .. " (" .. Loc ["STRING_MASTERY"] .. ")"} --> mind flay mastery proc (priest)
+ --[124464] = {name = GetSpellInfo (124464) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> shadow word: pain mastery proc (priest)
}
function _detalhes:IsCooldown (spellid)
diff --git a/functions/timedata.lua b/functions/timedata.lua
index 7f3fd20a..7ef1e711 100644
--- a/functions/timedata.lua
+++ b/functions/timedata.lua
@@ -1,162 +1,226 @@
---File Revision: 1
---Last Modification: 27/07/2013
--- Change Log:
- -- 27/07/2013: Finished alpha version.
+
+
+
+
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+--> basic stuff
+
+ local _
+ local _detalhes = _G._detalhes
+
+ --> mantain the enabled time captures
+ _detalhes.timeContainer = {}
+ _detalhes.timeContainer.Exec = {}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-
- local _detalhes = _G._detalhes
- local _
- _detalhes.timeContainer = {
- damage_recording = 0,
- healing_recording = 0,
-
- have_custom = false,
- custom_functions = {},
- custom_attributes = {},
-
- current_table = {} --> place holder
- }
- _detalhes.timeContainer.__index = _detalhes.timeContainer
-
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
-
- local _pairs = pairs
+ local ipairs = ipairs
+ local time = time
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---> details api functions
+--> constants
- --> remove a capture previous registred
- function _detalhes:UnregisterTimeCapture (captureType)
- if (type (captureType) == "number" and captureType == 1) then
- if (_detalhes.timeContainer.damage_recording > 1) then
- _detalhes.timeContainer.damage_recording = _detalhes.timeContainer.damage_recording - 1
- end
-
- elseif (type (captureType) == "number" and captureType == 2) then
- if (_detalhes.timeContainer.healing_recording > 1) then
- _detalhes.timeContainer.healing_recording = _detalhes.timeContainer.healing_recording - 1
- end
-
- elseif (type (captureType) == "string") then
- if (_detalhes.timeContainer.have_custom) then
- if (_detalhes.timeContainer.custom_functions [captureType]) then
- _detalhes.timeContainer.custom_functions [captureType] = nil
+ local INDEX_NAME = 1
+ local INDEX_FUNCTION = 2
+ local INDEX_MATRIX = 3
+ local INDEX_AUTHOR = 4
+ local INDEX_VERSION = 5
+ local INDEX_ICON = 6
+ local INDEX_ENABLED = 7
+
+ local DEFAULT_USER_MATRIX = {max_value = 0, last_value = 0}
+
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+--> register and unregister captures
+
+
+ function _detalhes:TimeDataUpdate (index_or_name, name, func, matrix, author, version, icon, is_enabled)
+
+ local this_capture
+ if (type (index_or_name) == "number") then
+ this_capture = _detalhes.savedTimeCaptures [index_or_name]
+ else
+ for index, t in ipairs (_detalhes.savedTimeCaptures) do
+ if (t [INDEX_NAME] == index_or_name) then
+ this_capture = t
end
end
end
- end
-
- --> register a new capture
- function _detalhes:RegisterTimeCapture (captureType, customName, attributes)
-
- if (type (captureType) == "number" and captureType == 1) then
- if (_detalhes.timeContainer.damage_recording < 1) then
- _detalhes.timeContainer.current_table.damage = {}
- _detalhes.timeContainer.current_table.damageLast = 0
- _detalhes.timeContainer.current_table.damageMax = 0
- end
- _detalhes.timeContainer.damage_recording = _detalhes.timeContainer.damage_recording + 1
-
- elseif (type (captureType) == "number" and captureType == 2) then
- if (_detalhes.timeContainer.healing_recording < 1) then
- _detalhes.timeContainer.current_table.healing = {}
- _detalhes.timeContainer.current_table.healingLast = 0
- _detalhes.timeContainer.current_table.healingMax = 0
- end
- _detalhes.timeContainer.healing_recording = _detalhes.timeContainer.healing_recording + 1
-
- elseif (type (captureType) == "function") then
- if (customName) then
- _detalhes.timeContainer.have_custom = true
- _detalhes.timeContainer.custom_functions [customName] = captureType
- _detalhes.timeContainer.custom_attributes [customName] = attributes or {}
- _detalhes.timeContainer.current_table [customName .. "Data"] = {}
- _detalhes.timeContainer.current_table [customName .. "Attributes"] = {}
- if (attributes) then
- for k, v in pairs (attributes) do
- _detalhes.timeContainer.current_table [customName .. "Attributes"][k] = v
- end
- end
- end
+
+ if (not this_capture) then
+ return false
+ end
+
+ if (this_capture.do_not_save) then
+ return _detalhes:Msg ("This capture belongs to a plugin and cannot be edited.")
+ end
+
+ this_capture [INDEX_NAME] = name or this_capture [INDEX_NAME]
+ this_capture [INDEX_FUNCTION] = func or this_capture [INDEX_FUNCTION]
+ this_capture [INDEX_MATRIX] = matrix or this_capture [INDEX_MATRIX]
+ this_capture [INDEX_AUTHOR] = author or this_capture [INDEX_AUTHOR]
+ this_capture [INDEX_VERSION] = version or this_capture [INDEX_VERSION]
+ this_capture [INDEX_ICON] = icon or this_capture [INDEX_ICON]
+
+ if (is_enabled ~= nil) then
+ this_capture [INDEX_ENABLED] = is_enabled
+ else
+ this_capture [INDEX_ENABLED] = this_capture [INDEX_ENABLED]
end
return true
+
end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---> internal functions
+ function _detalhes:TimeDataRegister (name, func, matrix, author, version, icon, is_enabled, force_no_save)
- function _detalhes.timeContainer:CreateTimeTable()
- local _t = {}
- setmetatable (_t, _detalhes.timeContainer)
- _t.timeIndex = 1
- --
- if (_detalhes.timeContainer.damage_recording > 0) then
- _t.damage = {}
- _t.damageLast = 0
- _t.damageMax = 0
+ --> check name
+ if (not name) then
+ return "Couldn't register the time capture, name was nil."
end
- --
- if (_detalhes.timeContainer.healing_recording > 0) then
- _t.healing = {}
- _t.healingLast = 0
- _t.healingMax = 0
- end
- --
- if (_detalhes.timeContainer.have_custom) then
- for customName, customFunction in _pairs (_detalhes.timeContainer.custom_functions) do
- if (customFunction) then
- _t [customName .. "Data"] = {}
- _t [customName .. "Attributes"] = {}
-
- local attributes = _detalhes.timeContainer.custom_attributes [customName]
- local attributeTable = _t [customName .. "Attributes"]
- for k, v in pairs (attributes) do
- attributeTable [k] = v
- end
-
- end
+
+ --> check if the name already exists
+ for index, t in ipairs (_detalhes.savedTimeCaptures) do
+ if (t [INDEX_NAME] == name) then
+ return "Couldn't register the time capture, name already registred."
end
end
- _detalhes.timeContainer.current_table = _t
+ --> check function
+ if (not func) then
+ return "Couldn't register the time capture, invalid function."
+ end
- return _t
+ local no_save = nil
+ --> passed a function means that this isn't came from a user
+ --> so the plugin register the capture every time it loads.
+ if (type (func) == "function") then
+ no_save = true
+
+ --> this a custom capture from a user, so we register a default user table for matrix
+ elseif (type (func) == "string") then
+ matrix = DEFAULT_USER_MATRIX
+
+ end
+
+ if (not no_save and force_no_save) then
+ no_save = true
+ end
+
+ --> check matrix
+ if (not matrix or type (matrix) ~= "table") then
+ return "Couldn't register the time capture, matrix was invalid."
+ end
+
+ author = author or "Unknown"
+ version = version or "v1.0"
+ icon = icon or [[Interface\InventoryItems\WoWUnknownItem01]]
+
+ tinsert (_detalhes.savedTimeCaptures, {name, func, matrix, author, version, icon, is_enabled, do_not_save = no_save})
+
+ return true
+
+ end
+
+ --> unregister
+ function _detalhes:TimeDataUnregister (name)
+ if (type (name) == "number") then
+ return tremove (_detalhes.savedTimeCaptures, name)
+ else
+ for index, t in ipairs (_detalhes.savedTimeCaptures) do
+ if (t [INDEX_NAME] == name) then
+ tremove (_detalhes.savedTimeCaptures, index)
+ return true
+ end
+ end
+ return false
+ end
+ end
+
+ --> cleanup when logout
+ function _detalhes:TimeDataCleanUpTemporary()
+ local new_table = {}
+ for index, t in ipairs (_detalhes.savedTimeCaptures) do
+ if (not t.do_not_save) then
+ tinsert (new_table, t)
+ end
+ end
+ _detalhes.savedTimeCaptures = new_table
end
- function _detalhes.timeContainer:Record()
-
- if (self.damage_recording > 0) then
- --> record damage
- local currentDamage = _detalhes.tabela_vigente.totals_grupo[1]
- local thisDamage = currentDamage - self.damageLast
- self.damage [self.timeIndex] = thisDamage
- if (thisDamage > self.damageMax) then
- self.damageMax = thisDamage
- end
- self.damageLast = currentDamage
- end
+ local tick_time = 0
+
+ --> starting a combat
+ function _detalhes:TimeDataCreateCombatTables()
- if (self.healing_recording > 0) then
- --> record healing
- local currentHealing = _detalhes.tabela_vigente.totals_grupo[2]
- self.healing [self.timeIndex] = currentHealing - self.healingLast
- if (currentHealing > self.healingMax) then
- self.healingMax = currentHealing
- end
- self.healingLast = currentHealing
- end
+ --> create capture table
+ local data_captured = {}
+
+ --> drop the last capture exec table without wiping
+ local exec = {}
+ _detalhes.timeContainer.Exec = exec
- if (self.have_custom) then
- --> record unknow, handled by function
- for customName, customFunction in _pairs (self.custom_functions) do
- if (customFunction) then
- customFunction (self.timeIndex, self [customName .. "Data"], self [customName .. "Attributes"])
+ --> build the exec table
+ for index, t in ipairs (_detalhes.savedTimeCaptures) do
+ if (t [INDEX_ENABLED]) then
+
+ local data = {}
+ data_captured [t [INDEX_NAME]] = data
+
+ if (type (t [INDEX_FUNCTION]) == "string") then
+ --> user
+ local func = loadstring (t [INDEX_FUNCTION])
+ if (func) then
+ tinsert (exec, { func = func, data = data, attributes = table_deepcopy (t [INDEX_MATRIX]), is_user = true })
+ end
+ else
+ --> plugin
+ tinsert (exec, { func = t [INDEX_FUNCTION], data = data, attributes = table_deepcopy (t [INDEX_MATRIX]) })
end
+
end
end
+
+ tick_time = 0
+
+ --> return the capture table the to combat object
+ return data_captured
+ end
+
+ local exec_user_func = function (func, attributes, data, this_second)
- self.timeIndex = self.timeIndex + 1
- end
\ No newline at end of file
+ local result = func()
+
+ local current = result - attributes.last_value
+ data [this_second] = current
+
+ if (current > attributes.max_value) then
+ attributes.max_value = current
+ data.max_value = current
+ end
+
+ attributes.last_value = result
+
+ end
+
+ function _detalhes:TimeDataTick()
+
+ tick_time = tick_time + 1
+
+ for index, t in ipairs (_detalhes.timeContainer.Exec) do
+
+ if (t.is_user) then
+ --> by a user
+ exec_user_func (t.func, t.attributes, t.data, tick_time)
+
+ else
+ --> by a plugin
+ t.func (t.attributes, t.data, tick_time)
+
+ end
+
+ end
+
+ end
+
+
\ No newline at end of file
diff --git a/gumps/janela_options.lua b/gumps/janela_options.lua
index 58f6be9e..89943539 100644
--- a/gumps/janela_options.lua
+++ b/gumps/janela_options.lua
@@ -5,6 +5,7 @@ local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
local LDB = LibStub ("LibDataBroker-1.1", true)
local LDBIcon = LDB and LibStub ("LibDBIcon-1.0", true)
+local tinsert = tinsert
local g = _detalhes.gump
local _
@@ -72,10 +73,9 @@ function _detalhes:OpenOptionsWindow (instance)
--background:SetTexCoord (0.0087890625, 0.8759765625, 0.0087890625, 0.578125)
background:SetTexCoord (0, 0.8759765625, 0, 0.578125)
- local bigdog = g:NewImage (window, [[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]], 180, 200, nil, nil, "backgroundBigDog", "$parentBackgroundBigDog")
+ local bigdog = g:NewImage (window, [[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]], 180, 200, nil, {1, 0, 0, 1}, "backgroundBigDog", "$parentBackgroundBigDog")
bigdog:SetPoint ("bottomright", window, "bottomright", -8, 31)
bigdog:SetAlpha (.15)
- bigdog:SetTexCoord (1, 0, 0, 1)
local window_icon = g:NewImage (window, [[Interface\AddOns\Details\images\options_window]], 58, 58, nil, nil, "windowicon", "$parentWindowIcon")
window_icon:SetPoint (17, -17)
@@ -129,6 +129,12 @@ function _detalhes:OpenOptionsWindow (instance)
info_text.valign = "^"
info_text.active = false
info_text.color = "white"
+
+ local desc_anchor = g:NewImage (window, [[Interface\AddOns\Details\images\options_window]], 75, 106, "artwork", {0.19921875, 0.2724609375, 0.6796875, 0.783203125}, "descAnchorImage", "$parentDescAnchorImage") --204 696 279 802
+ desc_anchor:SetPoint ("topleft", info_text, "topleft", -28, 33)
+
+ local desc_background = g:NewImage (window, [[Interface\AddOns\Details\images\options_window]], 253, 198, "artwork", {0.3193359375, 0.56640625, 0.685546875, 0.87890625}, "descBackgroundImage", "$parentDescBackgroundImage") -- 327 702 580 900
+ desc_background:SetPoint ("topleft", info_text, "topleft", 0, 0)
--> select instance dropbox
local onSelectInstance = function (_, _, instance)
@@ -312,35 +318,18 @@ function _detalhes:OpenOptionsWindow (instance)
--> left panel buttons
- local menu_indexes = {
- [1] = "General Settings",
- [2] = "General Settings",
- [13] = "General Settings",
- [3] = "Appearance",
- [4] = "Appearance",
- [5] = "Appearance",
- [6] = "Appearance",
- [7] = "Appearance",
- [8] = "Appearance",
- [9] = "Appearance",
- [14] = "Appearance",
- [10] = "Performance",
- [11] = "Performance",
- [12] = "Skins",
- }
-
local menus = { --labels nos menus
{"Display", "Combat", "Profiles"},
- {"Skin Selection", "Row Settings", "Row Texts and Extra Bars", "Window Settings", "Attribute Text", "Menus: Left Buttons", "Menus: Right Buttons", "Wallpaper"},
+ {"Skin Selection", "Row Settings", "Row Texts and Extra Bars", "Show & Hide Settings", "Window Settings", "Attribute Text", "Menus: Left Buttons", "Menus: Right Buttons", "Wallpaper"},
{"Performance Tweaks", "Data Collector"},
- {"Plugins Management"}
+ {"Plugins Management", "Spell Customization", "Data for Charts"}
}
-
+
local menus2 = {
"Display", "Combat",
"Skin Selection", "Row Settings", "Row Texts and Extra Bars", "Window Settings", "Menus: Left Buttons", "Menus: Right Buttons", "Wallpaper",
"Performance Tweaks", "Data Collector",
- "Plugins Management", "Profiles", "Attribute Text"
+ "Plugins Management", "Profiles", "Attribute Text", "Spell Customization", "Data for Charts", "Show & Hide Settings"
}
local select_options = function (options_type, true_index)
@@ -352,9 +341,16 @@ function _detalhes:OpenOptionsWindow (instance)
editing.text = menus2 [options_type]
-- ~altura
- if (options_type == 12) then
+ if (options_type == 12 or options_type == 15 or options_type == 16) then --plugins / spell custom / charts
window.options [12][1].slider:SetMinMaxValues (0, 320)
- info_text.text = ""
+ --info_text.text = ""
+ info_text:Hide()
+ window.descAnchorImage:Hide()
+ window.descBackgroundImage:Hide()
+ else
+ info_text:Show()
+ window.descAnchorImage:Show()
+ window.descBackgroundImage:Show()
end
end
@@ -399,21 +395,26 @@ function _detalhes:OpenOptionsWindow (instance)
g_performance_texture:SetTexCoord (0, 0.15625, 0.751953125, 0.7841796875)
g_performance_texture:SetPoint ("topleft", g_performance, "topleft", 0, 0)
- --plugins
- local g_plugin = g:NewButton (window, _, "$parentPluginButton", "g_plugin", 150, 33, function() end, 0x4)
+ --advanced
+ local g_advanced = g:NewButton (window, _, "$parentAdvancedButton", "g_advanced", 150, 33, function() end, 0x4)
- g:NewLabel (window, _, "$parentperplugins_settings_text", "PluginsSettingsLabel", Loc ["STRING_OPTIONS_PLUGINS"], "GameFontNormal", 12)
- window.PluginsSettingsLabel:SetPoint ("topleft", g_plugin, "topleft", 35, -11)
+ g:NewLabel (window, _, "$parentadvanced_settings_text", "AdvancedSettingsLabel", Loc ["STRING_OPTIONS_ADVANCED"], "GameFontNormal", 12)
+ window.AdvancedSettingsLabel:SetPoint ("topleft", g_advanced, "topleft", 35, -11)
- local g_performance_texture = g:NewImage (window, [[Interface\AddOns\Details\images\options_window]], 160, 33, nil, nil, "PluginsSettingsTexture", "$parentPluginsSettingsTexture")
- g_performance_texture:SetTexCoord (0, 0.15625, 0.78515625, 0.8173828125)
- g_performance_texture:SetPoint ("topleft", g_plugin, "topleft", 0, 0)
+ local g_advanced_texture = g:NewImage (window, [[Interface\AddOns\Details\images\options_window]], 160, 33, nil, nil, "AdvancedSettingsTexture", "$parentAdvancedSettingsTexture")
+ g_advanced_texture:SetTexCoord (0, 0.15625, 0.8173828125, 0.849609375)
+ g_advanced_texture:SetPoint ("topleft", g_advanced, "topleft", 0, 0)
+
+ -- advanced
- local menus_settings = {1, 2, 13, 3, 4, 5, 6, 14, 7, 8, 9, 10, 11, 12}
+
+ --> index dos menus
+ local menus_settings = {1, 2, 13, 3, 4, 5, 17, 6, 14, 7, 8, 9, 10, 11, 12, 15, 16}
+
--> create menus
- local anchors = {g_settings, g_appearance, g_performance, g_plugin}
- local y = -110
+ local anchors = {g_settings, g_appearance, g_performance, g_advanced}
+ local y = -90
local sub_menu_index = 1
local textcolor = {.8, .8, .8, 1}
@@ -460,7 +461,7 @@ function _detalhes:OpenOptionsWindow (instance)
texture:SetTexCoord (0.146484375, 0.591796875, 0.0546875, 0.26171875)
texture:SetPoint (38, y-2)
texture:SetVertexColor (1, 1, 1, .5)
-
+
local button = g:NewButton (window, _, "$parentButton_" .. index .. "_" .. i, nil, 150, 18, select_options, menus_settings [true_index], true_index, "", menus [index] [i])
button:SetPoint (40, y)
button.textalign = "<"
@@ -498,6 +499,9 @@ function _detalhes:OpenOptionsWindow (instance)
[12] = {},
[13] = {}, --profiles
[14] = {}, --attribute text
+ [15] = {}, --spellcustom
+ [16] = {}, --charts data
+ [17] = {}, --instance settings
} --> vai armazenar os frames das opções
@@ -609,6 +613,9 @@ function _detalhes:OpenOptionsWindow (instance)
table.insert (window.options [12], window:create_box (12))
table.insert (window.options [13], window:create_box_no_scroll (13))
table.insert (window.options [14], window:create_box_no_scroll (14))
+ table.insert (window.options [15], window:create_box_no_scroll (15))
+ table.insert (window.options [16], window:create_box_no_scroll (16))
+ table.insert (window.options [17], window:create_box_no_scroll (17))
function window:hide_all_options()
for _, frame in ipairs (window.options) do
@@ -705,7 +712,786 @@ function _detalhes:OpenOptionsWindow (instance)
end
select_options (1)
+
+ --[[
+ _detalhes.savedCustomSpells = {}
+ local a, _, b = GetSpellInfo (124464)
+ tinsert (_detalhes.savedCustomSpells, {124464, a, b})
+ local a, _, b = GetSpellInfo (124465)
+ tinsert (_detalhes.savedCustomSpells, {124465, a, b})
+ local a, _, b = GetSpellInfo (124468)
+ tinsert (_detalhes.savedCustomSpells, {1244684, a, b})
+--]]
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Advanced Settings - Chart Data ~17
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+function window:CreateFrame17()
+
+ local frame17 = window.options [17][1]
+
+ local titulo_instance_settings = g:NewLabel (frame17, _, "$parentTituloInstanceSettingsText", "InstanceSettingsLabel", Loc ["STRING_OPTIONS_SHOWHIDE"], "GameFontNormal", 16)
+ local titulo_instance_settings_desc = g:NewLabel (frame17, _, "$parentInstanceSettingsText2", "InstanceSettingsLabel", Loc ["STRING_OPTIONS_SHOWHIDE_DESC"], "GameFontNormal", 9, "white")
+ titulo_instance_settings_desc.width = 350
+ titulo_instance_settings_desc.height = 40
+
+ --> combat alpha modifier
+
+ --anchor
+ g:NewLabel (frame17, _, "$parentHideInCombatAnchor", "hideInCombatAnchor", "Combat and Group Alpha Mod:", "GameFontNormal")
+
+ --> hide in combat
+ g:NewLabel (frame17, _, "$parentCombatAlphaLabel", "combatAlphaLabel", Loc ["STRING_OPTIONS_COMBAT_ALPHA"], "GameFontHighlightLeft")
+
+ local onSelectCombatAlpha = function (_, _, combat_alpha)
+ _G.DetailsOptionsWindow.instance:SetCombatAlpha (combat_alpha)
+ end
+ local typeCombatAlpha = {
+ {value = 1, label = "No Changes", onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_03", texcoord = {1, 0, 0, 1}},
+ {value = 2, label = "While In Combat", onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = {1, 0, 0, 1}},
+ {value = 3, label = "While Out of Combat", onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = {1, 0, 0, 1}},
+ {value = 4, label = "While Out of a Group", onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = {1, 0, 0, 1}}
+ }
+ local buildTypeCombatAlpha = function()
+ return typeCombatAlpha
+ end
+ local d = g:NewDropDown (frame17, _, "$parentCombatAlphaDropdown", "combatAlphaDropdown", 160, 20, buildTypeCombatAlpha, nil)
+ d.onenter_backdrop = dropdown_backdrop_onenter
+ d.onleave_backdrop = dropdown_backdrop_onleave
+ d:SetBackdrop (dropdown_backdrop)
+ d:SetBackdropColor (unpack (dropdown_backdrop_onleave))
+
+ frame17.combatAlphaDropdown:SetPoint ("left", frame17.combatAlphaLabel, "right", 2, 0)
+
+ frame17.combatAlphaDropdown.info = Loc ["STRING_OPTIONS_COMBAT_ALPHA_DESC"]
+
+ window:create_line_background (frame17, frame17.combatAlphaLabel, frame17.combatAlphaDropdown)
+ frame17.combatAlphaDropdown:SetHook ("OnEnter", background_on_enter)
+ frame17.combatAlphaDropdown:SetHook ("OnLeave", background_on_leave)
+
+ g:NewLabel (frame17, _, "$parentHideOnCombatAlphaLabel", "hideOnCombatAlphaLabel", Loc ["STRING_OPTIONS_HIDECOMBATALPHA"], "GameFontHighlightLeft")
+
+ local s = g:NewSlider (frame17, _, "$parentHideOnCombatAlphaSlider", "hideOnCombatAlphaSlider", SLIDER_WIDTH, 20, 0, 100, 1, _G.DetailsOptionsWindow.instance.hide_in_combat_alpha) -- min, max, step, defaultv
+ s:SetBackdrop (slider_backdrop)
+ s:SetBackdropColor (unpack (slider_backdrop_color))
+ s:SetThumbSize (50)
+
+ frame17.hideOnCombatAlphaSlider:SetPoint ("left", frame17.hideOnCombatAlphaLabel, "right", 2, 0)
+ frame17.hideOnCombatAlphaSlider:SetHook ("OnValueChange", function (self, instance, amount) --> slider, fixedValue, sliderValue
+ instance.hide_in_combat_alpha = amount
+ _G.DetailsOptionsWindow.instance:SetCombatAlpha (nil, nil, true)
+ end)
+
+ frame17.hideOnCombatAlphaSlider.info = Loc ["STRING_OPTIONS_HIDECOMBATALPHA_DESC"]
+
+ window:create_line_background (frame17, frame17.hideOnCombatAlphaLabel, frame17.hideOnCombatAlphaSlider)
+ frame17.hideOnCombatAlphaSlider:SetHook ("OnEnter", background_on_enter)
+ frame17.hideOnCombatAlphaSlider:SetHook ("OnLeave", background_on_leave)
+
+ --> auto transparency
+ --> alpha onenter onleave auto transparency
+
+ g:NewLabel (frame17, _, "$parentMenuAlphaAnchor", "menuAlphaAnchorLabel", Loc ["STRING_OPTIONS_MENU_ALPHA"], "GameFontNormal")
+
+ g:NewSwitch (frame17, _, "$parentMenuOnEnterLeaveAlphaSwitch", "alphaSwitch", 60, 20, _, _, instance.menu_alpha.enabled)
+
+ local s = g:NewSlider (frame17, _, "$parentMenuOnEnterAlphaSlider", "menuOnEnterSlider", SLIDER_WIDTH, 20, 0, 1, 0.02, instance.menu_alpha.onenter, true)
+ s:SetBackdrop (slider_backdrop)
+ s:SetBackdropColor (unpack (slider_backdrop_color))
+ s:SetThumbSize (50)
+ s.useDecimals = true
+
+ local s = g:NewSlider (frame17, _, "$parentMenuOnLeaveAlphaSlider", "menuOnLeaveSlider", SLIDER_WIDTH, 20, 0, 1, 0.02, instance.menu_alpha.onleave, true)
+ s:SetBackdrop (slider_backdrop)
+ s:SetBackdropColor (unpack (slider_backdrop_color))
+ s:SetThumbSize (50)
+
+ frame17.menuOnEnterSlider.useDecimals = true
+ frame17.menuOnLeaveSlider.useDecimals = true
+
+ g:NewLabel (frame17, _, "$parentMenuOnEnterLeaveAlphaLabel", "alphaSwitchLabel", Loc ["STRING_OPTIONS_MENU_ALPHAENABLED"], "GameFontHighlightLeft")
+ g:NewLabel (frame17, _, "$parentMenuOnEnterAlphaLabel", "menuOnEnterLabel", Loc ["STRING_OPTIONS_MENU_ALPHAENTER"], "GameFontHighlightLeft")
+ g:NewLabel (frame17, _, "$parentMenuOnLeaveAlphaLabel", "menuOnLeaveLabel", Loc ["STRING_OPTIONS_MENU_ALPHALEAVE"], "GameFontHighlightLeft")
+
+ frame17.alphaSwitch.info = Loc ["STRING_OPTIONS_MENU_ALPHAENABLED_DESC"]
+ window:create_line_background (frame17, frame17.alphaSwitchLabel, frame17.alphaSwitch)
+ frame17.alphaSwitch:SetHook ("OnEnter", background_on_enter)
+ frame17.alphaSwitch:SetHook ("OnLeave", background_on_leave)
+
+ frame17.menuOnEnterSlider.info = Loc ["STRING_OPTIONS_MENU_ALPHAENTER_DESC"]
+ window:create_line_background (frame17, frame17.menuOnEnterLabel, frame17.menuOnEnterSlider)
+ frame17.menuOnEnterSlider:SetHook ("OnEnter", background_on_enter)
+ frame17.menuOnEnterSlider:SetHook ("OnLeave", background_on_leave)
+
+ frame17.menuOnLeaveSlider.info = Loc ["STRING_OPTIONS_MENU_ALPHALEAVE_DESC"]
+ window:create_line_background (frame17, frame17.menuOnLeaveLabel, frame17.menuOnLeaveSlider)
+ frame17.menuOnLeaveSlider:SetHook ("OnEnter", background_on_enter)
+ frame17.menuOnLeaveSlider:SetHook ("OnLeave", background_on_leave)
+
+ frame17.alphaSwitch:SetPoint ("left", frame17.alphaSwitchLabel, "right", 2)
+ frame17.menuOnEnterSlider:SetPoint ("left", frame17.menuOnEnterLabel, "right", 2)
+ frame17.menuOnLeaveSlider:SetPoint ("left", frame17.menuOnLeaveLabel, "right", 2)
+
+ frame17.menuOnEnterSlider:SetThumbSize (50)
+ frame17.menuOnLeaveSlider:SetThumbSize (50)
+
+
+ g:NewLabel (frame17, _, "$parentMenuOnEnterLeaveAlphaIconsTooLabel", "alphaIconsTooLabel", Loc ["STRING_OPTIONS_MENU_IGNOREBARS"], "GameFontHighlightLeft")
+ g:NewSwitch (frame17, _, "$parentMenuOnEnterLeaveAlphaIconsTooSwitch", "alphaIconsTooSwitch", 60, 20, _, _, instance.menu_alpha.ignorebars)
+
+ frame17.alphaIconsTooSwitch.info = Loc ["STRING_OPTIONS_MENU_IGNOREBARS_DESC"]
+ window:create_line_background (frame17, frame17.alphaIconsTooLabel, frame17.alphaIconsTooSwitch)
+ frame17.alphaIconsTooSwitch:SetHook ("OnEnter", background_on_enter)
+ frame17.alphaIconsTooSwitch:SetHook ("OnLeave", background_on_leave)
+
+ frame17.alphaIconsTooSwitch:SetPoint ("left", frame17.alphaIconsTooLabel, "right", 2)
+
+ frame17.alphaIconsTooSwitch.OnSwitch = function (self, instance, value)
+ instance:SetMenuAlpha (nil, nil, nil, value)
+ end
+ frame17.alphaSwitch.OnSwitch = function (self, instance, value)
+ --
+ instance:SetMenuAlpha (value)
+ end
+ frame17.menuOnEnterSlider:SetHook ("OnValueChange", function (self, instance, value)
+ --
+ self.amt:SetText (string.format ("%.2f", value))
+ instance:SetMenuAlpha (nil, value)
+ return true
+ end)
+ frame17.menuOnLeaveSlider:SetHook ("OnValueChange", function (self, instance, value)
+ --
+ self.amt:SetText (string.format ("%.2f", value))
+ instance:SetMenuAlpha (nil, nil, value)
+ return true
+ end)
+
+
+ --> auto hide menus
+
+
+
+ --> anchors
+ titulo_instance_settings:SetPoint (10, -10)
+ titulo_instance_settings_desc:SetPoint (10, -30)
+
+ frame17.hideInCombatAnchor:SetPoint (10, -80)
+ frame17.combatAlphaLabel:SetPoint (10, -105)
+ frame17.hideOnCombatAlphaLabel:SetPoint (10, -130)
+
+ frame17.menuAlphaAnchorLabel:SetPoint (10, -165)
+ frame17.alphaSwitchLabel:SetPoint (10, -190)
+ frame17.menuOnEnterLabel:SetPoint (10, -215)
+ frame17.menuOnLeaveLabel:SetPoint (10, -240)
+ frame17.alphaIconsTooLabel:SetPoint (10, -265)
+end
+
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Advanced Settings - Chart Data ~16
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+function window:CreateFrame16()
+
+ --> general settings:
+ local frame16 = window.options [16][1]
+
+ --> title
+ local titulo_datacharts = g:NewLabel (frame16, _, "$parentTituloDataChartsText", "DataChartsLabel", Loc ["STRING_OPTIONS_DATACHARTTITLE"], "GameFontNormal", 16)
+ local titulo_datacharts_desc = g:NewLabel (frame16, _, "$parentDataChartsText2", "DataCharts2Label", Loc ["STRING_OPTIONS_DATACHARTTITLE_DESC"], "GameFontNormal", 9, "white")
+ titulo_datacharts_desc.width = 350
+
+ --> panel
+ local edit_name = function (index, name)
+ _detalhes:TimeDataUpdate (index, name)
+ frame16.userTimeCaptureFillPanel:Refresh()
+ end
+
+ local big_code_editor = g:NewSpecialLuaEditorEntry (frame16, 643, 382, "bigCodeEditor", "$parentBigCodeEditor")
+ big_code_editor:SetPoint ("topleft", frame16, "topleft", 7, -70)
+ big_code_editor:SetFrameLevel (frame16:GetFrameLevel()+6)
+ big_code_editor:SetBackdrop ({bgFile = [[Interface\AddOns\Details\images\background]], edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
+ tile = 1, tileSize = 16, edgeSize = 16, insets = {left = 5, right = 5, top = 5, bottom = 5}})
+ big_code_editor:SetBackdropColor (0, 0, 0, 1)
+ big_code_editor:Hide()
+
+ local accept = function()
+ big_code_editor:ClearFocus()
+ if (not big_code_editor.is_export) then
+ _detalhes:TimeDataUpdate (big_code_editor.index, nil, big_code_editor:GetText())
+ end
+ big_code_editor:Hide()
+ end
+ local cancel = function()
+ big_code_editor:ClearFocus()
+ big_code_editor:Hide()
+ end
+ local accept_changes = g:NewButton (big_code_editor, nil, "$parentAccept", "acceptButton", 24, 24, accept, nil, nil, [[Interface\Buttons\UI-CheckBox-Check]])
+ accept_changes:SetPoint (10, 18)
+ local accept_changes_label = g:NewLabel (big_code_editor, nil, nil, nil, "Save")
+ accept_changes_label:SetPoint ("left", accept_changes, "right", 2, 0)
+
+ local cancel_changes = g:NewButton (big_code_editor, nil, "$parentCancel", "CancelButton", 20, 20, cancel, nil, nil, [[Interface\PetBattles\DeadPetIcon]])
+ cancel_changes:SetPoint (100, 17)
+ local cancel_changes_label = g:NewLabel (big_code_editor, nil, nil, nil, "Cancel")
+ cancel_changes_label:SetPoint ("left", cancel_changes, "right", 2, 0)
+
+ local edit_code = function (index)
+ local data = _detalhes.savedTimeCaptures [index]
+ if (data) then
+ local func = data [2]
+
+ if (type (func) == "function") then
+ return _detalhes:Msg ("The code is already loaded and cannot be displayed.")
+ end
+
+ big_code_editor:SetText (func)
+ big_code_editor.original_code = func
+ big_code_editor.index = index
+ big_code_editor.is_export = nil
+ big_code_editor:Show()
+
+ frame16.userTimeCaptureAddPanel:Hide()
+ frame16.importEditor:ClearFocus()
+ frame16.importEditor:Hide()
+ if (DetailsIconPickFrame and DetailsIconPickFrame:IsShown()) then
+ DetailsIconPickFrame:Hide()
+ end
+ end
+ end
+
+ local edit_icon = function (index, icon)
+ _detalhes:TimeDataUpdate (index, nil, nil, nil, nil, nil, icon)
+ frame16.userTimeCaptureFillPanel:Refresh()
+ end
+ local edit_author = function (index, author)
+ _detalhes:TimeDataUpdate (index, nil, nil, nil, author)
+ frame16.userTimeCaptureFillPanel:Refresh()
+ end
+ local edit_version = function (index, version)
+ _detalhes:TimeDataUpdate (index, nil, nil, nil, nil, version)
+ frame16.userTimeCaptureFillPanel:Refresh()
+ end
+
+ local big_code_editor2 = g:NewSpecialLuaEditorEntry (frame16, 643, 382, "exportEditor", "$parentExportEditor", true)
+ big_code_editor2:SetPoint ("topleft", frame16, "topleft", 7, -70)
+ big_code_editor2:SetFrameLevel (frame16:GetFrameLevel()+6)
+ big_code_editor2:SetBackdrop ({bgFile = [[Interface\AddOns\Details\images\background]], edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
+ tile = 1, tileSize = 16, edgeSize = 16, insets = {left = 5, right = 5, top = 5, bottom = 5}})
+ big_code_editor2:SetBackdropColor (0, 0, 0, 1)
+ big_code_editor2:Hide()
+
+ local close_export_box = function()
+ big_code_editor2:ClearFocus()
+ big_code_editor2:Hide()
+ end
+ local close_export = g:NewButton (big_code_editor2, nil, "$parentClose", "closeButton", 24, 24, close_export_box, nil, nil, [[Interface\Buttons\UI-CheckBox-Check]])
+ close_export:SetPoint (10, 18)
+ local close_export_label = g:NewLabel (big_code_editor2, nil, nil, nil, "Close")
+ close_export_label:SetPoint ("left", close_export, "right", 2, 0)
+
+ local export_function = function (index)
+ local data = _detalhes.savedTimeCaptures [index]
+ if (data) then
+ local serialized = _detalhes:Serialize (data)
+ --serialized = LibStub:GetLibrary ("LibCompress"):CompressLZW (serialized)
+ --local serialized = LibStub:GetLibrary ("LibCompress"):Compress (func)
+
+ big_code_editor2:SetText (serialized)
+
+ big_code_editor2:Show()
+ big_code_editor2.editbox:HighlightText()
+ big_code_editor2.editbox:SetFocus (true)
+
+ end
+ end
+
+ local remove_capture = function (index)
+ _detalhes:TimeDataUnregister (index)
+ frame16.userTimeCaptureFillPanel:Refresh()
+ end
+
+ local edit_enabled = function (index, enabled)
+ if (enabled) then
+ _detalhes:TimeDataUpdate (index, nil, nil, nil, nil, nil, nil, false)
+ else
+ _detalhes:TimeDataUpdate (index, nil, nil, nil, nil, nil, nil, true)
+ end
+
+ frame16.userTimeCaptureFillPanel:Refresh()
+ end
+
+ local header = {
+ {name = "Name", width = 175, type = "entry", func = edit_name},
+ {name = "Edit Code", width = 55, type = "button", func = edit_code, icon = [[Interface\Buttons\UI-GuildButton-OfficerNote-Disabled]], notext = true, iconalign = "center"},
+ {name = "Icon", width = 50, type = "icon", func = edit_icon},
+ {name = "Author", width = 125, type = "text", func = edit_author},
+ {name = "Version", width = 65, type = "entry", func = edit_version},
+ {name = "Enabled", width = 50, type = "button", func = edit_enabled, icon = [[Interface\COMMON\Indicator-Green]], notext = true, iconalign = "center"},
+ {name = "Export", width = 50, type = "button", func = export_function, icon = [[Interface\Buttons\UI-GuildButton-PublicNote-Up]], notext = true, iconalign = "center"},
+ {name = "Remove", width = 70, type = "button", func = remove_capture, icon = [[Interface\COMMON\VOICECHAT-MUTED]], notext = true, iconalign = "center"},
+ }
+
+ local total_lines = function()
+ return #_detalhes.savedTimeCaptures
+ end
+ local fill_row = function (index)
+ local data = _detalhes.savedTimeCaptures [index]
+ if (data) then
+
+ local enabled_texture
+ if (data[7]) then
+ enabled_texture = [[Interface\COMMON\Indicator-Green]]
+ else
+ enabled_texture = [[Interface\COMMON\Indicator-Red]]
+ end
+
+ return {
+ data[1], --name
+ "", --func
+ data[6], --icon
+ data[4], -- author
+ data[5], --version
+ {func = edit_enabled, icon = enabled_texture, value = data[7]} --enabled
+ }
+ else
+ return {nil, nil, nil, nil, nil, nil}
+ end
+ end
+
+ local panel = g:NewFillPanel (frame16, header, "$parentUserTimeCapturesFillPanel", "userTimeCaptureFillPanel", 640, 382, total_lines, fill_row, false)
+
+ panel:SetHook ("OnMouseDown", function()
+ if (DetailsIconPickFrame and DetailsIconPickFrame:IsShown()) then
+ DetailsIconPickFrame:Hide()
+ end
+ end)
+
+ panel:Refresh()
+
+ --> add panel
+ local addframe = g:NewPanel (frame16, nil, "$parentUserTimeCapturesAddPanel", "userTimeCaptureAddPanel", 640, 382)
+ addframe.backdrop = {bgFile = [[Interface\AddOns\Details\images\background]]}
+ addframe.color = "black"
+ addframe:SetPoint (10, -70)
+ addframe:SetFrameLevel (7)
+ addframe:Hide()
+
+ addframe:SetGradient ("OnEnter", {0, 0, 0, .95})
+ addframe:SetGradient ("OnLeave", {0, 0, 0, .95})
+ addframe:SetBackdropColor (0, 0, 0, .95)
+
+ --> name
+ local capture_name = g:NewLabel (addframe, nil, "$parentNameLabel", "nameLabel", "Name: ")
+ local capture_name_entry = g:NewTextEntry (addframe, nil, "$parentNameEntry", "nameEntry", 160, 20, function() end)
+ capture_name_entry:SetPoint ("left", capture_name, "right", 2, 0)
+
+ --> function
+ local capture_func = g:NewLabel (addframe, nil, "$parentFunctionLabel", "functionLabel", "Code: ")
+ local capture_func_entry = g:NewSpecialLuaEditorEntry (addframe.widget, 300, 200, "funcEntry", "$parentFuncEntry")
+ capture_func_entry:SetPoint ("topleft", capture_func.widget, "topright", 2, 0)
+ capture_func_entry:SetSize (500, 200)
+
+ --> icon
+ local capture_icon = g:NewLabel (addframe, nil, "$parentIconLabel", "iconLabel", "Icon: ")
+ local icon_button_func = function (texture)
+ addframe.iconButton.icon.texture = texture
+ end
+ local capture_icon_button = g:NewButton (addframe, nil, "$parentIconButton", "iconButton", 20, 20, function() g:IconPick (icon_button_func) end)
+ local capture_icon_button_icon = g:NewImage (capture_icon_button, [[Interface\ICONS\TEMP]], 19, 19, "background", nil, "icon", "$parentIcon")
+ capture_icon_button_icon:SetPoint (0, 0)
+ capture_icon_button:InstallCustomTexture()
+ capture_icon_button:SetPoint ("left", capture_icon, "right", 2, 0)
+
+ --> author
+ local capture_author = g:NewLabel (addframe, nil, "$parentAuthorLabel", "authorLabel", "Author: ")
+ local capture_author_entry = g:NewTextEntry (addframe, nil, "$parentAuthorEntry", "authorEntry", 160, 20, function() end)
+ capture_author_entry:SetPoint ("left", capture_author, "right", 2, 0)
+
+ --> version
+ local capture_version = g:NewLabel (addframe, nil, "$parentVersionLabel", "versionLabel", "Version: ")
+ local capture_version_entry = g:NewTextEntry (addframe, nil, "$parentVersionEntry", "versionEntry", 160, 20, function() end)
+ capture_version_entry:SetPoint ("left", capture_version, "right", 2, 0)
+
+ --> open add panel button
+ local add = function()
+ addframe:Show()
+ frame16.importEditor:ClearFocus()
+ frame16.importEditor:Hide()
+ big_code_editor:ClearFocus()
+ big_code_editor:Hide()
+ if (DetailsIconPickFrame and DetailsIconPickFrame:IsShown()) then
+ DetailsIconPickFrame:Hide()
+ end
+ end
+ local addbutton = g:NewButton (frame16, nil, "$parentAddButton", "addbutton", 135, 21, add, nil, nil, nil, "Add Data Capture")
+ addbutton:InstallCustomTexture()
+ addbutton:SetPoint ("bottomright", panel, "topright", -30, 0)
+
+ local left = g:NewImage (frame16, "Interface\\PaperDollInfoFrame\\PaperDollSidebarTabs", 64, 13, "artwork", {0, 1, 0, 0.05078125})
+ left:SetPoint ("bottomright", addbutton, "bottomleft", 34, 0)
+ left:SetBlendMode ("ADD")
+ left:Hide()
+ local right = g:NewImage (frame16, "Interface\\PaperDollInfoFrame\\PaperDollSidebarTabs", 64, 13, "artwork", {0, 1, 0.0546875, 0.1015625})
+ right:SetPoint ("bottomleft", addbutton, "bottomright", 0, 0)
+ right:SetBlendMode ("ADD")
+
+ --> open import panel button
+
+ local importframe = g:NewSpecialLuaEditorEntry (frame16, 643, 382, "importEditor", "$parentImportEditor", true)
+ importframe:SetPoint ("topleft", frame16, "topleft", 7, -70)
+ importframe:SetFrameLevel (frame16:GetFrameLevel()+6)
+ importframe:SetBackdrop ({bgFile = [[Interface\AddOns\Details\images\background]], edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
+ tile = 1, tileSize = 16, edgeSize = 16, insets = {left = 5, right = 5, top = 5, bottom = 5}})
+ importframe:SetBackdropColor (0, 0, 0, 1)
+ importframe:Hide()
+
+ local doimport = function()
+ local text = importframe:GetText()
+ local unserialize, arg2, arg3 = select (2, _detalhes:Deserialize (text))
+
+ if (type (unserialize) == "table") then
+ if (unserialize[1] and unserialize[2] and unserialize[3] and unserialize[4] and unserialize[5]) then
+ _detalhes:RegisterUserTimeCapture (unpack (unserialize))
+ else
+ _detalhes:Msg ("The import string is invalid.")
+ end
+ else
+ _detalhes:Msg ("The import string is invalid.")
+ end
+
+ importframe:Hide()
+ panel:Refresh()
+ end
+
+ local accept_import = g:NewButton (importframe, nil, "$parentAccept", "acceptButton", 24, 24, doimport, nil, nil, [[Interface\Buttons\UI-CheckBox-Check]])
+ accept_import:SetPoint (10, 18)
+ local accept_import_label = g:NewLabel (importframe, nil, nil, nil, "Import")
+ accept_import_label:SetPoint ("left", accept_import, "right", 2, 0)
+
+ local cancelimport = function()
+ importframe:ClearFocus()
+ importframe:Hide()
+ end
+
+ local cancel_changes = g:NewButton (importframe, nil, "$parentCancel", "CancelButton", 20, 20, cancelimport, nil, nil, [[Interface\PetBattles\DeadPetIcon]])
+ cancel_changes:SetPoint (100, 17)
+ local cancel_changes_label = g:NewLabel (importframe, nil, nil, nil, "Cancel")
+ cancel_changes_label:SetPoint ("left", cancel_changes, "right", 2, 0)
+
+ local import = function()
+ importframe:Show()
+ importframe:SetText ("")
+ importframe:SetFocus (true)
+ addframe:Hide()
+ big_code_editor:ClearFocus()
+ big_code_editor:Hide()
+ if (DetailsIconPickFrame and DetailsIconPickFrame:IsShown()) then
+ DetailsIconPickFrame:Hide()
+ end
+ end
+ local importbutton = g:NewButton (frame16, nil, "$parentImportButton", "importbutton", 75, 21, import, nil, nil, nil, "Import")
+ importbutton:InstallCustomTexture()
+ importbutton:SetPoint ("bottomright", panel, "topright", -165, 0)
+
+ local left = g:NewImage (frame16, "Interface\\PaperDollInfoFrame\\PaperDollSidebarTabs", 64, 13, "artwork", {0, 1, 0, 0.05078125})
+ left:SetPoint ("bottomright", importbutton, "bottomleft", 34, 0)
+ left:SetBlendMode ("ADD")
+ local right = g:NewImage (frame16, "Interface\\PaperDollInfoFrame\\PaperDollSidebarTabs", 64, 13, "artwork", {0, 1, 0.0546875, 0.1015625})
+ right:SetPoint ("bottomleft", importbutton, "bottomright", 0, 0)
+ right:SetBlendMode ("ADD")
+ right:Hide()
+
+ --> close button
+ local closebutton = g:NewButton (addframe, nil, "$parentAddCloseButton", "addClosebutton", 135, 21, function() addframe:Hide() end, nil, nil, nil, "Close")
+ closebutton:InstallCustomTexture()
+
+ --> confirm add capture
+ local addcapture = function()
+ local name = capture_name_entry.text
+ if (name == "") then
+ return _detalhes:Msg ("The name is invalid.")
+ end
+
+ local author = capture_author_entry.text
+ if (author == "") then
+ return _detalhes:Msg ("Author name is invalid.")
+ end
+
+ local icon = capture_icon_button_icon.texture
+
+ local version = capture_version_entry.text
+ if (version == "") then
+ return _detalhes:Msg ("Version is invalid.")
+ end
+
+ local func = capture_func_entry:GetText()
+ if (func == "") then
+ return _detalhes:Msg ("Function is invalid.")
+ end
+
+ _detalhes:RegisterUserTimeCapture (name, func, icon, author, version)
+
+ panel:Refresh()
+
+ capture_name_entry.text = ""
+ capture_author_entry.text = ""
+ capture_version_entry.text = ""
+ capture_func_entry:SetText ("")
+ capture_icon_button_icon.texture = [[Interface\ICONS\TEMP]]
+
+ if (DetailsIconPickFrame and DetailsIconPickFrame:IsShown()) then
+ DetailsIconPickFrame:Hide()
+ end
+ addframe:Hide();
+
+ end
+ local addcapturebutton = g:NewButton (addframe, nil, "$parentAddCaptureButton", "addCapturebutton", 135, 21, addcapture, nil, nil, nil, "Add")
+ addcapturebutton:InstallCustomTexture()
+
+ --> anchors
+ local start = 25
+ capture_name:SetPoint (start, -30)
+ capture_icon:SetPoint (start, -55)
+ capture_author:SetPoint (start, -80)
+ capture_version:SetPoint (start, -105)
+ capture_func:SetPoint (start, -130)
+ closebutton:SetPoint ("bottomright", addframe, "bottomright", 0, 0)
+ addcapturebutton:SetPoint (50, -360)
+
+ --> anchors
+
+ titulo_datacharts:SetPoint (10, -10)
+ titulo_datacharts_desc:SetPoint (10, -30)
+
+ panel:SetPoint (10, -70)
+end
+
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Advanced Settings - Custom Spells ~15
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+function window:CreateFrame15()
+
+ --> general settings:
+ local frame15 = window.options [15][1]
+
+ --> title
+ local titulo_customspells = g:NewLabel (frame15, _, "$parentTituloCustomSpellsText", "customSpellsTextLabel", Loc ["STRING_OPTIONS_CUSTOMSPELLTITLE"], "GameFontNormal", 16)
+ local titulo_customspells_desc = g:NewLabel (frame15, _, "$parentCustomSpellsText2", "customSpellsText2Label", Loc ["STRING_OPTIONS_CUSTOMSPELLTITLE_DESC"], "GameFontNormal", 9, "white")
+ titulo_customspells_desc.width = 350
+
+ local name_entry_func = function (index, text)
+ _detalhes:UserCustomSpellUpdate (index, text)
+ end
+ local icon_func = function (index, icon)
+ _detalhes:UserCustomSpellUpdate (index, nil, icon)
+ end
+ local remove_func = function (index)
+ _detalhes:UserCustomSpellRemove (index)
+ end
+
+ --> custom spells panel
+ local header = {
+ {name = "Index", width = 55, type = "text"},
+ {name = "Name", width = 310, type = "entry", func = name_entry_func},
+ {name = "Icon", width = 50, type = "icon", func = icon_func},
+ {name = "Spell ID", width = 100, type = "text"},
+ {name = "Remove", width = 125, type = "button", func = remove_func, icon = [[Interface\COMMON\VOICECHAT-MUTED]]},
+ }
+ --local header = {{name = "Index", type = "text"}, {name = "Name", type = "entry"}, {name = "Icon", type = "icon"}, {name = "Author", type = "text"}, {name = "Version", type = "text"}}
+
+ local total_lines = function()
+ return #_detalhes.savedCustomSpells
+ end
+ local fill_row = function (index)
+ local data = _detalhes.savedCustomSpells [index]
+ if (data) then
+ return {index, data [2], data [3], data [1], ""}
+ else
+ return {nil, nil, nil, nil, nil}
+ end
+ end
+
+ local panel = g:NewFillPanel (frame15, header, "$parentCustomSpellsFillPanel", "customSpellsFillPanel", 640, 382, total_lines, fill_row, false)
+
+ panel:Refresh()
+
+ --> add
+
+ --> add panel
+ local addframe = g:NewPanel (frame15, nil, "$parentCustomSpellsAddPanel", "customSpellsAddPanel", 640, 382)
+ addframe.backdrop = {bgFile = [[Interface\AddOns\Details\images\background]]}
+ addframe.color = "black"
+ addframe:SetPoint (10, -70)
+ addframe:SetFrameLevel (7)
+ addframe:Hide()
+
+ addframe:SetGradient ("OnEnter", {0, 0, 0, .95})
+ addframe:SetGradient ("OnLeave", {0, 0, 0, .95})
+ addframe:SetBackdropColor (0, 0, 0, .95)
+
+ local desc = "A ID is a unique number to identify the spell inside World of Warcraft. There is many ways to get the number:\n\n- On the Player Details Window, hold shift while hover over spells bars.\n- Type the spell name in the SpellId field, a tooltip is shown with suggested spells.\n- Community web sites, most of them have the spellid on the address link.\n- Browsing the spell cache below:"
+ local desc_spellid = g:NewLabel (addframe, nil, "$parentSpellidDescLabel", "spellidDescLabel", desc)
+
+ local spellid = g:NewLabel (addframe, nil, "$parentSpellidLabel", "spellidLabel", "SpellId: ")
+ local spellname = g:NewLabel (addframe, nil, "$parentSpellnameLabel", "spellnameLabel", "Custom Name: ")
+ local spellicon = g:NewLabel (addframe, nil, "$parentSpelliconLabel", "spelliconLabel", "Custom Icon: ")
+
+ local spellname_entry_func = function() end
+ local spellname_entry = g:NewTextEntry (addframe, nil, "$parentSpellnameEntry", "spellnameEntry", 160, 20, spellname_entry_func)
+ spellname_entry:SetPoint ("left", spellname, "right", 2, 0)
+
+ local spellid_entry_func = function (arg1, arg2, spellid)
+ local spellname, _, icon = GetSpellInfo (spellid)
+ if (spellname) then
+ spellname_entry:SetText (spellname)
+ addframe.spellIconButton.icon.texture = icon
+ else
+ _detalhes:Msg ("Spell not found.")
+ end
+ end
+ local spellid_entry = g:NewSpellEntry (addframe, spellid_entry_func, 160, 20, nil, nil, "spellidEntry", "$parentSpellidEntry")
+ spellid_entry:SetPoint ("left", spellid, "right", 2, 0)
+
+
+ local icon_button_func = function (texture)
+ addframe.spellIconButton.icon.texture = texture
+ end
+ local icon_button = g:NewButton (addframe, nil, "$parentSpellIconButton", "spellIconButton", 20, 20, function() g:IconPick (icon_button_func) end)
+ local icon_button_icon = g:NewImage (icon_button, [[Interface\ICONS\TEMP]], 19, 19, "background", nil, "icon", "$parentSpellIcon")
+ icon_button_icon:SetPoint (0, 0)
+ icon_button:InstallCustomTexture()
+ icon_button:SetPoint ("left", spellicon, "right", 2, 0)
+
+ local all_cached_spells = {}
+
+ local refresh_cache = function (self)
+
+ local offset = FauxScrollFrame_GetOffset (self)
+ local total = #all_cached_spells
+
+ for index = 1, #self.lines1 do
+
+ local label1 = self.lines1 [index]
+ local label2 = self.lines2 [index]
+
+ local data = all_cached_spells [index + offset]
+
+ if (data) then
+ label1.text = data [1]
+ label2.text = data [2]
+ else
+ label1.text = ""
+ label2.text = ""
+ end
+
+ end
+
+ end
+ local scrollframe = CreateFrame ("scrollframe", "SpellCacheBrowserFrame", addframe.widget, "FauxScrollFrameTemplate")
+ scrollframe:SetScript ("OnVerticalScroll", function (self, offset) FauxScrollFrame_OnVerticalScroll (self, offset, 10, refresh_cache) end)
+ scrollframe:SetSize (250, 140)
+ scrollframe.lines1 = {}
+ scrollframe.lines2 = {}
+ scrollframe:SetBackdrop ({bgFile = [[Interface\AddOns\Details\images\background]], edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = true, edgeSize = 8, tileSize = 5})
+
+ for i = 1, 10 do
+ local label1 = g:NewLabel (scrollframe, nil, "$parentLabel1" .. i, nil)
+ local label2 = g:NewLabel (scrollframe, nil, "$parentLabel2" .. i, nil)
+ local y = (i-1) * 13 * -1 - 5
+ label1:SetPoint (3, y)
+ label2:SetPoint (70, y)
+ tinsert (scrollframe.lines1, label1)
+ tinsert (scrollframe.lines2, label2)
+ end
+
+ --> close button
+ local closebutton = g:NewButton (addframe, nil, "$parentAddCloseButton", "addClosebutton", 135, 21, function() addframe:Hide(); table.wipe (all_cached_spells) end, nil, nil, nil, "Close")
+ closebutton:InstallCustomTexture()
+
+ --> confirm add spell
+ local addspell = function()
+ local id = spellid_entry.text
+ if (id == "") then
+ return _detalhes:Msg ("Spell id invalid.")
+ end
+ local name = spellname_entry.text
+ if (name == "") then
+ return _detalhes:Msg ("Spell name invalid.")
+ end
+ local icon = addframe.spellIconButton.icon.texture
+
+ id = tonumber (id)
+ if (not id) then
+ return _detalhes:Msg ("Spell id invalid.")
+ end
+
+ _detalhes:UserCustomSpellAdd (id, name, icon)
+
+ panel:Refresh()
+
+ spellid_entry.text = ""
+ spellname_entry.text = ""
+ addframe.spellIconButton.icon.texture = [[Interface\ICONS\TEMP]]
+
+ if (DetailsIconPickFrame and DetailsIconPickFrame:IsShown()) then
+ DetailsIconPickFrame:Hide()
+ end
+ addframe:Hide();
+ table.wipe (all_cached_spells)
+ end
+ local addspellbutton = g:NewButton (addframe, nil, "$parentAddSpellButton", "addSpellbutton", 135, 21, addspell, nil, nil, nil, "Add")
+ addspellbutton:InstallCustomTexture()
+
+ closebutton:SetPoint ("bottomright", addframe, "bottomright", 0, 0)
+ desc_spellid:SetPoint (50, -30)
+ scrollframe:SetPoint ("topleft", addframe.widget, "topleft", 50, -110)
+ spellid:SetPoint (50, -285)
+ spellname:SetPoint (50, -310)
+ spellicon:SetPoint (50, -335)
+ addspellbutton:SetPoint (50, -360)
+
+ scrollframe:Show()
+
+ local update_cache_scroll = function()
+
+ table.wipe (all_cached_spells)
+
+ for spellid, t in pairs (_detalhes.spellcache) do
+ tinsert (all_cached_spells, {spellid, t[1]})
+ end
+
+ table.sort (all_cached_spells, function (t1, t2) local a = t1 and t1[2] or "z"; local b = t2 and t2[2] or "z"; return a < b end)
+
+ FauxScrollFrame_Update (scrollframe, math.max (11, #all_cached_spells), 10, 12)
+ refresh_cache (scrollframe)
+ end
+
+
+
+ --> open add panel button
+ local add = function()
+ update_cache_scroll()
+ addframe:Show()
+ end
+ local addbutton = g:NewButton (frame15, nil, "$parentAddButton", "addbutton", 135, 21, add, nil, nil, nil, "Add Spell")
+ addbutton:InstallCustomTexture()
+ addbutton:SetPoint ("bottomright", panel, "topright", -30, 0)
+
+ local left = g:NewImage (frame15, "Interface\\PaperDollInfoFrame\\PaperDollSidebarTabs", 64, 13, "artwork", {0, 1, 0, 0.05078125})
+ left:SetPoint ("bottomright", addbutton, "bottomleft", 34, 0)
+ left:SetBlendMode ("ADD")
+ local right = g:NewImage (frame15, "Interface\\PaperDollInfoFrame\\PaperDollSidebarTabs", 64, 13, "artwork", {0, 1, 0.0546875, 0.1015625})
+ right:SetPoint ("bottomleft", addbutton, "bottomright", 0, 0)
+ right:SetBlendMode ("ADD")
+
+ --> anchors
+
+ titulo_customspells:SetPoint (10, -10)
+ titulo_customspells_desc:SetPoint (10, -30)
+
+ panel:SetPoint (10, -70)
+end
+
+
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- General Settings - Display ~14
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -1184,8 +1970,8 @@ function window:CreateFrame2()
_detalhes:AtualizaGumpPrincipal (-1, true)
end
local timetypeOptions = {
- {value = 1, label = "Activity Time", onclick = onSelectTimeType, icon = "Interface\\Icons\\INV_Misc_PocketWatch_01"}, --, desc = ""
- {value = 2, label = "Effective Time", onclick = onSelectTimeType, icon = "Interface\\Icons\\INV_Misc_Gear_03"} --, desc = ""
+ {value = 1, label = "Activity Time", onclick = onSelectTimeType, icon = "Interface\\Icons\\Achievement_Quests_Completed_Daily_08", iconcolor = {1, .9, .9}, texcoord = {0.078125, 0.921875, 0.078125, 0.921875}}, --, desc = ""
+ {value = 2, label = "Effective Time", onclick = onSelectTimeType, icon = "Interface\\Icons\\Achievement_Quests_Completed_08"} --, desc = ""
}
local buildTimeTypeMenu = function()
return timetypeOptions
@@ -1204,37 +1990,6 @@ function window:CreateFrame2()
frame2.timetypeDropdown:SetHook ("OnEnter", background_on_enter)
frame2.timetypeDropdown:SetHook ("OnLeave", background_on_leave)
- --> hide in combat
- g:NewLabel (frame2, _, "$parentHideOnCombatLabel", "hideOnCombatLabel", Loc ["STRING_OPTIONS_HIDECOMBAT"], "GameFontHighlightLeft")
- g:NewLabel (frame2, _, "$parentHideOnCombatAlphaLabel", "hideOnCombatAlphaLabel", Loc ["STRING_OPTIONS_HIDECOMBATALPHA"], "GameFontHighlightLeft")
-
- g:NewSwitch (frame2, _, "$parentHideOnCombatSlider", "hideOnCombatSlider", 60, 20, _, _, _G.DetailsOptionsWindow.instance.hide_in_combat)
- frame2.hideOnCombatSlider:SetPoint ("left", frame2.hideOnCombatLabel, "right", 2, 0)
- frame2.hideOnCombatSlider.OnSwitch = function (self, instance, value)
- instance.hide_in_combat = value
- end
-
- local s = g:NewSlider (frame2, _, "$parentHideOnCombatAlphaSlider", "hideOnCombatAlphaSlider", SLIDER_WIDTH, 20, 0, 100, 1, _G.DetailsOptionsWindow.instance.hide_in_combat_alpha) -- min, max, step, defaultv
- s:SetBackdrop (slider_backdrop)
- s:SetBackdropColor (unpack (slider_backdrop_color))
- s:SetThumbSize (50)
-
- frame2.hideOnCombatAlphaSlider:SetPoint ("left", frame2.hideOnCombatAlphaLabel, "right", 2, 0)
- frame2.hideOnCombatAlphaSlider:SetHook ("OnValueChange", function (self, instance, amount) --> slider, fixedValue, sliderValue
- instance.hide_in_combat_alpha = amount
- end)
-
- frame2.hideOnCombatSlider.info = Loc ["STRING_OPTIONS_HIDECOMBAT_DESC"]
- frame2.hideOnCombatAlphaSlider.info = Loc ["STRING_OPTIONS_HIDECOMBATALPHA_DESC"]
-
- window:create_line_background (frame2, frame2.hideOnCombatLabel, frame2.hideOnCombatSlider)
- frame2.hideOnCombatSlider:SetHook ("OnEnter", background_on_enter)
- frame2.hideOnCombatSlider:SetHook ("OnLeave", background_on_leave)
-
- window:create_line_background (frame2, frame2.hideOnCombatAlphaLabel, frame2.hideOnCombatAlphaSlider)
- frame2.hideOnCombatAlphaSlider:SetHook ("OnEnter", background_on_enter)
- frame2.hideOnCombatAlphaSlider:SetHook ("OnLeave", background_on_leave)
-
--> auto switch
g:NewLabel (frame2, _, "$parentAutoSwitchLabel", "autoSwitchLabel", Loc ["STRING_OPTIONS_AUTO_SWITCH"], "GameFontHighlightLeft")
--
@@ -1316,10 +2071,9 @@ function window:CreateFrame2()
frame2.fragsPvpLabel:SetPoint (10, -75)
frame2.timetypeLabel:SetPoint (10, -100)
- frame2.hideOnCombatLabel:SetPoint (10, -135)
- frame2.hideOnCombatAlphaLabel:SetPoint (10, -160)
- frame2.autoSwitchLabel:SetPoint (10, -195)
- frame2.autoCurrentLabel:SetPoint (10, -220) --auto current
+
+ frame2.autoSwitchLabel:SetPoint (10, -135)
+ frame2.autoCurrentLabel:SetPoint (10, -160) --auto current
end
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -2413,8 +3167,8 @@ function window:CreateFrame6()
local frame6 = window.options [6][1]
--> window
- local titulo_instance = g:NewLabel (frame6, _, "$parentTituloPersona", "tituloBarsLabel", Loc ["STRING_OPTIONS_INSTANCE"], "GameFontNormal", 16)
- local titulo_instance_desc = g:NewLabel (frame6, _, "$parentTituloPersona2", "tituloBars2Label", Loc ["STRING_OPTIONS_INSTANCE_DESC"], "GameFontNormal", 9, "white")
+ local titulo_instance = g:NewLabel (frame6, _, "$parentTituloPersona", "tituloBarsLabel", Loc ["STRING_OPTIONS_WINDOW_TITLE"], "GameFontNormal", 16)
+ local titulo_instance_desc = g:NewLabel (frame6, _, "$parentTituloPersona2", "tituloBars2Label", Loc ["STRING_OPTIONS_WINDOW_TITLE_DESC"], "GameFontNormal", 9, "white")
titulo_instance_desc.width = 320
--> window color
@@ -2530,8 +3284,23 @@ function window:CreateFrame6()
window:create_line_background (frame6, frame6.instanceToolbarSideLabel, frame6.instanceToolbarSideSlider)
frame6.instanceToolbarSideSlider:SetHook ("OnEnter", background_on_enter)
frame6.instanceToolbarSideSlider:SetHook ("OnLeave", background_on_leave)
-
- -- show side bars
+
+ --> micro displays side
+ g:NewSwitch (frame6, _, "$parentInstanceMicroDisplaysSideSlider", "instanceMicroDisplaysSideSlider", 80, 20, Loc ["STRING_BOTTOM"], Loc ["STRING_TOP"], instance.toolbar_side, nil, grow_switch_func, grow_return_func)
+ g:NewLabel (frame6, _, "$parentInstanceMicroDisplaysSideLabel", "instanceMicroDisplaysSideLabel", Loc ["STRING_OPTIONS_MICRODISPLAYSSIDE"], "GameFontHighlightLeft")
+
+ frame6.instanceMicroDisplaysSideSlider:SetPoint ("left", frame6.instanceMicroDisplaysSideLabel, "right", 2)
+ frame6.instanceMicroDisplaysSideSlider.OnSwitch = function (self, instance, value)
+ instance:MicroDisplaysSide (value, true)
+ end
+ frame6.instanceMicroDisplaysSideSlider.thumb:SetSize (50, 12)
+
+ frame6.instanceMicroDisplaysSideSlider.info = Loc ["STRING_OPTIONS_MICRODISPLAYSSIDE_DESC"]
+ window:create_line_background (frame6, frame6.instanceMicroDisplaysSideLabel, frame6.instanceMicroDisplaysSideSlider)
+ frame6.instanceMicroDisplaysSideSlider:SetHook ("OnEnter", background_on_enter)
+ frame6.instanceMicroDisplaysSideSlider:SetHook ("OnLeave", background_on_leave)
+
+ --> show side bars
g:NewLabel (frame6, _, "$parentSideBarsLabel", "sideBarsLabel", Loc ["STRING_OPTIONS_SHOW_SIDEBARS"], "GameFontHighlightLeft")
@@ -2618,82 +3387,7 @@ function window:CreateFrame6()
frame6.strataDropdown:SetHook ("OnEnter", background_on_enter)
frame6.strataDropdown:SetHook ("OnLeave", background_on_leave)
- --> alpha onenter onleave auto transparency
- g:NewLabel (frame6, _, "$parentMenuAlphaAnchor", "menuAlphaAnchorLabel", Loc ["STRING_OPTIONS_MENU_ALPHA"], "GameFontNormal")
-
- g:NewSwitch (frame6, _, "$parentMenuOnEnterLeaveAlphaSwitch", "alphaSwitch", 60, 20, _, _, instance.menu_alpha.enabled)
-
- local s = g:NewSlider (frame6, _, "$parentMenuOnEnterAlphaSlider", "menuOnEnterSlider", SLIDER_WIDTH, 20, 0, 1, 0.02, instance.menu_alpha.onenter, true)
- s:SetBackdrop (slider_backdrop)
- s:SetBackdropColor (unpack (slider_backdrop_color))
- s:SetThumbSize (50)
- s.useDecimals = true
-
- local s = g:NewSlider (frame6, _, "$parentMenuOnLeaveAlphaSlider", "menuOnLeaveSlider", SLIDER_WIDTH, 20, 0, 1, 0.02, instance.menu_alpha.onleave, true)
- s:SetBackdrop (slider_backdrop)
- s:SetBackdropColor (unpack (slider_backdrop_color))
- s:SetThumbSize (50)
-
- frame6.menuOnEnterSlider.useDecimals = true
- frame6.menuOnLeaveSlider.useDecimals = true
-
- g:NewLabel (frame6, _, "$parentMenuOnEnterLeaveAlphaLabel", "alphaSwitchLabel", Loc ["STRING_OPTIONS_MENU_ALPHAENABLED"], "GameFontHighlightLeft")
- g:NewLabel (frame6, _, "$parentMenuOnEnterAlphaLabel", "menuOnEnterLabel", Loc ["STRING_OPTIONS_MENU_ALPHAENTER"], "GameFontHighlightLeft")
- g:NewLabel (frame6, _, "$parentMenuOnLeaveAlphaLabel", "menuOnLeaveLabel", Loc ["STRING_OPTIONS_MENU_ALPHALEAVE"], "GameFontHighlightLeft")
-
- frame6.alphaSwitch.info = Loc ["STRING_OPTIONS_MENU_ALPHAENABLED_DESC"]
- window:create_line_background (frame6, frame6.alphaSwitchLabel, frame6.alphaSwitch)
- frame6.alphaSwitch:SetHook ("OnEnter", background_on_enter)
- frame6.alphaSwitch:SetHook ("OnLeave", background_on_leave)
-
- frame6.menuOnEnterSlider.info = Loc ["STRING_OPTIONS_MENU_ALPHAENTER_DESC"]
- window:create_line_background (frame6, frame6.menuOnEnterLabel, frame6.menuOnEnterSlider)
- frame6.menuOnEnterSlider:SetHook ("OnEnter", background_on_enter)
- frame6.menuOnEnterSlider:SetHook ("OnLeave", background_on_leave)
-
- frame6.menuOnLeaveSlider.info = Loc ["STRING_OPTIONS_MENU_ALPHALEAVE_DESC"]
- window:create_line_background (frame6, frame6.menuOnLeaveLabel, frame6.menuOnLeaveSlider)
- frame6.menuOnLeaveSlider:SetHook ("OnEnter", background_on_enter)
- frame6.menuOnLeaveSlider:SetHook ("OnLeave", background_on_leave)
-
- frame6.alphaSwitch:SetPoint ("left", frame6.alphaSwitchLabel, "right", 2)
- frame6.menuOnEnterSlider:SetPoint ("left", frame6.menuOnEnterLabel, "right", 2)
- frame6.menuOnLeaveSlider:SetPoint ("left", frame6.menuOnLeaveLabel, "right", 2)
-
- frame6.menuOnEnterSlider:SetThumbSize (50)
- frame6.menuOnLeaveSlider:SetThumbSize (50)
-
-
- g:NewLabel (frame6, _, "$parentMenuOnEnterLeaveAlphaIconsTooLabel", "alphaIconsTooLabel", Loc ["STRING_OPTIONS_MENU_IGNOREBARS"], "GameFontHighlightLeft")
- g:NewSwitch (frame6, _, "$parentMenuOnEnterLeaveAlphaIconsTooSwitch", "alphaIconsTooSwitch", 60, 20, _, _, instance.menu_alpha.ignorebars)
-
- frame6.alphaIconsTooSwitch.info = Loc ["STRING_OPTIONS_MENU_IGNOREBARS_DESC"]
- window:create_line_background (frame6, frame6.alphaIconsTooLabel, frame6.alphaIconsTooSwitch)
- frame6.alphaIconsTooSwitch:SetHook ("OnEnter", background_on_enter)
- frame6.alphaIconsTooSwitch:SetHook ("OnLeave", background_on_leave)
-
- frame6.alphaIconsTooSwitch:SetPoint ("left", frame6.alphaIconsTooLabel, "right", 2)
-
- frame6.alphaIconsTooSwitch.OnSwitch = function (self, instance, value)
- instance:SetMenuAlpha (nil, nil, nil, value)
- end
- frame6.alphaSwitch.OnSwitch = function (self, instance, value)
- --
- instance:SetMenuAlpha (value)
- end
- frame6.menuOnEnterSlider:SetHook ("OnValueChange", function (self, instance, value)
- --
- self.amt:SetText (string.format ("%.2f", value))
- instance:SetMenuAlpha (nil, value)
- return true
- end)
- frame6.menuOnLeaveSlider:SetHook ("OnValueChange", function (self, instance, value)
- --
- self.amt:SetText (string.format ("%.2f", value))
- instance:SetMenuAlpha (nil, nil, value)
- return true
- end)
--> statusbar color overwrite
g:NewLabel (frame6, _, "$parentStatusbarLabelAnchor", "statusbarAnchorLabel", Loc ["STRING_OPTIONS_INSTANCE_STATUSBAR_ANCHOR"], "GameFontNormal")
@@ -2719,18 +3413,13 @@ function window:CreateFrame6()
frame6.instanceToolbarSideLabel:SetPoint (10, -120)
frame6.sideBarsLabel:SetPoint (10, -145) --borders
frame6.stretchAnchorLabel:SetPoint (10, -170) --stretch direction
- frame6.backdropLabel:SetPoint (10, -195)
- frame6.strataLabel:SetPoint (10, -220)
-
- frame6.menuAlphaAnchorLabel:SetPoint (10, -255)
- frame6.alphaSwitchLabel:SetPoint (10, -280)
- frame6.menuOnEnterLabel:SetPoint (10, -305)
- frame6.menuOnLeaveLabel:SetPoint (10, -330)
- frame6.alphaIconsTooLabel:SetPoint (10, -355)
-
- frame6.statusbarAnchorLabel:SetPoint (10, -390)
- frame6.statusbarLabel:SetPoint (10, -415) --statusbar
- frame6.statusbarColorLabel:SetPoint (10, -440)
+ frame6.instanceMicroDisplaysSideLabel:SetPoint (10, -195)
+ frame6.backdropLabel:SetPoint (10, -220)
+ frame6.strataLabel:SetPoint (10, -245)
+
+ frame6.statusbarAnchorLabel:SetPoint (10, -280)
+ frame6.statusbarLabel:SetPoint (10, -305) --statusbar
+ frame6.statusbarColorLabel:SetPoint (10, -330)
end
@@ -4143,13 +4832,13 @@ end
local percent_string = g:NewLabel (window, nil, nil, "percent_string", "loading: 0%", "GameFontNormal", 12)
percent_string.textcolor = "white"
percent_string:SetPoint ("bottomleft", window, "bottomleft", 340, 12)
- local step = 7.6923
+ local step = 5.8823
function _detalhes:create_options_panels()
window ["CreateFrame" .. panel_index]()
- if (panel_index == 14) then
+ if (panel_index == 17) then
_detalhes:CancelTimer (window.create_thread)
window:create_left_menu()
@@ -4172,7 +4861,7 @@ end
else
- for i = 1, 14 do
+ for i = 1, 17 do
window ["CreateFrame" .. i]()
end
window:create_left_menu()
@@ -4217,7 +4906,10 @@ function window:update_all (editing_instance)
--> window 2
_G.DetailsOptionsWindow2FragsPvpSlider.MyObject:SetValue (_detalhes.only_pvp_frags)
- _G.DetailsOptionsWindow2TTDropdown.MyObject:Select (_detalhes.time_type)
+ _G.DetailsOptionsWindow2TTDropdown.MyObject:Select (_detalhes.time_type)
+
+ _G.DetailsOptionsWindow2AutoCurrentSlider.MyObject:SetFixedParameter (editing_instance)
+ _G.DetailsOptionsWindow2AutoCurrentSlider.MyObject:SetValue (editing_instance.auto_current)
--> window 4
_G.DetailsOptionsWindow4BarStartSlider.MyObject:SetFixedParameter (editing_instance)
@@ -4238,16 +4930,7 @@ function window:update_all (editing_instance)
_G.DetailsOptionsWindow5CutomRightTextEntry.MyObject:SetText (editing_instance.row_info.textR_custom_text)
--> window 6
- _G.DetailsOptionsWindow6MenuOnEnterLeaveAlphaSwitch.MyObject:SetFixedParameter (editing_instance)
- _G.DetailsOptionsWindow6MenuOnEnterAlphaSlider.MyObject:SetFixedParameter (editing_instance)
- _G.DetailsOptionsWindow6MenuOnLeaveAlphaSlider.MyObject:SetFixedParameter (editing_instance)
- _G.DetailsOptionsWindow6MenuOnEnterLeaveAlphaIconsTooSwitch.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow6BackdropDropdown.MyObject:SetFixedParameter (editing_instance)
-
- _G.DetailsOptionsWindow6MenuOnEnterAlphaSlider.MyObject:SetValue (editing_instance.menu_alpha.onenter)
- _G.DetailsOptionsWindow6MenuOnLeaveAlphaSlider.MyObject:SetValue (editing_instance.menu_alpha.onleave)
- _G.DetailsOptionsWindow6MenuOnEnterLeaveAlphaSwitch.MyObject:SetValue (editing_instance.menu_alpha.enabled)
- _G.DetailsOptionsWindow6MenuOnEnterLeaveAlphaIconsTooSwitch.MyObject:SetValue (editing_instance.menu_alpha.ignorebars)
_G.DetailsOptionsWindow6BackdropDropdown.MyObject:Select (editing_instance.backdrop_texture)
local r, g, b = unpack (editing_instance.statusbar_info.overlay)
@@ -4256,6 +4939,8 @@ function window:update_all (editing_instance)
_G.DetailsOptionsWindow6StrataDropdown.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow6StrataDropdown.MyObject:Select (strata [editing_instance.strata] or "Low")
+ _G.DetailsOptionsWindow6InstanceMicroDisplaysSideSlider.MyObject:SetFixedParameter (editing_instance)
+ _G.DetailsOptionsWindow6InstanceMicroDisplaysSideSlider.MyObject:SetValue (editing_instance.micro_displays_side)
--> window 7
_G.DetailsOptionsWindow7AutoHideRightMenuSwitch.MyObject:SetFixedParameter (editing_instance)
@@ -4312,6 +4997,21 @@ function window:update_all (editing_instance)
_G.DetailsOptionsWindow14AttributeSideSwitch.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow14AttributeSideSwitch.MyObject:SetValue (editing_instance.attribute_text.side)
+ --> window 17
+ _G.DetailsOptionsWindow17CombatAlphaDropdown.MyObject:Select (editing_instance.hide_in_combat_type, true)
+ _G.DetailsOptionsWindow17HideOnCombatAlphaSlider.MyObject:SetFixedParameter (editing_instance)
+ _G.DetailsOptionsWindow17HideOnCombatAlphaSlider.MyObject:SetValue (editing_instance.hide_in_combat_alpha)
+
+ _G.DetailsOptionsWindow17MenuOnEnterLeaveAlphaSwitch.MyObject:SetFixedParameter (editing_instance)
+ _G.DetailsOptionsWindow17MenuOnEnterAlphaSlider.MyObject:SetFixedParameter (editing_instance)
+ _G.DetailsOptionsWindow17MenuOnLeaveAlphaSlider.MyObject:SetFixedParameter (editing_instance)
+ _G.DetailsOptionsWindow17MenuOnEnterLeaveAlphaIconsTooSwitch.MyObject:SetFixedParameter (editing_instance)
+
+ _G.DetailsOptionsWindow17MenuOnEnterAlphaSlider.MyObject:SetValue (editing_instance.menu_alpha.onenter)
+ _G.DetailsOptionsWindow17MenuOnLeaveAlphaSlider.MyObject:SetValue (editing_instance.menu_alpha.onleave)
+ _G.DetailsOptionsWindow17MenuOnEnterLeaveAlphaSwitch.MyObject:SetValue (editing_instance.menu_alpha.enabled)
+ _G.DetailsOptionsWindow17MenuOnEnterLeaveAlphaIconsTooSwitch.MyObject:SetValue (editing_instance.menu_alpha.ignorebars)
+
----------
_G.DetailsOptionsWindow8ResetTextColorPick.MyObject:SetColor (unpack (editing_instance.resetbutton_info.text_color))
_G.DetailsOptionsWindow8ResetTextSizeSlider.MyObject:SetValue (editing_instance.resetbutton_info.text_size)
@@ -4325,10 +5025,7 @@ function window:update_all (editing_instance)
_G.DetailsOptionsWindow8CloseButtonColorPick.MyObject:SetColor (unpack (editing_instance.closebutton_info.color_overlay))
- _G.DetailsOptionsWindow2HideOnCombatSlider.MyObject:SetFixedParameter (editing_instance)
- _G.DetailsOptionsWindow2HideOnCombatAlphaSlider.MyObject:SetFixedParameter (editing_instance)
- _G.DetailsOptionsWindow2HideOnCombatSlider.MyObject:SetValue (editing_instance.hide_in_combat)
- _G.DetailsOptionsWindow2HideOnCombatAlphaSlider.MyObject:SetValue (editing_instance.hide_in_combat_alpha)
+
_G.DetailsOptionsWindow6SideBarsSlider.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow6SideBarsSlider.MyObject:SetValue (editing_instance.show_sidebars)
@@ -4364,12 +5061,6 @@ function window:update_all (editing_instance)
_G.DetailsOptionsWindow7MenuAnchorYSlider.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow7MenuAnchorYSlider.MyObject:SetValue (editing_instance.menu_anchor[2])
-
-
-
-
-
-
----------------------------------------------------------------
@@ -4420,8 +5111,6 @@ function window:update_all (editing_instance)
_G.DetailsOptionsWindow5SliderFontSize.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow5SliderFontSize.MyObject:SetValue (editing_instance.row_info.font_size)
--
- _G.DetailsOptionsWindow2AutoCurrentSlider.MyObject:SetFixedParameter (editing_instance)
- _G.DetailsOptionsWindow2AutoCurrentSlider.MyObject:SetValue (editing_instance.auto_current)
--
_G.DetailsOptionsWindow4ClassColorSlider.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow4ClassColorSlider.MyObject:SetValue (editing_instance.row_info.texture_class_colors)
@@ -4460,7 +5149,7 @@ function window:update_all (editing_instance)
_G.DetailsOptionsWindow5FixedTextColor.MyObject:SetColor (unpack (editing_instance.row_info.fixed_text_color))
- _G.DetailsOptionsWindow1NicknameEntry.MyObject.text = _detalhes:GetNickname (UnitGUID ("player"), UnitName ("player"), true)
+ _G.DetailsOptionsWindow1NicknameEntry.MyObject.text = _detalhes:GetNickname (UnitGUID ("player"), UnitName ("player"), true) or ""
_G.DetailsOptionsWindow2TTDropdown.MyObject:Select (_detalhes.time_type, true)
_G.DetailsOptionsWindow.MyObject.instance = instance
diff --git a/gumps/janela_principal.lua b/gumps/janela_principal.lua
index 7d73a59a..689251f2 100644
--- a/gumps/janela_principal.lua
+++ b/gumps/janela_principal.lua
@@ -1583,6 +1583,7 @@ end
local function button_up_scripts (main_frame, backgrounddisplay, instancia, scrollbar)
main_frame.button_up:SetScript ("OnMouseDown", function(self)
+
if (not scrollbar:IsEnabled()) then
return
end
@@ -1621,6 +1622,61 @@ local function button_up_scripts (main_frame, backgrounddisplay, instancia, scro
end)
end
+function DetailsKeyBindScrollUp()
+
+ local last_key_pressed = _detalhes.KeyBindScrollUpLastPressed or GetTime()-0.3
+
+ local to_top = false
+ if (last_key_pressed+0.2 > GetTime()) then
+ to_top = true
+ end
+
+ _detalhes.KeyBindScrollUpLastPressed = GetTime()
+
+ for index, instance in ipairs (_detalhes.tabela_instancias) do
+ if (instance:IsEnabled()) then
+
+ local scrollbar = instance.scroll
+
+ local A = instance.barraS[1]
+ if (A and A > 1) then
+ if (to_top) then
+ scrollbar:SetValue (0)
+ scrollbar.ultimo = 0
+ instance.baseframe.button_up:Disable()
+ else
+ scrollbar:SetValue (scrollbar:GetValue() - instance.row_height*2)
+ end
+ elseif (A) then
+ scrollbar:SetValue (0)
+ scrollbar.ultimo = 0
+ instance.baseframe.button_up:Disable()
+ end
+
+ end
+ end
+end
+
+function DetailsKeyBindScrollDown()
+ for index, instance in ipairs (_detalhes.tabela_instancias) do
+ if (instance:IsEnabled()) then
+
+ local scrollbar = instance.scroll
+
+ local B = instance.barraS[2]
+ if (B and B < instance.rows_showing) then
+ scrollbar:SetValue (scrollbar:GetValue() + instance.row_height*2)
+ elseif (B) then
+ local _, maxValue = scrollbar:GetMinMaxValues()
+ scrollbar:SetValue (maxValue)
+ scrollbar.ultimo = maxValue
+ instance.baseframe.button_down:Disable()
+ end
+
+ end
+ end
+end
+
local function iterate_scroll_scripts (backgrounddisplay, backgroundframe, baseframe, scrollbar, instancia)
baseframe:SetScript ("OnMouseWheel",
@@ -1930,7 +1986,7 @@ local function show_anti_overlap (instance, host, side)
anti_menu_overlap:Show()
end
---> ~inicio ~janela ~window
+--> ~inicio ~janela ~window ~nova
function gump:CriaJanelaPrincipal (ID, instancia, criando)
-- main frames -----------------------------------------------------------------------------------------------------------------------------------------------
@@ -2918,7 +2974,7 @@ function _detalhes:SetWindowAlphaForInteract (alpha)
end
-function _detalhes:SetWindowAlphaForCombat (entering_in_combat)
+function _detalhes:SetWindowAlphaForCombat (entering_in_combat, true_hide)
local amount, rowsamount
@@ -2952,8 +3008,13 @@ function _detalhes:SetWindowAlphaForCombat (entering_in_combat)
end
--apply
- gump:Fade (self.baseframe, "ALPHAANIM", amount)
- gump:Fade (self.rowframe, "ALPHAANIM", rowsamount)
+ if (true_hide and amount == 0) then
+ gump:Fade (self.baseframe, _unpack (_detalhes.windows_fade_in))
+ gump:Fade (self.rowframe, _unpack (_detalhes.windows_fade_in))
+ else
+ gump:Fade (self.baseframe, "ALPHAANIM", amount)
+ gump:Fade (self.rowframe, "ALPHAANIM", rowsamount)
+ end
if (self.show_statusbar) then
self.baseframe.barra_fundo:Hide()
@@ -4261,13 +4322,16 @@ function _detalhes:ChangeSkin (skin_name)
self:HideSideBars()
end
+ --> refresh the side of the micro displays
+ self:MicroDisplaysSide()
+
--> update statusbar
if (self.show_statusbar) then
self:ShowStatusBar()
else
self:HideStatusBar()
end
-
+
--> update wallpaper
if (self.wallpaper.enabled) then
self:InstanceWallpaper (true)
@@ -4298,6 +4362,9 @@ function _detalhes:ChangeSkin (skin_name)
--> update window strata level
self:SetFrameStrata()
+
+ --> update the combat alphas
+ self:SetCombatAlpha (nil, nil, true)
--> update icons
_detalhes.ToolBar:ReorganizeIcons (nil, true) --call self:SetMenuAlpha()
@@ -4327,6 +4394,57 @@ function _detalhes:ChangeSkin (skin_name)
end
+function _detalhes:SetCombatAlpha (modify_type, alpha_amount, interacting)
+
+ if (interacting) then
+
+ if (self.hide_in_combat_type == 1) then --None
+ return
+
+ elseif (self.hide_in_combat_type == 2) then --While In Combat
+ if (UnitAffectingCombat ("player") or InCombatLockdown()) then
+ self:SetWindowAlphaForCombat (true, true) --> hida a janela
+ else
+ self:SetWindowAlphaForCombat (false) --> deshida a janela
+ end
+
+ elseif (self.hide_in_combat_type == 3) then --"While Out of Combat"
+ if (UnitAffectingCombat ("player") or InCombatLockdown()) then
+ self:SetWindowAlphaForCombat (false) --> deshida a janela
+ else
+ self:SetWindowAlphaForCombat (true, true) --> hida a janela
+ end
+
+ elseif (self.hide_in_combat_type == 4) then --"While Out of a Group"
+ if (_detalhes.in_group) then
+ self:SetWindowAlphaForCombat (false) --> deshida a janela
+ else
+ self:SetWindowAlphaForCombat (true, true) --> hida a janela
+ end
+ end
+
+ return
+ end
+
+ if (not modify_type) then
+ modify_type = self.hide_in_combat_type
+ else
+ if (modify_type == 1) then --> changed to none
+ self:SetWindowAlphaForCombat (false)
+ end
+ end
+
+ if (not alpha_amount) then
+ alpha_amount = self.hide_in_combat_alpha
+ end
+
+ self.hide_in_combat_type = modify_type
+ self.hide_in_combat_alpha = alpha_amount
+
+ self:SetCombatAlpha (nil, nil, true)
+
+end
+
function _detalhes:SetFrameStrata (strata)
if (not strata) then
@@ -4633,6 +4751,28 @@ function _detalhes:GetInstanceIconsCurrentAlpha()
end
end
+function _detalhes:MicroDisplaysSide (side, fromuser)
+ if (not side) then
+ side = self.micro_displays_side
+ end
+
+ self.micro_displays_side = side
+
+ _detalhes.StatusBar:ReloadAnchors (self)
+
+ if (self.micro_displays_side == 2 and not self.show_statusbar) then --> bottom side
+ _detalhes.StatusBar:Hide (self)
+ if (fromuser) then
+ _detalhes:Msg (Loc ["STRING_OPTIONS_MICRODISPLAYWARNING"])
+ end
+ elseif (self.micro_displays_side == 2) then
+ _detalhes.StatusBar:Show (self)
+ elseif (self.micro_displays_side == 1) then
+ _detalhes.StatusBar:Show (self)
+ end
+
+end
+
function _detalhes:ToolbarSide (side)
if (not side) then
@@ -5042,7 +5182,9 @@ function _detalhes:HideStatusBar (instancia)
self:StretchButtonAnchor()
- _detalhes.StatusBar:Hide (self) --> mini displays widgets
+ if (self.micro_displays_side == 2) then --> bottom side
+ _detalhes.StatusBar:Hide (self) --> mini displays widgets
+ end
end
function _detalhes:StatusBarColor (r, g, b, a, no_save)
@@ -5084,7 +5226,9 @@ function _detalhes:ShowStatusBar (instancia)
self:ToolbarSide()
self:StretchButtonAnchor()
- _detalhes.StatusBar:Show (self) --> mini displays widgets
+ if (self.micro_displays_side == 2) then --> bottom side
+ _detalhes.StatusBar:Show (self) --> mini displays widgets
+ end
end
function gump:CriaCabecalho (baseframe, instancia)
@@ -5191,6 +5335,26 @@ function gump:CriaCabecalho (baseframe, instancia)
baseframe.UPFrameConnect:SetResizable (true)
BGFrame_scripts (baseframe.UPFrameConnect, baseframe, instancia)
+ --> anchors para os micro displays no lado de cima da janela
+ local StatusBarLeftAnchor = CreateFrame ("frame", nil, baseframe)
+ StatusBarLeftAnchor:SetPoint ("bottomleft", baseframe, "topleft", 0, 9)
+ StatusBarLeftAnchor:SetWidth (1)
+ StatusBarLeftAnchor:SetHeight (1)
+ baseframe.cabecalho.StatusBarLeftAnchor = StatusBarLeftAnchor
+
+ local StatusBarCenterAnchor = CreateFrame ("frame", nil, baseframe)
+ StatusBarCenterAnchor:SetPoint ("center", baseframe, "center")
+ StatusBarCenterAnchor:SetPoint ("bottom", baseframe, "top", 0, 9)
+ StatusBarCenterAnchor:SetWidth (1)
+ StatusBarCenterAnchor:SetHeight (1)
+ baseframe.cabecalho.StatusBarCenterAnchor = StatusBarCenterAnchor
+
+ local StatusBarRightAnchor = CreateFrame ("frame", nil, baseframe)
+ StatusBarRightAnchor:SetPoint ("bottomright", baseframe, "topright", 0, 9)
+ StatusBarRightAnchor:SetWidth (1)
+ StatusBarRightAnchor:SetHeight (1)
+ baseframe.cabecalho.StatusBarRightAnchor = StatusBarRightAnchor
+
-- botões
-------------------------------------------------------------------------------------------------------------------------------------------------
diff --git a/images/options_window.tga b/images/options_window.tga
index e8f185db..a427cf90 100644
Binary files a/images/options_window.tga and b/images/options_window.tga differ
diff --git a/images/skins/elvui.tga b/images/skins/elvui.tga
index 99fe01bb..2d558c69 100644
Binary files a/images/skins/elvui.tga and b/images/skins/elvui.tga differ
diff --git a/images/skins/flat_skin.tga b/images/skins/flat_skin.tga
index 6938f233..2e4b5a97 100644
Binary files a/images/skins/flat_skin.tga and b/images/skins/flat_skin.tga differ
diff --git a/indent.lua b/indent.lua
new file mode 100644
index 00000000..d947c30c
--- /dev/null
+++ b/indent.lua
@@ -0,0 +1,1326 @@
+-- For All Indents And Purposes
+local revision = 17
+-- Maintainer: kristofer.karlsson@gmail.com
+
+-- For All Indents And Purposes -
+-- a indentation + syntax highlighting library
+-- All valid lua code should be processed correctly.
+
+-- Usage (for developers)
+--------
+-- Variant 1: - non embedded
+-- 1) Add ForAllIndentsAndPurposes to your dependencies (or optional dependencies)
+
+-- Variant 2: - embedded
+-- 1.a) Copy indent.lua to your addon directory
+-- 1.b) Put indent.lua first in your list of files in the TOC
+
+-- For both variants:
+-- 2) hook the editboxes that you want to have indentation like this:
+-- IndentationLib.enable(editbox [, colorTable [, tabWidth] ])
+-- if you don't select a color table, it will use the default.
+-- Read through this code for further usage help.
+-- (The documentation IS the code)
+
+if not IndentationLib then
+ IndentationLib = {}
+end
+
+if not IndentationLib.revision or revision > IndentationLib.revision then
+ local lib = IndentationLib
+ lib.revision = revision
+
+ local stringlen = string.len
+ local stringformat = string.format
+ local stringfind = string.find
+ local stringsub = string.sub
+ local stringbyte = string.byte
+ local stringchar = string.char
+ local stringrep = string.rep
+ local stringgsub = string.gsub
+
+ local workingTable = {}
+ local workingTable2 = {}
+ local function tableclear(t)
+ for k in next,t do
+ t[k] = nil
+ end
+ end
+
+ local function stringinsert(s, pos, insertStr)
+ return stringsub(s, 1, pos) .. insertStr .. stringsub(s, pos + 1)
+ end
+ lib.stringinsert = stringinsert
+
+ local function stringdelete(s, pos1, pos2)
+ return stringsub(s, 1, pos1 - 1) .. stringsub(s, pos2 + 1)
+ end
+ lib.stringdelete = stringdelete
+
+ -- token types
+ local tokens = {}
+ lib.tokens = tokens
+
+ tokens.TOKEN_UNKNOWN = 0
+ tokens.TOKEN_NUMBER = 1
+ tokens.TOKEN_LINEBREAK = 2
+ tokens.TOKEN_WHITESPACE = 3
+ tokens.TOKEN_IDENTIFIER = 4
+ tokens.TOKEN_ASSIGNMENT = 5
+ tokens.TOKEN_EQUALITY = 6
+ tokens.TOKEN_MINUS = 7
+ tokens.TOKEN_COMMENT_SHORT = 8
+ tokens.TOKEN_COMMENT_LONG = 9
+ tokens.TOKEN_STRING = 10
+ tokens.TOKEN_LEFTBRACKET = 11
+ tokens.TOKEN_PERIOD = 12
+ tokens.TOKEN_DOUBLEPERIOD = 13
+ tokens.TOKEN_TRIPLEPERIOD = 14
+ tokens.TOKEN_LTE = 15
+ tokens.TOKEN_LT = 16
+ tokens.TOKEN_GTE = 17
+ tokens.TOKEN_GT = 18
+ tokens.TOKEN_NOTEQUAL = 19
+ tokens.TOKEN_COMMA = 20
+ tokens.TOKEN_SEMICOLON = 21
+ tokens.TOKEN_COLON = 22
+ tokens.TOKEN_LEFTPAREN = 23
+ tokens.TOKEN_RIGHTPAREN = 24
+ tokens.TOKEN_PLUS = 25
+ tokens.TOKEN_SLASH = 27
+ tokens.TOKEN_LEFTWING = 28
+ tokens.TOKEN_RIGHTWING = 29
+ tokens.TOKEN_CIRCUMFLEX = 30
+ tokens.TOKEN_ASTERISK = 31
+ tokens.TOKEN_RIGHTBRACKET = 32
+ tokens.TOKEN_KEYWORD = 33
+ tokens.TOKEN_SPECIAL = 34
+ tokens.TOKEN_VERTICAL = 35
+ tokens.TOKEN_TILDE = 36
+
+ -- WoW specific tokens
+ tokens.TOKEN_COLORCODE_START = 37
+ tokens.TOKEN_COLORCODE_STOP = 38
+
+-- new as of lua 5.1
+ tokens.TOKEN_HASH = 39
+ tokens.TOKEN_PERCENT = 40
+
+
+ -- ascii codes
+ local bytes = {}
+ lib.bytes = bytes
+ bytes.BYTE_LINEBREAK_UNIX = stringbyte("\n")
+ bytes.BYTE_LINEBREAK_MAC = stringbyte("\r")
+ bytes.BYTE_SINGLE_QUOTE = stringbyte("'")
+ bytes.BYTE_DOUBLE_QUOTE = stringbyte('"')
+ bytes.BYTE_0 = stringbyte("0")
+ bytes.BYTE_9 = stringbyte("9")
+ bytes.BYTE_PERIOD = stringbyte(".")
+ bytes.BYTE_SPACE = stringbyte(" ")
+ bytes.BYTE_TAB = stringbyte("\t")
+ bytes.BYTE_E = stringbyte("E")
+ bytes.BYTE_e = stringbyte("e")
+ bytes.BYTE_MINUS = stringbyte("-")
+ bytes.BYTE_EQUALS = stringbyte("=")
+ bytes.BYTE_LEFTBRACKET = stringbyte("[")
+ bytes.BYTE_RIGHTBRACKET = stringbyte("]")
+ bytes.BYTE_BACKSLASH = stringbyte("\\")
+ bytes.BYTE_COMMA = stringbyte(",")
+ bytes.BYTE_SEMICOLON = stringbyte(";")
+ bytes.BYTE_COLON = stringbyte(":")
+ bytes.BYTE_LEFTPAREN = stringbyte("(")
+ bytes.BYTE_RIGHTPAREN = stringbyte(")")
+ bytes.BYTE_TILDE = stringbyte("~")
+ bytes.BYTE_PLUS = stringbyte("+")
+ bytes.BYTE_SLASH = stringbyte("/")
+ bytes.BYTE_LEFTWING = stringbyte("{")
+ bytes.BYTE_RIGHTWING = stringbyte("}")
+ bytes.BYTE_CIRCUMFLEX = stringbyte("^")
+ bytes.BYTE_ASTERISK = stringbyte("*")
+ bytes.BYTE_LESSTHAN = stringbyte("<")
+ bytes.BYTE_GREATERTHAN = stringbyte(">")
+ -- WoW specific chars
+ bytes.BYTE_VERTICAL = stringbyte("|")
+ bytes.BYTE_r = stringbyte("r")
+ bytes.BYTE_c = stringbyte("c")
+
+-- new as of lua 5.1
+ bytes.BYTE_HASH = stringbyte("#")
+ bytes.BYTE_PERCENT = stringbyte("%")
+
+
+ local linebreakCharacters = {}
+ lib.linebreakCharacters = linebreakCharacters
+ linebreakCharacters[bytes.BYTE_LINEBREAK_UNIX] = 1
+ linebreakCharacters[bytes.BYTE_LINEBREAK_MAC] = 1
+
+ local whitespaceCharacters = {}
+ lib.whitespaceCharacters = whitespaceCharacters
+ whitespaceCharacters[bytes.BYTE_SPACE] = 1
+ whitespaceCharacters[bytes.BYTE_TAB] = 1
+
+ local specialCharacters = {}
+ lib.specialCharacters = specialCharacters
+ specialCharacters[bytes.BYTE_PERIOD] = -1
+ specialCharacters[bytes.BYTE_LESSTHAN] = -1
+ specialCharacters[bytes.BYTE_GREATERTHAN] = -1
+ specialCharacters[bytes.BYTE_LEFTBRACKET] = -1
+ specialCharacters[bytes.BYTE_EQUALS] = -1
+ specialCharacters[bytes.BYTE_MINUS] = -1
+ specialCharacters[bytes.BYTE_SINGLE_QUOTE] = -1
+ specialCharacters[bytes.BYTE_DOUBLE_QUOTE] = -1
+ specialCharacters[bytes.BYTE_TILDE] = -1
+ specialCharacters[bytes.BYTE_RIGHTBRACKET] = tokens.TOKEN_RIGHTBRACKET
+ specialCharacters[bytes.BYTE_COMMA] = tokens.TOKEN_COMMA
+ specialCharacters[bytes.BYTE_COLON] = tokens.TOKEN_COLON
+ specialCharacters[bytes.BYTE_SEMICOLON] = tokens.TOKEN_SEMICOLON
+ specialCharacters[bytes.BYTE_LEFTPAREN] = tokens.TOKEN_LEFTPAREN
+ specialCharacters[bytes.BYTE_RIGHTPAREN] = tokens.TOKEN_RIGHTPAREN
+ specialCharacters[bytes.BYTE_PLUS] = tokens.TOKEN_PLUS
+ specialCharacters[bytes.BYTE_SLASH] = tokens.TOKEN_SLASH
+ specialCharacters[bytes.BYTE_LEFTWING] = tokens.TOKEN_LEFTWING
+ specialCharacters[bytes.BYTE_RIGHTWING] = tokens.TOKEN_RIGHTWING
+ specialCharacters[bytes.BYTE_CIRCUMFLEX] = tokens.TOKEN_CIRCUMFLEX
+ specialCharacters[bytes.BYTE_ASTERISK] = tokens.TOKEN_ASTERISK
+ -- WoW specific
+ specialCharacters[bytes.BYTE_VERTICAL] = -1
+-- new as of lua 5.1
+ specialCharacters[bytes.BYTE_HASH] = tokens.TOKEN_HASH
+ specialCharacters[bytes.BYTE_PERCENT] = tokens.TOKEN_PERCENT
+
+ local function nextNumberExponentPartInt(text, pos)
+ while true do
+ local byte = stringbyte(text, pos)
+ if not byte then
+ return tokens.TOKEN_NUMBER, pos
+ end
+
+ if byte >= bytes.BYTE_0 and byte <= bytes.BYTE_9 then
+ pos = pos + 1
+ else
+ return tokens.TOKEN_NUMBER, pos
+ end
+ end
+ end
+
+ local function nextNumberExponentPart(text, pos)
+ local byte = stringbyte(text, pos)
+ if not byte then
+ return tokens.TOKEN_NUMBER, pos
+ end
+
+ if byte == bytes.BYTE_MINUS then
+ -- handle this case: a = 1.2e-- some comment
+ -- i decide to let 1.2e be parsed as a a number
+ byte = stringbyte(text, pos + 1)
+ if byte == bytes.BYTE_MINUS then
+ return tokens.TOKEN_NUMBER, pos
+ end
+ return nextNumberExponentPartInt(text, pos + 1)
+ end
+
+ return nextNumberExponentPartInt(text, pos)
+ end
+
+ local function nextNumberFractionPart(text, pos)
+ while true do
+ local byte = stringbyte(text, pos)
+ if not byte then
+ return tokens.TOKEN_NUMBER, pos
+ end
+
+ if byte >= bytes.BYTE_0 and byte <= bytes.BYTE_9 then
+ pos = pos + 1
+ elseif byte == bytes.BYTE_E or byte == bytes.BYTE_e then
+ return nextNumberExponentPart(text, pos + 1)
+ else
+ return tokens.TOKEN_NUMBER, pos
+ end
+ end
+ end
+
+ local function nextNumberIntPart(text, pos)
+ while true do
+ local byte = stringbyte(text, pos)
+ if not byte then
+ return tokens.TOKEN_NUMBER, pos
+ end
+
+ if byte >= bytes.BYTE_0 and byte <= bytes.BYTE_9 then
+ pos = pos + 1
+ elseif byte == bytes.BYTE_PERIOD then
+ return nextNumberFractionPart(text, pos + 1)
+ elseif byte == bytes.BYTE_E or byte == bytes.BYTE_e then
+ return nextNumberExponentPart(text, pos + 1)
+ else
+ return tokens.TOKEN_NUMBER, pos
+ end
+ end
+ end
+
+ local function nextIdentifier(text, pos)
+ while true do
+ local byte = stringbyte(text, pos)
+
+ if not byte or
+ linebreakCharacters[byte] or
+ whitespaceCharacters[byte] or
+ specialCharacters[byte] then
+ return tokens.TOKEN_IDENTIFIER, pos
+ end
+ pos = pos + 1
+ end
+ end
+
+ -- returns false or: true, nextPos, equalsCount
+ local function isBracketStringNext(text, pos)
+ local byte = stringbyte(text, pos)
+ if byte == bytes.BYTE_LEFTBRACKET then
+ local pos2 = pos + 1
+ byte = stringbyte(text, pos2)
+ while byte == bytes.BYTE_EQUALS do
+ pos2 = pos2 + 1
+ byte = stringbyte(text, pos2)
+ end
+ if byte == bytes.BYTE_LEFTBRACKET then
+ return true, pos2 + 1, (pos2 - 1) - pos
+ else
+ return false
+ end
+ else
+ return false
+ end
+ end
+
+
+ -- Already parsed the [==[ part when get here
+ local function nextBracketString(text, pos, equalsCount)
+ local state = 0
+ while true do
+ local byte = stringbyte(text, pos)
+ if not byte then
+ return tokens.TOKEN_STRING, pos
+ end
+
+ if byte == bytes.BYTE_RIGHTBRACKET then
+ if state == 0 then
+ state = 1
+ elseif state == equalsCount + 1 then
+ return tokens.TOKEN_STRING, pos + 1
+ else
+ state = 0
+ end
+ elseif byte == bytes.BYTE_EQUALS then
+ if state > 0 then
+ state = state + 1
+ end
+ else
+ state = 0
+ end
+ pos = pos + 1
+ end
+ end
+
+ local function nextComment(text, pos)
+ -- When we get here we have already parsed the "--"
+ -- Check for long comment
+ local isBracketString, nextPos, equalsCount = isBracketStringNext(text, pos)
+ if isBracketString then
+ local tokenType, nextPos2 = nextBracketString(text, nextPos, equalsCount)
+ return tokens.TOKEN_COMMENT_LONG, nextPos2
+ end
+
+ local byte = stringbyte(text, pos)
+
+ -- Short comment, find the first linebreak
+ while true do
+ byte = stringbyte(text, pos)
+ if not byte then
+ return tokens.TOKEN_COMMENT_SHORT, pos
+ end
+ if linebreakCharacters[byte] then
+ return tokens.TOKEN_COMMENT_SHORT, pos
+ end
+ pos = pos + 1
+ end
+ end
+
+ local function nextString(text, pos, character)
+ local even = true
+ while true do
+ local byte = stringbyte(text, pos)
+ if not byte then
+ return tokens.TOKEN_STRING, pos
+ end
+
+ if byte == character then
+ if even then
+ return tokens.TOKEN_STRING, pos + 1
+ end
+ end
+ if byte == bytes.BYTE_BACKSLASH then
+ even = not even
+ else
+ even = true
+ end
+
+ pos = pos + 1
+ end
+ end
+
+ -- INPUT
+ -- 1: text: text to search in
+ -- 2: tokenPos: where to start searching
+ -- OUTPUT
+ -- 1: token type
+ -- 2: position after the last character of the token
+ function nextToken(text, pos)
+ local byte = stringbyte(text, pos)
+ if not byte then
+ return nil
+ end
+
+ if linebreakCharacters[byte] then
+ return tokens.TOKEN_LINEBREAK, pos + 1
+ end
+
+ if whitespaceCharacters[byte] then
+ while true do
+ pos = pos + 1
+ byte = stringbyte(text, pos)
+ if not byte or not whitespaceCharacters[byte] then
+ return tokens.TOKEN_WHITESPACE, pos
+ end
+ end
+ end
+
+ local token = specialCharacters[byte]
+ if token then
+ if token ~= -1 then
+ return token, pos + 1
+ end
+
+ -- WoW specific (for color codes)
+ if byte == bytes.BYTE_VERTICAL then
+ byte = stringbyte(text, pos + 1)
+ if byte == bytes.BYTE_VERTICAL then
+ return tokens.TOKEN_VERTICAL, pos + 2
+ end
+ if byte == bytes.BYTE_c then
+ return tokens.TOKEN_COLORCODE_START, pos + 10
+ end
+ if byte == bytes.BYTE_r then
+ return tokens.TOKEN_COLORCODE_STOP, pos + 2
+ end
+ return tokens.TOKEN_UNKNOWN, pos + 1
+ end
+
+ if byte == bytes.BYTE_MINUS then
+ byte = stringbyte(text, pos + 1)
+ if byte == bytes.BYTE_MINUS then
+ return nextComment(text, pos + 2)
+ end
+ return tokens.TOKEN_MINUS, pos + 1
+ end
+
+ if byte == bytes.BYTE_SINGLE_QUOTE then
+ return nextString(text, pos + 1, bytes.BYTE_SINGLE_QUOTE)
+ end
+
+ if byte == bytes.BYTE_DOUBLE_QUOTE then
+ return nextString(text, pos + 1, bytes.BYTE_DOUBLE_QUOTE)
+ end
+
+ if byte == bytes.BYTE_LEFTBRACKET then
+ local isBracketString, nextPos, equalsCount = isBracketStringNext(text, pos)
+ if isBracketString then
+ return nextBracketString(text, nextPos, equalsCount)
+ else
+ return tokens.TOKEN_LEFTBRACKET, pos + 1
+ end
+ end
+
+ if byte == bytes.BYTE_EQUALS then
+ byte = stringbyte(text, pos + 1)
+ if not byte then
+ return tokens.TOKEN_ASSIGNMENT, pos + 1
+ end
+ if byte == bytes.BYTE_EQUALS then
+ return tokens.TOKEN_EQUALITY, pos + 2
+ end
+ return tokens.TOKEN_ASSIGNMENT, pos + 1
+ end
+
+ if byte == bytes.BYTE_PERIOD then
+ byte = stringbyte(text, pos + 1)
+ if not byte then
+ return tokens.TOKEN_PERIOD, pos + 1
+ end
+ if byte == bytes.BYTE_PERIOD then
+ byte = stringbyte(text, pos + 2)
+ if byte == bytes.BYTE_PERIOD then
+ return tokens.TOKEN_TRIPLEPERIOD, pos + 3
+ end
+ return tokens.TOKEN_DOUBLEPERIOD, pos + 2
+ elseif byte >= bytes.BYTE_0 and byte <= bytes.BYTE_9 then
+ return nextNumberFractionPart(text, pos + 2)
+ end
+ return tokens.TOKEN_PERIOD, pos + 1
+ end
+
+ if byte == bytes.BYTE_LESSTHAN then
+ byte = stringbyte(text, pos + 1)
+ if byte == bytes.BYTE_EQUALS then
+ return tokens.TOKEN_LTE, pos + 2
+ end
+ return tokens.TOKEN_LT, pos + 1
+ end
+
+ if byte == bytes.BYTE_GREATERTHAN then
+ byte = stringbyte(text, pos + 1)
+ if byte == bytes.BYTE_EQUALS then
+ return tokens.TOKEN_GTE, pos + 2
+ end
+ return tokens.TOKEN_GT, pos + 1
+ end
+
+ if byte == bytes.BYTE_TILDE then
+ byte = stringbyte(text, pos + 1)
+ if byte == bytes.BYTE_EQUALS then
+ return tokens.TOKEN_NOTEQUAL, pos + 2
+ end
+ return tokens.TOKEN_TILDE, pos + 1
+ end
+
+ return tokens.TOKEN_UNKNOWN, pos + 1
+ elseif byte >= bytes.BYTE_0 and byte <= bytes.BYTE_9 then
+ return nextNumberIntPart(text, pos + 1)
+ else
+ return nextIdentifier(text, pos + 1)
+ end
+ end
+
+ -- Cool stuff begins here! (indentation and highlighting)
+
+ local noIndentEffect = {0, 0}
+ local indentLeft = {-1, 0}
+ local indentRight = {0, 1}
+ local indentBoth = {-1, 1}
+
+ local keywords = {}
+ lib.keywords = keywords
+ keywords["and"] = noIndentEffect
+ keywords["break"] = noIndentEffect
+ keywords["false"] = noIndentEffect
+ keywords["for"] = noIndentEffect
+ keywords["if"] = noIndentEffect
+ keywords["in"] = noIndentEffect
+ keywords["local"] = noIndentEffect
+ keywords["nil"] = noIndentEffect
+ keywords["not"] = noIndentEffect
+ keywords["or"] = noIndentEffect
+ keywords["return"] = noIndentEffect
+ keywords["true"] = noIndentEffect
+ keywords["while"] = noIndentEffect
+
+ keywords["until"] = indentLeft
+ keywords["elseif"] = indentLeft
+ keywords["end"] = indentLeft
+
+ keywords["do"] = indentRight
+ keywords["then"] = indentRight
+ keywords["repeat"] = indentRight
+ keywords["function"] = indentRight
+
+ keywords["else"] = indentBoth
+
+ tokenIndentation = {}
+ lib.tokenIndentation = tokenIndentation
+ tokenIndentation[tokens.TOKEN_LEFTPAREN] = indentRight
+ tokenIndentation[tokens.TOKEN_LEFTBRACKET] = indentRight
+ tokenIndentation[tokens.TOKEN_LEFTWING] = indentRight
+
+ tokenIndentation[tokens.TOKEN_RIGHTPAREN] = indentLeft
+ tokenIndentation[tokens.TOKEN_RIGHTBRACKET] = indentLeft
+ tokenIndentation[tokens.TOKEN_RIGHTWING] = indentLeft
+
+ local function fillWithTabs(n)
+ return stringrep("\t", n)
+ end
+
+ local function fillWithSpaces(a, b)
+ return stringrep(" ", a*b)
+ end
+
+ function lib.colorCodeCode(code, colorTable, caretPosition)
+ local stopColor = colorTable and colorTable[0]
+ if not stopColor then
+ return code, caretPosition
+ end
+
+ local stopColorLen = stringlen(stopColor)
+
+ tableclear(workingTable)
+ local tsize = 0
+ local totalLen = 0
+
+ local numLines = 0
+ local newCaretPosition
+ local prevTokenWasColored = false
+ local prevTokenWidth = 0
+
+ local pos = 1
+ local level = 0
+
+ while true do
+ if caretPosition and not newCaretPosition and pos >= caretPosition then
+ if pos == caretPosition then
+ newCaretPosition = totalLen
+ else
+ newCaretPosition = totalLen
+ local diff = pos - caretPosition
+ if diff > prevTokenWidth then
+ diff = prevTokenWidth
+ end
+ if prevTokenWasColored then
+ diff = diff + stopColorLen
+ end
+ newCaretPosition = newCaretPosition - diff
+ end
+ end
+
+ prevTokenWasColored = false
+ prevTokenWidth = 0
+
+ local tokenType, nextPos = nextToken(code, pos)
+
+ if not tokenType then
+ break
+ end
+
+ if tokenType == tokens.TOKEN_COLORCODE_START or tokenType == tokens.TOKEN_COLORCODE_STOP or tokenType == tokens.TOKEN_UNKNOWN then
+ -- ignore color codes
+
+ elseif tokenType == tokens.TOKEN_LINEBREAK or tokenType == tokens.TOKEN_WHITESPACE then
+ if tokenType == tokens.TOKEN_LINEBREAK then
+ numLines = numLines + 1
+ end
+ local str = stringsub(code, pos, nextPos - 1)
+ prevTokenWidth = nextPos - pos
+
+ tsize = tsize + 1
+ workingTable[tsize] = str
+ totalLen = totalLen + stringlen(str)
+ else
+ local str = stringsub(code, pos, nextPos - 1)
+
+ prevTokenWidth = nextPos - pos
+
+ -- Add coloring
+ if keywords[str] then
+ tokenType = tokens.TOKEN_KEYWORD
+ end
+
+ local color
+ if stopColor then
+ color = colorTable[str]
+ if not color then
+ color = colorTable[tokenType]
+ if not color then
+ if tokenType == tokens.TOKEN_IDENTIFIER then
+ color = colorTable[tokens.TOKEN_IDENTIFIER]
+ else
+ color = colorTable[tokens.TOKEN_SPECIAL]
+ end
+ end
+ end
+ end
+
+ if color then
+ tsize = tsize + 1
+ workingTable[tsize] = color
+ tsize = tsize + 1
+ workingTable[tsize] = str
+ tsize = tsize + 1
+ workingTable[tsize] = stopColor
+
+ totalLen = totalLen + stringlen(color) + (nextPos - pos) + stopColorLen
+ prevTokenWasColored = true
+ else
+ tsize = tsize + 1
+ workingTable[tsize] = str
+
+ totalLen = totalLen + stringlen(str)
+ end
+ end
+
+ pos = nextPos
+ end
+ return table.concat(workingTable), newCaretPosition, numLines
+ end
+
+ function lib.indentCode(code, tabWidth, colorTable, caretPosition)
+ local fillFunction
+ if tabWidth == nil then
+ tabWidth = defaultTabWidth
+ end
+ if tabWidth then
+ fillFunction = fillWithSpaces
+ else
+ fillFunction = fillWithTabs
+ end
+
+ tableclear(workingTable)
+ local tsize = 0
+ local totalLen = 0
+
+ tableclear(workingTable2)
+ local tsize2 = 0
+ local totalLen2 = 0
+
+
+ local stopColor = colorTable and colorTable[0]
+ local stopColorLen = not stopColor or stringlen(stopColor)
+
+ local newCaretPosition
+ local newCaretPositionFinalized = false
+ local prevTokenWasColored = false
+ local prevTokenWidth = 0
+
+ local pos = 1
+ local level = 0
+
+ local hitNonWhitespace = false
+ local hitIndentRight = false
+ local preIndent = 0
+ local postIndent = 0
+ while true do
+ if caretPosition and not newCaretPosition and pos >= caretPosition then
+ if pos == caretPosition then
+ newCaretPosition = totalLen + totalLen2
+ else
+ newCaretPosition = totalLen + totalLen2
+ local diff = pos - caretPosition
+ if diff > prevTokenWidth then
+ diff = prevTokenWidth
+ end
+ if prevTokenWasColored then
+ diff = diff + stopColorLen
+ end
+ newCaretPosition = newCaretPosition - diff
+ end
+ end
+
+ prevTokenWasColored = false
+ prevTokenWidth = 0
+
+ local tokenType, nextPos = nextToken(code, pos)
+
+ if not tokenType or tokenType == tokens.TOKEN_LINEBREAK then
+ level = level + preIndent
+ if level < 0 then level = 0 end
+
+ local s = fillFunction(level, tabWidth)
+
+ tsize = tsize + 1
+ workingTable[tsize] = s
+ totalLen = totalLen + stringlen(s)
+
+ if newCaretPosition and not newCaretPositionFinalized then
+ newCaretPosition = newCaretPosition + stringlen(s)
+ newCaretPositionFinalized = true
+ end
+
+
+ for k, v in next,workingTable2 do
+ tsize = tsize + 1
+ workingTable[tsize] = v
+ totalLen = totalLen + stringlen(v)
+ end
+
+ if not tokenType then
+ break
+ end
+
+ tsize = tsize + 1
+ workingTable[tsize] = stringsub(code, pos, nextPos - 1)
+ totalLen = totalLen + nextPos - pos
+
+ level = level + postIndent
+ if level < 0 then level = 0 end
+
+ tableclear(workingTable2)
+ tsize2 = 0
+ totalLen2 = 0
+
+ hitNonWhitespace = false
+ hitIndentRight = false
+ preIndent = 0
+ postIndent = 0
+ elseif tokenType == tokens.TOKEN_WHITESPACE then
+ if hitNonWhitespace then
+ prevTokenWidth = nextPos - pos
+
+ tsize2 = tsize2 + 1
+ local s = stringsub(code, pos, nextPos - 1)
+ workingTable2[tsize2] = s
+ totalLen2 = totalLen2 + stringlen(s)
+ end
+ elseif tokenType == tokens.TOKEN_COLORCODE_START or tokenType == tokens.TOKEN_COLORCODE_STOP or tokenType == tokens.TOKEN_UNKNOWN then
+ -- skip these, though they shouldn't be encountered here anyway
+ else
+ hitNonWhitespace = true
+
+ local str = stringsub(code, pos, nextPos - 1)
+
+ prevTokenWidth = nextPos - pos
+
+ -- See if this is an indent-modifier
+ local indentTable
+ if tokenType == tokens.TOKEN_IDENTIFIER then
+ indentTable = keywords[str]
+ else
+ indentTable = tokenIndentation[tokenType]
+ end
+
+ if indentTable then
+ if hitIndentRight then
+ postIndent = postIndent + indentTable[1] + indentTable[2]
+ else
+ local pre = indentTable[1]
+ local post = indentTable[2]
+ if post > 0 then
+ hitIndentRight = true
+ end
+ preIndent = preIndent + pre
+ postIndent = postIndent + post
+ end
+ end
+
+ -- Add coloring
+ if keywords[str] then
+ tokenType = tokens.TOKEN_KEYWORD
+ end
+
+ local color
+ if stopColor then
+ color = colorTable[str]
+ if not color then
+ color = colorTable[tokenType]
+ if not color then
+ if tokenType == tokens.TOKEN_IDENTIFIER then
+ color = colorTable[tokens.TOKEN_IDENTIFIER]
+ else
+ color = colorTable[tokens.TOKEN_SPECIAL]
+ end
+ end
+ end
+ end
+
+ if color then
+ tsize2 = tsize2 + 1
+ workingTable2[tsize2] = color
+ totalLen2 = totalLen2 + stringlen(color)
+
+ tsize2 = tsize2 + 1
+ workingTable2[tsize2] = str
+ totalLen2 = totalLen2 + nextPos - pos
+
+ tsize2 = tsize2 + 1
+ workingTable2[tsize2] = stopColor
+ totalLen2 = totalLen2 + stopColorLen
+
+ prevTokenWasColored = true
+ else
+ tsize2 = tsize2 + 1
+ workingTable2[tsize2] = str
+ totalLen2 = totalLen2 + nextPos - pos
+
+ end
+ end
+ pos = nextPos
+ end
+ return table.concat(workingTable), newCaretPosition
+ end
+
+
+
+ -- WoW specific code:
+ local GetTime = GetTime
+
+ local editboxSetText
+ local editboxGetText
+
+ -- Caret code (thanks Tem!)
+ local function critical_enter(editbox)
+ local script = editbox:GetScript("OnTextSet")
+ if script then
+ editbox:SetScript("OnTextSet", nil)
+ end
+ return script
+ end
+
+ local function critical_leave(editbox, script)
+ if script then
+ editbox:SetScript("OnTextSet", script)
+ end
+ end
+
+ local function setCaretPos_main(editbox, pos)
+ local text = editboxGetText(editbox)
+
+ if stringlen(text) > 0 then
+ editboxSetText(editbox, stringinsert(text, pos, "a"))
+ editbox:HighlightText(pos, pos + 1)
+ editbox:Insert("\0")
+ end
+ end
+
+ local function getCaretPos(editbox)
+ local script = critical_enter(editbox)
+
+ local text = editboxGetText(editbox)
+ editbox:Insert("\1")
+ local pos = stringfind(editboxGetText(editbox), "\1", 1, 1)
+ editboxSetText(editbox, text)
+
+ if pos then
+ setCaretPos_main(editbox, pos - 1)
+ end
+ critical_leave(editbox, script)
+
+ return (pos or 0) - 1
+ end
+
+ local function setCaretPos(editbox, pos)
+ local script = critical_enter(editbox)
+ setCaretPos_main(editbox, pos)
+ critical_leave(editbox, script, script2)
+ end
+ -- end of caret code
+
+ function lib.stripWowColors(code)
+
+ -- HACK!
+ -- This is a fix for a bug, where an unfinished string causes a lot of newlines to be created.
+ -- The reason for the bug, is that a |r\n\n gets converted to \n\n|r after the next indent-run
+ -- The fix is to remove those last two linebreaks when stripping
+ code = stringgsub(code, "|r\n\n$", "|r")
+
+ tableclear(workingTable)
+ local tsize = 0
+
+ local pos = 1
+
+ local prevVertical = false
+ local even = true
+ local selectionStart = 1
+
+ while true do
+ local byte = stringbyte(code, pos)
+ if not byte then
+ break
+ end
+ if byte == bytes.BYTE_VERTICAL then
+ even = not even
+ prevVertical = true
+ else
+ if prevVertical and not even then
+ if byte == bytes.BYTE_c then
+
+ if pos - 2 >= selectionStart then
+ tsize = tsize + 1
+ workingTable[tsize] = stringsub(code, selectionStart, pos - 2)
+ end
+
+ pos = pos + 8
+ selectionStart = pos + 1
+ elseif byte == bytes.BYTE_r then
+
+ if pos - 2 >= selectionStart then
+ tsize = tsize + 1
+ workingTable[tsize] = stringsub(code, selectionStart, pos - 2)
+ end
+ selectionStart = pos + 1
+ end
+ end
+ prevVertical = false
+ even = true
+ end
+ pos = pos + 1
+ end
+ if pos >= selectionStart then
+ tsize = tsize + 1
+ workingTable[tsize] = stringsub(code, selectionStart, pos - 1)
+ end
+ return table.concat(workingTable)
+ end
+
+ function lib.decode(code)
+ if code then
+ code = lib.stripWowColors(code)
+ code = stringgsub(code, "||", "|")
+ end
+ return code or ""
+ end
+
+ function lib.encode(code)
+ if code then
+ code = stringgsub(code, "|", "||")
+ end
+ return code or ""
+ end
+
+ function lib.stripWowColorsWithPos(code, pos)
+ code = stringinsert(code, pos, "\2")
+ code = lib.stripWowColors(code)
+ pos = stringfind(code, "\2", 1, 1)
+ code = stringdelete(code, pos, pos)
+ return code, pos
+ end
+
+ -- returns the padded code, and true if modified, false if unmodified
+ local linebreak = stringbyte("\n")
+ function lib.padWithLinebreaks(code)
+ local len = stringlen(code)
+ if stringbyte(code, len) == linebreak then
+ if stringbyte(code, len - 1) == linebreak then
+ return code, false
+ end
+ return code .. "\n", true
+ end
+ return code .. "\n\n", true
+
+ end
+
+ local defaultTabWidth = 2
+ local defaultColorTable
+
+ -- Data tables
+ -- No weak table magic, since editboxes can never be removed in WoW
+ local enabled = {}
+ local dirty = {}
+
+ local editboxIndentCache = {}
+ local decodeCache = {}
+ local editboxStringCache = {}
+ local editboxNumLinesCache = {}
+
+ function lib.colorCodeEditbox(editbox)
+ dirty[editbox] = nil
+
+ local colorTable = editbox.faiap_colorTable or defaultColorTable
+ local tabWidth = editbox.faiap_tabWidth
+
+ local orgCode = editboxGetText(editbox)
+ local prevCode = editboxStringCache[editbox]
+ if prevCode == orgCode then
+ return
+ end
+
+ local pos = getCaretPos(editbox)
+
+ local code
+ code, pos = lib.stripWowColorsWithPos(orgCode, pos)
+
+ colorTable[0] = "|r"
+
+ local newCode, newPos, numLines = lib.colorCodeCode(code, colorTable, pos)
+ newCode = lib.padWithLinebreaks(newCode)
+
+ editboxStringCache[editbox] = newCode
+ if orgCode ~= newCode then
+ local script, script2 = critical_enter(editbox)
+ decodeCache[editbox] = nil
+ local stringlenNewCode = stringlen(newCode)
+
+ editboxSetText(editbox, newCode)
+ if newPos then
+ if newPos < 0 then newPos = 0 end
+ if newPos > stringlenNewCode then newPos = stringlenNewCode end
+
+ setCaretPos(editbox, newPos)
+ end
+ critical_leave(editbox, script, script2)
+ end
+
+ if editboxNumLinesCache[editbox] ~= numLines then
+ lib.indentEditbox(editbox)
+ end
+ editboxNumLinesCache[editbox] = numLines
+ end
+
+ function lib.indentEditbox(editbox)
+ dirty[editbox] = nil
+
+ local colorTable = editbox.faiap_colorTable or defaultColorTable
+ local tabWidth = editbox.faiap_tabWidth
+
+ local orgCode = editboxGetText(editbox)
+ local prevCode = editboxIndentCache[editbox]
+ if prevCode == orgCode then
+ return
+ end
+
+ local pos = getCaretPos(editbox)
+
+ local code
+ code, pos = lib.stripWowColorsWithPos(orgCode, pos)
+
+ colorTable[0] = "|r"
+ local newCode, newPos = lib.indentCode(code, tabWidth, colorTable, pos)
+ newCode = lib.padWithLinebreaks(newCode)
+ editboxIndentCache[editbox] = newCode
+ if code ~= newCode then
+ local script, script2 = critical_enter(editbox)
+ decodeCache[editbox] = nil
+
+ local stringlenNewCode = stringlen(newCode)
+
+ editboxSetText(editbox, newCode)
+
+ if newPos then
+ if newPos < 0 then newPos = 0 end
+ if newPos > stringlenNewCode then newPos = stringlenNewCode end
+
+ setCaretPos(editbox, newPos)
+ end
+ critical_leave(editbox, script, script2)
+ end
+ end
+
+ local function hookHandler(editbox, handler, newFun)
+ local oldFun = editbox:GetScript(handler)
+ if oldFun == newFun then
+ -- already hooked, ignore it
+ return
+ end
+ editbox["faiap_old_" .. handler] = oldFun
+ editbox:SetScript(handler, newFun)
+ end
+
+ local function textChangedHook(editbox, ...)
+ local oldFun = editbox["faiap_old_OnTextChanged"]
+ if oldFun then
+ oldFun(editbox, ...)
+ end
+ if enabled[editbox] then
+ dirty[editbox] = GetTime()
+ end
+ end
+
+ local function tabPressedHook(editbox, ...)
+ local oldFun = editbox["faiap_old_OnTabPressed"]
+ if oldFun then
+ oldFun(editbox, ...)
+ end
+ if enabled[editbox] then
+ return lib.indentEditbox(editbox)
+ end
+ end
+
+ local function onUpdateHook(editbox, ...)
+ local oldFun = editbox["faiap_old_OnUpdate"]
+ if oldFun then
+ oldFun(editbox, ...)
+ end
+ if enabled[editbox] then
+ local now = GetTime()
+ local lastUpdate = dirty[editbox] or now
+ if now - lastUpdate > 0.2 then
+ decodeCache[editbox] = nil
+ return lib.colorCodeEditbox(editbox)
+ end
+ end
+ end
+
+ local function newGetText(editbox)
+ local decoded = decodeCache[editbox]
+ if not decoded then
+ decoded = lib.decode(editboxGetText(editbox))
+ decodeCache[editbox] = decoded
+ end
+ return decoded or ""
+ end
+
+ local function newSetText(editbox, text)
+ decodeCache[editbox] = nil
+ if text then
+ local encoded = lib.encode(text)
+
+ return editboxSetText(editbox, encoded)
+ end
+ end
+
+ function lib.enable(editbox, colorTable, tabWidth)
+ if not editboxSetText then
+ editboxSetText = editbox.SetText
+ editboxGetText = editbox.GetText
+ end
+
+ local modified
+ if editbox.faiap_colorTable ~= colorTable then
+ editbox.faiap_colorTable = colorTable
+ modified = true
+ end
+ if editbox.faiap_tabWidth ~= tabWidth then
+ editbox.faiap_tabWidth = tabWidth
+ modified = true
+ end
+
+ if enabled[editbox] then
+ if modified then
+ lib.indentEditbox(editbox)
+ end
+ return
+ end
+
+ -- Editbox is possibly hooked, but disabled
+ enabled[editbox] = true
+
+ editbox.oldMaxBytes = editbox:GetMaxBytes()
+ editbox.oldMaxLetters = editbox:GetMaxLetters()
+ editbox:SetMaxBytes(0)
+ editbox:SetMaxLetters(0)
+
+ editbox.GetText = newGetText
+ editbox.SetText = newSetText
+
+ hookHandler(editbox, "OnTextChanged", textChangedHook)
+ hookHandler(editbox, "OnTabPressed", tabPressedHook)
+ hookHandler(editbox, "OnUpdate", onUpdateHook)
+
+ lib.indentEditbox(editbox)
+ end
+
+ -- Deprecated function
+ lib.addSmartCode = lib.enable
+
+ function lib.disable(editbox)
+ if not enabled[editbox] then
+ return
+ end
+ enabled[editbox] = nil
+
+ -- revert settings for max bytes / letters
+ editbox:SetMaxBytes(editbox.oldMaxBytes)
+ editbox:SetMaxLetters(editbox.oldMaxLetters)
+
+ -- try a real unhooking, if possible
+ if editbox:GetScript("OnTextChanged") == textChangedHook then
+ editbox:SetScript("OnTextChanged", editbox.faiap_old_OnTextChanged)
+ editbox.faiap_old_OnTextChanged = nil
+ end
+
+ if editbox:GetScript("OnTabPressed") == tabPressedHook then
+ editbox:SetScript("OnTabPressed", editbox.faiap_old_OnTabPressed)
+ editbox.faiap_old_OnTabPressed = nil
+ end
+
+ if editbox:GetScript("OnUpdate") == onUpdateHook then
+ editbox:SetScript("OnUpdate", editbox.faiap_old_OnUpdate)
+ editbox.faiap_old_OnUpdate = nil
+ end
+
+ editbox.GetText = nil
+ editbox.SetText = nil
+
+ -- change the text back to unformatted
+ editbox:SetText(newGetText(editbox))
+
+ -- clear caches
+ editboxIndentCache[editbox] = nil
+ decodeCache[editbox] = nil
+ editboxStringCache[editbox] = nil
+ editboxNumLinesCache[editbox] = nil
+ end
+
+ defaultColorTable = {}
+ lib.defaultColorTable = defaultColorTable
+ defaultColorTable[tokens.TOKEN_SPECIAL] = "|c00ff99ff"
+ defaultColorTable[tokens.TOKEN_KEYWORD] = "|c006666ff"
+ defaultColorTable[tokens.TOKEN_COMMENT_SHORT] = "|c00999999"
+ defaultColorTable[tokens.TOKEN_COMMENT_LONG] = "|c00999999"
+
+ local stringColor = "|c00ffff77"
+ defaultColorTable[tokens.TOKEN_STRING] = stringColor
+ defaultColorTable[".."] = stringColor
+
+ local tableColor = "|c00ff9900"
+ defaultColorTable["..."] = tableColor
+ defaultColorTable["{"] = tableColor
+ defaultColorTable["}"] = tableColor
+ defaultColorTable["["] = tableColor
+ defaultColorTable["]"] = tableColor
+
+ local arithmeticColor = "|c0033ff55"
+ defaultColorTable[tokens.TOKEN_NUMBER] = arithmeticColor
+ defaultColorTable["+"] = arithmeticColor
+ defaultColorTable["-"] = arithmeticColor
+ defaultColorTable["/"] = arithmeticColor
+ defaultColorTable["*"] = arithmeticColor
+
+ local logicColor1 = "|c0055ff88"
+ defaultColorTable["=="] = logicColor1
+ defaultColorTable["<"] = logicColor1
+ defaultColorTable["<="] = logicColor1
+ defaultColorTable[">"] = logicColor1
+ defaultColorTable[">="] = logicColor1
+ defaultColorTable["~="] = logicColor1
+
+ local logicColor2 = "|c0088ffbb"
+ defaultColorTable["and"] = logicColor2
+ defaultColorTable["or"] = logicColor2
+ defaultColorTable["not"] = logicColor2
+
+ defaultColorTable[0] = "|r"
+
+end
+
+-- just for testing
+--[[
+function testTokenizer()
+ local str = ""
+ for line in io.lines("indent.lua") do
+ str = str .. line .. "\n"
+ end
+
+ local pos = 1
+
+ while true do
+ local tokenType, nextPos = nextToken(str, pos)
+
+ if not tokenType then
+ break
+ end
+
+ if true or tokenType ~= tokens.TOKEN_WHITESPACE and tokenType ~= tokens.TOKEN_LINEBREAK then
+ print(stringformat("Found token %d (%d-%d): (%s)", tokenType, pos, nextPos - 1, stringsub(str, pos, nextPos - 1)))
+ end
+
+ if tokenType == tokens.TOKEN_UNKNOWN then
+ print("unknown token!")
+ break
+ end
+
+ pos = nextPos
+ end
+end
+
+
+function testIndenter(i)
+ local lib = IndentationLib
+ local str = ""
+ for line in io.lines("test.lua") do
+ str = str .. line .. "\n"
+ end
+
+ local colorTable = lib.defaultColorTable
+ print(lib.indentCode(str, 4, colorTable, i))
+end
+
+
+testIndenter()
+
+--]]
diff --git a/plugins/Details_EncounterDetails/Details_EncounterDetails.lua b/plugins/Details_EncounterDetails/Details_EncounterDetails.lua
index 3233eaf3..6f86ced3 100644
--- a/plugins/Details_EncounterDetails/Details_EncounterDetails.lua
+++ b/plugins/Details_EncounterDetails/Details_EncounterDetails.lua
@@ -97,7 +97,45 @@ local function CreatePluginFrames (data)
--> check if was a boss fight
EncounterDetails:WasEncounter()
end
- _detalhes:RegisterTimeCapture (1)
+
+ local damage_done_func = function (support_table, time_table, tick_second)
+
+ local current_total_damage = _detalhes.tabela_vigente.totals_grupo[1]
+
+ local current_damage = current_total_damage - support_table.last_damage
+
+ time_table [tick_second] = current_damage
+
+ if (current_damage > support_table.max_damage) then
+ support_table.max_damage = current_damage
+ time_table.max_damage = current_damage
+ end
+
+ support_table.last_damage = current_total_damage
+
+ end
+
+ local string_damage_done_func = [[
+
+ -- this script takes the current combat and request the total of damage done by the group.
+
+ -- first lets take the current combat and name it "current_combat".
+ local current_combat = _detalhes:GetCombat ("current") --> getting the current combat
+
+ -- now lets ask the combat for the total damage done by the raide group.
+ local total_damage = current_combat:GetTotal ( DETAILS_ATTRIBUTE_DAMAGE, nil, DETAILS_TOTALS_ONLYGROUP )
+
+ -- checks if the result is valid
+ if (not total_damage) then
+ return 0
+ end
+
+ -- with the number in hands, lets finish the code returning the amount
+ return total_damage
+ ]]
+
+ --_detalhes:TimeDataRegister ("Raid Damage Done", damage_done_func, {last_damage = 0, max_damage = 0}, "Encounter Details", "v1.0", [[Interface\ICONS\Ability_DualWield]], true)
+ _detalhes:TimeDataRegister ("Raid Damage Done", string_damage_done_func, nil, "Encounter Details", "v1.0", [[Interface\ICONS\Ability_DualWield]], true, true)
elseif (event == "COMBAT_PLAYER_ENTER") then --> combat started
if (EncounterDetails.showing) then
diff --git a/plugins/Details_EncounterDetails/frames.lua b/plugins/Details_EncounterDetails/frames.lua
index 259e9d21..5ab5dd8b 100644
--- a/plugins/Details_EncounterDetails/frames.lua
+++ b/plugins/Details_EncounterDetails/frames.lua
@@ -95,7 +95,7 @@ do
function EncounterDetails:BuildDpsGraphic()
EncounterDetails.LastGraphicDrew = EncounterDetails.LastGraphicDrew or {}
- local graphicData = _detalhes.tabela_vigente:GetTimeData()
+ local graphicData = _detalhes.tabela_vigente:GetTimeData ("Raid Damage Done")
if (not graphicData or not _detalhes.tabela_vigente.start_time or not _detalhes.tabela_vigente.end_time) then
return
@@ -105,7 +105,7 @@ do
EncounterDetails.LastGraphicDrew = graphicData
end
- if (graphicData.damageMax == 0 or not graphicData.damage) then
+ if (graphicData.max_value == 0) then
return
end
@@ -233,12 +233,12 @@ do
lastBoss = _detalhes.tabela_vigente.is_boss and _detalhes.tabela_vigente.is_boss.index
local _data = {}
- local dps_max = graphicData.damageMax
- local amount = #graphicData.damage
+ local dps_max = graphicData.max_value
+ local amount = #graphicData
local scaleW = 1/670
- local content = graphicData.damage
+ local content = graphicData
table.insert (content, 1, 0)
table.insert (content, 1, 0)
table.insert (content, #content+1, 0)
@@ -688,7 +688,7 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156:
local return_table = {}
for index, combate in ipairs (historico) do
- if (combate.is_boss) then
+ if (combate.is_boss and combate.is_boss.index) then
local l, r, t, b, icon = _detalhes:GetBossIcon (combate.is_boss.mapid, combate.is_boss.index)
return_table [#return_table+1] = {value = index, label = "#" .. index .. " " .. combate.is_boss.name, icon = icon, texcoord = {l, r, t, b}, onclick = EncounterDetails.OpenAndRefresh}
end
diff --git a/plugins/Details_SpellDetails/Details_SpellDetails.lua b/plugins/Details_SpellDetails/Details_SpellDetails.lua
index 0d504a50..7ddfa87e 100644
--- a/plugins/Details_SpellDetails/Details_SpellDetails.lua
+++ b/plugins/Details_SpellDetails/Details_SpellDetails.lua
@@ -41,41 +41,80 @@ local function CreatePluginFrames (data)
SpellDetails.data = data or {}
SpellDetails.updating = false
- local timeCaptureFunction = function (second, myTimeTable, myAttributesTable)
- --> second: number of the tick
- --> myTimeTable: is the table wich will contain the data
- --> myAttributesTable: table wich your custom parameters
+ local player_damage_done = function (support_table, time_table, tick_second)
- if (SpellDetails.playerActor) then
- --> get player total damage
- local actorTotalDamage = SpellDetails.playerActor.total
- --> calculate the diferente between last tick
- local currentDamage = actorTotalDamage - myAttributesTable.lastDamage
- --> record damage
- myTimeTable [second] = currentDamage
- --> check if this tick was greater then before
- if (currentDamage > myAttributesTable.maxDamage) then
- myAttributesTable.maxDamage = currentDamage
+ local player = _detalhes.tabela_vigente (1, _detalhes.playername)
+
+ if (player) then
+
+ local total_damage = player.total
+
+ local current_damage = total_damage - support_table.last_damage
+
+ time_table [tick_second] = current_damage
+
+ if (current_damage > support_table.max_damage) then
+ support_table.max_damage = current_damage
+ time_table.max_damage = current_damage
end
- --> record tick total damage
- myAttributesTable.lastDamage = actorTotalDamage
+
+ support_table.last_damage = total_damage
+
+ else
+ time_table [tick_second] = 0
end
+
end
+ local string_player_damage_done = [[
+
+ -- the goal of this script is get the current combat then get your character and extract your damage done.
+ -- the first thing to do is get the combat, so, we use here the command "_detalhes:GetCombat ( "overall" "current" or "segment number")"
+
+ local current_combat = _detalhes:GetCombat ("current") --> getting the current combat
+
+ -- the next step is request your character from the combat
+ -- to do this, we take the combat which here we named "current_combat" and tells what we want inside parentheses.
+
+ local my_self = current_combat (DETAILS_ATTRIBUTE_DAMAGE, _detalhes.playername)
+
+ -- _detalhes.playername holds the name of your character.
+ -- DETAILS_ATTRIBUTE_DAMAGE means we want the damage table, _HEAL _ENERGY _MISC is the other 3 tables.
+
+ -- before we proceed, the result needs to be checked to make sure its a valid result.
+
+ if (not my_self) then
+ return 0 -- the combat doesnt have *you*, this happens when you didn't deal any damage in the combat yet.
+ end
+
+ -- now its time to get the total damage.
+
+ local my_damage = my_self.total
+
+ -- then finally return the amount to the capture.
+
+ return my_damage
+
+ ]]
+
function SpellDetails:OnDetailsEvent (event, ...)
+
if (event == "SHOW") then --> plugin shown on screen, actived
--> register a custom time capture // time capture is a custom function wich will run every second and grab any kind of data.
--> here we want to capture the damage of "player".
--> _detalhes:RegisterTimeCapture ( function, give a name, parameters table )
-
- _detalhes:RegisterTimeCapture (timeCaptureFunction, "SpellDetails_PlayerDamage", {lastDamage = 0, maxDamage = 0})
elseif (event == "HIDE") then --> plugin hidded, disabled
SpellDetailsFrame:SetScript ("OnUpdate", nil)
- _detalhes:UnregisterTimeCapture ("SpellDetails_PlayerDamage")
+
SpellDetails.playerActor = nil
+ elseif (event == "DETAILS_STARTED") then
+
+ -- _detalhes:TimeDataRegister ("Player Damage Done", player_damage_done, {last_damage = 0, max_damage = 0}, "Spell Details", "v1.0", [[Interface\ICONS\Achievement_Leader_Tyrande_Whisperwind]], true)
+ _detalhes:TimeDataRegister ("Player Damage Done", string_player_damage_done, nil, "Spell Details", "v1.0", [[Interface\ICONS\Achievement_Leader_Tyrande_Whisperwind]], true, true)
+
elseif (event == "REFRESH") then --> requested a refresh window
SpellDetails:Refresh()
@@ -318,21 +357,25 @@ local function CreatePluginFrames (data)
end
SpellDetails.LastGraphicDrew = SpellDetails.LastGraphicDrew or {}
- local graphicData = _detalhes.tabela_vigente:GetTimeData()
+
+ local graphicData = _detalhes.tabela_vigente:GetTimeData ("Player Damage Done")
+
+ if (not graphicData) then
+ print ("No graphic available for this segment.")
+ return
+ end
if (graphicData == SpellDetails.LastGraphicDrew) then
return
else
SpellDetails.LastGraphicDrew = SpellDetails.LastGraphicDrew
end
-
- if (not graphicData ["SpellDetails_PlayerDamageAttributes"]) then
- return
- elseif (graphicData ["SpellDetails_PlayerDamageAttributes"].maxDamage == 0) then
+
+ if (graphicData.max_damage == 0) then
return
end
- if (#graphicData ["SpellDetails_PlayerDamageData"] < 2) then
+ if (#graphicData < 2) then
local timetooshort = SpellDetails.graphic.fundo.timetooshot or DetailsFrameWork:NewLabel (SpellDetails.graphic.fundo, SpellDetails.graphic.fundo, nil, "timetooshort", Loc ["STRING_TOOSHORT"], "GameFontHighlightSmall")
timetooshort:SetPoint ("TOPLEFT", SpellDetails.graphic.fundo, "TOPLEFT", 40, -55)
_detalhes:SetFontSize (timetooshort, 10)
@@ -346,12 +389,12 @@ local function CreatePluginFrames (data)
GraphicObject:ResetData()
local _data = {}
- local dps_max = graphicData ["SpellDetails_PlayerDamageAttributes"].maxDamage
- local amount = #graphicData ["SpellDetails_PlayerDamageData"]
+ local dps_max = graphicData.max_value
+ local amount = #graphicData
local scaleW = 1/288
- local content = graphicData ["SpellDetails_PlayerDamageData"]
+ local content = graphicData
table.insert (content, 1, 0)
table.insert (content, 1, 0)
table.insert (content, #content+1, 0)
@@ -528,6 +571,8 @@ local function CreatePluginFrames (data)
--> botão para o gráfico:
local SwitchButton = DetailsFrameWork:NewDetailsButton (SpellDetailsFrame, SpellDetailsFrame, _, SpellDetails.ShowGraphic, _, _, 110, 15)
+ SwitchButton:SetFrameStrata ("TOOLTIP")
+ SwitchButton:SetFrameLevel (50)
SwitchButton:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", 10, -274)
SwitchButton:SetFrameLevel (6)
SwitchButton:InstallCustomTexture()
diff --git a/startup.lua b/startup.lua
index 041e83ac..e4c461aa 100644
--- a/startup.lua
+++ b/startup.lua
@@ -40,6 +40,12 @@ function _G._detalhes:Start()
f:SetScript ("OnMouseDown", function() f:StartMoving(); f:SetScript("OnUpdate", function() f:UpdateLeftRight() end) end)
f:SetScript ("OnMouseUp", function() f:StopMovingOrSizing(); f:SetScript("OnUpdate", nil); f:UpdateLeftRight() end)
+
+ function _detalhes:updatetestbox()
+ f:UpdateLeftRight()
+ end
+ _detalhes:ScheduleTimer("updatetestbox", 5)
+
--]]
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> details defaults
@@ -307,6 +313,9 @@ function _G._detalhes:Start()
}
self.custom [#self.custom+1] = HealingPotion
end
+
+ _detalhes:FillUserCustomSpells()
+
end
--_detalhes:OpenWelcomeWindow()
@@ -418,6 +427,8 @@ function _G._detalhes:Start()
lower_instance:InstanceAlert (Loc ["STRING_VERSION_UPDATE"], {[[Interface\GossipFrame\AvailableQuestIcon]], 16, 16, false}, 20, {_detalhes.OpenNewsWindow})
end
end
+
+ _detalhes:FillUserCustomSpells()
end
--> minimap
@@ -587,11 +598,13 @@ function _G._detalhes:Start()
end
end
-
+
--register lib-hotcorners
local reset_func = function() _detalhes.tabela_historico:resetar() end
_detalhes:RegisterHotCornerButton ("TOPLEFT", "DetailsLeftCornerButton", [[Interface\AddOns\Details\images\minimap]], "|cFFFFFFFFDetails!\n|cFF00FF00Left Click:|r clear all segments.", reset_func, nil, reset_func)
+ --> register time captures
+ --_detalhes:LoadUserTimeCaptures()
--[[
local f = CreateFrame ("frame", nil, UIParent)
@@ -611,5 +624,12 @@ function _G._detalhes:Start()
b:SetPoint ("left", f, "left")
b:SetAlpha (1)
--]]
+
+ --function _detalhes:OpenOptionsWindowAtStart()
+ --_detalhes:OpenOptionsWindow (_detalhes.tabela_instancias[1])
+ --end
+ --_detalhes:ScheduleTimer ("OpenOptionsWindowAtStart", 2)
+
+
end