diff --git a/boot.lua b/boot.lua index 8e586253..a20ef79b 100644 --- a/boot.lua +++ b/boot.lua @@ -4,8 +4,8 @@ _ = 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.0" - _detalhes.realversion = 72 --core version + _detalhes.userversion = "v3.17.2" + _detalhes.realversion = 73 --core version _detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" Details = _detalhes @@ -21,13 +21,18 @@ do local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) --[[ -|cFFFFFF00v3.17.0 (|cFFFFCC00Jul 07, 2015|r|cFFFFFF00)|r:\n\n +|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 --]] -- - Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v3.17.0 (|cFFFFCC00Jul 07, 2015|r|cFFFFFF00)|r:\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.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_DETAILS1"] = "|cffffaeaeDetails!:|r " diff --git a/classes/classe_custom.lua b/classes/classe_custom.lua index 8df7f815..ca8b9161 100644 --- a/classes/classe_custom.lua +++ b/classes/classe_custom.lua @@ -197,19 +197,28 @@ local percent_script = _detalhes.custom_function_cache [instance.customName .. "Percent"] local total_script = _detalhes.custom_function_cache [instance.customName .. "Total"] + local okey for index, actor in _ipairs (instance_container._ActorTable) do local percent, ptotal if (percent_script) then - percent = percent_script (_math_floor (actor.value), top, total, combat, instance) + okey, percent = _pcall (percent_script, _math_floor (actor.value), top, total, combat, instance, actor) + if (not okey) then + _detalhes:Msg ("|cFFFF9900error on custom display function|r:", percent) + return _detalhes:EndRefresh (instance, 0, combat, combat [1]) + end else percent = _cstr ("%.1f", _math_floor (actor.value) / total * 100) end if (total_script) then - local value = total_script (_math_floor (actor.value), top, total, combat, instance) + local value = _pcall (total_script, _math_floor (actor.value), top, total, combat, instance, actor) if (type (value) == "number") then - ptotal = SelectedToKFunction (_, value) + okey, ptotal = SelectedToKFunction (_, value) + if (not okey) then + _detalhes:Msg ("|cFFFF9900error on custom display function|r:", ptotal) + return _detalhes:EndRefresh (instance, 0, combat, combat [1]) + end else ptotal = value end @@ -472,10 +481,15 @@ self.minha_barra = row local percent + local okey if (percent_script) then --local value, top, total, combat, instance = ... - percent = percent_script (self.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 else if (percentage_type == 1) then percent = _cstr ("%.1f", self.value / total * 100) @@ -491,7 +505,11 @@ end if (total_script) then - local value = total_script (self.value, top, total, combat, instance) + local okey, value = _pcall (total_script, self.value, top, total, combat, instance, self) + if (not okey) then + _detalhes:Msg ("|cFFFF9900error on custom display function|r:", value) + return _detalhes:EndRefresh (instance, 0, combat, combat [1]) + end if (type (value) == "number") then row.texto_direita:SetText (SelectedToKFunction (_, value) .. bars_brackets[1] .. percent .. bars_brackets[2]) else @@ -905,6 +923,10 @@ --> get the custom object local custom_object = instance:GetCustomObject() + if (custom_object.notooltip) then + return + end + --> get the actor local actor = self.my_actor @@ -920,11 +942,9 @@ end if (actor.id) then - _detalhes:AddTooltipSpellHeaderText (select (1, _GetSpellInfo (actor.id)), "yellow", 1, 0, 0, 0) - GameCooltip:AddIcon (select (3, _GetSpellInfo (actor.id)), 1, 1, 14, 14, 0.90625, 0.109375, 0.15625, 0.875) + _detalhes:AddTooltipSpellHeaderText (select (1, _GetSpellInfo (actor.id)), "yellow", 1, select (3, _GetSpellInfo (actor.id)), 0.90625, 0.109375, 0.15625, 0.875) else - _detalhes:AddTooltipSpellHeaderText (custom_object:GetName(), "yellow", 1, 0, 0, 0) - GameCooltip:AddIcon (custom_object:GetIcon(), 1, 1, 14, 14, 0.90625, 0.109375, 0.15625, 0.875) + _detalhes:AddTooltipSpellHeaderText (custom_object:GetName(), "yellow", 1, custom_object:GetIcon(), 0.90625, 0.109375, 0.15625, 0.875) end --GameCooltip:AddStatusBar (100, 1, r, g, b, 1) @@ -1556,339 +1576,6 @@ end --------------------------------------- - - local DamageTakenBySpell = { - name = Loc ["STRING_CUSTOM_DTBS"], - icon = [[Interface\ICONS\spell_mage_infernoblast]], - attribute = false, - spellid = false, - author = "Details!", - desc = Loc ["STRING_CUSTOM_DTBS_DESC"], - source = false, - target = false, - script_version = 30, - on_shift_click = [[ - local row, object, instance = ... - local spellname, _, spellicon = _detalhes.GetSpellInfo (object.id) - _detalhes:OpenAuraPanel (object.id, spellname, spellicon) - ]], - script = [[ - --> get the parameters passed - local combat, instance_container, instance = ... - --> declade the values to return - local total, top, amount = 0, 0, 0 - --> get a list of all damage actors - local AllDamageCharacters = combat:GetActorList (DETAILS_ATTRIBUTE_DAMAGE) - - --> no amount increase for repeated spells - local NoRepeat = {} - - --> do a loop amoung the actors - for index, character in ipairs (AllDamageCharacters) do - - --> is the actor a player? - if (character:IsPlayer()) then - - local taken_from = character.damage_from - - for source_name, _ in pairs (taken_from) do - - local source = combat (1, source_name) - - if (source) then - --> came from an enemy - if (not source:IsPlayer()) then - - local AllSpells = source:GetSpellList() - for spellid, spell in pairs (AllSpells) do - local on_player = spell.targets [character.nome] - - if (on_player and on_player >= 1) then - instance_container:AddValue (spell, on_player) - total = total + on_player - local value = instance_container:GetValue (spell) - if (value > top) then - top = value - end - if (not NoRepeat [spellid]) then - amount = amount + 1 - NoRepeat [spellid] = true - end - end - end - - elseif (source:IsGroupPlayer()) then -- friendly fire - - local AllSpells = source.friendlyfire [character.nome] and source.friendlyfire [character.nome].spells - for spellid, on_player in pairs (AllSpells) do - if (on_player and on_player >= 1) then - - local spellname = select (1, GetSpellInfo(spellid)) - local TEMP_SPELL_OBJECT = _G ["DetailsDamageTakenBySpellTemp"..spellid] - if (not TEMP_SPELL_OBJECT) then - TEMP_SPELL_OBJECT = {} - _G ["DetailsDamageTakenBySpellTemp"..spellid] = TEMP_SPELL_OBJECT - end - - TEMP_SPELL_OBJECT.id = spellid - TEMP_SPELL_OBJECT.spellschool = 1 - - instance_container:AddValue (TEMP_SPELL_OBJECT, on_player) - total = total + on_player - local value = instance_container:GetValue (TEMP_SPELL_OBJECT) - if (value > top) then - top = value - end - if (not NoRepeat [spellid]) then - amount = amount + 1 - NoRepeat [spellid] = true - end - end - end - end - end - end - end - end - - return total, top, amount - ]], - - tooltip = [[ - --get the parameters passed - local actor, combat, instance = ... - local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) - local GameCooltip = GameCooltip - local from_spell = actor.id - local from_spellname - if (from_spell) then - from_spellname = select (1, GetSpellInfo (actor.id)) - end - - --> get a list of all damage actors - local AllDamageCharacters = combat:GetActorList (DETAILS_ATTRIBUTE_DAMAGE) - - --> hold the targets - local Targets = {} - local total = 0 - local top = 0 - - local is_custom_spell = false - for _, spellcustom in ipairs (_detalhes.savedCustomSpells) do - if (spellcustom[1] == from_spell) then - is_custom_spell = true - end - end - - for index, character in ipairs (AllDamageCharacters) do - - if (is_custom_spell) then - for playername, ff_table in pairs (character.friendlyfire) do - if (ff_table.spells [from_spell]) then - local damage_actor = combat (1, playername) - local heal_actor = combat (2, playername) - - if ((damage_actor or heal_actor) and ( (damage_actor and damage_actor:IsPlayer()) or (heal_actor and heal_actor:IsPlayer()))) then - - local got - - for index, t in ipairs (Targets) do - if (t[1] == playername) then - t[2] = t[2] + ff_table.spells [from_spell] - if (t[2] > top) then - top = t[2] - end - got = true - break - end - end - - if (not got) then - - Targets [#Targets+1] = {playername, ff_table.spells [from_spell]} - if (ff_table.spells [from_spell] > top) then - top = ff_table.spells [from_spell] - end - end - end - end - end - else - - for playername, ff_table in pairs (character.friendlyfire) do - for spellid, amount in pairs (ff_table.spells) do - local spellname = select (1, GetSpellInfo (spellid)) - if (spellname == from_spellname) then - local damage_actor = combat (1, playername) - local heal_actor = combat (2, playername) - if ((damage_actor or heal_actor) and ( (damage_actor and damage_actor:IsPlayer()) or (heal_actor and heal_actor:IsPlayer()))) then - local got - for index, t in ipairs (Targets) do - if (t[1] == playername) then - t[2] = t[2] + amount - if (t[2] > top) then - top = t[2] - end - got = true - break - end - end - - if (not got) then - Targets [#Targets+1] = {playername, amount} - if (amount > top) then - top = amount - end - end - end - end - end - end - end - - --> search actors which used the spell shown in the bar - local spell = character.spells._ActorTable [from_spell] - - if (spell) then - for targetname, amount in pairs (spell.targets) do - - local got = false - - local damage_actor = combat (1, targetname) - local heal_actor = combat (2, targetname) - - if ( (damage_actor or heal_actor) and ( (damage_actor and damage_actor:IsPlayer()) or (heal_actor and heal_actor:IsPlayer()) ) ) then - for index, t in ipairs (Targets) do - if (t[1] == targetname) then - t[2] = t[2] + amount - if (t[2] > top) then - top = t[2] - end - got = true - break - end - end - if (not got) then - Targets [#Targets+1] = {targetname, amount} - if (amount > top) then - top = amount - end - end - -- else - -- for index, t in ipairs (Targets) do - -- if (t[1] == Loc ["STRING_TARGETS_OTHER1"]) then - -- t[2] = t[2] + amount - -- got = true - --print (damage_actor and damage_actor.nome, heal_actor and heal_actor.nome) - -- break - -- end - -- end - -- if (not got) then - -- Targets [#Targets+1] = {Loc ["STRING_TARGETS_OTHER1"], amount} - -- end - end - end - end - - if (not is_custom_spell) then - for spellid, spell in pairs (character.spells._ActorTable) do - if (spellid ~= from_spell) then - local spellname = select (1, GetSpellInfo (spellid)) - if (spellname == from_spellname) then - for targetname, amount in pairs (spell.targets) do - - local got = false - - local damage_actor = combat (1, targetname) - local heal_actor = combat (2, targetname) - - if ( (damage_actor or heal_actor) and ( (damage_actor and damage_actor:IsPlayer()) or (heal_actor and heal_actor:IsPlayer()) ) ) then - for index, t in ipairs (Targets) do - if (t[1] == targetname) then - t[2] = t[2] + amount - if (t[2] > top) then - top = t[2] - end - got = true - break - end - end - if (not got) then - Targets [#Targets+1] = {targetname, amount} - if (amount > top) then - top = amount - end - end - end - end - end - end - end - end - - end - - table.sort (Targets, _detalhes.Sort2) - - GameCooltip:SetOption ("StatusBarTexture", "Interface\\AddOns\\Details\\images\\bar_serenity") - - --local bar_background = {value = 100, color = {0.1, 0.1, 0.1, 0.9}, texture = "Interface\\AddOns\\Details\\images\\bar_background"} - local bar_background = DETAILS_DTBS_BACKGROUND - if (not bar_background) then - local color = {0.1960, 0.1960, 0.1960, 0.9097} - DETAILS_DTBS_BACKGROUND = {value = 100, color = color, texture = "Interface\\AddOns\\Details\\images\\bar_background2"} - bar_background = DETAILS_DTBS_BACKGROUND - end - - for index, t in ipairs (Targets) do - GameCooltip:AddLine (_detalhes:GetOnlyName(t[1]), _detalhes:ToK (t[2])) - local class, _, _, _, _, r, g, b = _detalhes:GetClass (t[1]) - - GameCooltip:AddStatusBar (t[2]/top*100, 1, r, g, b, 0.8, false, bar_background) - - if (class) then - local texture, l, r, t, b = _detalhes:GetClassIcon (class) - GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small_alpha", 1, 1, 14, 14, l, r, t, b) - elseif (t[1] == Loc ["STRING_TARGETS_OTHER1"]) then - GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small_alpha", 1, 1, 14, 14, 0.25, 0.49609375, 0.75, 1) - end - end - - local aura = "" - if (WeakAuras) then - aura = "|cFFffa200Shift Click|r: Create Aura" - end - - GameCooltip:AddLine (" ") - GameCooltip:AddLine ("|cFFffa200Click|r: Report Results", aura, 1, "white", "white") - GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.2, false, bar_background) - GameCooltip:SetOption ("YSpacingMod", -1) - ]], - } - - local have = false - for _, custom in ipairs (self.custom) do - if (custom.name == Loc ["STRING_CUSTOM_DTBS"] and (custom.script_version and custom.script_version >= DamageTakenBySpell.script_version) ) then - have = true - break - end - end - if (not have) then - setmetatable (DamageTakenBySpell, _detalhes.atributo_custom) - DamageTakenBySpell.__index = _detalhes.atributo_custom - - for i, custom in ipairs (self.custom) do - if (custom.name == Loc ["STRING_CUSTOM_DTBS"]) then - table.remove (self.custom, i) - tinsert (self.custom, i, DamageTakenBySpell) - have = true - end - end - - if (not have) then - self.custom [#self.custom+1] = DamageTakenBySpell - end - end ---------------------------------------------------------------------------------------------------------------------------------------------------- --doas @@ -1945,11 +1632,10 @@ table.sort (targets, _detalhes.Sort2) - _detalhes:AddTooltipSpellHeaderText ("Targets", "yellow", r, g, b, #targets) + _detalhes:AddTooltipSpellHeaderText ("Targets", "yellow", #targets) local class, _, _, _, _, r, g, b = _detalhes:GetClass (actor.nome) GameCooltip:AddStatusBar (100, 1, r, g, b, 1) - for index, target in ipairs (targets) do GameCooltip:AddLine (target[1], target [2]) _detalhes:AddTooltipBackgroundStatusbar() diff --git a/classes/classe_damage.lua b/classes/classe_damage.lua index 152e4f8e..f68c4239 100644 --- a/classes/classe_damage.lua +++ b/classes/classe_damage.lua @@ -78,6 +78,11 @@ local ntable = {} --temp local vtable = {} --temp + local tooltip_void_zone_temp = {} --temp + local bs_table = {} --temp + local bs_index_table = {} --temp + local bs_tooltip_table + local frags_tooltip_table local tooltip_temp_table = {} @@ -311,6 +316,30 @@ end end +--[[exported]] function _detalhes:GetSpellLink (spellid) + if (spellid == 1) then --melee + return GetSpellLink (6603) + elseif (spellid == 2) then --autoshot + return GetSpellLink (75) + elseif (spellid > 10) then + return GetSpellLink (spellid) + else + local spellname = _GetSpellInfo (spellid) + return spellname + end + end + +--[[exported]] function _detalhes:GameTooltipSetSpellByID (spellid) + if (spellid == 1) then + GameTooltip:SetSpellByID (6603) + elseif (spellid == 2) then + GameTooltip:SetSpellByID (75) + elseif (spellid > 10) then + GameTooltip:SetSpellByID (spellid) + else + GameTooltip:SetSpellByID (spellid) + end + end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> class constructor @@ -382,6 +411,542 @@ return total end +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> damage taken by spell + + local byspell_tooltip_background = {value = 100, color = {0.1960, 0.1960, 0.1960, 0.9097}, texture = [[Interface\AddOns\Details\images\bar_background2]]} + + function _detalhes:ToolTipBySpell (instance, tabela, esta_barra, keydown) + + local GameCooltip = GameCooltip + local combat = instance.showing + local from_spell = tabela [1] --spellid + local from_spellname + if (from_spell) then + from_spellname = select (1, GetSpellInfo (from_spell)) + end + + --> get a list of all damage actors + local AllDamageCharacters = combat:GetActorList (DETAILS_ATTRIBUTE_DAMAGE) + + --> hold the targets + local Targets = {} + local total = 0 + local top = 0 + + local is_custom_spell = false + for _, spellcustom in ipairs (_detalhes.savedCustomSpells) do + if (spellcustom[1] == from_spell) then + is_custom_spell = true + end + end + + for index, character in ipairs (AllDamageCharacters) do + + if (is_custom_spell) then + for playername, ff_table in pairs (character.friendlyfire) do + if (ff_table.spells [from_spell]) then + local damage_actor = combat (1, playername) + local heal_actor = combat (2, playername) + + if ((damage_actor or heal_actor) and ( (damage_actor and damage_actor:IsPlayer()) or (heal_actor and heal_actor:IsPlayer()))) then + + local got + + for index, t in ipairs (Targets) do + if (t[1] == playername) then + t[2] = t[2] + ff_table.spells [from_spell] + total = total + ff_table.spells [from_spell] + if (t[2] > top) then + top = t[2] + end + got = true + break + end + end + + if (not got) then + Targets [#Targets+1] = {playername, ff_table.spells [from_spell]} + total = total + ff_table.spells [from_spell] + if (ff_table.spells [from_spell] > top) then + top = ff_table.spells [from_spell] + end + end + end + end + end + else + for playername, ff_table in pairs (character.friendlyfire) do + for spellid, amount in pairs (ff_table.spells) do + local spellname = select (1, GetSpellInfo (spellid)) + if (spellname == from_spellname) then + local damage_actor = combat (1, playername) + local heal_actor = combat (2, playername) + if ((damage_actor or heal_actor) and ( (damage_actor and damage_actor:IsPlayer()) or (heal_actor and heal_actor:IsPlayer()))) then + local got + for index, t in ipairs (Targets) do + if (t[1] == playername) then + t[2] = t[2] + amount + total = total + amount + if (t[2] > top) then + top = t[2] + end + got = true + break + end + end + + if (not got) then + Targets [#Targets+1] = {playername, amount} + total = total + amount + if (amount > top) then + top = amount + end + end + end + end + end + end + end + + --> search actors which used the spell shown in the bar + local spell = character.spells._ActorTable [from_spell] + + if (spell) then + for targetname, amount in pairs (spell.targets) do + + local got = false + local damage_actor = combat (1, targetname) + local heal_actor = combat (2, targetname) + + if ( (damage_actor or heal_actor) and ( (damage_actor and damage_actor:IsPlayer()) or (heal_actor and heal_actor:IsPlayer()) ) ) then + for index, t in ipairs (Targets) do + if (t[1] == targetname) then + t[2] = t[2] + amount + total = total + amount + if (t[2] > top) then + top = t[2] + end + got = true + break + end + end + + if (not got) then + Targets [#Targets+1] = {targetname, amount} + total = total + amount + if (amount > top) then + top = amount + end + end + end + end + end + + if (not is_custom_spell) then + for spellid, spell in pairs (character.spells._ActorTable) do + if (spellid ~= from_spell) then + local spellname = select (1, GetSpellInfo (spellid)) + if (spellname == from_spellname) then + for targetname, amount in pairs (spell.targets) do + + local got = false + local damage_actor = combat (1, targetname) + local heal_actor = combat (2, targetname) + + if ( (damage_actor or heal_actor) and ( (damage_actor and damage_actor:IsPlayer()) or (heal_actor and heal_actor:IsPlayer()) ) ) then + for index, t in ipairs (Targets) do + if (t[1] == targetname) then + t[2] = t[2] + amount + total = total + amount + if (t[2] > top) then + top = t[2] + end + got = true + break + end + end + + if (not got) then + Targets [#Targets+1] = {targetname, amount} + total = total + amount + if (amount > top) then + top = amount + end + end + end + end + end + end + end + end + end + + table.sort (Targets, _detalhes.Sort2) + bs_tooltip_table = Targets + bs_tooltip_table.damage_total = total + + GameCooltip:SetOption ("StatusBarTexture", "Interface\\AddOns\\Details\\images\\bar_serenity") + + local spellname, _, spellicon = select (1, _GetSpellInfo (from_spell)) + GameCooltip:AddLine (spellname .. " " .. Loc ["STRING_CUSTOM_ATTRIBUTE_DAMAGE"], nil, nil, headerColor, nil, 10) + --GameCooltip:AddIcon ([[Interface\ICONS\Spell_Mage_InfernoBlast]], 1, 1, 14, 14, 0.078125, 0.921875, 0.078125, 0.921875) + GameCooltip:AddIcon (spellicon, 1, 1, 14, 14, 0.078125, 0.921875, 0.078125, 0.921875) + GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay2) + _detalhes:AddTooltipHeaderStatusbar (1, 1, 1, 0.5) + + local top = Targets[1] and Targets[1][2] + + for index, t in ipairs (Targets) do + GameCooltip:AddLine (_detalhes:GetOnlyName(t[1]), _detalhes:ToK (t[2]) .. " (" .. _cstr ("%.1f", t[2]/total*100) .. "%)") + local class, _, _, _, _, r, g, b = _detalhes:GetClass (t[1]) + + GameCooltip:AddStatusBar (t[2]/top*100, 1, r, g, b, 0.8, false, byspell_tooltip_background) + + if (class) then + local texture, l, r, t, b = _detalhes:GetClassIcon (class) + GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small_alpha", 1, 1, 14, 14, l, r, t, b) + elseif (t[1] == Loc ["STRING_TARGETS_OTHER1"]) then + GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small_alpha", 1, 1, 14, 14, 0.25, 0.49609375, 0.75, 1) + end + end + + GameCooltip:AddLine (" ") + _detalhes:AddTooltipReportLineText() + + GameCooltip:SetOption ("YSpacingMod", -1) + GameCooltip:SetOwner (esta_barra) + GameCooltip:Show() + + end + + local function RefreshBarraBySpell (tabela, barra, instancia) + atributo_damage:AtualizarBySpell (tabela, tabela.minha_barra, barra.colocacao, instancia) + end + + local on_switch_DTBS_show = function (instance) + instance:TrocaTabela (instance, true, 1, 8) + return true + end + + local DTBS_search_code = [[ + --> get the parameters passed + local combat, instance_container, instance = ... + --> declade the values to return + local total, top, amount = 0, 0, 0 + --> hold the targets + local Targets = {} + + local from_spell = @SPELLID@ + local from_spellname + if (from_spell) then + from_spellname = select (1, GetSpellInfo (from_spell)) + end + + --> get a list of all damage actors + local AllDamageCharacters = combat:GetActorList (DETAILS_ATTRIBUTE_DAMAGE) + + local is_custom_spell = false + for _, spellcustom in ipairs (_detalhes.savedCustomSpells) do + if (spellcustom[1] == from_spell) then + is_custom_spell = true + end + end + + for index, character in ipairs (AllDamageCharacters) do + + if (is_custom_spell) then + for playername, ff_table in pairs (character.friendlyfire) do + if (ff_table.spells [from_spell]) then + local damage_actor = combat (1, playername) + local heal_actor = combat (2, playername) + + if ((damage_actor or heal_actor) and ( (damage_actor and damage_actor:IsPlayer()) or (heal_actor and heal_actor:IsPlayer()))) then + + local got + + for index, t in ipairs (Targets) do + if (t[1] == playername) then + t[2] = t[2] + ff_table.spells [from_spell] + if (t[2] > top) then + top = t[2] + end + got = true + break + end + end + + if (not got) then + Targets [#Targets+1] = {playername, ff_table.spells [from_spell], damage_actor or heal_actor} + if (ff_table.spells [from_spell] > top) then + top = ff_table.spells [from_spell] + end + end + end + end + end + else + + for playername, ff_table in pairs (character.friendlyfire) do + for spellid, amount in pairs (ff_table.spells) do + local spellname = select (1, GetSpellInfo (spellid)) + if (spellname == from_spellname) then + local damage_actor = combat (1, playername) + local heal_actor = combat (2, playername) + if ((damage_actor or heal_actor) and ( (damage_actor and damage_actor:IsPlayer()) or (heal_actor and heal_actor:IsPlayer()))) then + local got + for index, t in ipairs (Targets) do + if (t[1] == playername) then + t[2] = t[2] + amount + if (t[2] > top) then + top = t[2] + end + got = true + break + end + end + + if (not got) then + Targets [#Targets+1] = {playername, amount, damage_actor or heal_actor} + if (amount > top) then + top = amount + end + end + end + end + end + end + end + + --> search actors which used the spell shown in the bar + local spell = character.spells._ActorTable [from_spell] + + if (spell) then + for targetname, amount in pairs (spell.targets) do + + local got = false + + local damage_actor = combat (1, targetname) + local heal_actor = combat (2, targetname) + + if ( (damage_actor or heal_actor) and ( (damage_actor and damage_actor:IsPlayer()) or (heal_actor and heal_actor:IsPlayer()) ) ) then + for index, t in ipairs (Targets) do + if (t[1] == targetname) then + t[2] = t[2] + amount + if (t[2] > top) then + top = t[2] + end + got = true + break + end + end + if (not got) then + Targets [#Targets+1] = {targetname, amount, damage_actor or heal_actor} + if (amount > top) then + top = amount + end + end + end + end + end + + if (not is_custom_spell) then + for spellid, spell in pairs (character.spells._ActorTable) do + if (spellid ~= from_spell) then + local spellname = select (1, GetSpellInfo (spellid)) + if (spellname == from_spellname) then + for targetname, amount in pairs (spell.targets) do + + local got = false + + local damage_actor = combat (1, targetname) + local heal_actor = combat (2, targetname) + + if ( (damage_actor or heal_actor) and ( (damage_actor and damage_actor:IsPlayer()) or (heal_actor and heal_actor:IsPlayer()) ) ) then + for index, t in ipairs (Targets) do + if (t[1] == targetname) then + t[2] = t[2] + amount + if (t[2] > top) then + top = t[2] + end + got = true + break + end + end + if (not got) then + Targets [#Targets+1] = {targetname, amount, damage_actor or heal_actor} + if (amount > top) then + top = amount + end + end + end + end + end + end + end + end + + end + + table.sort (Targets, _detalhes.Sort2) + + local amount = 0 + for index, t in ipairs (Targets) do + instance_container:AddValue (t[3], t[2]) + total = total + t[2] + amount = amount + 1 + end + + return total, top, amount + ]] + + local function ShowDTBSInWindow (spell, instance) + + local spellname, _, icon = _GetSpellInfo (spell [1]) + local custom_name = spellname .. " - " .. Loc ["STRING_CUSTOM_DTBS"] .. "" + + --check if already exists + for index, CustomObject in _ipairs (_detalhes.custom) do + if (CustomObject:GetName() == custom_name) then + --> fix for not saving funcs on logout + if (not CustomObject.OnSwitchShow) then + CustomObject.OnSwitchShow = on_switch_DTBS_show + end + return instance:TrocaTabela (instance.segmento, 5, index) + end + end + + --create a custom for this spell + local new_custom_object = { + name = custom_name, + icon = icon, + attribute = false, + author = _detalhes.playername, + desc = spellname .. " " .. Loc ["STRING_CUSTOM_DTBS"], + source = false, + target = false, + script = false, + tooltip = false, + temp = true, + notooltip = true, + OnSwitchShow = on_switch_DTBS_show, + } + + local new_code = DTBS_search_code + new_code = new_code:gsub ("@SPELLID@", spell [1]) + new_custom_object.script = new_code + + tinsert (_detalhes.custom, new_custom_object) + setmetatable (new_custom_object, _detalhes.atributo_custom) + new_custom_object.__index = _detalhes.atributo_custom + + return instance:TrocaTabela (instance.segmento, 5, #_detalhes.custom) + + end + + local DTBS_format_name = function (player_name) return _detalhes:GetOnlyName (player_name) end + local DTBS_format_amount = function (amount) return _detalhes:ToK (amount) .. " (" .. _cstr ("%.1f", amount / bs_tooltip_table.damage_total * 100) .. "%)" end + + function atributo_damage:ReportSingleDTBSLine (spell, instance, ShiftKeyDown, ControlKeyDown) + if (ControlKeyDown) then + local spellname, _, spellicon = _GetSpellInfo (spell[1]) + return _detalhes:OpenAuraPanel (spell[1], spellname, spellicon) + elseif (ShiftKeyDown) then + return ShowDTBSInWindow (spell, instance) + end + + local spelllink = _detalhes:GetSpellLink (spell [1]) + local report_table = {"Details!: " .. Loc ["STRING_CUSTOM_DTBS"] .. " " .. spelllink} + + _detalhes:FormatReportLines (report_table, bs_tooltip_table, DTBS_format_name, DTBS_format_amount) + + return _detalhes:Reportar (report_table, {_no_current = true, _no_inverse = true, _custom = true}) + end + + function atributo_damage:AtualizarBySpell (tabela, qual_barra, colocacao, instancia) + tabela ["byspell"] = true --> marca que esta tabela é uma tabela de frags, usado no controla na hora de montar o tooltip + local esta_barra = instancia.barras [qual_barra] --> pega a referência da barra na janela + + if (not esta_barra) then + print ("DEBUG: problema com "..qual_barra .. " " .. colocacao) + return + end + + local tabela_anterior = esta_barra.minha_tabela + esta_barra.minha_tabela = tabela + + local spellname, _, spellicon = _GetSpellInfo (tabela [1]) + + tabela.nome = spellname --> evita dar erro ao redimencionar a janela + tabela.minha_barra = qual_barra + esta_barra.colocacao = colocacao + + if (not _getmetatable (tabela)) then + _setmetatable (tabela, {__call = RefreshBarraBySpell}) + tabela._custom = true + end + + local total = instancia.showing.totals.by_spell + local porcentagem + + if (instancia.row_info.percent_type == 1) then + porcentagem = _cstr ("%.1f", tabela [2] / total * 100) + elseif (instancia.row_info.percent_type == 2) then + porcentagem = _cstr ("%.1f", tabela [2] / instancia.top * 100) + end + + esta_barra.texto_esquerdo:SetText (colocacao .. ". " .. spellname) + + local bars_show_data = instancia.row_info.textR_show_data + local bars_brackets = instancia:GetBarBracket() + + local spell_damage = tabela [2] + if (not bars_show_data [1]) then + spell_damage = "" + end + if (not bars_show_data [3]) then + porcentagem = "" + else + porcentagem = porcentagem .. "%" + end + + esta_barra.texto_direita:SetText (SelectedToKFunction (_, spell_damage) .. bars_brackets[1] .. porcentagem .. bars_brackets[2]) + + esta_barra.texto_esquerdo:SetTextColor (1, 1, 1, 1) + esta_barra.texto_direita:SetTextColor (1, 1, 1, 1) + + esta_barra.texto_esquerdo:SetSize (esta_barra:GetWidth() - esta_barra.texto_direita:GetStringWidth() - 20, 15) + + if (colocacao == 1) then + esta_barra:SetValue (100) + else + esta_barra:SetValue (tabela [2] / instancia.top * 100) + end + + if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then + gump:Fade (esta_barra, "out") + end + + if (instancia.row_info.texture_class_colors) then + if (tabela [3] > 1) then + local r, g, b = _detalhes:GetSpellSchoolColor (tabela [3]) + esta_barra.textura:SetVertexColor (r, g, b) + else + local r, g, b = _detalhes:GetSpellSchoolColor (0) + esta_barra.textura:SetVertexColor (r, g, b) + end + + end + + esta_barra.icone_classe:SetTexture (spellicon) + esta_barra.icone_classe:SetTexCoord (0.078125, 0.921875, 0.078125, 0.921875) + esta_barra.icone_classe:SetVertexColor (1, 1, 1) + + if (esta_barra.mouse_over and not instancia.baseframe.isMoving) then --> precisa atualizar o tooltip + --gump:UpdateTooltip (qual_barra, esta_barra, instancia) + end + end + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> frags @@ -401,6 +966,7 @@ local took_damage_from = frag_actor.damage_from local total_damage_taken = frag_actor.damage_taken + local total = 0 for aggressor, _ in _pairs (took_damage_from) do @@ -410,39 +976,41 @@ local target_amount = damager_actor.targets [name] if (target_amount) then damage_taken_table [#damage_taken_table+1] = {aggressor, target_amount, damager_actor.classe} + total = total + target_amount end end end + + _table_sort (damage_taken_table, _detalhes.Sort2) + + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_DAMAGE_FROM"], headerColor, #damage_taken_table, [[Interface\Addons\Details\images\icons]], 0.126953125, 0.1796875, 0, 0.0546875) + _detalhes:AddTooltipHeaderStatusbar (1, 1, 1, 0.5) + GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay2) + local min = 6 + local ismaximized = false + --always maximized + if (true or keydown == "shift" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 3) then + min = 99 + ismaximized = true + end + + if (ismaximized) then + GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay2) + else + GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay1) + end + + local top = damage_taken_table[1] and damage_taken_table[1][2] + frags_tooltip_table = damage_taken_table + frags_tooltip_table.damage_total = total + if (#damage_taken_table > 0) then - - _table_sort (damage_taken_table, _detalhes.Sort2) - - GameCooltip:AddLine (Loc ["STRING_DAMAGE_FROM"], nil, nil, headerColor, nil, 12) - GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.126953125, 0.1796875, 0, 0.0546875) - - local min = 6 - local ismaximized = false - if (keydown == "shift" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 3) then - min = 99 - ismaximized = true - end - - if (ismaximized) then - --highlight shift key - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay2) - GameCooltip:AddStatusBar (100, 1, .1, .1, .1, 1) - else - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay1) - GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .3) - end - for i = 1, math.min (min, #damage_taken_table) do - local t = damage_taken_table [i] - GameCooltip:AddLine (t [1], FormatTooltipNumber (_, t [2])) - local classe = t [3] + GameCooltip:AddLine (_detalhes:GetOnlyName (t[1]), FormatTooltipNumber (_, t[2]) .. " (" .. _cstr ("%.1f", t[2] / total * 100) .. "%)") + local classe = t[3] if (not classe) then classe = "UNKNOW" end @@ -450,50 +1018,29 @@ if (classe == "UNKNOW") then GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, 14, 14, .25, .5, 0, 1) else - GameCooltip:AddIcon (instancia.row_info.icon_file, nil, nil, 14, 14, _unpack (_detalhes.class_coords [classe])) + GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small_alpha]], nil, nil, 14, 14, _unpack (_detalhes.class_coords [classe])) end - _detalhes:AddTooltipBackgroundStatusbar() + + local _, _, _, _, _, r, g, b = _detalhes:GetClass (t[1]) + GameCooltip:AddStatusBar (t[2] / top * 100, 1, r, g, b, 1, false, enemies_background) end - - GameCooltip:AddLine ("") - GameCooltip:AddLine (Loc ["STRING_REPORT_LEFTCLICK"], nil, 1, _unpack (self.click_to_report_color)) - GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 0.015625, 0.13671875, 0.4375, 0.59765625) - GameCooltip:ShowCooltip() - else GameCooltip:AddLine (Loc ["STRING_NO_DATA"], nil, 1, "white") GameCooltip:AddIcon (instancia.row_info.icon_file, nil, nil, 14, 14, _unpack (_detalhes.class_coords ["UNKNOW"])) - GameCooltip:ShowCooltip() end - else - GameCooltip:AddLine (Loc ["STRING_NO_DATA"], nil, 1, "white") - GameCooltip:AddIcon (instancia.row_info.icon_file, nil, nil, 14, 14, _unpack (_detalhes.class_coords ["UNKNOW"])) + GameCooltip:AddLine (" ") + _detalhes:AddTooltipReportLineText() + + GameCooltip:SetOption ("StatusBarTexture", "Interface\\AddOns\\Details\\images\\bar_serenity") GameCooltip:ShowCooltip() end - - end - + end + local function RefreshBarraFrags (tabela, barra, instancia) atributo_damage:AtualizarFrags (tabela, tabela.minha_barra, barra.colocacao, instancia) end - function atributo_damage:ReportSingleFragsLine (frag, instancia) - local barra = instancia.barras [frag.minha_barra] - - local reportar = {"Details!: " .. frag [1] .. " - " .. Loc ["STRING_ATTRIBUTE_DAMAGE_TAKEN"]} - - for i = 2, GameCooltip:GetNumLines()-2 do - local texto_left, texto_right = GameCooltip:GetText (i) - if (texto_left and texto_right) then - texto_left = texto_left:gsub (("|T(.*)|t "), "") - reportar [#reportar+1] = "" .. texto_left .. " ....... " .. texto_right - end - end - - return _detalhes:Reportar (reportar, {_no_current = true, _no_inverse = true, _custom = true}) - end - function atributo_damage:AtualizarFrags (tabela, qual_barra, colocacao, instancia) tabela ["frags"] = true --> marca que esta tabela é uma tabela de frags, usado no controla na hora de montar o tooltip @@ -580,20 +1127,183 @@ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> void zones + local on_switch_AVZ_show = function (instance) + instance:TrocaTabela (instance, true, 1, 7) + return true + end + + local AVZ_search_code = [[ + --> get the parameters passed + local combat, instance_container, instance = ... + --> declade the values to return + local total, top, amount = 0, 0, 0 + + local actor_name = "@ACTORNAME@" + local actor = combat (4, actor_name) + + if (not actor) then + return 0, 0, 0 + end + + local damage_actor = combat (1, actor.damage_twin) + + local habilidade + local alvos + + if (damage_actor) then + habilidade = damage_actor.spells._ActorTable [actor.damage_spellid] + end + if (habilidade) then + alvos = habilidade.targets + end + + local container = actor.debuff_uptime_targets + local tooltip_void_zone_temp = {} + + for target_name, debuff_table in pairs (container) do + if (alvos) then + local damage_alvo = alvos [target_name] + if (damage_alvo) then + debuff_table.damage = damage_alvo + else + debuff_table.damage = 0 + end + else + debuff_table.damage = 0 + end + end + + local i = 1 + for target_name, debuff_table in pairs (container) do + local t = tooltip_void_zone_temp [i] + if (not t) then + t = {} + tinsert (tooltip_void_zone_temp, t) + end + + local target_actor = combat (1, target_name) or combat (2, target_name) or combat (4, target_name) + t[1] = target_name + t[2] = debuff_table.damage + t[3] = debuff_table + t[4] = target_actor + + i = i + 1 + end + + --> sort no container: + table.sort (tooltip_void_zone_temp, _detalhes.sort_tooltip_void_zones) - function atributo_damage:ReportSingleVoidZoneLine (actor, instancia) - local barra = instancia.barras [actor.minha_barra] - - local reportar = {"Details!: " .. actor.nome .. " - " .. Loc ["STRING_ATTRIBUTE_DAMAGE_DEBUFFS_REPORT"]} - for i = 2, GameCooltip:GetNumLines()-2 do - local texto_left, texto_right = GameCooltip:GetText (i) - if (texto_left and texto_right) then - texto_left = texto_left:gsub (("|T(.*)|t "), "") - reportar [#reportar+1] = "" .. texto_left .. " ..... " .. texto_right + for index, t in ipairs (tooltip_void_zone_temp) do + instance_container:AddValue (t[4], t[2]) + + local custom_actor = instance_container:GetActorTable (t[4]) + custom_actor.uptime = t[3].uptime + + total = total + t[2] + amount = amount + 1 + if (t[2] > top) then + top = t[2] end end - return _detalhes:Reportar (reportar, {_no_current = true, _no_inverse = true, _custom = true}) + return total, top, amount + ]] + + local AVZ_total_code = [[ + local value, top, total, combat, instance, custom_actor = ... + local uptime = custom_actor.uptime or 0 + + local minutos, segundos = floor (uptime / 60), floor (uptime % 60) + if (minutos > 0) then + uptime = "" .. minutos .. "m " .. segundos .. "s" .. "" + else + uptime = "" .. segundos .. "s" .. "" + end + + return _detalhes:ToK2 (value) .. " - " .. uptime .. " " + ]] + + local function ShowVoidZonesInWindow (actor, instance) + + local spellid = tooltip_void_zone_temp.spellid + + local spellname, _, icon = _GetSpellInfo (spellid) + local custom_name = spellname .. " - " .. Loc ["STRING_ATTRIBUTE_DAMAGE_DEBUFFS_REPORT"] .. "" + + --check if already exists + for index, CustomObject in _ipairs (_detalhes.custom) do + if (CustomObject:GetName() == custom_name) then + --> fix for not saving funcs on logout + if (not CustomObject.OnSwitchShow) then + CustomObject.OnSwitchShow = on_switch_AVZ_show + end + return instance:TrocaTabela (instance.segmento, 5, index) + end + end + + --create a custom for this spell + local new_custom_object = { + name = custom_name, + icon = icon, + attribute = false, + author = _detalhes.playername, + desc = spellname .. " " .. Loc ["STRING_ATTRIBUTE_DAMAGE_DEBUFFS_REPORT"], + source = false, + target = false, + script = false, + tooltip = false, + temp = true, + notooltip = true, + OnSwitchShow = on_switch_AVZ_show, + } + + local new_code = AVZ_search_code + new_code = new_code:gsub ("@ACTORNAME@", actor.nome) + new_custom_object.script = new_code + + local new_total_code = AVZ_total_code + new_total_code = new_total_code:gsub ("@ACTORNAME@", actor.nome) + new_total_code = new_total_code:gsub ("@SPELLID@", spellid) + new_custom_object.total_script = new_total_code + + tinsert (_detalhes.custom, new_custom_object) + setmetatable (new_custom_object, _detalhes.atributo_custom) + new_custom_object.__index = _detalhes.atributo_custom + + return instance:TrocaTabela (instance.segmento, 5, #_detalhes.custom) + end + + function atributo_damage:ReportSingleVoidZoneLine (actor, instance, ShiftKeyDown, ControlKeyDown) + + local spellid = tooltip_void_zone_temp.spellid + + if (ControlKeyDown) then + local spellname, _, spellicon = _GetSpellInfo (spellid) + return _detalhes:OpenAuraPanel (spellid, spellname, spellicon) + elseif (ShiftKeyDown) then + return ShowVoidZonesInWindow (actor, instance) + end + + local spelllink = _detalhes:GetSpellLink (spellid) + local report_table = {"Details!: " .. spelllink .. " " .. Loc ["STRING_ATTRIBUTE_DAMAGE_DEBUFFS_REPORT"]} + + local t = {} + for index, void_table in ipairs (tooltip_void_zone_temp) do + if (void_table[2] > 0) then + local actor_table = {_detalhes:GetOnlyName (void_table[1])} + local m, s = _math_floor (void_table[3].uptime / 60), _math_floor (void_table[3].uptime % 60) + if (m > 0) then + actor_table [2] = FormatTooltipNumber (_, void_table[3].damage) .. " (" .. m .. "m " .. s .. "s" .. ")" + else + actor_table [2] = FormatTooltipNumber (_, void_table[3].damage) .. " (" .. s .. "s" .. ")" + end + t [#t+1] = actor_table + end + end + + _detalhes:FormatReportLines (report_table, t) + + return _detalhes:Reportar (report_table, {_no_current = true, _no_inverse = true, _custom = true}) end local sort_tooltip_void_zones = function (tabela1, tabela2) @@ -611,8 +1321,8 @@ return false end end + _detalhes.sort_tooltip_void_zones = sort_tooltip_void_zones - local tooltip_void_zone_temp = {} function _detalhes:ToolTipVoidZones (instancia, actor, barra, keydown) @@ -671,14 +1381,17 @@ --> monta o cooltip local GameCooltip = GameCooltip - GameCooltip:AddLine (Loc ["STRING_VOIDZONE_TOOLTIP"], nil, nil, headerColor, nil, 12) - GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.126953125, 0.1796875, 0, 0.0546875) - _detalhes:AddTooltipHeaderStatusbar (1, 1, 1, 0.6) - - + local spellname, _, spellicon = _GetSpellInfo (actor.damage_spellid) + _detalhes:AddTooltipSpellHeaderText (spellname .. " " .. Loc ["STRING_VOIDZONE_TOOLTIP"], headerColor, #tooltip_void_zone_temp, spellicon, 0.078125, 0.921875, 0.078125, 0.921875) + _detalhes:AddTooltipHeaderStatusbar (1, 1, 1, 0.5) + GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay2) + --for target_name, debuff_table in _pairs (container) do local first = tooltip_void_zone_temp [1] and tooltip_void_zone_temp [1][3].damage + tooltip_void_zone_temp.spellid = actor.damage_spellid + tooltip_void_zone_temp.current_actor = actor + for index, t in _ipairs (tooltip_void_zone_temp) do if (t[3] == 0) then @@ -696,7 +1409,7 @@ local classe = _detalhes:GetClass (t[1]) if (classe) then - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small]], nil, nil, 14, 14, unpack (_detalhes.class_coords [classe])) + GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small_alpha]], nil, nil, 14, 14, unpack (_detalhes.class_coords [classe])) else GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, 14, 14, .25, .5, 0, 1) end @@ -707,10 +1420,8 @@ end - GameCooltip:AddLine ("") - GameCooltip:AddLine (Loc ["STRING_REPORT_LEFTCLICK"], nil, 1, _unpack (self.click_to_report_color)) - GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 0.015625, 0.13671875, 0.4375, 0.59765625) - GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.4) + GameCooltip:AddLine (" ") + _detalhes:AddTooltipReportLineText() GameCooltip:SetOption ("StatusBarTexture", "Interface\\AddOns\\Details\\images\\bar_serenity") @@ -752,9 +1463,11 @@ local porcentagem if (instancia.row_info.percent_type == 1) then + total = max (total, 0.0001) porcentagem = _cstr ("%.1f", self.damage / total * 100) elseif (instancia.row_info.percent_type == 2) then - porcentagem = _cstr ("%.1f", self.damage / instancia.top * 100) + local top = max (instancia.top, 0.0001) + porcentagem = _cstr ("%.1f", self.damage / top * 100) end if (UsingCustomRightText) then @@ -859,6 +1572,9 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex keyName = "enemies" elseif (sub_atributo == 7) then --> AURAS VOIDZONES keyName = "voidzones" + + elseif (sub_atributo == 8) then --> BY SPELL + keyName = "damage_taken_by_spells" end else keyName = exportar.key @@ -885,6 +1601,9 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex keyName = "enemies" elseif (sub_atributo == 7) then --> AURAS VOIDZONES keyName = "voidzones" + + elseif (sub_atributo == 8) then --> BY SPELL + keyName = "damage_taken_by_spells" end end @@ -966,6 +1685,151 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex return _detalhes:EndRefresh (instancia, total, tabela_do_combate, showing) --> retorna a tabela que precisa ganhar o refresh + elseif (keyName == "damage_taken_by_spells") then + + local bs_index, total = 0, 0 + wipe (bs_index_table) + + local combat = tabela_do_combate + local AllDamageCharacters = combat:GetActorList (DETAILS_ATTRIBUTE_DAMAGE) + + --> do a loop amoung the actors + for index, character in ipairs (AllDamageCharacters) do + + --> is the actor a player? + if (character:IsPlayer()) then + + for source_name, _ in pairs (character.damage_from) do + + local source = combat (1, source_name) + + if (source) then + --> came from an enemy + if (not source:IsPlayer()) then + + local AllSpells = source:GetSpellList() + for spellid, spell in pairs (AllSpells) do + local on_player = spell.targets [character.nome] + + if (on_player and on_player >= 1) then + + local spellname = GetSpellInfo (spellid) + + local has_index = bs_index_table [spellname] + local this_spell + if (has_index) then + this_spell = bs_table [has_index] + else + + bs_index = bs_index + 1 + + this_spell = bs_table [bs_index] + if (this_spell) then + this_spell [1] = spellid + this_spell [2] = 0 + this_spell [3] = spell.spellschool or _detalhes.spell_school_cache [select (1, GetSpellInfo (spellid))] or 1 + bs_index_table [spellname] = bs_index + else + this_spell = {spellid, 0, spell.spellschool or _detalhes.spell_school_cache [select (1, GetSpellInfo (spellid))] or 1} + bs_table [bs_index] = this_spell + bs_index_table [spellname] = bs_index + end + + end + + this_spell [2] = this_spell [2] + on_player + total = total + on_player + end + end + + elseif (source:IsGroupPlayer()) then -- friendly fire + + local AllSpells = source.friendlyfire [character.nome] and source.friendlyfire [character.nome].spells + for spellid, on_player in pairs (AllSpells) do + if (on_player and on_player >= 1) then + + local spellname = GetSpellInfo (spellid) + if (spellname) then + local has_index = bs_index_table [spellname] + local this_spell + if (has_index) then + this_spell = bs_table [has_index] + else + + bs_index = bs_index + 1 + + this_spell = bs_table [bs_index] + if (this_spell) then + this_spell [1] = spellid + this_spell [2] = 0 + this_spell [3] = _detalhes.spell_school_cache [select (1, GetSpellInfo (spellid))] or 1 + bs_index_table [spellname] = bs_index + else + this_spell = {spellid, 0, _detalhes.spell_school_cache [select (1, GetSpellInfo (spellid))] or 1} + bs_table [bs_index] = this_spell + bs_index_table [spellname] = bs_index + end + + end + + this_spell [2] = this_spell [2] + on_player + total = total + on_player + else + _detalhes:Msg ("error - no spell id for DTBS friendly fire", spellid, spellname) + end + end + end + end + end + end + end + end + + local tsize = #bs_table + if (bs_index < tsize) then + for i = bs_index+1, tsize do + bs_table [i][2] = 0 + end + end + + instancia.top = 0 + if (tsize > 0) then + _table_sort (bs_table, _detalhes.Sort2) + instancia.top = bs_table [1][2] + end + + local total2 = bs_index + + if (exportar) then + local export = {} + for i = 1, bs_index do + -- spellid, total, spellschool + export [i] = {spellid = bs_table[i][1], damage = bs_table[i][2], spellschool = bs_table[i][3]} + end + return total, "damage", instancia.top, bs_index, export + end + + if (bs_index < 1) then + instancia:EsconderScrollBar() + return _detalhes:EndRefresh (instancia, bs_index, tabela_do_combate, showing) --> retorna a tabela que precisa ganhar o refresh + end + + tabela_do_combate.totals.by_spell = total + + instancia:AtualizarScrollBar (bs_index) + + local qual_barra = 1 + local barras_container = instancia.barras + + --print (bs_index, #bs_table, instancia.barraS[1], instancia.barraS[2]) + + for i = instancia.barraS[1], instancia.barraS[2], 1 do + atributo_damage:AtualizarBySpell (bs_table[i], qual_barra, i, instancia) + qual_barra = qual_barra+1 + end + + return _detalhes:EndRefresh (instancia, bs_index, tabela_do_combate, showing) + elseif (keyName == "voidzones") then local index = 0 @@ -1048,7 +1912,10 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex total = index if (exportar) then - return voidzone_damage_total, "damage", instancia.top, total, vtable + for _, t in ipairs (vtable) do + t.report_name = _detalhes:GetSpellLink (t.damage_spellid) + end + return voidzone_damage_total, "damage", instancia.top, total, vtable, "report_name" end if (total < 1) then @@ -1801,7 +2668,7 @@ end if (self.enemy) then if (self.arena_enemy) then if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName) end @@ -1809,13 +2676,13 @@ end else if (_detalhes.faction_against == "Horde") then if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"..self.displayName) --seta o texto da esqueda -- HORDA end else --alliance if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"..self.displayName) --seta o texto da esqueda -- ALLY end @@ -1830,13 +2697,13 @@ end else if (self.arena_ally) then if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName) end else if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. self.displayName) --seta o texto da esqueda end @@ -1947,11 +2814,8 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) end --> MOSTRA HABILIDADES - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, r, g, b, #ActorSkillsSortTable) - - --GameCooltip:AddIcon ([[Interface\ICONS\Spell_Shaman_BlessingOfTheEternals]], 1, 1, 14, 14, 0.90625, 0.109375, 0.15625, 0.875) - GameCooltip:AddIcon (_detalhes.tooltip_spell_icon.file, 1, 1, 14, 14, unpack (_detalhes.tooltip_spell_icon.coords)) - + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, #ActorSkillsSortTable, _detalhes.tooltip_spell_icon.file, unpack (_detalhes.tooltip_spell_icon.coords)) + if (is_maximized) then --highlight shift key GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay2) @@ -1984,7 +2848,7 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) --> MOSTRA INIMIGOS if (instancia.sub_atributo == 1 or instancia.sub_atributo == 6) then - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_TARGETS"], headerColor, r, g, b, #ActorTargetsSortTable) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_TARGETS"], headerColor, #ActorTargetsSortTable, [[Interface\Addons\Details\images\icons]], 0, 0.03125, 0.126953125, 0.15625) local max_targets = _detalhes.tooltip.tooltip_max_targets local is_maximized = false @@ -1993,8 +2857,6 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) is_maximized = true end - GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0, 0.03125, 0.126953125, 0.15625) - if (is_maximized) then --highlight GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_ctrl]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay2) @@ -2085,9 +2947,7 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) if (not added_logo) then added_logo = true - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_PETS"], headerColor, r, g, b, #totais) - - GameCooltip:AddIcon ([[Interface\COMMON\friendship-heart]], 1, 1, 14, 14, 0.21875, 0.78125, 0.09375, 0.6875) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_PETS"], headerColor, #totais, [[Interface\COMMON\friendship-heart]], 0.21875, 0.78125, 0.09375, 0.6875) if (ismaximized) then GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_alt]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay2) @@ -2112,16 +2972,81 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) end - --> enemies - if (instancia.sub_atributo == 6) then - GameCooltip:AddLine (" ") - GameCooltip:AddLine (Loc ["STRING_LEFTCLICK_DAMAGETAKEN"]) - --GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 8/512, 70/512, 224/512, 306/512) - GameCooltip:AddLine (Loc ["STRING_MIDDLECLICK_DAMAGETAKEN"]) - --GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 14/512, 64/512, 127/512, 204/512) + return true +end + +local on_switch_show_enemies = function (instance) + instance:TrocaTabela (instance, true, 1, 6) + return true +end + +local on_switch_show_frags = function (instance) + instance:TrocaTabela (instance, true, 1, 5) + return true +end + +local ENEMIES_format_name = function (player) if (player == 0) then return false end return _detalhes:GetOnlyName (player.nome) end +local ENEMIES_format_amount = function (amount) if (amount <= 0) then return false end return _detalhes:ToK (amount) .. " (" .. _cstr ("%.1f", amount / tooltip_temp_table.damage_total * 100) .. "%)" end + +function atributo_damage:ReportEnemyDamageTaken (actor, instance, ShiftKeyDown, ControlKeyDown, fromFrags) + if (ShiftKeyDown) then + local inimigo = actor.nome + local custom_name = inimigo .. " -" .. Loc ["STRING_CUSTOM_ENEMY_DT"] + + --> procura se já tem um custom: + for index, CustomObject in _ipairs (_detalhes.custom) do + if (CustomObject:GetName() == custom_name) then + --> fix for not saving funcs on logout + if (not CustomObject.OnSwitchShow) then + CustomObject.OnSwitchShow = fromFrags and on_switch_show_frags or on_switch_show_enemies + end + return instance:TrocaTabela (instance.segmento, 5, index) + end + end + + --> criar um custom para este actor. + local new_custom_object = { + name = custom_name, + icon = [[Interface\ICONS\Pet_Type_Undead]], + attribute = "damagedone", + author = _detalhes.playername, + desc = inimigo .. " Damage Taken", + source = "[raid]", + target = inimigo, + script = false, + tooltip = false, + temp = true, + OnSwitchShow = fromFrags and on_switch_show_frags or on_switch_show_enemies, + } + + tinsert (_detalhes.custom, new_custom_object) + setmetatable (new_custom_object, _detalhes.atributo_custom) + new_custom_object.__index = _detalhes.atributo_custom + + return instance:TrocaTabela (instance.segmento, 5, #_detalhes.custom) end - return true + local report_table = {"Details!: " .. actor.nome .. " - " .. Loc ["STRING_ATTRIBUTE_DAMAGE_TAKEN"]} + + _detalhes:FormatReportLines (report_table, tooltip_temp_table, ENEMIES_format_name, ENEMIES_format_amount) + + return _detalhes:Reportar (report_table, {_no_current = true, _no_inverse = true, _custom = true}) +end + +local FRAGS_format_name = function (player_name) return _detalhes:GetOnlyName (player_name) end +local FRAGS_format_amount = function (amount) return _detalhes:ToK (amount) .. " (" .. _cstr ("%.1f", amount / frags_tooltip_table.damage_total * 100) .. "%)" end + +function atributo_damage:ReportSingleFragsLine (frag, instance, ShiftKeyDown, ControlKeyDown) + + if (ShiftKeyDown) then + return atributo_damage:ReportEnemyDamageTaken (frag, instance, ShiftKeyDown, ControlKeyDown, true) + end + + local report_table = {"Details!: " .. frag [1] .. " - " .. Loc ["STRING_ATTRIBUTE_DAMAGE_TAKEN"]} + + _detalhes:FormatReportLines (report_table, frags_tooltip_table, FRAGS_format_name, FRAGS_format_amount) + + return _detalhes:Reportar (report_table, {_no_current = true, _no_inverse = true, _custom = true}) end function atributo_damage:ToolTip_Enemies (instancia, numero, barra, keydown) @@ -2162,8 +3087,7 @@ function atributo_damage:ToolTip_Enemies (instancia, numero, barra, keydown) _table_sort (tooltip_temp_table, _detalhes.Sort2) -- enemy damage taken - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_DAMAGE_TAKEN_FROM"], headerColor, r, g, b, i-1) - GameCooltip:AddIcon ([[Interface\Buttons\UI-MicroStream-Red]], 1, 1, 14, 14, 0.1875, 0.8125, 0.15625, 0.78125) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_DAMAGE_TAKEN_FROM"], headerColor, i-1, [[Interface\Buttons\UI-MicroStream-Red]], 0.1875, 0.8125, 0.15625, 0.78125) GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay2) --GameCooltip:AddStatusBar (100, 1, 0.7, g, b, 1) @@ -2172,6 +3096,8 @@ function atributo_damage:ToolTip_Enemies (instancia, numero, barra, keydown) --> build the tooltip local top = (tooltip_temp_table [1] and tooltip_temp_table [1][2]) or 0 + tooltip_temp_table.damage_total = damage_taken + for o = 1, i-1 do local player = tooltip_temp_table [o][1] @@ -2204,7 +3130,7 @@ function atributo_damage:ToolTip_Enemies (instancia, numero, barra, keydown) --> damage done and heal GameCooltip:AddLine (" ") - GameCooltip:AddLine (Loc ["STRING_ATTRIBUTE_DAMAGE_DONE"], FormatTooltipNumber (_, _math_floor (self.total))) + GameCooltip:AddLine (Loc ["STRING_ATTRIBUTE_DAMAGE_ENEMIES_DONE"], FormatTooltipNumber (_, _math_floor (self.total))) local half = 0.00048828125 GameCooltip:AddIcon (instancia:GetSkinTexture(), 1, 1, 14, 14, 0.005859375 + half, 0.025390625 - half, 0.3623046875, 0.3818359375) --_detalhes:AddTooltipBackgroundStatusbar() @@ -2212,29 +3138,23 @@ function atributo_damage:ToolTip_Enemies (instancia, numero, barra, keydown) local heal_actor = instancia.showing (2, self.nome) if (heal_actor) then - GameCooltip:AddLine (Loc ["STRING_ATTRIBUTE_HEAL_DONE"], FormatTooltipNumber (_, _math_floor (heal_actor.heal_enemy_amt))) + GameCooltip:AddLine (Loc ["STRING_ATTRIBUTE_HEAL_ENEMY"], FormatTooltipNumber (_, _math_floor (heal_actor.heal_enemy_amt))) else - GameCooltip:AddLine (Loc ["STRING_ATTRIBUTE_HEAL_DONE"], 0) + GameCooltip:AddLine (Loc ["STRING_ATTRIBUTE_HEAL_ENEMY"], 0) end GameCooltip:AddIcon (instancia:GetSkinTexture(), 1, 1, 14, 14, 0.037109375 + half, 0.056640625 - half, 0.3623046875, 0.3818359375) --_detalhes:AddTooltipBackgroundStatusbar() GameCooltip:AddStatusBar (0, 1, r, g, b, 1, false, enemies_background) - --> enemy description - if (instancia.sub_atributo == 6) then - GameCooltip:AddLine (" ") - GameCooltip:AddLine (Loc ["STRING_LEFTCLICK_DAMAGETAKEN"]) - GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.4) - GameCooltip:AddLine (Loc ["STRING_MIDDLECLICK_DAMAGETAKEN"]) - GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.4) - end + GameCooltip:AddLine (" ") + _detalhes:AddTooltipReportLineText() --> clean up - for o = 1, #tooltip_temp_table do - local t = tooltip_temp_table [o] - t[2] = 0 - t[1] = 0 - end + --for o = 1, #tooltip_temp_table do + -- local t = tooltip_temp_table [o] + -- t[2] = 0 + -- t[1] = 0 + --end GameCooltip:SetOption ("YSpacingMod", -1) @@ -2296,11 +3216,9 @@ function atributo_damage:ToolTip_DamageTaken (instancia, numero, barra, keydown) end if (instancia.sub_atributo == 6) then - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_DAMAGE_TAKEN_FROM"], headerColor, r, g, b, #meus_agressores) - GameCooltip:AddIcon ([[Interface\Buttons\UI-MicroStream-Red]], 1, 1, 14, 14, 0.1875, 0.8125, 0.15625, 0.78125) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_DAMAGE_TAKEN_FROM"], headerColor, #meus_agressores, [[Interface\Buttons\UI-MicroStream-Red]], 0.1875, 0.8125, 0.15625, 0.78125) else - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_FROM"], headerColor, r, g, b, #meus_agressores) - GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.126953125, 0.1796875, 0, 0.0546875) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_FROM"], headerColor, #meus_agressores, [[Interface\Addons\Details\images\icons]], 0.126953125, 0.1796875, 0, 0.0546875) end if (ismaximized) then @@ -2384,15 +3302,6 @@ function atributo_damage:ToolTip_DamageTaken (instancia, numero, barra, keydown) end - --> enemies - if (instancia.sub_atributo == 6) then - GameCooltip:AddLine (" ") - GameCooltip:AddLine (Loc ["STRING_LEFTCLICK_DAMAGETAKEN"]) - GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.7) - GameCooltip:AddLine (Loc ["STRING_MIDDLECLICK_DAMAGETAKEN"]) - GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.7) - end - return true end @@ -2429,9 +3338,7 @@ function atributo_damage:ToolTip_FriendlyFire (instancia, numero, barra, keydown _table_sort (DamagedPlayers, _detalhes.Sort2) _table_sort (Skills, _detalhes.Sort2) - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_TARGETS"], headerColor, r, g, b, #DamagedPlayers) - - GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.126953125, 0.224609375, 0.056640625, 0.140625) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_TARGETS"], headerColor, #DamagedPlayers, [[Interface\Addons\Details\images\icons]], 0.126953125, 0.224609375, 0.056640625, 0.140625) local ismaximized = false if (keydown == "shift" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 3) then @@ -3661,8 +4568,19 @@ end for i = #vtable, 1, -1 do vtable [i] = nil end - + for i = #bs_table, 1, -1 do + bs_table [i] = nil + end + + if (bs_tooltip_table) then + wipe (bs_tooltip_table) + end + if (frags_tooltip_table) then + wipe (frags_tooltip_table) + end + wipe (bs_index_table) wipe (tooltip_temp_table) + wipe (tooltip_void_zone_temp) end --> atualize a funcao de abreviacao @@ -4068,7 +4986,7 @@ end _table_sort (tooltip_temp_table, _detalhes.Sort2) --> enemy damage taken - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_ATTRIBUTE_DAMAGE"], headerColor, r, g, b, i-1, true) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_ATTRIBUTE_DAMAGE"], headerColor, i-1, true) GameCooltip:AddIcon ([=[Interface\Buttons\UI-MicroStream-Green]=], 2, 1, 14, 14, 0.1875, 0.8125, 0.15625, 0.78125) GameCooltip:AddIcon ([=[Interface\AddOns\Details\images\key_shift]=], 2, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay2) GameCooltip:AddStatusBar (100, 2, 0.7, g, b, 1) diff --git a/classes/classe_energy.lua b/classes/classe_energy.lua index 1f508543..a2b82a22 100644 --- a/classes/classe_energy.lua +++ b/classes/classe_energy.lua @@ -817,7 +817,7 @@ function atributo_energy:RefreshBarra (esta_barra, instancia, from_resize) if (self.enemy) then if (self.arena_enemy) then if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName) end @@ -825,13 +825,13 @@ function atributo_energy:RefreshBarra (esta_barra, instancia, from_resize) else if (_detalhes.faction_against == "Horde") then if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"..self.displayName) --seta o texto da esqueda -- HORDA end else if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"..self.displayName) --seta o texto da esqueda -- ALLY end @@ -844,13 +844,13 @@ function atributo_energy:RefreshBarra (esta_barra, instancia, from_resize) else if (self.arena_ally) then if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName) end else if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. self.displayName) --seta o texto da esqueda end @@ -967,8 +967,7 @@ function atributo_energy:ToolTipRegenRecebido (instancia, numero, barra, keydown i = i - 1 _table_sort (energy_tooltips_table, _detalhes.Sort2) - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, r, g, b, i) - GameCooltip:AddIcon ([[Interface\HELPFRAME\ReportLagIcon-Spells]], 1, 1, 14, 14, 0.21875, 0.78125, 0.21875, 0.78125) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, i, [[Interface\HELPFRAME\ReportLagIcon-Spells]], 0.21875, 0.78125, 0.21875, 0.78125) local ismaximized = false if (keydown == "shift" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 3) then @@ -1030,8 +1029,7 @@ function atributo_energy:ToolTipRegenRecebido (instancia, numero, barra, keydown i = i - 1 _table_sort (energy_tooltips_table, _detalhes.Sort2) - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_PLAYERS"], headerColor, r, g, b, i) - GameCooltip:AddIcon ([[Interface\HELPFRAME\HelpIcon-HotIssues]], 1, 1, 14, 14, 0.21875, 0.78125, 0.21875, 0.78125) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_PLAYERS"], headerColor, i, [[Interface\HELPFRAME\HelpIcon-HotIssues]], 0.21875, 0.78125, 0.21875, 0.78125) local ismaximized = false if (keydown == "ctrl" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 4) then diff --git a/classes/classe_heal.lua b/classes/classe_heal.lua index 476ad6b6..91aac951 100644 --- a/classes/classe_heal.lua +++ b/classes/classe_heal.lua @@ -928,7 +928,7 @@ function atributo_heal:RefreshBarra (esta_barra, instancia, from_resize) if (self.enemy) then if (self.arena_enemy) then if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName) end @@ -936,13 +936,13 @@ function atributo_heal:RefreshBarra (esta_barra, instancia, from_resize) else if (_detalhes.faction_against == "Horde") then if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"..self.displayName) --seta o texto da esqueda -- HORDA end else if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"..self.displayName) --seta o texto da esqueda -- ALLY end @@ -955,13 +955,13 @@ function atributo_heal:RefreshBarra (esta_barra, instancia, from_resize) else if (self.arena_ally) then if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName) end else if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. self.displayName) --seta o texto da esqueda end @@ -1068,9 +1068,7 @@ function atributo_heal:ToolTip_HealingTaken (instancia, numero, barra, keydown) end end - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_FROM"], headerColor, r, g, b, #meus_curadores) - - GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TutorialFrame-LevelUp]], 1, 1, 14, 14, 0.10546875, 0.89453125, 0.05859375, 0.6796875) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_FROM"], headerColor, #meus_curadores, [[Interface\TUTORIALFRAME\UI-TutorialFrame-LevelUp]], 0.10546875, 0.89453125, 0.05859375, 0.6796875) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) local ismaximized = false @@ -1161,8 +1159,7 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra, keydown) _table_sort (ActorHealingTargets, _detalhes.Sort2) --> Mostra as habilidades no tooltip - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, r, g, b, #ActorHealingTable) - GameCooltip:AddIcon ([[Interface\RAIDFRAME\Raid-Icon-Rez]], 1, 1, 14, 14, 0.109375, 0.890625, 0.0625, 0.90625) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, #ActorHealingTable, [[Interface\RAIDFRAME\Raid-Icon-Rez]], 0.109375, 0.890625, 0.0625, 0.90625) local ismaximized = false if (keydown == "shift" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 3) then @@ -1215,8 +1212,7 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra, keydown) if (instancia.sub_atributo == 1) then -- 1 or 2 -> healing done or hps - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_TARGETS"], headerColor, r, g, b, #ActorHealingTargets) - GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TutorialFrame-LevelUp]], 1, 1, 14, 14, 0.10546875, 0.89453125, 0.05859375, 0.6796875) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_TARGETS"], headerColor, #ActorHealingTargets, [[Interface\TUTORIALFRAME\UI-TutorialFrame-LevelUp]], 0.10546875, 0.89453125, 0.05859375, 0.6796875) local ismaximized = false if (keydown == "ctrl" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 4) then @@ -1328,9 +1324,7 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra, keydown) if (not added_logo) then added_logo = true - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_PETS"], headerColor, r, g, b, #totais) - - GameCooltip:AddIcon ([[Interface\COMMON\friendship-heart]], 1, 1, 14, 14, 0.21875, 0.78125, 0.09375, 0.6875) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_PETS"], headerColor, #totais, [[Interface\COMMON\friendship-heart]], 0.21875, 0.78125, 0.09375, 0.6875) if (ismaximized) then GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_alt]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay2) diff --git a/classes/classe_instancia.lua b/classes/classe_instancia.lua index 26065753..1fc0a03b 100644 --- a/classes/classe_instancia.lua +++ b/classes/classe_instancia.lua @@ -2181,6 +2181,15 @@ function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, ini end end + if (not _detalhes:GetTutorialCVar ("ATTRIBUTE_SELECT_TUTORIAL2") and not _detalhes.initializing and not iniciando_instancia) then + + if (not _G ["DetailsWelcomeWindow"] or not _G ["DetailsWelcomeWindow"]:IsShown()) then + --_detalhes:SetTutorialCVar ("ATTRIBUTE_SELECT_TUTORIAL2", true) + --_detalhes:TutorialBookmark (instancia) + end + + end + if (_detalhes.cloud_process) then if (_detalhes.debug) then @@ -2731,6 +2740,101 @@ local function GetDpsHps (_thisActor, key) end end +-- report_table: table sent to report func / data: numeric table {{value1, value2}} / f1: format value1 / f2: format value2 +local default_format_value1 = function (v) return v end +local default_format_value2 = function (v) return v end +local default_format_value3 = function (i, v1, v2) + return "" .. i .. ". " .. v1 .. " " .. v2 +end + +function _detalhes:FormatReportLines (report_table, data, f1, f2, f3) + + f1 = f1 or default_format_value1 + f2 = f2 or default_format_value2 + f3 = f3 or default_format_value3 + + if (not _detalhes.fontstring_len) then + _detalhes.fontstring_len = _detalhes.listener:CreateFontString (nil, "background", "GameFontNormal") + end + local _, fontSize = FCF_GetChatWindowInfo (1) + if (fontSize < 1) then + fontSize = 10 + end + local fonte, _, flags = _detalhes.fontstring_len:GetFont() + _detalhes.fontstring_len:SetFont (fonte, fontSize, flags) + _detalhes.fontstring_len:SetText ("DEFAULT NAME") + local biggest_len = _detalhes.fontstring_len:GetStringWidth() + + for index, t in ipairs (data) do + local v1 = f1 (t[1]) + _detalhes.fontstring_len:SetText (v1) + local len = _detalhes.fontstring_len:GetStringWidth() + if (len > biggest_len) then + biggest_len = len + end + end + + if (biggest_len > 130) then + biggest_len = 130 + end + + for index, t in ipairs (data) do + local v1, v2 = f1 (t[1]), f2 (t[2]) + if (v1 and v2 and type (v1) == "string" and type (v2) == "string") then + v1 = v1 .. " " + _detalhes.fontstring_len:SetText (v1) + local len = _detalhes.fontstring_len:GetStringWidth() + + while (len < biggest_len) do + v1 = v1 .. "." + _detalhes.fontstring_len:SetText (v1) + len = _detalhes.fontstring_len:GetStringWidth() + end + + report_table [#report_table+1] = f3 (index, v1, v2) + end + end + +end + +local report_name_function = function (name) + local name, index = unpack (name) + + if (_detalhes.remove_realm_from_name and name:find ("-")) then + return index .. ". " .. name:gsub (("%-.*"), "") + else + return index .. ". " .. name + end +end + +local report_amount_function = function (t) + local amount, dps, percent, is_string, index = unpack (t) + + if (not is_string) then + if (dps) then + if (_detalhes.report_schema == 1) then + return _detalhes:ToKReport (_math_floor (amount)) .. " (" .. _detalhes:ToKMin (_math_floor (dps)) .. ", " .. percent .. "%)" + elseif (_detalhes.report_schema == 2) then + return percent .. "% (" .. _detalhes:ToKMin (_math_floor (dps)) .. ", " .. _detalhes:ToKReport ( _math_floor (amount)) .. ")" + elseif (_detalhes.report_schema == 3) then + return percent .. "% (" .. _detalhes:ToKReport ( _math_floor (amount) ) .. ", " .. _detalhes:ToKMin (_math_floor (dps)) .. ")" + end + else + if (_detalhes.report_schema == 1) then + return _detalhes:ToKReport (amount) .. " (" .. percent .. "%)" + else + return percent .. "% (" .. _detalhes:ToKReport (amount) .. ")" + end + end + else + return amount + end +end + +local report_build_line = function (i, v1, v2) + return v1 .. " " .. v2 +end + --> Reportar o que esta na janela da instância function _detalhes:monta_relatorio (este_relatorio, custom) @@ -2791,327 +2895,171 @@ function _detalhes:monta_relatorio (este_relatorio, custom) local barras = self.barras local esta_barra - local is_current = _G ["Details_Report_CB_1"]:GetChecked() local is_reverse = _G ["Details_Report_CB_2"]:GetChecked() - - if (not _detalhes.fontstring_len) then - _detalhes.fontstring_len = _detalhes.listener:CreateFontString (nil, "background", "GameFontNormal") - end - local _, fontSize = FCF_GetChatWindowInfo (1) - if (fontSize < 1) then - fontSize = 10 - end - local fonte, _, flags = _detalhes.fontstring_len:GetFont() - _detalhes.fontstring_len:SetFont (fonte, fontSize, flags) - _detalhes.fontstring_len:SetText ("hello details!") - local default_len = _detalhes.fontstring_len:GetStringWidth() - local name_member = "nome" - --> pegar a font do chat - --_detalhes.fontstring_len: + if (not is_current) then - if (not is_reverse) then - - if (not is_current) then - --> assumindo que self é sempre uma instância aqui. - local total, keyName, keyNameSec, first - local container_amount = 0 - local atributo = self.atributo - local container = self.showing [atributo]._ActorTable - - if (atributo == 1) then --> damage + local total, keyName, keyNameSec, first + local container_amount = 0 + local atributo = self.atributo + local container = self.showing [atributo]._ActorTable + + if (atributo == 1) then --> damage - if (self.sub_atributo == 5) then --> frags - local frags = self.showing.frags - local reportarFrags = {} - for name, amount in pairs (frags) do - --> string para imprimir direto sem calculos - reportarFrags [#reportarFrags+1] = {frag = tostring (amount), nome = name} - end - container = reportarFrags - container_amount = #reportarFrags - keyName = "frag" - - elseif (self.sub_atributo == 7) then --> auras e voidzones + if (self.sub_atributo == 5) then --> frags + local frags = self.showing.frags + local reportarFrags = {} + for name, amount in pairs (frags) do + --> string para imprimir direto sem calculos + reportarFrags [#reportarFrags+1] = {frag = tostring (amount), nome = name} + end + container = reportarFrags + container_amount = #reportarFrags + keyName = "frag" - total, keyName, first, container_amount, container = _detalhes.atributo_damage:RefreshWindow (self, self.showing, true, true) - - - else - total, keyName, first, container_amount = _detalhes.atributo_damage:RefreshWindow (self, self.showing, true, true) - if (self.sub_atributo == 1) then - keyNameSec = "dps" - elseif (self.sub_atributo == 2) then - - end + elseif (self.sub_atributo == 7) then --> auras e voidzones + + total, keyName, first, container_amount, container, name_member = _detalhes.atributo_damage:RefreshWindow (self, self.showing, true, true) + + elseif (self.sub_atributo == 8) then --> damage taken by spell + + total, keyName, first, container_amount, container = _detalhes.atributo_damage:RefreshWindow (self, self.showing, true, true) + + for _, t in ipairs (container) do + t.nome = _detalhes:GetSpellLink (t.spellid) end - elseif (atributo == 2) then --> heal - total, keyName, first, container_amount = _detalhes.atributo_heal:RefreshWindow (self, self.showing, true, true) - + + else + total, keyName, first, container_amount = _detalhes.atributo_damage:RefreshWindow (self, self.showing, true, true) if (self.sub_atributo == 1) then - keyNameSec = "hps" - end - elseif (atributo == 3) then --> energy - total, keyName, first, container_amount = _detalhes.atributo_energy:RefreshWindow (self, self.showing, true, true) - elseif (atributo == 4) then --> misc - if (self.sub_atributo == 5) then --> mortes - - local mortes = self.showing.last_events_tables - local reportarMortes = {} - for index, morte in ipairs (mortes) do - reportarMortes [#reportarMortes+1] = {dead = morte [6], nome = morte [3]:gsub (("%-.*"), "")} - end - container = reportarMortes - container_amount = #reportarMortes - keyName = "dead" - else - total, keyName, first, container_amount = _detalhes.atributo_misc:RefreshWindow (self, self.showing, true, true) - end - elseif (atributo == 5) then --> custom - - if (_detalhes.custom [self.sub_atributo]) then - total, container, first, container_amount, nm = _detalhes.atributo_custom:RefreshWindow (self, self.showing, true, true) - if (nm) then - name_member = nm - print ("nm:", nm) - end - keyName = "report_value" - else - total, keyName, first, container_amount = _detalhes.atributo_damage:RefreshWindow (self, self.showing, true, true) - total = 1 - atributo = 1 - container = self.showing [atributo]._ActorTable - end - --print (total, keyName, first, atributo, container_amount) - end - - amt = math.min (amt, container_amount or 0) ---amt é zero - for i = 1, amt do - local _thisActor = container [i] - - if (_thisActor) then - - local amount, is_string - if (type (_thisActor [keyName]) == "number") then - amount = _math_floor (_thisActor [keyName]) - else - amount = _thisActor [keyName] - is_string = true - end - - local name = _thisActor [name_member] .. " " - if (_detalhes.remove_realm_from_name and name:find ("-")) then - name = name:gsub (("%-.*"), "") - end + keyNameSec = "dps" + elseif (self.sub_atributo == 2) then - _detalhes.fontstring_len:SetText (name) - local stringlen = _detalhes.fontstring_len:GetStringWidth() - - while (stringlen < default_len) do - name = name .. "." - _detalhes.fontstring_len:SetText (name) - stringlen = _detalhes.fontstring_len:GetStringWidth() - end - - local percent - - if (self.atributo == 2 and self.sub_atributo == 3) then --overheal - percent = _cstr ("%.1f", _thisActor.totalover / (_thisActor.totalover + _thisActor.total) * 100) - elseif (not is_string) then - percent = _cstr ("%.1f", amount/total*100) - end - - if (_type (amount) == "number" and amount > 0) then - if (keyNameSec) then - local dps = GetDpsHps (_thisActor, keyNameSec) - if (_detalhes.report_schema == 1) then - report_lines [#report_lines+1] = i .. ". " .. name .. " " .. _detalhes:ToKMin ( _math_floor (amount) ) .. " (" .. _detalhes:ToKMin (_math_floor (dps)) .. ", " .. percent .. "%)" - elseif (_detalhes.report_schema == 2) then - report_lines [#report_lines+1] = i .. ". " .. name .. " " .. percent .. "% (" .. _detalhes:ToKMin (_math_floor (dps)) .. ", " .. _detalhes:ToKMin ( _math_floor (amount)) .. ")" - elseif (_detalhes.report_schema == 3) then - report_lines [#report_lines+1] = i .. ". " .. name .. " " .. percent .. "% (" .. _detalhes:ToKMin ( _math_floor (amount) ) .. ", " .. _detalhes:ToKMin (_math_floor (dps)) .. ")" - end - else - if (_detalhes.report_schema == 1) then - report_lines [#report_lines+1] = i .. ". " .. name .. " " .. _detalhes:ToKReport (amount) .. " (" .. percent .. "%)" - else - report_lines [#report_lines+1] = i .. ". " .. name .. " " .. percent .. "% (" .. _detalhes:ToKReport (amount) .. ")" - end - end - - elseif (_type (amount) == "string") then - - report_lines [#report_lines+1] = i .. ". " .. name .. " " .. amount - - else - break - end - else - break end end - - else - for i = 1, amt do - local ROW = self.barras [i] - if (ROW) then - if (not ROW.hidden or ROW.fading_out) then --> a barra esta visivel na tela - report_lines [#report_lines+1] = ROW.texto_esquerdo:GetText().." ".. ROW.texto_direita:GetText() - else - break - end - else - break --> chegou a final, parar de pegar as linhas - end + elseif (atributo == 2) then --> heal + total, keyName, first, container_amount = _detalhes.atributo_heal:RefreshWindow (self, self.showing, true, true) + + if (self.sub_atributo == 1) then + keyNameSec = "hps" end - end - - else --> é reverso - report_lines[1] = report_lines[1].." (" .. Loc ["STRING_REPORTFRAME_REVERTED"] .. ")" - - if (not is_current) then - --> assumindo que self é sempre uma instância aqui. - local total, keyName, first, container_amount - local atributo = self.atributo - - local container = self.showing [atributo]._ActorTable - local quantidade = 0 - - if (atributo == 1) then --> damage - if (self.sub_atributo == 5) then --> frags - local frags = self.showing.frags - local reportarFrags = {} - for name, amount in pairs (frags) do - --> string para imprimir direto sem calculos - reportarFrags [#reportarFrags+1] = {frag = tostring (amount), nome = name} - end - container = reportarFrags - keyName = "frag" - else - if (self.sub_atributo == 1) then - keyNameSec = "dps" - end - total, keyName, first, container_amount = _detalhes.atributo_damage:RefreshWindow (self, self.showing, true, true) + elseif (atributo == 3) then --> energy + total, keyName, first, container_amount = _detalhes.atributo_energy:RefreshWindow (self, self.showing, true, true) + elseif (atributo == 4) then --> misc + if (self.sub_atributo == 5) then --> mortes + + local mortes = self.showing.last_events_tables + local reportarMortes = {} + for index, morte in ipairs (mortes) do + reportarMortes [#reportarMortes+1] = {dead = morte [6], nome = morte [3]:gsub (("%-.*"), "")} end - elseif (atributo == 2) then --> heal - total, keyName, first, container_amount = _detalhes.atributo_heal:RefreshWindow (self, self.showing, true, true) - if (self.sub_atributo == 1) then - keyNameSec = "hps" - end - elseif (atributo == 3) then --> energy - total, keyName, first, container_amount = _detalhes.atributo_energy:RefreshWindow (self, self.showing, true, true) - elseif (atributo == 4) then --> misc - if (self.sub_atributo == 5) then --> mortes - local mortes = self.showing.last_events_tables - local reportarMortes = {} - for index, morte in ipairs (mortes) do - reportarMortes [#reportarMortes+1] = {dead = morte [6], nome = morte [3]:gsub (("%-.*"), "")} - end - container = reportarMortes - keyName = "dead" - else - total, keyName, first, container_amount = _detalhes.atributo_misc:RefreshWindow (self, self.showing, true, true) - end - elseif (atributo == 5) then --> custom + container = reportarMortes + container_amount = #reportarMortes + keyName = "dead" + else + total, keyName, first, container_amount = _detalhes.atributo_misc:RefreshWindow (self, self.showing, true, true) + end + elseif (atributo == 5) then --> custom + + if (_detalhes.custom [self.sub_atributo]) then total, container, first, container_amount, nm = _detalhes.atributo_custom:RefreshWindow (self, self.showing, true, true) if (nm) then name_member = nm end - keyName = "report_value" + keyName = "report_value" + else + total, keyName, first, container_amount = _detalhes.atributo_damage:RefreshWindow (self, self.showing, true, true) + total = 1 + atributo = 1 + container = self.showing [atributo]._ActorTable end + --print (total, keyName, first, atributo, container_amount) + end + + amt = math.min (amt, container_amount or 0) + local raw_data_to_report = {} + + for i = 1, container_amount do + local actor = container [i] - local this_amt = math.min (#container, container_amount or 0, amt) - this_amt = #container - this_amt - - for i = container_amount, this_amt, -1 do - - local _thisActor = container [i] - if (_thisActor) then - - local amount - if (type (_thisActor [keyName]) == "number") then - amount = _math_floor (_thisActor [keyName]) - else - amount = _thisActor [keyName] - end - - local name = _thisActor [name_member] .. " " - - _detalhes.fontstring_len:SetText (name) - local stringlen = _detalhes.fontstring_len:GetStringWidth() - - while (stringlen < default_len) do - name = name .. "." - _detalhes.fontstring_len:SetText (name) - stringlen = _detalhes.fontstring_len:GetStringWidth() - end - - if (_type (amount) == "number") then - if (amount > 0) then - - local percent - - if (self.atributo == 2 and self.sub_atributo == 3) then --overheal - percent = _cstr ("%.1f", _thisActor.totalover / (_thisActor.totalover + _thisActor.total) * 100) - else - percent = _cstr ("%.1f", amount/total*100) - end - - if (keyNameSec) then - local dps = GetDpsHps (_thisActor, keyNameSec) - if (_detalhes.report_schema == 1) then - report_lines [#report_lines+1] = i .. ". " .. name .. " " .. _detalhes:ToKMin ( _math_floor (amount) ) .. " (" .. _detalhes:ToKMin (_math_floor (dps)) .. ", " .. percent .. "%)" - elseif (_detalhes.report_schema == 2) then - report_lines [#report_lines+1] = i .. ". " .. name .. " " .. percent .. "% (" .. _detalhes:ToKMin (_math_floor (dps)) .. ", " .. _detalhes:ToKMin ( _math_floor (amount)) .. ")" - elseif (_detalhes.report_schema == 3) then - report_lines [#report_lines+1] = i .. ". " .. name .. " " .. percent .. "% (" .. _detalhes:ToKMin ( _math_floor (amount) ) .. ", " .. _detalhes:ToKMin (_math_floor (dps)) .. ")" - end - else - if (_detalhes.report_schema == 1) then - report_lines [#report_lines+1] = i .. ". " .. name .. " " .. _detalhes:ToKReport (amount) .. " (" .. percent .. "%)" - else - report_lines [#report_lines+1] = i .. ". " .. name .. " " .. _cstr ("%.1f", amount/total*100) .. "% (" .. percent .. ")" - end - end - - quantidade = quantidade + 1 - if (quantidade == amt) then - break - end - end - elseif (_type (amount) == "string") then - report_lines [#report_lines+1] = i .. ". " .. name .. " " .. amount - else - break - end - end - end - else - local nova_tabela = {} + if (actor) then - for i = 1, amt do - local ROW = self.barras [i] - if (ROW) then - if (not ROW.hidden or ROW.fading_out) then --> a barra esta visivel na tela - nova_tabela [#nova_tabela+1] = ROW.texto_esquerdo:GetText().." ".. ROW.texto_direita:GetText() - else - break - end + -- get the total + local amount, is_string + if (type (actor [keyName]) == "number") then + amount = _math_floor (actor [keyName]) else - break + amount = actor [keyName] + is_string = true end - end - - for i = #nova_tabela, 1, -1 do - report_lines [#report_lines+1] = nova_tabela[i] + + -- get the name + local name = actor [name_member] or "" + + if (not is_string) then + -- get the percent + local percent + if (self.atributo == 2 and self.sub_atributo == 3) then --overheal + percent = _cstr ("%.1f", actor.totalover / (actor.totalover + actor.total) * 100) + elseif (not is_string) then + percent = _cstr ("%.1f", amount / total * 100) + end + + -- get the dps + local dps = false + if (keyNameSec) then + dps = GetDpsHps (actor, keyNameSec) + end + + raw_data_to_report [#raw_data_to_report+1] = {{name, i}, {amount, dps, percent, false}} + else + raw_data_to_report [#raw_data_to_report+1] = {{name, i}, {amount, false, false, true}} + end + + else + break end end + if (is_reverse) then + local t = {} + for i = #raw_data_to_report, 1, -1 do + tinsert (t, raw_data_to_report [i]) + if (#t >= amt) then + break + end + end + _detalhes:FormatReportLines (report_lines, t, report_name_function, report_amount_function, report_build_line) + else + for i = #raw_data_to_report, amt+1, -1 do + tremove (raw_data_to_report, i) + end + _detalhes:FormatReportLines (report_lines, raw_data_to_report, report_name_function, report_amount_function, report_build_line) + end + + else + + local raw_data_to_report = {} + + for i = 1, amt do + local window_bar = self.barras [i] + if (window_bar) then + if (not window_bar.hidden or window_bar.fading_out) then + raw_data_to_report [#raw_data_to_report+1] = {window_bar.texto_esquerdo:GetText(), window_bar.texto_direita:GetText()} + else + break + end + else + break + end + end + + _detalhes:FormatReportLines (report_lines, raw_data_to_report, nil, nil, report_build_line) + end - + return self:envia_relatorio (report_lines) end diff --git a/classes/classe_others.lua b/classes/classe_others.lua index 10d379b3..d5214479 100644 --- a/classes/classe_others.lua +++ b/classes/classe_others.lua @@ -449,50 +449,51 @@ function atributo_misc:ReportSingleCooldownLine (misc_actor, instancia) return _detalhes:Reportar (reportar, {_no_current = true, _no_inverse = true, _custom = true}) end -function atributo_misc:ReportSingleBuffUptimeLine (misc_actor, instancia) - local reportar = {"Details!: " .. misc_actor.nome .. " - " .. Loc ["STRING_ATTRIBUTE_MISC_BUFF_UPTIME"]} - - local buffs = {} - local combat_time = instancia.showing:GetCombatTime() - - for spellid, spell in _pairs (misc_actor.buff_uptime_spells._ActorTable) do - buffs [#buffs+1] = {spellid, spell.uptime, spell} - end - - _table_sort (buffs, _detalhes.Sort2) - - for i, spell in _ipairs (buffs) do - local spelllink = GetSpellLink (spell [1]) - local m, s = _math_floor (spell [2] / 60), _math_floor (spell [2] % 60) - - reportar [#reportar+1] = spelllink .. ": " .. m .. "m " .. s .. "s (" .. _cstr ("%.1f", spell [2] / combat_time * 100) .. "%)" - end - - return _detalhes:Reportar (reportar, {_no_current = true, _no_inverse = true, _custom = true}) +local buff_format_name = function (spellid) + return _detalhes:GetSpellLink (spellid) +end +local buff_format_amount = function (t) + local total, percent = unpack (t) + local m, s = _math_floor (total / 60), _math_floor (total % 60) + return _cstr ("%.1f", percent) .. "% (" .. m .. "m " .. s .. "s)" +end +local sort_buff_report = function (t1, t2) + return t1[2][1] > t2[2][1] end -function atributo_misc:ReportSingleDebuffUptimeLine (misc_actor, instancia) +function atributo_misc:ReportSingleBuffUptimeLine (misc_actor, instance) + local report_table = {"Details!: " .. misc_actor.nome .. " - " .. Loc ["STRING_ATTRIBUTE_MISC_BUFF_UPTIME"]} + + local buffs = {} + local combat_time = instance.showing:GetCombatTime() + + for spellid, spell in _pairs (misc_actor.buff_uptime_spells._ActorTable) do + local percent = spell.uptime / combat_time * 100 + if (percent < 99.5) then + buffs [#buffs+1] = {spellid, {spell.uptime, percent}} + end + end - local reportar = {"Details!: " .. misc_actor.nome .. " - " .. Loc ["STRING_ATTRIBUTE_MISC_DEBUFF_UPTIME"]} + _table_sort (buffs, sort_buff_report) + _detalhes:FormatReportLines (report_table, buffs, buff_format_name, buff_format_amount) + return _detalhes:Reportar (report_table, {_no_current = true, _no_inverse = true, _custom = true}) +end + +function atributo_misc:ReportSingleDebuffUptimeLine (misc_actor, instance) + local report_table = {"Details!: " .. misc_actor.nome .. " - " .. Loc ["STRING_ATTRIBUTE_MISC_DEBUFF_UPTIME"]} local debuffs = {} - local combat_time = instancia.showing:GetCombatTime() + local combat_time = instance.showing:GetCombatTime() for spellid, spell in _pairs (misc_actor.debuff_uptime_spells._ActorTable) do - debuffs [#debuffs+1] = {spellid, spell.uptime, spell} + local percent = spell.uptime / combat_time * 100 + debuffs [#debuffs+1] = {spellid, {spell.uptime, percent}} end - _table_sort (debuffs, _detalhes.Sort2) - - for i, spell in _ipairs (debuffs) do - local spelllink = GetSpellLink (spell [1]) - local m, s = _math_floor (spell [2] / 60), _math_floor (spell [2] % 60) - - reportar [#reportar+1] = spelllink .. ": " .. m .. "m " .. s .. "s (" .. _cstr ("%.1f", spell [2] / combat_time * 100) .. "%)" - end - - return _detalhes:Reportar (reportar, {_no_current = true, _no_inverse = true, _custom = true}) + _table_sort (debuffs, sort_buff_report) + _detalhes:FormatReportLines (report_table, debuffs, buff_format_name, buff_format_amount) + return _detalhes:Reportar (report_table, {_no_current = true, _no_inverse = true, _custom = true}) end function atributo_misc:DeadAtualizarBarra (morte, qual_barra, colocacao, instancia) @@ -1003,7 +1004,7 @@ function atributo_misc:RefreshBarra (esta_barra, instancia, from_resize) if (self.enemy) then if (self.arena_enemy) then if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName) end @@ -1011,13 +1012,13 @@ function atributo_misc:RefreshBarra (esta_barra, instancia, from_resize) else if (_detalhes.faction_against == "Horde") then if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"..self.displayName) --seta o texto da esqueda -- HORDA end else if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"..self.displayName) --seta o texto da esqueda -- ALLY end @@ -1030,13 +1031,13 @@ function atributo_misc:RefreshBarra (esta_barra, instancia, from_resize) else if (self.arena_ally) then if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName) end else if (UsingCustomLeftText) then - esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "")) + esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "", self, instancia.showing)) else esta_barra.texto_esquerdo:SetText (bar_number .. self.displayName) --seta o texto da esqueda end @@ -1168,9 +1169,7 @@ function atributo_misc:ToolTipDispell (instancia, numero, barra) end _table_sort (meus_dispells, _detalhes.Sort2) - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, r, g, b, #meus_dispells) - - GameCooltip:AddIcon ([[Interface\ICONS\Spell_Arcane_ArcaneTorrent]], 1, 1, 14, 14, 0.078125, 0.9375, 0.078125, 0.953125) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, #meus_dispells, [[Interface\ICONS\Spell_Arcane_ArcaneTorrent]], 0.078125, 0.9375, 0.078125, 0.953125) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) local icon_size = _detalhes.tooltip.icon_size @@ -1195,9 +1194,7 @@ function atributo_misc:ToolTipDispell (instancia, numero, barra) end _table_sort (buffs_dispelados, _detalhes.Sort2) - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_DISPELLED"], headerColor, r, g, b, #buffs_dispelados) - - GameCooltip:AddIcon ([[Interface\ICONS\Spell_Arcane_ManaTap]], 1, 1, 14, 14, 0.078125, 0.9375, 0.078125, 0.953125) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_DISPELLED"], headerColor, #buffs_dispelados, [[Interface\ICONS\Spell_Arcane_ManaTap]], 0.078125, 0.9375, 0.078125, 0.953125) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) if (#buffs_dispelados > 0) then @@ -1218,8 +1215,7 @@ function atributo_misc:ToolTipDispell (instancia, numero, barra) end _table_sort (alvos_dispelados, _detalhes.Sort2) - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_TARGETS"], headerColor, r, g, b, #alvos_dispelados) - GameCooltip:AddIcon ([[Interface\ICONS\ACHIEVEMENT_GUILDPERK_EVERYONES A HERO_RANK2]], 1, 1, 14, 14, 0.078125, 0.9375, 0.078125, 0.953125) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_TARGETS"], headerColor, #alvos_dispelados, [[Interface\ICONS\ACHIEVEMENT_GUILDPERK_EVERYONES A HERO_RANK2]], 0.078125, 0.9375, 0.078125, 0.953125) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) for i = 1, _math_min (25, #alvos_dispelados) do @@ -1284,8 +1280,7 @@ function atributo_misc:ToolTipDispell (instancia, numero, barra) if (not added_logo) then added_logo = true - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_PETS"], headerColor, r, g, b, #totais) - GameCooltip:AddIcon ([[Interface\COMMON\friendship-heart]], 1, 1, 14, 14, 0.21875, 0.78125, 0.09375, 0.6875) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_PETS"], headerColor, #totais, [[Interface\COMMON\friendship-heart]], 0.21875, 0.78125, 0.09375, 0.6875) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) end @@ -1685,8 +1680,7 @@ function atributo_misc:ToolTipDebuffUptime (instancia, numero, barra) --_table_sort (debuffs_usados, Sort2Reverse) _table_sort (debuffs_usados, _detalhes.Sort2) - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, r, g, b, #debuffs_usados) - GameCooltip:AddIcon ([[Interface\ICONS\Ability_Warrior_Safeguard]], 1, 1, 14, 14, 0.9375, 0.078125, 0.078125, 0.953125) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, #debuffs_usados, [[Interface\ICONS\Ability_Warrior_Safeguard]], 0.9375, 0.078125, 0.078125, 0.953125) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) local icon_size = _detalhes.tooltip.icon_size @@ -1745,8 +1739,7 @@ function atributo_misc:ToolTipBuffUptime (instancia, numero, barra) --_table_sort (buffs_usados, Sort2Reverse) _table_sort (buffs_usados, _detalhes.Sort2) - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, r, g, b, #buffs_usados) - GameCooltip:AddIcon ([[Interface\ICONS\Ability_Warrior_Safeguard]], 1, 1, 14, 14, 0.9375, 0.078125, 0.078125, 0.953125) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, #buffs_usados, [[Interface\ICONS\Ability_Warrior_Safeguard]], 0.9375, 0.078125, 0.078125, 0.953125) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) local icon_size = _detalhes.tooltip.icon_size @@ -1804,8 +1797,7 @@ function atributo_misc:ToolTipDefensiveCooldowns (instancia, numero, barra) end _table_sort (cooldowns_usados, _detalhes.Sort2) - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, r, g, b, #cooldowns_usados) - GameCooltip:AddIcon ([[Interface\ICONS\Ability_Warrior_Safeguard]], 1, 1, 14, 14, 0.9375, 0.078125, 0.078125, 0.953125) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, #cooldowns_usados, [[Interface\ICONS\Ability_Warrior_Safeguard]], 0.9375, 0.078125, 0.078125, 0.953125) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) local icon_size = _detalhes.tooltip.icon_size @@ -1832,8 +1824,7 @@ function atributo_misc:ToolTipDefensiveCooldowns (instancia, numero, barra) end _table_sort (alvos, _detalhes.Sort2) - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_TARGETS"], headerColor, r, g, b, #alvos) - GameCooltip:AddIcon ([[Interface\ICONS\Ability_Warrior_DefensiveStance]], 1, 1, 14, 14, 0.9375, 0.125, 0.0625, 0.9375) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_TARGETS"], headerColor, #alvos, [[Interface\ICONS\Ability_Warrior_DefensiveStance]], 0.9375, 0.125, 0.0625, 0.9375) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) if (#alvos > 0) then @@ -1883,8 +1874,7 @@ function atributo_misc:ToolTipRess (instancia, numero, barra) end _table_sort (meus_ress, _detalhes.Sort2) - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, r, g, b, #meus_ress) - GameCooltip:AddIcon ([[Interface\ICONS\Ability_Paladin_BlessedMending]], 1, 1, 14, 14, 0.098125, 0.828125, 0.953125, 0.168125) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, #meus_ress, [[Interface\ICONS\Ability_Paladin_BlessedMending]], 0.098125, 0.828125, 0.953125, 0.168125) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) if (#meus_ress > 0) then @@ -1908,10 +1898,7 @@ function atributo_misc:ToolTipRess (instancia, numero, barra) end _table_sort (alvos, _detalhes.Sort2) - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_TARGETS"], headerColor, r, g, b, #alvos) - --GameCooltip:AddIcon ([[Interface\ICONS\Ability_DeathKnight_IcyGrip]], 1, 1, 14, 14, 0.9375, 0.078125, 0.953125, 0.078125) - - GameCooltip:AddIcon ([[Interface\ICONS\Ability_Priest_Cascade]], 1, 1, 14, 14, 0.9375, 0.0625, 0.0625, 0.9375) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_TARGETS"], headerColor, #alvos, [[Interface\ICONS\Ability_Priest_Cascade]], 0.9375, 0.0625, 0.0625, 0.9375) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) if (#alvos > 0) then @@ -1962,8 +1949,7 @@ function atributo_misc:ToolTipInterrupt (instancia, numero, barra) end _table_sort (meus_interrupts, _detalhes.Sort2) - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, r, g, b, #meus_interrupts) - GameCooltip:AddIcon ([[Interface\ICONS\Ability_Warrior_PunishingBlow]], 1, 1, 14, 14, 0.9375, 0.078125, 0.078125, 0.953125) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, #meus_interrupts, [[Interface\ICONS\Ability_Warrior_PunishingBlow]], 0.9375, 0.078125, 0.078125, 0.953125) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) if (#meus_interrupts > 0) then @@ -1986,8 +1972,7 @@ function atributo_misc:ToolTipInterrupt (instancia, numero, barra) end _table_sort (habilidades_interrompidas, _detalhes.Sort2) - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELL_INTERRUPTED"] .. ":", headerColor, r, g, b, #habilidades_interrompidas) - GameCooltip:AddIcon ([[Interface\ICONS\Ability_Warrior_Sunder]], 1, 1, 14, 14, 0.078125, 0.9375, 0.128125, 0.913125) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELL_INTERRUPTED"] .. ":", headerColor, #habilidades_interrompidas, [[Interface\ICONS\Ability_Warrior_Sunder]], 0.078125, 0.9375, 0.128125, 0.913125) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) if (#habilidades_interrompidas > 0) then @@ -2039,8 +2024,7 @@ function atributo_misc:ToolTipInterrupt (instancia, numero, barra) if (not added_logo) then added_logo = true - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_PETS"], headerColor, r, g, b, #totais) - GameCooltip:AddIcon ([[Interface\COMMON\friendship-heart]], 1, 1, 14, 14, 0.21875, 0.78125, 0.09375, 0.6875) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_PETS"], headerColor, #totais, [[Interface\COMMON\friendship-heart]], 0.21875, 0.78125, 0.09375, 0.6875) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) end diff --git a/core/control.lua b/core/control.lua index bfde37e7..26c0db3b 100644 --- a/core/control.lua +++ b/core/control.lua @@ -1106,6 +1106,11 @@ local backgroundColor = {0, 0, 0, 0.6} local avatarTextColor = {1, 1, 1, 1} + function _detalhes:AddTooltipReportLineText() + GameCooltip:AddLine (Loc ["STRING_CLICK_REPORT_LINE1"], Loc ["STRING_CLICK_REPORT_LINE2"]) + GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.4) + end + function _detalhes:AddTooltipBackgroundStatusbar (side) if (not side) then GameCooltip:AddStatusBar (100, 1, unpack (_detalhes.tooltip.background)) @@ -1118,20 +1123,15 @@ GameCooltip:AddStatusBar (100, 1, 1, 1, 1, a, nil, nil, [[Interface\WorldStateFrame\WORLDSTATEFINALSCORE-HIGHLIGHT]]) end - function _detalhes:AddTooltipSpellHeaderText (headerText, headerColor, r, g, b, amount, side) - if (not side) then - if (_detalhes.tooltip.show_amount) then - GameCooltip:AddLine (headerText, "x" .. amount .. "", nil, headerColor, r, g, b, .5, 10) - else - GameCooltip:AddLine (headerText, nil, nil, headerColor, nil, 12) - end + function _detalhes:AddTooltipSpellHeaderText (headerText, headerColor, amount, iconTexture, L, R, T, B) + if (_detalhes.tooltip.show_amount) then + GameCooltip:AddLine (headerText, "x" .. amount .. "", nil, headerColor, 1, 1, 1, .4, _detalhes.tooltip.fontsize_title) else - --> sub menu - if (_detalhes.tooltip.show_amount) then - GameCooltip:AddLine (headerText, "x" .. amount .. "", 2, headerColor, r, g, b, .5, 10) - else - GameCooltip:AddLine (headerText, nil, 2, headerColor, nil, 12) - end + GameCooltip:AddLine (headerText, nil, nil, headerColor, nil, _detalhes.tooltip.fontsize_title) + end + + if (iconTexture) then + GameCooltip:AddIcon (iconTexture, 1, 1, 14, 14, L or 0, R or 1, T or 0, B or 1) end end @@ -1181,6 +1181,8 @@ --verifica por tooltips especiais: if (objeto.dead) then --> é uma barra de dead return _detalhes:ToolTipDead (self, objeto, esta_barra, keydown) --> instância, [morte], barra + elseif (objeto.byspell) then + return _detalhes:ToolTipBySpell (self, objeto, esta_barra, keydown) elseif (objeto.frags) then return _detalhes:ToolTipFrags (self, objeto, esta_barra, keydown) elseif (objeto.boss_debuff) then @@ -1200,11 +1202,11 @@ GameCooltip:SetBannerText (1, (not _detalhes.ignore_nicktag and avatar [1]) or objeto.nome, textPoint, avatarTextColor, 14, SharedMedia:Fetch ("font", _detalhes.tooltip.fontface)) --> text [1] nickname end else - if (_detalhes.remove_realm_from_name and objeto.displayName:find ("%*")) then - GameCooltip:SetBannerImage (1, [[Interface\AddOns\Details\images\background]], 20, 30, avatarPoint, avatarTexCoord, {0, 0, 0, 0}) --> overlay [2] avatar path - GameCooltip:SetBannerImage (2, [[Interface\PetBattles\Weather-BurntEarth]], 160, 30, {{"bottomleft", "topleft", 0, -5}, {"bottomright", "topright", 0, -5}}, {0.12, 0.88, 1, 0}, {0, 0, 0, 0.1}) --> overlay [2] avatar path {0, 0, 0, 0} - GameCooltip:SetBannerText (1, objeto.nome, {"left", "left", 11, -8}, {1, 1, 1, 0.7}, 10, SharedMedia:Fetch ("font", _detalhes.tooltip.fontface)) --> text [1] nickname - end + --if (_detalhes.remove_realm_from_name and objeto.displayName:find ("%*")) then + -- GameCooltip:SetBannerImage (1, [[Interface\AddOns\Details\images\background]], 20, 30, avatarPoint, avatarTexCoord, {0, 0, 0, 0}) --> overlay [2] avatar path + -- GameCooltip:SetBannerImage (2, [[Interface\PetBattles\Weather-BurntEarth]], 160, 30, {{"bottomleft", "topleft", 0, -5}, {"bottomright", "topright", 0, -5}}, {0.12, 0.88, 1, 0}, {0, 0, 0, 0.1}) --> overlay [2] avatar path {0, 0, 0, 0} + -- GameCooltip:SetBannerText (1, objeto.nome, {"left", "left", 11, -8}, {1, 1, 1, 0.7}, 10, SharedMedia:Fetch ("font", _detalhes.tooltip.fontface)) --> text [1] nickname + --end end end diff --git a/core/meta.lua b/core/meta.lua index 1e616107..491ef933 100644 --- a/core/meta.lua +++ b/core/meta.lua @@ -79,7 +79,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/windows.lua b/core/windows.lua index 90e4f1bf..8198d88f 100644 --- a/core/windows.lua +++ b/core/windows.lua @@ -1259,6 +1259,7 @@ 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 diff --git a/functions/attributes.lua b/functions/attributes.lua index 50b8c8f2..eca1923d 100644 --- a/functions/attributes.lua +++ b/functions/attributes.lua @@ -14,6 +14,7 @@ do --[[global]] DETAILS_SUBATTRIBUTE_FRAGS = 5 --[[global]] DETAILS_SUBATTRIBUTE_ENEMIES = 6 --[[global]] DETAILS_SUBATTRIBUTE_VOIDZONES = 7 + --[[global]] DETAILS_SUBATTRIBUTE_BYSPELLS = 8 --[[global]] DETAILS_ATTRIBUTE_HEAL = 2 @@ -51,6 +52,7 @@ do "miscdata", --frags "damage", --enemy damage "aura", --auras + "damage", --damage taken by spell "heal", --healing done "heal", --hps @@ -83,7 +85,7 @@ do --[[ DAMAGE ]] dano = 1, --> identifier - [1] = 7, --> sub attributes + [1] = 8, --> sub attributes --[[ HEALING ]] cura = 2, --> identifier @@ -123,6 +125,7 @@ do frags = 5, enemies = 6, voidzones = 7, + damage_taken_by_spells = 8, lista = { --[[ String Names ]] Loc ["STRING_ATTRIBUTE_DAMAGE_DONE"], Loc ["STRING_ATTRIBUTE_DAMAGE_DPS"], @@ -131,6 +134,7 @@ do Loc ["STRING_ATTRIBUTE_DAMAGE_FRAGS"], Loc ["STRING_ATTRIBUTE_DAMAGE_ENEMIES"], Loc ["STRING_ATTRIBUTE_DAMAGE_DEBUFFS"], + Loc ["STRING_ATTRIBUTE_DAMAGE_BYSPELL"], }, icones = { {"Interface\\AddOns\\Details\\images\\atributos_icones_damage", {0, .125, 0, 1}}, @@ -139,9 +143,10 @@ do {"Interface\\AddOns\\Details\\images\\atributos_icones_damage", {.375, .5, 0, 1}}, {"Interface\\AddOns\\Details\\images\\atributos_icones_damage", {.5, 0.625, 0, 1}}, {"Interface\\AddOns\\Details\\images\\atributos_icones_damage", {0.625, .75, 0, 1}}, - {"Interface\\AddOns\\Details\\images\\atributos_icones_damage", {.75, 0.875, 0, 1}} + {"Interface\\AddOns\\Details\\images\\atributos_icones_damage", {.75, 0.875, 0, 1}}, + {"Interface\\AddOns\\Details\\images\\atributos_icones_damage", {0.875, 1, 0, 1}}, }, - internal = {"total", "last_dps", "damage_taken", "friendlyfire_total", "frags", "enemies", "voidzones"} + internal = {"total", "last_dps", "damage_taken", "friendlyfire_total", "frags", "enemies", "voidzones", "damage_taken_by_spells"} }, { diff --git a/functions/profiles.lua b/functions/profiles.lua index 7f3c0941..2e7fafd1 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -955,7 +955,8 @@ local default_profile = { --> tooltip tooltip = { fontface = "Friz Quadrata TT", - fontsize = 10, + fontsize = 10, + fontsize_title = 10, fontcolor = {1, 1, 1, 1}, fontcolor_right = {1, 0.7, 0, 1}, --{1, 0.9254, 0.6078, 1} fontshadow = false, diff --git a/functions/spells.lua b/functions/spells.lua index 0d408a3e..72ce67e5 100644 --- a/functions/spells.lua +++ b/functions/spells.lua @@ -2704,7 +2704,10 @@ do function _detalhes:GetSpellSchoolFormatedName (school) return _detalhes.spells_school [school] and _detalhes.spells_school [school].formated or "" end - + local default_school_color = {145/255, 180/255, 228/255} + function _detalhes:GetSpellSchoolColor (school) + return unpack (_detalhes.spells_school [school] and _detalhes.spells_school [school].decimals or default_school_color) + end function _detalhes:GetCooldownList (class) class = class or select (2, UnitClass ("player")) return _detalhes.DefensiveCooldownSpells [class] diff --git a/gumps/janela_custom.lua b/gumps/janela_custom.lua index 237a5ece..583284bb 100644 --- a/gumps/janela_custom.lua +++ b/gumps/janela_custom.lua @@ -1535,7 +1535,7 @@ gump:GradientEffect (button:GetParent(), "frame", _r, _g, _b, _a, OnEnterColors[1], OnEnterColors[2], OnEnterColors[3], OnEnterColors[4], .3) GameTooltip:SetOwner (button, "ANCHOR_TOPLEFT") - GameTooltip:SetSpellByID (button.MyObject.spellid) + _detalhes:GameTooltipSetSpellByID (button.MyObject.spellid) GameTooltip:Show() end local buttonMouseOut = function (button) diff --git a/gumps/janela_info.lua b/gumps/janela_info.lua index 048deea9..ba61267d 100644 --- a/gumps/janela_info.lua +++ b/gumps/janela_info.lua @@ -27,7 +27,7 @@ local classe_icones = _G.CLASS_ICON_TCOORDS --self = instancia --jogador = classe_damage ou classe_heal -function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh) +function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDown, ControlKeyDown) --print (debugstack()) @@ -39,7 +39,7 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh) _detalhes:FechaJanelaInfo() return end - return _detalhes.row_singleclick_overwrite [self.atributo][self.sub_atributo] (_, jogador, self) + return _detalhes.row_singleclick_overwrite [self.atributo][self.sub_atributo] (_, jogador, self, ShiftKeyDown, ControlKeyDown) end if (self.modo == _detalhes._detalhes_props["MODO_RAID"]) then @@ -1711,7 +1711,7 @@ function gump:CriaJanelaInfo() self:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 512, edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", edgeSize = 8}) self:SetBackdropColor (.5, .5, .5, .5) GameTooltip:SetOwner (self, "ANCHOR_TOPLEFT") - GameTooltip:SetSpellByID (self.spellid) + _detalhes:GameTooltipSetSpellByID (self.spellid) GameTooltip:Show() end end @@ -4259,10 +4259,10 @@ end local miniframe_func_on_enter = function (self) local barra = self:GetParent() if (barra.show and type (barra.show) == "number") then - local spellname = GetSpellInfo (barra.show) + local spellname = _GetSpellInfo (barra.show) if (spellname) then GameTooltip:SetOwner (self, "ANCHOR_TOPLEFT") - GameTooltip:SetSpellByID (barra.show) + _detalhes:GameTooltipSetSpellByID (barra.show) GameTooltip:Show() end end diff --git a/gumps/janela_principal.lua b/gumps/janela_principal.lua index 15c2c2da..23d46ed2 100644 --- a/gumps/janela_principal.lua +++ b/gumps/janela_principal.lua @@ -1823,11 +1823,6 @@ local shift_monitor = function (self) end end -local on_switch_show = function (instance) - instance:TrocaTabela (instance, true, 1, 6) - return true -end - local barra_backdrop_onenter = { bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tile = true, tileSize = 16, @@ -1917,44 +1912,6 @@ local barra_scripts_onmousedown = function (self, button) elseif (button == "LeftButton") then - if (self._instance.atributo == 1 and self._instance.sub_atributo == 6) then --> enemies - - local inimigo = self.minha_tabela.nome - local custom_name = inimigo .. Loc ["STRING_CUSTOM_ENEMY_DT"] - - --> procura se já tem um custom: - for index, CustomObject in _ipairs (_detalhes.custom) do - if (CustomObject:GetName() == custom_name) then - --> fix for not saving funcs on logout - if (not CustomObject.OnSwitchShow) then - CustomObject.OnSwitchShow = on_switch_show - end - return self._instance:TrocaTabela (self._instance.segmento, 5, index) - end - end - - --> criar um custom para este actor. - local new_custom_object = { - name = custom_name, - icon = [[Interface\ICONS\Pet_Type_Undead]], - attribute = "damagedone", - author = _detalhes.playername, - desc = inimigo .. " Damage Taken", - source = "[raid]", - target = inimigo, - script = false, - tooltip = false, - temp = true, - OnSwitchShow = on_switch_show, - } - - tinsert (_detalhes.custom, new_custom_object) - setmetatable (new_custom_object, _detalhes.atributo_custom) - new_custom_object.__index = _detalhes.atributo_custom - - return self._instance:TrocaTabela (self._instance.segmento, 5, #_detalhes.custom) - - end end self.texto_direita:SetPoint ("right", self.statusbar, "right", 1, -1) @@ -1977,6 +1934,10 @@ local barra_scripts_onmousedown = function (self, button) end local barra_scripts_onmouseup = function (self, button) + + local is_shift_down = _IsShiftKeyDown() + local is_control_down = _IsControlKeyDown() + if (self._instance.baseframe.isMoving) then move_janela (self._instance.baseframe, false, self._instance) self._instance:SaveMainWindowPosition() @@ -1999,31 +1960,30 @@ local barra_scripts_onmouseup = function (self, button) if (self.mouse_down and (self.mouse_down+0.4 > _GetTime() and (x == self.x and y == self.y)) or (x == self.x and y == self.y)) then if (self.button == "LeftButton" or self.button == "MiddleButton") then - if (self._instance.atributo == 5 or _IsShiftKeyDown()) then + if (self._instance.atributo == 5 or is_shift_down) then --> report - if (self._instance.atributo == 5 and _IsShiftKeyDown()) then + if (self._instance.atributo == 5 and is_shift_down) then local custom = self._instance:GetCustomObject() if (custom and custom.on_shift_click) then local func = loadstring (custom.on_shift_click) if (func) then - local successful, errortext = pcall (func, self, self.minha_tabela, self._instance) if (not successful) then _detalhes:Msg ("error occurred custom script shift+click:", errortext) end - - --local spellname, _, spellicon = _detalhes.getspellinfo (self.minha_tabela.id) - --_detalhes:OpenAuraPanel (self.minha_tabela.id, spellname, spellicon) - - --func (object.id, spellname, spellicon) - return end end end + + if (_detalhes.row_singleclick_overwrite [self._instance.atributo] and type (_detalhes.row_singleclick_overwrite [self._instance.atributo][self._instance.sub_atributo]) == "function") then + return _detalhes.row_singleclick_overwrite [self._instance.atributo][self._instance.sub_atributo] (_, self.minha_tabela, self._instance, is_shift_down, is_control_down) + end + return _detalhes:ReportSingleLine (self._instance, self) end - self._instance:AbreJanelaInfo (self.minha_tabela) + + self._instance:AbreJanelaInfo (self.minha_tabela, nil, nil, is_shift_down, is_control_down) end end end @@ -2058,14 +2018,14 @@ local icon_frame_on_enter = function (self) local actor = self.row.minha_tabela if (actor) then - if (actor.is_custom) then - if (actor.id) then + if (actor.frags) then + + + elseif (actor.is_custom or actor.byspell or actor.damage_spellid) then + local spellid = actor.damage_spellid or actor.id or actor[1] + if (spellid) then GameTooltip:SetOwner (self, "ANCHOR_TOPLEFT", 0, 10) - if (actor.id == 1) then - GameTooltip:SetSpellByID (6603) - else - GameTooltip:SetSpellByID (actor.id) - end + _detalhes:GameTooltipSetSpellByID (spellid) GameTooltip:Show() end @@ -2280,6 +2240,7 @@ local icon_frame_on_click_up = function (self) _detalhes:Msg (Loc ["STRING_QUERY_INSPECT_FAIL1"]) return end + if (self.showing == "actor") then if (_detalhes.ilevel.core:HasQueuedInspec (self.unitname)) then @@ -2388,22 +2349,28 @@ function _detalhes:ReportSingleLine (instancia, barra) local reportar if (instancia.atributo == 5) then --> custom - local actor_name = barra.texto_esquerdo:GetText() or "" - actor_name = actor_name:gsub ((".*%."), "") - - if (instancia.segmento == -1) then --overall - reportar = {"Details!: " .. Loc ["STRING_OVERALL"] .. " " .. instancia.customName .. ": " .. actor_name .. " " .. Loc ["STRING_CUSTOM_REPORT"]} - else - reportar = {"Details!: " .. instancia.customName .. ": " .. actor_name .. " " .. Loc ["STRING_CUSTOM_REPORT"]} - end - --> dump cooltip local GameCooltip = GameCooltip + if (GameCoolTipFrame1:IsShown()) then + local actor_name = barra.texto_esquerdo:GetText() or "" + actor_name = actor_name:gsub ((".*%."), "") + + if (instancia.segmento == -1) then --overall + reportar = {"Details!: " .. Loc ["STRING_OVERALL"] .. " " .. instancia.customName .. ": " .. actor_name .. " " .. Loc ["STRING_CUSTOM_REPORT"]} + else + reportar = {"Details!: " .. instancia.customName .. ": " .. actor_name .. " " .. Loc ["STRING_CUSTOM_REPORT"]} + end - local amt = GameCooltip.Indexes - for i = 2, amt do - local left_text, right_text = GameCooltip:GetText (i) - reportar [#reportar+1] = (i-1) .. ". " .. left_text .. " ... " .. right_text + local amt = GameCooltip.Indexes + for i = 2, amt do + local left_text, right_text = GameCooltip:GetText (i) + reportar [#reportar+1] = (i-1) .. ". " .. left_text .. " ... " .. right_text + end + else + reportar = {"Details!: " .. instancia.customName .. ": " .. Loc ["STRING_CUSTOM_REPORT"]} + reportar [#reportar+1] = barra.texto_esquerdo:GetText() .. " " .. barra.texto_direita:GetText() + + --reportar [#reportar+1] = (i-1) .. ". " .. left_text .. " ... " .. right_text end else diff --git a/gumps/janela_report.lua b/gumps/janela_report.lua index 2c215dde..a8ea6c94 100644 --- a/gumps/janela_report.lua +++ b/gumps/janela_report.lua @@ -631,7 +631,7 @@ local function cria_drop_down (este_gump) for i = 1, 9 do --window.max_last_buttons local b = window.recently_report_buttons [i] - b:SetSize (120, 16) + b:SetSize (150, 16) b:SetPoint ("topleft", window, "topleft", 10, -12 + (i*17*-1)) b:Show() b:SetBackdrop ({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16, @@ -653,12 +653,9 @@ local function cria_drop_down (este_gump) local b = window.recently_report_buttons [10] b:Hide() - Details_Report_CB_1:Hide() - Details_Report_CB_2:Hide() - window.dropdown:ClearAllPoints() window.dropdown:SetWidth (155) - window.dropdown:SetPoint ("topleft", window, "topleft", 160, -30) + window.dropdown:SetPoint ("topleft", window, "topleft", 175, -30) window.dropdown:SetBackdrop ({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]], edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, tile=true, tileSize = 64, insets = {left = 0, right = 0, top = 0, bottom = 0}}) window.dropdown:SetBackdropBorderColor (0, 0, 0, 0.5) @@ -666,7 +663,7 @@ local function cria_drop_down (este_gump) window.wisp_who:ClearAllPoints() window.editbox:ClearAllPoints() - window.wisp_who:SetPoint ("topleft", window.dropdown.widget, "bottomleft", 0, -11) + window.wisp_who:SetPoint ("topleft", window.dropdown.widget, "bottomleft", 0, -10) window.editbox:SetPoint ("topleft", window.wisp_who, "bottomleft", 0, -3) window.editbox:SetWidth (155) window.editbox:SetHeight (20) @@ -676,7 +673,7 @@ local function cria_drop_down (este_gump) window.editbox:SetBackdropColor (0, 0, 0, 0.3) window.linhas_amt:ClearAllPoints() - window.linhas_amt:SetPoint ("topleft", window.editbox, "bottomleft", 0, -11) + window.linhas_amt:SetPoint ("topleft", window.editbox, "bottomleft", 0, -10) window.slider:ClearAllPoints() window.slider:SetWidth (155) window.slider:SetPoint ("topleft", window.linhas_amt, "bottomleft", 0, -3) @@ -690,8 +687,24 @@ local function cria_drop_down (este_gump) window.slider.thumb:SetSize (16, 16) window.slider.thumb:SetVertexColor (0.6, 0.6, 0.6, 0.95) + Details_Report_CB_1:Hide() + local reverse_checkbox = Details_Report_CB_2 + reverse_checkbox:Show() + reverse_checkbox:ClearAllPoints() + reverse_checkbox:SetBackdrop ({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]], edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, tile=true, + tileSize = 64, insets = {left = 0, right = 0, top = 0, bottom = 0}}) + reverse_checkbox:SetBackdropBorderColor (0, 0, 0, 0.5) + reverse_checkbox:SetBackdropColor (0, 0, 0, 0.3) + reverse_checkbox:SetPoint ("topleft", window.slider, "bottomleft", 0, -8) + reverse_checkbox:SetSize (14, 14) + reverse_checkbox:SetNormalTexture (nil) + reverse_checkbox:SetPushedTexture (nil) + reverse_checkbox:SetHighlightTexture (nil) + _G [reverse_checkbox:GetName().."Text"]:ClearAllPoints() + _G [reverse_checkbox:GetName().."Text"]:SetPoint ("left", reverse_checkbox, "right", 2, 0) + window.enviar:ClearAllPoints() - window.enviar:SetPoint ("topleft", window.slider, "bottomleft", 0, -15) + window.enviar:SetPoint ("topleft", reverse_checkbox, "bottomleft", 0, -8) window.enviar:SetBackdrop ({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]], edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, tile=true, tileSize = 64, insets = {left = 0, right = 0, top = 0, bottom = 0}}) window.enviar:SetBackdropBorderColor (0, 0, 0, 0.5) @@ -762,7 +775,7 @@ local function cria_drop_down (este_gump) for i = 1, 9 do --window.max_last_buttons local b = window.recently_report_buttons [i] - b:SetSize (120, 16) + b:SetSize (150, 16) b:SetPoint ("topleft", window, "topleft", 10, -50 + (i*17*-1)) b:Show() b:SetBackdrop ({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16, @@ -783,12 +796,11 @@ local function cria_drop_down (este_gump) window.dropdown:ClearAllPoints() window.dropdown:SetWidth (145) - window.dropdown:SetPoint ("topleft", window, "topleft", 160, -68) - + window.dropdown:SetPoint ("topleft", window, "topleft", 175, -68) window.wisp_who:ClearAllPoints() window.editbox:ClearAllPoints() - window.wisp_who:SetPoint ("topleft", window.dropdown.widget, "bottomleft", 0, -11) + window.wisp_who:SetPoint ("topleft", window.dropdown.widget, "bottomleft", 0, -10) window.editbox:SetPoint ("topleft", window.wisp_who, "bottomleft", 0, -3) window.editbox:SetWidth (145) window.editbox:SetHeight (20) @@ -796,7 +808,7 @@ local function cria_drop_down (este_gump) edgeSize = 15, tileSize = 64, insets = {left = 3, right = 3, top = 4, bottom = 4}}) window.linhas_amt:ClearAllPoints() - window.linhas_amt:SetPoint ("topleft", window.editbox, "bottomleft", 0, -11) + window.linhas_amt:SetPoint ("topleft", window.editbox, "bottomleft", 0, -7) window.slider:ClearAllPoints() window.slider :SetWidth (145) window.slider:SetPoint ("topleft", window.linhas_amt, "bottomleft", 0, -3) @@ -807,8 +819,21 @@ local function cria_drop_down (este_gump) window.slider.thumb:SetSize (30, 24) window.slider.thumb:SetAlpha (0.7) + Details_Report_CB_1:Hide() + local reverse_checkbox = Details_Report_CB_2 + reverse_checkbox:Show() + reverse_checkbox:ClearAllPoints() + reverse_checkbox:SetBackdrop (nil) + reverse_checkbox:SetPoint ("topleft", window.slider, "bottomleft", -1, -4) + reverse_checkbox:SetSize (26, 26) + reverse_checkbox:SetNormalTexture ([[Interface\Buttons\UI-CheckBox-Up]]) + reverse_checkbox:SetPushedTexture ([[Interface\Buttons\UI-CheckBox-Down]]) + reverse_checkbox:SetHighlightTexture ([[Interface\Buttons\UI-CheckBox-Highlight]]) + _G [reverse_checkbox:GetName().."Text"]:ClearAllPoints() + _G [reverse_checkbox:GetName().."Text"]:SetPoint ("left", reverse_checkbox, "right", 2, 0) + window.enviar:ClearAllPoints() - window.enviar:SetPoint ("topleft", window.slider, "bottomleft", 0, -11) + window.enviar:SetPoint ("topleft", reverse_checkbox, "bottomleft", 0, -4) window.enviar.Left:Show() window.enviar.Middle:Show() window.enviar.Right:Show() diff --git a/gumps/switch.lua b/gumps/switch.lua index d41e22af..e55ef55e 100644 --- a/gumps/switch.lua +++ b/gumps/switch.lua @@ -699,7 +699,11 @@ function _detalhes.switch:OnRemoveCustom (CustomIndex) --> precisa resetar esse aqui options.atributo = nil options.sub_atributo = nil - _detalhes.switch:Update() + + --update if already shown once at least + if (_detalhes.switch.vertical_amt) then + _detalhes.switch:Update() + end end end end diff --git a/images/atributos_icones_damage.tga b/images/atributos_icones_damage.tga index 692e982c..3eead2c0 100644 Binary files a/images/atributos_icones_damage.tga and b/images/atributos_icones_damage.tga differ diff --git a/locales/Details-itIT.lua b/locales/Details-itIT.lua new file mode 100644 index 00000000..ad0282d4 --- /dev/null +++ b/locales/Details-itIT.lua @@ -0,0 +1,4 @@ +local L = LibStub("AceLocale-3.0"):NewLocale("Details", "itIT") +if not L then return end + +@localization(locale="itIT", format="lua_additive_table")@ diff --git a/startup.lua b/startup.lua index 2bbe96c2..03e9891c 100644 --- a/startup.lua +++ b/startup.lua @@ -52,7 +52,7 @@ function _G._detalhes:Start() --> single click row function replace --damage, dps, damage taken, friendly fire - self.row_singleclick_overwrite [1] = {true, true, true, true, self.atributo_damage.ReportSingleFragsLine, true, self.atributo_damage.ReportSingleVoidZoneLine} + self.row_singleclick_overwrite [1] = {true, true, true, true, self.atributo_damage.ReportSingleFragsLine, self.atributo_damage.ReportEnemyDamageTaken, self.atributo_damage.ReportSingleVoidZoneLine, self.atributo_damage.ReportSingleDTBSLine} --healing, hps, overheal, healing taken self.row_singleclick_overwrite [2] = {true, true, true, true, false, self.atributo_heal.ReportSingleDamagePreventedLine} --mana, rage, energy, runepower @@ -354,7 +354,32 @@ function _G._detalhes:Start() _detalhes:FillUserCustomSpells() _detalhes:AddDefaultCustomDisplays() - --> tooltip background color update + --> erase the custom for damage taken by spell + if (_detalhes_database.last_realversion and _detalhes_database.last_realversion < 73 and enable_reset_warning) then + + local secure_func = function() + for i = #_detalhes.custom, 1, -1 do + local index = i + local CustomObject = _detalhes.custom [index] + + if (CustomObject:GetName() == Loc ["STRING_CUSTOM_DTBS"]) then + for o = 1, _detalhes.switch.slots do + local options = _detalhes.switch.table [o] + if (options and options.atributo == 5 and options.sub_atributo == index) then + options.atributo = 1 + options.sub_atributo = 8 + _detalhes.switch:Update() + end + end + + _detalhes.atributo_custom:RemoveCustom (index) + end + end + end + pcall (secure_func) + + end + if (_detalhes_database.last_realversion and _detalhes_database.last_realversion < 70 and enable_reset_warning) then local bg = _detalhes.tooltip.background bg [1] = 0.1960