Skip to content

Commit

Permalink
Add DungeonScore in datatext (#1437)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rubgrsch authored Jan 2, 2025
1 parent ba57231 commit a483460
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
38 changes: 38 additions & 0 deletions ElvUI/Mainline/Modules/DataTexts/DungeonScore.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
local E, L, V, P, G = unpack(ElvUI)
local DT = E:GetModule('DataTexts')

local format = format

local function OnEnter()
DT.tooltip:ClearLines()

local playerName = UnitName('player')
local className, classFileName = UnitClass('player')
local classColor = C_ClassColor.GetClassColor(classFileName)
local dungeonScore = C_ChallengeMode.GetOverallDungeonScore()
local summary = C_PlayerInfo.GetPlayerMythicPlusRatingSummary('player')

DT.tooltip:AddLine(classColor:WrapTextInColorCode(playerName), className, nil, nil, nil, true)
DT.tooltip:AddLine(className, 1, 1, 1, true)
local color = C_ChallengeMode.GetDungeonScoreRarityColor(dungeonScore) or HIGHLIGHT_FONT_COLOR
DT.tooltip:AddLine(DUNGEON_SCORE_LINK_RATING:format(color:WrapTextInColorCode(dungeonScore)))

DT.tooltip:AddLine(' ')

for _, v in ipairs(summary.runs) do
local mapName = C_ChallengeMode.GetMapUIInfo(v.challengeModeID)
local finishedSuccess = v.finishedSuccess
local mapScore = v.mapScore
local bestRunLevel = v.bestRunLevel
DT.tooltip:AddDoubleLine(mapName, format("%d (%s%d)", mapScore, finishedSuccess and '+' or '-', bestRunLevel), 1, 1, 1, C_ChallengeMode.GetSpecificDungeonOverallScoreRarityColor(mapScore):GetRGB())
end

DT.tooltip:Show()
end

local function OnEvent(self)
local score = C_ChallengeMode.GetOverallDungeonScore()
self.text:SetText(C_ChallengeMode.GetDungeonScoreRarityColor(score):WrapTextInColorCode(score))
end

DT:RegisterDatatext('DungeonScore', nil, {'CHALLENGE_MODE_COMPLETED'}, OnEvent, nil, nil, OnEnter, nil, DUNGEON_SCORE)
1 change: 1 addition & 0 deletions ElvUI/Mainline/Modules/DataTexts/Load_DataTexts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Script file='..\..\..\Core\Modules\DataTexts\Speed.lua'/>
<Script file='CallToArms.lua'/>
<Script file='Crests.lua'/>
<Script file='DungeonScore.lua'/>
<Script file='Leech.lua'/>
<Script file='Missions.lua'/>
<Script file='Quickjoin.lua'/>
Expand Down

0 comments on commit a483460

Please sign in to comment.