From 55420e789324d541a37529be08b41ca46104c39c Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Tue, 16 Jul 2024 15:17:46 -0300 Subject: [PATCH] More debug for the new storage system --- boot.lua | 4 ++-- core/gears.lua | 44 +++++++++++++++++++++++++++++--------------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/boot.lua b/boot.lua index bd8e828d2..6b37b6512 100644 --- a/boot.lua +++ b/boot.lua @@ -19,8 +19,8 @@ local addonName, Details222 = ... local version, build, date, tvs = GetBuildInfo() - Details.build_counter = 12810 - Details.alpha_build_counter = 12810 --if this is higher than the regular counter, use it instead + Details.build_counter = 12811 + Details.alpha_build_counter = 12811 --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 diff --git a/core/gears.lua b/core/gears.lua index d1c307e58..00372adc5 100644 --- a/core/gears.lua +++ b/core/gears.lua @@ -2,6 +2,8 @@ local Details = _G.Details local addonName, Details222 = ... local Loc = LibStub("AceLocale-3.0"):GetLocale( "Details" ) +---@framework +local detailsFramework = DetailsFramework local _ local UnitGUID = UnitGUID @@ -1812,8 +1814,13 @@ end ---@param combat 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() -print(1) + if (not combat) then if (Details.debug) then print("|cFFFFFF00Details! Storage|r: combat not found.") @@ -1831,7 +1838,7 @@ print(1) end return end - print(2) + local encounterInfo = combat:GetBossInfo() local encounterId = encounterInfo and encounterInfo.id @@ -1843,15 +1850,21 @@ print(1) end --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 ---@type details_storage? local savedData = Details.Database.LoadDB() if (not savedData) then + if (Details.debug) then + print("|cFFFFFF00Details! Storage|r: Details.Database.LoadDB() FAILED!") + end return end - print(3) + --[=[ savedData[mythic] = { [encounterId] = { --indexed table @@ -1876,10 +1889,11 @@ print(1) local elapsedCombatTime = combat:GetCombatTime() ---@type table - local encountersTable = savedData[diff] + local encountersTable = savedData[diffName] if (not encountersTable) then - savedData[diff] = {} - encountersTable = savedData[diff] + Details:Msg("encountersTable not found, diffName:", diffName) + savedData[diffName] = {} + encountersTable = savedData[diffName] end ---@type details_encounterkillinfo[] @@ -1896,7 +1910,7 @@ print(1) --if the player is facing a raid boss if (IsInRaid()) then totalkillsTable[encounterId] = totalkillsTable[encounterId] or {} - totalkillsTable[encounterId][diff] = totalkillsTable[encounterId][diff] or { + totalkillsTable[encounterId][diffName] = totalkillsTable[encounterId][diffName] or { kills = 0, wipes = 0, time_fasterkill = 1000000, @@ -1909,7 +1923,7 @@ print(1) } print(4) ---@type details_bosskillinfo - local bossData = totalkillsTable[encounterId][diff] + local bossData = totalkillsTable[encounterId][diffName] ---@type combattime local encounterElapsedTime = elapsedCombatTime @@ -1944,9 +1958,9 @@ print(1) bossData.dps_best_raid_when = time() end end - print(5, diff) + print(5, diffName) --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 local match = 0 local guildName = GetGuildInfo("player") @@ -1993,7 +2007,7 @@ print(1) local damageContainer = combat:GetContainer(DETAILS_ATTRIBUTE_DAMAGE) local healingContainer = combat:GetContainer(DETAILS_ATTRIBUTE_HEAL) - print(6, diff) + print(6, diffName) for i = 1, GetNumGroupMembers() do local role = UnitGroupRolesAssigned(cachedRaidUnitIds[i]) @@ -2036,7 +2050,7 @@ print(1) end end - print(7, diff) + print(7, diffName) --add the encounter data tinsert(allEncountersStored, combatResultData) @@ -2046,7 +2060,7 @@ print(1) local playerRole = UnitGroupRolesAssigned("player") ---@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 local registeredBestTotal = bestRank and bestRank.total or 0 @@ -2087,7 +2101,7 @@ print(1) end 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} if (not Details.deny_score_messages) then instanceObject:InstanceAlert(Loc ["STRING_GUILDDAMAGERANK_WINDOWALERT"], icon, Details.update_warning_timeout, func, true)