diff --git a/frames/window_playerbreakdown.lua b/frames/window_playerbreakdown.lua index a5a57ac6..d5aca054 100644 --- a/frames/window_playerbreakdown.lua +++ b/frames/window_playerbreakdown.lua @@ -58,10 +58,27 @@ local spellInfoSettings = { amount = 6, } +_detalhes.player_details_tabs = {} +info.currentTabsInUse = {} + ------------------------------------------------------------------------------------------------------------------------------ --self = instancia --jogador = classe_damage ou classe_heal +function Details:GetBreakdownTabsInUse() + return info.currentTabsInUse +end + +function Details:GetBreakdownTabByName(tabName, tablePool) + tablePool = tablePool or _detalhes.player_details_tabs + for index = 1, #tablePool do + local tab = tablePool[index] + if (tab.tabname == tabName) then + return tab, index + end + end +end + --return the combat being used to show the data in the opened breakdown window function Details:GetCombatFromBreakdownWindow() return info.instancia and info.instancia.showing @@ -214,13 +231,13 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo gump:HidaAllDetalheInfo() gump:JI_AtualizaContainerBarras (-1) - + local classe = jogador.classe - + if (not classe) then classe = "monster" end - + --info.classe_icone:SetTexture ("Interface\\AddOns\\Details\\images\\"..classe:lower()) --> top left info.classe_icone:SetTexture ("Interface\\AddOns\\Details\\images\\classes") --> top left info.SetClassIcon (jogador, classe) @@ -240,27 +257,88 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo end end end - - info:ShowTabs() - Details.FadeHandler.Fader (info, 0) + + --info:ShowTabs() + + Details.FadeHandler.Fader(info, 0) Details:UpdateBreakdownPlayerList() - + --check which tab was selected and reopen that tab -- if (info.selectedTab == "Summary") then -- return jogador:MontaInfo() -- else --open tab + local tabsShown = {} + local tabsReplaced = {} + local tabReplacedAmount = 0 + + table.wipe(info.currentTabsInUse) + for index = 1, #_detalhes.player_details_tabs do - local tab = _detalhes.player_details_tabs [index] - if (tab:condition (info.jogador, info.atributo, info.sub_atributo)) then - if (tab.tabname == info.selectedTab) then - --_detalhes.player_details_tabs [index]:Click() - --_detalhes.player_details_tabs [index].onclick() - _detalhes.player_details_tabs [index]:OnShowFunc() + local tab = _detalhes.player_details_tabs[index] + tab.replaced = nil + tabsShown[#tabsShown+1] = tab + end + + for index = 1, #tabsShown do + --get the tab + local tab = tabsShown[index] + + if (tab.replaces) then + local attributeList = tab.replaces.attributes + if (attributeList[info.atributo]) then + if (attributeList[info.atributo][info.sub_atributo]) then + local tabReplaced, tabIndex = Details:GetBreakdownTabByName(tab.replaces.tabNameToReplace, tabsShown) + if (tabReplaced and tabIndex < index) then + + tabReplaced:Hide() + tabReplaced.frame:Hide() + tinsert(tabsReplaced, tabReplaced) + + tremove(tabsShown, tabIndex) + tinsert(tabsShown, tabIndex, tab) + + if (tabReplaced.tabname == info.selectedTab) then + info.selectedTab = tab.tabname + end + + tabReplaced.replaced = true + tabReplacedAmount = tabReplacedAmount + 1 + end + end end end end + + local newTabsShown = {} + local tabAlreadyInUse = {} + + for index = 1, #tabsShown do + if (not tabAlreadyInUse[tabsShown[index].tabname]) then + tabAlreadyInUse[tabsShown[index].tabname] = true + tinsert(newTabsShown, tabsShown[index]) + end + end + + tabsShown = newTabsShown + info.currentTabsInUse = newTabsShown + + info:ShowTabs() + + local shownTab + for index = 1, #tabsShown do + local tab = tabsShown[index] + if (tab:condition(info.jogador, info.atributo, info.sub_atributo)) then + if (info.selectedTab == tab.tabname) then + tabsShown[index]:Click() + tabsShown[index]:OnShowFunc() + shownTab = tabsShown[index] + end + end + end + + shownTab:Click() end -- for beta todo: info background need a major rewrite @@ -1861,7 +1939,7 @@ function gump:CriaJanelaInfo() end, nil, --[4] fill function function() --[5] onclick - for _, tab in _ipairs (_detalhes.player_details_tabs) do + for _, tab in _ipairs (Details:GetBreakdownTabsInUse()) do tab.frame:Hide() end end, @@ -4874,12 +4952,12 @@ function gump:CriaJanelaInfo() local secondRowIndex = 1 local breakLine = 6 --th tab it'll start the second line - for index = 1, #_detalhes.player_details_tabs do - - local tab = _detalhes.player_details_tabs [index] - - if (tab:condition (info.jogador, info.atributo, info.sub_atributo)) then + local tablePool = Details:GetBreakdownTabsInUse() + + for index = 1, #tablePool do + local tab = tablePool[index] + if (tab:condition(info.jogador, info.atributo, info.sub_atributo) and not tab.replaced) then --test if can show the tutorial for the comparison tab if (tab.tabname == "Compare") then --_detalhes:SetTutorialCVar ("DETAILS_INFO_TUTORIAL1", false) @@ -4931,14 +5009,14 @@ function gump:CriaJanelaInfo() end if (tabsShown < 2) then - _detalhes.player_details_tabs[1]:SetPoint ("BOTTOMLEFT", info.container_barras, "TOPLEFT", 490 - (94 * (1-0)), 1) + tablePool[1]:SetPoint ("BOTTOMLEFT", info.container_barras, "TOPLEFT", 490 - (94 * (1-0)), 1) end --selected by default - _detalhes.player_details_tabs[1]:Click() + tablePool[1]:Click() end - este_gump:SetScript ("OnHide", function (self) + este_gump:SetScript ("OnHide", function(self) _detalhes:FechaJanelaInfo() for _, tab in _ipairs (_detalhes.player_details_tabs) do tab:Hide() @@ -4955,15 +5033,13 @@ end info.selectedTab = "Summary" -_detalhes.player_details_tabs = {} - -function _detalhes:CreatePlayerDetailsTab (tabname, localized_name, condition, fillfunction, onclick, oncreate, iconSettings) +function _detalhes:CreatePlayerDetailsTab (tabname, localized_name, condition, fillfunction, onclick, oncreate, iconSettings, replace) if (not tabname) then tabname = "unnamed" end - + --create a button for the tab - local newTabButton = gump:CreateButton (info, onclick, 20, 20) + local newTabButton = gump:CreateButton (info, onclick, 20, 20, nil, nil, nil, nil, nil, "DetailsPlayerBreakdownWindowTab" .. tabname) newTabButton:SetTemplate ("DETAILS_TAB_BUTTON_TEMPLATE") if (tabname == "Summary") then newTabButton:SetTemplate ("DETAILS_TAB_BUTTONSELECTED_TEMPLATE") @@ -4985,7 +5061,7 @@ function _detalhes:CreatePlayerDetailsTab (tabname, localized_name, condition, f newTabButton.frame:SetFrameStrata ("HIGH") newTabButton.frame:SetFrameLevel (info:GetFrameLevel()+5) newTabButton.frame:EnableMouse (true) - + if (iconSettings) then local texture = iconSettings.texture local coords = iconSettings.coords @@ -5032,6 +5108,7 @@ function _detalhes:CreatePlayerDetailsTab (tabname, localized_name, condition, f newTabButton.frame:Hide() + newTabButton.replaces = replace _detalhes.player_details_tabs [#_detalhes.player_details_tabs+1] = newTabButton if (not onclick) then @@ -5039,7 +5116,7 @@ function _detalhes:CreatePlayerDetailsTab (tabname, localized_name, condition, f newTabButton.OnShowFunc = function (self) self = self.MyObject or self - for _, tab in _ipairs (_detalhes.player_details_tabs) do + for _, tab in _ipairs (Details:GetBreakdownTabsInUse()) do tab.frame:Hide() tab:SetTemplate ("DETAILS_TAB_BUTTON_TEMPLATE") end @@ -5055,7 +5132,7 @@ function _detalhes:CreatePlayerDetailsTab (tabname, localized_name, condition, f newTabButton.OnShowFunc = function (self) self = self.MyObject or self - for _, tab in _ipairs (_detalhes.player_details_tabs) do + for _, tab in _ipairs (Details:GetBreakdownTabsInUse()) do tab.frame:Hide() tab:SetTemplate ("DETAILS_TAB_BUTTON_TEMPLATE") end @@ -5088,6 +5165,7 @@ function _detalhes:CreatePlayerDetailsTab (tabname, localized_name, condition, f end end) + return newTabButton, newTabButton.frame end function _detalhes.playerDetailWindow:monta_relatorio (botao) diff --git a/plugins/Details_Streamer/Details_Streamer-BCC.toc b/plugins/Details_Streamer/Details_Streamer-BCC.toc index 85a59f3c..dc1de7fd 100644 --- a/plugins/Details_Streamer/Details_Streamer-BCC.toc +++ b/plugins/Details_Streamer/Details_Streamer-BCC.toc @@ -1,4 +1,4 @@ -## Interface: 20501 +## Interface: 20502 ## Title: Details!: Streamer (plugin) ## Notes: Show which spells you are casting, viewers can see what are you doing and follow your steps. ## RequiredDeps: Details diff --git a/plugins/Details_TinyThreat/Details_TinyThreat-BCC.toc b/plugins/Details_TinyThreat/Details_TinyThreat-BCC.toc index f0e90398..8ab84574 100644 --- a/plugins/Details_TinyThreat/Details_TinyThreat-BCC.toc +++ b/plugins/Details_TinyThreat/Details_TinyThreat-BCC.toc @@ -1,4 +1,4 @@ -## Interface: 20501 +## Interface: 20502 ## Title: Details!: Tiny Threat (plugin) ## Notes: Threat meter plugin, show threat for group members in the window. Select it from the Plugin menu in the Orange Cogwheel. ## RequiredDeps: Details diff --git a/plugins/Details_TinyThreat/Details_TinyThreat-Classic.toc b/plugins/Details_TinyThreat/Details_TinyThreat-Classic.toc new file mode 100644 index 00000000..5a58ed4e --- /dev/null +++ b/plugins/Details_TinyThreat/Details_TinyThreat-Classic.toc @@ -0,0 +1,14 @@ +## Interface: 11401 +## Title: Details!: Tiny Threat (plugin) +## Notes: Threat meter plugin, show threat for group members in the window. Select it from the Plugin menu in the Orange Cogwheel. +## RequiredDeps: Details +## OptionalDeps: Ace3 + +#@no-lib-strip@ +embeds.xml +#@end-no-lib-strip@ + +enUS.lua +ptBR.lua + +Details_TinyThreat.lua diff --git a/plugins/Details_TinyThreat/Details_TinyThreat.lua b/plugins/Details_TinyThreat/Details_TinyThreat.lua index af01f45a..1a851f7f 100644 --- a/plugins/Details_TinyThreat/Details_TinyThreat.lua +++ b/plugins/Details_TinyThreat/Details_TinyThreat.lua @@ -720,14 +720,14 @@ function ThreatMeter:OnEvent (_, event, ...) elseif (event == "ADDON_LOADED") then local AddonName = select (1, ...) + if (AddonName == "Details_TinyThreat") then - if (_G._detalhes) then - + if (DetailsFramework.IsClassicWow()) then - return + --return end - + --> create widgets CreatePluginFrames (data)