translated code to English and a few bug fixes from latest alpha

This commit is contained in:
Tercio Jose
2023-06-21 17:27:58 -03:00
parent a2c5e926c9
commit 9fb2b0d66b
36 changed files with 3523 additions and 2679 deletions
@@ -108,7 +108,7 @@ function chartsObject.Ticker()
--data set to capture data of some combat attribute or totals
local combatTotalCaptures = configsForCaptureData.totals
local currentSegmentData = chartsObject.GetCurrentSegmentData()
local currentSegmentData = chartsObject.GetCurrentCombatData()
local chartData = currentSegmentData.ChartData
if (#playerCaptures > 0) then
@@ -244,7 +244,7 @@ function chartsObject.HasValidAndOpenCombat()
local bCombatState = chartsObject.GetCombatState()
if (bCombatState) then
local detaisCurrentCombat = Details:GetCurrentCombat()
local chartCurrentSegmentData = chartsObject.GetCurrentSegmentData()
local chartCurrentSegmentData = chartsObject.GetCurrentCombatData()
if (detaisCurrentCombat:GetCombatId() == chartCurrentSegmentData:GetCombatId()) then
--it's all good
return true
@@ -266,7 +266,7 @@ function chartsObject.GetNumSegments()
return #chartsObject.SegmentsData
end
function chartsObject.GetCurrentSegmentData()
function chartsObject.GetCurrentCombatData()
return chartsObject.segmentData
end
@@ -47,6 +47,7 @@ function breakdownWindowPlayerList.CreatePlayerListFrame()
---@type button
local pluginButton = breakdownWindowFrame.RegisteredPluginButtons[i]
pluginButton:Show()
pluginButton:Hide() --not ready yet
pluginButton:ClearAllPoints()
if (i == 1) then
@@ -451,7 +452,7 @@ function breakdownWindowPlayerList.CreatePlayerListFrame()
end)
local gradientStartColor = Details222.ColorScheme.GetColorFor("gradient-background")
local gradientBelow = DetailsFramework:CreateTexture(breakdownWindowFrame.playerScrollBox,
local gradientBelow = DetailsFramework:CreateTexture(breakdownWindowFrame.playerScrollBox,
{gradient = "vertical", fromColor = gradientStartColor, toColor = "transparent"}, 1, 90, "artwork", {0, 1, 0, 1})
gradientBelow:SetPoint("bottoms", 1, 1)
end
+6 -3
View File
@@ -6206,7 +6206,8 @@ function Details:GetSegmentInfo(index)
elseif (index == 0 or index == "current") then
combat = Details.tabela_vigente
else
combat = Details.tabela_historico.tabelas[index]
local segmentsTable = Details:GetCombatSegments()
combat = segmentsTable[index]
end
if (combat) then
@@ -6319,8 +6320,10 @@ local buildSegmentTooltip = function(self, deltaTime)
local amountOfSegments = 0
local segmentsWithACombat = 0
local segmentsTable = Details:GetCombatSegments()
for i = 1, Details.segments_amount do
if (Details.tabela_historico.tabelas[i]) then
if (segmentsTable[i]) then
segmentsWithACombat = segmentsWithACombat + 1
else
break
@@ -6339,7 +6342,7 @@ local buildSegmentTooltip = function(self, deltaTime)
local isMythicDungeon = false
for i = Details.segments_amount, 1, -1 do
if (i <= fill) then
local thisCombat = Details.tabela_historico.tabelas[i]
local thisCombat = segmentsTable[i]
if (thisCombat and not thisCombat.__destroyed) then
local enemy = thisCombat.is_boss and thisCombat.is_boss.name
local segmentInfoAdded = false
+1
View File
@@ -195,6 +195,7 @@ function Details.options.InitializeOptionsWindow(instance)
--search field
local searchBox = detailsFramework:CreateTextEntry(footerFrame, function()end, 140, 20, _, _, _, options_dropdown_template)
searchBox:SetPoint("left", changelog, "right", 10, 0)
searchBox:SetAsSearchBox()
local searchLabel = detailsFramework:CreateLabel(footerFrame, "Search:") --localize-me
searchLabel:SetPoint("bottomleft", searchBox, "topleft", 0, 2)
+166 -142
View File
@@ -1,189 +1,213 @@
local Details = _G.Details
local DF = _G.DetailsFramework
local detailsFramework = _G.DetailsFramework
local _
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ~run ~runcode
local addonName, Details222 = ...
local CreateFrame = CreateFrame
local UIParent = UIParent
local load = loadstring
function Details:InitializeRunCodeWindow()
local DetailsRunCodePanel = DF:CreateSimplePanel(UIParent, 700, 480, "Details! Run Code", "DetailsRunCodePanel")
DetailsRunCodePanel.Frame = DetailsRunCodePanel
DetailsRunCodePanel.__name = "Auto Run Code"
DetailsRunCodePanel.real_name = "DETAILS_RUNCODEWINDOW"
local detailsRunCodePanel = detailsFramework:CreateSimplePanel(UIParent, 700, 480, "Details! Run Code Automation", "DetailsRunCodePanel")
detailsRunCodePanel.Frame = detailsRunCodePanel
detailsRunCodePanel.__name = "Auto Run Code"
detailsRunCodePanel.real_name = "DETAILS_RUNCODEWINDOW"
--DetailsRunCodePanel.__icon = [[Interface\AddOns\Details\images\lua_logo]]
DetailsRunCodePanel.__icon = [[Interface\AddOns\Details\images\run_code]]
detailsRunCodePanel.__icon = [[Interface\AddOns\Details\images\run_code]]
--DetailsRunCodePanel.__iconcoords = {0, 1, 0, 1}
DetailsRunCodePanel.__iconcoords = {0, 30/32, 0, 25/32}
DetailsRunCodePanel.__iconcoords = {0, 1, 0, 1}
DetailsRunCodePanel.__iconcolor = "white"
DetailsPluginContainerWindow.EmbedPlugin (DetailsRunCodePanel, DetailsRunCodePanel, true)
function DetailsRunCodePanel.RefreshWindow()
Details.OpenRunCodeWindow()
detailsRunCodePanel.__iconcoords = {0, 30/32, 0, 25/32}
detailsRunCodePanel.__iconcoords = {0, 1, 0, 1}
detailsRunCodePanel.__iconcolor = "white"
DetailsPluginContainerWindow.EmbedPlugin(detailsRunCodePanel, detailsRunCodePanel, true)
function detailsRunCodePanel.RefreshWindow()
Details222.AutoRunCode.OpenRunCodeWindow()
end
DetailsRunCodePanel:Hide()
detailsRunCodePanel:Hide()
Details222.AutoRunCode.DetailsRunCodePanel = detailsRunCodePanel
end
function Details.OpenRunCodeWindow()
if (not DetailsRunCodePanel or not DetailsRunCodePanel.Initialized) then
DetailsRunCodePanel.Initialized = true
local f = DetailsRunCodePanel or DF:CreateSimplePanel(UIParent, 700, 480, "Details! Run Code", "DetailsRunCodePanel")
function Details222.AutoRunCode.OpenRunCodeWindow()
local detailsRunCodePanel = Details222.AutoRunCode.DetailsRunCodePanel
if (not detailsRunCodePanel or not detailsRunCodePanel.Initialized) then
detailsRunCodePanel.Initialized = true
local autoRunCodeFrame = detailsRunCodePanel or detailsFramework:CreateSimplePanel(UIParent, 700, 480, "Details! Run Code", "DetailsRunCodePanel")
--lua editor
local code_editor = DF:NewSpecialLuaEditorEntry(f, 885, 510, "text", "$parentCodeEditorWindow")
f.CodeEditor = code_editor
code_editor:SetPoint("topleft", f, "topleft", 20, -56)
--code editor appearance
code_editor.scroll:SetBackdrop(nil)
code_editor.editbox:SetBackdrop(nil)
code_editor:SetBackdrop(nil)
DF:ReskinSlider(code_editor.scroll)
if (not code_editor.__background) then
code_editor.__background = code_editor:CreateTexture(nil, "background")
end
code_editor:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
code_editor:SetBackdropBorderColor(0, 0, 0, 1)
code_editor.__background:SetColorTexture(0.2317647, 0.2317647, 0.2317647)
code_editor.__background:SetVertexColor(0.27, 0.27, 0.27)
code_editor.__background:SetAlpha(0.8)
code_editor.__background:SetVertTile(true)
code_editor.__background:SetHorizTile(true)
code_editor.__background:SetAllPoints()
--code compile error warning
local errortext_frame = CreateFrame("frame", nil, code_editor,"BackdropTemplate")
errortext_frame:SetPoint("bottomleft", code_editor, "bottomleft", 1, 1)
errortext_frame:SetPoint("bottomright", code_editor, "bottomright", -1, 1)
errortext_frame:SetHeight(20)
errortext_frame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
errortext_frame:SetBackdropBorderColor(0, 0, 0, 1)
errortext_frame:SetBackdropColor(0, 0, 0)
DF:CreateFlashAnimation (errortext_frame)
local errortext_label = DF:CreateLabel(errortext_frame, "", DF:GetTemplate("font", "ORANGE_FONT_TEMPLATE"))
errortext_label.textcolor = "red"
errortext_label:SetPoint("left", errortext_frame, "left", 3, 0)
code_editor.NextCodeCheck = 0.33
code_editor:HookScript ("OnUpdate", function(self, deltaTime)
code_editor.NextCodeCheck = code_editor.NextCodeCheck - deltaTime
local codeEditor = detailsFramework:NewSpecialLuaEditorEntry(UIParent, 885, 510, nil, nil, false, true, true)
codeEditor:SetPoint("topleft", autoRunCodeFrame, "topleft", 20, -56)
codeEditor:SetFrameStrata(autoRunCodeFrame:GetFrameStrata())
codeEditor:SetFrameLevel(autoRunCodeFrame:GetFrameLevel()+1)
if (code_editor.NextCodeCheck < 0) then
local script = code_editor:GetText()
local func, errortext = loadstring (script, "Q")
if (not func) then
local firstLine = strsplit("\n", script, 2)
errortext = errortext:gsub(firstLine, "")
errortext = errortext:gsub("%[string \"", "")
errortext = errortext:gsub("...\"]:", "")
errortext = errortext:gsub("Q\"]:", "")
errortext = "Line " .. errortext
errortext_label.text = errortext
else
errortext_label.text = ""
end
code_editor.NextCodeCheck = 0.33
function Details222.AutoRunCode.CodeEditorSetText(codeKey)
local text = Details222.AutoRunCode.CodeTable[codeKey]
return codeEditor:SetText(text)
end
detailsRunCodePanel:HookScript("OnShow", function()
codeEditor:Show()
end)
detailsRunCodePanel:SetScript("OnHide", function()
codeEditor:Hide()
end)
--code editor appearance
codeEditor.scroll:SetBackdrop(nil)
codeEditor.editbox:SetBackdrop(nil)
codeEditor:SetBackdrop(nil)
detailsFramework:ReskinSlider(codeEditor.scroll)
if (not codeEditor.__background) then
codeEditor.__background = codeEditor:CreateTexture(nil, "background")
end
codeEditor:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
codeEditor:SetBackdropBorderColor(0, 0, 0, 1)
codeEditor.__background:SetColorTexture(0.2317647, 0.2317647, 0.2317647)
codeEditor.__background:SetVertexColor(0.27, 0.27, 0.27)
codeEditor.__background:SetAlpha(0.8)
codeEditor.__background:SetVertTile(true)
codeEditor.__background:SetHorizTile(true)
codeEditor.__background:SetAllPoints()
--code compile error warning
local errortext_frame = CreateFrame("frame", nil, codeEditor, "BackdropTemplate")
errortext_frame:SetPoint("bottomleft", codeEditor, "bottomleft", 1, 1)
errortext_frame:SetPoint("bottomright", codeEditor, "bottomright", -1, 1)
errortext_frame:SetHeight(20)
errortext_frame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
errortext_frame:SetBackdropBorderColor(0, 0, 0, 1)
errortext_frame:SetBackdropColor(0, 0, 0)
detailsFramework:CreateFlashAnimation (errortext_frame)
local errortext_label = detailsFramework:CreateLabel(errortext_frame, "", detailsFramework:GetTemplate("font", "ORANGE_FONT_TEMPLATE"))
errortext_label.textcolor = "red"
errortext_label:SetPoint("left", errortext_frame, "left", 3, 0)
codeEditor.NextCodeCheck = 0.33
codeEditor:HookScript ("OnUpdate", function(self, deltaTime)
codeEditor.NextCodeCheck = codeEditor.NextCodeCheck - deltaTime
if (codeEditor.NextCodeCheck < 0) then
local script = codeEditor:GetText()
local func, errortext = load(script, "Q")
if (not func) then
local firstLine = strsplit("\n", script, 2)
errortext = errortext:gsub(firstLine, "")
errortext = errortext:gsub("%[string \"", "")
errortext = errortext:gsub("...\"]:", "")
errortext = errortext:gsub("Q\"]:", "")
errortext = "Line " .. errortext
errortext_label.text = errortext
else
errortext_label.text = ""
end
end)
codeEditor.NextCodeCheck = 0.33
end
end)
--script selector
local on_select_CodeType_option = function(self, fixedParameter, value)
--set the current editing code type
f.EditingCode = Details.RunCodeTypes [value].Value
f.EditingCodeKey = Details.RunCodeTypes [value].ProfileKey
autoRunCodeFrame.EditingCode = Details.RunCodeTypes[value].Value
autoRunCodeFrame.EditingCodeKey = Details.RunCodeTypes[value].ProfileKey
--load the code for the event
local code = Details.run_code [f.EditingCodeKey]
code_editor:SetText(code)
Details222.AutoRunCode.CodeEditorSetText(autoRunCodeFrame.EditingCodeKey)
end
local build_CodeType_dropdown_options = function()
local t = {}
for i = 1, #Details.RunCodeTypes do
local option = Details.RunCodeTypes [i]
t [#t + 1] = {label = option.Name, value = option.Value, onclick = on_select_CodeType_option, desc = option.Desc}
end
return t
end
local code_type_label = DF:CreateLabel(f, "Event:", DF:GetTemplate("font", "ORANGE_FONT_TEMPLATE"))
local code_type_dropdown = DF:CreateDropDown (f, build_CodeType_dropdown_options, 1, 160, 20, "CodeTypeDropdown", _, DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
local code_type_label = detailsFramework:CreateLabel(autoRunCodeFrame, "Event:", detailsFramework:GetTemplate("font", "ORANGE_FONT_TEMPLATE"))
local code_type_dropdown = detailsFramework:CreateDropDown(autoRunCodeFrame, build_CodeType_dropdown_options, 1, 160, 20, "CodeTypeDropdown", _, detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
code_type_dropdown:SetPoint("left", code_type_label, "right", 2, 0)
code_type_dropdown:SetFrameLevel(code_editor:GetFrameLevel() + 10)
code_type_label:SetPoint("bottomleft", code_editor, "topleft", 0, 8)
code_type_dropdown:SetFrameLevel(codeEditor:GetFrameLevel() + 10)
code_type_label:SetPoint("bottomleft", codeEditor, "topleft", 0, 8)
--create save button
local save_script = function()
local code = code_editor:GetText()
local func, errortext = loadstring (code, "Q")
local code = codeEditor:GetText()
local func, errortext = load(code, "Q")
if (func) then
Details.run_code [f.EditingCodeKey] = code
Details:RecompileAutoRunCode()
Details222.AutoRunCode.CodeTable[autoRunCodeFrame.EditingCodeKey] = code
Details222.AutoRunCode.RecompileAutoRunCode()
Details:Msg("Code saved!")
code_editor:ClearFocus()
codeEditor:ClearFocus()
else
errortext_frame:Flash(0.2, 0.2, 0.4, true, nil, nil, "NONE")
Details:Msg("Can't save the code: it has errors.")
end
end
local button_y = -6
local save_script_button = DF:CreateButton(f, save_script, 120, 20, "Save", -1, nil, nil, nil, nil, nil, DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate("font", "PLATER_BUTTON"))
save_script_button:SetIcon ([[Interface\BUTTONS\UI-Panel-ExpandButton-Up]], 20, 20, "overlay", {0.1, .9, 0.1, .9})
save_script_button:SetPoint("topright", code_editor, "bottomright", 0, button_y)
--create cancel button
local cancel_script = function()
code_editor:SetText(Details.run_code [f.EditingCodeKey])
Details:Msg("Code cancelled!")
code_editor:ClearFocus()
Details222.AutoRunCode.CodeEditorSetText(autoRunCodeFrame.EditingCodeKey)
codeEditor:ClearFocus()
end
local cancel_script_button = DF:CreateButton(f, cancel_script, 120, 20, "Cancel", -1, nil, nil, nil, nil, nil, DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate("font", "PLATER_BUTTON"))
cancel_script_button:SetIcon ([[Interface\BUTTONS\UI-Panel-MinimizeButton-Up]], 20, 20, "overlay", {0.1, .9, 0.1, .9})
cancel_script_button:SetPoint("topleft", code_editor, "bottomleft", 0, button_y)
--create run now button
local execute_script = function()
local script = code_editor:GetText()
local func, errortext = loadstring (script, "Q")
local script = codeEditor:GetText()
local func, errortext = load(script, "Q")
if (func) then
DF:SetEnvironment(func)
DF:QuickDispatch(func)
detailsFramework:SetEnvironment(func)
detailsFramework:QuickDispatch(func)
else
errortext_frame:Flash(0.2, 0.2, 0.4, true, nil, nil, "NONE")
end
end
local run_script_button = DF:CreateButton(f, execute_script, 120, 20, "Test Code", -1, nil, nil, nil, nil, nil, DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate("font", "PLATER_BUTTON"))
run_script_button:SetIcon ([[Interface\BUTTONS\UI-SpellbookIcon-NextPage-Up]], 20, 20, "overlay", {0.05, 0.95, 0.05, 0.95})
run_script_button:SetPoint("bottomright", code_editor, "topright", 0, 3)
end
DetailsPluginContainerWindow.OpenPlugin (DetailsRunCodePanel)
DetailsRunCodePanel.CodeTypeDropdown:Select(1, true)
--show the initialization code when showing up this window
DetailsRunCodePanel.EditingCode = Details.RunCodeTypes [1].Value
DetailsRunCodePanel.EditingCodeKey = Details.RunCodeTypes [1].ProfileKey
local code = Details.run_code [DetailsRunCodePanel.EditingCodeKey]
DetailsRunCodePanel.CodeEditor:SetText(code)
local button_y = -6
local saveButton = CreateFrame("button", nil, codeEditor)
detailsFramework:ApplyStandardBackdrop(saveButton)
saveButton:SetSize(120, 20)
saveButton:SetText("Save")
saveButton:SetScript("OnClick", save_script)
saveButton:SetPoint("topright", codeEditor, "bottomright", 0, button_y)
saveButton:SetNormalFontObject("GameFontNormal")
local cancelButton = CreateFrame("button", nil, codeEditor)
detailsFramework:ApplyStandardBackdrop(cancelButton)
cancelButton:SetSize(120, 20)
cancelButton:SetText("Cancel")
cancelButton:SetScript("OnClick", cancel_script)
cancelButton:SetPoint("topleft", codeEditor, "bottomleft", 0, button_y)
cancelButton:SetNormalFontObject("GameFontNormal")
--create run now button
local runButton = CreateFrame("button", nil, codeEditor)
detailsFramework:ApplyStandardBackdrop(runButton)
runButton:SetSize(120, 20)
runButton:SetText("Test Code")
runButton:SetScript("OnClick", execute_script)
runButton:SetPoint("bottomright", codeEditor, "topright", 0, 3)
runButton:SetNormalFontObject("GameFontNormal")
end
DetailsPluginContainerWindow.OpenPlugin(detailsRunCodePanel)
detailsRunCodePanel.CodeTypeDropdown:Select(1, true)
--show the initialization code when showing up this window
detailsRunCodePanel.EditingCode = Details.RunCodeTypes[1].Value
detailsRunCodePanel.EditingCodeKey = Details.RunCodeTypes[1].ProfileKey
Details222.AutoRunCode.CodeEditorSetText(detailsRunCodePanel.EditingCodeKey)
end
+89 -86
View File
@@ -9,6 +9,7 @@ local _
local unpack = unpack
local floor = math.floor
local gameCooltip = GameCooltip
local CreateFrame = CreateFrame
--api locals
do
@@ -164,7 +165,7 @@ do
self.MainFrame.texture:SetBlendMode("BLEND")
on_leave_all_switch_button(self.MainFrame)
end
allDisplaysFrame.check_text_size = function(font_string)
local text_width = font_string:GetStringWidth()
while (text_width > 104) do
@@ -174,20 +175,20 @@ do
text_width = font_string:GetStringWidth()
end
end
local create_all_switch_button = function(attribute, sub_attribute, x, y)
local button = CreateFrame("button", "DetailsAllAttributesFrame" .. attribute .. sub_attribute, allDisplaysFrame)
button:SetSize(130, 16)
button.texture = button:CreateTexture(nil, "overlay")
button.texture:SetPoint("left", 0, 0)
button.texture:SetSize(icon_size, icon_size)
local texture_highlight_frame = CreateFrame("button", "DetailsAllAttributesFrame" .. attribute .. sub_attribute .. "IconFrame", button)
texture_highlight_frame:SetSize(icon_size, icon_size)
texture_highlight_frame:SetPoint("left", 0, 0)
texture_highlight_frame.texture = button.texture
texture_highlight_frame.MainFrame = button
button.text = button:CreateFontString(nil, "overlay", "GameFontNormal")
button.text:SetPoint("left", button.texture, "right", 2, 0)
button.attribute = attribute
@@ -195,22 +196,22 @@ do
button:SetPoint("topleft", x, y)
Details:SetFontSize(button.text, Details.all_switch_config.font_size)
Details:SetFontColor(button.text, text_color)
button:SetScript("OnClick", on_click_all_switch_button)
button:SetScript("OnEnter", on_enter_all_switch_button)
button:SetScript("OnLeave", on_leave_all_switch_button)
texture_highlight_frame:SetScript("OnClick", on_click_all_switch_button)
texture_highlight_frame:SetScript("OnEnter", on_enter_all_switch_button_icon)
texture_highlight_frame:SetScript("OnLeave", on_leave_all_switch_button_icon)
button:RegisterForClicks ("LeftButtonDown", "RightButtonDown")
return button
end
allDisplaysFrame:SetScript("OnShow", function()
if (not allDisplaysFrame.already_built) then
local x, y = 8, -8
allDisplaysFrame.higher_counter = 0
@@ -228,9 +229,9 @@ do
local title_str = allDisplaysFrame:CreateFontString(nil, "overlay", "GameFontNormal")
title_str:SetPoint("left", title_icon, "right", 2, 0)
title_str:SetText(loc_attribute_name)
y = y - 20
allDisplaysFrame.buttons [attribute] = {}
for i = 1, #Details.sub_atributos [attribute].lista do
--localized sub attribute name
@@ -246,20 +247,20 @@ do
tinsert(allDisplaysFrame.buttons [attribute], button)
y = y - 17
end
if (#Details.sub_atributos [attribute].lista > allDisplaysFrame.higher_counter) then
allDisplaysFrame.higher_counter = #Details.sub_atributos [attribute].lista
end
x = x + 130
y = -8
end
--prepare for scripts
allDisplaysFrame.x = x
allDisplaysFrame.y = -8
allDisplaysFrame.buttons [Details.atributos[0]+1] = {}
local title_icon = allDisplaysFrame:CreateTexture(nil, "overlay")
local texture, l, r, t, b = Details:GetAttributeIcon (Details.atributos[0]+1)
title_icon:SetTexture([[Interface\AddOns\Details\images\icons]])
@@ -269,11 +270,11 @@ do
local title_str = allDisplaysFrame:CreateFontString(nil, "overlay", "GameFontNormal")
title_str:SetPoint("left", title_icon, "right", 2, 0)
title_str:SetText("Scripts")
title_icon:SetPoint("topleft", allDisplaysFrame.x, allDisplaysFrame.y)
allDisplaysFrame.y = allDisplaysFrame.y - 20
allDisplaysFrame.title_custom = title_icon
allDisplaysFrame.already_built = true
--prepare for plugins
@@ -289,13 +290,13 @@ do
title_icon:SetPoint("topleft", allDisplaysFrame.x + 130, -8)
allDisplaysFrame.title_scripts = title_icon
end
--update scripts
local custom_index = Details.atributos[0]+1
for _, button in ipairs(allDisplaysFrame.buttons [custom_index]) do
button:Hide()
end
local button_index = 1
for i = #Details.custom, 1, -1 do
local button = allDisplaysFrame.buttons [custom_index] [button_index]
@@ -304,7 +305,7 @@ do
tinsert(allDisplaysFrame.buttons [custom_index], button)
allDisplaysFrame.y = allDisplaysFrame.y - 17
end
local custom = Details.custom [i]
button.text:SetText(custom.name)
Details:SetFontSize(button.text, Details.all_switch_config.font_size)
@@ -313,10 +314,10 @@ do
button.texture:SetTexture(custom.icon)
button.texture:SetTexCoord(0.078125, 0.921875, 0.078125, 0.921875)
button:Show()
button_index = button_index + 1
end
if (#Details.custom > allDisplaysFrame.higher_counter) then
allDisplaysFrame.higher_counter = #Details.custom
end
@@ -351,12 +352,12 @@ do
button.text:SetText(ptable[1])
Details:SetFontSize(button.text, Details.all_switch_config.font_size)
allDisplaysFrame.check_text_size(button.text)
button.texture:SetTexture(ptable[2])
button.texture:SetTexCoord(0.078125, 0.921875, 0.078125, 0.921875)
button:Show()
button_index = button_index + 1
end
end
@@ -496,42 +497,42 @@ function Details.switch:ShowMe(instancia)
Details.switch.CloseMe()
end
end
local hide_label = function(self)
self.texture:Hide()
self.button:Hide()
self.background:Hide()
self:Hide()
end
local show_label = function(self)
self.texture:Show()
self.button:Show()
self.background:Show()
self:Show()
end
local on_enter = function(self)
--self.MyObject.this_background:SetBlendMode("ADD")
--self.MyObject.boss_texture:SetBlendMode("ADD")
end
local on_leave = function(self)
self.MyObject.this_background:SetBlendMode("BLEND")
self.MyObject.boss_texture:SetBlendMode("BLEND")
end
function Details.switch:CreateSegmentBlock()
local s = gump:CreateLabel(Details.switch.frame)
Details:SetFontSize(s, 9)
local index = #Details.switch.segments_blocks
if (index == 1) then --overall button
index = -1
elseif (index >= 2) then
index = index - 1
end
local button = gump:CreateButton(Details.switch.frame, segment_switch, 100, 20, "", index)
button:SetPoint("topleft", s, "topleft", -17, 0)
button:SetPoint("bottomright", s, "bottomright", 0, 0)
@@ -546,24 +547,24 @@ function Details.switch:ShowMe(instancia)
background:SetWidth(85)
background:SetPoint("topleft", s.widget, "topleft", -16, 3)
background:SetPoint("bottomright", s.widget, "bottomright", -3, -5)
button.this_background = background
button.boss_texture = boss_texture.widget
s.texture = boss_texture
s.button = button
s.background = background
button:SetScript("OnEnter", on_enter)
button:SetScript("OnLeave", on_leave)
s.HideMe = hide_label
s.ShowMe = show_label
tinsert(Details.switch.segments_blocks, s)
return s
end
function Details.switch:GetSegmentBlock (index)
local block = Details.switch.segments_blocks [index]
if (not block) then
@@ -572,38 +573,38 @@ function Details.switch:ShowMe(instancia)
return block
end
end
function Details.switch:ClearSegmentBlocks()
for _, block in ipairs(Details.switch.segments_blocks) do
block:HideMe()
end
end
function Details.switch:ResizeSegmentBlocks()
local x = 7
local y = 5
local window_width, window_height = Details.switch.current_instancia:GetSize()
local horizontal_amt = floor(math.max(window_width / 100, 2))
local vertical_amt = floor((window_height - y) / 20)
local size = window_width / horizontal_amt
local frame = Details.switch.frame
Details.switch:ClearSegmentBlocks()
local i = 1
for vertical = 1, vertical_amt do
x = 7
for horizontal = 1, horizontal_amt do
local button = Details.switch:GetSegmentBlock (i)
button:SetPoint("topleft", frame, "topleft", x + 16, -y)
button:SetSize(size - 22, 12)
button:ShowMe()
i = i + 1
x = x + size
if (i > 40) then
@@ -613,37 +614,39 @@ function Details.switch:ShowMe(instancia)
y = y + 20
end
end
Details.switch.segments_blocks = {}
--current and overall
Details.switch:CreateSegmentBlock()
Details.switch:CreateSegmentBlock()
local block1 = Details.switch:GetSegmentBlock (1)
block1:SetText(Loc["STRING_CURRENTFIGHT"])
block1.texture:SetTexture([[Interface\Scenarios\ScenariosParts]])
block1.texture:SetTexCoord(55/512, 81/512, 368/512, 401/512)
local block2 = Details.switch:GetSegmentBlock (2)
block2:SetText(Loc["STRING_SEGMENT_OVERALL"])
block2.texture:SetTexture([[Interface\Scenarios\ScenariosParts]])
block2.texture:SetTexCoord(55/512, 81/512, 368/512, 401/512)
end
Details.switch:ClearSegmentBlocks()
Details.switch:HideAllBookmarks()
local segment_index = 1
for i = 3, #Details.tabela_historico.tabelas + 2 do
local combat = Details.tabela_historico.tabelas [segment_index]
local block = Details.switch:GetSegmentBlock (i)
local enemy, color, raid_type, killed, is_trash, portrait, background, background_coords = Details:GetSegmentInfo (segment_index)
block:SetText("#" .. segment_index .. " " .. enemy)
local segmentsTable = Details:GetCombatSegments()
local segmentIndex = 1
for i = 3, #segmentsTable + 2 do
---@type combat
local combat = segmentsTable[segmentIndex]
local block = Details.switch:GetSegmentBlock(i)
local enemy, color, raid_type, killed, is_trash, portrait, background, background_coords = Details:GetSegmentInfo(segmentIndex)
block:SetText("#" .. segmentIndex .. " " .. enemy)
if (combat.is_boss and combat.instance_type == "raid") then
local L, R, T, B, Texture = Details:GetBossIcon (combat.is_boss.mapid, combat.is_boss.index)
if (L) then
@@ -655,30 +658,30 @@ function Details.switch:ShowMe(instancia)
else
block.texture:SetTexture([[Interface\Scenarios\ScenarioIcon-Boss]])
end
block:ShowMe()
segment_index = segment_index + 1
segmentIndex = segmentIndex + 1
end
Details.switch.frame:SetScale(instancia.window_scale)
Details.switch:ResizeSegmentBlocks()
for i = segment_index+2, #Details.switch.segments_blocks do
for i = segmentIndex+2, #Details.switch.segments_blocks do
Details.switch.segments_blocks [i]:HideMe()
end
Details.switch.frame:SetPoint("topleft", instancia.baseframe, "topleft", 0, 1)
Details.switch.frame:SetPoint("bottomright", instancia.baseframe, "bottomright", 0, 1)
Details.switch.frame:Show()
return
else
if (Details.switch.segments_blocks) then
Details.switch:ClearSegmentBlocks()
end
end
--check if there is some custom contidional
if (instancia.atributo == 5) then
local custom_object = instancia:GetCustomObject()
@@ -689,13 +692,13 @@ function Details.switch:ShowMe(instancia)
end
end
end
Details.switch.frame:SetPoint("topleft", instancia.baseframe, "topleft", 0, 1)
Details.switch.frame:SetPoint("bottomright", instancia.baseframe, "bottomright", 0, 1)
local altura = instancia.baseframe:GetHeight()
local mostrar_quantas = floor(altura / Details.switch.button_height) * 2
local precisa_mostrar = 0
for i = 1, #Details.switch.table do
local slot = Details.switch.table [i]
@@ -709,31 +712,31 @@ function Details.switch:ShowMe(instancia)
break
end
end
if (Details.switch.mostrar_quantas ~= mostrar_quantas) then
if (Details.switch.mostrar_quantas ~= mostrar_quantas) then
for i = 1, #Details.switch.buttons do
if (i <= mostrar_quantas) then
if (i <= mostrar_quantas) then
Details.switch.buttons [i]:Show()
else
Details.switch.buttons [i]:Hide()
end
end
if (#Details.switch.buttons < mostrar_quantas) then
Details.switch.slots = mostrar_quantas
end
Details.switch.mostrar_quantas = mostrar_quantas
end
Details.switch:Resize (precisa_mostrar)
Details.switch:Update()
Details.switch.frame:SetScale(instancia.window_scale)
Details.switch.frame:Show()
Details.switch:Resize (precisa_mostrar)
if (DetailsSwitchPanel.all_switch:IsShown()) then
return DetailsSwitchPanel.all_switch:Hide()
end
@@ -927,7 +930,7 @@ function Details.switch:Update()
for i = 1, slots_shown do
--bookmark index
local index = (offset * Details.switch.vertical_amt) + i
--button
local button = Details.switch.buttons [i]
if (not button) then
@@ -937,21 +940,21 @@ function Details.switch:Update()
end
local options = Details.switch.table [index]
if (not options and index <= 40) then
if (not options and index <= 40) then
options = {}
Details.switch.table [index] = options
end
button.bookmark_number = index --button on icon
button.button2.bookmark_number = index --button on text
local icone
local coords
local name
local vcolor
local add
local textColor = "white"
if (options and options.sub_atributo) then
if (options.atributo == 5) then --custom
local CustomObject = Details.custom [options.sub_atributo]
@@ -967,7 +970,7 @@ function Details.switch:Update()
name = CustomObject.name
vcolor = vertex_color_default
end
elseif (options.atributo == "plugin") then --plugin
local plugin = Details:GetPlugin (options.sub_atributo)