Major upgrade for alpha testers

This commit is contained in:
Tercio Jose
2023-11-30 16:13:14 -03:00
parent 319fe4c84e
commit 0ff046b500
24 changed files with 2616 additions and 1399 deletions
+60 -46
View File
@@ -49,10 +49,8 @@ end
--]]
--precisa converter um wipe em um trash segment? provavel que sim
-- at the end of a mythic run, if enable on settings, merge all the segments from the mythic run into only one
function DetailsMythicPlusFrame.MergeSegmentsOnEnd() --~merge
--at the end of a mythic run, if enable on settings, merge all the segments from the mythic run into only one
if (DetailsMythicPlusFrame.DevelopmentDebug) then
print("Details!", "MergeSegmentsOnEnd() > starting to merge mythic segments.", "InCombatLockdown():", InCombatLockdown())
end
@@ -66,16 +64,18 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() --~merge
local newCombat = Details:GetCurrentCombat()
local segmentsTable = Details:GetCombatSegments()
local totalTime = 0
local timeInCombat = 0
local startDate, endDate = "", ""
local lastSegment
local totalSegments = 0
--copy deaths occured on all segments to the new segment, also sum the activity combat time
if (Details.mythic_plus.reverse_death_log) then
for i = 1, 40 do --copy the deaths from the first segment to the last one
local thisCombat = segmentsTable[i]
if (thisCombat and thisCombat.is_mythic_dungeon_run_id == Details.mythic_dungeon_id) then
newCombat:CopyDeathsFrom(thisCombat, true)
timeInCombat = timeInCombat + thisCombat:GetCombatTime()
end
end
else
@@ -84,11 +84,30 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() --~merge
if (thisCombat) then
if (thisCombat.is_mythic_dungeon_run_id == Details.mythic_dungeon_id) then
newCombat:CopyDeathsFrom(thisCombat, true)
timeInCombat = timeInCombat + thisCombat:GetCombatTime()
end
end
end
end
local zoneName, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo()
--tag the segment as mythic overall segment
newCombat.is_mythic_dungeon = {
StartedAt = Details.MythicPlus.StartedAt, --the start of the run
EndedAt = Details.MythicPlus.EndedAt, --the end of the run
WorldStateTimerStart = Details222.MythicPlus.WorldStateTimerStartAt,
WorldStateTimerEnd = Details222.MythicPlus.WorldStateTimerEndAt,
TimeInCombat = timeInCombat,
SegmentID = "overall", --segment number within the dungeon
RunID = Details.mythic_dungeon_id,
OverallSegment = true,
ZoneName = Details.MythicPlus.DungeonName,
MapID = instanceMapID,
Level = Details.MythicPlus.Level,
EJID = Details.MythicPlus.ejID,
}
--add all boss segments from this run to this new segment
for i = 1, 40 do --from the newer combat to the oldest
local thisCombat = segmentsTable[i]
@@ -96,15 +115,12 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() --~merge
local canAddThisSegment = true
if (Details.mythic_plus.make_overall_boss_only) then
if (not thisCombat.is_boss) then
canAddThisSegment = false
--canAddThisSegment = false --disabled
end
end
if (canAddThisSegment) then
newCombat = newCombat + thisCombat
--newCombat:CopyDeathsFrom(thisCombat, true)
totalTime = totalTime + thisCombat:GetCombatTime()
totalSegments = totalSegments + 1
if (DetailsMythicPlusFrame.DevelopmentDebug) then
@@ -113,7 +129,7 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() --~merge
if (endDate == "") then
local _, whenEnded = thisCombat:GetDate()
endDate =whenEnded
endDate = whenEnded
end
lastSegment = thisCombat
end
@@ -126,33 +142,33 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() --~merge
end
if (DetailsMythicPlusFrame.DevelopmentDebug) then
print("Details!", "MergeSegmentsOnEnd() > totalTime:", totalTime, "startDate:", startDate)
print("Details!", "MergeSegmentsOnEnd() > totalTime:", timeInCombat, "startDate:", startDate)
end
local zoneName, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo()
--tag the segment as mythic overall segment
newCombat.is_mythic_dungeon = {
StartedAt = Details.MythicPlus.StartedAt, --the start of the run
EndedAt = Details.MythicPlus.EndedAt, --the end of the run
SegmentID = "overall", --segment number within the dungeon
RunID = Details.mythic_dungeon_id,
OverallSegment = true,
ZoneName = Details.MythicPlus.DungeonName,
MapID = instanceMapID,
Level = Details.MythicPlus.Level,
EJID = Details.MythicPlus.ejID,
}
newCombat.total_segments_added = totalSegments
newCombat.is_mythic_dungeon_segment = true
newCombat.is_mythic_dungeon_run_id = Details.mythic_dungeon_id
--check if both values are valid, this can get invalid if the player leaves the dungeon before the timer ends or the game crashes
if (type(Details222.MythicPlus.time) == "number") then
newCombat.run_time = Details222.MythicPlus.time
Details222.MythicPlus.LogStep("GetCompletionInfo() Found, Time: " .. Details222.MythicPlus.time)
elseif (newCombat.is_mythic_dungeon.WorldStateTimerEnd and newCombat.is_mythic_dungeon.WorldStateTimerStart) then
local runTime = newCombat.is_mythic_dungeon.WorldStateTimerEnd - newCombat.is_mythic_dungeon.WorldStateTimerStart
newCombat.run_time = Details222.MythicPlus.time
Details222.MythicPlus.LogStep("World State Timers is Available, Run Time: " .. runTime .. "| start:" .. newCombat.is_mythic_dungeon.WorldStateTimerStart .. "| end:" .. newCombat.is_mythic_dungeon.WorldStateTimerEnd)
else
newCombat.run_time = timeInCombat
Details222.MythicPlus.LogStep("GetCompletionInfo() and World State Timers not Found, Activity Time: " .. timeInCombat)
end
newCombat:SetStartTime(GetTime() - timeInCombat)
newCombat:SetEndTime(GetTime())
Details222.MythicPlus.LogStep("Activity Time: " .. timeInCombat)
--set the segment time and date
newCombat:SetStartTime (GetTime() - totalTime)
newCombat:SetEndTime (GetTime())
newCombat:SetDate (startDate, endDate)
newCombat:SetDate(startDate, endDate)
--immediatly finishes the segment just started
Details:SairDoCombate()
@@ -391,9 +407,9 @@ function DetailsMythicPlusFrame.MergeRemainingTrashAfterAllBossesDone()
end
end
--this function is called right after defeat a boss inside a mythic dungeon
--it comes from details! control leave combat
function DetailsMythicPlusFrame.BossDefeated(this_is_end_end, encounterID, encounterName, difficultyID, raidSize, endStatus) --hold your breath and count to ten
--this function is called right after defeat a boss inside a mythic dungeon
--it comes from details! control leave combat
if (DetailsMythicPlusFrame.DevelopmentDebug) then
print("Details!", "BossDefeated() > boss defeated | SegmentID:", Details.MythicPlus.SegmentID, " | mapID:", Details.MythicPlus.DungeonID)
end
@@ -650,13 +666,13 @@ function DetailsMythicPlusFrame.MythicDungeonStarted()
local mythicLevel = C_ChallengeMode.GetActiveKeystoneInfo()
local zoneName, _, _, _, _, _, _, currentZoneID = GetInstanceInfo()
local mapID = C_Map.GetBestMapForUnit ("player")
local mapID = C_Map.GetBestMapForUnit("player")
if (not mapID) then
return
end
local ejID = DF.EncounterJournal.EJ_GetInstanceForMap (mapID)
local ejID = DF.EncounterJournal.EJ_GetInstanceForMap(mapID)
--setup the mythic run info
Details.MythicPlus.Started = true
@@ -669,12 +685,12 @@ function DetailsMythicPlusFrame.MythicDungeonStarted()
Details.MythicPlus.ejID = ejID
Details.MythicPlus.PreviousBossKilledAt = time()
Details:SaveState_CurrentMythicDungeonRun (Details.mythic_dungeon_id, zoneName, currentZoneID, time()+9.7, 1, mythicLevel, ejID, time())
Details:SaveState_CurrentMythicDungeonRun(Details.mythic_dungeon_id, zoneName, currentZoneID, time()+9.7, 1, mythicLevel, ejID, time())
local name, groupType, difficultyID, difficult = GetInstanceInfo()
if (groupType == "party" and Details.overall_clear_newchallenge) then
Details.historico:ResetOverallData()
Details:Msg("overall data are now reset.")
Details:Msg("the overall data has been reset.") --localize-me
if (Details.debug) then
Details:Msg("(debug) timer is for a mythic+ dungeon, overall has been reseted.")
@@ -684,19 +700,17 @@ function DetailsMythicPlusFrame.MythicDungeonStarted()
if (DetailsMythicPlusFrame.DevelopmentDebug) then
print("Details!", "MythicDungeonStarted() > State set to Mythic Dungeon, new combat starting in 10 seconds.")
end
end
function DetailsMythicPlusFrame.OnChallengeModeStart()
--is this a mythic dungeon?
local _, _, difficulty, _, _, _, _, currentZoneID = GetInstanceInfo()
local _, _, difficultyID, _, _, _, _, currentZoneID = GetInstanceInfo()
if (difficulty == 8 and DetailsMythicPlusFrame.LastTimer and DetailsMythicPlusFrame.LastTimer+2 > GetTime()) then
if (difficultyID == 8) then
--start the dungeon on Details!
DetailsMythicPlusFrame.MythicDungeonStarted()
--print("D! mythic dungeon started!")
Details222.MythicPlus.LogStep("OnChallengeModeStart()")
else
--print("D! mythic dungeon was already started!")
--from zone changed
local mythicLevel = C_ChallengeMode.GetActiveKeystoneInfo()
@@ -794,10 +808,10 @@ function DetailsMythicPlusFrame.EventListener.OnDetailsEvent(contextObject, even
lowerInstance = Details:GetInstance(lowerInstance)
if (lowerInstance) then
C_Timer.After(3, function()
if (lowerInstance:IsEnabled()) then
--if (lowerInstance:IsEnabled()) then
--todo, need localization
lowerInstance:InstanceAlert("Details!" .. " " .. "Damage" .. " " .. "Meter", {[[Interface\AddOns\Details\images\minimap]], 16, 16, false}, 3, {function() end}, false, true)
end
--lowerInstance:InstanceAlert("Details!" .. " " .. "Damage" .. " " .. "Meter", {[[Interface\AddOns\Details\images\minimap]], 16, 16, false}, 3, {function() end}, false, true)
--end
end)
end
end
@@ -812,7 +826,7 @@ function DetailsMythicPlusFrame.EventListener.OnDetailsEvent(contextObject, even
Details:Destroy(Details.cached_specs)
end
C_Timer.After(0.5, DetailsMythicPlusFrame.OnChallengeModeStart)
C_Timer.After(0.25, DetailsMythicPlusFrame.OnChallengeModeStart)
--debugging
local mPlusSettings = Details.mythic_plus
@@ -825,7 +839,7 @@ function DetailsMythicPlusFrame.EventListener.OnDetailsEvent(contextObject, even
local mythicLevel = C_ChallengeMode.GetActiveKeystoneInfo()
local zoneName, _, _, _, _, _, _, currentZoneID = GetInstanceInfo()
Details222.MythicPlus.LogStep("CHALLENGE_MODE_START | settings: " .. result .. " | level: " .. mythicLevel .. " | zone: " .. zoneName .. " | zoneId: " .. currentZoneID)
Details222.MythicPlus.LogStep("COMBAT_MYTHICDUNGEON_START | settings: " .. result .. " | level: " .. mythicLevel .. " | zone: " .. zoneName .. " | zoneId: " .. currentZoneID)
elseif (event == "COMBAT_MYTHICDUNGEON_END") then
--ignore the event if ignoring mythic dungeon special treatment
@@ -842,7 +856,7 @@ end
DetailsMythicPlusFrame:SetScript("OnEvent", function(_, event, ...)
if (event == "START_TIMER") then
DetailsMythicPlusFrame.LastTimer = GetTime()
--DetailsMythicPlusFrame.LastTimer = GetTime()
elseif (event == "ZONE_CHANGED_NEW_AREA") then
if (DetailsMythicPlusFrame.IsDoingMythicDungeon) then
+11 -1
View File
@@ -495,6 +495,13 @@ function Details:ApplyProfile(profileName, bNoSave, bIsCopy)
Details.time_type = 2
end
Details.capture_real["damage"] = true
Details.capture_real["heal"] = true
Details.capture_real["energy"] = true
Details.capture_real["miscdata"] = true
Details.capture_real["aura"] = true
Details.capture_real["spellcast"] = true
return true
end
@@ -1346,6 +1353,7 @@ local default_global_data = {
custom = {},
savedStyles = {},
savedCustomSpells = {},
userCustomSpells = {}, --spells modified by the user
savedTimeCaptures = {},
lastUpdateWarning = 0,
update_warning_timeout = 10,
@@ -1594,7 +1602,9 @@ local default_global_data = {
mythicrun_chart_frame = {},
mythicrun_chart_frame_minimized = {},
mythicrun_chart_frame_ready = {},
},
mythicrun_time_type = 1, --1: combat time (the amount of time the player is in combat) 2: run time (the amount of time it took to finish the mythic+ run)
}, --implementar esse time_type quando estiver dando refresh na janela
--plugin window positions
plugin_window_pos = {},
+17 -4
View File
@@ -336,12 +336,15 @@ do
return customItemList
end
function Details:UserCustomSpellUpdate(index, spellName, spellIcon)
function Details:UserCustomSpellUpdate(index, spellName, spellIcon) --called from the options panel > rename spells
---@type savedspelldata
local savedSpellData = Details.savedCustomSpells[index]
if (savedSpellData) then
local spellId = savedSpellData[1]
savedSpellData[2], savedSpellData[3] = spellName or savedSpellData[2], spellIcon or savedSpellData[3]
return rawset(Details.spellcache, savedSpellData[1], {savedSpellData[2], 1, savedSpellData[3]})
rawset(Details.spellcache, spellId, {savedSpellData[2], 1, savedSpellData[3]})
Details.userCustomSpells[spellId] = true
return true
else
return false
end
@@ -416,7 +419,13 @@ do
end
end
function Details:UserCustomSpellAdd(spellId, spellName, spellIcon)
function Details:UserCustomSpellAdd(spellId, spellName, spellIcon, bAddedByUser)
if (Details.userCustomSpells[spellId]) then
if (not bAddedByUser) then
return
end
end
local isOverwrite = false
for index, savedSpellData in ipairs(Details.savedCustomSpells) do
if (savedSpellData[1] == spellId) then
@@ -431,7 +440,11 @@ do
tinsert(Details.savedCustomSpells, {spellId, spellName, spellIcon})
end
return rawset(Details.spellcache, spellId, {spellName, 1, spellIcon})
rawset(Details.spellcache, spellId, {spellName, 1, spellIcon})
if (bAddedByUser) then
Details.userCustomSpells[spellId] = true
end
end
function Details:UserCustomSpellRemove(index)