Restored "right click to close" on breakdown window

This commit is contained in:
Tercio Jose
2023-05-09 10:58:41 -03:00
parent 767135e92c
commit a54e80c475
4 changed files with 48 additions and 9 deletions
+3
View File
@@ -24,6 +24,9 @@
---@field NewTimer fun(delay: number, func: function): timer
---@field NewTicker fun(interval: number, func: function, iterations: number|nil): timer
---@class C_ChallengeMode : table
---@field GetActiveKeystoneInfo fun(): number, number[], boolean @returns keystoneLevel, affixIDs, wasActive
---@class tablesize : {H: number, W: number}
---@class tablecoords : {L: number, R: number, T: number, B: number}
+9 -9
View File
@@ -15,8 +15,8 @@
local addonName, Details222 = ...
local version, build, date, tocversion = GetBuildInfo()
Details.build_counter = 10993
Details.alpha_build_counter = 10993 --if this is higher than the regular counter, use it instead
Details.build_counter = 11000
Details.alpha_build_counter = 11000 --if this is higher than the regular counter, use it instead
Details.dont_open_news = true
Details.game_version = version
Details.userversion = version .. " " .. Details.build_counter
@@ -1176,6 +1176,13 @@ function Details222.PlayerStats:AddStat(statName, value)
Details.player_stats[statName] = (Details.player_stats[statName] or 0) + value
end
---get the value of a saved stat
---@param statName string
---@return any
function Details222.PlayerStats:GetStat(statName)
return Details.player_stats[statName]
end
---same thing as above but set the value instead of adding
---@param statName string
---@param value number
@@ -1183,13 +1190,6 @@ function Details222.PlayerStats:SetStat(statName, value)
Details.player_stats[statName] = value
end
---get the value of a saved stat
---@param statName string
---@return any
function Details222.PlayerStats:GetStat(statName, value)
return Details.player_stats[statName]
end
---destroy a table and remove it from the object, if the key isn't passed, the object itself is destroyed
---@param object any
---@param key string|nil
+30
View File
@@ -5411,6 +5411,36 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
if (difficultyID == 8) then
_detalhes:SendEvent("COMBAT_MYTHICDUNGEON_END")
end
local okay, errorText = pcall(function()
local mapChallengeModeID, mythicLevel, time, onTime, keystoneUpgradeLevels, practiceRun, oldOverallDungeonScore, newOverallDungeonScore, IsMapRecord, IsAffixRecord, PrimaryAffix, isEligibleForScore, members = C_ChallengeMode.GetCompletionInfo()
if (mapChallengeModeID) then
local statName = "mythicdungeoncompletedDF2"
local mythicDungeonRuns = Details222.PlayerStats:GetStat(statName)
mythicDungeonRuns = mythicDungeonRuns or {}
mythicDungeonRuns[mapChallengeModeID] = mythicDungeonRuns[mapChallengeModeID] or {}
mythicDungeonRuns[mapChallengeModeID][mythicLevel] = mythicDungeonRuns[mapChallengeModeID][mythicLevel] or {}
local currentRun = mythicDungeonRuns[mapChallengeModeID][mythicLevel]
currentRun.completed = (currentRun.completed or 0) + 1
currentRun.totalTime = (currentRun.totalTime or 0) + time
if (not currentRun.minTime or time < currentRun.minTime) then
currentRun.minTime = time
end
currentRun.history = currentRun.history or {}
local day, month, year = tonumber(date("%d")), tonumber(date("%m")), tonumber(date("%Y"))
local amountDeaths = C_ChallengeMode.GetDeathCount() or 0
tinsert(currentRun.history, {day = day, month = month, year = year, runTime = time, onTime = onTime, deaths = amountDeaths, affix = PrimaryAffix})
Details222.PlayerStats:SetStat("mythicdungeoncompletedDF2", mythicDungeonRuns)
end
end)
if (not okay) then
_detalhes:Msg("something went wrong (0x7878):", errorText)
end
end
function _detalhes.parser_functions:PLAYER_REGEN_ENABLED(...)
+6
View File
@@ -505,6 +505,12 @@ function Details:CreateBreakdownWindow()
LibWindow.RestorePosition(breakdownWindow)
LibWindow.MakeDraggable(breakdownWindow)
LibWindow.SavePosition(breakdownWindow)
breakdownWindow:SetScript("OnMouseDown", function(self, button)
if (button == "RightButton") then
Details:CloseBreakdownWindow()
end
end)
end
end