Skip to content

Commit

Permalink
'Update'
Browse files Browse the repository at this point in the history
  • Loading branch information
BloodDragon2580 committed Aug 17, 2024
1 parent 3ebc069 commit 504b712
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 9 deletions.
2 changes: 1 addition & 1 deletion MythicPlusDrop/MythicPlusDrop.toc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Interface: 110002
## Title: |cffd6266cMythicPlusDrop|r
## Version: 8.4
## Version: 8.5
## Notes: Info for Mythic Dungeons
## Author: BloodDragon2580
## SavedVariables: MythicPlusDrop_Config, MythicPlusDrop_Data
Expand Down
66 changes: 58 additions & 8 deletions MythicPlusDrop/ProgressTracker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function Mod:COMBAT_LOG_EVENT_UNFILTERED()
lastDied = tonumber(npc_id)
lastDiedTime = GetTime()
lastDiedName = destName
ProcessLasts()
end
if bit.band(destFlags, COMBATLOG_OBJECT_TYPE_PLAYER) > 0 then
if UnitIsFeignDeath(destName) then
Expand All @@ -57,11 +58,12 @@ function Mod:SCENARIO_CRITERIA_UPDATE()
for criteriaIndex = 1, numCriteria do
local criteriaInfo = C_ScenarioInfo.GetCriteriaInfo(criteriaIndex)
if criteriaInfo and criteriaInfo.isWeightedProgress then
local quantityString = criteriaInfo.description
local currentQuantity = criteriaInfo.quantity
local quantityString = criteriaInfo.quantityString
local currentQuantity = quantityString and tonumber( quantityString:match("%d+") )
if lastQuantity and currentQuantity < criteriaInfo.totalQuantity and currentQuantity > lastQuantity then
lastAmount = currentQuantity - lastQuantity
lastAmountTime = GetTime()
ProcessLasts()
end
lastQuantity = currentQuantity
break
Expand All @@ -76,7 +78,8 @@ local function StartTime()
for criteriaIndex = 1, numCriteria do
local criteriaInfo = C_ScenarioInfo.GetCriteriaInfo(criteriaIndex)
if criteriaInfo and criteriaInfo.isWeightedProgress then
lastQuantity = criteriaInfo.quantity
local quantityString = criteriaInfo.quantityString
lastQuantity = quantityString and tonumber( quantityString:match("%d+") )
break
end
end
Expand Down Expand Up @@ -181,31 +184,78 @@ function Mod:GeneratePreset()
return ret
end

function Mod:PLAYER_ENTERING_WORLD(...) CheckTime(GetWorldElapsedTimers()) end
function Mod:WORLD_STATE_TIMER_START(...) local timerID = ...; CheckTime(timerID) end
function Mod:WORLD_STATE_TIMER_STOP(...) local timerID = ...; StopTime(timerID) end
function Mod:CHALLENGE_MODE_START(...) CheckTime(GetWorldElapsedTimers()) end
function Mod:CHALLENGE_MODE_RESET(...) wipe(Mod.playerDeaths) end

local function ProgressBar_SetValue(self, percent)

local scenarioType = select(10, C_Scenario.GetInfo())

if scenarioType ~= LE_SCENARIO_TYPE_CHALLENGE_MODE then return end

local numCriteria = select(3, C_Scenario.GetStepInfo())
local criteriaInfo
local cInfo

for criteriaIndex = 1, numCriteria do
cInfo = C_ScenarioInfo.GetCriteriaInfo(criteriaIndex)
if cInfo and cInfo.isWeightedProgress then
criteriaInfo = cInfo
break
end
end

if not criteriaInfo then return end

local totalQuantity = criteriaInfo.totalQuantity
local quantityString = criteriaInfo.quantityString
local currentQuantity = quantityString and tonumber( quantityString:match("%d+") )

if currentQuantity and totalQuantity then
if Addon.Config.progressFormat == 1 then
self.Bar.Label:SetFormattedText("%.2f%%", currentQuantity/totalQuantity*100)
elseif Addon.Config.progressFormat == 2 then
self.Bar.Label:SetFormattedText("%d/%d", currentQuantity, totalQuantity)
elseif Addon.Config.progressFormat == 3 then
self.Bar.Label:SetFormattedText("%.2f%% - %d/%d", currentQuantity/totalQuantity*100, currentQuantity, totalQuantity)
elseif Addon.Config.progressFormat == 4 then
self.Bar.Label:SetFormattedText("%.2f%% (%.2f%%)", currentQuantity/totalQuantity*100, (totalQuantity-currentQuantity)/totalQuantity*100)
elseif Addon.Config.progressFormat == 5 then
self.Bar.Label:SetFormattedText("%d/%d (%d)", currentQuantity, totalQuantity, totalQuantity - currentQuantity)
elseif Addon.Config.progressFormat == 6 then
self.Bar.Label:SetFormattedText("%.2f%% (%.2f%%) - %d/%d (%d)", currentQuantity/totalQuantity*100, (totalQuantity-currentQuantity)/totalQuantity*100, currentQuantity, totalQuantity, totalQuantity - currentQuantity)
end
end
end

function Mod:PLAYER_ENTERING_WORLD(...)
CheckTime(GetWorldElapsedTimers())
local progressBarFound = false

local function findProgressBar()

if progressBarFound then return end

local usedBars = ScenarioObjectiveTracker.usedProgressBars or {}

for _, bar in pairs(usedBars) do
if bar.used then
hooksecurefunc(bar, "SetValue", ProgressBar_SetValue)
progressBarFound = true
break
end
end
end

hooksecurefunc(ScenarioObjectiveTracker.ObjectivesBlock, "AddProgressBar", findProgressBar )

local function DeathCount_OnEnter(self)
local timeLost = tonumber(self.Count:GetText()) * 5
local parent = self:GetParent()

GameTooltip:SetOwner(self, "ANCHOR_LEFT")
GameTooltip:SetText(CHALLENGE_MODE_DEATH_COUNT_TITLE:format(tonumber(self.Count:GetText())), 1, 1, 1)
GameTooltip:AddLine(CHALLENGE_MODE_DEATH_COUNT_DESCRIPTION:format(SecondsToClock(timeLost, false)))
GameTooltip:SetText(CHALLENGE_MODE_DEATH_COUNT_TITLE:format(parent.deathCount), 1, 1, 1)
GameTooltip:AddLine(CHALLENGE_MODE_DEATH_COUNT_DESCRIPTION:format(SecondsToClock(parent.timeLost, false)))

GameTooltip:AddLine(" ")
local list = {}
Expand Down

0 comments on commit 504b712

Please sign in to comment.