From 2f94bd93b89e781248b669dbfd4e38047dc524a8 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Thu, 7 Apr 2022 14:33:46 -0300 Subject: [PATCH] Added M+ Score into the player info tooltip (hover over the spec icon) --- boot.lua | 7 ++-- frames/window_main.lua | 82 +++++++++++++++++++++++++++++++++--------- 2 files changed, 70 insertions(+), 19 deletions(-) diff --git a/boot.lua b/boot.lua index 547273c1..b1371477 100644 --- a/boot.lua +++ b/boot.lua @@ -33,12 +33,15 @@ do local Loc = _G.LibStub("AceLocale-3.0"):GetLocale( "Details" ) local news = { - {"v9.2.0.9715.146", "Merch 06th, 2022"}, + {"v9.2.0.9715.146", "April 7th, 2022"}, + "Added M+ Score into the player info tooltip (hover over the spec icon).", + + {"v9.2.0.9715.146", "March 6th, 2022"}, "More Tiny Threat fixes and implementations (by Treeston)", "Fixed Chinese and Taiwan 'Thousand' abbreviation letter (fix by github user Maioro).", - {"v9.2.0.9699.146", "Merch 04th, 2022"}, + {"v9.2.0.9699.146", "March 4th, 2022"}, "Align Text Columns now have a warning at the bracket and separators option", "Silence from interrupts shall be counted as a crowd control.", "More phrases in the options panel has been added to translation.", diff --git a/frames/window_main.lua b/frames/window_main.lua index 8a4103dd..f5212ef8 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -2100,14 +2100,10 @@ local set_bar_value = function (self, value) end -- ~talent ~icon +--code for when hovering over the class/spec icon in the player bar local icon_frame_on_enter = function (self) local actor = self.row.minha_tabela - if (self.row.icone_classe:GetTexture() ~= "") then - --self.row.icone_classe:SetSize (self.row.icone_classe:GetWidth()+1, self.row.icone_classe:GetWidth()+1) - --self.row.icone_classe:SetBlendMode ("ADD") - end - if (actor) then if (actor.frags) then @@ -2211,7 +2207,7 @@ local icon_frame_on_enter = function (self) local diff = combat:GetDifficulty() local attribute, subattribute = instance:GetDisplay() - --> check if is a raid encounter and if is heroic or mythic + --check if is a raid encounter and if is heroic or mythic if (diff and (diff == 15 or diff == 16) and (attribute == 1 or attribute == 2)) then local db = _detalhes.OpenStorage() if (db) then @@ -2239,7 +2235,68 @@ local icon_frame_on_enter = function (self) end end end - + + local actorName = actor:GetName() + + local RaiderIO = _G.RaiderIO + + if (RaiderIO) then + local addedInfo = false + + local playerName, playerRealm = actorName:match("(%w+)%-(%w+)") + playerName = playerName or actorName + playerRealm = playerRealm or GetRealmName() + local faction = actor.enemy and Details.faction_against or UnitFactionGroup("player") + faction = faction == "Horde" and 2 or 1 + + local rioProfile = RaiderIO.GetProfile(playerName, playerRealm, faction) + + if (rioProfile and rioProfile.mythicKeystoneProfile) then + rioProfile = rioProfile.mythicKeystoneProfile + + local previousScore = rioProfile.previousScore + local currentScore = rioProfile.currentScore + + if (previousScore > currentScore) then + GameCooltip:AddLine("M+ Score:", previousScore .. " (|cFFFFDD11" .. currentScore .. "|r)", 1, "white") + addedInfo = true + else + GameCooltip:AddLine("M+ Score:", currentScore, 1, "white") + addedInfo = true + end + + else + local dungeonPlayerInfo = C_PlayerInfo.GetPlayerMythicPlusRatingSummary(actorName) + if (dungeonPlayerInfo) then + local currentScore = dungeonPlayerInfo.currentSeasonScore or 0 + if (currentScore > 0) then + GameCooltip:AddLine("M+ Score:", currentScore, 1, "white") + addedInfo = true + end + end + end + + if (addedInfo) then + GameCooltip:AddIcon ([[]], 1, 1, 1, 20) + _detalhes:AddTooltipBackgroundStatusbar() + height = height + 19 --frame height + end + + else + local dungeonPlayerInfo = C_PlayerInfo.GetPlayerMythicPlusRatingSummary(actorName) + if (dungeonPlayerInfo) then + local currentScore = dungeonPlayerInfo.currentSeasonScore or 0 + if (currentScore > 0) then + GameCooltip:AddLine("M+ Score:", currentScore, 1, "white") + GameCooltip:AddIcon ([[]], 1, 1, 1, 20) + _detalhes:AddTooltipBackgroundStatusbar() + height = height + 19 --frame height + end + end + end + + --dps + --[=[ local attribute, subAttribute = instance:GetDisplay() if (attribute == 1) then local realDps = actor.total / instance:GetShowingCombat():GetCombatTime() @@ -2253,17 +2310,8 @@ local icon_frame_on_enter = function (self) height = height + 21 end end - - --[=[ - if (RaiderIO and RaiderIO.GetScore) then - local mythicPlusScore = RaiderIO.GetScore (name) - if (mythicPlusScore and mythicPlusScore.allScore) then - GameCooltip:AddLine ("Mythic+ Score:", mythicPlusScore.allScore, 1, "white", "white") - _detalhes:AddTooltipBackgroundStatusbar() - end - end --]=] - + GameCooltip:SetOption ("FixedHeight", height) GameCooltip:ShowCooltip()