More debug for the new storage system

This commit is contained in:
Tercio Jose
2024-07-16 15:17:46 -03:00
committed by andrew6180
parent 74bcd28edf
commit 6a1b10f8f0
2 changed files with 31 additions and 17 deletions
+2 -2
View File
@@ -19,8 +19,8 @@
local addonName, Details222 = ... local addonName, Details222 = ...
local version = GetBuildInfo() local version = GetBuildInfo()
Details.build_counter = 12810 Details.build_counter = 12811
Details.alpha_build_counter = 12810 --if this is higher than the regular counter, use it instead Details.alpha_build_counter = 12811 --if this is higher than the regular counter, use it instead
Details.dont_open_news = true Details.dont_open_news = true
Details.game_version = version Details.game_version = version
Details.userversion = version .. " " .. Details.build_counter Details.userversion = version .. " " .. Details.build_counter
+29 -15
View File
@@ -2,6 +2,8 @@
local Details = _G.Details local Details = _G.Details
local addonName, Details222 = ... local addonName, Details222 = ...
local Loc = LibStub("AceLocale-3.0"):GetLocale( "Details" ) local Loc = LibStub("AceLocale-3.0"):GetLocale( "Details" )
---@framework
local detailsFramework = DetailsFramework
local _ local _
local UnitGUID = UnitGUID local UnitGUID = UnitGUID
@@ -1834,8 +1836,13 @@ end
---@param combat combat ---@param combat combat
function Details.Database.StoreEncounter(combat) function Details.Database.StoreEncounter(combat)
--stop execution if the expansion isn't retail
if (not detailsFramework:IsDragonflightAndBeyond()) then
return
end
combat = combat or Details:GetCurrentCombat() combat = combat or Details:GetCurrentCombat()
print(1)
if (not combat) then if (not combat) then
if (Details.debug) then if (Details.debug) then
print("|cFFFFFF00Details! Storage|r: combat not found.") print("|cFFFFFF00Details! Storage|r: combat not found.")
@@ -1853,7 +1860,7 @@ print(1)
end end
return return
end end
print(2)
local encounterInfo = combat:GetBossInfo() local encounterInfo = combat:GetBossInfo()
local encounterId = encounterInfo and encounterInfo.id local encounterId = encounterInfo and encounterInfo.id
@@ -1865,15 +1872,21 @@ print(1)
end end
--get the difficulty --get the difficulty
local diffId, diff = combat:GetDifficulty() local diffId, diffName = combat:GetDifficulty()
if (Details.debug) then
print("|cFFFFFF00Details! Storage|r: difficulty identified:", diffId, diffName)
end
--database --database
---@type details_storage? ---@type details_storage?
local savedData = Details.Database.LoadDB() local savedData = Details.Database.LoadDB()
if (not savedData) then if (not savedData) then
if (Details.debug) then
print("|cFFFFFF00Details! Storage|r: Details.Database.LoadDB() FAILED!")
end
return return
end end
print(3)
--[=[ --[=[
savedData[mythic] = { savedData[mythic] = {
[encounterId] = { --indexed table [encounterId] = { --indexed table
@@ -1898,10 +1911,11 @@ print(1)
local elapsedCombatTime = combat:GetCombatTime() local elapsedCombatTime = combat:GetCombatTime()
---@type table<encounterid, details_encounterkillinfo[]> ---@type table<encounterid, details_encounterkillinfo[]>
local encountersTable = savedData[diff] local encountersTable = savedData[diffName]
if (not encountersTable) then if (not encountersTable) then
savedData[diff] = {} Details:Msg("encountersTable not found, diffName:", diffName)
encountersTable = savedData[diff] savedData[diffName] = {}
encountersTable = savedData[diffName]
end end
---@type details_encounterkillinfo[] ---@type details_encounterkillinfo[]
@@ -1918,7 +1932,7 @@ print(1)
--if the player is facing a raid boss --if the player is facing a raid boss
if (IsInRaid()) then if (IsInRaid()) then
totalkillsTable[encounterId] = totalkillsTable[encounterId] or {} totalkillsTable[encounterId] = totalkillsTable[encounterId] or {}
totalkillsTable[encounterId][diff] = totalkillsTable[encounterId][diff] or { totalkillsTable[encounterId][diffName] = totalkillsTable[encounterId][diffName] or {
kills = 0, kills = 0,
wipes = 0, wipes = 0,
time_fasterkill = 1000000, time_fasterkill = 1000000,
@@ -1931,7 +1945,7 @@ print(1)
} }
print(4) print(4)
---@type details_bosskillinfo ---@type details_bosskillinfo
local bossData = totalkillsTable[encounterId][diff] local bossData = totalkillsTable[encounterId][diffName]
---@type combattime ---@type combattime
local encounterElapsedTime = elapsedCombatTime local encounterElapsedTime = elapsedCombatTime
@@ -1966,9 +1980,9 @@ print(1)
bossData.dps_best_raid_when = time() bossData.dps_best_raid_when = time()
end end
end end
print(5, diff) print(5, diffName)
--check for heroic and mythic --check for heroic and mythic
if (Details222.storage.IsDebug or Details222.storage.DiffNamesHash[diff]) then if (Details222.storage.IsDebug or Details222.storage.DiffNamesHash[diffName]) then
--check the guild name --check the guild name
local match = 0 local match = 0
local guildName = GetGuildInfo("player") local guildName = GetGuildInfo("player")
@@ -2015,7 +2029,7 @@ print(1)
local damageContainer = combat:GetContainer(DETAILS_ATTRIBUTE_DAMAGE) local damageContainer = combat:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
local healingContainer = combat:GetContainer(DETAILS_ATTRIBUTE_HEAL) local healingContainer = combat:GetContainer(DETAILS_ATTRIBUTE_HEAL)
print(6, diff) print(6, diffName)
for i = 1, GetNumGroupMembers() do for i = 1, GetNumGroupMembers() do
local role = UnitGroupRolesAssigned(cachedRaidUnitIds[i]) local role = UnitGroupRolesAssigned(cachedRaidUnitIds[i])
@@ -2058,7 +2072,7 @@ print(1)
end end
end end
print(7, diff) print(7, diffName)
--add the encounter data --add the encounter data
tinsert(allEncountersStored, combatResultData) tinsert(allEncountersStored, combatResultData)
@@ -2068,7 +2082,7 @@ print(1)
local playerRole = UnitGroupRolesAssigned("player") local playerRole = UnitGroupRolesAssigned("player")
---@type details_storage_unitresult, details_encounterkillinfo ---@type details_storage_unitresult, details_encounterkillinfo
local bestRank, encounterKillInfo = Details222.storage.GetBestFromPlayer(diff, encounterId, playerRole, Details.playername, true) --get dps or hps local bestRank, encounterKillInfo = Details222.storage.GetBestFromPlayer(diffName, encounterId, playerRole, Details.playername, true) --get dps or hps
if (bestRank and encounterKillInfo) then if (bestRank and encounterKillInfo) then
local registeredBestTotal = bestRank and bestRank.total or 0 local registeredBestTotal = bestRank and bestRank.total or 0
@@ -2109,7 +2123,7 @@ print(1)
end end
local raidName = GetInstanceInfo() local raidName = GetInstanceInfo()
local func = {Details.OpenRaidHistoryWindow, Details, raidName, encounterId, diff, playerRole, guildName} local func = {Details.OpenRaidHistoryWindow, Details, raidName, encounterId, diffName, playerRole, guildName}
local icon = {[[Interface\PvPRankBadges\PvPRank08]], 16, 16, false, 0, 1, 0, 1} local icon = {[[Interface\PvPRankBadges\PvPRank08]], 16, 16, false, 0, 1, 0, 1}
if (not Details.deny_score_messages) then if (not Details.deny_score_messages) then
instanceObject:InstanceAlert(Loc ["STRING_GUILDDAMAGERANK_WINDOWALERT"], icon, Details.update_warning_timeout, func, true) instanceObject:InstanceAlert(Loc ["STRING_GUILDDAMAGERANK_WINDOWALERT"], icon, Details.update_warning_timeout, func, true)