From e8b0b5687acd663a3c1a4487d4f6edebf8e925f4 Mon Sep 17 00:00:00 2001 From: Tercio Date: Tue, 14 Jul 2015 17:24:17 -0300 Subject: [PATCH] - Added an option to show a stopwatch on the title text showing the elapsed time of an encounter. - Window title text now shrinks correctly when isn't enough space for it. --- boot.lua | 9 ++- classes/classe_instancia_include.lua | 5 +- core/control.lua | 3 + core/meta.lua | 2 +- core/parser.lua | 2 - core/windows.lua | 24 +++---- gumps/janela_options.lua | 33 +++++++-- gumps/janela_principal.lua | 100 ++++++++++++++++++++++++++- 8 files changed, 150 insertions(+), 28 deletions(-) diff --git a/boot.lua b/boot.lua index a20ef79b..f5feceda 100644 --- a/boot.lua +++ b/boot.lua @@ -4,7 +4,7 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") _detalhes.build_counter = 1209 --it's 1209 for release - _detalhes.userversion = "v3.17.2" + _detalhes.userversion = "v3.17.3" _detalhes.realversion = 73 --core version _detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" Details = _detalhes @@ -21,7 +21,9 @@ do local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) --[[ -|cFFFFFF00v3.17.2 (|cFFFFCC00Jul 13, 2015|r|cFFFFFF00)|r:\n\n +|cFFFFFF00v3.17.3 (|cFFFFCC00Jul 14, 2015|r|cFFFFFF00)|r:\n\n +|cFFFFFF00-|r Added an option to show a stopwatch on the title text showing the elapsed time of an encounter.\n\n +|cFFFFFF00-|r Window title text now shrinks correctly when isn't enough space for it.\n\n |cFFFFFF00-|r For some special cases, left click now open the report window and shift+click shows the tooltip content in the window.\n\n |cFFFFFF00-|r Damage Taken by Spells now are a part of Damage bracket (no more on custom).\n\n |cFFFFFF00-|r Fixed custom functions for the customized bar left text.\n\n @@ -32,7 +34,7 @@ do -- - Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v3.17.2 (|cFFFFCC00Jul 13, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r For some special cases, left click now open the report window and shift+click shows the tooltip content in the window.\n\n|cFFFFFF00-|r Damage Taken by Spells now are a part of Damage bracket (no more on custom).\n\n|cFFFFFF00-|r Fixed custom functions for the customized bar left text.\n\n|cFFFFFF00-|r Improvements on report text format and also reverse option now works as intended.\n\n|cFFFFFF00-|r Removed the option for report only what is shown in the window.\n\n|cFFFFFF00-|r Added skins for report panel, the skin follow the skin selected for Player Detail Window.\n\n|cFFFFFF00v3.16.0c (|cFFFFCC00Jul 06, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an issue with Encounter Details graphic for Archimonde encounter.\n\n|cFFFFFF00-|r Numbers format on Player Detail Window now respect the format chosen on options panel.\n\n|cFFFFFF00-|r Removed pet icons on Player Detail Window.\n\n|cFFFFFF00-|r Fixed some wrong textures on spec icons.\n\n|cFFFFFF00-|r Improvements on all skins for the Player Detail Window.\n\n|cFFFFFF00v3.15.8b (|cFFFFCC00Jul 01, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Soul Capacitor trinket fix.\n\n|cFFFFFF00-|r Fixed several small bugs from 6.2 patch.\n\n|cFFFFFF00-|r Disabled the special behavior for Tyrant Velhari encounter.\n\n|cFFFFFF00v3.15.7 (|cFFFFCC00Jun 23, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added support for Hellfire Citadel raid.\n\n|cFFFFFF00-|r Added support for custom CLEU parser functions.\n\n|cFFFFFF00-|r Tyrant Velhari encounter now has a custom CLEU parser function for healing where the heal absorbed by Aura of Contempt will count towards overheal and not healing done.\n\n|cFFFFFF00-|r Added support for embed on Chat Tabs.\n\n|cFFFFFF00-|r |cFFAAFFAAPS: We've made an addon for Shadow-Lord Iskar encounter called 'Iskar Assist' check it out|r.\n\n|cFFFFFF00v3.15.5a (|cFFFFCC00Jun 12, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an issue where sometimes tooltips wasn't being shown.\n\n|cFFFFFF00-|r Fixed a problem with overall data where it was using, even on dungoens, the raid-only 30 delay rule.\n\n|cFFFFFF00-|r Fixed an issue with spec detection (now it may detect even faster).\n\n|cFFFFFF00v3.15.5 (|cFFFFCC00Jun 09, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed a problem with auto hide feature not hiding plugins hosted by the window.\n\n|cFFFFFF00-|r Fixed an issue with stretch feature when the anchor button was anchored at the bottom side of the window.\n\n|cFFFFFF00-|r Small interface tweaks on tooltips, bookmark and player detail window.\n\n|cFFFFFF00-|r Custom display 'My Spells' now also show amount of casts and uptime.\n\n|cFFFFFF00-|r Added an extra tooltip for the class icon at the player's bar.\n\n|cFFFFFF00-|r Activity time now has only 3 seconds inactivity tolerance on battlegrounds and arenas.\n\n|cFFFFFF00-|r Effective time will automatically be used when inside a battleground and using sync from the score board.\n\n|cFFFFFF00-|r Added 'hide all' option on the minimap menu.\n\n|cFFFFFF00-|r Added support for battlegrounds.\n\n|cFFFFFF00-|r Added option for disable showing battleground enemies when the window is in group mode.\n\n|cFFFFFF00-|r Added option to disable the sync from battleground score board.\n\n|cFFFFFF00-|r Enemies from a battleground match segment won't be erased when the player logout.\n\n|cFFFFFF00v3.14.4 (|cFFFFCC00May 27, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r TimeLine (plugin): now also shows marks symbolizing the player death.\n\n|cFFFFFF00-|r Added raid history panel. Open it through bookmark or /details history.\n\n|cFFFFFF00-|r Added support for skins for Player Detail Window.\n\n|cFFFFFF00-|r Added report history on report button.\n\n|cFFFFFF00-|r Added key bindings settings for report what is shown on window #1 or #2.\n\n|cFFFFFF00v3.14.0b (|cFFFFCC00May 13, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Several texture changes for a smaller download size.\n\n|cFFFFFF00v3.13.4a (|cFFFFCC00May 06, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Created 'Details! Forge' but is still under development: /details forge.\n\n|cFFFFFF00-|r Several improvements on combatlog reader and custom displays.\n\n|cFFFFFF00-|r Improvements on enemies damage taken tooltip.\n\n|cFFFFFF00v3.13.1 (|cFFFFCC00April 27, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added casted amount for healing and damage spells. The result is shown on Player Detail Window and Comparison Panel.\n\n|cFFFFFF00-|r Added uptime amount for healing spells on Player Detail Window.\n\n|cFFFFFF00-|r Added an option to disable lock/resize/ungroup buttons. It's under miscellaneous bracket on Options Panel.\n\n|cFFFFFF00-|r Wallpaper for menus on title bar got a customization option under tooltips bracket on Options Panel.\n\n|cFFFFFF00-|r Updated spell list for Crowd Control and class detection.\n\n|cFFFFFF00-|r Improved Weakaura creation tool under Encounter Details Plugin.\n\n|cFFFFFF00v3.12.10 (|cFFFFCC00April 18, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added the spell uptime on damage player detail window.\n\n|cFFFFFF00-|r Added Rune Tap as cooldown.\n\n|cFFFFFF00-|r Report lines for deaths is now inverted. No need to scroll up the chat to see the cause of death anymore.\n\n|cFFFFFF00-|r Fixed some annoyances with auto current feature where it was changing the segments even when the user were using the window.\n\n|cFFFFFF00v3.12.7 (|cFFFFCC00April 09, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added slash command /details profile .\n\n|cFFFFFF00v3.12.6 (|cFFFFCC00May 06, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Encounter Details (plugin): added a report button on Emotes tab.\n\n|cFFFFFF00-|r Encounter Details (plugin): improved Weakauras creation.\n\n|cFFFFFF00-|r Encounter Details (plugin): fixed the report text for interrupts and dispells.\n\n|cFFFFFF00-|r Crowd control by Pets now is merged with its owner.\n\n|cFFFFFF00-|r Truncated left text on bars now shows the entire text when hover over the bar.\n\n|cFFFFFF00-|r Added an extra option on minimap menu to disable the minimap icon.\n\n|cFFFFFF00-|r Fixed a problem when disabling the minimap icon through options panel.\n\n|cFFFFFF00-|r Fixed an issue with item level tracker feature.\n\n|cFFFFFF00v3.12.2 (|cFFFFCC00Mar 30, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Raid Check (plugin): added item level.\n\n|cFFFFFF00-|r Advanced Death Logs (plugin): bug fixes, it's important to update it.\n\n|cFFFFFF00-|r Time Line (plugin): bug fixes.\n\n|cFFFFFF00-|r Added option to disabled th eitem level tracker.\n\n|cFFFFFF00-|r Added item level on Raid Check plugin panel.\n\n|cFFFFFF00-|r Added Spirit Link Totem damage and healing on death log.\n\n|cFFFFFF00-|r Added the total of life exchanged by the Spirit Link Totem on player detail window.\n\n|cFFFFFF00-|r Added more spells for crowd control.\n\n|cFFFFFF00-|r Added scroll on bookmark panel.\n\n|cFFFFFF00-|r Fixed issue with Dps/Hps data broker which wasn't respecting the type of time (effective/activity) selected.\n\n|cFFFFFF00-|r Fixed few bugs when using the key bind to toggle windows." + Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v3.17.3 (|cFFFFCC00Jul 14, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added an option to show a stopwatch on the title text showing the elapsed time of an encounter.\n\n|cFFFFFF00-|r Window title text now shrinks correctly when isn't enough space for it.\n\n|cFFFFFF00-|r For some special cases, left click now open the report window and shift+click shows the tooltip content in the window.\n\n|cFFFFFF00-|r Damage Taken by Spells now are a part of Damage bracket (no more on custom).\n\n|cFFFFFF00-|r Fixed custom functions for the customized bar left text.\n\n|cFFFFFF00-|r Improvements on report text format and also reverse option now works as intended.\n\n|cFFFFFF00-|r Removed the option for report only what is shown in the window.\n\n|cFFFFFF00-|r Added skins for report panel, the skin follow the skin selected for Player Detail Window.\n\n|cFFFFFF00v3.16.0c (|cFFFFCC00Jul 06, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an issue with Encounter Details graphic for Archimonde encounter.\n\n|cFFFFFF00-|r Numbers format on Player Detail Window now respect the format chosen on options panel.\n\n|cFFFFFF00-|r Removed pet icons on Player Detail Window.\n\n|cFFFFFF00-|r Fixed some wrong textures on spec icons.\n\n|cFFFFFF00-|r Improvements on all skins for the Player Detail Window.\n\n|cFFFFFF00v3.15.8b (|cFFFFCC00Jul 01, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Soul Capacitor trinket fix.\n\n|cFFFFFF00-|r Fixed several small bugs from 6.2 patch.\n\n|cFFFFFF00-|r Disabled the special behavior for Tyrant Velhari encounter.\n\n|cFFFFFF00v3.15.7 (|cFFFFCC00Jun 23, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added support for Hellfire Citadel raid.\n\n|cFFFFFF00-|r Added support for custom CLEU parser functions.\n\n|cFFFFFF00-|r Tyrant Velhari encounter now has a custom CLEU parser function for healing where the heal absorbed by Aura of Contempt will count towards overheal and not healing done.\n\n|cFFFFFF00-|r Added support for embed on Chat Tabs.\n\n|cFFFFFF00-|r |cFFAAFFAAPS: We've made an addon for Shadow-Lord Iskar encounter called 'Iskar Assist' check it out|r.\n\n|cFFFFFF00v3.15.5a (|cFFFFCC00Jun 12, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an issue where sometimes tooltips wasn't being shown.\n\n|cFFFFFF00-|r Fixed a problem with overall data where it was using, even on dungoens, the raid-only 30 delay rule.\n\n|cFFFFFF00-|r Fixed an issue with spec detection (now it may detect even faster).\n\n|cFFFFFF00v3.15.5 (|cFFFFCC00Jun 09, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed a problem with auto hide feature not hiding plugins hosted by the window.\n\n|cFFFFFF00-|r Fixed an issue with stretch feature when the anchor button was anchored at the bottom side of the window.\n\n|cFFFFFF00-|r Small interface tweaks on tooltips, bookmark and player detail window.\n\n|cFFFFFF00-|r Custom display 'My Spells' now also show amount of casts and uptime.\n\n|cFFFFFF00-|r Added an extra tooltip for the class icon at the player's bar.\n\n|cFFFFFF00-|r Activity time now has only 3 seconds inactivity tolerance on battlegrounds and arenas.\n\n|cFFFFFF00-|r Effective time will automatically be used when inside a battleground and using sync from the score board.\n\n|cFFFFFF00-|r Added 'hide all' option on the minimap menu.\n\n|cFFFFFF00-|r Added support for battlegrounds.\n\n|cFFFFFF00-|r Added option for disable showing battleground enemies when the window is in group mode.\n\n|cFFFFFF00-|r Added option to disable the sync from battleground score board.\n\n|cFFFFFF00-|r Enemies from a battleground match segment won't be erased when the player logout.\n\n|cFFFFFF00v3.14.4 (|cFFFFCC00May 27, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r TimeLine (plugin): now also shows marks symbolizing the player death.\n\n|cFFFFFF00-|r Added raid history panel. Open it through bookmark or /details history.\n\n|cFFFFFF00-|r Added support for skins for Player Detail Window.\n\n|cFFFFFF00-|r Added report history on report button.\n\n|cFFFFFF00-|r Added key bindings settings for report what is shown on window #1 or #2.\n\n|cFFFFFF00v3.14.0b (|cFFFFCC00May 13, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Several texture changes for a smaller download size.\n\n|cFFFFFF00v3.13.4a (|cFFFFCC00May 06, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Created 'Details! Forge' but is still under development: /details forge.\n\n|cFFFFFF00-|r Several improvements on combatlog reader and custom displays.\n\n|cFFFFFF00-|r Improvements on enemies damage taken tooltip.\n\n|cFFFFFF00v3.13.1 (|cFFFFCC00April 27, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added casted amount for healing and damage spells. The result is shown on Player Detail Window and Comparison Panel.\n\n|cFFFFFF00-|r Added uptime amount for healing spells on Player Detail Window.\n\n|cFFFFFF00-|r Added an option to disable lock/resize/ungroup buttons. It's under miscellaneous bracket on Options Panel.\n\n|cFFFFFF00-|r Wallpaper for menus on title bar got a customization option under tooltips bracket on Options Panel.\n\n|cFFFFFF00-|r Updated spell list for Crowd Control and class detection.\n\n|cFFFFFF00-|r Improved Weakaura creation tool under Encounter Details Plugin.\n\n|cFFFFFF00v3.12.10 (|cFFFFCC00April 18, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added the spell uptime on damage player detail window.\n\n|cFFFFFF00-|r Added Rune Tap as cooldown.\n\n|cFFFFFF00-|r Report lines for deaths is now inverted. No need to scroll up the chat to see the cause of death anymore.\n\n|cFFFFFF00-|r Fixed some annoyances with auto current feature where it was changing the segments even when the user were using the window.\n\n|cFFFFFF00v3.12.7 (|cFFFFCC00April 09, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added slash command /details profile .\n\n|cFFFFFF00v3.12.6 (|cFFFFCC00May 06, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Encounter Details (plugin): added a report button on Emotes tab.\n\n|cFFFFFF00-|r Encounter Details (plugin): improved Weakauras creation.\n\n|cFFFFFF00-|r Encounter Details (plugin): fixed the report text for interrupts and dispells.\n\n|cFFFFFF00-|r Crowd control by Pets now is merged with its owner.\n\n|cFFFFFF00-|r Truncated left text on bars now shows the entire text when hover over the bar.\n\n|cFFFFFF00-|r Added an extra option on minimap menu to disable the minimap icon.\n\n|cFFFFFF00-|r Fixed a problem when disabling the minimap icon through options panel.\n\n|cFFFFFF00-|r Fixed an issue with item level tracker feature.\n\n|cFFFFFF00v3.12.2 (|cFFFFCC00Mar 30, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Raid Check (plugin): added item level.\n\n|cFFFFFF00-|r Advanced Death Logs (plugin): bug fixes, it's important to update it.\n\n|cFFFFFF00-|r Time Line (plugin): bug fixes.\n\n|cFFFFFF00-|r Added option to disabled th eitem level tracker.\n\n|cFFFFFF00-|r Added item level on Raid Check plugin panel.\n\n|cFFFFFF00-|r Added Spirit Link Totem damage and healing on death log.\n\n|cFFFFFF00-|r Added the total of life exchanged by the Spirit Link Totem on player detail window.\n\n|cFFFFFF00-|r Added more spells for crowd control.\n\n|cFFFFFF00-|r Added scroll on bookmark panel.\n\n|cFFFFFF00-|r Fixed issue with Dps/Hps data broker which wasn't respecting the type of time (effective/activity) selected.\n\n|cFFFFFF00-|r Fixed few bugs when using the key bind to toggle windows." Loc ["STRING_DETAILS1"] = "|cffffaeaeDetails!:|r " @@ -138,6 +140,7 @@ do --> armazena instancias inativas _detalhes.unused_instances = {} _detalhes.default_skin_to_use = "Minimalistic" + _detalhes.instance_title_text_timer = {} --> player detail skin _detalhes.playerdetailwindow_skins = {} diff --git a/classes/classe_instancia_include.lua b/classes/classe_instancia_include.lua index 50ee5afb..68dba4f8 100644 --- a/classes/classe_instancia_include.lua +++ b/classes/classe_instancia_include.lua @@ -134,7 +134,7 @@ _detalhes.instance_defaults = { --blackwhiite icons desaturated_menu = false, --mode segment attribute report --icons on menu - menu_icons = {true, true, true, true, true, false, space = -4, shadow = false}, --mode segment attribute report reset close + menu_icons = {true, true, true, true, true, false, space = -3, shadow = false}, --mode segment attribute report reset close --menu icons size multiplicator factor menu_icons_size = 1.0, --mode segment attribute report --auto hide menu buttons @@ -149,7 +149,8 @@ _detalhes.instance_defaults = { side = 1, shadow = false, enable_custom_text = false, - custom_text = "{name}" + custom_text = "{name}", + show_timer = {true, true, true}, --raid encounter, battleground, arena }, --auto hide window borders statusbar main menu menu_alpha = {enabled = false, iconstoo = true, onenter = 1, onleave = 1, ignorebars = false}, diff --git a/core/control.lua b/core/control.lua index 26c0db3b..6e67e81f 100644 --- a/core/control.lua +++ b/core/control.lua @@ -379,6 +379,7 @@ _detalhes:SendEvent ("COMBAT_PLAYER_ENTER", nil, _detalhes.tabela_vigente, _detalhes.encounter_table and _detalhes.encounter_table.id) _detalhes:CheckSwitchToCurrent() + _detalhes:CheckForTextTimeCounter (true) end function _detalhes:DelayedSyncAlert() @@ -727,6 +728,8 @@ _detalhes:SendEvent ("COMBAT_PLAYER_LEAVE", nil, _detalhes.tabela_vigente) end + _detalhes:CheckForTextTimeCounter() + end function _detalhes:GetPlayersInArena() diff --git a/core/meta.lua b/core/meta.lua index 491ef933..a816e0a2 100644 --- a/core/meta.lua +++ b/core/meta.lua @@ -206,7 +206,7 @@ if (is_in_instance and _detalhes.remove_realm_from_name) then esta_classe.displayName = nome:gsub (("%-.*"), "") elseif (_detalhes.remove_realm_from_name) then - esta_classe.displayName = nome:gsub (("%-.*"), "%*") + esta_classe.displayName = nome:gsub (("%-.*"), "") --%* else esta_classe.displayName = nome end diff --git a/core/parser.lua b/core/parser.lua index 17c5b598..916e4f7e 100644 --- a/core/parser.lua +++ b/core/parser.lua @@ -3145,8 +3145,6 @@ _detalhes.encounter_table.index = boss_index end - --print ("Combat Start 2") - end function _detalhes.parser_functions:ENCOUNTER_END (...) diff --git a/core/windows.lua b/core/windows.lua index 8198d88f..c33458f1 100644 --- a/core/windows.lua +++ b/core/windows.lua @@ -62,9 +62,6 @@ self.proximo_update = 0 end --- /run print( _detalhes:GetInstance(1).rowframe:GetParent():GetName()) --- /run print (DetailsBarra_1_1:GetParent():GetName()) - function _detalhes:fazer_animacoes (amt_barras) --aqui @@ -1259,7 +1256,6 @@ if (not boss_repeated [encounterId]) then local encounter, instance = _detalhes:GetBossEncounterDetailsFromEncounterId (_, encounterId) if (encounter) then - --print ("encounter found", encounter.boss, encounter.name, instance) tinsert (boss_list, {value = encounterId, label = encounter.boss, icon = icon, onclick = on_boss_select}) boss_repeated [encounterId] = true @@ -2501,19 +2497,19 @@ local text = panel.editbox:GetText() --text = text:gsub ("\n", "") - local test = text + --local test = text - local function errorhandler(err) - return geterrorhandler()(err) - end + --local function errorhandler(err) + -- return geterrorhandler()(err) + --end - local code = [[local str = "STR"; str = _detalhes.string.replace (str, 100, 50, 75, {nome = "you", total = 10, total_without_pet = 5, damage_taken = 7, last_dps = 1, friendlyfire_total = 6, totalover = 2, totalabsorb = 4, totalover_without_pet = 6, healing_taken = 1, heal_enemy_amt = 2});]] - code = code:gsub ("STR", test) + --local code = [[local str = "STR"; str = _detalhes.string.replace (str, 100, 50, 75, {nome = "you", total = 10, total_without_pet = 5, damage_taken = 7, last_dps = 1, friendlyfire_total = 6, totalover = 2, totalabsorb = 4, totalover_without_pet = 6, healing_taken = 1, heal_enemy_amt = 2});]] + --code = code:gsub ("STR", test) - local f = loadstring (code) - if (not f) then - print (f) - end + --local f = loadstring (code) + --if (not f) then + -- print ("loadstring failed:", f) + --end --local err, two = xpcall (f, errorhandler) --if (not err) then -- return diff --git a/gumps/janela_options.lua b/gumps/janela_options.lua index 3b740407..83bcf4dd 100644 --- a/gumps/janela_options.lua +++ b/gumps/janela_options.lua @@ -3588,6 +3588,26 @@ function window:CreateFrame14() --frame14.attributeSideSwitch:SetThumbSize (50) window:CreateLineBackground2 (frame14, "attributeSideSwitch", "attributeSideLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_SIDE_DESC"]) + --show timer + --for encounters + + g:NewLabel (frame14, _, "$parentAttributeEncounterTimerLabel", "AttributeEncounterTimerLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_ENCOUNTERTIMER"], "GameFontHighlightLeft") + g:NewSwitch (frame14, _, "$parentAttributeEncounterTimerSwitch", "AttributeEncounterTimerSwitch", 60, 20, nil, nil, instance.attribute_text.show_timer [1]) + frame14.AttributeEncounterTimerSwitch:SetPoint ("left", frame14.AttributeEncounterTimerLabel, "right", 2) + frame14.AttributeEncounterTimerSwitch.OnSwitch = function (self, instance, value) + instance:AttributeMenu (nil, nil, nil, nil, nil, nil, nil, nil, value) + if (_detalhes.options_group_edit and not DetailsOptionsWindow.loading_settings) then + for _, this_instance in ipairs (instance:GetInstanceGroup()) do + if (this_instance ~= instance) then + this_instance:AttributeMenu (nil, nil, nil, nil, nil, nil, nil, nil, value) + end + end + end + + _detalhes:SendOptionsModifiedEvent (DetailsOptionsWindow.instance) + end + window:CreateLineBackground2 (frame14, "AttributeEncounterTimerSwitch", "AttributeEncounterTimerLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_ENCOUNTERTIMER_DESC"]) + --frame14.attributeLabel:SetPoint (10, -205) --general anchor @@ -3600,16 +3620,17 @@ function window:CreateFrame14() titulo_attributetext_desc:SetPoint (x, -50) local left_side = { - {"TextAnchorLabel", 6, true}, - {"attributeTextColorLabel", 7}, - {"attributeTextSizeLabel", 8}, - {"attributeFontLabel", 9}, - {"attributeShadowLabel", 10}, {"SettingsAnchorLabel", 1, true}, {"attributeEnabledLabel", 2}, {"attributeAnchorXLabel", 3}, {"attributeAnchorYLabel", 4}, {"attributeSideLabel", 5}, + {"AttributeEncounterTimerLabel", 6}, + {"TextAnchorLabel", 7, true}, + {"attributeTextColorLabel", 8}, + {"attributeTextSizeLabel", 9}, + {"attributeFontLabel", 10}, + {"attributeShadowLabel", 11}, } window:arrange_menu (frame14, left_side, x, -90) @@ -10400,6 +10421,7 @@ end --> if not window _G.DetailsOptionsWindow14AttributeFontDropdown.MyObject:SetFixedParameter (editing_instance) _G.DetailsOptionsWindow14AttributeTextSizeSlider.MyObject:SetFixedParameter (editing_instance) _G.DetailsOptionsWindow14AttributeShadowSwitch.MyObject:SetFixedParameter (editing_instance) + _G.DetailsOptionsWindow14AttributeEncounterTimerSwitch.MyObject:SetFixedParameter (editing_instance) _G.DetailsOptionsWindow14AttributeEnabledSwitch.MyObject:SetValue (editing_instance.attribute_text.enabled) _G.DetailsOptionsWindow14AttributeAnchorXSlider.MyObject:SetValue (editing_instance.attribute_text.anchor [1]) @@ -10408,6 +10430,7 @@ end --> if not window _G.DetailsOptionsWindow14AttributeTextSizeSlider.MyObject:SetValue (tonumber (editing_instance.attribute_text.text_size)) _G.DetailsOptionsWindow14AttributeTextColorPick.MyObject:SetColor (unpack (editing_instance.attribute_text.text_color)) _G.DetailsOptionsWindow14AttributeShadowSwitch.MyObject:SetValue (editing_instance.attribute_text.shadow) + _G.DetailsOptionsWindow14AttributeEncounterTimerSwitch.MyObject:SetValue (editing_instance.attribute_text.show_timer [1]) _G.DetailsOptionsWindow14AttributeSideSwitch.MyObject:SetFixedParameter (editing_instance) _G.DetailsOptionsWindow14AttributeSideSwitch.MyObject:SetValue (editing_instance.attribute_text.side) diff --git a/gumps/janela_principal.lua b/gumps/janela_principal.lua index 23d46ed2..5d8400df 100644 --- a/gumps/janela_principal.lua +++ b/gumps/janela_principal.lua @@ -1087,6 +1087,7 @@ local BFrame_scripts_onsizechange = function (self) self._instance:ReajustaGump() self._instance.oldwith = self:GetWidth() _detalhes:SendEvent ("DETAILS_INSTANCE_SIZECHANGED", nil, self._instance) + self._instance:RefreshAttributeTextSize() end local BFrame_scripts_onenter = function (self) @@ -5031,6 +5032,8 @@ function _detalhes:ToolbarMenuSetButtons (_mode, _segment, _attributes, _report, local space = self.menu_icons.space local shadow = self.menu_icons.shadow + local total_buttons_shown = 0 + --> normal buttons if (self.menu_anchor.side == 1) then @@ -5060,6 +5063,8 @@ function _detalhes:ToolbarMenuSetButtons (_mode, _segment, _attributes, _report, button:SetHighlightTexture ([[Interface\AddOns\Details\images\toolbar_icons]]) button:SetPushedTexture ([[Interface\AddOns\Details\images\toolbar_icons]]) end + + total_buttons_shown = total_buttons_shown + 1 else button:Hide() end @@ -5094,6 +5099,8 @@ function _detalhes:ToolbarMenuSetButtons (_mode, _segment, _attributes, _report, button:SetHighlightTexture ([[Interface\AddOns\Details\images\toolbar_icons]]) button:SetPushedTexture ([[Interface\AddOns\Details\images\toolbar_icons]]) end + + total_buttons_shown = total_buttons_shown + 1 else button:Hide() end @@ -5147,10 +5154,15 @@ function _detalhes:ToolbarMenuSetButtons (_mode, _segment, _attributes, _report, button:SetPushedTexture (button.__icon) button:SetHighlightTexture (button.__icon, "ADD") end + + total_buttons_shown = total_buttons_shown + 1 end end end + self.total_buttons_shown = total_buttons_shown + self:RefreshAttributeTextSize() + return true end @@ -6246,7 +6258,78 @@ function _detalhes:LeftMenuAnchorSide (side) end -- ~attributemenu (text with attribute name) -function _detalhes:AttributeMenu (enabled, pos_x, pos_y, font, size, color, side, shadow) +function _detalhes:RefreshAttributeTextSize() + if (self.attribute_text.enabled and self.total_buttons_shown and self.baseframe and self.menu_attribute_string) then + local window_width = self:GetSize() + local buttons_shown = self.total_buttons_shown + local buttons_width, buttons_spacement = self.menu_icons_size * 16, self.menu_icons.space + + local width_by_buttons = (buttons_shown * buttons_width) + (buttons_spacement * (buttons_shown - 1)) + + local text_size = window_width - width_by_buttons - 6 + self.menu_attribute_string:SetWidth (text_size) + self.menu_attribute_string:SetHeight (self.attribute_text.text_size + 2) + end +end + +function _detalhes:CheckForTextTimeCounter (combat_start) + if (combat_start) then + local combat = _detalhes.tabela_vigente + if (combat.is_boss) then + local lower = _detalhes:GetLowerInstanceNumber() + if (lower) then + local instance = _detalhes:GetInstance (lower) + if (instance.baseframe and instance:IsEnabled()) then + if (instance.attribute_text.show_timer [1]) then + if (_detalhes.instance_title_text_timer [instance.meu_id]) then + _detalhes:CancelTimer (_detalhes.instance_title_text_timer [instance.meu_id]) + end + _detalhes.instance_title_text_timer [instance.meu_id] = _detalhes:ScheduleRepeatingTimer ("TitleTextTickTimer", 1, instance) + end + end + else + return + end + end + else + for _, instance in ipairs (_detalhes.tabela_instancias) do + if (_detalhes.instance_title_text_timer [instance.meu_id]) then + _detalhes:CancelTimer (_detalhes.instance_title_text_timer [instance.meu_id]) + local current_text = instance.menu_attribute_string:GetText() + current_text = current_text:gsub ("%[.*%] ", "") + instance.menu_attribute_string:SetText (current_text) + end + end + end +end + +local format_timer = function (t) + local m, s = _math_floor (t/60), _math_floor (t%60) + if (m < 1) then + m = "00" + elseif (m < 10) then + m = "0" .. m + end + if (s < 10) then + s = "0" .. s + end + return "[" .. m .. ":" .. s .. "]" +end + +function _detalhes:TitleTextTickTimer (instance) + if (instance.attribute_text.enabled) then + local current_text = instance.menu_attribute_string:GetText() + if (not current_text:find ("%[.*%]")) then + instance.menu_attribute_string:SetText ("[00:01] " .. current_text) + else + local timer = format_timer (_detalhes.tabela_vigente:GetCombatTime()) + current_text = current_text:gsub ("%[.*%]", timer) + instance.menu_attribute_string:SetText (current_text) + end + end +end + +function _detalhes:AttributeMenu (enabled, pos_x, pos_y, font, size, color, side, shadow, timer_encounter, timer_bg, timer_arena) if (type (enabled) ~= "boolean") then enabled = self.attribute_text.enabled @@ -6279,6 +6362,16 @@ function _detalhes:AttributeMenu (enabled, pos_x, pos_y, font, size, color, side shadow = self.attribute_text.shadow end + if (type (timer_encounter) ~= "boolean") then + timer_encounter = self.attribute_text.show_timer [1] + end + if (type (timer_bg) ~= "boolean") then + timer_bg = self.attribute_text.show_timer [2] + end + if (type (timer_arena) ~= "boolean") then + timer_arena = self.attribute_text.show_timer [3] + end + self.attribute_text.enabled = enabled self.attribute_text.anchor [1] = pos_x self.attribute_text.anchor [2] = pos_y @@ -6287,6 +6380,9 @@ function _detalhes:AttributeMenu (enabled, pos_x, pos_y, font, size, color, side self.attribute_text.text_color = color self.attribute_text.side = side self.attribute_text.shadow = shadow + self.attribute_text.show_timer [1] = timer_encounter + self.attribute_text.show_timer [2] = timer_bg + self.attribute_text.show_timer [3] = timer_arena --> enabled if (not enabled and self.menu_attribute_string) then @@ -6360,6 +6456,8 @@ function _detalhes:AttributeMenu (enabled, pos_x, pos_y, font, size, color, side --shadow _detalhes:SetFontOutline (self.menu_attribute_string, shadow) + --refresh size + self:RefreshAttributeTextSize() end -- ~backdrop