From d5d34546be028abf387b9ce331e42742d2cb77a5 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sun, 15 Sep 2024 14:31:18 -0300 Subject: [PATCH] Attempt to fix the dungeon overall combat with 0.1 combat time, also fixing it getting erased on /reload --- Definitions.lua | 2 ++ boot.lua | 3 +++ classes/class_combat.lua | 40 ++++++++++++++++++++++++++++++++-------- textures.lua | 13 +++++++++++++ 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/Definitions.lua b/Definitions.lua index 06a4793b6..4eda17e4c 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -263,6 +263,8 @@ ---@field start_time gametime ---@field end_time gametime ---@field combat_counter number +---@field is_dungeon_overall boolean +---@field combat_type number ---@field is_trash boolean while in raid this is set to true if the combat isn't raid boss, in dungeon this is set to true if the combat isn't a boss or if the dungeon isn't a mythic+ ---@field is_boss bossinfo ---@field is_world_trash_combat boolean when true this combat is a regular combat done in the world, not in a dungeon, raid, battleground, arena, ... diff --git a/boot.lua b/boot.lua index 21ae2ba52..42fbaa97c 100644 --- a/boot.lua +++ b/boot.lua @@ -408,6 +408,9 @@ --finish the new combat Details:EndCombat() + + currentCombat.is_trash = false + currentCombat.is_dungeon_overall = true end Details222.DebugMsg("overall segment has been created.") diff --git a/classes/class_combat.lua b/classes/class_combat.lua index 35e6928fa..c148d4947 100644 --- a/classes/class_combat.lua +++ b/classes/class_combat.lua @@ -20,6 +20,7 @@ local detailsFramework = DetailsFramework --[[global]] DETAILS_SEGMENTTYPE_DUNGEON_TRASH = 5 --[[global]] DETAILS_SEGMENTTYPE_DUNGEON_BOSS = 6 +--[[global]] DETAILS_SEGMENTTYPE_DUNGEON_OVERALL = 9 --[[global]] DETAILS_SEGMENTTYPE_RAID_TRASH = 7 --[[global]] DETAILS_SEGMENTTYPE_RAID_BOSS = 8 @@ -45,6 +46,7 @@ local segmentTypeToString = { [DETAILS_SEGMENTTYPE_OVERALL] = "Overall", [DETAILS_SEGMENTTYPE_DUNGEON_TRASH] = "DungeonTrash", [DETAILS_SEGMENTTYPE_DUNGEON_BOSS] = "DungeonBoss", + [DETAILS_SEGMENTTYPE_DUNGEON_OVERALL] = "DungeonOverall", [DETAILS_SEGMENTTYPE_RAID_TRASH] = "RaidTrash", [DETAILS_SEGMENTTYPE_RAID_BOSS] = "RaidBoss", [DETAILS_SEGMENTTYPE_MYTHICDUNGEON] = "Category MythicDungeon", @@ -442,6 +444,9 @@ local segmentTypeToString = { elseif (combatType == DETAILS_SEGMENTTYPE_DUNGEON_BOSS) then return textureAtlas["segment-icon-skull"] + + elseif (combatType == DETAILS_SEGMENTTYPE_DUNGEON_OVERALL) then + return textureAtlas["segment-icon-dungeon-overall"] end return textureAtlas["segment-icon-regular"] @@ -528,6 +533,9 @@ local segmentTypeToString = { return bossInfo.name .." (#" .. segmentId .. ")", detailsFramework:ParseColors(bIsKill and bossKillColor or bossWipeColor) end + elseif (combatType == DETAILS_SEGMENTTYPE_DUNGEON_OVERALL) then + return self.zoneName .. " (overall)" --localize-me + elseif (combatType == DETAILS_SEGMENTTYPE_RAID_BOSS) then local bossInfo = self:GetBossInfo() if (bossInfo and bossInfo.name) then @@ -672,6 +680,10 @@ local segmentTypeToString = { end function classCombat:GetCombatType() + if (self.combat_type) then + return self.combat_type + end + --mythic dungeon local bIsMythicDungeon = self:IsMythicDungeon() if (bIsMythicDungeon) then @@ -697,18 +709,21 @@ local segmentTypeToString = { end if (self.training_dummy) then + self.combat_type = DETAILS_SEGMENTTYPE_TRAININGDUMMY return DETAILS_SEGMENTTYPE_TRAININGDUMMY end --arena local arenaInfo = self.is_arena if (arenaInfo) then + self.combat_type = DETAILS_SEGMENTTYPE_PVP_ARENA return DETAILS_SEGMENTTYPE_PVP_ARENA end --battleground local battlegroundInfo = self.is_pvp if (battlegroundInfo) then + self.combat_type = DETAILS_SEGMENTTYPE_PVP_BATTLEGROUND return DETAILS_SEGMENTTYPE_PVP_BATTLEGROUND end @@ -718,30 +733,42 @@ local segmentTypeToString = { if (instanceType == "party") then local bossInfo = self:GetBossInfo() + if (self.is_dungeon_overall) then + self.combat_type = DETAILS_SEGMENTTYPE_DUNGEON_OVERALL + return DETAILS_SEGMENTTYPE_DUNGEON_OVERALL + end + if (bossInfo) then if (bossInfo.mapid == 33 and bossInfo.diff_string == "Event" and bossInfo.id == 2879) then --Shadowfang Keep | The Crown Chemical Co. + self.combat_type = DETAILS_SEGMENTTYPE_EVENT_VALENTINEDAY return DETAILS_SEGMENTTYPE_EVENT_VALENTINEDAY else + self.combat_type = DETAILS_SEGMENTTYPE_DUNGEON_BOSS return DETAILS_SEGMENTTYPE_DUNGEON_BOSS end else + self.combat_type = DETAILS_SEGMENTTYPE_DUNGEON_TRASH return DETAILS_SEGMENTTYPE_DUNGEON_TRASH end elseif (instanceType == "raid") then local bossEncounter = self.is_boss if (bossEncounter) then + self.combat_type = DETAILS_SEGMENTTYPE_RAID_BOSS return DETAILS_SEGMENTTYPE_RAID_BOSS else + self.combat_type = DETAILS_SEGMENTTYPE_RAID_TRASH return DETAILS_SEGMENTTYPE_RAID_TRASH end end --overall data if (self == Details.tabela_overall) then + self.combat_type = DETAILS_SEGMENTTYPE_OVERALL return DETAILS_SEGMENTTYPE_OVERALL end + self.combat_type = DETAILS_SEGMENTTYPE_GENERIC return DETAILS_SEGMENTTYPE_GENERIC end @@ -967,23 +994,20 @@ local segmentTypeToString = { function classCombat:AddCombat(givingCombat, bSetStartDate, bSetEndDate) local receivingCombat = self - local timeInCombat = 0 - receivingCombat:CopyDeathsFrom(givingCombat, false) - timeInCombat = timeInCombat + givingCombat:GetCombatTime() + + local timeInCombat = receivingCombat:GetCombatTime() + givingCombat:GetCombatTime() + receivingCombat:SetStartTime(GetTime() - timeInCombat) + receivingCombat:SetEndTime(GetTime()) receivingCombat = receivingCombat + givingCombat local startDate, endDate = givingCombat:GetDate() - local startTime, endTime = givingCombat:GetStartTime(), givingCombat:GetEndTime() if (bSetStartDate) then receivingCombat:SetDate(startDate, endDate) - receivingCombat:SetStartTime(startTime) - receivingCombat:SetEndTime(endTime) else if (bSetEndDate) then - receivingCombat:SetDate(false, endDate) - receivingCombat:SetEndTime(endTime) + receivingCombat:SetDate(false, endDate) --passign false won't change the value end end diff --git a/textures.lua b/textures.lua index fcb5ad0f2..c9036367a 100644 --- a/textures.lua +++ b/textures.lua @@ -221,6 +221,19 @@ Details.TextureAtlas = { nativeHeight = 16, }, + ["segment-icon-dungeon-overall"] = { + file = [[Interface\QUESTFRAME\UI-Quest-BulletPoint]], + width = 16, + height = 16, + leftTexCoord = 0, + rightTexCoord = 1, + topTexCoord = 0, + bottomTexCoord = 1, + colorName = "MAGE", + nativeWidth = 16, + nativeHeight = 16, + }, + ["broom"] = { file = [[Interface\AddOns\Details\images\icons]], width = 44,