Added the new wipe counter for tests
This commit is contained in:
@@ -319,13 +319,88 @@ function Details:CanAddCombatToOverall(combatObject)
|
||||
return false
|
||||
end
|
||||
|
||||
---get the amount of wipes for a guilda in a specific boss and difficulty
|
||||
---@param guildName string
|
||||
---@param encounterId number
|
||||
---@param difficultyId number
|
||||
---@return number
|
||||
function Details:GetWipeCounter(guildName, encounterId, difficultyId)
|
||||
local guildWipes = Details.boss_wipe_counter[guildName]
|
||||
if (guildWipes) then
|
||||
local bossWipes = guildWipes[encounterId]
|
||||
if (bossWipes) then
|
||||
local difficultyWipes = bossWipes[difficultyId]
|
||||
if (difficultyWipes) then
|
||||
return difficultyWipes
|
||||
end
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
---count boss tries and set the value in the combat object
|
||||
---@param combatToBeAdded combat
|
||||
local setBossTryCounter = function(combatToBeAdded, segmentsTable, amountSegmentsInUse)
|
||||
---@type string
|
||||
local bossName = combatToBeAdded.is_boss and combatToBeAdded.is_boss.name
|
||||
---@type bossinfo
|
||||
local bossInfo = combatToBeAdded:GetBossInfo()
|
||||
local bossName = bossInfo and bossInfo.name
|
||||
local encounterId = bossInfo and bossInfo.id
|
||||
local bossDifficultyId = bossInfo and bossInfo.diff
|
||||
|
||||
if (bossName and encounterId and bossDifficultyId) then
|
||||
--account global
|
||||
---@type table<guildname, table<encounterid, table<encounterdifficulty, number>>>
|
||||
local bossTriesDatabase = Details.boss_wipe_counter
|
||||
|
||||
--to store a wipe 70% of the raid must be from the same guild
|
||||
--get the player guild name
|
||||
local playerGuildName = GetGuildInfo("player")
|
||||
if (playerGuildName) then
|
||||
local amountOfPlayersInGroup = GetNumGroupMembers()
|
||||
local amountOfPlayersFromGuild = 0
|
||||
|
||||
local cachedRaidUnitIds = Details222.UnitIdCache.Raid
|
||||
for i = 1, amountOfPlayersInGroup do
|
||||
local unitId = cachedRaidUnitIds[i]
|
||||
--get the guild name of the unit
|
||||
local unitGuildName = GetGuildInfo(unitId)
|
||||
if (unitGuildName and unitGuildName == playerGuildName) then
|
||||
amountOfPlayersFromGuild = amountOfPlayersFromGuild + 1
|
||||
end
|
||||
end
|
||||
|
||||
--check the 70%
|
||||
if (amountOfPlayersFromGuild / amountOfPlayersInGroup >= 0.7) then
|
||||
--check the elapsed time of the encounter is bigger than the min allowed
|
||||
if (Details.boss_wipe_min_time <= combatToBeAdded:GetCombatTime()) then
|
||||
--check if there is a table for the guild name in the database
|
||||
local guildWipes = bossTriesDatabase[playerGuildName]
|
||||
if (not guildWipes) then
|
||||
guildWipes = {}
|
||||
bossTriesDatabase[playerGuildName] = guildWipes
|
||||
end
|
||||
|
||||
--check if there is a table for the bossId in the guild table
|
||||
local bossWipes = guildWipes[encounterId]
|
||||
if (not bossWipes) then
|
||||
bossWipes = {}
|
||||
guildWipes[encounterId] = bossWipes
|
||||
end
|
||||
|
||||
--check if there's a difficulty table inside the boss wipes table
|
||||
local difficultyWipes = bossWipes[bossDifficultyId]
|
||||
if (not difficultyWipes) then
|
||||
difficultyWipes = 0
|
||||
bossWipes[bossDifficultyId] = difficultyWipes
|
||||
end
|
||||
|
||||
--increment the wipe counter
|
||||
bossWipes[bossDifficultyId] = difficultyWipes + 1
|
||||
Details:Msg("(testing) wipes on this boss with this guild in this difficulty:", bossWipes[bossDifficultyId])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (bossName) then
|
||||
local tryNumber = Details.encounter_counter[bossName]
|
||||
if (not tryNumber) then
|
||||
---@type combat
|
||||
@@ -392,7 +467,10 @@ function Details222.Combat.AddCombat(combatToBeAdded)
|
||||
end
|
||||
end
|
||||
|
||||
setBossTryCounter(combatToBeAdded, segmentsTable, amountSegmentsInUse)
|
||||
local bRunOkay, errorText = pcall(setBossTryCounter, combatToBeAdded, segmentsTable, amountSegmentsInUse)
|
||||
if (not bRunOkay) then
|
||||
Details:Msg("error > failed to set boss try counter > ", errorText)
|
||||
end
|
||||
|
||||
--shutdown actors from the previous combat from the time machine
|
||||
---@type combat
|
||||
@@ -467,6 +545,9 @@ function Details222.Combat.AddCombat(combatToBeAdded)
|
||||
end
|
||||
end
|
||||
|
||||
--is the wipe counter saved in the details database?
|
||||
--PAREI AQUI, implementar Details.segments_amount_boss_wipes e Details.segments_boss_wipes_keep_best_performance
|
||||
|
||||
--update the amount of segments in use in case a segment was removed
|
||||
amountSegmentsInUse = #segmentsTable
|
||||
|
||||
|
||||
+7
-7
@@ -1974,12 +1974,12 @@ print(1)
|
||||
local guildName = GetGuildInfo("player")
|
||||
local raidSize = GetNumGroupMembers() or 0
|
||||
|
||||
local cachedUnitIds = Details222.UnitIdCache.Raid
|
||||
local cachedRaidUnitIds = Details222.UnitIdCache.Raid
|
||||
|
||||
if (not Details222.storage.IsDebug) then
|
||||
if (guildName) then
|
||||
for i = 1, raidSize do
|
||||
local gName = GetGuildInfo(cachedUnitIds[i]) or ""
|
||||
local gName = GetGuildInfo(cachedRaidUnitIds[i]) or ""
|
||||
if (gName == guildName) then
|
||||
match = match + 1
|
||||
end
|
||||
@@ -2018,16 +2018,16 @@ print(1)
|
||||
print(6, diff)
|
||||
|
||||
for i = 1, GetNumGroupMembers() do
|
||||
local role = UnitGroupRolesAssigned(cachedUnitIds[i])
|
||||
local role = UnitGroupRolesAssigned(cachedRaidUnitIds[i])
|
||||
|
||||
if (UnitIsInMyGuild(cachedUnitIds[i])) then
|
||||
if (UnitIsInMyGuild(cachedRaidUnitIds[i])) then
|
||||
if (role == "NONE" or role == "DAMAGER" or role == "TANK") then
|
||||
local playerName = Details:GetFullName(cachedUnitIds[i])
|
||||
local playerName = Details:GetFullName(cachedRaidUnitIds[i])
|
||||
local _, _, class = Details:GetUnitClassFull(playerName)
|
||||
|
||||
local damagerActor = damageContainer:GetActor(playerName)
|
||||
if (damagerActor) then
|
||||
local guid = UnitGUID(cachedUnitIds[i])
|
||||
local guid = UnitGUID(cachedRaidUnitIds[i])
|
||||
|
||||
---@type details_storage_unitresult
|
||||
local unitResultInfo = {
|
||||
@@ -2044,7 +2044,7 @@ print(1)
|
||||
|
||||
local healingActor = healingContainer:GetActor(playerName)
|
||||
if (healingActor) then
|
||||
local guid = UnitGUID(cachedUnitIds[i])
|
||||
local guid = UnitGUID(cachedRaidUnitIds[i])
|
||||
|
||||
---@type details_storage_unitresult
|
||||
local unitResultInfo = {
|
||||
|
||||
@@ -400,51 +400,30 @@ do
|
||||
desc = Loc ["STRING_OPTIONS_SEGMENTSSAVE_DESC"],
|
||||
},
|
||||
|
||||
{type = "blank"},
|
||||
{type = "label", get = function() return "Auto Erase:" end, text_template = subSectionTitleTextTemplate},
|
||||
|
||||
{--auto erase settings | erase data
|
||||
type = "select",
|
||||
get = function() return Details.segments_auto_erase end,
|
||||
values = function()
|
||||
return buildEraseDataMenu()
|
||||
end,
|
||||
name = Loc ["STRING_OPTIONS_ED"],
|
||||
desc = Loc ["STRING_OPTIONS_ED_DESC"],
|
||||
},
|
||||
|
||||
{--auto erase trash segments
|
||||
type = "toggle",
|
||||
get = function() return Details.trash_auto_remove end,
|
||||
{--max segments on boss wipes
|
||||
type = "range",
|
||||
get = function() return Details.segments_amount_boss_wipes end,
|
||||
set = function(self, fixedparam, value)
|
||||
Details.trash_auto_remove = value
|
||||
Details.segments_amount_boss_wipes = value
|
||||
afterUpdate()
|
||||
end,
|
||||
name = Loc ["STRING_OPTIONS_CLEANUP"],
|
||||
desc = Loc ["STRING_OPTIONS_CLEANUP_DESC"],
|
||||
boxfirst = true,
|
||||
min = 1,
|
||||
max = 40,
|
||||
step = 1,
|
||||
name = "Segments Boss Wipe",
|
||||
desc = "Amount of segments to keep for wipes on the same boss.",
|
||||
hidden = true,
|
||||
},
|
||||
{--auto erase world segments
|
||||
{--wipe segments keep the best segments and delete the worst ones
|
||||
type = "toggle",
|
||||
get = function() return Details.world_combat_is_trash end,
|
||||
get = function() return Details.segments_boss_wipes_keep_best_performance end,
|
||||
set = function(self, fixedparam, value)
|
||||
Details.world_combat_is_trash = value
|
||||
afterUpdate()
|
||||
Details.segments_boss_wipes_keep_best_performance = value
|
||||
end,
|
||||
name = Loc ["STRING_OPTIONS_PERFORMANCE_ERASEWORLD"],
|
||||
desc = Loc ["STRING_OPTIONS_PERFORMANCE_ERASEWORLD_DESC"],
|
||||
boxfirst = true,
|
||||
},
|
||||
{--erase chart data
|
||||
type = "toggle",
|
||||
get = function() return Details.clear_graphic end,
|
||||
set = function(self, fixedparam, value)
|
||||
Details.clear_graphic = value
|
||||
afterUpdate()
|
||||
end,
|
||||
name = Loc ["STRING_OPTIONS_ERASECHARTDATA"],
|
||||
desc = Loc ["STRING_OPTIONS_ERASECHARTDATA_DESC"],
|
||||
name = "Keep Best Performance (boss wipes)",
|
||||
desc = "Keep the segments with more progress in the boss health and delete the ones with less progress.",
|
||||
boxfirst = true,
|
||||
hidden = true,
|
||||
},
|
||||
|
||||
{type = "breakline"},
|
||||
@@ -685,6 +664,53 @@ do
|
||||
boxfirst = true,
|
||||
},
|
||||
|
||||
{type = "blank"},
|
||||
{type = "label", get = function() return "Auto Erase:" end, text_template = subSectionTitleTextTemplate},
|
||||
|
||||
{--auto erase settings | erase data
|
||||
type = "select",
|
||||
get = function() return Details.segments_auto_erase end,
|
||||
values = function()
|
||||
return buildEraseDataMenu()
|
||||
end,
|
||||
name = Loc ["STRING_OPTIONS_ED"],
|
||||
desc = Loc ["STRING_OPTIONS_ED_DESC"],
|
||||
},
|
||||
|
||||
{--auto erase trash segments
|
||||
type = "toggle",
|
||||
get = function() return Details.trash_auto_remove end,
|
||||
set = function(self, fixedparam, value)
|
||||
Details.trash_auto_remove = value
|
||||
afterUpdate()
|
||||
end,
|
||||
name = Loc ["STRING_OPTIONS_CLEANUP"],
|
||||
desc = Loc ["STRING_OPTIONS_CLEANUP_DESC"],
|
||||
boxfirst = true,
|
||||
},
|
||||
{--auto erase world segments
|
||||
type = "toggle",
|
||||
get = function() return Details.world_combat_is_trash end,
|
||||
set = function(self, fixedparam, value)
|
||||
Details.world_combat_is_trash = value
|
||||
afterUpdate()
|
||||
end,
|
||||
name = Loc ["STRING_OPTIONS_PERFORMANCE_ERASEWORLD"],
|
||||
desc = Loc ["STRING_OPTIONS_PERFORMANCE_ERASEWORLD_DESC"],
|
||||
boxfirst = true,
|
||||
},
|
||||
{--erase chart data
|
||||
type = "toggle",
|
||||
get = function() return Details.clear_graphic end,
|
||||
set = function(self, fixedparam, value)
|
||||
Details.clear_graphic = value
|
||||
afterUpdate()
|
||||
end,
|
||||
name = Loc ["STRING_OPTIONS_ERASECHARTDATA"],
|
||||
desc = Loc ["STRING_OPTIONS_ERASECHARTDATA_DESC"],
|
||||
boxfirst = true,
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
sectionFrame.sectionOptions = sectionOptions
|
||||
|
||||
@@ -699,6 +699,10 @@ local default_profile = {
|
||||
--segments
|
||||
segments_amount = 25,
|
||||
segments_amount_to_save = 15,
|
||||
--max amount of boss wipes allowed
|
||||
segments_amount_boss_wipes = 10,
|
||||
--should boss wipes delete segments with less progression?
|
||||
segments_boss_wipes_keep_best_performance = true,
|
||||
segments_panic_mode = false,
|
||||
segments_auto_erase = 1,
|
||||
|
||||
@@ -1206,6 +1210,9 @@ local default_global_data = {
|
||||
position = {},
|
||||
},
|
||||
|
||||
boss_wipe_counter = {},
|
||||
boss_wipe_min_time = 20, --minimum time to consider a wipe as a boss wipe
|
||||
|
||||
user_is_patreon_supporter = false,
|
||||
|
||||
show_warning_id1 = true,
|
||||
@@ -1852,6 +1859,10 @@ function Details:ImportProfile (profileString, newProfileName, bImportAutoRunCod
|
||||
--make the max amount of segments be 25
|
||||
Details.segments_amount = 25
|
||||
Details.segments_amount_to_save = 15
|
||||
--max amount of boss wipes allowed
|
||||
Details.segments_amount_boss_wipes = 10
|
||||
--should boss wipes delete segments with less progression?
|
||||
Details.segments_boss_wipes_keep_best_performance = true
|
||||
|
||||
--transfer instance data to the new created profile
|
||||
profileObject.instances = DetailsFramework.table.copy({}, profileData.instances)
|
||||
|
||||
Reference in New Issue
Block a user