More storage development

This commit is contained in:
Tercio Jose
2024-07-11 01:16:18 -03:00
committed by andrew6180
parent cbc9022cd5
commit 5d45539caa
8 changed files with 53 additions and 40 deletions
+3 -1
View File
@@ -105,7 +105,9 @@
---@diagnostic disable-next-line: missing-fields
local storage = {
DiffNames = {"normal", "heroic", "mythic", "ascended"},
DiffNamesHash = {normal = 1, heroic = 2, mythic = 3, ascended = 4},
DiffNamesHash = {normal = 14, heroic = 2, mythic = 3, ascended = 4,},
DiffIdToName = {[1] = "normal", [2] = "heroic", [3] = "mythic", [4] = "ascended"},
IsDebug = false
}
Details222.storage = storage
+1 -8
View File
@@ -177,18 +177,11 @@ local segmentTypeToString = {
return rawget(self, "is_trash")
end
local diffNumberToName = {
[0] = "normal",
[1] = "heroic",
[2] = "mythic",
[3] = "ascended",
}
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
+2
View File
@@ -44,6 +44,8 @@
--show more information about spells
local debugmode = false
local GetSpellTexture = GetSpellTexture or C_Spell.GetSpellTexture
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--constants
+18 -21
View File
@@ -861,7 +861,7 @@ end)
---@field totalkills table<string, table<encounterid, details_bosskillinfo>>
---@class details_storage_feature : table
---@field diffNames string[] {"normal", "heroic", "mythic"}
---@field diffNames string[] {"normal", "heroic", "mythic", "ascended"}
---@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,12 +871,7 @@ end)
local CONST_ADDONNAME_DATASTORAGE = "Details_DataStorage"
local diffNumberToName = {
[0] = "normal",
[1] = "heroic",
[2] = "mythic",
[3] = "ascended",
}
local diffNumberToName = Details222.storage.DiffIdToName
local createStorageTables = function()
local storageDatabase = DetailsDataStorage
@@ -1787,9 +1782,9 @@ function Details.Database.StoreWipe(combat)
local _, _, _, _, _, _, _, mapID = 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
@@ -1836,14 +1831,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.")
@@ -1853,13 +1844,15 @@ function Details.Database.StoreEncounter(combat)
local _, _, _, _, _, _, _, mapID = 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
@@ -1879,7 +1872,7 @@ function Details.Database.StoreEncounter(combat)
if (not savedData) then
return
end
print(3)
--[=[
savedData[mythic] = {
[encounterId] = { --indexed table
@@ -1935,7 +1928,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
@@ -1972,9 +1965,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")
@@ -1982,7 +1975,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 ""
@@ -2021,6 +2014,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])
@@ -2062,6 +2057,8 @@ function Details.Database.StoreEncounter(combat)
end
end
print(7, diff)
--add the encounter data
tinsert(allEncountersStored, combatResultData)
if (Details.debug) then
+1 -6
View File
@@ -394,12 +394,7 @@
--this block won't execute if the storage isn't loaded
--self is a timer reference from C_Timer
local diffNumberToName = {
[0] = "normal",
[1] = "heroic",
[2] = "mythic",
[3] = "ascended",
}
local diffNumberToName = Details222.storage.DiffIdToName
local encounterID = self.Boss
local diff = self.Diff
+19
View File
@@ -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
+3 -3
View File
@@ -5966,9 +5966,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)
+5
View File
@@ -182,6 +182,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)