diff --git a/boot.lua b/boot.lua index 616e75d9..ae81e616 100644 --- a/boot.lua +++ b/boot.lua @@ -3,9 +3,9 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.build_counter = 56 --it's 56 for release - _detalhes.userversion = "v1.24.5" - _detalhes.realversion = 27 + _detalhes.build_counter = 69 --it's 69 for release + _detalhes.userversion = "v1.25.0" + _detalhes.realversion = 28 _detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -18,12 +18,10 @@ do local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) --[[ -|cFFFFFF00v1.24.5 (|cFFFFCC00Ago 31, 2014|r|cFFFFFF00)|r:\n\n -|cFFFFFF00-|r .\n\n + --]] - - Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v1.24.5 (|cFFFFCC00Ago 31, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added Raid Tools bracket on Options Panel.\n\n|cFFFFFF00-|r Added interrupt, cooldown and death announcers (raid tools).\n\n|cFFFFFF00-|r Added pre potion recognition, showing after the encounter on the chat only for you (raid tools).\n\n|cFFFFFF00-|r Added a Boss Emotes tab for Encounter Details plugin |cFF999999(thanks Bloodforce-Azralon)|r.\n\n|cFFFFFF00-|r Rework on Activity Time, now it is tuned to closely match warcraftlogs |cFF999999(thanks www.warcraftlogs.com)|r.\n\n|cFFFFFF00-|r Added two new customs: Damage Activity Time and Healing Activity Time.\n\n|cFFFFFF00-|r Time Attack Plugin now have six fixed time amount options for test your dps on training dummies.\n\n|cFFFFFF00-|r Time Attack Plugin can now also share results on your realm, between players with the same class.\n\n|cFFFFFF00v1.23.6 (|cFFFFCC00Ago 24, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added 2 new bar textures and 6 new fonts.\n\n|cFFFFFF00-|r Swapped left and middle button for enemy bars, now left button open damage taken and middle button player detail window.\n\n|cFFFFFF00-|r Added new skin: Minimalistic v2.\n\n|cFFFFFF00-|r Minimalistic v2 is now the default skin.\n\n|cFFFFFF00-|r Few changes on both icon packs with transparency.\n\n|cFFFFFF00-|r Replaced the slash command '/d' with '/de' |cFF999999(thanks @kamuul-mmochampion forum)|r.\n\n|cFFFFFF00-|r Added custom spells for Atonement, Power Word: Solance and Life Bloom |cFF999999(thanks @skmzarn-mmochampion forum)|r.\n\n|cFFFFFF00v1.22.4 (|cFFFFCC00Ago 15, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added new skin: ElvUI Frame Style (Black White).\n\n|cFFFFFF00-|r Align With Right Chat Window option now check if the window have statusbar enabled.\n\n|cFFFFFF00-|r Few improvements on report for Deaths and Spells over Player Detail Window.\n\n|cFFFFFF00-|r Added option to disable reset button (reset only using its tooltip menu).\n\n|cFFFFFF00-|r Added option for disable window groups.\n\n|cFFFFFF00-|r Added option for select the icon pack to use, also added black white icon pack.\n\n|cFFFFFF00-|r Fixed many bugs involving skins and profiles, thing should run more smooth now.\n\n|cFFFFFF00-|r Plugin Time Attack now correctly saves the attempt when pressing the big save button.\n\n|cFFFFFF00-|r Added support for hotcorners.\n\n|cFFFFFF00v1.21.4 (|cFFFFCC00Ago 9, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added Shaman's Ancestral Guidance on cooldowns list |cFF999999(thanks @skmzarn-mmochampion forum)|r.\n\n|cFFFFFF00-|r Added a profile selection screen when Details! are running for the first time on a character.\n\n|cFFFFFF00-|r Added Menu Text Size option over miscellaneous section on options panel |cFF999999(thanks @ Revi-mmochampion forum)|r.\n\n|cFFFFFF00-|r Fixed a bug over Healing Player Details Window where pets wasn't being shown |cFF999999(thanks @Mystery2012-mmochampion forum)|r.\n\n|cFFFFFF00-|r Fixed issue with summoning pets with unknown owners where it was breaking the summon of all the others pets. |cFF999999(thanks @ThunderLost-curse website)|r.\n\n|cFFFFFF00-|r Hot Corners isn't no more a part of Details!, instead of that, Hot Corner is now a standalone addon which needs to be installed separately for who wants to use it.\n\n|cFFFFFF00-|r Skin data is now stored inside the profiles, many code parts got rewrite, still may have few bugs but it's more reliable then before.\n\n|cFFFFFF00-|r Rework on Auras and Voidzones: now shows damage, dps and percentage. Also its tooltip got fixes and now shows the correct damage done to players.\n\n|cFFFFFF00-|r Tooltip for Enemies now shows damage taken from players |cFF999999(thanks @Arieth-mmochampion forum)|r.\n\n|cFFFFFF00-|r Right clicking a real-time enemy bar, makes it back to Enemies display instead of show Bookmark panel |cFF999999(thanks @Arieth-mmochampion forum)|r.\n\n|cFFFFFF00-|r Tank comparison from previous segment now uses the same percentage method from player comparison panel.\n\n|cFFFFFF00-|r Fix bug with the slash command 'show' where was ignoring the window limit set on options panel |cFF999999(thanks @Castiel-US-Azralon realm)|r.\n\n|cFFFFFF00-|r Fixed few bugs with scroll bars, including scrolls on dropdown menu and player detail window |cFF999999(thanks @Revi-mmochampion forum)|r.\n\n|cFFFFFF00v1.20.2 (|cFFFFCC00Aug 1, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added a option under Miscellaneous section to provide spell link instead of spell name for helpful spells when reporting a death |cFF999999(thanks @skmzarn-mmochampion forum)|r.\n\n|cFFFFFF00-|r Improvements done on how deaths are handled, now latest events before death will be more precise.\n\n|cFFFFFF00-|r Implemented Damage Taken from environment like lava, gravity, etc.\n\n|cFFFFFF00-|r Added Warlock's Fire and Brimstone spell on customized spells.\n\n|cFFFFFF00-|r Added dwarf racial Stone Form on cooldown list |cFF999999(thanks @Mystery2012-mmochampion forum)|r.\n\n|cFFFFFF00-|r Bookmark now are shared between all characters.\n\n|cFFFFFF00-|r Fixed few inconsistencies with trash recognition.\n\n|cFFFFFF00-|r Fixed Cloud Capture where sometimes it wasn't sharing.\n\n|cFFFFFF00-|r Fixed report where it wasn't sharing for guild and raid when the player name box were empty.\n\n|cFFFFFF00-|r Report box now also saves the position and the last channel used to report |cFF999999(thanks @skmzarn-mmochampion forum)|r.\n\n|cFFFFFF00-|r You Are Not Prepared plugin now have tooltips for spells and its window auto opens after a boss encounter.\n\n|cFFFFFF00-|r Advanced Death Logs plugin got full rewrite (and still are in development).\n\n|cFFFFFF00v1.19.0 - v1.19.1 - v1.19.2 (|cFFFFCC00Jul 21, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Details! is now able to be translated by its community for all supported languages through Curse Forge Web Site:\n\n|cFFFFFF00http://wow.curseforge.com/addons/details/localization/|r\n\n|cFFFFFF00-|r Slash commands now are multi language, accepting both english and the localized language.\n\n|cFFFFFF00-|r Added Data Broker for: Combat Time, Player Dps and Player Hps.\n\n|cFFFFFF00-|r Rework on plugins: Timeline, You Are Not Prepared, Tiny Threat, Encounter Details. All those plugins got a options panel and few improvaments.\n\n|cFFFFFF00-|r Trash segments won't be saved anymore.\n\n|cFFFFFF00-|r Added support for plugins options.\n\n|cFFFFFF00-|r Revamp on Deaths report lines, adding links for harmful spells and changing the text order |cFF999999(thanks @skmzarn-mmochampion forum)|r.\n\n|cFFFFFF00-|r Modified the percentage used on Comparison panel |cFF999999(thanks @Mystery2012-mmochampion forum)|r.\n\n|cFFFFFF00-|r Fixed the Raid Dps and Hps data exported by Data Broker |cFF999999(thanks @Arieth-mmochampion forum)|r.\n\n|cFFFFFF00v1.18.4 - v1.18.5 - v1.18.6 (|cFFFFCC00Jul 13, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added option to customize the bar left text.\n\n|cFFFFFF00-|r Added option for show or hide bar placement number.\n\n|cFFFFFF00-|r Spell icon is shown in the bar when the enemy character is a environment spell type.\n\n|cFFFFFF00-|r Changed the non-player enemy icon (monsters).\n\n|cFFFFFF00-|r Fixed bug on flex performance profile |cFF999999(thanks @skmzarn-mmochampion forum)|r.\n\n|cFFFFFF00-|r Added new version tracker which should alert you when a newer Details! version is found.\n\n|cFFFFFF00-|r Added Enemy Damage Taken by clicking with middle mouse button over a enemy bar (enemies display).\n\n|cFFFFFF00-|r Added import/export for saved skins and custom displays created.\n\n|cFFFFFF00-|r Small changes on ElvUI Frame Style skin (need reaply).\n\n|cFFFFFF00-|r Fixed the death recognition for bosses, now it should show the correct color over segments menu.\n\n|cFFFFFF00-|r Fixed Dps inacuracy when plyaing solo (no party or raid group).\n\n|cFFFFFF00-|r Fixed the duration time of buffs applied before the pull, like pre-potions.\n\n|cFFFFFF00v1.17.5 (|cFFFFCC00Jun 30, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Shortcut panel is now known as Bookmarks and a revamp has done on its panel.\n\n|cFFFFFF00-|r NickTag now doesnt check anymore if a received nickname from other guild member is invalid.\n\n|cFFFFFF00-|r Healthstone now is considered a cooldown.\n\n|cFFFFFF00-|r Few improvements on Default Skin, Minimalistic Skin and ElvUI Frame Style Skin.\n\n|cFFFFFF00-|r Revamp on Image Editor, many bugs solves and now it is usable." + Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v1.25.0 (|cFFFFCC00Set 08, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added Acitivity Time for Damage + Healing, tooltip show the activity separately.\n\n|cFFFFFF00-|r Major changes on Encounter Details Plugin making more easy to use.\n\n|cFFFFFF00-|r Removed Spell Details Plugin.\n\n|cFFFFFF00-|r Added new plugin for Solo Mode: Dps Tuning.\n\n|cFFFFFF00v1.24.5 (|cFFFFCC00Ago 31, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added Raid Tools bracket on Options Panel.\n\n|cFFFFFF00-|r Added interrupt, cooldown and death announcers (raid tools).\n\n|cFFFFFF00-|r Added pre potion recognition, showing after the encounter on the chat only for you (raid tools).\n\n|cFFFFFF00-|r Added a Boss Emotes tab for Encounter Details plugin |cFF999999(thanks Bloodforce-Azralon)|r.\n\n|cFFFFFF00-|r Rework on Activity Time, now it is tuned to closely match warcraftlogs |cFF999999(thanks www.warcraftlogs.com)|r.\n\n|cFFFFFF00-|r Added two new customs: Damage Activity Time and Healing Activity Time.\n\n|cFFFFFF00-|r Time Attack Plugin now have six fixed time amount options for test your dps on training dummies.\n\n|cFFFFFF00-|r Time Attack Plugin can now also share results on your realm, between players with the same class.\n\n|cFFFFFF00v1.23.6 (|cFFFFCC00Ago 24, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added 2 new bar textures and 6 new fonts.\n\n|cFFFFFF00-|r Swapped left and middle button for enemy bars, now left button open damage taken and middle button player detail window.\n\n|cFFFFFF00-|r Added new skin: Minimalistic v2.\n\n|cFFFFFF00-|r Minimalistic v2 is now the default skin.\n\n|cFFFFFF00-|r Few changes on both icon packs with transparency.\n\n|cFFFFFF00-|r Replaced the slash command '/d' with '/de' |cFF999999(thanks @kamuul-mmochampion forum)|r.\n\n|cFFFFFF00-|r Added custom spells for Atonement, Power Word: Solance and Life Bloom |cFF999999(thanks @skmzarn-mmochampion forum)|r.\n\n|cFFFFFF00v1.22.4 (|cFFFFCC00Ago 15, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added new skin: ElvUI Frame Style (Black White).\n\n|cFFFFFF00-|r Align With Right Chat Window option now check if the window have statusbar enabled.\n\n|cFFFFFF00-|r Few improvements on report for Deaths and Spells over Player Detail Window.\n\n|cFFFFFF00-|r Added option to disable reset button (reset only using its tooltip menu).\n\n|cFFFFFF00-|r Added option for disable window groups.\n\n|cFFFFFF00-|r Added option for select the icon pack to use, also added black white icon pack.\n\n|cFFFFFF00-|r Fixed many bugs involving skins and profiles, thing should run more smooth now.\n\n|cFFFFFF00-|r Plugin Time Attack now correctly saves the attempt when pressing the big save button.\n\n|cFFFFFF00-|r Added support for hotcorners.\n\n|cFFFFFF00v1.21.4 (|cFFFFCC00Ago 9, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added Shaman's Ancestral Guidance on cooldowns list |cFF999999(thanks @skmzarn-mmochampion forum)|r.\n\n|cFFFFFF00-|r Added a profile selection screen when Details! are running for the first time on a character.\n\n|cFFFFFF00-|r Added Menu Text Size option over miscellaneous section on options panel |cFF999999(thanks @ Revi-mmochampion forum)|r.\n\n|cFFFFFF00-|r Fixed a bug over Healing Player Details Window where pets wasn't being shown |cFF999999(thanks @Mystery2012-mmochampion forum)|r.\n\n|cFFFFFF00-|r Fixed issue with summoning pets with unknown owners where it was breaking the summon of all the others pets. |cFF999999(thanks @ThunderLost-curse website)|r.\n\n|cFFFFFF00-|r Hot Corners isn't no more a part of Details!, instead of that, Hot Corner is now a standalone addon which needs to be installed separately for who wants to use it.\n\n|cFFFFFF00-|r Skin data is now stored inside the profiles, many code parts got rewrite, still may have few bugs but it's more reliable then before.\n\n|cFFFFFF00-|r Rework on Auras and Voidzones: now shows damage, dps and percentage. Also its tooltip got fixes and now shows the correct damage done to players.\n\n|cFFFFFF00-|r Tooltip for Enemies now shows damage taken from players |cFF999999(thanks @Arieth-mmochampion forum)|r.\n\n|cFFFFFF00-|r Right clicking a real-time enemy bar, makes it back to Enemies display instead of show Bookmark panel |cFF999999(thanks @Arieth-mmochampion forum)|r.\n\n|cFFFFFF00-|r Tank comparison from previous segment now uses the same percentage method from player comparison panel.\n\n|cFFFFFF00-|r Fix bug with the slash command 'show' where was ignoring the window limit set on options panel |cFF999999(thanks @Castiel-US-Azralon realm)|r.\n\n|cFFFFFF00-|r Fixed few bugs with scroll bars, including scrolls on dropdown menu and player detail window |cFF999999(thanks @Revi-mmochampion forum)|r.\n\n|cFFFFFF00v1.20.2 (|cFFFFCC00Aug 1, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added a option under Miscellaneous section to provide spell link instead of spell name for helpful spells when reporting a death |cFF999999(thanks @skmzarn-mmochampion forum)|r.\n\n|cFFFFFF00-|r Improvements done on how deaths are handled, now latest events before death will be more precise.\n\n|cFFFFFF00-|r Implemented Damage Taken from environment like lava, gravity, etc.\n\n|cFFFFFF00-|r Added Warlock's Fire and Brimstone spell on customized spells.\n\n|cFFFFFF00-|r Added dwarf racial Stone Form on cooldown list |cFF999999(thanks @Mystery2012-mmochampion forum)|r.\n\n|cFFFFFF00-|r Bookmark now are shared between all characters.\n\n|cFFFFFF00-|r Fixed few inconsistencies with trash recognition.\n\n|cFFFFFF00-|r Fixed Cloud Capture where sometimes it wasn't sharing.\n\n|cFFFFFF00-|r Fixed report where it wasn't sharing for guild and raid when the player name box were empty.\n\n|cFFFFFF00-|r Report box now also saves the position and the last channel used to report |cFF999999(thanks @skmzarn-mmochampion forum)|r.\n\n|cFFFFFF00-|r You Are Not Prepared plugin now have tooltips for spells and its window auto opens after a boss encounter.\n\n|cFFFFFF00-|r Advanced Death Logs plugin got full rewrite (and still are in development).\n\n|cFFFFFF00v1.19.0 - v1.19.1 - v1.19.2 (|cFFFFCC00Jul 21, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Details! is now able to be translated by its community for all supported languages through Curse Forge Web Site:\n\n|cFFFFFF00http://wow.curseforge.com/addons/details/localization/|r\n\n|cFFFFFF00-|r Slash commands now are multi language, accepting both english and the localized language.\n\n|cFFFFFF00-|r Added Data Broker for: Combat Time, Player Dps and Player Hps.\n\n|cFFFFFF00-|r Rework on plugins: Timeline, You Are Not Prepared, Tiny Threat, Encounter Details. All those plugins got a options panel and few improvaments.\n\n|cFFFFFF00-|r Trash segments won't be saved anymore.\n\n|cFFFFFF00-|r Added support for plugins options.\n\n|cFFFFFF00-|r Revamp on Deaths report lines, adding links for harmful spells and changing the text order |cFF999999(thanks @skmzarn-mmochampion forum)|r.\n\n|cFFFFFF00-|r Modified the percentage used on Comparison panel |cFF999999(thanks @Mystery2012-mmochampion forum)|r.\n\n|cFFFFFF00-|r Fixed the Raid Dps and Hps data exported by Data Broker |cFF999999(thanks @Arieth-mmochampion forum)|r.\n\n|cFFFFFF00v1.18.4 - v1.18.5 - v1.18.6 (|cFFFFCC00Jul 13, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added option to customize the bar left text.\n\n|cFFFFFF00-|r Added option for show or hide bar placement number.\n\n|cFFFFFF00-|r Spell icon is shown in the bar when the enemy character is a environment spell type.\n\n|cFFFFFF00-|r Changed the non-player enemy icon (monsters).\n\n|cFFFFFF00-|r Fixed bug on flex performance profile |cFF999999(thanks @skmzarn-mmochampion forum)|r.\n\n|cFFFFFF00-|r Added new version tracker which should alert you when a newer Details! version is found.\n\n|cFFFFFF00-|r Added Enemy Damage Taken by clicking with middle mouse button over a enemy bar (enemies display).\n\n|cFFFFFF00-|r Added import/export for saved skins and custom displays created.\n\n|cFFFFFF00-|r Small changes on ElvUI Frame Style skin (need reaply).\n\n|cFFFFFF00-|r Fixed the death recognition for bosses, now it should show the correct color over segments menu.\n\n|cFFFFFF00-|r Fixed Dps inacuracy when plyaing solo (no party or raid group).\n\n|cFFFFFF00-|r Fixed the duration time of buffs applied before the pull, like pre-potions.\n\n|cFFFFFF00v1.17.5 (|cFFFFCC00Jun 30, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Shortcut panel is now known as Bookmarks and a revamp has done on its panel.\n\n|cFFFFFF00-|r NickTag now doesnt check anymore if a received nickname from other guild member is invalid.\n\n|cFFFFFF00-|r Healthstone now is considered a cooldown.\n\n|cFFFFFF00-|r Few improvements on Default Skin, Minimalistic Skin and ElvUI Frame Style Skin.\n\n|cFFFFFF00-|r Revamp on Image Editor, many bugs solves and now it is usable." Loc ["STRING_DETAILS1"] = "|cffffaeaeDetails!:|r " --> startup diff --git a/classes/classe_combate.lua b/classes/classe_combate.lua index aa4378a4..b0c3dd40 100644 --- a/classes/classe_combate.lua +++ b/classes/classe_combate.lua @@ -70,6 +70,10 @@ return self.last_events_tables end + function combate:GetCombatNumber() + return self.combat_counter + end + --return the name of the encounter or enemy function combate:GetCombatName (try_find) if (self.is_pvp) then @@ -141,6 +145,9 @@ _setmetatable (esta_tabela, combate) + _detalhes.combat_counter = _detalhes.combat_counter + 1 + esta_tabela.combat_counter = _detalhes.combat_counter + --> try discover if is a pvp combat local who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags = ... if (who_serial) then --> aqui irá identificar o boss ou o oponente diff --git a/classes/classe_custom.lua b/classes/classe_custom.lua index 2e069fca..51002ad7 100644 --- a/classes/classe_custom.lua +++ b/classes/classe_custom.lua @@ -644,6 +644,11 @@ table.wipe (self._NameIndexTable) end + function atributo_custom:GetValue (actor) + local actor_table = self:GetActorTable (actor) + return actor_table.value + end + function atributo_custom:AddValue (actor, actortotal, checktop) local actor_table = self:GetActorTable (actor) actor_table.my_actor = actor @@ -654,6 +659,8 @@ atributo_custom._TargetActorsProcessedTop = actor_table.value end end + + return actor_table.value end function atributo_custom:SetValue (actor, actortotal) @@ -1122,77 +1129,20 @@ self.custom [#self.custom+1] = Healthstone end - local DamageActivityTime = { - name = Loc ["STRING_CUSTOM_ACTIVITY_DPS"], - icon = [[Interface\ICONS\Achievement_PVP_H_06]], +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + + local ActivityTime = { + name = Loc ["STRING_CUSTOM_ACTIVITY_ALL"], + icon = [[INTERFACE\ICONS\Achievement_PVP_G_15]], attribute = false, spellid = false, author = "Details!", - desc = Loc ["STRING_CUSTOM_ACTIVITY_DPS_DESC"], + desc = Loc ["STRING_CUSTOM_ACTIVITY_ALL_DESC"], source = false, target = false, total_script = [[ local value, top, total, combat, instance = ... - local minutos, segundos = math.floor (value/60), math.floor (value%60) - return minutos .. "m " .. segundos .. "s" - ]], - percent_script = [[ - local value, top, total, combat, instance = ... - return string.format ("%.1f", value/top*100) - ]], - script = [[ - --init: - local combat, instance_container, instance = ... - local total, amount = 0, 0 - - --get the misc actor container - local damage_container = combat:GetActorList ( DETAILS_ATTRIBUTE_DAMAGE ) - - --do the loop: - for _, player in ipairs ( damage_container ) do - if (player.grupo) then - local activity = player:Tempo() - total = total + activity - amount = amount + 1 - --add amount to the player - instance_container:AddValue (player, activity) - end - end - - --return: - return total, combat:GetCombatTime(), amount - ]], - tooltip = [[ - - ]], - } - - local have = false - for _, custom in ipairs (self.custom) do - if (custom.name == Loc ["STRING_CUSTOM_ACTIVITY_DPS"]) then - have = true - break - end - end - if (not have) then - setmetatable (DamageActivityTime, _detalhes.atributo_custom) - DamageActivityTime.__index = _detalhes.atributo_custom - self.custom [#self.custom+1] = DamageActivityTime - end - - local HealActivityTime = { - name = Loc ["STRING_CUSTOM_ACTIVITY_HPS"], - icon = [[Interface\ICONS\Achievement_PVP_G_06]], - attribute = false, - spellid = false, - author = "Details!", - desc = Loc ["STRING_CUSTOM_ACTIVITY_HPS_DESC"], - source = false, - target = false, - total_script = [[ - local value, top, total, combat, instance = ... - local minutos, segundos = math.floor (value/60), math.floor (value%60) - return minutos .. "m " .. segundos .. "s" + return math.floor (value) ]], percent_script = [[ local value, top, total, combat, instance = ... @@ -1203,39 +1153,86 @@ local combat, instance_container, instance = ... local total, top, amount = 0, 0, 0 - --get the misc actor container - local damage_container = combat:GetActorList ( DETAILS_ATTRIBUTE_HEAL ) + --get the heal actor container + local heal_container = combat:GetActorList ( DETAILS_ATTRIBUTE_HEAL ) --do the loop: - for _, player in ipairs ( damage_container ) do + for _, player in ipairs ( heal_container ) do if (player.grupo) then local activity = player:Tempo() total = total + activity amount = amount + 1 --add amount to the player instance_container:AddValue (player, activity) + if (activity > top) then + top = activity + end + end + end + + --get the damage actor container + local damage_container = combat:GetActorList ( DETAILS_ATTRIBUTE_DAMAGE ) + + --do the loop: + for _, player in ipairs ( damage_container ) do + if (player.grupo) then + local activity = player:Tempo() + total = total + activity + if (not instance_container._NameIndexTable [player:Name()]) then + amount = amount + 1 + end + --add amount to the player + local value = instance_container:AddValue (player, activity) + if (value > top) then + top = value + end end end --return: - return total, combat:GetCombatTime(), amount + return total, top, amount ]], tooltip = [[ + --init: + local player, combat, instance = ... + local damage_actor = combat (DETAILS_ATTRIBUTE_DAMAGE, player:Name()) + if (damage_actor) then + local damage_activity = damage_actor:Tempo() + local minutos1, segundos1 = math.floor (damage_activity/60), math.floor (damage_activity%60) + GameCooltip:AddLine ("Damage Activity", minutos1 .. "m " .. segundos1 .. "s") + _detalhes:AddTooltipBackgroundStatusbar() + GameCooltip:AddIcon ('Interface\\ICONS\\Achievement_PVP_H_06', 1, 1, 14, 14) + else + GameCooltip:AddLine ("Damage Activity", "0m 0s") + end + + local heal_actor = combat (DETAILS_ATTRIBUTE_HEAL, player:Name()) + if (heal_actor) then + local heal_activity = heal_actor:Tempo() + local minutos2, segundos2 = math.floor (heal_activity/60), math.floor (heal_activity%60) + GameCooltip:AddLine ("Heal Activity", minutos2 .. "m " .. segundos2 .. "s") + _detalhes:AddTooltipBackgroundStatusbar() + GameCooltip:AddIcon ('Interface\\ICONS\\Achievement_PVP_G_06', 1, 1, 14, 14) + else + GameCooltip:AddLine ("Heal Activity", "0m 0s") + end ]], } + --/run _detalhes:AddDefaultCustomDisplays() + local have = false for _, custom in ipairs (self.custom) do - if (custom.name == Loc ["STRING_CUSTOM_ACTIVITY_HPS"]) then + if (custom.name == Loc ["STRING_CUSTOM_ACTIVITY_ALL"]) then have = true break end end if (not have) then - setmetatable (HealActivityTime, _detalhes.atributo_custom) - HealActivityTime.__index = _detalhes.atributo_custom - self.custom [#self.custom+1] = HealActivityTime + setmetatable (ActivityTime, _detalhes.atributo_custom) + ActivityTime.__index = _detalhes.atributo_custom + self.custom [#self.custom+1] = ActivityTime end end diff --git a/classes/classe_others.lua b/classes/classe_others.lua index ef1355ae..3cb93641 100644 --- a/classes/classe_others.lua +++ b/classes/classe_others.lua @@ -1370,8 +1370,7 @@ function _detalhes:CatchRaidBuffUptime (in_or_out) end _detalhes.parser:add_buff_uptime (nil, GetTime(), _UnitGUID ("player"), playerName, 0x00000514, _UnitGUID ("player"), playerName, 0x00000514, spellid, name, in_or_out) - else - break + end end @@ -1398,9 +1397,7 @@ function _detalhes:CatchRaidBuffUptime (in_or_out) end _detalhes.parser:add_buff_uptime (nil, GetTime(), _UnitGUID ("party"..groupIndex), playerName, 0x00000417, _UnitGUID ("party"..groupIndex), playerName, 0x00000417, spellid, name, in_or_out) - - else - --break + end end end @@ -1410,8 +1407,6 @@ function _detalhes:CatchRaidBuffUptime (in_or_out) if (name and unitCaster == "player") then local playerName = _UnitName ("player") _detalhes.parser:add_buff_uptime (nil, GetTime(), _UnitGUID ("player"), playerName, 0x00000417, _UnitGUID ("player"), playerName, 0x00000417, spellid, name, in_or_out) - else - break end end @@ -1431,8 +1426,6 @@ function _detalhes:CatchRaidBuffUptime (in_or_out) end _detalhes.parser:add_buff_uptime (nil, GetTime(), _UnitGUID ("player"), playerName, 0x00000417, _UnitGUID ("player"), playerName, 0x00000417, spellid, name, in_or_out) - else - break end end diff --git a/core/control.lua b/core/control.lua index 8fbf9651..6aafc001 100644 --- a/core/control.lua +++ b/core/control.lua @@ -536,7 +536,9 @@ _detalhes.SoloTables.CombatID = _detalhes.SoloTables.CombatIDLast else - _detalhes:RefreshSolo() + if (_detalhes.RefreshSolo) then + _detalhes:RefreshSolo() + end _detalhes.SoloTables.CombatID = nil end end diff --git a/core/parser.lua b/core/parser.lua index a382513e..20d7e208 100644 --- a/core/parser.lua +++ b/core/parser.lua @@ -2555,7 +2555,6 @@ end end - --"ENVIRONMENTAL_DAMAGE" --> damage aplied by enviorement like lava. --SPELL_PERIODIC_MISSED --> need research --DAMAGE_SHIELD_MISSED --> need research --SPELL_EXTRA_ATTACKS --> need research diff --git a/core/plugins.lua b/core/plugins.lua index bb73bc47..24e684d5 100644 --- a/core/plugins.lua +++ b/core/plugins.lua @@ -248,7 +248,42 @@ template = template or 1 - if (template == 1) then + if (template == 2) then + local options_frame = CreateFrame ("frame", name, UIParent, "ButtonFrameTemplate") + tinsert (UISpecialFrames, name) + options_frame:SetSize (500, 200) + options_frame:SetFrameStrata ("DIALOG") + + options_frame:SetScript ("OnMouseDown", function(self, button) + if (button == "RightButton") then + if (self.moving) then + self.moving = false + self:StopMovingOrSizing() + end + return options_frame:Hide() + elseif (button == "LeftButton" and not self.moving) then + self.moving = true + self:StartMoving() + end + end) + options_frame:SetScript ("OnMouseUp", function(self) + if (self.moving) then + self.moving = false + self:StopMovingOrSizing() + end + end) + + options_frame:SetMovable (true) + options_frame:EnableMouse (true) + options_frame:Hide() + + options_frame:SetPoint ("center", UIParent, "center") + options_frame.TitleText:SetText (title) + options_frame.portrait:SetTexture ([[Interface\CHARACTERFRAME\TEMPORARYPORTRAIT-FEMALE-BLOODELF]]) + + return options_frame + + elseif (template == 1) then local options_frame = CreateFrame ("frame", name, UIParent) tinsert (UISpecialFrames, name) options_frame:SetSize (500, 200) diff --git a/framework/button.lua b/framework/button.lua index 92660d02..0243c648 100644 --- a/framework/button.lua +++ b/framework/button.lua @@ -576,7 +576,7 @@ local ButtonMetaFunctions = {} end if (button.MyObject.OnEnterHook) then - local interrupt = button.MyObject.OnEnterHook (button) + local interrupt = button.MyObject.OnEnterHook (button, button.MyObject) if (interrupt) then return end @@ -621,7 +621,7 @@ local ButtonMetaFunctions = {} end if (button.MyObject.OnLeaveHook) then - local interrupt = button.MyObject.OnLeaveHook (button) + local interrupt = button.MyObject.OnLeaveHook (button, button.MyObject) if (interrupt) then return end @@ -653,7 +653,7 @@ local ButtonMetaFunctions = {} local OnHide = function (button) if (button.MyObject.OnHideHook) then - local interrupt = button.MyObject.OnHideHook (button) + local interrupt = button.MyObject.OnHideHook (button, button.MyObject) if (interrupt) then return end @@ -662,7 +662,7 @@ local ButtonMetaFunctions = {} local OnShow = function (button) if (button.MyObject.OnShowHook) then - local interrupt = button.MyObject.OnShowHook (button) + local interrupt = button.MyObject.OnShowHook (button, button.MyObject) if (interrupt) then return end @@ -687,7 +687,7 @@ local ButtonMetaFunctions = {} end if (button.MyObject.OnMouseDownHook) then - local interrupt = button.MyObject.OnMouseDownHook (button, buttontype) + local interrupt = button.MyObject.OnMouseDownHook (button, buttontype, button.MyObject) if (interrupt) then return end @@ -774,7 +774,7 @@ local ButtonMetaFunctions = {} end if (button.MyObject.OnMouseUpHook) then - local interrupt = button.MyObject.OnMouseUpHook (button, buttontype) + local interrupt = button.MyObject.OnMouseUpHook (button, buttontype, button.MyObject) if (interrupt) then return end @@ -836,10 +836,16 @@ local ButtonMetaFunctions = {} ------------------------------------------------------------------------------------------------------------ --> object constructor +function gump:CreateButton (parent, func, w, h, text, param1, param2, texture, member, name, short_method) + return gump:NewButton (parent, parent, name, member, w, h, func, param1, param2, texture, text, short_method) +end + function gump:NewButton (parent, container, name, member, w, h, func, param1, param2, texture, text, short_method) if (not name) then - return nil + name = "DetailsButtonNumber" .. gump.ButtonCounter + gump.ButtonCounter = gump.ButtonCounter + 1 + elseif (not parent) then return nil end diff --git a/framework/cooltip.lua b/framework/cooltip.lua index e383b046..7e4a7bc6 100644 --- a/framework/cooltip.lua +++ b/framework/cooltip.lua @@ -72,6 +72,7 @@ function DetailsCreateCoolTip() ["FixedHeight"] = true, ["FixedWidthSub"] = true, ["FixedHeightSub"] = true, + ["AlignAsBlizzTooltip"] = true, ["IgnoreSubMenu"] = true, ["IgnoreButtonAutoHeight"] = true, ["TextHeightMod"] = true, @@ -301,16 +302,6 @@ function DetailsCreateCoolTip() end) frame1:SetScript ("OnHide", function (self) - --[[ --> avoid taint errors - if (not frame1.hidden) then --> significa que foi fechado com ESC - frame1:Show() - gump:Fade (frame1, 1) - end - if (not frame2.hidden) then --> significa que foi fechado com ESC - frame2:Show() - gump:Fade (frame2, 1) - end - --]] CoolTip.active = false CoolTip.buttonClicked = false CoolTip.mouseOver = false @@ -1163,7 +1154,13 @@ function DetailsCreateCoolTip() menuButton:SetPoint ("right", frame1, "right") --> height - if (CoolTip.OptionsTable.IgnoreButtonAutoHeight) then + if (CoolTip.OptionsTable.AlignAsBlizzTooltip) then + local height = _math_max (8, menuButton.leftText:GetStringHeight(), menuButton.rightText:GetStringHeight(), menuButton.leftIcon:GetHeight(), menuButton.rightIcon:GetHeight()) + menuButton:SetHeight (height) + menuButton:SetPoint ("top", frame1, "top", 0, temp) + temp = temp + ( height * -1) + + elseif (CoolTip.OptionsTable.IgnoreButtonAutoHeight) then local height = _math_max (menuButton.leftText:GetStringHeight(), menuButton.rightText:GetStringHeight(), menuButton.leftIcon:GetHeight(), menuButton.rightIcon:GetHeight()) menuButton:SetHeight (height) @@ -1213,7 +1210,9 @@ function DetailsCreateCoolTip() if (CoolTip.OptionsTable.FixedHeight) then frame1:SetHeight (CoolTip.OptionsTable.FixedHeight) else - if (CoolTip.OptionsTable.IgnoreButtonAutoHeight) then + if (CoolTip.OptionsTable.AlignAsBlizzTooltip) then + frame1:SetHeight ( (temp-10) * -1) + elseif (CoolTip.OptionsTable.IgnoreButtonAutoHeight) then frame1:SetHeight ( (temp+spacing) * -1) else frame1:SetHeight ( _math_max ( (frame1.hHeight * CoolTip.Indexes) + 12, 22 )) @@ -2354,12 +2353,10 @@ function DetailsCreateCoolTip() if (not lineTable_left) then lineTable_left = {} _table_insert (frameTableLeft, CoolTip.Indexes, lineTable_left) - --frameTableLeft [CoolTip.Indexes] = lineTable_left end if (not lineTable_right) then lineTable_right = {} _table_insert (frameTableRight, CoolTip.Indexes, lineTable_right) - --frameTableRight [CoolTip.Indexes] = lineTable_right end end diff --git a/framework/dropdown.lua b/framework/dropdown.lua index a4344b9a..2237dfa9 100644 --- a/framework/dropdown.lua +++ b/framework/dropdown.lua @@ -819,10 +819,16 @@ end ------------------------------------------------------------------------------------------------------------ --> object constructor +function gump:CreateDropDown (parent, func, default, w, h, member, name) + return gump:NewDropDown (parent, parent, name, member, w, h, func, default) +end + function gump:NewDropDown (parent, container, name, member, w, h, func, default) if (not name) then - return nil + name = "DetailsDropDownNumber" .. gump.DropDownCounter + gump.DropDownCounter = gump.DropDownCounter + 1 + elseif (not parent) then return nil end diff --git a/framework/framework.lua b/framework/framework.lua index 40814dab..5e93bb1d 100644 --- a/framework/framework.lua +++ b/framework/framework.lua @@ -7,6 +7,10 @@ local _unpack = unpack local _ gump.LabelNameCounter = 1 gump.PictureNameCounter = 1 +gump.BarNameCounter = 1 +gump.DropDownCounter = 1 +gump.PanelCounter = 1 +gump.ButtonCounter = 1 gump.debug = false diff --git a/framework/label.lua b/framework/label.lua index f1ac9ec2..8da69613 100644 --- a/framework/label.lua +++ b/framework/label.lua @@ -217,11 +217,11 @@ local LabelMetaFunctions = {} ------------------------------------------------------------------------------------------------------------ --> object constructor -function gump:CreateLabel (parent, text, size, color, font, member, name) - return gump:NewLabel (parent, nil, name, member, text, font, size, color) +function gump:CreateLabel (parent, text, size, color, font, member, name, layer) + return gump:NewLabel (parent, nil, name, member, text, font, size, color, layer) end -function gump:NewLabel (parent, container, name, member, text, font, size, color) +function gump:NewLabel (parent, container, name, member, text, font, size, color, layer) if (not parent) then return nil @@ -257,7 +257,7 @@ function gump:NewLabel (parent, container, name, member, text, font, size, color font = font or "GameFontHighlightSmall" - LabelObject.label = parent:CreateFontString (name, "OVERLAY", font) + LabelObject.label = parent:CreateFontString (name, layer or "OVERLAY", font) LabelObject.widget = LabelObject.label LabelObject.label.MyObject = LabelObject diff --git a/framework/normal_bar.lua b/framework/normal_bar.lua index 7e3fc005..6e73436c 100644 --- a/framework/normal_bar.lua +++ b/framework/normal_bar.lua @@ -419,7 +419,7 @@ local APIBarFunctions local OnEnter = function (frame) if (frame.MyObject.OnEnterHook) then - local interrupt = frame.MyObject.OnEnterHook (frame) + local interrupt = frame.MyObject.OnEnterHook (frame, frame.MyObject) if (interrupt) then return end @@ -591,10 +591,16 @@ function DetailsNormalBar_OnCreate (self) return true end -function gump:NewBar (parent, container, name, member, w, h, value) +function gump:CreateBar (parent, texture, w, h, value, member, name) + return gump:NewBar (parent, parent, name, member, w, h, value, texture) +end + +function gump:NewBar (parent, container, name, member, w, h, value, texture_name) if (not name) then - return nil + name = "DetailsBarNumber" .. gump.BarNameCounter + gump.BarNameCounter = gump.BarNameCounter + 1 + elseif (not parent) then return nil elseif (not container) then @@ -617,6 +623,10 @@ function gump:NewBar (parent, container, name, member, w, h, value) if (container.dframework) then container = container.widget end + + value = value or 0 + w = w or 150 + h = h or 14 --> default members: --> hooks @@ -680,6 +690,11 @@ function gump:NewBar (parent, container, name, member, w, h, value) --> set class _setmetatable (BarObject, BarMetaFunctions) - + + --> set texture + if (texture_name) then + smember_texture (BarObject, texture_name) + end + return BarObject end diff --git a/framework/panel.lua b/framework/panel.lua index 9e7867db..8fbf3896 100644 --- a/framework/panel.lua +++ b/framework/panel.lua @@ -357,7 +357,7 @@ local APIFrameFunctions local OnEnter = function (frame) if (frame.MyObject.OnEnterHook) then - local interrupt = frame.MyObject.OnEnterHook (frame) + local interrupt = frame.MyObject.OnEnterHook (frame, frame.MyObject) if (interrupt) then return end @@ -379,7 +379,7 @@ local APIFrameFunctions local OnLeave = function (frame) if (frame.MyObject.OnLeaveHook) then - local interrupt = frame.MyObject.OnLeaveHook (frame) + local interrupt = frame.MyObject.OnLeaveHook (frame, frame.MyObject) if (interrupt) then return end @@ -397,7 +397,7 @@ local APIFrameFunctions local OnHide = function (frame) if (frame.MyObject.OnHideHook) then - local interrupt = frame.MyObject.OnHideHook (frame) + local interrupt = frame.MyObject.OnHideHook (frame, frame.MyObject) if (interrupt) then return end @@ -406,7 +406,7 @@ local APIFrameFunctions local OnShow = function (frame) if (frame.MyObject.OnShowHook) then - local interrupt = frame.MyObject.OnShowHook (frame) + local interrupt = frame.MyObject.OnShowHook (frame, frame.MyObject) if (interrupt) then return end @@ -415,7 +415,7 @@ local APIFrameFunctions local OnMouseDown = function (frame, button) if (frame.MyObject.OnMouseDownHook) then - local interrupt = frame.MyObject.OnMouseDownHook (frame, button) + local interrupt = frame.MyObject.OnMouseDownHook (frame, button, frame.MyObject) if (interrupt) then return end @@ -439,7 +439,7 @@ local APIFrameFunctions local OnMouseUp = function (frame, button) if (frame.MyObject.OnMouseUpHook) then - local interrupt = frame.MyObject.OnMouseUpHook (frame, button) + local interrupt = frame.MyObject.OnMouseUpHook (frame, button, frame.MyObject) if (interrupt) then return end @@ -464,10 +464,16 @@ local APIFrameFunctions ------------------------------------------------------------------------------------------------------------ --> object constructor +function gump:CreatePanel (parent, w, h, backdrop, backdropcolor, bordercolor, member, name) + return gump:NewPanel (parent, parent, name, member, w, h, backdrop, backdropcolor, bordercolor) +end + function gump:NewPanel (parent, container, name, member, w, h, backdrop, backdropcolor, bordercolor) if (not name) then - return nil + name = "DetailsPanelNumber" .. gump.PanelCounter + gump.PanelCounter = gump.PanelCounter + 1 + elseif (not parent) then parent = UIParent end @@ -1129,3 +1135,522 @@ function gump:IconPick (callback, close_when_select) gump.IconPickFrame.click_close = close_when_select end + +local chart_panel_backdrop = {bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, +edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 32, insets = {left = 5, right = 5, top = 5, bottom = 5}} + +local chart_panel_align_timelabels = function (self, elapsed_time) + + self.TimeScale = elapsed_time + + local linha = self.TimeLabels [17] + local minutos, segundos = math.floor (elapsed_time / 60), math.floor (elapsed_time % 60) + if (segundos < 10) then + segundos = "0" .. segundos + end + + if (minutos > 0) then + if (minutos < 10) then + minutos = "0" .. minutos + end + linha:SetText (minutos .. ":" .. segundos) + else + linha:SetText ("00:" .. segundos) + end + + local time_div = elapsed_time / 16 --786 -- 49.125 + + for i = 2, 16 do + + local linha = self.TimeLabels [i] + + local this_time = time_div * (i-1) + local minutos, segundos = math.floor (this_time / 60), math.floor (this_time % 60) + + if (segundos < 10) then + segundos = "0" .. segundos + end + + if (minutos > 0) then + if (minutos < 10) then + minutos = "0" .. minutos + end + linha:SetText (minutos .. ":" .. segundos) + else + linha:SetText ("00:" .. segundos) + end + + end + +end + +local chart_panel_set_scale = function (self, amt, func, text) + if (type (amt) ~= "number") then + return + end + + local piece = amt / 8 + + for i = 1, 8 do + if (func) then + self ["dpsamt" .. math.abs (i-9)]:SetText ( func (piece*i) .. (text or "")) + else + self ["dpsamt" .. math.abs (i-9)]:SetText ( floor (piece*i) .. (text or "")) + end + end +end + +local chart_panel_can_move = function (self, can) + self.can_move = can +end + +local chart_panel_overlay_reset = function (self) + self.OverlaysAmount = 1 + for index, pack in ipairs (self.Overlays) do + for index2, texture in ipairs (pack) do + texture:Hide() + end + end +end + +local chart_panel_reset = function (self) + + self.Graphic:ResetData() + self.Graphic.max_value = 0 + + self.TimeScale = nil + self.BoxLabelsAmount = 1 + table.wipe (self.GData) + table.wipe (self.OData) + + for index, box in ipairs (self.BoxLabels) do + box.check:Hide() + box.button:Hide() + box.box:Hide() + box.text:Hide() + box.border:Hide() + box.showing = false + end + + chart_panel_overlay_reset (self) +end + +local chart_panel_enable_line = function (f, thisbox) + + local index = thisbox.index + local type = thisbox.type + + if (thisbox.enabled) then + --disable + thisbox.check:Hide() + thisbox.enabled = false + else + --enable + thisbox.check:Show() + thisbox.enabled = true + end + + if (type == "graphic") then + + f.Graphic:ResetData() + f.Graphic.max_value = 0 + + local max = 0 + + for index, box in ipairs (f.BoxLabels) do + if (box.type == type and box.showing and box.enabled) then + local data = f.GData [index] + f.Graphic:AddDataSeries (data[1], data[2], nil, data[3]) + if (data[4] > max) then + max = data[4] + end + end + end + + f:SetScale (max) + + elseif (type == "overlay") then + + chart_panel_overlay_reset (f) + + for index, box in ipairs (f.BoxLabels) do + if (box.type == type and box.showing and box.enabled) then + + f:AddOverlay (box.index) + + end + end + + end +end + +local create_box = function (self, next_box) + + local thisbox = {} + self.BoxLabels [next_box] = thisbox + + local box = gump:NewImage (self, nil, 16, 16, "border") + local text = gump:CreateLabel (self, nil, nil, nil, "GameFontNormal") + + local border = gump:NewImage (self, [[Interface\DialogFrame\UI-DialogBox-Gold-Corner]], 30, 30, "artwork") + border:SetPoint ("center", box, "center", -3, -4) + + local checktexture = gump:NewImage (self, [[Interface\Buttons\UI-CheckBox-Check]], 18, 18, "overlay") + checktexture:SetPoint ("center", box, "center", -1, -1) + + thisbox.box = box + thisbox.text = text + thisbox.border = border + thisbox.check = checktexture + thisbox.enabled = true + + local button = gump:CreateButton (self, chart_panel_enable_line, 20, 20, "", self, thisbox) + button:SetPoint ("center", box, "center") + + thisbox.button = button + + thisbox.box:SetPoint ("right", text, "left", -4, 0) + + if (next_box == 1) then + thisbox.text:SetPoint ("topright", self, "topright", -35, -16) + else + thisbox.text:SetPoint ("right", self.BoxLabels [next_box-1].box, "left", -7, 0) + end + + return thisbox + +end + +local chart_panel_add_label = function (self, color, name, type, number) + + local next_box = self.BoxLabelsAmount + local thisbox = self.BoxLabels [next_box] + + if (not thisbox) then + thisbox = create_box (self, next_box) + end + + self.BoxLabelsAmount = self.BoxLabelsAmount + 1 + + thisbox.type = type + thisbox.index = number + + thisbox.box:SetTexture (unpack (color)) + thisbox.text:SetText (name) + + thisbox.check:Show() + thisbox.button:Show() + thisbox.border:Show() + thisbox.box:Show() + thisbox.text:Show() + + thisbox.showing = true + thisbox.enabled = true + +end + +local line_default_color = {1, 1, 1} +local draw_overlay = function (self, this_overlay, overlayData, color) + + local pixel = self.Graphic:GetWidth() / self.TimeScale + local index = 1 + local r, g, b = unpack (color) + + for i = 1, #overlayData, 2 do + local aura_start = overlayData [i] + local aura_end = overlayData [i+1] + + local this_block = this_overlay [index] + if (not this_block) then + this_block = self.Graphic:CreateTexture (nil, "border") + tinsert (this_overlay, this_block) + end + this_block:SetHeight (self.Graphic:GetHeight()) + + this_block:SetPoint ("left", self.Graphic, "left", pixel * aura_start, 0) + if (aura_end) then + this_block:SetWidth ((aura_end-aura_start)*pixel) + else + --malformed table + this_block:SetWidth (pixel*5) + end + + this_block:SetTexture (r, g, b, 0.25) + this_block:Show() + + index = index + 1 + end + +end + +local chart_panel_add_overlay = function (self, overlayData, color, name, icon) + + if (not self.TimeScale) then + error ("Use SetTime (time) before adding an overlay.") + end + + if (type (overlayData) == "number") then + local overlay_index = overlayData + draw_overlay (self, self.Overlays [self.OverlaysAmount], self.OData [overlay_index][1], self.OData [overlay_index][2]) + else + local this_overlay = self.Overlays [self.OverlaysAmount] + if (not this_overlay) then + this_overlay = {} + tinsert (self.Overlays, this_overlay) + end + + draw_overlay (self, this_overlay, overlayData, color) + + tinsert (self.OData, {overlayData, color or line_default_color}) + if (name) then + self:AddLabel (color or line_default_color, name, "overlay", #self.OData) + end + end + + self.OverlaysAmount = self.OverlaysAmount + 1 +end + +local chart_panel_add_data = function (self, graphicData, color, name, lineTexture, smoothLevel) + + + local f = self + self = self.Graphic + + local _data = {} + local max_value = graphicData.max_value + local amount = #graphicData + + local scaleW = 1/self:GetWidth() + + local content = graphicData + tinsert (content, 1, 0) + tinsert (content, 1, 0) + tinsert (content, #content+1, 0) + tinsert (content, #content+1, 0) + + local _i = 3 + + local graphMaxDps = math.max (self.max_value, max_value) + if (not smoothLevel) then + while (_i <= #content-2) do + local v = (content[_i-2]+content[_i-1]+content[_i]+content[_i+1]+content[_i+2])/5 --> normalize + _data [#_data+1] = {scaleW*(_i-2), v/graphMaxDps} --> x and y coords + _i = _i + 1 + end + + elseif (smoothLevel == 1) then + _i = 2 + while (_i <= #content-1) do + local v = (content[_i-1]+content[_i]+content[_i+1])/3 --> normalize + _data [#_data+1] = {scaleW*(_i-1), v/graphMaxDps} --> x and y coords + _i = _i + 1 + end + + elseif (smoothLevel == 2) then + _i = 1 + while (_i <= #content) do + local v = content[_i] --> do not normalize + _data [#_data+1] = {scaleW*(_i), v/graphMaxDps} --> x and y coords + _i = _i + 1 + end + + end + + tremove (content, 1) + tremove (content, 1) + tremove (content, #graphicData) + tremove (content, #graphicData) + + if (max_value > self.max_value) then + --> normalize previous data + if (self.max_value > 0) then + local normalizePercent = self.max_value / max_value + for dataIndex, Data in ipairs (self.Data) do + local Points = Data.Points + for i = 1, #Points do + Points[i][2] = Points[i][2]*normalizePercent + end + end + end + + self.max_value = max_value + end + + tinsert (f.GData, {_data, color or line_default_color, lineTexture, graphicData.max_value}) + if (name) then + f:AddLabel (color or line_default_color, name, "graphic", #f.GData) + end + + self:AddDataSeries (_data, color or line_default_color, nil, lineTexture) + +end + +local chart_panel_onresize = function (self) + local width, height = self:GetSize() + local spacement = width - 78 - 60 + spacement = spacement / 16 + + for i = 1, 17 do + local label = self.TimeLabels [i] + label:SetPoint ("bottomleft", f, "bottomleft", 78 + ((i-1)*spacement), 13) + label.line:SetHeight (height - 45) + end + + local spacement = (self.Graphic:GetHeight()) / 8 + for i = 1, 8 do + self ["dpsamt"..i]:SetPoint ("TOPLEFT", self, "TOPLEFT", 27, -25 + (-(spacement* (i-1))) ) + self ["dpsamt"..i].line:SetWidth (width-20) + end + + self.Graphic:SetSize (width - 135, height - 67) + self.Graphic:SetPoint ("topleft", self, "topleft", 108, -35) +end + +local chart_panel_vlines_on = function (self) + for i = 1, 17 do + local label = self.TimeLabels [i] + label.line:Show() + end +end + +local chart_panel_vlines_off = function (self) + for i = 1, 17 do + local label = self.TimeLabels [i] + label.line:Hide() + end +end + +local chart_panel_set_title = function (self, title) + self.chart_title.text = title +end + +local chart_panel_mousedown = function (self, button) + if (button == "LeftButton" and self.can_move) then + if (not self.isMoving) then + self:StartMoving() + self.isMoving = true + end + elseif (button == "RightButton") then + if (not self.isMoving) then + self:Hide() + end + end +end +local chart_panel_mouseup = function (self, button) + if (button == "LeftButton" and self.isMoving) then + self:StopMovingOrSizing() + self.isMoving = nil + end +end + +function gump:CreateChartPanel (parent, w, h, name) + + if (not name) then + name = "DetailsPanelNumber" .. gump.PanelCounter + gump.PanelCounter = gump.PanelCounter + 1 + end + + parent = parent or UIParent + w = w or 800 + h = h or 500 + + local f = CreateFrame ("frame", name, parent) + f:SetSize (w or 500, h or 400) + f:EnableMouse (true) + f:SetMovable (true) + + f:SetScript ("OnMouseDown", chart_panel_mousedown) + f:SetScript ("OnMouseUp", chart_panel_mouseup) + + f:SetBackdrop (chart_panel_backdrop) + f:SetBackdropColor (.3, .3, .3, .3) + + local c = CreateFrame ("Button", nil, f, "UIPanelCloseButton") + c:SetWidth (32) + c:SetHeight (32) + c:SetPoint ("TOPRIGHT", f, "TOPRIGHT", -3, -7) + c:SetFrameLevel (f:GetFrameLevel()+1) + c:SetAlpha (0.9) + f.CloseButton = c + + local title = gump:NewLabel (f, nil, "$parentTitle", "chart_title", "Chart!", nil, 20, "yellow") + title:SetPoint (110, -13) + _detalhes:SetFontOutline (title, true) + + local bottom_texture = gump:NewImage (f, nil, 702, 25, "background", nil, nil, "$parentBottomTexture") + bottom_texture:SetTexture (0, 0, 0, .6) + bottom_texture:SetPoint ("bottomleft", f, "bottomleft", 8, 7) + bottom_texture:SetPoint ("bottomright", f, "bottomright", -8, 7) + + f.Overlays = {} + f.OverlaysAmount = 1 + + f.BoxLabels = {} + f.BoxLabelsAmount = 1 + + f.TimeLabels = {} + for i = 1, 17 do + local time = gump:NewLabel (f, nil, "$parentTime"..i, nil, "00:00") + time:SetPoint ("bottomleft", f, "bottomleft", 78 + ((i-1)*36), 13) + f.TimeLabels [i] = time + local line = gump:NewImage (f, nil, 1, h-45, "border", nil, nil, "$parentTime"..i.."Bar") + line:SetTexture (1, 1, 1, .1) + line:SetPoint ("bottomleft", time, "topright", 0, -10) + time.line = line + end + + --graphic + local g = LibStub:GetLibrary("LibGraph-2.0"):CreateGraphLine (name .. "Graphic", f, "topleft","topleft", 108, -35, w - 120, h - 67) + g:SetXAxis (-1,1) + g:SetYAxis (-1,1) + g:SetGridSpacing (false, false) + g:SetGridColor ({0.5,0.5,0.5,0.3}) + g:SetAxisDrawing (false,false) + g:SetAxisColor({1.0,1.0,1.0,1.0}) + g:SetAutoScale (true) + g:SetLineTexture ("smallline") + g:SetBorderSize ("right", 0.001) + g:SetBorderSize ("left", 0.000) + g:SetBorderSize ("top", 0.002) + g:SetBorderSize ("bottom", 0.001) + g.VerticalLines = {} + g.max_value = 0 + + g:SetLineTexture ("line") + + f.Graphic = g + f.GData = {} + f.OData = {} + + g:SetBackdrop ({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16}) + g:SetBackdropColor (0, 0, 0, 0.8) + + --div lines + for i = 1, 8, 1 do + local line = g:CreateTexture (nil, "overlay") + line:SetTexture (1, 1, 1, .2) + line:SetWidth (670) + line:SetHeight (1.1) + + gump:NewLabel (f, f, nil, "dpsamt"..i, "100k", "GameFontHighlightSmall") + f["dpsamt"..i]:SetPoint ("TOPLEFT", f, "TOPLEFT", 27, -61 + (-(24.6*i))) + line:SetPoint ("topleft", f["dpsamt"..i].widget, "bottom", -27, 0) + f["dpsamt"..i].line = line + end + + f.SetTime = chart_panel_align_timelabels + f.EnableVerticalLines = chart_panel_vlines_on + f.DisableVerticalLines = chart_panel_vlines_off + f.SetTitle = chart_panel_set_title + f.SetScale = chart_panel_set_scale + f.Reset = chart_panel_reset + f.AddLine = chart_panel_add_data + f.CanMove = chart_panel_can_move + f.AddLabel = chart_panel_add_label + f.AddOverlay = chart_panel_add_overlay + + f:SetScript ("OnSizeChanged", chart_panel_onresize) + chart_panel_onresize (f) + + return f +end diff --git a/functions/boss.lua b/functions/boss.lua index a94bc7e5..ca0c9365 100644 --- a/functions/boss.lua +++ b/functions/boss.lua @@ -147,7 +147,13 @@ do --> return the wallpaper for the raid instance function _detalhes:GetRaidBackground (mapid) - return _detalhes.EncounterInformation [mapid] and _detalhes.EncounterInformation [mapid].background + local bosstables = _detalhes.EncounterInformation [mapid] + if (bosstables) then + local bg = bosstables.backgroundFile + if (bg) then + return bg.file, unpack (bg.coords) + end + end end --> return the icon for the raid instance function _detalhes:GetRaidIcon (mapid) diff --git a/functions/classes.lua b/functions/classes.lua index 8bb0d8ba..69a2fa86 100644 --- a/functions/classes.lua +++ b/functions/classes.lua @@ -118,5 +118,10 @@ do function _detalhes:Class (actor) return self.classe or actor.classe end - + function _detalhes:GetActorSpells() + return self.spell_tables._ActorTable + end + function _detalhes:GetSpell (spellid) + return self.spell_tables._ActorTable [spellid] + end end diff --git a/functions/profiles.lua b/functions/profiles.lua index d39ebf03..5949ac50 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -804,6 +804,7 @@ _detalhes.default_profile = default_profile local default_player_data = { --> current combat number combat_id = 0, + combat_counter = 0, --> nicktag cache nick_tag_cache = {}, --> plugin data diff --git a/functions/timedata.lua b/functions/timedata.lua index 15992340..19bf4dcc 100644 --- a/functions/timedata.lua +++ b/functions/timedata.lua @@ -70,6 +70,10 @@ this_capture [INDEX_ENABLED] = this_capture [INDEX_ENABLED] end + if (_G.DetailsOptionsWindow and _G.DetailsOptionsWindow:IsShown()) then + _G.DetailsOptionsWindow16UserTimeCapturesFillPanel.MyObject:Refresh() + end + return true end @@ -131,11 +135,17 @@ --> unregister function _detalhes:TimeDataUnregister (name) if (type (name) == "number") then - return tremove (_detalhes.savedTimeCaptures, name) + tremove (_detalhes.savedTimeCaptures, name) + if (_G.DetailsOptionsWindow and _G.DetailsOptionsWindow:IsShown()) then + _G.DetailsOptionsWindow16UserTimeCapturesFillPanel.MyObject:Refresh() + end else for index, t in ipairs (_detalhes.savedTimeCaptures) do if (t [INDEX_NAME] == name) then tremove (_detalhes.savedTimeCaptures, index) + if (_G.DetailsOptionsWindow and _G.DetailsOptionsWindow:IsShown()) then + _G.DetailsOptionsWindow16UserTimeCapturesFillPanel.MyObject:Refresh() + end return true end end diff --git a/gumps/janela_custom.lua b/gumps/janela_custom.lua index 558a0bca..2826171b 100644 --- a/gumps/janela_custom.lua +++ b/gumps/janela_custom.lua @@ -91,10 +91,16 @@ custom_window:SetSize (850, 370) custom_window:EnableMouse (true) custom_window:SetMovable (true) - custom_window:SetScript ("OnMouseDown", function (self) - if (not self.moving) then - self.moving = true - self:StartMoving() + custom_window:SetScript ("OnMouseDown", function (self, button) + if (button == "LeftButton") then + if (not self.moving) then + self.moving = true + self:StartMoving() + end + elseif (button == "RightButton") then + if (not self.moving) then + _detalhes:CloseCustomDisplayWindow() + end end end) custom_window:SetScript ("OnMouseUp", function (self) diff --git a/gumps/janela_info.lua b/gumps/janela_info.lua index 4b8af0ba..a71d4eff 100644 --- a/gumps/janela_info.lua +++ b/gumps/janela_info.lua @@ -363,78 +363,42 @@ end --> seta os scripts da janela de informações +local mouse_down_func = function (self, button) + if (button == "LeftButton") then + info:StartMoving() + info.isMoving = true + elseif (button == "RightButton" and not self.isMoving) then + _detalhes:FechaJanelaInfo() + end +end + +local mouse_up_func = function (self, button) + if (info.isMoving) then + info:StopMovingOrSizing() + info.isMoving = false + end +end + ------------------------------------------------------------------------------------------------------------------------------ local function seta_scripts (este_gump) --> Janela - este_gump:SetScript ("OnMouseDown", - function (self, botao) - if (botao == "LeftButton") then - self:StartMoving() - self.isMoving = true - end - end) - - este_gump:SetScript ("OnMouseUp", - function (self) - if (self.isMoving) then - self:StopMovingOrSizing() - self.isMoving = false - end - end) - - este_gump.container_barras.gump:SetScript ("OnMouseDown", - function (self, botao) - if (botao == "LeftButton") then - este_gump:StartMoving() - este_gump.isMoving = true - end - end) - - este_gump.container_barras.gump:SetScript ("OnMouseUp", - function (self) - if (este_gump.isMoving) then - este_gump:StopMovingOrSizing() - este_gump.isMoving = false - end - end) - - este_gump.container_detalhes:SetScript ("OnMouseDown", - function (self, botao) - if (botao == "LeftButton") then - este_gump:StartMoving() - este_gump.isMoving = true - end - end) - - este_gump.container_detalhes:SetScript ("OnMouseUp", - function (self) - if (este_gump.isMoving) then - este_gump:StopMovingOrSizing() - este_gump.isMoving = false - end - end) + este_gump:SetScript ("OnMouseDown", mouse_down_func) + este_gump:SetScript ("OnMouseUp", mouse_up_func) - este_gump.container_alvos.gump:SetScript ("OnMouseDown", - function (self, botao) - if (botao == "LeftButton") then - este_gump:StartMoving() - este_gump.isMoving = true - end - end) + este_gump.container_barras.gump:SetScript ("OnMouseDown", mouse_down_func) + este_gump.container_barras.gump:SetScript ("OnMouseUp", mouse_up_func) - este_gump.container_alvos.gump:SetScript ("OnMouseUp", - function (self) - if (este_gump.isMoving) then - este_gump:StopMovingOrSizing() - este_gump.isMoving = false - end - end) + este_gump.container_detalhes:SetScript ("OnMouseDown", mouse_down_func) + este_gump.container_detalhes:SetScript ("OnMouseUp", mouse_up_func) + + este_gump.container_alvos.gump:SetScript ("OnMouseDown", mouse_down_func) + este_gump.container_alvos.gump:SetScript ("OnMouseUp", mouse_up_func) --> botão fechar - este_gump.fechar:SetScript ("OnClick", function(self) - _detalhes:FechaJanelaInfo() - end) + este_gump.fechar:SetScript ("OnClick", function (self) + _detalhes:FechaJanelaInfo() + end) end @@ -453,7 +417,28 @@ end --> cria a barra de detalhes a direita da janela de informações ------------------------------------------------------------------------------------------------------------------------------ + +local detalhe_infobg_onenter = function (self) + gump:Fade (self.overlay, "OUT") + gump:Fade (self.reportar, "OUT") +end + +local detalhe_infobg_onleave = function (self) + gump:Fade (self.overlay, "IN") + gump:Fade (self.reportar, "IN") +end + +local detalhes_inforeport_onenter = function (self) + gump:Fade (self:GetParent().overlay, "OUT") + gump:Fade (self, "OUT") +end +local detalhes_inforeport_onleave = function (self) + gump:Fade (self:GetParent().overlay, "IN") + gump:Fade (self, "IN") +end + function gump:CriaDetalheInfo (index) + local info = {} info.nome = _detalhes.janela_info.container_detalhes:CreateFontString (nil, "OVERLAY", "GameFontHighlightSmall") info.nome2 = _detalhes.janela_info.container_detalhes:CreateFontString (nil, "OVERLAY", "GameFontHighlightSmall") @@ -483,38 +468,15 @@ function gump:CriaDetalheInfo (index) info.bg.reportar:SetPoint ("BOTTOMLEFT", info.bg.overlay, "BOTTOMRIGHT", -33, 10) gump:Fade (info.bg.reportar, 1) - info.bg:SetScript ("OnEnter", - function(self) - gump:Fade (self.overlay, "OUT") - gump:Fade (self.reportar, "OUT") - end) - info.bg:SetScript ("OnLeave", - function(self) - gump:Fade (self.overlay, "IN") - gump:Fade (self.reportar, "IN") - end) + info.bg:SetScript ("OnEnter", detalhe_infobg_onenter) + info.bg:SetScript ("OnLeave", detalhe_infobg_onleave) + + info.bg.reportar:SetScript ("OnEnter", detalhes_inforeport_onenter) + info.bg.reportar:SetScript ("OnLeave", detalhes_inforeport_onleave) - info.bg.reportar:SetScript ("OnEnter", - function(self) - gump:Fade (info.bg.overlay, "OUT") - gump:Fade (self, "OUT") - end) - info.bg.reportar:SetScript ("OnLeave", - function(self) - gump:Fade (info.bg.overlay, "IN") - gump:Fade (self, "IN") - end) - info.bg_end = info.bg:CreateTexture (nil, "BACKGROUND") info.bg_end:SetHeight (47) - --este_gump.bg4:SetPoint ("BOTTOMRIGHT", este_gump, "BOTTOMRIGHT", 0, 0) - --este_gump.bg4:SetWidth (128) - --este_gump.bg4:SetHeight (256) info.bg_end:SetTexture ("Interface\\AddOns\\Details\\images\\bar_detalhes2_end") - --info.bg = _detalhes.janela_info.container_detalhes:CreateTexture (nil, "BACKGROUND") - --info.bg:SetWidth (400) - --info.bg:SetHeight (70) - --info.bg:SetTexture ("Interface\\MONEYFRAME\\UI-MoneyFrame2") _detalhes.janela_info.grupos_detalhes [index] = info end @@ -3384,6 +3346,79 @@ local row_on_leave = function (self) end end +local row_on_mousedown = function (self) + if (self.fading_in) then + return + end + + self.mouse_down = _GetTime() + local x, y = _GetCursorPosition() + self.x = _math_floor (x) + self.y = _math_floor (y) + + if ((not info.isLocked) or (info.isLocked == 0)) then + info:StartMoving() + info.isMoving = true + end +end + +local row_on_mouseup = function (self) + if (self.fading_in) then + return + end + + if (info.isMoving) then + info:StopMovingOrSizing() + info.isMoving = false + end + + local x, y = _GetCursorPosition() + x = _math_floor (x) + y = _math_floor (y) + if ((self.mouse_down+0.4 > _GetTime() and (x == self.x and y == self.y)) or (x == self.x and y == self.y)) then + --> setar os textos + + if (self.isMain) then --> se não for uma barra de alvo + + local barra_antiga = info.mostrando + if (barra_antiga and not info.mostrando_mouse_over) then + + barra_antiga.textura:SetStatusBarColor (1, 1, 1, 1) --> volta a textura normal + barra_antiga.on_focus = false --> não esta mais no foco + + --> CLICOU NA MESMA BARRA + if (barra_antiga == self) then --> + info.mostrando_mouse_over = true + return + + --> CLICOU EM OUTRA BARRA + else --> clicou em outra barra e trocou o foco + barra_antiga:SetAlpha (.9) --> volta a alfa antiga + + info.mostrando = self + info.showing = i + + info.jogador.detalhes = self.show + info.jogador:MontaDetalhes (self.show, self) + + self:SetAlpha (1) + self.textura:SetStatusBarColor (129/255, 125/255, 69/255, 1) + self.on_focus = true + return + end + end + + --> NÃO TINHA BARRAS PRECIONADAS + -- info.mostrando = self + info.mostrando_mouse_over = false + self:SetAlpha (1) + self.textura:SetStatusBarColor (129/255, 125/255, 69/255, 1) + self.on_focus = true + end + + end +end + local function SetBarraScripts (esta_barra, instancia, i) esta_barra._index = i @@ -3391,85 +3426,9 @@ local function SetBarraScripts (esta_barra, instancia, i) esta_barra:SetScript ("OnEnter", row_on_enter) esta_barra:SetScript ("OnLeave", row_on_leave) - esta_barra:SetScript ("OnMouseDown", function (self) - - if (self.fading_in) then - return - end - - self.mouse_down = _GetTime() - local x, y = _GetCursorPosition() - self.x = _math_floor (x) - self.y = _math_floor (y) - - if ((not info.isLocked) or (info.isLocked == 0)) then - info:StartMoving() - info.isMoving = true - end - - end) - - esta_barra:SetScript ("OnMouseUp", function (self) + esta_barra:SetScript ("OnMouseDown", row_on_mousedown) + esta_barra:SetScript ("OnMouseUp", row_on_mouseup) - if (self.fading_in) then - return - end - - if (info.isMoving) then - info:StopMovingOrSizing() - info.isMoving = false - --instancia:SaveMainWindowPosition() --> precisa fazer algo pra salvar o trem - end - - local x, y = _GetCursorPosition() - x = _math_floor (x) - y = _math_floor (y) - if ((self.mouse_down+0.4 > _GetTime() and (x == self.x and y == self.y)) or (x == self.x and y == self.y)) then - --> setar os textos - - if (self.isMain) then --> se não for uma barra de alvo - - local barra_antiga = info.mostrando --> ?? - - --> on_focus = quando a barra esta precionada - - if (barra_antiga and not info.mostrando_mouse_over) then - - barra_antiga.textura:SetStatusBarColor (1, 1, 1, 1) --> volta a textura normal - barra_antiga.on_focus = false --> não esta mais no foco - - --> CLICOU NA MESMA BARRA - if (barra_antiga == self) then --> - info.mostrando_mouse_over = true - return - - --> CLICOU EM OUTRA BARRA - else --> clicou em outra barra e trocou o foco - barra_antiga:SetAlpha (.9) --> volta a alfa antiga - - info.mostrando = self - info.showing = i - - info.jogador.detalhes = self.show - info.jogador:MontaDetalhes (self.show, self) - - self:SetAlpha (1) - self.textura:SetStatusBarColor (129/255, 125/255, 69/255, 1) - self.on_focus = true - return - end - end - - --> NÃO TINHA BARRAS PRECIONADAS - -- info.mostrando = self - info.mostrando_mouse_over = false - self:SetAlpha (1) - self.textura:SetStatusBarColor (129/255, 125/255, 69/255, 1) - self.on_focus = true - end - - end - end) end local function CriaTexturaBarra (instancia, barra) diff --git a/gumps/janela_principal.lua b/gumps/janela_principal.lua index 15162470..e8e010c4 100644 --- a/gumps/janela_principal.lua +++ b/gumps/janela_principal.lua @@ -661,52 +661,56 @@ local function move_janela (baseframe, iniciando, instancia) end _detalhes.move_janela_func = move_janela -local function BGFrame_scripts (BG, baseframe, instancia) - - BG:SetScript("OnEnter", function (self) - OnEnterMainWindow (instancia, self) - end) - - BG:SetScript("OnLeave", function (self) - OnLeaveMainWindow (instancia, self) - end) - - BG:SetScript ("OnMouseDown", function (frame, button) - if (baseframe.isMoving) then - move_janela (baseframe, false, instancia) - instancia:SaveMainWindowPosition() - return - end - - if (not baseframe.isLocked and button == "LeftButton") then - move_janela (baseframe, true, instancia) --> novo movedor da janela - if (BG.is_toolbar) then - if (instancia.attribute_text.enabled and instancia.attribute_text.side == 1 and instancia.toolbar_side == 1) then - instancia.menu_attribute_string:SetPoint ("bottomleft", instancia.baseframe.cabecalho.ball, "bottomright", instancia.attribute_text.anchor [1]+1, instancia.attribute_text.anchor [2]-1) - end - end - elseif (button == "RightButton") then - if (_detalhes.switch.current_instancia and _detalhes.switch.current_instancia == instancia) then - _detalhes.switch:CloseMe() - else - _detalhes.switch:ShowMe (instancia) - end - end - end) - - BG:SetScript ("OnMouseUp", function (frame) - if (baseframe.isMoving) then - move_janela (baseframe, false, instancia) --> novo movedor da janela - instancia:SaveMainWindowPosition() - if (BG.is_toolbar) then - if (instancia.attribute_text.enabled and instancia.attribute_text.side == 1 and instancia.toolbar_side == 1) then - instancia.menu_attribute_string:SetPoint ("bottomleft", instancia.baseframe.cabecalho.ball, "bottomright", instancia.attribute_text.anchor [1], instancia.attribute_text.anchor [2]) - end - end - end - end) +local BGFrame_scripts_onenter = function (self) + OnEnterMainWindow (self._instance, self) end +local BGFrame_scripts_onleave = function (self) + OnLeaveMainWindow (self._instance, self) +end + +local BGFrame_scripts_onmousedown = function (self, button) + if (self._instance.baseframe.isMoving) then + move_janela (self._instance.baseframe, false, self._instance) + self._instance:SaveMainWindowPosition() + return + end + + if (not self._instance.baseframe.isLocked and button == "LeftButton") then + move_janela (self._instance.baseframe, true, self._instance) + if (self.is_toolbar) then + if (self._instance.attribute_text.enabled and self._instance.attribute_text.side == 1 and self._instance.toolbar_side == 1) then + self._instance.menu_attribute_string:SetPoint ("bottomleft", self._instance.baseframe.cabecalho.ball, "bottomright", self._instance.attribute_text.anchor [1]+1, self._instance.attribute_text.anchor [2]-1) + end + end + elseif (button == "RightButton") then + if (_detalhes.switch.current_instancia and _detalhes.switch.current_instancia == self._instance) then + _detalhes.switch:CloseMe() + else + _detalhes.switch:ShowMe (self._instance) + end + end +end + +local BGFrame_scripts_onmouseup = function (self, button) + if (self._instance.baseframe.isMoving) then + move_janela (self._instance.baseframe, false, self._instance) --> novo movedor da janela + self._instance:SaveMainWindowPosition() + if (self.is_toolbar) then + if (self._instance.attribute_text.enabled and self._instance.attribute_text.side == 1 and self._instance.toolbar_side == 1) then + self._instance.menu_attribute_string:SetPoint ("bottomleft", self._instance.baseframe.cabecalho.ball, "bottomright", self._instance.attribute_text.anchor [1], self._instance.attribute_text.anchor [2]) + end + end + end +end + +local function BGFrame_scripts (BG, baseframe, instancia) + BG._instance = instancia + BG:SetScript ("OnEnter", BGFrame_scripts_onenter) + BG:SetScript ("OnLeave", BGFrame_scripts_onleave) + BG:SetScript ("OnMouseDown", BGFrame_scripts_onmousedown) + BG:SetScript ("OnMouseUp", BGFrame_scripts_onmouseup) +end function gump:RegisterForDetailsMove (frame, instancia) @@ -725,36 +729,41 @@ function gump:RegisterForDetailsMove (frame, instancia) end --> scripts do base frame +local BFrame_scripts_onsizechange = function (self) + self._instance:SaveMainWindowPosition() + self._instance:ReajustaGump() + self._instance.oldwith = self:GetWidth() + _detalhes:SendEvent ("DETAILS_INSTANCE_SIZECHANGED", nil, self._instance) +end + +local BFrame_scripts_onenter = function (self) + OnEnterMainWindow (self._instance, self) +end + +local BFrame_scripts_onleave = function (self) + OnLeaveMainWindow (self._instance, self) +end + +local BFrame_scripts_onmousedown = function (self, button) + if (not self.isLocked and button == "LeftButton") then + move_janela (self, true, self._instance) + end +end + +local BFrame_scripts_onmouseup = function (self, button) + if (self.isMoving) then + move_janela (self, false, self._instance) --> novo movedor da janela + self._instance:SaveMainWindowPosition() + end +end + local function BFrame_scripts (baseframe, instancia) - - baseframe:SetScript("OnSizeChanged", function (self) - instancia:SaveMainWindowPosition() - instancia:ReajustaGump() - instancia.oldwith = baseframe:GetWidth() - _detalhes:SendEvent ("DETAILS_INSTANCE_SIZECHANGED", nil, instancia) - end) - - baseframe:SetScript("OnEnter", function (self) - OnEnterMainWindow (instancia, self) - end) - - baseframe:SetScript("OnLeave", function (self) - OnLeaveMainWindow (instancia, self) - end) - - baseframe:SetScript ("OnMouseDown", function (frame, button) - if (not baseframe.isLocked and button == "LeftButton") then - move_janela (baseframe, true, instancia) --> novo movedor da janela - end - end) - - baseframe:SetScript ("OnMouseUp", function (frame) - if (baseframe.isMoving) then - move_janela (baseframe, false, instancia) --> novo movedor da janela - instancia:SaveMainWindowPosition() - end - end) - + baseframe._instance = instancia + baseframe:SetScript("OnSizeChanged", BFrame_scripts_onsizechange) + baseframe:SetScript("OnEnter", BFrame_scripts_onenter) + baseframe:SetScript("OnLeave", BFrame_scripts_onleave) + baseframe:SetScript ("OnMouseDown", BFrame_scripts_onmousedown) + baseframe:SetScript ("OnMouseUp", BFrame_scripts_onmouseup) end local function backgrounddisplay_scripts (backgrounddisplay, baseframe, instancia) @@ -1036,200 +1045,206 @@ local resizeTooltip = { } --> search key: ~resizescript + +local resize_scripts_onmousedown = function (self, button) + _G.GameCooltip:ShowMe (false) --> Hide Cooltip + + if (not self:GetParent().isLocked and button == "LeftButton" and self._instance.modo ~= _detalhes._detalhes_props["MODO_ALONE"]) then + self:GetParent().isResizing = true + self._instance:BaseFrameSnap() + + local isVertical = self._instance.verticalSnap + local isHorizontal = self._instance.horizontalSnap + + local agrupadas + if (self._instance.verticalSnap) then + agrupadas = self._instance:InstanciasVerticais() + elseif (self._instance.horizontalSnap) then + agrupadas = self._instance:InstanciasHorizontais() + end + + self._instance.stretchToo = agrupadas + if (self._instance.stretchToo and #self._instance.stretchToo > 0) then + for _, esta_instancia in ipairs (self._instance.stretchToo) do + esta_instancia.baseframe._place = esta_instancia:SaveMainWindowPosition() + esta_instancia.baseframe.isResizing = true + end + end + + ---------------- + + if (self._myside == "<") then + if (_IsShiftKeyDown()) then + self._instance.baseframe:StartSizing("left") + self._instance.eh_horizontal = true + elseif (_IsAltKeyDown()) then + self._instance.baseframe:StartSizing("top") + self._instance.eh_vertical = true + elseif (_IsControlKeyDown()) then + self._instance.baseframe:StartSizing("bottomleft") + self._instance.eh_tudo = true + else + self._instance.baseframe:StartSizing("bottomleft") + end + + self:SetPoint ("bottomleft", self._instance.baseframe, "bottomleft", -1, -1) + self.afundado = true + + elseif (self._myside == ">") then + if (_IsShiftKeyDown()) then + self._instance.baseframe:StartSizing ("right") + self._instance.eh_horizontal = true + elseif (_IsAltKeyDown()) then + self._instance.baseframe:StartSizing ("top") + self._instance.eh_vertical = true + elseif (_IsControlKeyDown()) then + self._instance.baseframe:StartSizing ("bottomright") + self._instance.eh_tudo = true + else + self._instance.baseframe:StartSizing ("bottomright") + end + + if (self._instance.rolagem and _detalhes.use_scroll) then + self:SetPoint ("bottomright", self._instance.baseframe, "bottomright", (self._instance.largura_scroll*-1) + 1, -1) + else + self:SetPoint ("bottomright", self._instance.baseframe, "bottomright", 1, -1) + end + self.afundado = true + end + + _detalhes:SendEvent ("DETAILS_INSTANCE_STARTRESIZE", nil, self._instance) + + end +end + +local resize_scripts_onmouseup = function (self, button) + + if (self.afundado) then + self.afundado = false + if (self._myside == ">") then + if (self._instance.rolagem and _detalhes.use_scroll) then + self:SetPoint ("bottomright", self._instance.baseframe, "bottomright", self._instance.largura_scroll*-1, 0) + else + self:SetPoint ("bottomright", self._instance.baseframe, "bottomright", 0, 0) + end + else + self:SetPoint ("bottomleft", self._instance.baseframe, "bottomleft", 0, 0) + end + end + + if (self:GetParent().isResizing) then + + self:GetParent():StopMovingOrSizing() + self:GetParent().isResizing = false + + if (self._instance.stretchToo and #self._instance.stretchToo > 0) then + for _, esta_instancia in ipairs (self._instance.stretchToo) do + esta_instancia.baseframe:StopMovingOrSizing() + esta_instancia.baseframe.isResizing = false + esta_instancia:ReajustaGump() + _detalhes:SendEvent ("DETAILS_INSTANCE_SIZECHANGED", nil, esta_instancia) + end + self._instance.stretchToo = nil + end + + local largura = self._instance.baseframe:GetWidth() + local altura = self._instance.baseframe:GetHeight() + + if (self._instance.eh_horizontal) then + instancias_horizontais (self._instance, largura, true, true) + self._instance.eh_horizontal = nil + end + + --if (instancia.eh_vertical) then + instancias_verticais (self._instance, altura, true, true) + self._instance.eh_vertical = nil + --end + + _detalhes:SendEvent ("DETAILS_INSTANCE_ENDRESIZE", nil, self._instance) + + if (self._instance.eh_tudo) then + for _, esta_instancia in _ipairs (_detalhes.tabela_instancias) do + if (esta_instancia:IsAtiva() and esta_instancia.modo ~= _detalhes._detalhes_props["MODO_ALONE"]) then + esta_instancia.baseframe:ClearAllPoints() + esta_instancia:SaveMainWindowPosition() + esta_instancia:RestoreMainWindowPosition() + end + end + + for _, esta_instancia in _ipairs (_detalhes.tabela_instancias) do + if (esta_instancia:IsAtiva() and esta_instancia ~= self._instance and esta_instancia.modo ~= _detalhes._detalhes_props["MODO_ALONE"]) then + esta_instancia.baseframe:SetWidth (largura) + esta_instancia.baseframe:SetHeight (altura) + esta_instancia.auto_resize = true + esta_instancia:ReajustaGump() + esta_instancia.auto_resize = false + _detalhes:SendEvent ("DETAILS_INSTANCE_SIZECHANGED", nil, esta_instancia) + end + end + + self._instance.eh_tudo = nil + end + + self._instance:BaseFrameSnap() + + for _, esta_instancia in _ipairs (_detalhes.tabela_instancias) do + if (esta_instancia:IsAtiva()) then + esta_instancia:SaveMainWindowPosition() + esta_instancia:RestoreMainWindowPosition() + end + end + end +end + +local resize_scripts_onhide = function (self) + if (self.going_hide) then + _G.GameCooltip:ShowMe (false) + self.going_hide = nil + end +end + +local resize_scripts_onenter = function (self) + if (self._instance.modo ~= _detalhes._detalhes_props["MODO_ALONE"] and not self._instance.baseframe.isLocked and not self.mostrando) then + + OnEnterMainWindow (self._instance, self) + + self.texture:SetBlendMode ("ADD") + self.mostrando = true + + GameCooltip:Reset() + GameCooltip:SetType ("tooltip") + GameCooltip:AddFromTable (resizeTooltip) + GameCooltip:SetOption ("TextSize", _detalhes.font_sizes.menus) + GameCooltip:SetOption ("NoLastSelectedBar", true) + GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) + GameCooltip:SetOwner (self) + GameCooltip:ShowCooltip() + end +end + +local resize_scripts_onleave = function (self) + if (self.mostrando) then + self.going_hide = true + if (not self.movendo) then + OnLeaveMainWindow (self._instance, self) + end + + self.texture:SetBlendMode ("BLEND") + self.mostrando = false + + GameCooltip:ShowMe (false) + end +end + local function resize_scripts (resizer, instancia, scrollbar, side, baseframe) + resizer._instance = instancia + resizer._myside = side - resizer:SetScript ("OnMouseDown", function (self, button) - - _G.GameCooltip:ShowMe (false) --> Hide Cooltip - - if (not self:GetParent().isLocked and button == "LeftButton" and instancia.modo ~= _detalhes._detalhes_props["MODO_ALONE"]) then - self:GetParent().isResizing = true - instancia:BaseFrameSnap() - - local isVertical = instancia.verticalSnap - local isHorizontal = instancia.horizontalSnap - - local agrupadas - if (instancia.verticalSnap) then - agrupadas = instancia:InstanciasVerticais() - elseif (instancia.horizontalSnap) then - agrupadas = instancia:InstanciasHorizontais() - end - - instancia.stretchToo = agrupadas - if (instancia.stretchToo and #instancia.stretchToo > 0) then - for _, esta_instancia in ipairs (instancia.stretchToo) do - esta_instancia.baseframe._place = esta_instancia:SaveMainWindowPosition() - esta_instancia.baseframe.isResizing = true - end - end - - ---------------- - - if (side == "<") then - if (_IsShiftKeyDown()) then - instancia.baseframe:StartSizing("left") - instancia.eh_horizontal = true - elseif (_IsAltKeyDown()) then - instancia.baseframe:StartSizing("top") - instancia.eh_vertical = true - elseif (_IsControlKeyDown()) then - instancia.baseframe:StartSizing("bottomleft") - instancia.eh_tudo = true - else - instancia.baseframe:StartSizing("bottomleft") - end - - resizer:SetPoint ("bottomleft", baseframe, "bottomleft", -1, -1) - resizer.afundado = true - - elseif (side == ">") then - if (_IsShiftKeyDown()) then - instancia.baseframe:StartSizing("right") - instancia.eh_horizontal = true - elseif (_IsAltKeyDown()) then - instancia.baseframe:StartSizing("top") - instancia.eh_vertical = true - elseif (_IsControlKeyDown()) then - instancia.baseframe:StartSizing("bottomright") - instancia.eh_tudo = true - else - instancia.baseframe:StartSizing("bottomright") - end - - if (instancia.rolagem and _detalhes.use_scroll) then - resizer:SetPoint ("bottomright", baseframe, "bottomright", (instancia.largura_scroll*-1) + 1, -1) - else - resizer:SetPoint ("bottomright", baseframe, "bottomright", 1, -1) - end - resizer.afundado = true - end - - _detalhes:SendEvent ("DETAILS_INSTANCE_STARTRESIZE", nil, instancia) - - end - end) - - resizer:SetScript ("OnMouseUp", function (self,button) - - if (resizer.afundado) then - resizer.afundado = false - if (resizer.side == 2) then - if (instancia.rolagem and _detalhes.use_scroll) then - resizer:SetPoint ("bottomright", baseframe, "bottomright", instancia.largura_scroll*-1, 0) - else - resizer:SetPoint ("bottomright", baseframe, "bottomright", 0, 0) - end - else - resizer:SetPoint ("bottomleft", baseframe, "bottomleft", 0, 0) - end - end - - if (self:GetParent().isResizing) then - - self:GetParent():StopMovingOrSizing() - self:GetParent().isResizing = false - - if (instancia.stretchToo and #instancia.stretchToo > 0) then - for _, esta_instancia in ipairs (instancia.stretchToo) do - esta_instancia.baseframe:StopMovingOrSizing() - esta_instancia.baseframe.isResizing = false - esta_instancia:ReajustaGump() - _detalhes:SendEvent ("DETAILS_INSTANCE_SIZECHANGED", nil, esta_instancia) - end - instancia.stretchToo = nil - end - - local largura = instancia.baseframe:GetWidth() - local altura = instancia.baseframe:GetHeight() - - if (instancia.eh_horizontal) then - instancias_horizontais (instancia, largura, true, true) - instancia.eh_horizontal = nil - end - - --if (instancia.eh_vertical) then - instancias_verticais (instancia, altura, true, true) - instancia.eh_vertical = nil - --end - - _detalhes:SendEvent ("DETAILS_INSTANCE_ENDRESIZE", nil, instancia) - - if (instancia.eh_tudo) then - for _, esta_instancia in _ipairs (_detalhes.tabela_instancias) do - if (esta_instancia:IsAtiva() and esta_instancia.modo ~= _detalhes._detalhes_props["MODO_ALONE"]) then - esta_instancia.baseframe:ClearAllPoints() - esta_instancia:SaveMainWindowPosition() - esta_instancia:RestoreMainWindowPosition() - end - end - - for _, esta_instancia in _ipairs (_detalhes.tabela_instancias) do - if (esta_instancia:IsAtiva() and esta_instancia ~= instancia and esta_instancia.modo ~= _detalhes._detalhes_props["MODO_ALONE"]) then - esta_instancia.baseframe:SetWidth (largura) - esta_instancia.baseframe:SetHeight (altura) - esta_instancia.auto_resize = true - esta_instancia:ReajustaGump() - esta_instancia.auto_resize = false - _detalhes:SendEvent ("DETAILS_INSTANCE_SIZECHANGED", nil, esta_instancia) - end - end - - instancia.eh_tudo = nil - end - - instancia:BaseFrameSnap() - - for _, esta_instancia in _ipairs (_detalhes.tabela_instancias) do - if (esta_instancia:IsAtiva()) then - esta_instancia:SaveMainWindowPosition() - esta_instancia:RestoreMainWindowPosition() - end - end - end - end) - - resizer:SetScript ("OnHide", function (self) - if (self.going_hide) then - _G.GameCooltip:ShowMe (false) - self.going_hide = nil - end - end) - - resizer:SetScript ("OnEnter", function (self) - if (instancia.modo ~= _detalhes._detalhes_props["MODO_ALONE"] and not instancia.baseframe.isLocked and not self.mostrando) then - - OnEnterMainWindow (instancia, self) - - self.texture:SetBlendMode ("ADD") - self.mostrando = true - - GameCooltip:Reset() - GameCooltip:SetType ("tooltip") - GameCooltip:AddFromTable (resizeTooltip) - GameCooltip:SetOption ("TextSize", _detalhes.font_sizes.menus) - GameCooltip:SetOption ("NoLastSelectedBar", true) - GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) - GameCooltip:SetOwner (resizer) - GameCooltip:ShowCooltip() - end - end) - - resizer:SetScript ("OnLeave", function (self) - - if (self.mostrando) then - - resizer.going_hide = true - if (not self.movendo) then - OnLeaveMainWindow (instancia, self) - end - - self.texture:SetBlendMode ("BLEND") - self.mostrando = false - - GameCooltip:ShowMe (false) - end - end) + resizer:SetScript ("OnMouseDown", resize_scripts_onmousedown) + resizer:SetScript ("OnMouseUp", resize_scripts_onmouseup) + resizer:SetScript ("OnHide", resize_scripts_onhide) + resizer:SetScript ("OnEnter", resize_scripts_onenter) + resizer:SetScript ("OnLeave", resize_scripts_onleave) end local lockButtonTooltip = { @@ -1392,161 +1407,159 @@ local on_switch_show = function (instance) return true end -local function barra_scripts (esta_barra, instancia, i) +local barra_backdrop_onenter = { + bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], + tile = true, tileSize = 16, + insets = {left = 1, right = 1, top = 0, bottom = 1} +} +local barra_backdrop_onleave = { + bgFile = "", + edgeFile = "", tile = true, tileSize = 16, edgeSize = 32, + insets = {left = 1, right = 1, top = 0, bottom = 1} +} - esta_barra:SetScript ("OnEnter", function (self) - self.mouse_over = true - OnEnterMainWindow (instancia, esta_barra) +local barra_scripts_onenter = function (self) + self.mouse_over = true + OnEnterMainWindow (self._instance, self) - instancia:MontaTooltip (self, i) - - self:SetBackdrop({ - bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], - tile = true, tileSize = 16, - insets = {left = 1, right = 1, top = 0, bottom = 1},}) - self:SetBackdropColor (0.588, 0.588, 0.588, 0.7) - - self:SetScript ("OnUpdate", shift_monitor) - - end) - - esta_barra:SetScript ("OnLeave", function (self) - self.mouse_over = false - OnLeaveMainWindow (instancia, self) - - _GameTooltip:Hide() - _G.GameCooltip:ShowMe (false) - - self:SetBackdrop({ - bgFile = "", edgeFile = "", tile = true, tileSize = 16, edgeSize = 32, - insets = {left = 1, right = 1, top = 0, bottom = 1},}) - - self:SetBackdropBorderColor (0, 0, 0, 0) - self:SetBackdropColor (0, 0, 0, 0) - - self.showing_allspells = false - self:SetScript ("OnUpdate", nil) - - end) - - esta_barra:SetScript ("OnMouseDown", function (self, button) - - if (esta_barra.fading_in) then - return - end - - if (button == "RightButton") then - return _detalhes.switch:ShowMe (instancia) - - elseif (button == "MiddleButton") then - --> verifica se é damage taken - - elseif (button == "LeftButton") then + self._instance:MontaTooltip (self, self.row_id) - if (instancia.atributo == 1 and instancia.sub_atributo == 6) then --> enemies - - local inimigo = esta_barra.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 instancia:TrocaTabela (instancia.segmento, 5, index) + self:SetBackdrop (barra_backdrop_onenter) + self:SetBackdropColor (0.588, 0.588, 0.588, 0.7) + + self:SetScript ("OnUpdate", shift_monitor) +end + +local barra_scripts_onleave = function (self) + self.mouse_over = false + OnLeaveMainWindow (self._instance, self) + + _GameTooltip:Hide() + GameCooltip:ShowMe (false) + + self:SetBackdrop (barra_backdrop_onleave) + self:SetBackdropBorderColor (0, 0, 0, 0) + self:SetBackdropColor (0, 0, 0, 0) + + self.showing_allspells = false + self:SetScript ("OnUpdate", nil) +end + +local barra_scripts_onmousedown = function (self, button) + if (self.fading_in) then + return + end + + if (button == "RightButton") then + return _detalhes.switch:ShowMe (self._instance) + + --elseif (button == "MiddleButton") then + + 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 - - --> 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 instancia:TrocaTabela (instancia.segmento, 5, #_detalhes.custom) - --func, true, 5, index - - end - end - - esta_barra.texto_direita:SetPoint ("right", esta_barra.statusbar, "right", 1, -1) - if (instancia.row_info.no_icon) then - esta_barra.texto_esquerdo:SetPoint ("left", esta_barra.statusbar, "left", 3, -1) - else - esta_barra.texto_esquerdo:SetPoint ("left", esta_barra.icone_classe, "right", 4, -1) - end - - self.mouse_down = _GetTime() - self.button = button - local x, y = _GetCursorPosition() - self.x = _math_floor (x) - self.y = _math_floor (y) - - local parent = instancia.baseframe - if ((not parent.isLocked) or (parent.isLocked == 0)) then - GameCooltip:Hide() --> fecha o tooltip - move_janela (parent, true, instancia) --> novo movedor da janela - end - - end) - - esta_barra:SetScript ("OnMouseUp", function (self, button) - - local parent = instancia.baseframe - if (parent.isMoving) then - - move_janela (parent, false, instancia) --> novo movedor da janela - instancia:SaveMainWindowPosition() - _GameTooltip:SetOwner (self, "ANCHOR_TOPRIGHT") - if (instancia:MontaTooltip (self, i)) then - GameCooltip:Show (esta_barra, 1) 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) + if (self._instance.row_info.no_icon) then + self.texto_esquerdo:SetPoint ("left", self.statusbar, "left", 3, -1) + else + self.texto_esquerdo:SetPoint ("left", self.icone_classe, "right", 4, -1) + end + + self.mouse_down = _GetTime() + self.button = button + local x, y = _GetCursorPosition() + self.x = _math_floor (x) + self.y = _math_floor (y) + + if (not self._instance.baseframe.isLocked) then + GameCooltip:Hide() + move_janela (self._instance.baseframe, true, self._instance) + end +end + +local barra_scripts_onmouseup = function (self, button) + if (self._instance.baseframe.isMoving) then + move_janela (self._instance.baseframe, false, self._instance) + self._instance:SaveMainWindowPosition() + + if (self._instance:MontaTooltip (self, self.row_id)) then + GameCooltip:Show (self, 1) end + end - esta_barra.texto_direita:SetPoint ("right", esta_barra.statusbar, "right") - if (instancia.row_info.no_icon) then - esta_barra.texto_esquerdo:SetPoint ("left", esta_barra.statusbar, "left", 2, 0) - else - esta_barra.texto_esquerdo:SetPoint ("left", esta_barra.icone_classe, "right", 3, 0) - end - - local x, y = _GetCursorPosition() - x = _math_floor (x) - y = _math_floor (y) + self.texto_direita:SetPoint ("right", self.statusbar, "right") + if (self._instance.row_info.no_icon) then + self.texto_esquerdo:SetPoint ("left", self.statusbar, "left", 2, 0) + else + self.texto_esquerdo:SetPoint ("left", self.icone_classe, "right", 3, 0) + end + + local x, y = _GetCursorPosition() + x = _math_floor (x) + y = _math_floor (y) - 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 - --> a única maneira de abrir a janela de info é por aqui... - - if (self.button == "LeftButton" or self.button == "MiddleButton") then - if (instancia.atributo == 5 or _IsShiftKeyDown()) then - --> report - return _detalhes:ReportSingleLine (instancia, self) - end - instancia:AbreJanelaInfo (self.minha_tabela) + 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 + --> report + return _detalhes:ReportSingleLine (self._instance, self) end - + self._instance:AbreJanelaInfo (self.minha_tabela) end - end) + end +end - esta_barra:SetScript ("OnClick", function (self, button) +local barra_scripts_onclick = function (self, button) - end) +end + +local function barra_scripts (esta_barra, instancia, i) + esta_barra._instance = instancia + + esta_barra:SetScript ("OnEnter", barra_scripts_onenter) + esta_barra:SetScript ("OnLeave", barra_scripts_onleave) + esta_barra:SetScript ("OnMouseDown", barra_scripts_onmousedown) + esta_barra:SetScript ("OnMouseUp", barra_scripts_onmouseup) + esta_barra:SetScript ("OnClick", barra_scripts_onclick) end function _detalhes:ReportSingleLine (instancia, barra) diff --git a/plugins/Details_DpsTuning/Details_DpsTuning.lua b/plugins/Details_DpsTuning/Details_DpsTuning.lua new file mode 100644 index 00000000..d99468fe --- /dev/null +++ b/plugins/Details_DpsTuning/Details_DpsTuning.lua @@ -0,0 +1,1189 @@ +local Loc = LibStub ("AceLocale-3.0"):GetLocale ("Details") + +--> Main Plugin Object +local DpsTuningPlugin = _detalhes:NewPluginObject ("Details_DpsTuning") +--> Main Frame +local SDF = DpsTuningPlugin.Frame + +--> global pointers +local ClockTime = time --> lua library local +local ipairs = ipairs --> lua library local +local pairs = pairs --> lua library local +local floor = floor --> lua library local +local _cstr = string.format --> lua library local + +local GetSpellBonusDamage = GetSpellBonusDamage +local UnitAura = UnitAura --> wow api local +local GetTime = GetTime --> wow api local + +local _GetSpellInfo =_detalhes.getspellinfo --> details api local + +local function CreatePluginFrames() + + --> get the framework + local fw = _detalhes:GetFramework() + + --> player damage done chart code + local string_player_damage_done = [[ + + -- the goal of this script is get the current combat then get your character and extract your damage done. + -- the first thing to do is get the combat, so, we use here the command "_detalhes:GetCombat ( "overall" "current" or "segment number")" + + local current_combat = _detalhes:GetCombat ("current") --> getting the current combat + + -- the next step is request your character from the combat + -- to do this, we take the combat which here we named "current_combat" and tells what we want inside parentheses. + + local my_self = current_combat (DETAILS_ATTRIBUTE_DAMAGE, _detalhes.playername) + + -- _detalhes.playername holds the name of your character. + -- DETAILS_ATTRIBUTE_DAMAGE means we want the damage table, _HEAL _ENERGY _MISC is the other 3 tables. + + -- before we proceed, the result needs to be checked to make sure its a valid result. + + if (not my_self) then + return 0 -- the combat doesnt have *you*, this happens when you didn't deal any damage in the combat yet. + end + + -- now its time to get the total damage. + + local my_damage = my_self.total + + -- then finally return the amount to the capture. + + return my_damage + + ]] + + --> color for spell dps bars + DpsTuningPlugin.BarColor = {.4, .4, .4, .7} + + function DpsTuningPlugin:OnDetailsEvent (event, ...) + + if (event == "SHOW") then --> plugin shown on screen, actived + + SDF:SetResizable (false) --> cant resize, this is a fixed size + SDF:SetSize (300, 300) --> need to be 300x300 to fit details window + + --> create the frames on the first shown + if (not DpsTuningPlugin.frames_created) then + DpsTuningPlugin:BuildHeader() + DpsTuningPlugin:BuildSpellBars() + DpsTuningPlugin:BuildSummaryPanel() + DpsTuningPlugin:BuildBuffBlocks() + DpsTuningPlugin:BuildChartPanels() + + DpsTuningPlugin.frames_created = true + DpsTuningPlugin.Frame:Show() + + --tricky, localize members inside the plugin, so it doesn't need to lookup on _detalhes object every time + DpsTuningPlugin.playername = DpsTuningPlugin.playername + DpsTuningPlugin.comma_value = DpsTuningPlugin.comma_value + DpsTuningPlugin.ToK2 = DpsTuningPlugin.ToK2 + DpsTuningPlugin.Sort2 = DpsTuningPlugin.Sort2 + DpsTuningPlugin.Sort3 = DpsTuningPlugin.Sort3 + end + + --> we only want register the player damage done when the plugin is active + DpsTuningPlugin:TimeDataRegister ("Player Damage Done", string_player_damage_done, nil, "Spell Details", "v1.0", "Interface\\Icons\\INV_Fabric_Spellweave", true, true) + + elseif (event == "HIDE") then --> plugin hidded, disabled + + --> plugin is gone, unregister the chart + DpsTuningPlugin:TimeDataUnregister ("Player Damage Done") + + elseif (event == "DETAILS_STARTED") then + + --> triggered right after details finish run all ADDON_LOADED functions + local power = {} + for i = 1, 7 do + power [i] = {i, GetSpellBonusDamage (i)} + end + table.sort (power, DpsTuningPlugin.Sort2) + DpsTuningPlugin.PowerType = power [1][1] + + elseif (event == "REFRESH") then --> requested a refresh window + --> refresh window happens when there is a invalid combat, like a combat with less then 5 seconds. + --DpsTuningPlugin:Refresh() + + elseif (event == "COMBAT_PLAYER_ENTER") then + DpsTuningPlugin:OnCombatStart (...) + + elseif (event == "COMBAT_PLAYER_LEAVE") then + DpsTuningPlugin:OnCombatEnd (...) + + elseif (event == "PLUGIN_DISABLED") then + --> plugin got disabled on details options panel + + elseif (event == "PLUGIN_ENABLED") then + --> plugin got enabled on details options panel + + end + end + + function DpsTuningPlugin.GetActivityTime (thisspell, time) + if (thisspell.tempo_end) then --> o tempo do jogador esta trancado + local t = thisspell.tempo_end - thisspell.start + if (t < 6) then + t = 6 + end + return t + elseif (thisspell.onhold) then + local t = thisspell.delay - thisspell.start + if (t < 6) then + t = 6 + end + return t + else + if (thisspell.start == 0) then + return 6 + end + local t = time - thisspell.start + if (t < 6) then + if (DpsTuningPlugin.in_combat) then + local combat_time = DpsTuningPlugin.CurCombat:GetCombatTime() + if (combat_time < 6) then + return combat_time + end + end + t = 6 + end + return t + end + end + + local spells = {cur = 0} + local spell_activity = {} + local buff_activity = {} + local buff_graphic_data = {} + local spell_graphic_data = {} + local power_amount_chart_table = {} + power_amount_chart_table.max_value = 0 + + DpsTuningPlugin.FinishedAt = 0 + + function DpsTuningPlugin.RefreshSpells() + + if (DpsTuningPlugin.db.SpellBarsShowType == 1) then --> execution activity dps + + local now = ClockTime() + for spellid, spelltable in pairs (DpsTuningPlugin.CurPlayer:GetActorSpells()) do + + local this = spell_activity [spellid] + if (not this) then + local t = {} + t.total = spelltable.total + t.time = ClockTime() + t.start = t.time + t.tempo_end = nil + t.lastevent = t.time + spell_activity [spellid] = t + this = t + else + local lastdamage = this.total + if (lastdamage ~= spelltable.total) then + this.lastevent = now + end + + if (this.lastevent+6 < now) then + --hold + if (not this.onhold) then + this.delay = this.lastevent + if (this.delay < this.start) then + this.delay = this.start + end + this.onhold = true + end + else + --exec + if (this.onhold) then + local diff = now - this.delay - 2 + if (diff > 0) then + this.start = this.start + diff + end + this.onhold = nil + end + end + + this.total = spelltable.total + end + end + + local i = 0 + for spellid, spelltable in pairs (spell_activity) do + i = i + 1 + + if (not spells [i]) then + spells [i] = {} + end + + spells [i][1] = spellid + spells [i][2] = spelltable.total + spells [i][3] = DpsTuningPlugin.GetActivityTime (spelltable, now) + spells [i][4] = spells [i][2] / spells [i][3] --adps + end + + spells.cur = i + for o = #spells, i+1, -1 do + spells [o][1] = 0 + spells [o][2] = 0 + spells [o][3] = 0 + spells [o][4] = 0 + end + + table.sort (spells, DpsTuningPlugin.Sort4) + + DpsTuningPlugin.SpellList = spells + DpsTuningPlugin.SpellScroll:Update() + + elseif (DpsTuningPlugin.db.SpellBarsShowType == 2) then --> player activity dps + + local player_time = DpsTuningPlugin.CurPlayer:Tempo() + local i = 0 + + for spellid, spelltable in pairs (DpsTuningPlugin.CurPlayer:GetActorSpells()) do + i = i + 1 + + if (not spells [i]) then + spells [i] = {} + end + + spells [i][1] = spellid + spells [i][2] = spelltable.total + spells [i][3] = spelltable.total/player_time + end + + spells.cur = i + for o = #spells, i+1, -1 do + spells [o][1] = 0 + spells [o][2] = 0 + spells [o][3] = 0 + spells [o][4] = 0 + end + + table.sort (spells, DpsTuningPlugin.Sort3) + + DpsTuningPlugin.SpellList = spells + DpsTuningPlugin.SpellScroll:Update() + + elseif (DpsTuningPlugin.db.SpellBarsShowType == 3) then --> spell damage + + local i = 0 + for spellid, spelltable in pairs (DpsTuningPlugin.CurPlayer:GetActorSpells()) do + i = i + 1 + + if (not spells [i]) then + spells [i] = {} + end + + spells [i][1] = spellid + spells [i][2] = spelltable.total + end + + spells.cur = i + for o = #spells, i+1, -1 do + spells [o][1] = 0 + spells [o][2] = 0 + spells [o][3] = 0 + spells [o][4] = 0 + end + + table.sort (spells, DpsTuningPlugin.Sort2) + + DpsTuningPlugin.SpellList = spells + DpsTuningPlugin.SpellScroll:Update() + + end + + end + + function update_scroll (self) + + local spells = DpsTuningPlugin.SpellList + if (not spells) then + for bar_index = 1, 9 do + local bar = DpsTuningPlugin.SpellBars [bar_index] + bar:Hide() + end + return + end + + local offset = FauxScrollFrame_GetOffset (self) + local amt = 0 + for index, spell in ipairs (spells) do + if (spell[2] > 0) then + amt = amt + 1 + end + end + + for bar_index = 1, 9 do + local data = spells [bar_index + offset] + local bar = DpsTuningPlugin.SpellBars [bar_index] + + if (DpsTuningPlugin.db.SpellBarsShowType == 1) then --> execution activity dps + + if (data and data[3] > 0) then + local name, _, icon = _GetSpellInfo (data [1]) + bar.icon = icon + bar.lefttext = name + bar.righttext = DpsTuningPlugin:comma_value (data [2]) .. " (" .. data [3] .. ", " .. DpsTuningPlugin:ToK2 (floor (data [4])) .. ")" + bar.spellid = data [1] + bar:Show() + else + bar:Hide() + end + + elseif (DpsTuningPlugin.db.SpellBarsShowType == 2) then --> player activity dps + + if (data and data[2] > 0) then + local name, _, icon = _GetSpellInfo (data [1]) + bar.icon = icon + bar.lefttext = name + bar.righttext = DpsTuningPlugin:comma_value (data [2]) .. " (" .. DpsTuningPlugin:ToK2 (floor (data [3])) .. ")" + bar.spellid = data [1] + bar:Show() + else + bar:Hide() + end + + elseif (DpsTuningPlugin.db.SpellBarsShowType == 3) then --> spell damage + + local total = DpsTuningPlugin.CurPlayer.total + + if (data and data[2] > 0) then + local name, _, icon = _GetSpellInfo (data [1]) + bar.icon = icon + bar.lefttext = name + bar.righttext = DpsTuningPlugin:comma_value (data [2]) .. " (" .. floor (data[2] / total * 100) .. "%)" + bar.spellid = data [1] + bar:Show() + else + bar:Hide() + end + + end + end + + FauxScrollFrame_Update (self, amt, 9, 15) + + end + + function DpsTuningPlugin:BuildSummaryPanel() + + --total damage + local damage1 = fw:CreateLabel (SDF, "Damage:") + local damage2 = fw:CreateLabel (SDF, "") + damage1:SetPoint ("topleft", SDF, "topleft", 2, -165) + damage2:SetPoint ("left", damage1, "right", 2, 0) + DpsTuningPlugin.total_damage = damage2 + + --activity dps + local a_dps1 = fw:CreateLabel (SDF, "Dps:") + local a_dps2 = fw:CreateLabel (SDF, "") + a_dps1:SetPoint ("topleft", SDF, "topleft", 2, -180) + a_dps2:SetPoint ("left", a_dps1, "right", 2, 0) + DpsTuningPlugin.activity_dps = a_dps2 + + --timer + local timer1 = fw:CreateLabel (SDF, "Time:") + local timer2 = fw:CreateLabel (SDF, "") + timer1:SetPoint ("topleft", SDF, "topleft", 2, -195) + timer2:SetPoint ("left", timer1, "right", 2, 0) + DpsTuningPlugin.time_elapsed = timer2 + + --power + local power1 = fw:CreateLabel (SDF, "Power:") + local power2 = fw:CreateLabel (SDF, "", 15, "orange") + power1:SetPoint ("topleft", SDF, "topleft", 2, -215) + power2:SetPoint ("left", power1, "right", 2, 0) + DpsTuningPlugin.power_amount = power2 + end + + function DpsTuningPlugin:BuildHeader() + + local on_select_spell_type = function (_, _, type_number) + DpsTuningPlugin.db.SpellBarsShowType = type_number + DpsTuningPlugin:UpdateTick() + end + + local icon = [[Interface\COMMON\friendship-FistOrc]] + + local spell_type_options = { + {value = 1, label = "Execution Activity Dps", desc = "Oder and show the dps following the spell individual activity time.", onclick = on_select_spell_type, icon = icon}, + {value = 2, label = "Player Activity Dps", desc = "Order the spells using your activity time to measure the dps for each spell.", onclick = on_select_spell_type, icon = icon}, + {value = 3, label = "Damage", desc = "Order the spells following the damage done by each one.", onclick = on_select_spell_type, icon = icon}, + } + + local select_spell_type = function() + return spell_type_options + end + + local dropdown = fw:CreateDropDown (SDF, select_spell_type, DpsTuningPlugin.db.SpellBarsShowType, 160, 18) + local label = fw:CreateLabel (SDF, "Dps Format:") + label:SetPoint (2, -4) + dropdown:SetPoint ("left", label, "right", 2, -1) + end + + DpsTuningPlugin.AuraBlocks = {} + + local aura_onenter = function (self, capsule) + self:SetBackdropBorderColor (1, 1, 0, 1) + capsule.icontexture.alpha = 1 + local buff = capsule.buff + if (buff) then + GameCooltip:Reset() + GameCooltip:SetOwner (self) + GameCooltip:SetType ("tooltip") + DpsTuningPlugin:CooltipPreset (2) + + local name, _, icon = _GetSpellInfo (buff.spellid) + + GameCooltip:AddLine (name, "", 1, "orange", nil, 13, "Arrial Narrow") + GameCooltip:AddIcon (icon) + + GameCooltip:AddLine ("") + + local minutos, segundos = floor (buff.uptime/60), floor (buff.uptime%60) + GameCooltip:AddLine ("Uptime:", minutos .. "m " .. segundos .. "s", 1, "white", nil, 10, "Arrial Narrow") + GameCooltip:AddLine ("Percent:", _cstr ("%.1f", buff.uptime/DpsTuningPlugin.CurPlayer:Tempo()*100) .. "%", 1, "white", nil, 10, "Arrial Narrow") + + GameCooltip:SetOption ("AlignAsBlizzTooltip", true) + GameCooltip:Show() + end + end + local aura_onleave = function (self, capsule) + self:SetBackdropBorderColor (1, 1, 1, 1) + capsule.icontexture.alpha = 0.9 + GameCooltip:Hide() + end + + local aura_onenter2 = function (self, capsule) + aura_onenter (capsule.block.widget, capsule.block) + end + local aura_onleave2 = function (self, capsule) + aura_onleave (capsule.block.widget, capsule.block) + end + + local AuraOnClick = function (block) + if (block.buff) then + block.buff.disabled = not block.buff.disabled + if (block.buff.disabled) then + block.X:Show() + else + block.X:Hide() + end + end + end + + function DpsTuningPlugin:BuildBuffBlocks() + + local auras = fw:CreateLabel (SDF, "Auras (click to disable):") + auras:SetPoint (170, -165) + + local coords = {0.1, 0.9, 0.1, 0.9} + local size = 26 + local color = {.7, .7, .7} + + for i = 1, 3 do + local block = fw:CreatePanel (SDF, 32, 32) + block:SetFrameLevel (SDF:GetFrameLevel()+2) + block:SetPoint (170 + ((i-1) * 36), -180) + block:SetHook ("OnEnter", aura_onenter) + block:SetHook ("OnLeave", aura_onleave) + block.icontexture = fw:CreateImage (block, nil, size, size, "border", coords) + block.icontexture:SetPoint ("center", block, "center") + block.icontexture.alpha = 0.9 + block.icontexture:SetVertexColor (unpack (color)) + block.texttime = fw:CreateLabel (block, "", 16, "yellow", "GameFontNormal", nil, nil, "artwork") + block.texttime:SetPoint ("center", block, "center") + + block.X = fw:CreateImage (block, [[Interface\Glues\LOGIN\Glues-CheckBox-Check]], size*1.1, size*1.1, "overlay") + block.X:SetPoint ("center", block, "center") + block.X:Hide() + + block.button = fw:CreateButton (block, AuraOnClick, 32, 32, "", block) + block.button:SetPoint ("center", box, "center") + block.button:SetHook ("OnEnter", aura_onenter2) + block.button:SetHook ("OnLeave", aura_onleave2) + block.button.block = block + + tinsert (DpsTuningPlugin.AuraBlocks, block) + end + + for i = 1, 3 do + local block = fw:CreatePanel (SDF, 32, 32) + block:SetFrameLevel (SDF:GetFrameLevel()+2) + block:SetPoint (170 + ((i-1) * 36), -220) + block:SetHook ("OnEnter", aura_onenter) + block:SetHook ("OnLeave", aura_onleave) + block.icontexture = fw:CreateImage (block, nil, size, size, "border", coords) + block.icontexture:SetPoint ("center", block, "center") + block.icontexture.alpha = 0.9 + block.icontexture:SetVertexColor (unpack (color)) + block.texttime = fw:CreateLabel (block, "", 16, "yellow", "GameFontNormal", nil, nil, "artwork") + block.texttime:SetPoint ("center", block, "center") + + block.X = fw:CreateImage (block, [[Interface\Glues\LOGIN\Glues-CheckBox-Check]], size*1.1, size*1.1, "overlay") + block.X:SetPoint ("center", block, "center") + block.X:Hide() + + block.button = fw:CreateButton (block, AuraOnClick, 32, 32, "", block) + block.button:SetPoint ("center", box, "center") + block.button:SetHook ("OnEnter", aura_onenter2) + block.button:SetHook ("OnLeave", aura_onleave2) + block.button.block = block + + tinsert (DpsTuningPlugin.AuraBlocks, block) + end + + for i = 1, 3 do + local block = fw:CreatePanel (SDF, 32, 32) + block:SetFrameLevel (SDF:GetFrameLevel()+2) + block:SetPoint (170 + ((i-1) * 36), -260) + block:SetHook ("OnEnter", aura_onenter) + block:SetHook ("OnLeave", aura_onleave) + block.icontexture = fw:CreateImage (block, nil, size, size, "border", coords) + block.icontexture:SetPoint ("center", block, "center") + block.icontexture.alpha = 0.9 + block.icontexture:SetVertexColor (unpack (color)) + block.texttime = fw:CreateLabel (block, "", 16, "yellow", "GameFontNormal", nil, nil, "artwork") + block.texttime:SetPoint ("center", block, "center") + + block.X = fw:CreateImage (block, [[Interface\Glues\LOGIN\Glues-CheckBox-Check]], size*1.1, size*1.1, "overlay") + block.X:SetPoint ("center", block, "center") + block.X:Hide() + + block.button = fw:CreateButton (block, AuraOnClick, 32, 32, "", block) + block.button:SetPoint ("center", box, "center") + block.button:SetHook ("OnEnter", aura_onenter2) + block.button:SetHook ("OnLeave", aura_onleave2) + block.button.block = block + + tinsert (DpsTuningPlugin.AuraBlocks, block) + end + + end + + function DpsTuningPlugin:ClearBuffBlocks() + for index, block in ipairs (DpsTuningPlugin.AuraBlocks) do + block.buff = nil + block.icontexture.texture = nil + block.texttime.text = "" + end + end + + function DpsTuningPlugin:UpdateBuffBlocks() + for index, block in ipairs (DpsTuningPlugin.AuraBlocks) do + if (block.buff) then + if (block.buff.actived) then + block.texttime.text = block.buff.uptime + (ClockTime() - block.buff.actived_at) + else + block.texttime.text = block.buff.uptime + end + end + end + end + + function DpsTuningPlugin:EnableAuraBlock (block_number, buff_table) + if (block_number <= 9) then + local block = DpsTuningPlugin.AuraBlocks [block_number] + block.icontexture.texture = select (3, _GetSpellInfo (buff_table.spellid)) + block.buff = buff_table + end + end + + function DpsTuningPlugin:TrackBuffsAtEnd() + for buffIndex = 1, 41 do + local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellid = UnitAura ("player", buffIndex, nil, "HELPFUL") + local buff_table = buff_activity [spellid] + if (buff_table) then + if (buff_table.actived_at and buff_table.actived) then + buff_table.uptime = buff_table.uptime + ClockTime() - buff_table.actived_at + end + buff_table.actived = false + buff_table.actived_at = nil + DpsTuningPlugin:BuffChartEnd (spellid) + end + end + end + + function DpsTuningPlugin:BuffChartStart (spellid) + local buff_chart = buff_graphic_data [spellid] + if (not buff_chart) then + buff_chart = {} + buff_graphic_data [spellid] = buff_chart + end + local bufftime = {time_start = DpsTuningPlugin.CurTick, time_end = 0} + tinsert (buff_chart, bufftime) + end + + function DpsTuningPlugin:BuffChartEnd (spellid) + local buff_chart = buff_graphic_data [spellid] + if (buff_chart) then + local bufftime = buff_chart [#buff_chart] + bufftime.time_end = DpsTuningPlugin.CurTick + end + end + + function DpsTuningPlugin:TrackBuffsAtStart() + for buffIndex = 1, 41 do + local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellid = UnitAura ("player", buffIndex, nil, "HELPFUL") + + if (name and unitCaster == "player" and duration > 0 and expirationTime > 0 and not shouldConsolidate) then + local buff_table = buff_activity [spellid] + if (not buff_table) then + buff_table = {uptime = 0, actived = false, activedamt = 0, block = buff_activity.next, spellid = spellid, procs = {}} + buff_activity.next = buff_activity.next + 1 + buff_activity [spellid] = buff_table + end + + buff_table.actived = true + buff_table.activedamt = 1 + buff_table.actived_at = ClockTime() + tinsert (buff_table.procs, DpsTuningPlugin.CurCombat:GetCombatTime()) + + DpsTuningPlugin:BuffChartStart (spellid) + DpsTuningPlugin:EnableAuraBlock (buff_table.block, buff_table) + end + end + end + + + function DpsTuningPlugin:AuraApplied (time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, spellschool, tipo, amount) + if (tipo == "BUFF") then + + local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellid = UnitAura ("player", spellname, nil, "HELPFUL") + + if (name and unitCaster == "player" and duration > 0 and expirationTime > 0 and not shouldConsolidate) then + + local buff_table = buff_activity [spellid] + if (not buff_table) then + buff_table = {uptime = 0, actived = false, activedamt = 0, block = buff_activity.next, spellid = spellid, procs = {}} + buff_activity.next = buff_activity.next + 1 + buff_activity [spellid] = buff_table + end + + buff_table.actived = true + buff_table.activedamt = buff_table.activedamt + 1 + buff_table.actived_at = ClockTime() + tinsert (buff_table.procs, DpsTuningPlugin.CurCombat:GetCombatTime()) + + DpsTuningPlugin:BuffChartStart (spellid) + DpsTuningPlugin:EnableAuraBlock (buff_table.block, buff_table) + + end + end + end + + function DpsTuningPlugin:AuraRefresh (time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, spellschool, tipo, amount) + if (tipo == "BUFF") then + local buff_table = buff_activity [spellid] + if (buff_table) then + if (buff_table.actived_at and buff_table.actived) then + buff_table.uptime = buff_table.uptime + ClockTime() - buff_table.actived_at + end + buff_table.actived_at = ClockTime() + buff_table.actived = true + end + end + end + + function DpsTuningPlugin:AuraRemoved (time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, spellschool, tipo, amount) + if (tipo == "BUFF") then + local buff_table = buff_activity [spellid] + if (buff_table) then + if (buff_table.actived_at and buff_table.actived) then + buff_table.uptime = buff_table.uptime + ClockTime() - buff_table.actived_at + end + buff_table.actived = false + buff_table.actived_at = nil + tinsert (buff_table.procs, DpsTuningPlugin.CurCombat:GetCombatTime()) + DpsTuningPlugin:BuffChartEnd (spellid) + end + end + end + + local misscolor = {1, 0.3, 0.3} + + local bar_onenter_script = function (self, capsule) + + if (not DpsTuningPlugin.CurPlayer or not capsule.spellid) then + return + end + + GameCooltip:Reset() + GameCooltip:SetOwner (self) + GameCooltip:SetType ("tooltip") + DpsTuningPlugin:CooltipPreset (2) + + local spell = DpsTuningPlugin.CurPlayer:GetSpell (capsule.spellid) + local name, _, icon = _GetSpellInfo (capsule.spellid) + + GameCooltip:AddLine (name, "", 1, "orange", nil, 13, "Arrial Narrow") + GameCooltip:AddIcon (icon) + + GameCooltip:AddLine ("") + + GameCooltip:AddLine ("Damage:", DpsTuningPlugin:comma_value (spell.total), 1, "white", nil, 10, "Arrial Narrow") + GameCooltip:AddLine ("Hits:", spell.counter, 1, "white", nil, 10, "Arrial Narrow") + GameCooltip:AddLine ("Dps:", DpsTuningPlugin:ToK2 (floor (spell.total / DpsTuningPlugin.CurPlayer:Tempo())), 1, "white", nil, 10, "Arrial Narrow") + GameCooltip:AddLine ("Percent:", _cstr ("%.1f", spell.total / DpsTuningPlugin.CurPlayer.total_without_pet * 100) .. "%", 1, "white", nil, 10, "Arrial Narrow") + + GameCooltip:AddLine ("") + + GameCooltip:AddLine ("Average Damage:", DpsTuningPlugin:comma_value (floor (spell.total / spell.counter)), 1, "white", nil, 10, "Arrial Narrow") + GameCooltip:AddLine ("Min Hit:", DpsTuningPlugin:comma_value (spell.n_min), 1, "white", nil, 10, "Arrial Narrow") + GameCooltip:AddLine ("Max Hit:", DpsTuningPlugin:comma_value (math.max (spell.n_max, spell.c_max)), 1, "white", nil, 10, "Arrial Narrow") + + GameCooltip:AddLine ("") + + GameCooltip:AddLine ("Critical Hits:", _cstr ("%.1f", spell.c_amt / spell.counter * 100) .. "%", 1, "white", nil, 10, "Arrial Narrow") + if (spell.c_amt > 0) then + GameCooltip:AddLine ("Critical Average Damage:", DpsTuningPlugin:comma_value (floor (spell.c_dmg / spell.c_amt)), 1, "white", nil, 10, "Arrial Narrow") + else + GameCooltip:AddLine ("Critical Average Damage:", "0", 1, "white", nil, 10, "Arrial Narrow") + end + + --uptime + local misc = DpsTuningPlugin.CurCombat (DETAILS_ATTRIBUTE_MISC, DpsTuningPlugin.playername) + if (misc) then + local debuff_uptime = misc.debuff_uptime + if (debuff_uptime) then + local this_spell = misc.debuff_uptime_spell_tables._ActorTable [capsule.spellid] + if (this_spell) then + GameCooltip:AddLine ("") + local uptime = this_spell.uptime + local minutos, segundos = floor (uptime/60), floor (uptime%60) + GameCooltip:AddLine ("Uptime:", minutos .. "m " .. segundos .. "s", 1, "white", nil, 10, "Arrial Narrow") + end + end + end + + --miss + GameCooltip:AddLine ("") + + local miss = spell ["MISS"] + local parry = spell ["PARRY"] + local dodge = spell ["DODGE"] + + if (miss) then + GameCooltip:AddLine ("Miss:", miss .. " (" .. _cstr ("%.1f", miss / spell.counter * 100) .. "%)", 1, misscolor, nil, 10, "Arrial Narrow") + end + if (parry) then + GameCooltip:AddLine ("Parry:", parry .. " (" .. _cstr ("%.1f", parry / spell.counter * 100) .. "%)", 1, misscolor, nil, 10, "Arrial Narrow") + end + if (dodge) then + GameCooltip:AddLine ("Dodge:", dodge .. " (" .. _cstr ("%.1f", dodge / spell.counter * 100) .. "%)", 1, misscolor, nil, 10, "Arrial Narrow") + end + if (spell.g_amt > 0) then + GameCooltip:AddLine ("Glancing:", spell.g_amt .. " (" .. _cstr ("%.1f", spell.g_amt / spell.counter * 100) .. "%)", 1, misscolor, nil, 10, "Arrial Narrow") + end + + GameCooltip:SetOption ("AlignAsBlizzTooltip", true) + GameCooltip:Show() + end + + local bar_onleanve_script = function (self) + GameCooltip:Hide() + end + + function DpsTuningPlugin:BuildSpellBars() + DpsTuningPlugin.SpellBars = {} + + local scrollbar = CreateFrame ("scrollframe", "DpsTuningPluginSpellsFauxScroll", DpsTuningPlugin.Frame, "FauxScrollFrameTemplate") + scrollbar:SetSize (275, 150) + scrollbar:SetPoint ("topleft", DpsTuningPlugin.Frame, "topleft", 1, 0) + scrollbar:SetScript ("OnVerticalScroll", function (self, offset) FauxScrollFrame_OnVerticalScroll (self, offset, 15, update_scroll) end) + scrollbar.Update = update_scroll + DpsTuningPlugin.SpellScroll = scrollbar + + for i = 1, 9 do + local bar = fw:CreateBar (DpsTuningPlugin.Frame, "Skyline", 275, 14, 100) + bar.color = DpsTuningPlugin.BarColor + bar.textfont = "Arial Narrow" + bar.textsize = 10 + bar:SetPoint ("topleft", DpsTuningPlugin.Frame, "topleft", 1, ((i-1) * -15) - 20) + + bar:SetHook ("OnEnter", bar_onenter_script) + bar:SetHook ("OnLeave", bar_onleanve_script) + + tinsert (DpsTuningPlugin.SpellBars, bar) + end + end + + local colors = { + {1, 1, 1}, --white + {1, 0.8, .1}, --orange + {.3, .3, 1}, --blue + {1, .3, .3}, --red + {.3, 1, .3}, --green + {.3, 1, 1}, --cyan + {1, 0.75, 0.79}, --pink + {0.98, 0.50, 0.44}, --salmon + {0.75, 0.75, 0.75}, --silver + {0.60, 0.80, 0.19}, --yellow + {1, .3, 1}, --magenta + } + + local linetypes = {"line", "smallline", "thinline"} + + function DpsTuningPlugin:BuildChartPanels() + + local chart_panel = fw:CreateChartPanel (UIParent, GetScreenWidth()-200, 500) + chart_panel:SetPoint ("topleft", UIParent, "topleft", 100, -100) + chart_panel:SetTitle ("Dps Tuning") + chart_panel:SetFrameStrata ("DIALOG") + chart_panel:CanMove (true) + tinsert (UISpecialFrames, chart_panel:GetName()) + + chart_panel:Hide() + + local open_chart_panel = function() + chart_panel:Reset() + + local player_dps = DpsTuningPlugin.CurCombat:GetTimeData ("Player Damage Done") + + chart_panel:SetTime (DpsTuningPlugin.CurCombat:GetCombatTime()) + chart_panel:SetScale (player_dps.max_value) + + chart_panel:AddLine (player_dps, {1, 1, 1, 1}, "Your Damage", "line") + chart_panel:AddLine (power_amount_chart_table, {1, .4, .4, 1}, "Spell/Attack Power (x3)") + + chart_panel:Show() + end + + local open_chart_panel2 = function() + + chart_panel:Reset() + + local GraphicSmoothLevel = 1 + + --> we need to copy because of the addition of spells with the same icon. + local spell_graphic_data = table_deepcopy (spell_graphic_data) + + local consolidate = {} + for spellid, data in pairs (spell_graphic_data) do + local spellname, _, spellicon = _GetSpellInfo (spellid) + if (consolidate [spellicon]) then + + local data2 = consolidate [spellicon][3] + local new_max_value = consolidate [spellicon][4] + + for i = 1, #data do + data2[i] = data2[i] + data[i] --can be the same table as the default one or it just will add and add over again. + if (data2[i] > new_max_value) then + new_max_value = data2[i] + end + end + + consolidate [spellicon][4] = new_max_value + + local spelldamage = DpsTuningPlugin.CurPlayer:GetSpell (spellid).total + consolidate [spellicon][5] = consolidate [spellicon][5] + spelldamage + + if (string.len (spellname) < string.len (consolidate [spellicon][2])) then + consolidate [spellicon][2] = spellname + end + + else + consolidate [spellicon] = {spellid, spellname, data, data.max_value, DpsTuningPlugin.CurPlayer:GetSpell (spellid).total} + end + end + + local order = {} + for spellid, data in pairs (consolidate) do + tinsert (order, data) + end + + table.sort (order, DpsTuningPlugin.Sort1) + + local player_total_damage = DpsTuningPlugin.CurPlayer.total + + local max = 0 + + for index, data in ipairs (order) do + local spellid = data[1] + local spellname = data[2] + local chart_data = data[3] + local max_value = data[4] + if (max_value > max) then + max = max_value + end + local spelldamage = data[5] + + if (spelldamage/player_total_damage*100 > 5) then + if (colors [index]) then + chart_panel:AddLine (chart_data, colors [index], spellname, nil, GraphicSmoothLevel) + end + end + end + + chart_panel:SetTime (DpsTuningPlugin.CurCombat:GetCombatTime()) + chart_panel:SetScale (max) + + chart_panel:Show() + end + + local open_chart_panel3 = function() + + chart_panel:Reset() + + local player_dps = DpsTuningPlugin.CurCombat:GetTimeData ("Player Damage Done") + chart_panel:AddLine (player_dps, {1, 1, 1, 1}, "Your Damage", "line") + + chart_panel:SetTime (DpsTuningPlugin.CurCombat:GetCombatTime()) + chart_panel:SetScale (player_dps.max_value) + + local index = 1 + for spellid, bufftable in pairs (buff_activity) do + if (type (bufftable) == "table") then + if (not bufftable.disabled) then + local proctable = bufftable.procs + + local spellname, _, spellicon = _GetSpellInfo (spellid) + + chart_panel:AddOverlay (bufftable.procs, colors [index], spellname, spellicon) + index = index + 1 + end + end + end + + chart_panel:Show() + + end + + local button_open = fw:CreateButton (SDF, open_chart_panel, 120, 18, "Damage x Power", nil, nil, nil, "OpenGraphicButton") + button_open:InstallCustomTexture (nil, nil, nil, nil, true) + button_open:SetPoint ("bottomleft", SDF, "bottomleft", 2, 3) + button_open:Disable() + + local button_open2 = fw:CreateButton (SDF, open_chart_panel2, 120, 18, "All Spells", nil, nil, nil, "OpenGraphicButton2") + button_open2:InstallCustomTexture (nil, nil, nil, nil, true) + button_open2:SetPoint ("bottom", button_open, "top", 0, 3) + button_open2:Disable() + + local button_open3 = fw:CreateButton (SDF, open_chart_panel3, 120, 18, "Aura Procs", nil, nil, nil, "OpenGraphicButton3") + button_open3:InstallCustomTexture (nil, nil, nil, nil, true) + button_open3:SetPoint ("bottom", button_open2, "top", 0, 3) + button_open3:Disable() + + end + + + function DpsTuningPlugin:UpdateSummary() + if (DpsTuningPlugin.CurPlayer) then + DpsTuningPlugin.total_damage.text = DpsTuningPlugin:comma_value (floor (DpsTuningPlugin.CurPlayer.total)) + DpsTuningPlugin.activity_dps.text = DpsTuningPlugin:ToK2 (floor (DpsTuningPlugin.CurPlayer.total / DpsTuningPlugin.CurPlayer:Tempo())) + DpsTuningPlugin.time_elapsed.text = _cstr ("%.1f", GetTime() - DpsTuningPlugin.StartTime) + DpsTuningPlugin.power_amount.text = DpsTuningPlugin:comma_value (GetSpellBonusDamage (DpsTuningPlugin.PowerType)) + end + end + + function DpsTuningPlugin:UpdateMiliTick() + DpsTuningPlugin:UpdateSummary() + end + + function DpsTuningPlugin:UpdateTick() + + --check for current player + if (not DpsTuningPlugin.CurPlayer) then + if (not DpsTuningPlugin.CurCombat) then + return + end + DpsTuningPlugin.CurPlayer = DpsTuningPlugin.CurCombat (DETAILS_ATTRIBUTE_DAMAGE, DpsTuningPlugin.playername) + if (not DpsTuningPlugin.CurPlayer) then + return + end + + if (DpsTuningPlugin.CurPlayer and not DpsTuningPlugin.MiliSecTick) then + DpsTuningPlugin.MiliSecTick = DpsTuningPlugin:ScheduleRepeatingTimer ("UpdateMiliTick", 0.1) + end + end + + DpsTuningPlugin.CurTick = DpsTuningPlugin.CurTick + 1 + + --refresh bars + DpsTuningPlugin.RefreshSpells() + + --refresh buff blocks + DpsTuningPlugin:UpdateBuffBlocks() + + --get spells damages + DpsTuningPlugin:ChartDataTick() + + end + + function DpsTuningPlugin:ChartDataTick() + + local power = math.max (GetSpellBonusDamage (1), GetSpellBonusDamage (2)) * 3 + tinsert (power_amount_chart_table, power) + if (power_amount_chart_table.max_value < power) then + power_amount_chart_table.max_value = power + end + + for spellid, spelltable in pairs (DpsTuningPlugin.CurPlayer:GetActorSpells()) do + if (spelltable.total > 0) then + + local chart_table = spell_graphic_data [spelltable.id] + + if (not chart_table) then + local new_chart_data = {} + new_chart_data.last_value = 0 + new_chart_data.max_value = 0 + + for i = 1, DpsTuningPlugin.CurTick-1 do + tinsert (new_chart_data, 0) + end + spell_graphic_data [spelltable.id] = new_chart_data + chart_table = new_chart_data + end + + local cvalue = spelltable.total - chart_table.last_value + if (chart_table.max_value < cvalue) then + chart_table.max_value = cvalue + end + tinsert (chart_table, cvalue) + chart_table.last_value = spelltable.total + + end + end + end + + function DpsTuningPlugin:OnCombatStart (...) + + if (DpsTuningPlugin.FinishedAt+10 > ClockTime()) then + DpsTuningPlugin:Msg ("Ignoring combat start: a combat just finished.") + DpsTuningPlugin.FinishedAt = ClockTime() + return + end + + DpsTuningPlugin.CurCombat = ... + DpsTuningPlugin.CurPlayer = DpsTuningPlugin.CurCombat (DETAILS_ATTRIBUTE_DAMAGE, DpsTuningPlugin.playername) + + table.wipe (spell_activity) + table.wipe (buff_activity) + table.wipe (spell_graphic_data) + table.wipe (buff_graphic_data) + table.wipe (power_amount_chart_table) + + buff_activity.next = 1 + power_amount_chart_table.max_value = 0 + + DpsTuningPlugin:ClearBuffBlocks() + DpsTuningPlugin:TrackBuffsAtStart() + + --> enable buff parser + SDF:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") + + DpsTuningPlugin.LastDps = 0 + DpsTuningPlugin.CurTick = 0 + DpsTuningPlugin.StartTime = GetTime() + + DpsTuningPlugin.TimerTick = DpsTuningPlugin:ScheduleRepeatingTimer ("UpdateTick", 1) + + if (DpsTuningPlugin.CurPlayer and not DpsTuningPlugin.MiliSecTick) then + DpsTuningPlugin.MiliSecTick = DpsTuningPlugin:ScheduleRepeatingTimer ("UpdateMiliTick", 0.1) + end + + SDF.OpenGraphicButton:Disable() + SDF.OpenGraphicButton2:Disable() + SDF.OpenGraphicButton3:Disable() + + end + + function DpsTuningPlugin:OnCombatEnd (...) + local combat = ... + + if (DpsTuningPlugin.CurCombat and DpsTuningPlugin.CurCombat == combat) then + local now = ClockTime() + + DpsTuningPlugin.FinishedAt = now + + --> close spells + for spellid, spelltable in pairs (spell_activity) do + if (spelltable.onhold) then + local diff = now - spelltable.delay - 2 + if (diff > 0) then + spelltable.start = spelltable.start + diff + end + spelltable.onhold = nil + end + + spelltable.tempo_end = now + end + + --> close buffs + DpsTuningPlugin:TrackBuffsAtEnd() + + --> turn off buff parser + SDF:UnregisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") + + --> cancel tick + DpsTuningPlugin:CancelTicker() + + SDF.OpenGraphicButton:Enable() + SDF.OpenGraphicButton2:Enable() + SDF.OpenGraphicButton3:Enable() + end + end + + function DpsTuningPlugin:CancelTicker() + if (DpsTuningPlugin.TimerTick) then + DpsTuningPlugin:CancelTimer (DpsTuningPlugin.TimerTick) + DpsTuningPlugin.TimerTick = nil + end + if (DpsTuningPlugin.MiliSecTick) then + DpsTuningPlugin:CancelTimer (DpsTuningPlugin.MiliSecTick) + DpsTuningPlugin.MiliSecTick = nil + end + end + +end + +function DpsTuningPlugin:OnEvent (_, event, ...) + + if (event == "COMBAT_LOG_EVENT_UNFILTERED") then + + local time1, token, hidding, who_serial, who_name, who_flags, who_flags2, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spellschool, tipo, amount = select (1, ...) + + if (who_name == DpsTuningPlugin.playername and alvo_name == DpsTuningPlugin.playername) then + if (token == "SPELL_AURA_APPLIED") then + DpsTuningPlugin:AuraApplied (time1, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, spellschool, tipo, amount) + elseif (token == "SPELL_AURA_REMOVED") then + DpsTuningPlugin:AuraRemoved (time1, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, spellschool, tipo, amount) + elseif (token == "SPELL_AURA_REFRESH") then + DpsTuningPlugin:AuraRefresh (time1, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, spellschool, tipo, amount) + end + end + + elseif (event == "ADDON_LOADED") then + local AddonName = select (1, ...) + if (AddonName == "Details_DpsTuning") then + + if (_G._detalhes) then + + --> create main plugin object + CreatePluginFrames() + + local MINIMAL_DETAILS_VERSION_REQUIRED = 28 + + local default_settings = { + SpellBarsShowType = 1, + } + + --> Install plugin inside details + local install = _G._detalhes:InstallPlugin ("SOLO", "Dps Tuning", "Interface\\Icons\\Ability_Racial_RocketBarrage", DpsTuningPlugin, "DETAILS_PLUGIN_DPS_TUNING", MINIMAL_DETAILS_VERSION_REQUIRED, "Details! Team", "v1.00", default_settings) + if (type (install) == "table" and install.error) then + print (install.error) + end + + --> Register needed events + _G._detalhes:RegisterEvent (DpsTuningPlugin, "COMBAT_PLAYER_ENTER") + _G._detalhes:RegisterEvent (DpsTuningPlugin, "COMBAT_PLAYER_LEAVE") + _G._detalhes:RegisterEvent (DpsTuningPlugin, "DETAILS_DATA_RESET") + + end + end + + end +end diff --git a/plugins/Details_DpsTuning/Details_DpsTuning.toc b/plugins/Details_DpsTuning/Details_DpsTuning.toc new file mode 100644 index 00000000..593aa5da --- /dev/null +++ b/plugins/Details_DpsTuning/Details_DpsTuning.toc @@ -0,0 +1,7 @@ +## Interface: 50400 +## Title: Details Dps Tuning (plugin) +## Notes: Plugin for Details +## RequiredDeps: Details +## OptionalDeps: Ace3 + +Details_DpsTuning.lua \ No newline at end of file diff --git a/plugins/Details_EncounterDetails/Details_EncounterDetails.lua b/plugins/Details_EncounterDetails/Details_EncounterDetails.lua index e21a0918..de7c108c 100644 --- a/plugins/Details_EncounterDetails/Details_EncounterDetails.lua +++ b/plugins/Details_EncounterDetails/Details_EncounterDetails.lua @@ -38,7 +38,7 @@ local _combat_object local CLASS_ICON_TCOORDS = _G.CLASS_ICON_TCOORDS EncounterDetails.name = "Encounter Details" - +EncounterDetails.debugmode = false local ability_type_table = { [0x1] = "|cFF00FF00"..Loc ["STRING_HEAL"].."|r", @@ -61,8 +61,6 @@ local ability_type_table = { } -local debugmode = false - --> main object frame functions local function CreatePluginFrames (data) @@ -138,7 +136,7 @@ local function CreatePluginFrames (data) --_detalhes:TimeDataRegister ("Raid Damage Done", damage_done_func, {last_damage = 0, max_damage = 0}, "Encounter Details", "v1.0", [[Interface\ICONS\Ability_DualWield]], true) _detalhes:TimeDataRegister ("Raid Damage Done", string_damage_done_func, nil, "Encounter Details", "v1.0", [[Interface\ICONS\Ability_DualWield]], true, true) - + if (EncounterDetails.db.show_icon == 4) then EncounterDetails:ShowIcon() elseif (EncounterDetails.db.show_icon == 5) then @@ -194,7 +192,8 @@ local function CreatePluginFrames (data) --drop last combat table EncounterDetails.LastSegmentShown = nil - --table.wipe (EncounterDetails.boss_emotes_table) + --wipe emotes + table.wipe (EncounterDetails.boss_emotes_table) elseif (event == "GROUP_ONENTER") then if (EncounterDetails.db.show_icon == 2) then @@ -231,7 +230,7 @@ local function CreatePluginFrames (data) function EncounterDetails:WasEncounter() --> check if last combat was a boss encounter fight - if (not debugmode) then + if (not EncounterDetails.debugmode) then if (not _combat_object.is_boss) then return @@ -269,6 +268,7 @@ local function CreatePluginFrames (data) end --> build all window data + EncounterDetails.db.opened = EncounterDetails.db.opened + 1 EncounterDetails:OpenAndRefresh() --> show EncounterDetailsFrame:Show() @@ -322,14 +322,12 @@ end local function KillInfo (deathTable, row) - local lastEvents = deathTable [1] - local timeOfDeath = deathTable [2] + local eventos = deathTable [1] + local hora_da_morte = deathTable [2] local hp_max = deathTable [5] - local lines = {} - local battleress = false - local skillTable = row.extra + local lastcooldown = false local GameCooltip = GameCooltip @@ -337,90 +335,98 @@ end GameCooltip:SetType ("tooltipbar") GameCooltip:SetOwner (row) + GameCooltip:AddLine ("Click to Report", nil, 1, "orange") + GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 0.015625, 0.13671875, 0.4375, 0.59765625) + GameCooltip:AddStatusBar (0, 1, 1, 1, 1, 1, false, {value = 100, color = {.3, .3, .3, 1}, specialSpark = false, texture = [[Interface\AddOns\Details\images\bar_serenity]]}) + + --death parser + for index, event in _ipairs (eventos) do - for index, event in _ipairs (lastEvents) do - - --max hp percent (in case of hp cooldowns) local hp = _math_floor (event[5]/hp_max*100) if (hp > 100) then hp = 100 end - if (event [1]) then --> DAMAGE - local nome_magia, _, icone_magia = _GetSpellInfo (event [2]) - - if (not event[3] and not battleress) then --> battle ress - GameCooltip:AddLine ("+".._cstr ("%.1f", event[4] - timeOfDeath) .."s "..nome_magia.." ("..event[6]..")", "-- -- -- ", 1, "white") - GameCooltip:AddIcon ("Interface\\Glues\\CharacterSelect\\Glues-AddOn-Icons", 1, 1, nil, nil, .75, 1, 0, 1) - GameCooltip:AddStatusBar (100, 1, "silver", false) - battleress = true + local evtype = event [1] + local spellname, _, spellicon = _GetSpellInfo (event [2]) + local amount = event [3] + local time = event [4] + local source = event [6] + + if (type (evtype) == "boolean") then + --> is damage or heal + if (evtype) then + --> damage + GameCooltip:AddLine ("" .. _cstr ("%.1f", time - hora_da_morte) .. "s " .. spellname .. " (" .. source .. ")", "-" .. _detalhes:ToK (amount) .. " (" .. hp .. "%)", 1, "white", "white") + GameCooltip:AddIcon (spellicon) - elseif (event[3]) then - - local habilidade_school = skillTable [event [2]] --> pegou a tabela com os hex - local _school = "" - - if (habilidade_school) then - for _, hex in _ipairs (habilidade_school) do - _school = _school .. " " .. ability_type_table [hex] - end - end - - _school = _detalhes:trim (_school) - local texto_esquerdo - if (nome_magia) then - texto_esquerdo = "".._cstr ("%.1f", event[4] - timeOfDeath) .."s " .. nome_magia .. " (".. event [6] ..")" --" (".. _school ..")" - texto_esquerdo = texto_esquerdo:gsub ("(%()%)", "") + if (event [9]) then + --> friendly fire + GameCooltip:AddStatusBar (hp, 1, "darkorange", true) else - texto_esquerdo = "" + --> from a enemy + GameCooltip:AddStatusBar (hp, 1, "red", true) end + else + --> heal + GameCooltip:AddLine ("" .. _cstr ("%.1f", time - hora_da_morte) .. "s " .. spellname .. " (" .. source .. ")", "+" .. _detalhes:ToK (amount) .. " (" .. hp .. "%)", 1, "white", "white") + GameCooltip:AddIcon (spellicon) + GameCooltip:AddStatusBar (hp, 1, "green", true) + + end + + elseif (type (evtype) == "number") then + if (evtype == 1) then + --> cooldown + GameCooltip:AddLine ("" .. _cstr ("%.1f", time - hora_da_morte) .. "s " .. spellname .. " (" .. source .. ")", "cooldown (" .. hp .. "%)", 1, "white", "white") + GameCooltip:AddIcon (spellicon) + GameCooltip:AddStatusBar (100, 1, "yellow", true) + + elseif (evtype == 2 and not battleress) then + --> battle ress + battleress = event + + elseif (evtype == 3) then + --> last cooldown used + lastcooldown = event - if (type (event [1]) ~= "boolean" and event [1] == 2) then --> last cooldown - if (event[3] == 1) then - GameCooltip:AddLine ("".._cstr ("%.1f", event[4] - timeOfDeath) .. "s " .. nome_magia .. " (" .. Loc ["STRING_LAST_COOLDOWN"] .. ")") - GameCooltip:AddIcon (icone_magia) - GameCooltip:AddStatusBar (100, 1, "gray", true) - else - GameCooltip:AddLine (Loc ["STRING_NOLAST_COOLDOWN"]) - GameCooltip:AddStatusBar (100, 1, "gray", true) - end - else - GameCooltip:AddLine (texto_esquerdo, "-".._detalhes:ToK (event[3]).." (".. hp .."%)", 1, "white", "white") - GameCooltip:AddIcon (icone_magia) - - if (type (event [1]) ~= "boolean" and event [1] == 1) then --> cooldown - GameCooltip:AddStatusBar (100, 1, "yellow", true) - else - GameCooltip:AddStatusBar (hp, 1, "red", true) - end - end - end - else - local nome_magia, _, icone_magia = _GetSpellInfo (event [2]) - GameCooltip:AddLine ("".._cstr ("%.1f", event[4] - timeOfDeath) .."s "..nome_magia.." ("..event[6]..")", "+".._detalhes:ToK (event[3]).." (".. hp .."%)", 1, "white", "white") - GameCooltip:AddIcon (icone_magia, 1, 1) - GameCooltip:AddStatusBar (hp, 1, "green", true) end end + + GameCooltip:AddLine (deathTable [6] .. " " .. "died" , "-- -- -- ", 1, "white") + GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\small_icons", 1, 1, nil, nil, .75, 1, 0, 1) + GameCooltip:AddStatusBar (0, 1, .5, .5, .5, .5, false, {value = 100, color = {.5, .5, .5, 1}, specialSpark = false, texture = [[Interface\AddOns\Details\images\bar4_vidro]]}) if (battleress) then - GameCooltip:AddSpecial ("line", 2, nil, deathTable [6] .. " "..Loc ["STRING_DIED"], "-- -- -- ", 1, "white") - GameCooltip:AddSpecial ("icon", 2, nil, "Interface\\AddOns\\Details\\images\\small_icons", 1, 1, nil, nil, .75, 1, 0, 1) - GameCooltip:AddSpecial ("statusbar", 2, nil, 100, 1, "darkgray", false) - else - GameCooltip:AddSpecial ("line", 1, nil, deathTable [6] .. " "..Loc ["STRING_DIED"], "-- -- -- ", 1, "white") - GameCooltip:AddSpecial ("icon", 1, nil, "Interface\\AddOns\\Details\\images\\small_icons", 1, 1, nil, nil, .75, 1, 0, 1) - GameCooltip:AddSpecial ("statusbar", 1, nil, 100, 1, "darkgray", false) - + local nome_magia, _, icone_magia = _GetSpellInfo (battleress [2]) + GameCooltip:AddLine ("+" .. _cstr ("%.1f", battleress[4] - hora_da_morte) .. "s " .. nome_magia .. " (" .. battleress[6] .. ")", "", 1, "white") + GameCooltip:AddIcon ("Interface\\Glues\\CharacterSelect\\Glues-AddOn-Icons", 1, 1, nil, nil, .75, 1, 0, 1) + GameCooltip:AddStatusBar (0, 1, .5, .5, .5, .5, false, {value = 100, color = {.5, .5, .5, 1}, specialSpark = false, texture = [[Interface\AddOns\Details\images\bar4_vidro]]}) end + if (lastcooldown) then + if (lastcooldown[3] == 1) then + local nome_magia, _, icone_magia = _GetSpellInfo (lastcooldown [2]) + GameCooltip:AddLine (_cstr ("%.1f", lastcooldown[4] - hora_da_morte) .. "s " .. nome_magia .. " (" .. Loc ["STRING_LAST_COOLDOWN"] .. ")") + GameCooltip:AddIcon (icone_magia) + else + GameCooltip:AddLine (Loc ["STRING_NOLAST_COOLDOWN"]) + GameCooltip:AddIcon ([[Interface\CHARACTERFRAME\UI-Player-PlayTimeUnhealthy]], 1, 1, 18, 18) + end + GameCooltip:AddStatusBar (0, 1, 1, 1, 1, 1, false, {value = 100, color = {.3, .3, .3, 1}, specialSpark = false, texture = [[Interface\AddOns\Details\images\bar_serenity]]}) + end + + GameCooltip:SetOption ("StatusBarHeightMod", -6) - GameCooltip:SetOption ("FixedWidth", 400) + GameCooltip:SetOption ("FixedWidth", 300) GameCooltip:SetOption ("TextSize", 9) - GameCooltip:SetOption ("StatusBarTexture", "Interface\\AddOns\\Details\\images\\bar_serenity") - GameCooltip:ShowCooltip() + GameCooltip:SetOption ("LeftBorderSize", -4) + GameCooltip:SetOption ("RightBorderSize", 5) + GameCooltip:SetOption ("StatusBarTexture", [[Interface\AddOns\Details\images\bar4_reverse]]) + GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0.64453125, 0}, {.8, .8, .8, 0.2}, true) + GameCooltip:ShowCooltip() end --> custom tooltip for dispells details --------------------------------------------------------------------------------------------------------- @@ -614,6 +620,9 @@ end --> custom tooltip that handle mouse enter and leave on customized rows --------------------------------------------------------------------------------------------------------- +local backdrop_bar_onenter = {bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16, edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", edgeSize = 8, insets = {left = 1, right = 1, top = 0, bottom = 1}} +local backdrop_bar_onleave = {bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16, insets = {left = 1, right = 1, top = 0, bottom = 1}} + function EncounterDetails:SetRowScripts (barra, index, container) barra:SetScript ("OnMouseDown", function (self) @@ -663,9 +672,9 @@ function EncounterDetails:SetRowScripts (barra, index, container) self:SetHeight (17) self:SetAlpha(1) - self:SetBackdrop({edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", tile = true, tileSize = 16, edgeSize = 10,insets = {left = 1, right = 1, top = 0, bottom = 1},}) - self:SetBackdropBorderColor (170/255, 170/255, 170/255) - self:SetBackdropColor (24/255, 24/255, 24/255) + self:SetBackdrop (backdrop_bar_onenter) + self:SetBackdropColor (.0, .0, .0, 0.3) + self:SetBackdropBorderColor (.0, .0, .0, 0.5) GameTooltip:SetOwner (self, "ANCHOR_TOPRIGHT") @@ -714,11 +723,10 @@ function EncounterDetails:SetRowScripts (barra, index, container) end self:SetHeight (16) - self:SetAlpha(0.9) + self:SetAlpha (0.9) - self:SetBackdrop({bgFile = "", edgeFile = "", tile = true, tileSize = 16, edgeSize = 32, insets = {left = 1, right = 1, top = 0, bottom = 1},}) - self:SetBackdropBorderColor (0, 0, 0, 0) - self:SetBackdropColor (0, 0, 0, 0) + self:SetBackdrop (backdrop_bar_onleave) + self:SetBackdropColor (.0, .0, .0, 0.3) GameTooltip:Hide() _detalhes.popup:ShowMe (false, "tooltip") @@ -739,21 +747,23 @@ function EncounterDetails:OpenAndRefresh (_, segment) if (segment) then --get combat segment, 1 more recently ...25 oldest _combat_object = EncounterDetails:GetCombat (segment) + EncounterDetails._segment = segment else _G [frame:GetName().."SegmentsDropdown"].MyObject:Select (1, true) + EncounterDetails._segment = 1 end local boss_id local map_id local boss_info - if (debugmode and not _combat_object.is_boss) then + if (EncounterDetails.debugmode and not _combat_object.is_boss) then _combat_object.is_boss = { index = 1, - name = _detalhes:GetBossName (1098, 1), - zone = "Throne of Thunder", - mapid = 1098, - encounter = "Jin'Rohk the Breaker" + name = "Immerseus", + zone = "Siege of Orggrimar", + mapid = 1136, + encounter = "Immerseus" } end @@ -785,6 +795,10 @@ function EncounterDetails:OpenAndRefresh (_, segment) end end + if (EncounterDetailsFrame.ShowType == "graph") then + EncounterDetails:BuildDpsGraphic() + end + EncounterDetails.LastSegmentShown = _combat_object -------------- set boss name and zone name -------------- @@ -795,14 +809,18 @@ function EncounterDetails:OpenAndRefresh (_, segment) local L, R, T, B, Texture = EncounterDetails:GetBossIcon (_combat_object.is_boss.mapid, _combat_object.is_boss.index) EncounterDetailsFrame.boss_icone:SetTexture (Texture) EncounterDetailsFrame.boss_icone:SetTexCoord (L, R, T, B) - EncounterDetailsFrame.raidbackground:SetTexture (EncounterDetails:GetRaidBackground (_combat_object.is_boss.mapid)) + + local file, L, R, T, B = EncounterDetails:GetRaidBackground (_combat_object.is_boss.mapid) + EncounterDetailsFrame.raidbackground:SetTexture (file) + EncounterDetailsFrame.raidbackground:SetTexCoord (L, R, T, B) + EncounterDetailsFrame.raidbackground:SetAlpha (0.8) -------------- set totals on down frame -------------- --[[ data mine: _combat_object ["totals_grupo"] hold the total [1] damage // [2] heal // [3] [energy_name] energies // [4] [misc_name] miscs --]] - EncounterDetailsFrame.StatusBar_totaldamage:SetText (Loc ["STRING_TOTAL_DAMAGE"]..": ".. _detalhes:comma_value (_combat_object.totals_grupo[1])) --> [1] total damage - EncounterDetailsFrame.StatusBar_totalheal:SetText (Loc ["STRING_TOTAL_HEAL"]..": ".. _detalhes:comma_value (_combat_object.totals_grupo[2])) --> [2] total heal + --EncounterDetailsFrame.StatusBar_totaldamage:SetText (Loc ["STRING_TOTAL_DAMAGE"]..": ".. _detalhes:comma_value (_combat_object.totals_grupo[1])) --> [1] total damage + --EncounterDetailsFrame.StatusBar_totalheal:SetText (Loc ["STRING_TOTAL_HEAL"]..": ".. _detalhes:comma_value (_combat_object.totals_grupo[2])) --> [2] total heal --> Container Overall Damage Taken --[[ data mine: @@ -1026,6 +1044,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) --> agora ja tenho a lista de todos os adds da luta -- vasculhar o container de dano e achar os adds: + -- ~add local adds = {} @@ -1089,8 +1108,11 @@ function EncounterDetails:OpenAndRefresh (_, segment) --> montou a tabela, agora precisa mostrar no painel - local function _DanoFeito (barra) - barra = barra:GetParent() + local function _DanoFeito (self) + + self.textura:SetBlendMode ("ADD") + + local barra = self:GetParent() local tabela = barra.jogador local dano_em = tabela.dano_em @@ -1111,8 +1133,11 @@ function EncounterDetails:OpenAndRefresh (_, segment) GameTooltip:Show() end - local function _DanoRecebido (barra) - barra = barra:GetParent() + local function _DanoRecebido (self) + + self.textura:SetBlendMode ("ADD") + + local barra = self:GetParent() local tabela = barra.jogador local damage_from = tabela.damage_from @@ -1139,6 +1164,11 @@ function EncounterDetails:OpenAndRefresh (_, segment) GameTooltip:Show() end + local function _OnHide (self) + GameTooltip:Hide() + self.textura:SetBlendMode ("BLEND") + end + local y = 10 local frame_adds = EncounterDetailsFrame.overall_adds container = frame_adds.gump @@ -1153,8 +1183,11 @@ function EncounterDetails:OpenAndRefresh (_, segment) local barra = container.barras [index] if (not barra) then - barra = EncounterDetails:CreateRow (index, container) - barra:SetWidth (160) + barra = EncounterDetails:CreateRow (index, container, -0) + barra:SetBackdrop (backdrop_bar_onleave) + barra:SetBackdropColor (.0, .0, .0, 0.3) + + barra:SetWidth (155) barra._no_report = true @@ -1168,11 +1201,11 @@ function EncounterDetails:OpenAndRefresh (_, segment) add_damage_taken:SetResizable (false) add_damage_taken:SetPoint ("left", barra, "left", 0, 0) - add_damage_taken:SetBackdrop (gump_fundo_backdrop) - add_damage_taken:SetBackdropColor (.3, .7, .7, 0.8) + add_damage_taken:SetBackdrop ({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16}) + add_damage_taken:SetBackdropColor (.0, .5, .0, 0.5) add_damage_taken:SetScript ("OnEnter", _DanoRecebido) - add_damage_taken:SetScript ("OnLeave", function() GameTooltip:Hide() end) + add_damage_taken:SetScript ("OnLeave", _OnHide) add_damage_taken:SetScript ("OnClick", EncounterDetails.BossInfoRowClick) add_damage_taken.textura = add_damage_taken:CreateTexture (nil, "overlay") @@ -1191,8 +1224,8 @@ function EncounterDetails:OpenAndRefresh (_, segment) add_damage_done:SetResizable (false) add_damage_done:SetPoint ("left", add_damage_taken, "right", 0, 0) - add_damage_done:SetBackdrop (gump_fundo_backdrop) - add_damage_done:SetBackdropColor (.9, .9, .3, 0.8) + add_damage_done:SetBackdrop ({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16}) + add_damage_done:SetBackdropColor (.5, .0, .0, 0.5) add_damage_done.textura = add_damage_done:CreateTexture (nil, "overlay") add_damage_done.textura:SetTexture ("Interface\\Buttons\\UI-MicroStream-Red") @@ -1201,7 +1234,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) add_damage_done.textura:SetPoint ("topleft", add_damage_done, "topleft") add_damage_done:SetScript ("OnEnter", _DanoFeito) - add_damage_done:SetScript ("OnLeave", function() GameTooltip:Hide() end) + add_damage_done:SetScript ("OnLeave", _OnHide) add_damage_done:SetScript ("OnClick", EncounterDetails.BossInfoRowClick) barra.texto_esquerdo:SetPoint ("left", add_damage_done, "right") @@ -1213,10 +1246,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) end barra.texto_esquerdo:SetText (addName) - - --barra.texto_direita:SetText (_detalhes:comma_value (esta_tabela.total)) barra.texto_direita:SetText (_detalhes:ToK (esta_tabela.total)) - barra.texto_esquerdo:SetSize (barra:GetWidth() - barra.texto_direita:GetStringWidth() - 34, 15) barra.jogador = esta_tabela --> barra.jogador agora tem a tabela com --> [1] total dano causado [2] jogadores que foram alvos [3] jogadores que castaram essa magia [4] ID da magia @@ -1225,9 +1255,6 @@ function EncounterDetails:OpenAndRefresh (_, segment) barra.textura:SetStatusBarColor (1, 1, 1, 1) --> a cor pode ser a spell school da magia barra.textura:SetValue (100) - --barra.icone:SetTexture (icone_magia) - --barra.icone:SetTexCoord (_unpack (CLASS_ICON_TCOORDS [jogador.classe])) - barra:Show() quantidade = quantidade + 1 index = index +1 @@ -1300,6 +1327,9 @@ function EncounterDetails:OpenAndRefresh (_, segment) barra = EncounterDetails:CreateRow (index, container, 3, 3, -6) barra.TTT = "total_interrupt" -- tool tip type barra.report_text = "Details! ".. Loc ["STRING_INTERRUPT_BY"] + barra:SetBackdrop (backdrop_bar_onleave) + barra:SetBackdropColor (.0, .0, .0, 0.3) + barra:SetWidth (155) end local spellid = tabela [3] @@ -1411,6 +1441,9 @@ function EncounterDetails:OpenAndRefresh (_, segment) barra = EncounterDetails:CreateRow (index, container, 3, 3, -6) barra.TTT = "dispell" -- tool tip type barra.report_text = "Details! ".. Loc ["STRING_DISPELLED_BY"] + barra:SetBackdrop (backdrop_bar_onleave) + barra:SetBackdropColor (.0, .0, .0, 0.3) + barra:SetWidth (160) end local nome_magia, _, icone_magia = _GetSpellInfo (tabela [3]) @@ -1471,6 +1504,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) _detalhes:SetFontSize (barra.texto_esquerdo, 9) _detalhes:SetFontSize (barra.texto_direita, 9) _detalhes:SetFontFace (barra.texto_esquerdo, "Arial Narrow") + barra:SetWidth (160) end if (tabela [3]:find ("-")) then @@ -1530,6 +1564,7 @@ function EncounterDetails:OnEvent (_, event, ...) show_icon = 5, --automatic hide_on_combat = false, --hide the window when a new combat start max_emote_segments = 3, + opened = 0, } --> Install @@ -1549,8 +1584,6 @@ function EncounterDetails:OnEvent (_, event, ...) print (install.error) end - EncounterDetails.db = saveddata - EncounterDetails.charsaved = EncounterDetailsDB or {emotes = {}} EncounterDetailsDB = EncounterDetails.charsaved diff --git a/plugins/Details_EncounterDetails/frames.lua b/plugins/Details_EncounterDetails/frames.lua index 59ad1d4c..adac599a 100644 --- a/plugins/Details_EncounterDetails/frames.lua +++ b/plugins/Details_EncounterDetails/frames.lua @@ -31,18 +31,8 @@ do end local build_options_panel = function() - local options_frame = CreateFrame ("frame", "EncounterDetailsOptionsWindow", UIParent, "ButtonFrameTemplate") - tinsert (UISpecialFrames, "EncounterDetailsOptionsWindow") - options_frame:SetSize (500, 200) - options_frame:SetFrameStrata ("DIALOG") - options_frame:SetScript ("OnMouseDown", function(self) self:StartMoving()end) - options_frame:SetScript ("OnMouseUp", function(self) self:StopMovingOrSizing()end) - options_frame:SetMovable (true) - options_frame:EnableMouse (true) - options_frame:Hide() - options_frame:SetPoint ("center", UIParent, "center") - options_frame.TitleText:SetText ("Encounter Details Options") - options_frame.portrait:SetTexture ([[Interface\CHARACTERFRAME\TEMPORARYPORTRAIT-FEMALE-BLOODELF]]) + + local options_frame = EncounterDetails:CreatePluginOptionsFrame ("EncounterDetailsOptionsWindow", "Encounter Details Options", 2) -- 1 = only when inside a raid map -- 2 = only when in raid group @@ -87,7 +77,6 @@ do -- /dump DETAILS_PLUGIN_ENCOUNTER_DETAILS.db.show_icon local menu = { - --show when dropdown { type = "select", get = function() return EncounterDetails.db.show_icon end, @@ -208,20 +197,38 @@ do end end - local grafico_cores = {{1, 1, 1, 1}, {1, 0.5, 0.3, 1}, {0.75, 0.7, 0.1, 1}, {0.2, 0.9, 0.2, 1}, {0.2, 0.5, 0.9, 1}} --, {0.9, 0.2, 0.35, 1}, {0.85, 0.55, 0.45, 1}, {0.4, 0.98, 0.29, 1} + local grafico_cores = {{1, 1, 1, 1}, {1, 0.5, 0.3, 1}, {0.75, 0.7, 0.1, 1}, {0.2, 0.9, 0.2, 1}, {0.2, 0.5, 0.9, 1}} local lastBoss = nil + EncounterDetails.CombatsAlreadyDrew = {} + function EncounterDetails:BuildDpsGraphic() - - EncounterDetails.LastGraphicDrew = EncounterDetails.LastGraphicDrew or {} - local graphicData = _detalhes.tabela_vigente:GetTimeData ("Raid Damage Done") - if (not graphicData or not _detalhes.tabela_vigente.start_time or not _detalhes.tabela_vigente.end_time) then - return - elseif (graphicData == EncounterDetails.LastGraphicDrew) then - return + local segment = EncounterDetails._segment + + --print ("Segment:", segment) + local g + + if (not _G.DetailsRaidDpsGraph) then + EncounterDetails:CreateGraphPanel() + g = _G.DetailsRaidDpsGraph else - EncounterDetails.LastGraphicDrew = graphicData + g = _G.DetailsRaidDpsGraph + + --if (not combat.is_boss or not lastBoss or combat.is_boss.index ~= lastBoss) then + -- g.max_damage = 0 + --end + end + g:ResetData() + + local combat = EncounterDetails:GetCombat (segment) + local graphicData = combat:GetTimeData ("Raid Damage Done") + + if (not graphicData or not combat.start_time or not combat.end_time) then + EncounterDetails:Msg ("This segment doesn't have chart data.") + return + --elseif (EncounterDetails.CombatsAlreadyDrew [combat:GetCombatNumber()]) then + --return end if (graphicData.max_value == 0) then @@ -229,128 +236,66 @@ do end --> battle time - if (_detalhes.tabela_vigente.end_time - _detalhes.tabela_vigente.start_time < 12) then + if (combat.end_time - combat.start_time < 12) then return end - local g - - EncounterDetails.Frame.linhas = EncounterDetails.Frame.linhas or 0 - EncounterDetails.Frame.linhas = EncounterDetails.Frame.linhas + 1 + --EncounterDetails.Frame.linhas = EncounterDetails.Frame.linhas or 0 + EncounterDetails.Frame.linhas = 1 if (EncounterDetails.Frame.linhas > 5) then EncounterDetails.Frame.linhas = 1 end - if (not _G.DetailsRaidDpsGraph) then - g = Graphics:CreateGraphLine ("DetailsRaidDpsGraph", EncounterDetails.Frame, "topleft","topleft",20,-76,670,238) - g:SetXAxis (-1,1) - g:SetYAxis (-1,1) - g:SetGridSpacing (false, false) - g:SetGridColor ({0.5,0.5,0.5,0.3}) - g:SetAxisDrawing (false,false) - g:SetAxisColor({1.0,1.0,1.0,1.0}) - g:SetAutoScale (true) - g:SetLineTexture ("smallline") - g:SetBorderSize ("right", 0.001) - g.VerticalLines = {} - g.TryIndicator = {} - - function g:ChangeColorOnDataSeries (index, color) - self.Data [index].Color = color - self.NeedsUpdate=true - end - - function g:AddDataSeriesOnFirstIndex (points, color, n2) - local data - --Make sure there is data points - if not points then - return - end - data=points - if n2==nil then - n2=false + + g.max_damage = 0 + + for _, line in ipairs (g.VerticalLines) do + line:Hide() + end + + lastBoss = combat.is_boss and combat.is_boss.index + + -- + for i = segment + 4, segment+1, -1 do + local combat = EncounterDetails:GetCombat (i) + if (combat) then --the combat exists + local elapsed_time = combat:GetCombatTime() + + if (EncounterDetails.debugmode and not combat.is_boss) then + combat.is_boss = { + index = 1, + name = _detalhes:GetBossName (1098, 1), + zone = "Throne of Thunder", + mapid = 1098, + encounter = "Jin'Rohk the Breaker" + } end - if n2 or (table.getn(points)==2 and table.getn(points[1])~=2) then - data={} - for k,v in ipairs(points[1]) do - tinsert(data,{v,points[2][k]}) + + if (elapsed_time > 12 and combat.is_boss and combat.is_boss.index == lastBoss) then --is the same boss + + local chart_data = combat:GetTimeData ("Raid Damage Done") + if (chart_data and chart_data.max_value and chart_data.max_value > 0) then --have a chart data + --if (not EncounterDetails.CombatsAlreadyDrew [combat:GetCombatNumber()]) then --isn't drew yet + EncounterDetails:DrawSegmentGraphic (g, chart_data, combat) + --EncounterDetails.CombatsAlreadyDrew [combat:GetCombatNumber()] = true + --end end end - - table.insert (self.Data, 1, {Points=data;Color=color}) - - self.NeedsUpdate=true - end - - DetailsFrameWork:NewLabel (EncounterDetails.Frame, EncounterDetails.Frame, nil, "timeamt0", "00:00", "GameFontHighlightSmall") - EncounterDetails.Frame["timeamt0"]:SetPoint ("TOPLEFT", EncounterDetails.Frame, "TOPLEFT", 85, -300) - - for i = 1, 8, 1 do - - local line = g:CreateTexture (nil, "overlay") - line:SetTexture (.5, .5, .5, .7) - line:SetWidth (670) - line:SetHeight (1) - line:SetVertexColor (.4, .4, .4, .8) - - DetailsFrameWork:NewLabel (EncounterDetails.Frame, EncounterDetails.Frame, nil, "dpsamt"..i, "", "GameFontHighlightSmall") - EncounterDetails.Frame["dpsamt"..i]:SetPoint ("TOPLEFT", EncounterDetails.Frame, "TOPLEFT", 27, -61 + (-(24.6*i))) - line:SetPoint ("topleft", EncounterDetails.Frame["dpsamt"..i].widget, "bottom", -27, 0) - - DetailsFrameWork:NewLabel (EncounterDetails.Frame, EncounterDetails.Frame, nil, "timeamt"..i, "", "GameFontHighlightSmall") - EncounterDetails.Frame["timeamt"..i].widget:SetPoint ("TOPLEFT", EncounterDetails.Frame, "TOPLEFT", 75+(73*i), -300) - end - - g.max_time = 0 - g.max_damage = 0 - - EncounterDetails.MaxGraphics = EncounterDetails.MaxGraphics or 5 - - for i = 1, EncounterDetails.MaxGraphics do - local texture = g:CreateTexture (nil, "overlay") - texture:SetWidth (9) - texture:SetHeight (9) - texture:SetPoint ("TOPLEFT", EncounterDetails.Frame, "TOPLEFT", (i*65) + 299, -81) - texture:SetTexture (unpack (grafico_cores[i])) - local text = g:CreateFontString (nil, "OVERLAY", "GameFontHighlightSmall") - text:SetPoint ("LEFT", texture, "right", 2, 0) - text:SetJustifyH ("LEFT") - if (i == 1) then - text:SetText (Loc ["STRING_CURRENT"]) - else - text:SetText (Loc ["STRING_TRY"] .. " #" .. i) - end - --texture:Hide() - g.TryIndicator [#g.TryIndicator+1] = {texture = texture, text = text} - end - - local v = g:CreateTexture (nil, "overlay") - v:SetWidth (1) - v:SetHeight (238) - v:SetPoint ("top", g, "top", 0, 1) - v:SetPoint ("left", g, "left", 55, 0) - v:SetTexture (1, 1, 1, 1) - - local h = g:CreateTexture (nil, "overlay") - h:SetWidth (668) - h:SetHeight (2) - h:SetPoint ("top", g, "top", 0, -217) - h:SetPoint ("left", g, "left") - h:SetTexture (1, 1, 1, 1) - - else - g = _G.DetailsRaidDpsGraph - - if (not _detalhes.tabela_vigente.is_boss or not lastBoss or _detalhes.tabela_vigente.is_boss.index ~= lastBoss) then - g:ResetData() - g.max_damage = 0 end end + -- - lastBoss = _detalhes.tabela_vigente.is_boss and _detalhes.tabela_vigente.is_boss.index + EncounterDetails:DrawSegmentGraphic (g, graphicData, combat, combat) + EncounterDetails.CombatsAlreadyDrew [combat:GetCombatNumber()] = true + g:Show() + + end + + function EncounterDetails:DrawSegmentGraphic (g, graphicData, combat, drawDeathsCombat) + local _data = {} local dps_max = graphicData.max_value local amount = #graphicData @@ -358,10 +303,11 @@ do local scaleW = 1/670 local content = graphicData - table.insert (content, 1, 0) - table.insert (content, 1, 0) - table.insert (content, #content+1, 0) - table.insert (content, #content+1, 0) + tinsert (content, 1, 0) + tinsert (content, 1, 0) + tinsert (content, #content+1, 0) + tinsert (content, #content+1, 0) + local _i = 3 local graphMaxDps = math.max (g.max_damage, dps_max) @@ -370,12 +316,13 @@ do _data [#_data+1] = {scaleW*(_i-2), v/graphMaxDps} --> x and y coords _i = _i + 1 end + + tremove (content, 1) + tremove (content, 1) + tremove (content, #graphicData) + tremove (content, #graphicData) ---[[ precisa de uma proteção contra troca de tabela, no inicio dos trash -Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: - attempt to perform arithmetic on field 'end_time' (a nil value)--]] - - local tempo = _detalhes.tabela_vigente.end_time - _detalhes.tabela_vigente.start_time + local tempo = combat.end_time - combat.start_time if (g.max_time < tempo) then g.max_time = tempo @@ -394,20 +341,14 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: end end - --print ("DPSMAX: " .. dps_max .. " > " .. g.max_damage) - if (dps_max > g.max_damage) then --> normalize previous data - - --table.insert (self.Data, 1, {Points=data;Color=color}) - if (g.max_damage > 0) then local normalizePercent = g.max_damage / dps_max for dataIndex, Data in ipairs (g.Data) do local Points = Data.Points for i = 1, #Points do - --print (Points[i][1], Points[i][2]) Points[i][2] = Points[i][2]*normalizePercent end end @@ -435,102 +376,197 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: for i = 2, #g.Data do g:ChangeColorOnDataSeries (i, grafico_cores [i]) end - - local mortes = _detalhes.tabela_vigente.last_events_tables - local scaleG = 650/_detalhes.tabela_vigente:GetCombatTime() - - for _, row in _ipairs (g.VerticalLines) do - row:Hide() - end - - for i = 1, math.min (3, #mortes) do - - local vRowFrame = g.VerticalLines [i] - local deadTime = mortes [i][2] - _detalhes.tabela_vigente.start_time + + if (drawDeathsCombat) then + local mortes = drawDeathsCombat.last_events_tables + --local scaleG = 650/_detalhes.tabela_vigente:GetCombatTime() + local scaleG = 610/drawDeathsCombat:GetCombatTime() - if (not vRowFrame) then - - vRowFrame = CreateFrame ("frame", "DetailsEncountersVerticalLine"..i, g) - vRowFrame:SetWidth (20) - vRowFrame:SetHeight (43) - vRowFrame:SetFrameLevel (g:GetFrameLevel()+2) - - vRowFrame:SetScript ("OnEnter", function (frame) - - if (vRowFrame.dead[1] and vRowFrame.dead[1][3] and vRowFrame.dead[1][3][2]) then - local nome_magia3, _, icone_magia3 = _GetSpellInfo (vRowFrame.dead[1][3][2]) - if (type (vRowFrame.dead[1][3][3]) == "number") then - nome_magia3 = _detalhes:comma_value (vRowFrame.dead[1][3][3]).." "..nome_magia3 - end - - local nome_magia2, _, icone_magia2 = _GetSpellInfo (vRowFrame.dead[1][2][2]) - if (type (vRowFrame.dead[1][2][3]) == "number") then - nome_magia2 = _detalhes:comma_value (vRowFrame.dead[1][2][3]).." "..nome_magia2 - end - - local nome_magia1, _, icone_magia1 = _GetSpellInfo (vRowFrame.dead[1][1][2]) - if (type (vRowFrame.dead[1][1][3]) == "number") then - nome_magia1 = _detalhes:comma_value (vRowFrame.dead[1][1][3]).." "..nome_magia1 - else --bress - local decorrido = vRowFrame.dead[1][1][4] - _detalhes.tabela_vigente.start_time - local minutos, segundos = _math_floor (decorrido/60), _math_floor (decorrido%60) - nome_magia1 = minutos..":"..segundos.." "..nome_magia1 - end - - GameCooltip:Reset() - - GameCooltip:AddLine (vRowFrame.dead[6].." "..vRowFrame.dead[3]) - GameCooltip:AddIcon ("Interface\\AddOns\\Details_EncounterDetails\\images\\small_icons", _,_,_,_, .75, 1, 0, 1) - - GameCooltip:AddLine (nome_magia3) - GameCooltip:AddIcon (icone_magia3) - - GameCooltip:AddLine (nome_magia2) - GameCooltip:AddIcon (icone_magia1) - - GameCooltip:AddLine (nome_magia1) - GameCooltip:AddIcon (icone_magia1) - - GameCooltip:SetOption ("TextSize", 9.5) - GameCooltip:SetOption ("IconSize", 12) - GameCooltip:SetOption ("HeightAnchorMod", -15) - - GameCooltip:ShowCooltip (frame, "tooltip") - end - end) - - vRowFrame:SetScript ("OnLeave", function (frame) - _detalhes.popup:ShowMe (false) - end) - - vRowFrame.texture = vRowFrame:CreateTexture (nil, "overlay") - vRowFrame.texture:SetTexture ("Interface\\AddOns\\Details\\images\\verticalline") - vRowFrame.texture:SetWidth (3) - vRowFrame.texture:SetHeight (20) - vRowFrame.texture:SetPoint ("center", "DetailsEncountersVerticalLine"..i, "center") - vRowFrame.texture:SetPoint ("bottom", "DetailsEncountersVerticalLine"..i, "bottom", 0, 0) - vRowFrame.texture:SetVertexColor (1, 1, 1, .5) - - vRowFrame.icon = vRowFrame:CreateTexture (nil, "overlay") - vRowFrame.icon:SetTexture ("Interface\\WorldStateFrame\\SkullBones") - vRowFrame.icon:SetTexCoord (0.046875, 0.453125, 0.046875, 0.46875) - vRowFrame.icon:SetWidth (16) - vRowFrame.icon:SetHeight (16) - vRowFrame.icon:SetPoint ("center", "DetailsEncountersVerticalLine"..i, "center") - vRowFrame.icon:SetPoint ("bottom", "DetailsEncountersVerticalLine"..i, "bottom", 0, 20) - - g.VerticalLines [i] = vRowFrame + for _, row in _ipairs (g.VerticalLines) do + row:Hide() end - vRowFrame:SetPoint ("topleft", EncounterDetails.Frame, "topleft", (deadTime*scaleG), -268) - vRowFrame.dead = mortes [i] - vRowFrame:Show() + for i = 1, math.min (3, #mortes) do + local vRowFrame = g.VerticalLines [i] + + if (not vRowFrame) then + + vRowFrame = CreateFrame ("frame", "DetailsEncountersVerticalLine"..i, g) + vRowFrame:SetWidth (20) + vRowFrame:SetHeight (43) + vRowFrame:SetFrameLevel (g:GetFrameLevel()+2) + + vRowFrame:SetScript ("OnEnter", function (frame) + + if (vRowFrame.dead[1] and vRowFrame.dead[1][3] and vRowFrame.dead[1][3][2]) then + + GameCooltip:Reset() + + --time of death and player name + GameCooltip:AddLine (vRowFrame.dead[6].." "..vRowFrame.dead[3]) + local class, l, r, t, b = _detalhes:GetClass (vRowFrame.dead[3]) + if (class) then + GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small]], 1, 1, 12, 12, l, r, t, b) + end + GameCooltip:AddLine ("") + + --last hits: + local death = vRowFrame.dead + local amt = 0 + for i = #death[1], 1, -1 do + local this_hit = death[1][i] + if (type (this_hit[1]) == "boolean" and this_hit[1]) then + local spellname, _, spellicon = _GetSpellInfo (this_hit[2]) + local t = death [2] - this_hit [4] + GameCooltip:AddLine ("-" .. _cstr ("%.1f", t) .. " " .. spellname .. " (" .. this_hit[6] .. ")", EncounterDetails:comma_value (this_hit [3])) + GameCooltip:AddIcon (spellicon, 1, 1, 12, 12, 0.1, 0.9, 0.1, 0.9) + amt = amt + 1 + if (amt == 3) then + break + end + end + end + + GameCooltip:SetOption ("TextSize", 9.5) + GameCooltip:SetOption ("HeightAnchorMod", -15) + + GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) + GameCooltip:ShowCooltip (frame, "tooltip") + end + end) + + vRowFrame:SetScript ("OnLeave", function (frame) + _detalhes.popup:ShowMe (false) + end) + + vRowFrame.texture = vRowFrame:CreateTexture (nil, "overlay") + vRowFrame.texture:SetTexture ("Interface\\AddOns\\Details\\images\\verticalline") + vRowFrame.texture:SetWidth (3) + vRowFrame.texture:SetHeight (20) + vRowFrame.texture:SetPoint ("center", "DetailsEncountersVerticalLine"..i, "center") + vRowFrame.texture:SetPoint ("bottom", "DetailsEncountersVerticalLine"..i, "bottom", 0, 0) + vRowFrame.texture:SetVertexColor (1, 1, 1, .5) + + vRowFrame.icon = vRowFrame:CreateTexture (nil, "overlay") + vRowFrame.icon:SetTexture ("Interface\\WorldStateFrame\\SkullBones") + vRowFrame.icon:SetTexCoord (0.046875, 0.453125, 0.046875, 0.46875) + vRowFrame.icon:SetWidth (16) + vRowFrame.icon:SetHeight (16) + vRowFrame.icon:SetPoint ("center", "DetailsEncountersVerticalLine"..i, "center") + vRowFrame.icon:SetPoint ("bottom", "DetailsEncountersVerticalLine"..i, "bottom", 0, 20) + + g.VerticalLines [i] = vRowFrame + end + + local deadTime = mortes [i].dead_at + --print (deadTime, mortes [i][3]) + vRowFrame:SetPoint ("topleft", EncounterDetails.Frame, "topleft", (deadTime*scaleG)+70, -268) + vRowFrame.dead = mortes [i] + vRowFrame:Show() + + end + end + end + + function EncounterDetails:CreateGraphPanel() + local g = Graphics:CreateGraphLine ("DetailsRaidDpsGraph", EncounterDetails.Frame, "topleft","topleft",20,-76,670,238) + g:SetXAxis (-1,1) + g:SetYAxis (-1,1) + g:SetGridSpacing (false, false) + g:SetGridColor ({0.5,0.5,0.5,0.3}) + g:SetAxisDrawing (false,false) + g:SetAxisColor({1.0,1.0,1.0,1.0}) + g:SetAutoScale (true) + g:SetLineTexture ("smallline") + g:SetBorderSize ("right", 0.001) + g.VerticalLines = {} + g.TryIndicator = {} + + function g:ChangeColorOnDataSeries (index, color) + self.Data [index].Color = color + self.NeedsUpdate=true end - _G.DetailsRaidDpsGraph:Show() + function g:AddDataSeriesOnFirstIndex (points, color, n2) + local data + --Make sure there is data points + if not points then + return + end + + data=points + if n2==nil then + n2=false + end + if n2 or (table.getn(points)==2 and table.getn(points[1])~=2) then + data={} + for k,v in ipairs(points[1]) do + tinsert(data,{v,points[2][k]}) + end + end + + table.insert (self.Data, 1, {Points=data;Color=color}) + + self.NeedsUpdate=true + end + + DetailsFrameWork:NewLabel (EncounterDetails.Frame, EncounterDetails.Frame, nil, "timeamt0", "00:00", "GameFontHighlightSmall") + EncounterDetails.Frame["timeamt0"]:SetPoint ("TOPLEFT", EncounterDetails.Frame, "TOPLEFT", 85, -300) - end + for i = 1, 8, 1 do + + local line = g:CreateTexture (nil, "overlay") + line:SetTexture (.5, .5, .5, .7) + line:SetWidth (670) + line:SetHeight (1) + line:SetVertexColor (.4, .4, .4, .8) + + DetailsFrameWork:NewLabel (EncounterDetails.Frame, EncounterDetails.Frame, nil, "dpsamt"..i, "", "GameFontHighlightSmall") + EncounterDetails.Frame["dpsamt"..i]:SetPoint ("TOPLEFT", EncounterDetails.Frame, "TOPLEFT", 27, -61 + (-(24.6*i))) + line:SetPoint ("topleft", EncounterDetails.Frame["dpsamt"..i].widget, "bottom", -27, 0) + + DetailsFrameWork:NewLabel (EncounterDetails.Frame, EncounterDetails.Frame, nil, "timeamt"..i, "", "GameFontHighlightSmall") + EncounterDetails.Frame["timeamt"..i].widget:SetPoint ("TOPLEFT", EncounterDetails.Frame, "TOPLEFT", 75+(73*i), -300) + end + + g.max_time = 0 + g.max_damage = 0 + + EncounterDetails.MaxGraphics = EncounterDetails.MaxGraphics or 5 + + for i = 1, EncounterDetails.MaxGraphics do + local texture = g:CreateTexture (nil, "overlay") + texture:SetWidth (9) + texture:SetHeight (9) + texture:SetPoint ("TOPLEFT", EncounterDetails.Frame, "TOPLEFT", (i*65) + 299, -81) + texture:SetTexture (unpack (grafico_cores[i])) + local text = g:CreateFontString (nil, "OVERLAY", "GameFontHighlightSmall") + text:SetPoint ("LEFT", texture, "right", 2, 0) + text:SetJustifyH ("LEFT") + if (i == 1) then + text:SetText (Loc ["STRING_CURRENT"]) + else + text:SetText (Loc ["STRING_TRY"] .. " #" .. i) + end + --texture:Hide() + g.TryIndicator [#g.TryIndicator+1] = {texture = texture, text = text} + end + + local v = g:CreateTexture (nil, "overlay") + v:SetWidth (1) + v:SetHeight (238) + v:SetPoint ("top", g, "top", 0, 1) + v:SetPoint ("left", g, "left", 55, 0) + v:SetTexture (1, 1, 1, 1) + + local h = g:CreateTexture (nil, "overlay") + h:SetWidth (668) + h:SetHeight (2) + h:SetPoint ("top", g, "top", 0, -217) + h:SetPoint ("left", g, "left") + h:SetTexture (1, 1, 1, 1) + end local BossFrame = EncounterDetails.Frame @@ -565,6 +601,8 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: if (botao == "LeftButton") then self:StartMoving() self.isMoving = true + elseif (botao == "RightButton" and not self.isMoving) then + EncounterDetails:CloseWindow() end end) @@ -735,7 +773,8 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: widget:Hide() end - BossFrame.segmentosDropdown:Disable() + BossFrame.segmentosDropdown:Enable() + --BossFrame.segmentosDropdown:Disable() end end @@ -809,7 +848,11 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: --tooltips BossFrame.buttonSwitchNormal.MouseOnEnterHook = function() GameCooltip:Reset() - GameCooltip:AddLine (Loc ["STRING_FIGHT_SUMMARY"]) + --GameCooltip:AddLine (Loc ["STRING_FIGHT_SUMMARY"]) + GameCooltip:AddLine (Loc ["STRING_FIGHT_SUMMARY"], nil, nil, "orange", nil, 12) + --GameCooltip:AddIcon ("Interface\\AddOns\\Details_EncounterDetails\\images\\boss_frame_buttons", 1, 1, 16, 16, 0, 0.1015625, 0, 0.515625) + + GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) GameCooltip:ShowCooltip (BossFrame.buttonSwitchNormal, "tooltip") t:SetBlendMode ("ADD") end @@ -817,7 +860,10 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: -- BossFrame.buttonSwitchGraphic.MouseOnEnterHook = function() GameCooltip:Reset() - GameCooltip:AddLine (Loc ["STRING_FIGHT_GRAPHIC"]) + GameCooltip:AddLine (Loc ["STRING_FIGHT_GRAPHIC"], nil, nil, "orange", nil, 12) + --GameCooltip:AddIcon ("Interface\\AddOns\\Details_EncounterDetails\\images\\boss_frame_buttons", 1, 1, 16, 16, 0.1171875, 0.21875, 0, 0.515625) + + GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) GameCooltip:ShowCooltip (BossFrame.buttonSwitchGraphic, "tooltip") g:SetBlendMode ("ADD") end @@ -825,7 +871,10 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: -- BossFrame.buttonSwitchBossEmotes:SetHook ("OnEnter", function() GameCooltip:Reset() - GameCooltip:AddLine ("boss emotes") + GameCooltip:AddLine ("boss emotes", nil, nil, "orange", nil, 12) + --GameCooltip:AddIcon ("Interface\\AddOns\\Details_EncounterDetails\\images\\boss_frame_buttons", 1, 1, 16, 16, 90/256, 116/256, 0, 0.515625) + + GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) GameCooltip:ShowCooltip (BossFrame.buttonSwitchBossEmotes, "tooltip") e:SetBlendMode ("ADD") end) @@ -1278,10 +1327,12 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: mouseOver_adds_frame:SetScript ("OnEnter", function() - _G.DetailsBubble:SetOwner (mouseOver_adds_frame.imagem, nil, nil, -45, -22) - _G.DetailsBubble:FlipHorizontal() - _G.DetailsBubble:SetBubbleText (Loc ["STRING_ADDS_HELP"]) - _G.DetailsBubble:ShowBubble() + if (EncounterDetails.db.opened < 30) then + _G.DetailsBubble:SetOwner (mouseOver_adds_frame.imagem, nil, nil, -45, -22) + _G.DetailsBubble:FlipHorizontal() + _G.DetailsBubble:SetBubbleText (Loc ["STRING_ADDS_HELP"]) + _G.DetailsBubble:ShowBubble() + end mouseOver_adds_frame.imagem:SetTexCoord (0.7734375, 0.99609375, 0.03125, 0.3671875) end) mouseOver_adds_frame:SetScript ("OnLeave", @@ -1305,16 +1356,16 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: --container_adds_window:SetBackdropColor (0, 0, 0, 0.1) container_adds_frame:SetAllPoints (container_adds_window) - container_adds_frame:SetWidth (170) + container_adds_frame:SetWidth (175) container_adds_frame:SetHeight (67) container_adds_frame:EnableMouse (true) container_adds_frame:SetResizable (false) container_adds_frame:SetMovable (true) - container_adds_window:SetWidth (170) + container_adds_window:SetWidth (175) container_adds_window:SetHeight (65) container_adds_window:SetScrollChild (container_adds_frame) - container_adds_window:SetPoint ("TOPLEFT", frame, "TOPLEFT", 260, -113) + container_adds_window:SetPoint ("TOPLEFT", frame, "TOPLEFT", 255, -113) DetailsFrameWork:NewLabel (container_adds_window, container_adds_window, nil, "titulo", Loc ["STRING_ADDS"], "QuestFont_Large", 16, {1, 1, 1}) container_adds_window.titulo:SetPoint ("bottomleft", container_adds_window, "topleft", 0, 4) @@ -1355,10 +1406,11 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: mouseOver_interrupt_frame:SetScript ("OnEnter", function() - _G.DetailsBubble:SetOwner (mouseOver_interrupt_frame.imagem, nil, nil, 40, -18) - --_G.DetailsBubble:FlipHorizontal() - _G.DetailsBubble:SetBubbleText (Loc ["STRING_INTERRIPT_HELP"]) - _G.DetailsBubble:ShowBubble() + if (EncounterDetails.db.opened < 30) then + _G.DetailsBubble:SetOwner (mouseOver_interrupt_frame.imagem, nil, nil, 40, -18) + _G.DetailsBubble:SetBubbleText (Loc ["STRING_INTERRIPT_HELP"]) + _G.DetailsBubble:ShowBubble() + end mouseOver_interrupt_frame.imagem:SetTexCoord (0.6015625, 1, 0.4296875, 0.6953125) end) mouseOver_interrupt_frame:SetScript ("OnLeave", @@ -1374,29 +1426,22 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: container_interrupt_frame.barras = {} - --container_interrupt_window:SetBackdrop({edgeFile = "Interface\\DialogFrame\\UI-DialogBox-gold-Border", tile = true, tileSize = 16, edgeSize = 5, insets = {left = 1, right = 1, top = 0, bottom = 1},}) - --container_interrupt_window:SetBackdropBorderColor (0,0,0,0) - - --container_interrupt_window:SetBackdrop (gump_fundo_backdrop) - --container_interrupt_window:SetBackdropBorderColor (1, 1, 1, 1) - --container_interrupt_window:SetBackdropColor (0, 0, 0, 0.1) - container_interrupt_frame:SetAllPoints (container_interrupt_window) - container_interrupt_frame:SetWidth (170) + container_interrupt_frame:SetWidth (185) container_interrupt_frame:SetHeight (67) container_interrupt_frame:EnableMouse (true) container_interrupt_frame:SetResizable (false) container_interrupt_frame:SetMovable (true) - container_interrupt_window:SetWidth (170) + container_interrupt_window:SetWidth (185) container_interrupt_window:SetHeight (65) container_interrupt_window:SetScrollChild (container_interrupt_frame) - container_interrupt_window:SetPoint ("TOPLEFT", frame, "TOPLEFT", 480, -113) + container_interrupt_window:SetPoint ("TOPLEFT", frame, "TOPLEFT", 470, -113) DetailsFrameWork:NewLabel (container_interrupt_window, container_interrupt_window, nil, "titulo", Loc ["STRING_INTERRUPTS"], "QuestFont_Large", 16, {1, 1, 1}) container_interrupt_window.titulo:SetPoint ("bottomleft", container_interrupt_window, "topleft", 0, 4) - DetailsFrameWork:NewScrollBar (container_interrupt_window, container_interrupt_frame, 4, -13) + DetailsFrameWork:NewScrollBar (container_interrupt_window, container_interrupt_frame, -1, -13) container_interrupt_window.slider:Altura (45) container_interrupt_window.slider:cimaPoint (0, 1) container_interrupt_window.slider:baixoPoint (0, -1) @@ -1432,10 +1477,12 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: mouseOver_dispell_frame:SetScript ("OnEnter", function() - _G.DetailsBubble:SetOwner (mouseOver_dispell_frame.imagem, nil, nil, -45, -22) - _G.DetailsBubble:FlipHorizontal() - _G.DetailsBubble:SetBubbleText (Loc ["STRING_DISPELL_HELP"]) - _G.DetailsBubble:ShowBubble() + if (EncounterDetails.db.opened < 30) then + _G.DetailsBubble:SetOwner (mouseOver_dispell_frame.imagem, nil, nil, -45, -22) + _G.DetailsBubble:FlipHorizontal() + _G.DetailsBubble:SetBubbleText (Loc ["STRING_DISPELL_HELP"]) + _G.DetailsBubble:ShowBubble() + end mouseOver_dispell_frame.imagem:SetTexCoord (0.1796875, 0.3359375, 0.4140625, 0.71875) end) mouseOver_dispell_frame:SetScript ("OnLeave", @@ -1451,29 +1498,22 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: container_dispell_frame.barras = {} - --container_dispell_window:SetBackdrop (backdrop) - --container_dispell_window:SetBackdropBorderColor (0,0,0,0) - - --container_dispell_window:SetBackdrop (gump_fundo_backdrop) - --container_dispell_window:SetBackdropBorderColor (1, 1, 1, 1) - --container_dispell_window:SetBackdropColor (0, 0, 0, 0.1) - container_dispell_frame:SetAllPoints (container_dispell_window) - container_dispell_frame:SetWidth (170) + container_dispell_frame:SetWidth (190) container_dispell_frame:SetHeight (62) container_dispell_frame:EnableMouse (true) container_dispell_frame:SetResizable (false) container_dispell_frame:SetMovable (true) - container_dispell_window:SetWidth (170) + container_dispell_window:SetWidth (190) container_dispell_window:SetHeight (68) container_dispell_window:SetScrollChild (container_dispell_frame) - container_dispell_window:SetPoint ("TOPLEFT", frame, "TOPLEFT", 260, -231) + container_dispell_window:SetPoint ("TOPLEFT", frame, "TOPLEFT", 245, -231) DetailsFrameWork:NewLabel (container_dispell_window, container_dispell_window, nil, "titulo", Loc ["STRING_DISPELLS"], "QuestFont_Large", 16, {1, 1, 1}) container_dispell_window.titulo:SetPoint ("bottomleft", container_dispell_window, "topleft", 0, 4) - DetailsFrameWork:NewScrollBar (container_dispell_window, container_dispell_frame, 4, -13) + DetailsFrameWork:NewScrollBar (container_dispell_window, container_dispell_frame, -1, -13) container_dispell_window.slider:Altura (45) container_dispell_window.slider:cimaPoint (0, 1) container_dispell_window.slider:baixoPoint (0, -1) @@ -1483,8 +1523,7 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: container_dispell_frame.window = container_dispell_window container_dispell_window.ultimo = 0 frame.overall_dispell = container_dispell_window - - + --> Caixa das mortes local container_dead_window = CreateFrame ("ScrollFrame", "Details_Boss_ContainerDead", frame) @@ -1510,10 +1549,11 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: mouseOver_dead_frame:SetScript ("OnEnter", function() - _G.DetailsBubble:SetOwner (mouseOver_dead_frame.imagem, nil, nil, 40, -18) - --_G.DetailsBubble:FlipHorizontal() - _G.DetailsBubble:SetBubbleText (Loc ["STRING_DEATHS_HELP"]) - _G.DetailsBubble:ShowBubble() + if (EncounterDetails.db.opened < 30) then + _G.DetailsBubble:SetOwner (mouseOver_dead_frame.imagem, nil, nil, 40, -18) + _G.DetailsBubble:SetBubbleText (Loc ["STRING_DEATHS_HELP"]) + _G.DetailsBubble:ShowBubble() + end mouseOver_dead_frame.imagem:SetTexCoord (0.171875, 0.3359375, 0.03125, 0.34375) end) mouseOver_dead_frame:SetScript ("OnLeave", @@ -1528,31 +1568,23 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156: mouseOver_dead_frame:SetScript ("OnMouseUp", mouse_up) container_dead_frame.barras = {} - - --container_dead_window:SetBackdrop({edgeFile = "Interface\\DialogFrame\\UI-DialogBox-gold-Border", tile = true, tileSize = 16, edgeSize = 5, insets = {left = 1, right = 1, top = 0, bottom = 1},}) - --container_dead_window:SetBackdropBorderColor (0,0,0,0) - - --container_dead_window:SetBackdrop (gump_fundo_backdrop) - --container_dead_window:SetBackdropBorderColor (1, 1, 1, 1) - --container_dead_window:SetBackdropColor (0, 0, 0, 0.1) - - --container_dead_frame:SetAllPoints (container_dead_window) + container_dead_frame:SetPoint ("left", container_dead_window, "left") container_dead_frame:SetPoint ("right", container_dead_window, "right") container_dead_frame:SetPoint ("top", container_dead_window, "top") container_dead_frame:SetPoint ("bottom", container_dead_window, "bottom", 0, 10) - container_dead_frame:SetWidth (170) + container_dead_frame:SetWidth (178) container_dead_frame:SetHeight (60) container_dead_frame:EnableMouse (true) container_dead_frame:SetResizable (false) container_dead_frame:SetMovable (true) - container_dead_window:SetWidth (170) + container_dead_window:SetWidth (178) container_dead_window:SetHeight (70) container_dead_window:SetScrollChild (container_dead_frame) - container_dead_window:SetPoint ("TOPLEFT", frame, "TOPLEFT", 480, -235) + container_dead_window:SetPoint ("TOPLEFT", frame, "TOPLEFT", 472, -235) DetailsFrameWork:NewLabel (container_dead_window, container_dead_window, nil, "titulo", Loc ["STRING_DEATH_LOG"], "QuestFont_Large", 16, {1, 1, 1}) container_dead_window.titulo:SetPoint ("bottomleft", container_dead_window, "topleft", 0, 3) diff --git a/plugins/Details_RaidInfo-SiegeOfOrgrimmar/SiegeOfOrgrimmar.lua b/plugins/Details_RaidInfo-SiegeOfOrgrimmar/SiegeOfOrgrimmar.lua index 25de99af..1898f460 100644 --- a/plugins/Details_RaidInfo-SiegeOfOrgrimmar/SiegeOfOrgrimmar.lua +++ b/plugins/Details_RaidInfo-SiegeOfOrgrimmar/SiegeOfOrgrimmar.lua @@ -20,8 +20,8 @@ local siege_of_orgrimmar = { icon = "Interface\\AddOns\\Details_RaidInfo-SiegeOfOrgrimmar\\images\\icon256x128", is_raid = true, - - background = "Interface\\AddOns\\Details_RaidInfo-SiegeOfOrgrimmar\\images\\wallpaper", + + backgroundFile = {file = [[Interface\Glues\LOADINGSCREENS\LoadScreenSiegeOfOrgrimmar]], coords = {0, 1, 256/1024, 840/1024}}, backgroundEJ = [[Interface\EncounterJournal\UI-EJ-LOREBG-SiegeofOrgrimmar]], boss_names = { diff --git a/plugins/Details_RaidInfo-SiegeOfOrgrimmar/images/wallpaper.tga b/plugins/Details_RaidInfo-SiegeOfOrgrimmar/images/wallpaper.tga deleted file mode 100644 index 59d88d23..00000000 Binary files a/plugins/Details_RaidInfo-SiegeOfOrgrimmar/images/wallpaper.tga and /dev/null differ diff --git a/plugins/Details_RaidInfo-ThroneOfThunder/ThroneOfThunder.lua b/plugins/Details_RaidInfo-ThroneOfThunder/ThroneOfThunder.lua index c1c0baab..31b80de1 100644 --- a/plugins/Details_RaidInfo-ThroneOfThunder/ThroneOfThunder.lua +++ b/plugins/Details_RaidInfo-ThroneOfThunder/ThroneOfThunder.lua @@ -21,7 +21,7 @@ local throne_of_thunder = { is_raid = true, - background = "Interface\\AddOns\\Details_RaidInfo-ThroneOfThunder\\images\\raid_tot", + backgroundFile = {file = [[Interface\Glues\LOADINGSCREENS\LoadscreenThunderkingRaid]], coords = {0, 1, 256/1024, 840/1024}}, backgroundEJ = [[Interface\EncounterJournal\UI-EJ-LOREBG-ThunderKingRaid]], boss_names = { diff --git a/plugins/Details_RaidInfo-ThroneOfThunder/images/raid_tot.tga b/plugins/Details_RaidInfo-ThroneOfThunder/images/raid_tot.tga deleted file mode 100644 index 74681589..00000000 Binary files a/plugins/Details_RaidInfo-ThroneOfThunder/images/raid_tot.tga and /dev/null differ diff --git a/plugins/Details_SpellDetails/Details_SpellDetails.lua b/plugins/Details_SpellDetails/Details_SpellDetails.lua deleted file mode 100644 index 7ddfa87e..00000000 --- a/plugins/Details_SpellDetails/Details_SpellDetails.lua +++ /dev/null @@ -1,1338 +0,0 @@ -local Loc = LibStub ("AceLocale-3.0"):GetLocale ("Details_SpellDetails") -local Graphics = LibStub:GetLibrary("LibGraph-2.0") - ---> Main Plugin Object -local SpellDetails = _detalhes:NewPluginObject ("Details_SpellDetails") ---> Main Frame -local SpellDetailsFrame = SpellDetails.Frame - ---> Needed locals -local _GetTime = GetTime --> wow api local -local _UFC = UnitAffectingCombat --> wow api local -local _IsInRaid = IsInRaid --> wow api local -local _IsInGroup = IsInGroup --> wow api local -local _UnitAura = UnitAura --> wow api local -local _CreateFrame = CreateFrame --> wow api local -local _ipairs = ipairs --> lua library local -local _pairs = pairs --> lua library local -local _string_len = string.len --> lua library local -local _math_floor = math.floor --> lua library local -local _cstr = string.format --> lua library local -local _string_format = string.format -local _table_sort = table.sort -local _tostring = tostring -local _GetSpellInfo =_detalhes.getspellinfo --> details spell cache -local _string_lower = string.lower -local _string_sub = string.sub - ---> this function will run when the plugin receives the Addon_Loaded event, ["data"] = previus saved player rank -local function CreatePluginFrames (data) - - --> catch Details! main object - local _detalhes = _G._detalhes - local DetailsFrameWork = _detalhes.gump - - if (not _detalhes) then - --> details isn't active - return - end - - --> Saved Data - SpellDetails.data = data or {} - SpellDetails.updating = false - - local player_damage_done = function (support_table, time_table, tick_second) - - local player = _detalhes.tabela_vigente (1, _detalhes.playername) - - if (player) then - - local total_damage = player.total - - local current_damage = total_damage - support_table.last_damage - - time_table [tick_second] = current_damage - - if (current_damage > support_table.max_damage) then - support_table.max_damage = current_damage - time_table.max_damage = current_damage - end - - support_table.last_damage = total_damage - - else - time_table [tick_second] = 0 - end - - end - - local string_player_damage_done = [[ - - -- the goal of this script is get the current combat then get your character and extract your damage done. - -- the first thing to do is get the combat, so, we use here the command "_detalhes:GetCombat ( "overall" "current" or "segment number")" - - local current_combat = _detalhes:GetCombat ("current") --> getting the current combat - - -- the next step is request your character from the combat - -- to do this, we take the combat which here we named "current_combat" and tells what we want inside parentheses. - - local my_self = current_combat (DETAILS_ATTRIBUTE_DAMAGE, _detalhes.playername) - - -- _detalhes.playername holds the name of your character. - -- DETAILS_ATTRIBUTE_DAMAGE means we want the damage table, _HEAL _ENERGY _MISC is the other 3 tables. - - -- before we proceed, the result needs to be checked to make sure its a valid result. - - if (not my_self) then - return 0 -- the combat doesnt have *you*, this happens when you didn't deal any damage in the combat yet. - end - - -- now its time to get the total damage. - - local my_damage = my_self.total - - -- then finally return the amount to the capture. - - return my_damage - - ]] - - function SpellDetails:OnDetailsEvent (event, ...) - - if (event == "SHOW") then --> plugin shown on screen, actived - - --> register a custom time capture // time capture is a custom function wich will run every second and grab any kind of data. - --> here we want to capture the damage of "player". - --> _detalhes:RegisterTimeCapture ( function, give a name, parameters table ) - - elseif (event == "HIDE") then --> plugin hidded, disabled - SpellDetailsFrame:SetScript ("OnUpdate", nil) - - SpellDetails.playerActor = nil - - elseif (event == "DETAILS_STARTED") then - - -- _detalhes:TimeDataRegister ("Player Damage Done", player_damage_done, {last_damage = 0, max_damage = 0}, "Spell Details", "v1.0", [[Interface\ICONS\Achievement_Leader_Tyrande_Whisperwind]], true) - _detalhes:TimeDataRegister ("Player Damage Done", string_player_damage_done, nil, "Spell Details", "v1.0", [[Interface\ICONS\Achievement_Leader_Tyrande_Whisperwind]], true, true) - - elseif (event == "REFRESH") then --> requested a refresh window - SpellDetails:Refresh() - - elseif (event == "COMBAT_PLAYER_TIMESTARTED") then --> combat started - - if (not SpellDetailsFrame:GetScript ("OnUpdate")) then - _detalhes:RegisterEvent (SpellDetails, "BUFF_UPDATE") --> register buffs on player - _detalhes:RegisterEvent (SpellDetails, "BUFF_UPDATE_DEBUFFPOWER") --> register debuffs wich player cast on oponents - SpellDetails:RefreshBuffs() - SpellDetails:JanelaSoloUpdate (1) - SpellDetails.playerActor = select (2, ...) - end - - elseif (event == "BUFF_UPDATE") then - --> trigger when a buff is applyed on player - SpellDetails:RefreshBuffs() - - elseif (event == "PLUGIN_DISABLED") then - - elseif (event == "PLUGIN_ENABLED") then - - end - end - - function SpellDetails:CombatEnd() - _detalhes:UnregisterEvent (SpellDetails, "BUFF_UPDATE") - _detalhes:UnregisterEvent (SpellDetails, "BUFF_UPDATE_DEBUFFPOWER") - SpellDetailsFrame:SetScript ("OnUpdate", nil) - SpellDetails:RefreshBuffs() - end - ---------> Build Frame and Widgets --------------------------------------------------------------------------------------------------------------------------- - SpellDetailsFrame:SetResizable (false) - SpellDetailsFrame:SetPoint ("TOPLEFT", UIParent, "TOPLEFT") - SpellDetailsFrame:SetWidth (1) - SpellDetailsFrame:SetHeight (1) - - --> Widgets Container - SpellDetails.SummaryLine = {} - SpellDetails.SpellButtons = {} - SpellDetails.SpellInfoLabels = {} - SpellDetails.BuffTextEntry = {} - - --> reset all labels - function SpellDetails:ResetWindow() - SpellDetails.SummaryLine:Reset() - SpellDetails.SpellButtons:Reset() - SpellDetails.SpellInfoLabels:Reset() - SpellDetails:ClearBuffTexts() - end - ---------> Build head displays ----------------------------------------------------------------------------------------- - local y = -5 - local x = { - 25, 55, --> total de feito - 120, 158, --> media - 200, 240 --> tempo decorrido - } - - --> background - SpellDetailsFrame.bg_status = SpellDetailsFrame:CreateTexture (nil, "BACKGROUND") - SpellDetailsFrame.bg_status:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", -35, y+5) - SpellDetailsFrame.bg_status:SetWidth (370) - SpellDetailsFrame.bg_status:SetHeight (30) - SpellDetailsFrame.bg_status:SetTexture ("Interface\\UNITPOWERBARALT\\WowUI_Horizontal_Frame") - - local TotalLabel = DetailsFrameWork:NewLabel (SpellDetailsFrame, SpellDetailsFrame, nil, "SummaryDmg", Loc ["STRING_DAMAGE"]..": ".." 0", "GameFontHighlightSmall") - TotalLabel:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", x[1]-5, y-5) - - local TotalDpsLabel = DetailsFrameWork:NewLabel (SpellDetailsFrame, SpellDetailsFrame, nil, "SummaryDps", Loc ["STRING_DPS"]..":".." 0", "GameFontHighlightSmall") - TotalDpsLabel:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", x[3], y-5) - - local TotalTimeLabel = DetailsFrameWork:NewLabel (SpellDetailsFrame, SpellDetailsFrame, nil, "SummaryTime", Loc ["STRING_TEMPO"]..":".." 0.0", "GameFontHighlightSmall") - TotalTimeLabel:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", x[5]+10, y-5) - - SpellDetails.SummaryLine.total = TotalLabel - SpellDetails.SummaryLine.dps = TotalDpsLabel - SpellDetails.SummaryLine.time = TotalTimeLabel - - function SpellDetails.SummaryLine:Reset() - SpellDetails.SummaryLine.total:SetText (Loc ["STRING_DAMAGE"]..": 0") - SpellDetails.SummaryLine.dps:SetText (Loc ["STRING_DPS"]..":".." 0") - SpellDetails.SummaryLine.time:SetText (Loc ["STRING_TEMPO"]..":".." 0") - end - ---------> Build 9 spells boxes ----------------------------------------------------------------------------------------- - - function SpellDetails:ChangeSpellBox (id, spellid, icon, line1, line2, tooltip) - local BoxTable = SpellDetails.SpellButtons [id] - - if (BoxTable) then - if (icon) then - BoxTable.icon:SetTexture (icon) - end - - if (line1) then - BoxTable.label1:SetText (line1) - end - - if (line2) then - BoxTable.label2:SetText (line2) - end - - if (tooltip) then - BoxTable.button.tooltip = tooltip - end - - BoxTable.spellid = spellid - end - end - - function SpellDetails.ShowSpellDetails (id) - if (SpellDetails.CurrentSpellSlot) then - SpellDetails.SpellButtons [SpellDetails.CurrentSpellSlot].background:Hide() - end - return SpellDetails:DetalhesDaMagia (id) - end - - local CreateSpellBox = function (x, y, w, h, id, framelevel) - - local button = DetailsFrameWork:NewDetailsButton (SpellDetailsFrame, SpellDetailsFrame, _, SpellDetails.ShowSpellDetails, id, _, w, h+10, "Interface\\BUTTONS\\UI-DialogBox-Button-Disabled.blp") - button:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", x, y) - button:SetFrameLevel (framelevel) - - local icon = button:CreateTexture (nil, "OVERLAY") - icon:SetPoint ("TOPLEFT", button, "TOPLEFT", 6, -5) - icon:SetWidth (18) - icon:SetHeight (18) - - local label2 = DetailsFrameWork:NewLabel (button, button, nil, "text2", "", "GameFontHighlightSmall", 9.2) - label2:SetPoint ("LEFT", icon, "RIGHT", 5, 4) - local label1 = DetailsFrameWork:NewLabel (button, button, nil, "text1", "", "GameFontHighlightSmall", 9.2) - label1:SetPoint ("LEFT", icon, "RIGHT", 5, -5) - - local box = button:CreateTexture (nil, "artwork") - box:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", x, y) - box:SetWidth (w) - box:SetHeight (h+10) - box:SetTexture ("Interface\\BUTTONS\\UI-DialogBox-Button-Disabled.blp") - box:SetBlendMode ("ADD") - box:Hide() - - SpellDetails.SpellButtons [id] = {background = box, button = button, icon = icon, label1 = label1, label2 = label2, selected = false} - end - - SpellDetails.SpellButtons.LastSelected = nil - SpellDetails.SpellButtons.selected = SpellDetailsFrame:CreateTexture (nil, "background") - SpellDetails.SpellButtons.selected:SetDrawLayer ("background", 1) - SpellDetails.SpellButtons.selected:SetWidth (98) - SpellDetails.SpellButtons.selected:SetHeight (36) - - function SpellDetails:ClearSpellBox (id) - local BoxTable = SpellDetails.SpellButtons [id] - if (BoxTable) then - BoxTable.icon:SetTexture (nil) - BoxTable.label1:SetText ("") - BoxTable.label2:SetText ("") - BoxTable.button.tooltip = nil - BoxTable.selected = false - end - end - - function SpellDetails.SpellButtons:Reset() - for i = 1, 9 do - SpellDetails:ClearSpellBox (i) - SpellDetails.SpellButtons.LastSelected = nil - SpellDetails.SpellButtons.selected:ClearAllPoints() - end - end - - --> Call the build function for the 9 spell boxes - local ROWX = {6, 106, 206} --> up - - for i = 1, 3 do - CreateSpellBox (ROWX[i], -32, 90, 30, i, 5) - end - for i = 4, 6 do - CreateSpellBox (ROWX[i-3], -62, 90, 30, i, 6) - end - for i = 7, 9 do - CreateSpellBox (ROWX[i-6], -92, 90, 30, i, 7) - end - ---------> Cria o background da esquerda - SpellDetails.graphic = {} - - SpellDetails.graphic.fundo = _CreateFrame ("frame", nil, SpellDetailsFrame) - SpellDetails.graphic.fundo:SetPoint ("topleft", SpellDetailsFrame, "topleft", 5, -133) - SpellDetails.graphic.fundo:SetWidth (288) - SpellDetails.graphic.fundo:SetHeight (160) - SpellDetails.graphic.fundo:SetBackdrop ({ - --edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", - tile = true, tileSize = 16, edgeSize = 10, insets = {left = 1, right = 1, top = 0, bottom = 1}, - bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background"}) - - SpellDetails.graphic.fundo:SetScript ("OnEnter", function() - local _r, _g, _b, _a =SpellDetails.graphic.fundo:GetBackdropColor() - DetailsFrameWork:GradientEffect (SpellDetails.graphic.fundo, "frame", _r, _g, _b, _a, .3, .3, .3, .5, 0.9) - end) - - SpellDetails.graphic.fundo:SetScript ("OnLeave", function() - local _r, _g, _b, _a = SpellDetails.graphic.fundo:GetBackdropColor() - DetailsFrameWork:GradientEffect (SpellDetails.graphic.fundo, "frame", _r, _g, _b, _a, .9, .7, .7, 1, 0.9) - end) - - - --> Cria a janela do gráfico - if (not _G.DetailsSoloDpsGraph) then - local g = Graphics:CreateGraphLine ("DetailsSoloDpsGraph", SpellDetails.graphic.fundo, "topleft", "topleft", 0, 0, 288, 140) - g:SetXAxis (-1,1) - g:SetYAxis (-1,1) - g:SetGridSpacing (false, 0.105) - g:SetGridColor ({0.5, 0.5, 0.5, 0.5}) - g:SetAxisDrawing (true, true) - g:SetAxisColor({1.0, 1.0, 1.0, 1.0}) - g:SetAutoScale (true) - g.CustomRightBorder = 0.001 - g.max_time = 0 - g.max_damage = 0 - g.BuffLines = {} - g.LinesContainer = {} - g.CustomLine = "Interface\\AddOns\\Details\\Libs\\LibGraph-2.0\\smallline" - --g.LockOnXMax = true - - for i = 1, 8, 1 do - DetailsFrameWork:NewLabel (SpellDetails.graphic.fundo, SpellDetails.graphic.fundo, nil, "dpsamt"..i, "", "GameFontHighlightSmall") - SpellDetails.graphic.fundo["dpsamt"..i]:SetPoint ("TOPLEFT", SpellDetails.graphic.fundo, "TOPLEFT", -1, -(14.4*i)) - _detalhes:SetFontSize (SpellDetails.graphic.fundo["dpsamt"..i], 9) - end - - end - - function SpellDetails:UpdateDamageGraphic() - - local GraphicObject = _G.DetailsSoloDpsGraph - - if (not GraphicObject) then - print ("Nao ha um grafico criado.") - return - end - - SpellDetails.LastGraphicDrew = SpellDetails.LastGraphicDrew or {} - - local graphicData = _detalhes.tabela_vigente:GetTimeData ("Player Damage Done") - - if (not graphicData) then - print ("No graphic available for this segment.") - return - end - - if (graphicData == SpellDetails.LastGraphicDrew) then - return - else - SpellDetails.LastGraphicDrew = SpellDetails.LastGraphicDrew - end - - if (graphicData.max_damage == 0) then - return - end - - if (#graphicData < 2) then - local timetooshort = SpellDetails.graphic.fundo.timetooshot or DetailsFrameWork:NewLabel (SpellDetails.graphic.fundo, SpellDetails.graphic.fundo, nil, "timetooshort", Loc ["STRING_TOOSHORT"], "GameFontHighlightSmall") - timetooshort:SetPoint ("TOPLEFT", SpellDetails.graphic.fundo, "TOPLEFT", 40, -55) - _detalhes:SetFontSize (timetooshort, 10) - timetooshort:SetJustifyH ("center") - timetooshort:Show() - return - elseif (SpellDetails.graphic.fundo.timetooshort) then - SpellDetails.graphic.fundo.timetooshort:Hide() - end - - GraphicObject:ResetData() - - local _data = {} - local dps_max = graphicData.max_value - local amount = #graphicData - - local scaleW = 1/288 - - local content = graphicData - table.insert (content, 1, 0) - table.insert (content, 1, 0) - table.insert (content, #content+1, 0) - table.insert (content, #content+1, 0) - local _i = 3 - while (_i <= #content-2) do - local v = (content[_i-2]+content[_i-1]+content[_i]+content[_i+1]+content[_i+2])/5 - _data [#_data+1] = {scaleW*(_i-2), v/dps_max} --> - _i = _i + 1 - end - - local BuffTable = _detalhes.Buffs.BuffsTable - local iconIndex = 1 - - if (BuffTable) then - - local geralLineIndex = 1 - local scaleG = 277/_detalhes.tabela_vigente:GetCombatTime() --288 - - for spellName, spellTable in _pairs (BuffTable) do - - local timeTable = {} - for index, appliedAt in _ipairs (spellTable.appliedAt) do - timeTable [#timeTable+1] = {appliedAt, spellTable.tableIndex} - end - - for index, appliedAt in _ipairs (timeTable) do - local thisLine = GraphicObject.BuffLines [geralLineIndex] - if (not thisLine) then - thisLine = GraphicObject:CreateTexture (nil, "overlay") - thisLine:SetTexture ("Interface\\AddOns\\Details\\images\\verticalline") - thisLine:SetWidth (3) - thisLine:SetHeight (160) - thisLine:SetPoint ("topleft", SpellDetails.graphic.fundo, "topleft", (appliedAt[1]*scaleG)+25, 0) - thisLine:SetVertexColor (.4, .4, .4, .8) - - thisLine.icon = GraphicObject:CreateTexture (nil, "overlay") - local _, _, icon = GetSpellInfo (spellName) - --print (spellName, icon) - thisLine.icon:SetTexture (icon) - thisLine.icon:SetWidth (12) - thisLine.icon:SetHeight (12) - - if (iconIndex == 1) then - thisLine.icon:SetPoint ("left", thisLine, "right", -2, 0) - thisLine.icon:SetPoint ("top", thisLine, "bottom", 0, 25) - elseif (iconIndex == 2) then - thisLine.icon:SetPoint ("right", thisLine, "left", 2, 0) - thisLine.icon:SetPoint ("top", thisLine, "bottom", 0, 25) - elseif (iconIndex == 3) then - thisLine.icon:SetPoint ("right", thisLine, "left", 2, 0) - thisLine.icon:SetPoint ("top", thisLine, "bottom", 0, 12) - elseif (iconIndex == 4) then - thisLine.icon:SetPoint ("left", thisLine, "right", -2, 0) - thisLine.icon:SetPoint ("top", thisLine, "bottom", 0, 12) - end - - GraphicObject.BuffLines [geralLineIndex] = thisLine - else - thisLine:SetPoint ("topleft", SpellDetails.graphic.fundo, "topleft", (appliedAt[1]*scaleG)+28, 0) - local _, _, icon = GetSpellInfo (spellName) - thisLine.icon:SetTexture (icon) - end - - geralLineIndex = geralLineIndex + 1 - end - - iconIndex = iconIndex + 1 - if (iconIndex == 5) then - iconIndex = 1 - end - - end - end - - local dano_divisao = dps_max/8 - local o = 1 - for i = 8, 1, -1 do - local d = _detalhes:ToK0 (dano_divisao*i) - SpellDetails.graphic.fundo["dpsamt"..o]:SetText (d) - o = o + 1 - end - - GraphicObject:AddDataSeries (_data, {1, 1, 1, 1}) - - end - - --> Hida - SpellDetails.graphic.fundo:Hide() - ---------> Cria o background - SpellDetailsFrame.fundo = SpellDetailsFrame:CreateTexture (nil, "background") - SpellDetailsFrame.fundo:SetTexture ("Interface\\AddOns\\Details_SpellDetails\\images\\solo_bg") - SpellDetailsFrame.fundo:SetPoint ("topleft", SpellDetailsFrame, "topleft", 0, -125) - SpellDetailsFrame.fundo:SetWidth (298) - SpellDetailsFrame.fundo:SetHeight (175) - SpellDetailsFrame.fundo:SetTexCoord (0, 0.615234375, 0, 0.6640625) - SpellDetailsFrame.fundo:SetDrawLayer ("background", 1) - ---------> Cria o background da esquerda - SpellDetailsFrame.fundoEsq = _CreateFrame ("frame", nil, SpellDetailsFrame) - --SpellDetailsFrame.fundoEsq:SetTexture ("Interface\\Tooltips\\UI-Tooltip-Background") - SpellDetailsFrame.fundoEsq:SetPoint ("topleft", SpellDetailsFrame, "topleft", 5, -133) - SpellDetailsFrame.fundoEsq:SetWidth (120) - SpellDetailsFrame.fundoEsq:SetHeight (160) - SpellDetailsFrame.fundoEsq:SetBackdrop ({ - edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", - tile = true, tileSize = 16, edgeSize = 10, insets = {left = 1, right = 1, top = 0, bottom = 1}, - bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background"}) - - SpellDetailsFrame.fundoEsq:SetScript ("OnEnter", function() - local _r, _g, _b, _a =SpellDetailsFrame.fundoEsq:GetBackdropColor() - DetailsFrameWork:GradientEffect (SpellDetailsFrame.fundoEsq, "frame", _r, _g, _b, _a, .3, .3, .3, .5, .9) - - end) - - SpellDetailsFrame.fundoEsq:SetScript ("OnLeave", function() - local _r, _g, _b, _a = SpellDetailsFrame.fundoEsq:GetBackdropColor() - DetailsFrameWork:GradientEffect (SpellDetailsFrame.fundoEsq, "frame", _r, _g, _b, _a, .9, .7, .7, 1, .9) - end) - ---------> Cria o background da direita - SpellDetailsFrame.fundoDir = _CreateFrame ("frame", nil, SpellDetailsFrame) - SpellDetailsFrame.fundoDir:SetPoint ("topleft", SpellDetailsFrame, "topright", 127, -138+5) - SpellDetailsFrame.fundoDir:SetWidth (166) - SpellDetailsFrame.fundoDir:SetHeight (160) - SpellDetailsFrame.fundoDir:SetBackdrop ({ - edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", - tile = true, tileSize = 16, edgeSize = 10, insets = {left = 1, right = 1, top = 0, bottom = 1}, - bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background"}) - SpellDetailsFrame.fundoDir:SetScript ("OnEnter", function() - local _r, _g, _b, _a =SpellDetailsFrame.fundoDir:GetBackdropColor() - DetailsFrameWork:GradientEffect (SpellDetailsFrame.fundoDir, "frame", _r, _g, _b, _a, .3, .3, .3, .5, .9) - end) - SpellDetailsFrame.fundoDir:SetScript ("OnLeave", function() - local _r, _g, _b, _a = SpellDetailsFrame.fundoDir:GetBackdropColor() - DetailsFrameWork:GradientEffect (SpellDetailsFrame.fundoDir, "frame", _r, _g, _b, _a, .9, .7, .7, 1, .9) - end) - ------------------------------------------------------------------------------------------------------------------------------------------------ ---> botão switch - - SpellDetails.Detalhes = 1 --> normal - function SpellDetails:ShowGraphic() - --> hidar os 2 blocos em baixo: - - if (SpellDetails.Detalhes == 1) then --> show graphic - - if (InCombatLockdown()) then - print ("|cffFF2222"..Loc ["STRING_INCOMBAT"]) - return - end - - SpellDetailsFrame.fundoEsq:Hide() - SpellDetailsFrame.fundoDir:Hide() - SpellDetails.Detalhes = 2 - SpellDetails.SwitchButton.text:SetText ("X") --> localize-me - SpellDetails.SwitchButton:SetWidth (15) - SpellDetails.graphic.fundo:Show() - SpellDetails:UpdateDamageGraphic (SpellDetailsFrame) - SpellDetails.SwitchButton:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", 275, -136) - - elseif (SpellDetails.Detalhes == 2) then --> show normal details - SpellDetailsFrame.fundoEsq:Show() - SpellDetailsFrame.fundoDir:Show() - SpellDetails.Detalhes = 1 - SpellDetails.SwitchButton.text:SetText ("Graphic") --> localize-me - SpellDetails.SwitchButton:SetWidth (110) - SpellDetails.graphic.fundo:Hide() - SpellDetails.SwitchButton:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", 10, -274) - - end - end - - --> botão para o gráfico: - local SwitchButton = DetailsFrameWork:NewDetailsButton (SpellDetailsFrame, SpellDetailsFrame, _, SpellDetails.ShowGraphic, _, _, 110, 15) - SwitchButton:SetFrameStrata ("TOOLTIP") - SwitchButton:SetFrameLevel (50) - SwitchButton:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", 10, -274) - SwitchButton:SetFrameLevel (6) - SwitchButton:InstallCustomTexture() - SwitchButton.text:SetText ("Graphic") --> localize-me - - SpellDetails.SwitchButton = SwitchButton - - --------------------------------------------------------------------------------------------------------------------------------------------- - --> painel da esquerda inferior (informações da magia) - - local loc_y = {-140, -150, -160, -170, -180, -190, -200, -210, -220, -230, -240} - local xStart = 10 - - local total = DetailsFrameWork:NewLabel (SpellDetailsFrame.fundoEsq, SpellDetailsFrame.fundoEsq, nil, "total", Loc ["STRING_DAMAGE"]..":", "GameFontHighlightSmall") - SpellDetailsFrame.fundoEsq.total:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", xStart, loc_y[1]) - SpellDetails.SpellInfoLabels.total = total - - local dps = DetailsFrameWork:NewLabel (SpellDetailsFrame.fundoEsq, SpellDetailsFrame.fundoEsq, nil, "dps", Loc ["STRING_DPS"]..":", "GameFontHighlightSmall") - SpellDetailsFrame.fundoEsq.dps:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", xStart, loc_y[2]) - SpellDetails.SpellInfoLabels.dps = dps - - local media = DetailsFrameWork:NewLabel (SpellDetailsFrame.fundoEsq, SpellDetailsFrame.fundoEsq, nil, "porcento", Loc ["STRING_PERCENT"]..":", "GameFontHighlightSmall") - SpellDetailsFrame.fundoEsq.porcento:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", xStart, loc_y[3]) - SpellDetails.SpellInfoLabels.porcento = media - - local uptime = DetailsFrameWork:NewLabel (SpellDetailsFrame.fundoEsq, SpellDetailsFrame.fundoEsq, nil, "tempo_em_uso", Loc ["STRING_UPTIME"]..":", "GameFontHighlightSmall") - SpellDetailsFrame.fundoEsq.tempo_em_uso:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", xStart, loc_y[4]) - SpellDetails.SpellInfoLabels.uptime = uptime - - local critical = DetailsFrameWork:NewLabel (SpellDetailsFrame.fundoEsq, SpellDetailsFrame.fundoEsq, nil, "critico", Loc ["STRING_CRIT"]..":", "GameFontHighlightSmall") - SpellDetailsFrame.fundoEsq.critico:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", xStart, loc_y[5]) - SpellDetails.SpellInfoLabels.critical = critical - - local miss = DetailsFrameWork:NewLabel (SpellDetailsFrame.fundoEsq, SpellDetailsFrame.fundoEsq, nil, "miss", Loc ["STRING_MISS"]..":", "GameFontHighlightSmall") - SpellDetailsFrame.fundoEsq.miss:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", xStart, loc_y[6]) - SpellDetails.SpellInfoLabels.miss = miss - - local block = DetailsFrameWork:NewLabel (SpellDetailsFrame.fundoEsq, SpellDetailsFrame.fundoEsq, nil, "blocked", Loc ["STRING_BLOCKED"]..":", "GameFontHighlightSmall") - SpellDetailsFrame.fundoEsq.blocked:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", xStart, loc_y[7]) - SpellDetails.SpellInfoLabels.block = block - - local glancing = DetailsFrameWork:NewLabel (SpellDetailsFrame.fundoEsq, SpellDetailsFrame.fundoEsq, nil, "glancing", "Glancing: ", "GameFontHighlightSmall") - SpellDetailsFrame.fundoEsq.glancing:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPLEFT", xStart, loc_y[8]) - SpellDetails.SpellInfoLabels.glancing = glancing - - function SpellDetails.SpellInfoLabels:Reset() - SpellDetails.SpellInfoLabels.total:SetText (Loc ["STRING_DAMAGE"]..": 0") - SpellDetails.SpellInfoLabels.dps:SetText (Loc ["STRING_DPS"]..":".." 0") - SpellDetails.SpellInfoLabels.porcento:SetText (Loc ["STRING_PERCENT"]..":".." 0") - SpellDetails.SpellInfoLabels.uptime:SetText (Loc ["STRING_UPTIME"]..":".." 0") - SpellDetails.SpellInfoLabels.critical:SetText (Loc ["STRING_CRIT"]..":".." 0") - SpellDetails.SpellInfoLabels.miss:SetText (Loc ["STRING_MISS"]..":".." 0") - SpellDetails.SpellInfoLabels.block:SetText (Loc ["STRING_BLOCKED"]..":".." 0") - SpellDetails.SpellInfoLabels.glancing:SetText (Loc ["STRING_GLANCING"]..":".." 0") - end - - - --------------------------------------------------------------------------------------------------------------------------------------------- - --> painel da direita inferior (detalhes dos buffs do jogador) - - --_detalhes.SoloTables.BuffsTable.BuffIds = _detalhes.SoloTables.BuffsTable.BuffIds or {0, 0, 0, 0} - --_detalhes.SoloTables.BuffsTableNameCache = _detalhes.SoloTables.BuffsTableNameCache or {"", "", "", ""} - - local BuffIndex = {} - - function SpellDetails:ClearBuffTexts() - for _, BuffInput in _ipairs (SpellDetails.BuffTextEntry) do - BuffInput.amtdone:SetText ("") - BuffInput.dps:SetText ("") - BuffInput.uptime:SetText ("") - end - end - - function SpellDetails:SetBuffTexts (id, damage, dps) - local BuffInput = SpellDetails.BuffTextEntry [id] - BuffInput.amtdone:SetText (Loc ["STRING_DAMAGE"]..": "..damage) - BuffInput.dps:SetText (Loc ["STRING_DPS"]..":".." "..dps) - end - - local Clear = function (BuffEntryTable) - --> clicked on X to clear the buff - _detalhes.Buffs:RemoveBuff (BuffEntryTable.name:GetText()) - - --_detalhes.SoloTables.BuffsTable.BuffIds [BuffEntryTable.id] = 0 - BuffIndex [BuffEntryTable.name:GetText()] = nil - - BuffEntryTable.icon:SetTexture (nil) - BuffEntryTable.name:SetText ("") - BuffEntryTable.amtdone:SetText ("") - BuffEntryTable.dps:SetText ("") - BuffEntryTable.editbox:SetText (Loc ["STRING_DEBUFFNAME"]) - BuffEntryTable.editbox:Show() - BuffEntryTable.background:Hide() - BuffEntryTable.backgroundFrame:Hide() - BuffEntryTable.button:Hide() - end - - local SetBuff = function (BuffEntryTable, spellid, id) - - local spellname, _, spellicon = GetSpellInfo (spellid) - - if (not _detalhes.Buffs:IsRegistred (spellid)) then - _detalhes.Buffs:NewBuff (spellname, spellid) - end - - BuffIndex [spellname] = BuffEntryTable - - BuffEntryTable.icon:SetTexture (spellicon) - BuffEntryTable.name:SetText (spellname) - BuffEntryTable.amtdone:SetText (Loc ["STRING_DAMAGE"]..": 0") - BuffEntryTable.dps:SetText (Loc ["STRING_DPS"]..":".." 0") - BuffEntryTable.editbox:Hide() - BuffEntryTable.background:Show() - BuffEntryTable.backgroundFrame:Show() - BuffEntryTable.button:Show() - --print (debugstack()) - end - - local OnEnter = function (_, id, texto, editbox, by) - - if (_string_len (texto) > 0 and texto ~= Loc ["STRING_DEBUFFNAME"]) then - if (by == editbox) then --> By Enter - if (_detalhes.popup.NumLines > 0) then - local texto2 = _detalhes.popup:GetText(1):match ("(.-):") - texto = texto2 - end - end - if (not tonumber (texto)) then - editbox:SetText (Loc ["STRING_DEBUFFNAME"]) - return - end - SetBuff (SpellDetails.BuffTextEntry [id], tonumber (texto), id) - else - editbox:SetText (Loc ["STRING_DEBUFFNAME"]) - end - - if (_detalhes.popup.active) then - _detalhes.popup:ShowMe (false) - end - end - - local CreateBuffInput = function (y, id) - - local backgroundFrame = _CreateFrame ("frame", "SoloBuffEditBox"..id.."Background", SpellDetailsFrame.fundoDir) - backgroundFrame:SetWidth (166) - backgroundFrame:SetHeight (40) - backgroundFrame:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPRIGHT", 127, y+5+8) - backgroundFrame:SetBackdrop ({edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", tile = true, tileSize = 16, edgeSize = 10, insets = {left = 1, right = 1, top = 0, bottom = 1}, - bgFile = "Interface\\DialogFrame\\UI-DialogBox-Gold-Background"}) - backgroundFrame:SetBackdropColor (.3, .3, .3, .5) - --backgroundFrame:SetBackdropBorderColor (1, 0, 0, 1) - backgroundFrame:Hide() - - backgroundFrame:SetScript ("OnEnter", function() - if (not backgroundFrame.Actived) then - local _r, _g, _b, _a = backgroundFrame:GetBackdropColor() - DetailsFrameWork:GradientEffect (backgroundFrame, "frame", _r, _g, _b, _a, .9, .7, .7, 1, .9) - else - local _r, _g, _b, _a = backgroundFrame:GetBackdropColor() - DetailsFrameWork:GradientEffect (backgroundFrame, "frame", _r, _g, _b, _a, 75/255, 246/255, 78/255, 1, .9) - end - end) - - backgroundFrame:SetScript ("OnLeave", function() - if (not backgroundFrame.Actived) then - local _r, _g, _b, _a = backgroundFrame:GetBackdropColor() - DetailsFrameWork:GradientEffect (backgroundFrame, "frame", _r, _g, _b, _a, .3, .3, .3, .5, .9) - else - local _r, _g, _b, _a = backgroundFrame:GetBackdropColor() - DetailsFrameWork:GradientEffect (backgroundFrame, "frame", _r, _g, _b, _a, 22/255, 155/255, 29/255, .9, .9) - end - end) - - function backgroundFrame:Active() - local _r, _g, _b, _a = backgroundFrame:GetBackdropColor() - DetailsFrameWork:GradientEffect (backgroundFrame, "frame", _r, _g, _b, _a, 22/255, 155/255, 29/255, .9, .9) - backgroundFrame.Actived = true - end - - function backgroundFrame:Desactive() - local _r, _g, _b, _a = backgroundFrame:GetBackdropColor() - DetailsFrameWork:GradientEffect (backgroundFrame, "frame", _r, _g, _b, _a, .3, .3, .3, .5, .9) - backgroundFrame.Actived = false - end - - local background = SpellDetailsFrame.fundoDir:CreateTexture (nil, "background") - --background:SetTexture ("Interface\\DialogFrame\\UI-DialogBox-Background") - background:SetWidth (166) - background:SetHeight (36) - background:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPRIGHT", 127, y+3+8) - background:SetDrawLayer ("background", 2) - background:Hide() - - --> editbox - --local editbox = DetailsFrameWork:NewTextBox (SpellDetailsFrame.fundoDir, SpellDetailsFrame.fundoDir, "SoloBuffEditBox"..id, OnEnter, "param_1", id, 120, 14) - - local editbox = DetailsFrameWork:NewTextEntry (SpellDetailsFrame.fundoDir, nil, "DetailsSpellDetailsBox"..id, "SoloBuffEditBox"..id, 120, 14, OnEnter, "param_1", id) - - editbox:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPRIGHT", 150, y) - editbox.text = Loc ["STRING_DEBUFFNAME"] - - local imageLeft = editbox:CreateTexture (nil, "overlay") - imageLeft:SetPoint ("right", "DetailsSpellDetailsBox"..id, "left", 0.5, -2) - imageLeft:SetTexture ("Interface\\ARCHEOLOGY\\ArchaeologyParts") - imageLeft:SetTexCoord (0.119140625, 0.1875, 0.8046875, 0.87890625) - imageLeft:SetWidth (19) - imageLeft:SetHeight (10) - local imageRight = editbox:CreateTexture (nil, "overlay") - imageRight:SetPoint ("left", "DetailsSpellDetailsBox"..id, "right", -0.5, -2) - imageRight:SetTexture ("Interface\\ARCHEOLOGY\\ArchaeologyParts") - imageRight:SetTexCoord (0.0078125, 0.078125, 0.859375, 0.93359375) - imageRight:SetWidth (19) - imageRight:SetHeight (10) - - editbox.HaveMenu = false - - local OnClickMenu = function (_, _, SpellID) - editbox:SetText (SpellID) - editbox:PressEnter (true) - editbox.HaveMenu = false - _detalhes.popup:ShowMe (false) - end - - editbox.OnTextChangedHook = function (frame, userChanged) - - if (not userChanged) then - return - end - - local texto = editbox:GetText() - texto = _detalhes:trim (texto) - texto = _string_lower (texto) - texto = texto:gsub ("%(", "") - texto = texto:gsub ("%[", "") - - local index = _string_sub (texto, 1, 1) - local cached = _detalhes.spellcachefull [index] - - if (cached) then - - local CoolTip = _G.GameCooltip - - CoolTip:Reset() - CoolTip:SetType ("menu") - CoolTip:SetOwner (_G ["DetailsSpellDetailsBox"..id]) - CoolTip:SetOption ("NoLastSelectedBar", true) - CoolTip:SetOption ("HeightAnchorMod", -8) - CoolTip:SetOption ("TextSize", 9.5) - - local CoolTipTable = {} - local texcoord = {0,1,0,1} - local i = 1 - - for SpellID, SpellTable in _pairs (cached) do - - if (_string_lower (SpellTable[1]):find (texto)) then - local rank = SpellTable[3] - if (not rank or rank == "") then - rank = "" - else - rank = " ("..rank..")" - end - - CoolTip:AddMenu (1, OnClickMenu, SpellID, nil, nil, SpellID..": "..SpellTable[1]..rank, SpellTable[2], true) - - if (i > 20) then - break - else - i = i + 1 - end - end - - end - - _detalhes.popup.buttonOver = true - editbox.HaveMenu = true - CoolTip:ShowCooltip() - end - end - - local icon = backgroundFrame:CreateTexture (nil, "OVERLAY") - icon:SetWidth (16) - icon:SetHeight (16) - icon:SetPoint ("TOPLEFT", SpellDetailsFrame, "TOPRIGHT", 133, y+8) - - local name = DetailsFrameWork:NewLabel (backgroundFrame, backgroundFrame, nil, "BuffName"..id, "", "GameFontHighlightSmall") - name:SetPoint ("LEFT", icon, "RIGHT", 3, 4) - - local amtdone = DetailsFrameWork:NewLabel (backgroundFrame, backgroundFrame, nil, "BuffDone"..id, "", "GameFontHighlightSmall") - amtdone:SetPoint ("LEFT", icon, "RIGHT", 3, -6) - local uptime = DetailsFrameWork:NewLabel (backgroundFrame, backgroundFrame, nil, "BuffUptime"..id, "", "GameFontHighlightSmall") - uptime:SetPoint ("LEFT", icon, "RIGHT", 55, -6) - - local dps = DetailsFrameWork:NewLabel (backgroundFrame, backgroundFrame, nil, "BuffDps"..id, "", "GameFontHighlightSmall") - dps:SetPoint ("LEFT", icon, "RIGHT", 3, -16) - - local clearbutton = _CreateFrame ("Button", nil, backgroundFrame, "UIPanelCloseButton") - clearbutton:SetWidth (20) - clearbutton:SetHeight (20) - clearbutton:SetPoint ("TOPLEFT", icon, "TOPRIGHT", -18, -15) - - SpellDetails.BuffTextEntry [id] = {id = id, editbox = editbox, icon = icon, name = name, amtdone = amtdone, dps = dps, uptime = uptime, button = clearbutton, background = background, backgroundFrame = backgroundFrame} - - --clearbutton:SetText ("x") - - clearbutton:SetScript ("OnClick", function() Clear (SpellDetails.BuffTextEntry [id]) end) - clearbutton:Hide() - - editbox.OnEscapePressedHook = function() - editbox:SetText (Loc ["STRING_DEBUFFNAME"]) - _detalhes.popup:ShowMe (false) - end - - editbox.OnEnterPressedHook = function() - if (editbox:GetText() == Loc ["STRING_DEBUFFNAME"]) then - editbox:SetText ("") - elseif (_string_len (editbox:GetText()) > 0) then - if (not _detalhes.popup.active) then - editbox.OnTextChangedHook (true) - end - end - end - - editbox.OnLeaveHook = function() - if (not editbox:HasFocus()) then - if (editbox:GetText() == "") then - editbox:SetText (Loc ["STRING_DEBUFFNAME"]) - end - end - - _detalhes.popup.buttonOver = false - if (_detalhes.popup.active) then - local passou = 0 - editbox:SetScript ("OnUpdate", function (self, elapsed) - passou = passou+elapsed - if (passou > 0.3) then - if (not _detalhes.popup.mouseOver and not _detalhes.popup.buttonOver) then - _detalhes.popup:ShowMe (false) - end - editbox:SetScript ("OnUpdate", nil) - end - end) - elseif (_detalhes.popup.tooltip) then - _detalhes.popup:ShowMe (false) - else - editbox:SetScript ("OnUpdate", nil) - end - - end - - editbox.OnEditFocusGainedHook = function() - if (InCombatLockdown()) then - - GameCooltip:Reset() - GameCooltip:AddLine ("|cffFF2222"..Loc ["STRING_INCOMBAT"]) - GameCooltip:AddIcon ("Interface\\Buttons\\LockButton-Locked-Up",_,_, 25, 25) - GameCooltip:ShowCooltip (_G ["DetailsSpellDetailsBox"..id], "tooltip") - - editbox:PressEnter() - else - editbox:SetText ("") - _detalhes:BuildSpellList() - end - end - - editbox.OnEditFocusLostHook = function() - editbox.HaveMenu = false - local texto = editbox:GetText() - if (_string_len (texto) > 0 and texto ~= Loc ["STRING_DEBUFFNAME"]) then - SetBuff (SpellDetails.BuffTextEntry [id], tonumber (texto), id) - else - editbox:SetText (Loc ["STRING_DEBUFFNAME"]) - end - _detalhes:ClearSpellList() - end - - end - - --> Crias as caixas dos buffs - local y = {-146, -186, -226, -266} -- +8 - for i = 1, 4 do - CreateBuffInput (y [i], i) - end - - --> fill with buff information: - --> inject inside details for ace3 delay - function _detalhes:SpellDetailsStartupBuffs() - local buffmax = 4 - local BuffList = _detalhes.Buffs:GetBuffListIds() - for i = 1, #BuffList do - if (i >= 5) then - break - end - SetBuff (SpellDetails.BuffTextEntry [i], BuffList [i], i) - end - end - - _detalhes:ScheduleTimer ("SpellDetailsStartupBuffs", 5) - --_detalhes:SpellDetailsStartupBuffs() - - function SpellDetails:RefreshBuffs() - for BuffName, BuffTable in _pairs (_detalhes.Buffs.BuffsTable) do - if (BuffTable.active and SpellDetails:IsInCombat()) then - if (BuffIndex [BuffName]) then - BuffIndex [BuffName].backgroundFrame:Active() - end - else - if (BuffIndex [BuffName]) then - BuffIndex [BuffName].backgroundFrame:Desactive() - end - end - end - end - - function SpellDetails:Refresh() - SpellDetails:AtualizaSoloMode() - SpellDetails:DetalhesDaMagia (SpellDetails.CurrentSpellSlot) - SpellDetails:ForceUpdateUpDisplay() - end - - function SpellDetails:JanelaSoloUpdate (OnOff) - - local janela_solo = SpellDetailsFrame - if (OnOff > 0) then - - if (not _detalhes.SoloTables.CombatID) then - return - end - - local MySelf - if (_detalhes.SoloTables.CombatID == _detalhes:NumeroCombate()) then - MySelf = _detalhes.tabela_vigente (DETAILS_ATTRIBUTE_DAMAGE, _detalhes.playername) - else - local vigente = _detalhes.tabela_historico.tabelas[_detalhes:NumeroCombate() - _detalhes.SoloTables.CombatID] - MySelf = vigente (DETAILS_ATTRIBUTE_DAMAGE, _detalhes.playername) - end - - if (MySelf) then - janela_solo.SoloInicioCombate = MySelf.start_time - janela_solo.SoloInicioTimer = _GetTime() - janela_solo.SoloTimer = 0 - janela_solo.SoloDps = 0 - janela_solo.AtualizarJanelaDetalhes = 0 - janela_solo.MySelf = MySelf - janela_solo.Instancia = self - janela_solo:SetScript ("OnUpdate", SpellDetails.SoloUpdater) - end - else - janela_solo.SoloInicioCombate = nil - janela_solo.SoloTimer = nil - janela_solo.SoloDps = nil - janela_solo.AtualizarJanelaDetalhes = nil - janela_solo.MySelf = nil - janela_solo.Instancia = nil - janela_solo:SetScript ("OnUpdate", nil) - end - end - - function SpellDetails:ForceUpdateUpDisplay() - local MySelf = _detalhes.tabela_vigente (DETAILS_ATTRIBUTE_DAMAGE, _detalhes.playername) - if (MySelf and MySelf.end_time and MySelf.start_time) then - local tempo_in_combat = MySelf.end_time - MySelf.start_time - SpellDetails.SummaryLine.time:SetText (Loc ["STRING_TEMPO"]..":".." ".._string_format ("%.1f", tempo_in_combat)) - SpellDetails.SummaryLine.dps:SetText (Loc ["STRING_DPS"]..":".." ".._cstr ("%.1f", MySelf.total/tempo_in_combat)) - SpellDetails.SummaryLine.total:SetText (Loc ["STRING_DAMAGE"]..": " .. _tostring (MySelf.total)) - else - SpellDetails.SummaryLine.time:SetText (Loc ["STRING_TEMPO"]..":".." 0.0") - SpellDetails.SummaryLine.dps:SetText (Loc ["STRING_DPS"]..":".." 0") - SpellDetails.SummaryLine.total:SetText (Loc ["STRING_DAMAGE"]..": 0") - end - end - - function SpellDetails:SoloUpdater (elapsed) - - self.SoloTimer = self.SoloTimer + elapsed - self.SoloDps = self.SoloDps + elapsed - self.AtualizarJanelaDetalhes = self.AtualizarJanelaDetalhes + elapsed - - if (self.SoloTimer > 0.1) then - local tempo_agora = (_GetTime() - self.SoloInicioTimer) - SpellDetails.SummaryLine.time:SetText (Loc ["STRING_TEMPO"]..":".." ".._string_format ("%.1f", tempo_agora)) - self.SoloTimer = 0 - end - - if (self.SoloDps > 0.2) then - - --print (_GetTime() .. " " .._detalhes._tempo .. " " .. time()) - --print (self.MySelf.start_time) - --_detalhes.SoloTables.SummaryLine.dps:SetText (Loc ["STRING_DPS"]..":".." ".._detalhes:comma_value( _math_floor (self.MySelf.total/(_tempo - self.SoloInicioCombate))) ) - --print (self.MySelf.total .. " / " .. (time() - self.MySelf.start_time)) - SpellDetails.SummaryLine.dps:SetText (Loc ["STRING_DPS"]..":".." ".._detalhes:comma_value( _math_floor (self.MySelf.total/( time() - self.MySelf.start_time))) ) - self.SoloDps = 0 - end - - if (self.AtualizarJanelaDetalhes > 1.0) then - SpellDetails:AtualizaSoloMode() - SpellDetails:DetalhesDaMagia (SpellDetails.CurrentSpellSlot) - self.AtualizarJanelaDetalhes = 0 - if (not _UFC ("player")) then - return SpellDetails:CombatEnd() - end - end - end - - function SpellDetails:AtualizaSoloMode() - - if (not _detalhes.SoloTables.CombatID) then - return - end - - -- self.atributo <- retorna o que esta sendo mostrado na instancia - local atributo = DETAILS_ATTRIBUTE_DAMAGE - local MySelf - - if (_detalhes.SoloTables.CombatID == _detalhes:NumeroCombate()) then - MySelf = _detalhes.tabela_vigente (atributo, _detalhes.playername) - else - local vigente = _detalhes.tabela_historico.tabelas[_detalhes:NumeroCombate() - _detalhes.SoloTables.CombatID] - if (not vigente) then - --print ("!Vigente> solo_id = ".._detalhes.SoloTables.CombatID.." <> " .. _detalhes:NumeroCombate() - _detalhes.SoloTables.CombatID) - return - end - MySelf = vigente (atributo, _detalhes.playername) - end - - local janela = SpellDetailsFrame - - if (MySelf) then - local meu_total, dps = MySelf.total, MySelf.last_dps - - SpellDetails.SummaryLine.total:SetText (Loc ["STRING_DAMAGE"]..": ".._detalhes:comma_value (meu_total)) --> gravar total - - --> pegar as magias que castei - - local tabela = MySelf.spell_tables._ActorTable - local meus_danos = {} - - local SpellsTotalHits = 0 - for _spellid, _tabela in _pairs (tabela) do - meus_danos [#meus_danos+1] = {_spellid, _tabela, _tabela.total} - SpellsTotalHits = SpellsTotalHits + _tabela.counter - end - - --> spellvalue - for _, _tabela in _ipairs (meus_danos) do - local PercentDamage = (_tabela[3]/MySelf.total)+1 -- a escala é de 0.0 a 0.9 + 1 então é de 1 a 1.999 - local PercentHits = ((_tabela[2].counter/SpellsTotalHits)*0.1) + 1 --> 0.1 scale down --> 1.09 - local pow = math.pow (PercentDamage, PercentHits) - local scaled = _detalhes:Scale (1, 2.15, 1, 100, pow) - _tabela[4] = scaled - end - - _table_sort (meus_danos, function (_spell1, _spell2) return _spell1[4] > _spell2[4] end) - - for i = 1, 9 do - local esta_magia = meus_danos[i] - if (esta_magia) then - local SpellName, _, Icon = _GetSpellInfo (esta_magia[1]) - local SpellBoxObject = SpellDetails.SpellButtons [i] - - SpellDetails:ChangeSpellBox (i, esta_magia[1], Icon, - "DPS: ".. _detalhes:ToK (_math_floor (esta_magia[3]/MySelf:Tempo())), - "SV: ".. _string_format ("%.1f", esta_magia[4]), - nil) - else - SpellDetails:ClearSpellBox (i) - end - end - end - end - - function SpellDetails:DetalhesDaMagia (slot) - - local SoloCombatID = _detalhes.SoloTables.CombatID - - if (not SoloCombatID) then - return - end - - if (not slot) then --> slot é qual dos 9 quadros vai mostrar - slot = 1 - SpellDetails.CurrentSpellSlot = 1 - SpellDetails.SpellButtons.LastSelected = slot - SpellDetails.SpellButtons.selected:SetPoint ("TOPLEFT", SpellDetails.SpellButtons [slot].background, "TOPLEFT", -5, 3) - SpellDetails.SpellButtons [slot].background:Show() - end - - if (slot ~= SpellDetails.CurrentSpellSlot) then --> se o player clicou em outro quadro - SpellDetails.CurrentSpellSlot = slot - SpellDetails:ClearBuffTexts() - SpellDetails.SpellButtons.LastSelected = slot - SpellDetails.SpellButtons.selected:SetPoint ("TOPLEFT", SpellDetails.SpellButtons [slot].background, "TOPLEFT", -5, 3) - SpellDetails.SpellButtons [slot].background:Show() - end - - local SpellBoxTable = SpellDetails.SpellButtons [slot] - local spellid = SpellBoxTable.spellid - local CombatTable - - local MySelf - if (SoloCombatID == _detalhes:NumeroCombate()) then - MySelf = _detalhes.tabela_vigente (DETAILS_ATTRIBUTE_DAMAGE, _detalhes.playername) - CombatTable = _detalhes.tabela_vigente - else - if (_detalhes.SoloTables.CombatID == 0) then - return - end - - local vigente = _detalhes.tabela_historico.tabelas [_detalhes:NumeroCombate() - SoloCombatID] - if (not vigente) then - --print ("!Vigente> solo_id = "..SoloCombatID.." <> " .. _detalhes:NumeroCombate() .. " table: " .. (_detalhes:NumeroCombate() - SoloCombatID)) - return - end - MySelf = vigente (DETAILS_ATTRIBUTE_DAMAGE, _detalhes.playername) - CombatTable = vigente - end - - if (not MySelf) then --> caso o jogador não esteja em combate - return - end - - local habilidade = MySelf.spell_tables._ActorTable [spellid] --> agora tem o objeto classe_TIPO_habilidade - if (not habilidade) then --> caso a tabela do jogador não tenha a skill pedida. - return - end - - local SpellInfoLabels = SpellDetails.SpellInfoLabels --> shortcut - - SpellInfoLabels.total:SetText (Loc ["STRING_DAMAGE"]..": ".._detalhes:comma_value (habilidade.total)) - SpellInfoLabels.dps:SetText (Loc ["STRING_DPS"]..":".." ".._detalhes:comma_value (_math_floor (habilidade.total/(MySelf:Tempo())))) - SpellInfoLabels.porcento:SetText (Loc ["STRING_PERCENT"]..":".." ".. _detalhes:comma_value ( _math_floor (habilidade.total/MySelf.total*100)).."%") - - local SoloDebuffUptime = CombatTable.SoloDebuffUptime - if (SoloDebuffUptime) then - local DebuffTable = SoloDebuffUptime [spellid] - if (DebuffTable) then - --SpellInfoLabels.uptime:SetText (Loc ["STRING_UPTIME"]..":".." ".._math_floor (DebuffTable.duration).."s (".._math_floor (DebuffTable.duration/MySelf:Tempo()*100).."%) "..DebuffTable.castedAmt.."/"..DebuffTable.refreshAmt.."/"..DebuffTable.droppedAmt) --> localize-me - - local duration = DebuffTable.duration - if (DebuffTable.Active) then - duration = duration + (_detalhes._tempo - DebuffTable.start) - end - - SpellInfoLabels.uptime:SetText (Loc ["STRING_UPTIME"]..":".." ".._math_floor (duration).."s (".._math_floor (duration/MySelf:Tempo()*100).."%) ") --> localize-me - else - SpellInfoLabels.uptime:SetText (Loc ["STRING_UPTIME"]..":".." 0") --> localize-me - end - else - SpellInfoLabels.uptime:SetText (Loc ["STRING_UPTIME"]..":".." 0") --> localize-me - end - - SpellInfoLabels.critical:SetText (Loc ["STRING_CRIT"]..":".." "..habilidade.c_amt.." (".. _math_floor ( habilidade.c_amt/habilidade.counter*100 ) .."%)") -- /"..habilidade.counter.." - if (habilidade.c_amt < 1) then - SpellInfoLabels.critical:SetTextColor (0.5, 0.5, 0.5) - SpellInfoLabels.critical:SetText (Loc ["STRING_CRIT"]..":".." "..habilidade.c_amt.."/"..habilidade.counter) --> localize-me - else - SpellInfoLabels.critical:SetTextColor (1, 1, 1) - end - - local erros = 0 - for _, missType in _ipairs (MySelf.missTypes) do - local este_erro = habilidade [missType] - if (este_erro) then - erros = erros + este_erro - end - end - - SpellInfoLabels.miss:SetText (Loc ["STRING_MISS"]..":".." "..erros.. " (".._string_format ("%.1f", erros/habilidade.counter*100).."%)") --> localize-me - if (erros < 1) then - SpellInfoLabels.miss:SetTextColor (0.5, 0.5, 0.5) - else - SpellInfoLabels.miss:SetTextColor (1, 1, 1) - end - - SpellInfoLabels.block:SetText (Loc ["STRING_BLOCKED"]..":".." ".. _string_format ("%.1f", habilidade.b_amt/habilidade.counter*100).."%") --> ..habilidade.b_dmg - if (habilidade.b_dmg < 1) then - SpellInfoLabels.block:SetTextColor (0.5, 0.5, 0.5) - else - SpellInfoLabels.block:SetTextColor (1, 1, 1) - end - - SpellInfoLabels.glancing:SetText ("Glancing: "..habilidade.g_amt.. " (".._string_format ("%.1f", habilidade.g_amt/habilidade.counter*100).."%)") --> localize-me - if (habilidade.g_amt < 1) then - SpellInfoLabels.glancing:SetTextColor (0.5, 0.5, 0.5) - else - SpellInfoLabels.glancing:SetTextColor (1, 1, 1) - end - - --> BUFFS - - local HabilidadeDetails = habilidade.BuffTable - if (not HabilidadeDetails) then - print ("!buffs -> !habilidade.BuffTable") - return - end - - local BuffTextEntry = SpellDetails.BuffTextEntry --> { 1,2,3,4 } - --local SoloBuffUptime = _detalhes.SoloTables.SoloBuffUptime - local SoloBuffUptime = _detalhes.Buffs.BuffsTable - - for BuffName, BuffTable in _pairs (_detalhes.Buffs.BuffsTable) do - local tabela = HabilidadeDetails [BuffName] - if (tabela) then - local EntryObject = BuffIndex [BuffName] - if (EntryObject) then - - local tempo = MySelf:Tempo() - local EntryObject = BuffIndex [BuffName] - EntryObject.amtdone:SetText ("Hits: "..tabela.counter) - - local duration = BuffTable.duration - if (BuffTable.active) then - if (not BuffTable.start) then - print ("BUFF " .. BuffTable.name.." sem START") - else - duration = duration + (_detalhes._tempo - BuffTable.start) - end - end - tempo = duration - - --SpellInfoLabels.uptime:SetText (Loc ["STRING_UPTIME"]..":".." ".._math_floor (DebuffTable.duration).."s (".._math_floor (DebuffTable.duration/MySelf:Tempo()*100).."%) "..DebuffTable.castedAmt.."/"..DebuffTable.refreshAmt.."/"..DebuffTable.droppedAmt) --> localize-me - EntryObject.uptime:SetText (Loc ["STRING_UPTIME"]..":" .. " " .. _math_floor (tempo/MySelf:Tempo()*100).."%") --me _math_floor (BuffTable.duration).."s (".. - EntryObject.dps:SetText ("Dps: ".._detalhes:comma_value (_math_floor (tabela.total/tempo))) - - end - end - end - - end - -end - -function SpellDetails:OnEvent (_, event, ...) - - if (event == "ADDON_LOADED") then - local AddonName = select (1, ...) - if (AddonName == "Details_SpellDetails") then - - if (_G._detalhes) then - - --> create main plugin object - CreatePluginFrames (_detalhes_databaseSpellDetails) - - local MINIMAL_DETAILS_VERSION_REQUIRED = 1 - - --> Install plugin inside details - local install = _G._detalhes:InstallPlugin ("SOLO", Loc ["PLUGIN_NAME"], "Interface\\Icons\\INV_Fabric_Spellweave", SpellDetails, "DETAILS_PLUGIN_SPELL_DETAILS", MINIMAL_DETAILS_VERSION_REQUIRED, "Details! Team", "v1.08") - if (type (install) == "table" and install.error) then - print (install.error) - end - - --> Register needed events - _G._detalhes:RegisterEvent (SpellDetails, "COMBAT_PLAYER_TIMESTARTED") - - end - end - - elseif (event == "PLAYER_LOGOUT") then - _detalhes_databaseSpellDetails = SpellDetails.data - end -end diff --git a/plugins/Details_SpellDetails/Details_SpellDetails.toc b/plugins/Details_SpellDetails/Details_SpellDetails.toc deleted file mode 100644 index 70b04d2c..00000000 --- a/plugins/Details_SpellDetails/Details_SpellDetails.toc +++ /dev/null @@ -1,15 +0,0 @@ -## Interface: 50400 -## Title: Details Spells (plugin) -## Notes: Plugin for Details -## SavedVariablesPerCharacter: _detalhes_databaseSpellDetails -## RequiredDeps: Details -## OptionalDeps: Ace3 - -#@no-lib-strip@ -embeds.xml -#@end-no-lib-strip@ - -enUS.lua -ptBR.lua - -Details_SpellDetails.lua \ No newline at end of file diff --git a/plugins/Details_SpellDetails/Libs/AceLocale-3.0/AceLocale-3.0.lua b/plugins/Details_SpellDetails/Libs/AceLocale-3.0/AceLocale-3.0.lua deleted file mode 100644 index 2ecc0cb8..00000000 --- a/plugins/Details_SpellDetails/Libs/AceLocale-3.0/AceLocale-3.0.lua +++ /dev/null @@ -1,137 +0,0 @@ ---- **AceLocale-3.0** manages localization in addons, allowing for multiple locale to be registered with fallback to the base locale for untranslated strings. --- @class file --- @name AceLocale-3.0 --- @release $Id: AceLocale-3.0.lua 1035 2011-07-09 03:20:13Z kaelten $ -local MAJOR,MINOR = "AceLocale-3.0", 6 - -local AceLocale, oldminor = LibStub:NewLibrary(MAJOR, MINOR) - -if not AceLocale then return end -- no upgrade needed - --- Lua APIs -local assert, tostring, error = assert, tostring, error -local getmetatable, setmetatable, rawset, rawget = getmetatable, setmetatable, rawset, rawget - --- Global vars/functions that we don't upvalue since they might get hooked, or upgraded --- List them here for Mikk's FindGlobals script --- GLOBALS: GAME_LOCALE, geterrorhandler - -local gameLocale = GetLocale() -if gameLocale == "enGB" then - gameLocale = "enUS" -end - -AceLocale.apps = AceLocale.apps or {} -- array of ["AppName"]=localetableref -AceLocale.appnames = AceLocale.appnames or {} -- array of [localetableref]="AppName" - --- This metatable is used on all tables returned from GetLocale -local readmeta = { - __index = function(self, key) -- requesting totally unknown entries: fire off a nonbreaking error and return key - rawset(self, key, key) -- only need to see the warning once, really - geterrorhandler()(MAJOR..": "..tostring(AceLocale.appnames[self])..": Missing entry for '"..tostring(key).."'") - return key - end -} - --- This metatable is used on all tables returned from GetLocale if the silent flag is true, it does not issue a warning on unknown keys -local readmetasilent = { - __index = function(self, key) -- requesting totally unknown entries: return key - rawset(self, key, key) -- only need to invoke this function once - return key - end -} - --- Remember the locale table being registered right now (it gets set by :NewLocale()) --- NOTE: Do never try to register 2 locale tables at once and mix their definition. -local registering - --- local assert false function -local assertfalse = function() assert(false) end - --- This metatable proxy is used when registering nondefault locales -local writeproxy = setmetatable({}, { - __newindex = function(self, key, value) - rawset(registering, key, value == true and key or value) -- assigning values: replace 'true' with key string - end, - __index = assertfalse -}) - --- This metatable proxy is used when registering the default locale. --- It refuses to overwrite existing values --- Reason 1: Allows loading locales in any order --- Reason 2: If 2 modules have the same string, but only the first one to be --- loaded has a translation for the current locale, the translation --- doesn't get overwritten. --- -local writedefaultproxy = setmetatable({}, { - __newindex = function(self, key, value) - if not rawget(registering, key) then - rawset(registering, key, value == true and key or value) - end - end, - __index = assertfalse -}) - ---- Register a new locale (or extend an existing one) for the specified application. --- :NewLocale will return a table you can fill your locale into, or nil if the locale isn't needed for the players --- game locale. --- @paramsig application, locale[, isDefault[, silent]] --- @param application Unique name of addon / module --- @param locale Name of the locale to register, e.g. "enUS", "deDE", etc. --- @param isDefault If this is the default locale being registered (your addon is written in this language, generally enUS) --- @param silent If true, the locale will not issue warnings for missing keys. Must be set on the first locale registered. If set to "raw", nils will be returned for unknown keys (no metatable used). --- @usage --- -- enUS.lua --- local L = LibStub("AceLocale-3.0"):NewLocale("TestLocale", "enUS", true) --- L["string1"] = true --- --- -- deDE.lua --- local L = LibStub("AceLocale-3.0"):NewLocale("TestLocale", "deDE") --- if not L then return end --- L["string1"] = "Zeichenkette1" --- @return Locale Table to add localizations to, or nil if the current locale is not required. -function AceLocale:NewLocale(application, locale, isDefault, silent) - - -- GAME_LOCALE allows translators to test translations of addons without having that wow client installed - local gameLocale = GAME_LOCALE or gameLocale - - local app = AceLocale.apps[application] - - if silent and app and getmetatable(app) ~= readmetasilent then - geterrorhandler()("Usage: NewLocale(application, locale[, isDefault[, silent]]): 'silent' must be specified for the first locale registered") - end - - if not app then - if silent=="raw" then - app = {} - else - app = setmetatable({}, silent and readmetasilent or readmeta) - end - AceLocale.apps[application] = app - AceLocale.appnames[app] = application - end - - if locale ~= gameLocale and not isDefault then - return -- nop, we don't need these translations - end - - registering = app -- remember globally for writeproxy and writedefaultproxy - - if isDefault then - return writedefaultproxy - end - - return writeproxy -end - ---- Returns localizations for the current locale (or default locale if translations are missing). --- Errors if nothing is registered (spank developer, not just a missing translation) --- @param application Unique name of addon / module --- @param silent If true, the locale is optional, silently return nil if it's not found (defaults to false, optional) --- @return The locale table for the current language. -function AceLocale:GetLocale(application, silent) - if not silent and not AceLocale.apps[application] then - error("Usage: GetLocale(application[, silent]): 'application' - No locales registered for '"..tostring(application).."'", 2) - end - return AceLocale.apps[application] -end diff --git a/plugins/Details_SpellDetails/Libs/AceLocale-3.0/AceLocale-3.0.xml b/plugins/Details_SpellDetails/Libs/AceLocale-3.0/AceLocale-3.0.xml deleted file mode 100644 index d69dbb13..00000000 --- a/plugins/Details_SpellDetails/Libs/AceLocale-3.0/AceLocale-3.0.xml +++ /dev/null @@ -1,4 +0,0 @@ - -