From 0b38e849bce05d1bbbe357b9cd0711fc2d3903c2 Mon Sep 17 00:00:00 2001 From: Tercio Date: Fri, 9 Feb 2018 11:33:02 -0200 Subject: [PATCH] - Added real time compile error while writing a custom script. - Added protection on compiling a custom script to show in the window, an error text should be printed to chat window. - Added events: COMM_EVENT_RECEIVED and COMM_EVENT_SENT. - When options panel is not in the screen, the script will attempt to fix the position. - While doing a sync on guild statistics, more information about the download is shown. --- API.lua | 85 +++++++++++---------- boot.lua | 4 +- classes/classe_custom.lua | 55 ++++++++----- classes/classe_others.lua | 4 +- core/network.lua | 18 ++++- core/plugins.lua | 14 +++- core/windows.lua | 51 ++++++++++++- functions/events.lua | 11 ++- gumps/janela_custom.lua | 24 +++++- plugins/Details_EncounterDetails/frames.lua | 33 ++++---- 10 files changed, 211 insertions(+), 88 deletions(-) diff --git a/API.lua b/API.lua index aade0669..92434626 100644 --- a/API.lua +++ b/API.lua @@ -603,83 +603,84 @@ Extract the npcId from the actor guid. --custom displays [[ -Cstom Display is a special display where users can set their own rules on searching for what show in the window. -There is 4 scripts which compose the display: +@TITLECustom Displays@ +@DESCis a special display where users can set their own rules. +There is 4 scripts which composes a custom display:@ -Required: -Search - this is the main script, it's responsible to build a list of actors to show in the window. +@TITLERequired:@ +@DESCSearch: the main script, it's responsible to search and build what the window will show.@ -Optional: -Tooltip - it runs when the user hover over a bar. -Total - runs when showing the bar, and helps format the total done. -Percent - also runs when showing the bar, it formats the percentage amount. +@TITLEOptional:@ +@DESCTooltip: runs when the user hover over a bar. +Total: helps format the total done number. +Percent: formats the percent number amount.@ -Search Code: -- The script receives 3 parameters: *Combat, *CustomContainer and *Instance. +@TITLESearch Code:@ +@DESC- The script receives 3 parameters: *Combat, *CustomContainer and *Instance. *Combat - is the reference for the selected combat shown in the window (the one selected on segments menu). *CustomContainer - is the place where the display mantain stored the results, Details! get the content inside the container and use to update the window. *Instance - is the reference of the window where the custom display is shown. - Also, the script must return three values: total made by all players, the amount of the top player and the amount of players found by the script. -- The search script basically begins getting these three parameters and declaring our three return values: +- The search script basically begins getting these three parameters and declaring our three return values:@ -local Combat, CustomContainer, Instance = ... -local total, top, amount = 0, 0, 0 +@CODElocal Combat, CustomContainer, Instance = ... +local total, top, amount = 0, 0, 0@ -- Then, we build our search for wherever we want to show, here we are building an example for Damage Done by Pets and Guardians. -- So, as we are working with damage, we want to get a list of Actors from the Damage Container of the combat and iterate it with ipairs: +@DESC- Then, we build our search for wherever we want to show, here we are building an example for Damage Done by Pets and Guardians. +- So, as we are working with damage, we want to get a list of Actors from the Damage Container of the combat and iterate it with ipairs:@ -local damage_container = combat:GetActorList( DETAILS_ATTRIBUTE_DAMAGE ) +@CODElocal damage_container = combat:GetActorList( DETAILS_ATTRIBUTE_DAMAGE ) for i, actor in ipairs( damage_container ) do --do stuff -end +end@ -- Actor, can be anything, a monster, player, boss, etc, so, we need to check if actor is a pet: +@DESC- Actor, can be anything, a monster, player, boss, etc, so, we need to check if actor is a pet:@ -if (actor:IsPetOrGuardian()) then +@CODEif (actor:IsPetOrGuardian()) then --do stuff -end +end@ -- Now we found a pet, we need to get the damage done and find who is the owner of this pet, after that, we also need to check if the owner is a player: +@DESC- Now we found a pet, we need to get the damage done and find who is the owner of this pet, after that, we also need to check if the owner is a player:@ -local petOwner = actor.owner +@CODElocal petOwner = actor.owner if (petOwner:IsPlayer()) then local petDamage = actor.total -end +end@ -- The next step is add the pet owner into the CustomContainer: +@DESC- The next step is add the pet owner into the CustomContainer:@ -CustomContainer:AddValue (petOwner, petDamage) +@CODECustomContainer:AddValue (petOwner, petDamage)@ -- And in the and, we need to get the total, top and amount values. This is generally calculated inside our loop above, but just calling the API for the result is more handy: +@DESC- And in the and, we need to get the total, top and amount values. This is generally calculated inside our loop above, but just calling the API for the result is more handy:@ -total, top = CustomContainer:GetTotalAndHighestValue() +@CODEtotal, top = CustomContainer:GetTotalAndHighestValue() amount = CustomContainer:GetNumActors() -return total, top, amount +return total, top, amount@ -The finished script looks like this: - +@DESCThe finished script looks like this:@ +@CODE local Combat, CustomContainer, Instance = ... local total, top, amount = 0, 0, 0 local damage_container = Combat:GetActorList( DETAILS_ATTRIBUTE_DAMAGE ) for i, actor in ipairs( damage_container ) do - if (actor:IsPetOrGuardian()) then - local petOwner = actor.owner - if (petOwner:IsPlayer()) then - local petDamage = actor.total - CustomContainer:AddValue( petOwner, petDamage ) - end - end + if (actor:IsPetOrGuardian()) then + local petOwner = actor.owner + if (petOwner:IsPlayer()) then + local petDamage = actor.total + CustomContainer:AddValue( petOwner, petDamage ) + end + end end total, top = CustomContainer:GetTotalAndHighestValue() amount = CustomContainer:GetNumActors() return total, top, amount - +@ Tooltip Code: - The script receives 3 parameters: *Actor, *Combat and *Instance. This script has no return value. @@ -697,10 +698,10 @@ local actorPets = Actor.pets - In Details! always use ">= 1" not "> 0", also when not using our format functions, use at least floor() for i, petName in ipairs( actorPets ) do - local petActor = Combat( DETAILS_ATTRIBUTE_DAMAGE, petName) - if (petActor and petActor.total >= 1) then - --do stuff - end + local petActor = Combat( DETAILS_ATTRIBUTE_DAMAGE, petName) + if (petActor and petActor.total >= 1) then + --do stuff + end end - With the pet in hands, what we have to do now is add this pet to our tooltip. diff --git a/boot.lua b/boot.lua index 73d83494..fe3672fb 100644 --- a/boot.lua +++ b/boot.lua @@ -3,9 +3,9 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.build_counter = 5231 + _detalhes.build_counter = 5282 _detalhes.userversion = "v7.3.0." .. _detalhes.build_counter - _detalhes.realversion = 128 --core version + _detalhes.realversion = 129 --core version _detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" Details = _detalhes diff --git a/classes/classe_custom.lua b/classes/classe_custom.lua index 553be8fd..91219132 100644 --- a/classes/classe_custom.lua +++ b/classes/classe_custom.lua @@ -110,22 +110,39 @@ if (_detalhes.custom_function_cache [instance.customName]) then func = _detalhes.custom_function_cache [instance.customName] else - func = loadstring (custom_object.script) + local errortext + func, errortext = loadstring (custom_object.script) if (func) then _detalhes.custom_function_cache [instance.customName] = func + else + _detalhes:Msg ("|cFFFF9900error compiling code for custom display " .. (instance.customName or "") .. " |r:", errortext) end - local tooltip_script = custom_object.tooltip and loadstring (custom_object.tooltip) - if (tooltip_script) then - _detalhes.custom_function_cache [instance.customName .. "Tooltip"] = tooltip_script + if (custom_object.tooltip) then + local tooltip_script, errortext = loadstring (custom_object.tooltip) + if (tooltip_script) then + _detalhes.custom_function_cache [instance.customName .. "Tooltip"] = tooltip_script + else + _detalhes:Msg ("|cFFFF9900error compiling tooltip code for custom display " .. (instance.customName or "") .. " |r:", errortext) + end end - local total_script = custom_object.total_script and loadstring (custom_object.total_script) - if (total_script) then - _detalhes.custom_function_cache [instance.customName .. "Total"] = total_script + + if (custom_object.total_script) then + local total_script, errortext = loadstring (custom_object.total_script) + if (total_script) then + _detalhes.custom_function_cache [instance.customName .. "Total"] = total_script + else + _detalhes:Msg ("|cFFFF9900error compiling total code for custom display " .. (instance.customName or "") .. " |r:", errortext) + end end - local percent_script = custom_object.percent_script and loadstring (custom_object.percent_script) - if (percent_script) then - _detalhes.custom_function_cache [instance.customName .. "Percent"] = percent_script + + if (custom_object.percent_script) then + local percent_script, errortext = loadstring (custom_object.percent_script) + if (percent_script) then + _detalhes.custom_function_cache [instance.customName .. "Percent"] = percent_script + else + _detalhes:Msg ("|cFFFF9900error compiling percent code for custom display " .. (instance.customName or "") .. " |r:", errortext) + end end end @@ -134,9 +151,6 @@ _detalhes:EndRefresh (instance, 0, combat, combat [1]) end - --> call the loop function - --total, top, amount = func (combat, instance_container, instance) - okey, total, top, amount = _pcall (func, combat, instance_container, instance) if (not okey) then _detalhes:Msg ("|cFFFF9900error on custom display function|r:", total) @@ -470,7 +484,7 @@ end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> custom object functions - + local actor_class_color_r, actor_class_color_g, actor_class_color_b function atributo_custom:UpdateBar (row_container, index, percentage_type, rank, total, top, instance, is_forced, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator) @@ -484,14 +498,14 @@ local percent local okey - + if (percent_script) then --local value, top, total, combat, instance = ... okey, percent = _pcall (percent_script, self.value, top, total, combat, instance, self) if (not okey) then _detalhes:Msg ("|cFFFF9900error on custom display function|r:", percent) return _detalhes:EndRefresh (instance, 0, combat, combat [1]) - end + end else if (percentage_type == 1) then percent = _cstr ("%.1f", self.value / total * 100) @@ -503,7 +517,11 @@ if (not bars_show_data [3]) then percent = "" else - percent = percent .. "%" + if (percent) then + percent = percent .. "%" + else + percent = "" + end end if (total_script) then @@ -930,6 +948,9 @@ if (custom_object:IsScripted()) then if (custom_object.tooltip) then local func = _detalhes.custom_function_cache [instance.customName .. "Tooltip"] + if (func) then + + end local okey, errortext = _pcall (func, actor, instance.showing, instance) if (not okey) then _detalhes:Msg ("|cFFFF9900error on custom display tooltip function|r:", errortext) diff --git a/classes/classe_others.lua b/classes/classe_others.lua index 4b75e3f6..1c45102f 100644 --- a/classes/classe_others.lua +++ b/classes/classe_others.lua @@ -518,7 +518,7 @@ function atributo_misc:ReportSingleDebuffUptimeLine (misc_actor, instance) end function atributo_misc:DeadAtualizarBarra (morte, qual_barra, colocacao, instancia) - + morte ["dead"] = true --> marca que esta tabela é uma tabela de mortes, usado no controla na hora de montar o tooltip local esta_barra = instancia.barras[qual_barra] --> pega a referência da barra na janela @@ -539,7 +539,7 @@ function atributo_misc:DeadAtualizarBarra (morte, qual_barra, colocacao, instanc _setmetatable (morte, {__call = RefreshBarraMorte}) morte._custom = true end - + esta_barra.texto_esquerdo:SetText (colocacao .. ". " .. morte [3]:gsub (("%-.*"), "")) esta_barra.texto_direita:SetText (morte [6]) diff --git a/core/network.lua b/core/network.lua index e7d7277a..737200a7 100644 --- a/core/network.lua +++ b/core/network.lua @@ -127,7 +127,7 @@ if (_detalhes.host_by) then return end - + if (realm ~= _GetRealmName()) then player = player .."-"..realm end @@ -403,15 +403,20 @@ _detalhes:Msg ("(debug) network received:", prefix, "length:",string.len (data)) end + --event + _detalhes:SendEvent ("COMM_EVENT_RECEIVED", nil, string.len (data), prefix, player, realm, dversion, arg6, arg7, arg8, arg9) + --print ("comm received", prefix, _detalhes.network.functions [prefix]) local func = _detalhes.network.functions [prefix] if (func) then + --todo: this call should be safe func (player, realm, dversion, arg6, arg7, arg8, arg9) else func = plugins_registred [prefix] --print ("plugin comm?", func, player, realm, dversion, arg6, arg7, arg8, arg9) if (func) then + --todo: this call should be safe func (player, realm, dversion, arg6, arg7, arg8, arg9) else if (_detalhes.debug) then @@ -420,9 +425,18 @@ end end end - + _detalhes:RegisterComm ("DTLS", "CommReceived") + --> hook the send comm message so we can trigger events when sending data + --> this adds overhead, but easily catches all outgoing comm messages + hooksecurefunc (Details, "SendCommMessage", function (context, addonPrefix, serializedData, channel) + --unpack data + local prefix, player, realm, dversion, arg6, arg7, arg8, arg9 = _select (2, _detalhes:Deserialize (serializedData)) + --send the event + _detalhes:SendEvent ("COMM_EVENT_SENT", nil, string.len (serializedData), prefix, player, realm, dversion, arg6, arg7, arg8, arg9) + end) + function _detalhes:RegisterPluginComm (prefix, func) assert (type (prefix) == "string" and string.len (prefix) >= 2 and string.len (prefix) <= 4, "RegisterPluginComm expects a string with 2-4 characters on #1 argument.") assert (type (func) == "function" or (type (func) == "string" and type (self [func]) == "function"), "RegisterPluginComm expects a function or function name on #2 argument.") diff --git a/core/plugins.lua b/core/plugins.lua index 484e3600..5a4893f6 100644 --- a/core/plugins.lua +++ b/core/plugins.lua @@ -483,7 +483,8 @@ bigdogRow:SetHeight (20) bigdogRow:SetColorTexture (.5, .5, .5, .1) bigdogRow:Hide() - + + -- --> plugins menu title bar local titlebar_plugins = CreateFrame ("frame", nil, menuBackground) titlebar_plugins:SetPoint ("topleft", menuBackground, "topleft", 2, -3) @@ -510,7 +511,16 @@ --> scripts f:SetScript ("OnShow", function() - + --check if the window isn't out of screen + C_Timer.After (1, function() + local right = f:GetRight() + if (right and right > GetScreenWidth() + 500) then + f:ClearAllPoints() + f:SetPoint ("center", UIParent, "center", 0, 0) + LibWindow.SavePosition (f) + _detalhes:Msg ("detected options panel out of screen, position has reset") + end + end) end) f:SetScript ("OnHide", function() diff --git a/core/windows.lua b/core/windows.lua index 6ebba4fa..30da572a 100644 --- a/core/windows.lua +++ b/core/windows.lua @@ -25,6 +25,9 @@ local end_window_spacement = 0 + --prefix used on sync statistics + local CONST_GUILD_SYNC = "GS" + --> settings local animation_speed = 33 @@ -1170,7 +1173,7 @@ ---> raid history window ~history +--> raid history window ~history ~statistics function _detalhes:InitializeRaidHistoryWindow() local DetailsRaidHistoryWindow = CreateFrame ("frame", "DetailsRaidHistoryWindow", UIParent) @@ -1351,6 +1354,13 @@ GuildRankCheckBox:SetAsCheckBox() local guild_sync = function() + + f.RequestedAmount = 0 + f.DownloadedAmount = 0 + f.EstimateSize = 0 + f.DownloadedSize = 0 + f.SyncStartTime = time() + _detalhes.storage:DBGuildSync() f.GuildSyncButton:Disable() @@ -1408,6 +1418,45 @@ GuildSyncButton:SetPoint ("topright", f, "topright", -20, -34) GuildSyncButton:SetIcon ([[Interface\GLUES\CharacterSelect\RestoreButton]], 12, 12, "overlay", {0.2, .8, 0.2, .8}, nil, 4) + --> listen to comm events + local eventListener = _detalhes:CreateEventListener() + + function eventListener:OnCommReceived (event, length, prefix, playerName, realmName, detailsVersion, guildSyncID, data) + if (prefix == CONST_GUILD_SYNC) then + --received a list of encounter IDs + if (guildSyncID == "L") then + + --received one encounter table + elseif (guildSyncID == "A") then + f.DownloadedAmount = f.DownloadedAmount + 1 + + --size = 1 byte per characters in the string + f.EstimateSize = length * f.RequestedAmount > f.EstimateSize and length * f.RequestedAmount or f.RequestedAmount + f.DownloadedSize = f.DownloadedSize + length + local downloadSpeed = f.DownloadedSize / (time() - f.SyncStartTime) + + f.SyncText:SetText ("working [downloading " .. f.DownloadedAmount .. "/" .. f.RequestedAmount .. ", " .. format ("%.2f", downloadSpeed/1024) .. "Kbps]") + end + end + end + + function eventListener:OnCommSent (event, length, prefix, playerName, realmName, detailsVersion, guildSyncID, missingIDs, arg8, arg9) + if (prefix == CONST_GUILD_SYNC) then + --requested a list of encounters + if (guildSyncID == "R") then + + + --requested to download a selected list of encounter tables + elseif (guildSyncID == "G") then + f.RequestedAmount = f.RequestedAmount + #missingIDs + f.SyncText:SetText ("working [downloading " .. f.DownloadedAmount .. "/" .. f.RequestedAmount .. "]") + end + end + end + + eventListener:RegisterEvent ("COMM_EVENT_RECEIVED", "OnCommReceived") + eventListener:RegisterEvent ("COMM_EVENT_SENT", "OnCommSent") + function f.BuildReport() if (f.LatestResourceTable) then local reportFunc = function (IsCurrent, IsReverse, AmtLines) diff --git a/functions/events.lua b/functions/events.lua index 5b934591..cd4db48e 100644 --- a/functions/events.lua +++ b/functions/events.lua @@ -56,9 +56,10 @@ ["BUFF_UPDATE_DEBUFFPOWER"] = {}, --> network - ["REALM_CHANNEL_ENTER"] = {}, - ["REALM_CHANNEL_LEAVE"] = {}, - + ["REALM_CHANNEL_ENTER"] = {}, --deprecated (realm channels are disabled) + ["REALM_CHANNEL_LEAVE"] = {}, --deprecated + ["COMM_EVENT_RECEIVED"] = {}, --added on core 129 + ["COMM_EVENT_SENT"] = {}, --added on core 129 } local function AlreadyRegistred (_tables, _object) @@ -109,6 +110,8 @@ local common_events = { ["ZONE_TYPE_CHANGED"] = true, ["REALM_CHANNEL_ENTER"] = true, ["REALM_CHANNEL_LEAVE"] = true, + ["COMM_EVENT_RECEIVED"] = true, + ["COMM_EVENT_SENT"] = true, } ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -228,7 +231,7 @@ local common_events = { --> Send Event function _detalhes:SendEvent (event, object, ...) - + --> send event to all registred plugins if (event == "PLUGIN_DISABLED" or event == "PLUGIN_ENABLED") then diff --git a/gumps/janela_custom.lua b/gumps/janela_custom.lua index b680164f..7047084a 100644 --- a/gumps/janela_custom.lua +++ b/gumps/janela_custom.lua @@ -254,8 +254,8 @@ --loop end --if not managed inside the loop, get the values of total, top and amount - total, top = Container:GetTotalAndHighestValue() - amount = Container:GetNumActors() + total, top = CustomContainer:GetTotalAndHighestValue() + amount = CustomContainer:GetNumActors() --return the values return total, top, amount @@ -1726,6 +1726,21 @@ code_editor:SetPoint ("topleft", custom_window, "topleft", CONST_MENU_X_POSITION, CONST_EDITBOX_Y_POSITION) code_editor:SetFrameLevel (custom_window:GetFrameLevel()+4) code_editor:SetBackdrop (nil) + code_editor:HookScript ("OnUpdate", function() + local script = code_editor:GetText() + local func, errortext = loadstring (script) + if (not func) then + local firstLine = strsplit ("\n", script, 2) + errortext = errortext:gsub (firstLine, "") + errortext = errortext:gsub ("%[string \"", "") + errortext = errortext:gsub ("...\"]:", "") + errortext = "Line " .. errortext + DetailsCustomPanel.ErrorString.text = errortext + else + DetailsCustomPanel.ErrorString.text = "" + end + -- + end) --> create a background area where the code editor is local codeEditorBackground = gump:NewButton (custom_window, nil, nil, nil, 1, 1, function()end) @@ -1834,6 +1849,11 @@ open_API:SetPoint ("left", apply1, "right", 2, 0) open_API:SetTemplate (CONST_CODETEXTENTRYBUTTON_TEMPLATE) + local errorString = gump:CreateLabel (supportFrame) + errorString:SetPoint ("left", open_API, "right", 10, 0) + errorString.color = "red" + DetailsCustomPanel.ErrorString = errorString + code_editor:SetScript ("OnShow", function() expand:Show() font_size1:Show() diff --git a/plugins/Details_EncounterDetails/frames.lua b/plugins/Details_EncounterDetails/frames.lua index fa07eaf7..61374a92 100644 --- a/plugins/Details_EncounterDetails/frames.lua +++ b/plugins/Details_EncounterDetails/frames.lua @@ -1193,7 +1193,7 @@ _detalhes.EncounterDetailsTempWindow = function (EncounterDetails) end for _, button in ipairs (BossFrame.AllButtons) do - button:SetTemplate (PhaseButtonTemplate) + button:SetTemplate (DetailsFrameWork:GetTemplate ("button", "DETAILS_PLUGIN_BUTTON_TEMPLATE")) end BossFrame.DBMBars:Hide() @@ -1217,7 +1217,7 @@ _detalhes.EncounterDetailsTempWindow = function (EncounterDetails) BossFrame.ShowType = "main" BossFrame.segmentosDropdown:Enable() - BossFrame.buttonSwitchNormal:SetTemplate (PhaseButtonTemplateSelected) + BossFrame.buttonSwitchNormal:SetTemplate (DetailsFrameWork:GetTemplate ("button", "DETAILS_PLUGIN_BUTTONSELECTED_TEMPLATE")) elseif (to == "spellsauras") then @@ -1253,7 +1253,7 @@ _detalhes.EncounterDetailsTempWindow = function (EncounterDetails) BossFrame.DBMBars:Refresh() BossFrame.BigWigsBars:Refresh() - BossFrame.buttonSwitchSpellsAuras:SetTemplate (PhaseButtonTemplateSelected) + BossFrame.buttonSwitchSpellsAuras:SetTemplate (DetailsFrameWork:GetTemplate ("button", "DETAILS_PLUGIN_BUTTONSELECTED_TEMPLATE")) elseif (to == "emotes") then @@ -1292,7 +1292,7 @@ _detalhes.EncounterDetailsTempWindow = function (EncounterDetails) BossFrame.segmentosDropdown:Disable() - BossFrame.buttonSwitchBossEmotes:SetTemplate (PhaseButtonTemplateSelected) + BossFrame.buttonSwitchBossEmotes:SetTemplate (DetailsFrameWork:GetTemplate ("button", "DETAILS_PLUGIN_BUTTONSELECTED_TEMPLATE")) elseif (to == "phases") then @@ -1305,7 +1305,7 @@ _detalhes.EncounterDetailsTempWindow = function (EncounterDetails) EncounterDetailsPhaseFrame:Show() - BossFrame.buttonSwitchPhases:SetTemplate (PhaseButtonTemplateSelected) + BossFrame.buttonSwitchPhases:SetTemplate (DetailsFrameWork:GetTemplate ("button", "DETAILS_PLUGIN_BUTTONSELECTED_TEMPLATE")) elseif (to == "graph") then @@ -1343,10 +1343,10 @@ _detalhes.EncounterDetailsTempWindow = function (EncounterDetails) BossFrame.segmentosDropdown:Enable() - BossFrame.buttonSwitchGraphic:SetTemplate (PhaseButtonTemplateSelected) + BossFrame.buttonSwitchGraphic:SetTemplate (DetailsFrameWork:GetTemplate ("button", "DETAILS_PLUGIN_BUTTONSELECTED_TEMPLATE")) end end - + -- ~button ~menu local BUTTON_WIDTH = 120 @@ -1359,31 +1359,37 @@ _detalhes.EncounterDetailsTempWindow = function (EncounterDetails) BossFrame.buttonSwitchNormal = _detalhes.gump:CreateButton (BossFrame, BossFrame.switch, BUTTON_WIDTH, BUTTON_HEIGHT, "Summary", "main") BossFrame.buttonSwitchNormal:SetPoint ("TOPLEFT", BossFrame, "TOPLEFT", HEADER_MENUBUTTONS_X, HEADER_MENUBUTTONS_Y) BossFrame.buttonSwitchNormal:SetIcon ("Interface\\AddOns\\Details_EncounterDetails\\images\\boss_frame_buttons", 18, 18, "overlay", {0, 0.1015625, 0, 0.505625}) - BossFrame.buttonSwitchNormal:SetTemplate (PhaseButtonTemplateSelected) + BossFrame.buttonSwitchNormal:SetTemplate (DetailsFrameWork:GetTemplate ("button", "DETAILS_PLUGIN_BUTTONSELECTED_TEMPLATE")) + BossFrame.buttonSwitchNormal:SetWidth (BUTTON_WIDTH) --chart BossFrame.buttonSwitchGraphic = _detalhes.gump:CreateButton (BossFrame, BossFrame.switch, BUTTON_WIDTH, BUTTON_HEIGHT, "Charts", "graph") BossFrame.buttonSwitchGraphic:SetPoint ("left", BossFrame.buttonSwitchNormal, "right", HEADER_MENUBUTTONS_SPACEMENT, 0) BossFrame.buttonSwitchGraphic:SetIcon ("Interface\\AddOns\\Details_EncounterDetails\\images\\boss_frame_buttons", 18, 18, "overlay", {0.1271875, 0.21875, 0, 0.505625}) - BossFrame.buttonSwitchGraphic:SetTemplate (PhaseButtonTemplate) + BossFrame.buttonSwitchGraphic:SetTemplate (DetailsFrameWork:GetTemplate ("button", "DETAILS_PLUGIN_BUTTON_TEMPLATE")) + BossFrame.buttonSwitchGraphic:SetWidth (BUTTON_WIDTH) --emotes BossFrame.buttonSwitchBossEmotes = _detalhes.gump:CreateButton (BossFrame, BossFrame.switch, BUTTON_WIDTH, BUTTON_HEIGHT, "Emotes", "emotes") BossFrame.buttonSwitchBossEmotes:SetPoint ("left", BossFrame.buttonSwitchGraphic, "right", HEADER_MENUBUTTONS_SPACEMENT, 0) BossFrame.buttonSwitchBossEmotes:SetIcon ("Interface\\AddOns\\Details_EncounterDetails\\images\\boss_frame_buttons", 18, 18, "overlay", {91/256, 116/256, 0, 0.505625}) - BossFrame.buttonSwitchBossEmotes:SetTemplate (PhaseButtonTemplate) + BossFrame.buttonSwitchBossEmotes:SetTemplate (DetailsFrameWork:GetTemplate ("button", "DETAILS_PLUGIN_BUTTON_TEMPLATE")) + BossFrame.buttonSwitchBossEmotes:SetWidth (BUTTON_WIDTH) --spells e auras BossFrame.buttonSwitchSpellsAuras = _detalhes.gump:CreateButton (BossFrame, BossFrame.switch, BUTTON_WIDTH, BUTTON_HEIGHT, "WeakAuras", "spellsauras") BossFrame.buttonSwitchSpellsAuras:SetPoint ("left", BossFrame.buttonSwitchBossEmotes, "right", HEADER_MENUBUTTONS_SPACEMENT, 0) BossFrame.buttonSwitchSpellsAuras:SetIcon ("Interface\\AddOns\\Details_EncounterDetails\\images\\boss_frame_buttons", 18, 18, "overlay", {121/256, 146/256, 0, 0.505625}) - BossFrame.buttonSwitchSpellsAuras:SetTemplate (PhaseButtonTemplate) + BossFrame.buttonSwitchSpellsAuras:SetTemplate (DetailsFrameWork:GetTemplate ("button", "DETAILS_PLUGIN_BUTTON_TEMPLATE")) + BossFrame.buttonSwitchSpellsAuras:SetWidth (BUTTON_WIDTH) --phases BossFrame.buttonSwitchPhases = _detalhes.gump:CreateButton (BossFrame, BossFrame.switch, BUTTON_WIDTH, BUTTON_HEIGHT, "Phases", "phases") BossFrame.buttonSwitchPhases:SetPoint ("left", BossFrame.buttonSwitchSpellsAuras, "right", HEADER_MENUBUTTONS_SPACEMENT, 0) BossFrame.buttonSwitchPhases:SetIcon ("Interface\\AddOns\\Details_EncounterDetails\\images\\boss_frame_buttons", 18, 18, "overlay", {151/256, 176/256, 0, 0.505625}) - BossFrame.buttonSwitchPhases:SetTemplate (PhaseButtonTemplate) + BossFrame.buttonSwitchPhases:SetTemplate (DetailsFrameWork:GetTemplate ("button", "DETAILS_PLUGIN_BUTTON_TEMPLATE")) + BossFrame.buttonSwitchPhases:SetWidth (BUTTON_WIDTH) + BossFrame.AllButtons = {BossFrame.buttonSwitchNormal, BossFrame.buttonSwitchGraphic, BossFrame.buttonSwitchBossEmotes, BossFrame.buttonSwitchSpellsAuras, BossFrame.buttonSwitchPhases} @@ -2587,9 +2593,8 @@ end --> options button local options = DetailsFrameWork:NewButton (frame, nil, "$parentOptionsButton", "OptionsButton", 120, 20, EncounterDetails.OpenOptionsPanel, nil, nil, nil, "Options") options:SetPoint ("left", segmentos, "right", 10, 0) - options:SetTextColor (1, 0.93, 0.74) + options:SetTemplate (DetailsFrameWork:GetTemplate ("button", "DETAILS_PLUGIN_BUTTON_TEMPLATE")) options:SetIcon ([[Interface\Buttons\UI-OptionsButton]], 14, 14, nil, {0, 1, 0, 1}, nil, 3) - options:SetTemplate (DetailsFrameWork:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) --> Caixa do Dano total tomado pela Raid