From 0531ed0b91d96035662a6b7f163a3f914e0627dd Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Thu, 11 Jul 2024 01:16:18 -0300 Subject: [PATCH] More storage development --- boot.lua | 6 ++++-- classes/class_combat.lua | 8 +------- classes/class_damage.lua | 2 ++ core/gears.lua | 42 +++++++++++++++++++--------------------- core/parser.lua | 6 +----- frames/window_debug.lua | 19 ++++++++++++++++++ frames/window_main.lua | 6 +++--- startup.lua | 7 ++++++- 8 files changed, 56 insertions(+), 40 deletions(-) diff --git a/boot.lua b/boot.lua index c4f542bde..74e5c0ddd 100644 --- a/boot.lua +++ b/boot.lua @@ -115,8 +115,10 @@ ---@type details_storage_feature ---@diagnostic disable-next-line: missing-fields local storage = { - DiffNames = {"normal", "heroic", "mythic"}, - DiffNamesHash = {normal = 14, heroic = 15, mythic = 16}, + DiffNames = {"normal", "heroic", "mythic", "raidfinder"}, + DiffNamesHash = {normal = 14, heroic = 15, mythic = 16, raidfinder = 17}, + DiffIdToName = {[14] = "normal", [15] = "heroic", [16] = "mythic", [17] = "raidfinder"}, + IsDebug = false } Details222.storage = storage diff --git a/classes/class_combat.lua b/classes/class_combat.lua index f5b400ce9..800428ce5 100644 --- a/classes/class_combat.lua +++ b/classes/class_combat.lua @@ -177,17 +177,11 @@ local segmentTypeToString = { return rawget(self, "is_trash") end - local diffNumberToName = { - [14] = "normal", - [15] = "heroic", - [16] = "mythic", - } - function classCombat:GetDifficulty() local bossInfo = self:GetBossInfo() if (bossInfo) then local difficultyId = bossInfo.diff - return difficultyId, diffNumberToName[difficultyId] + return difficultyId, Details222.storage.DiffIdToName[difficultyId] end end diff --git a/classes/class_damage.lua b/classes/class_damage.lua index 15b7c425c..458545f05 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -44,6 +44,8 @@ --show more information about spells local debugmode = false + local GetSpellTexture = GetSpellTexture or C_Spell.GetSpellTexture + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --constants diff --git a/core/gears.lua b/core/gears.lua index b9613dae1..6085069ce 100644 --- a/core/gears.lua +++ b/core/gears.lua @@ -23,7 +23,7 @@ function Details:UpdateGears() Details:UpdateCombat() end ----@alias raid_difficulty_eng_name_lowercase "normal" | "heroic" | "mythic" +---@alias raid_difficulty_eng_name_lowercase "normal" | "heroic" | "mythic" | "raidfinder" ------------------------------------------------------------------------------------------------------------ --chat hooks @@ -861,7 +861,7 @@ end) ---@field totalkills table> ---@class details_storage_feature : table ----@field diffNames string[] {"normal", "heroic", "mythic"} +---@field diffNames string[] {"normal", "heroic", "mythic", "raidfinder"} ---@field OpenRaidStorage fun():details_storage ---@field HaveDataForEncounter fun(difficulty:string, encounterId:number, guildName:string|boolean):boolean ---@field GetBestFromGuild fun(difficulty:string, encounterId:number, role:role, dps:boolean, guildName:string):actorname, details_storage_unitresult, details_encounterkillinfo @@ -871,11 +871,7 @@ end) local CONST_ADDONNAME_DATASTORAGE = "Details_DataStorage" -local diffNumberToName = { - [14] = "normal", - [15] = "heroic", - [16] = "mythic", -} +local diffNumberToName = Details222.storage.DiffIdToName local createStorageTables = function() local storageDatabase = DetailsDataStorage @@ -1764,9 +1760,9 @@ function Details.Database.StoreWipe(combat) local name, type, zoneDifficulty, difficultyName, maxPlayers, playerDifficulty, isDynamicInstance, mapID, instanceGroupSize = GetInstanceInfo() - if (not Details:IsZoneIdFromCurrentExpansion(mapID)) then + if (not Details:IsZoneIdFromCurrentExpansion(mapID) and not Details222.storage.IsDebug) then if (Details.debug) then - print("|cFFFFFF00Details! Storage|r: instance not allowed.") + print("|cFFFFFF00Details! Storage|r: instance not allowed.") --again end return end @@ -1813,14 +1809,10 @@ function Details.Database.StoreWipe(combat) end end - ----PAREI AQUI - - ---@param combat combat function Details.Database.StoreEncounter(combat) combat = combat or Details:GetCurrentCombat() - +print(1) if (not combat) then if (Details.debug) then print("|cFFFFFF00Details! Storage|r: combat not found.") @@ -1830,13 +1822,15 @@ function Details.Database.StoreEncounter(combat) local name, type, difficulty, difficultyName, maxPlayers, playerDifficulty, isDynamicInstance, mapID, instanceGroupSize = GetInstanceInfo() - if (not Details:IsZoneIdFromCurrentExpansion(mapID)) then + --Details:IsZoneIdFromCurrentExpansion(select(8, GetInstanceInfo())) + + if (not Details:IsZoneIdFromCurrentExpansion(mapID) and not Details222.storage.IsDebug) then if (Details.debug) then print("|cFFFFFF00Details! Storage|r: instance not allowed.") end return end - + print(2) local encounterInfo = combat:GetBossInfo() local encounterId = encounterInfo and encounterInfo.id @@ -1856,7 +1850,7 @@ function Details.Database.StoreEncounter(combat) if (not savedData) then return end - + print(3) --[=[ savedData[mythic] = { [encounterId] = { --indexed table @@ -1896,7 +1890,7 @@ function Details.Database.StoreEncounter(combat) --total kills in a boss on raid or dungeon local totalkillsTable = Details.Database.GetBossKillsDB(savedData) - + --store total kills on this boss --if the player is facing a raid boss if (IsInRaid()) then @@ -1912,7 +1906,7 @@ function Details.Database.StoreEncounter(combat) dps_best_raid = 0, dps_best_raid_when = 0 } - + print(4) ---@type details_bosskillinfo local bossData = totalkillsTable[encounterId][diff] ---@type combattime @@ -1949,9 +1943,9 @@ function Details.Database.StoreEncounter(combat) bossData.dps_best_raid_when = time() end end - + print(5, diff) --check for heroic and mythic - if (storageDebug or Details222.storage.DiffNamesHash[diff]) then + if (Details222.storage.IsDebug or Details222.storage.DiffNamesHash[diff]) then --check the guild name local match = 0 local guildName = GetGuildInfo("player") @@ -1959,7 +1953,7 @@ function Details.Database.StoreEncounter(combat) local cachedUnitIds = Details222.UnitIdCache.Raid - if (not storageDebug) then + if (not Details222.storage.IsDebug) then if (guildName) then for i = 1, raidSize do local gName = GetGuildInfo(cachedUnitIds[i]) or "" @@ -1998,6 +1992,8 @@ function Details.Database.StoreEncounter(combat) local damageContainer = combat:GetContainer(DETAILS_ATTRIBUTE_DAMAGE) local healingContainer = combat:GetContainer(DETAILS_ATTRIBUTE_HEAL) + print(6, diff) + for i = 1, GetNumGroupMembers() do local role = UnitGroupRolesAssigned(cachedUnitIds[i]) @@ -2039,6 +2035,8 @@ function Details.Database.StoreEncounter(combat) end end + print(7, diff) + --add the encounter data tinsert(allEncountersStored, combatResultData) if (Details.debug) then diff --git a/core/parser.lua b/core/parser.lua index f1fc456ea..037851522 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -677,11 +677,7 @@ --this block won't execute if the storage isn't loaded --self is a timer reference from C_Timer - local diffNumberToName = { - [14] = "normal", - [15] = "heroic", - [16] = "mythic", - } + local diffNumberToName = Details222.storage.DiffIdToName local encounterID = self.Boss local diff = self.Diff diff --git a/frames/window_debug.lua b/frames/window_debug.lua index 82763c0b0..2d25ed2a1 100644 --- a/frames/window_debug.lua +++ b/frames/window_debug.lua @@ -123,6 +123,25 @@ local createDebugOptionsFrame = function() desc = "When enabled, Details! will save the chart data from the next m+ run and use it when showing the chart panel. This save persist on saved variables and I don't think it is deleted, never.", --/run Details.mythic_plus.last_mythicrun_chart = {} }, + + {type = "blank"}, + + {--storage debug + type = "toggle", + get = function() + return Details222.storage.IsDebug + end, + set = function(self, fixedparam, value) + Details222.storage.IsDebug = value + if (Details222.storage.IsDebug) then + Details:Msg("Storage Debug is ON.") + else + Details:Msg("Storage Debug is OFF.") + end + end, + name = "Encounter Storage Debug", + desc = "Internal tests of the storage feature.", + }, } options.always_boxfirst = true diff --git a/frames/window_main.lua b/frames/window_main.lua index 574589a87..2032e5697 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -6096,9 +6096,9 @@ local build_mode_list = function(self, deltaTime) gameCooltip:AddMenu(1, function() instance:SetMode(2) end) gameCooltip:AddIcon([[Interface\AddOns\Details\images\modo_icones]], 1, 1, 20, 20, 32/256, 32/256*2, 0, 1) - gameCooltip:AddLine(Loc["STRING_MODE_ALL"]) - gameCooltip:AddMenu(1, function() instance:SetMode(3) end) - gameCooltip:AddIcon([[Interface\AddOns\Details\images\modo_icones]], 1, 1, 20, 20, 32/256*2, 32/256*3, 0, 1) + --gameCooltip:AddLine(Loc["STRING_MODE_ALL"]) + --gameCooltip:AddMenu(1, function() instance:SetMode(3) end) + --gameCooltip:AddIcon([[Interface\AddOns\Details\images\modo_icones]], 1, 1, 20, 20, 32/256*2, 32/256*3, 0, 1) gameCooltip:AddLine(Loc["STRING_OPTIONS_PLUGINS"]) gameCooltip:AddMenu(1, function() instance:SetMode(4) end) diff --git a/startup.lua b/startup.lua index b5dbbe5bd..1f0643e56 100644 --- a/startup.lua +++ b/startup.lua @@ -66,7 +66,7 @@ function Details:StartMeUp() Details.ShowDeathTooltipFunction = Details.ShowDeathTooltip if (C_CVar) then - if (not InCombatLockdown()) then --disable for releases + if (not InCombatLockdown() and DetailsFramework.IsDragonflightAndBeyond()) then --disable for releases C_CVar.SetCVar("cameraDistanceMaxZoomFactor", 2.6) end end @@ -190,6 +190,11 @@ function Details:StartMeUp() for id = 1, Details:GetNumInstances() do local instance = Details:GetInstance(id) if (instance:IsEnabled()) then + if (instance.modo == 3) then --everything + instance.LastModo = 2 --standard + instance.modo = 2 --standard + end + --refresh wallpaper if (instance.wallpaper.enabled) then instance:InstanceWallpaper(true)