Skip to content

Commit

Permalink
More debug for the new storage system
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Jul 16, 2024
1 parent edfea88 commit 55420e7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
4 changes: 2 additions & 2 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 29 additions & 15 deletions core/gears.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.")
Expand All @@ -1831,7 +1838,7 @@ print(1)
end
return
end
print(2)

local encounterInfo = combat:GetBossInfo()
local encounterId = encounterInfo and encounterInfo.id

Expand All @@ -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
Expand All @@ -1876,10 +1889,11 @@ print(1)
local elapsedCombatTime = combat:GetCombatTime()

---@type table<encounterid, details_encounterkillinfo[]>
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[]
Expand All @@ -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,
Expand All @@ -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

Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -2036,7 +2050,7 @@ print(1)
end
end

print(7, diff)
print(7, diffName)

--add the encounter data
tinsert(allEncountersStored, combatResultData)
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 55420e7

Please sign in to comment.