From a8d87332747ce5aca5c5b89905f9c17d11569f8b Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Thu, 29 Feb 2024 23:59:33 -0300 Subject: [PATCH] Another round of bug fixes --- API.lua | 4 +- API.txt | 3 - Definitions.lua | 60 +++--- boot.lua | 2 +- classes/class_combat.lua | 96 +++++----- core/control.lua | 21 ++- core/meta.lua | 2 +- frames/window_main.lua | 212 +++++++++------------- functions/mythicdungeon/mythicdungeon.lua | 21 ++- functions/mythicdungeon/segments.lua | 17 +- textures.lua | 2 +- 11 files changed, 217 insertions(+), 223 deletions(-) diff --git a/API.lua b/API.lua index 7f4e46098..9f73657d2 100644 --- a/API.lua +++ b/API.lua @@ -153,6 +153,7 @@ DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH = 11 DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL = 12 DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASHOVERALL = 13 DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS = 14 +DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSTRASH = 15 DETAILS_SEGMENTTYPE_PVP_ARENA = 20 DETAILS_SEGMENTTYPE_PVP_BATTLEGROUND = 21 @@ -242,9 +243,6 @@ total = combat:GetTotal ( attribute, subAttribute [, onlyGroup] ) mythictInfo = combat:GetMythicDungeonInfo() @COMMENTreturns a table with information about the mythic dungeon encounter.@ -mythicTrashInfo = combat:GetMythicDungeonTrashInfo() -@COMMENTreturns a table with information about the trash cleanup for this combat.@ - isMythicDungeonSegment = combat:IsMythicDungeon() @COMMENTreturns if the segment is from a mythic dungeon.@ diff --git a/API.txt b/API.txt index 2d56cd981..e13921928 100644 --- a/API.txt +++ b/API.txt @@ -203,9 +203,6 @@ returns the total of the requested attribute. mythictInfo = combat:GetMythicDungeonInfo() returns a table with information about the mythic dungeon encounter. -mythicTrashInfo = combat:GetMythicDungeonTrashInfo() -returns a table with information about the trash cleanup for this combat. - isMythicDungeonSegment = combat:IsMythicDungeon() returns if the segment is from a mythic dungeon. diff --git a/Definitions.lua b/Definitions.lua index ebbefb846..bf4ce1833 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -58,34 +58,36 @@ ---@field EJID number ---@class mythicdungeoninfo ----@field StartedAt number ----@field EndedAt number ----@field WorldStateTimerStart number ----@field WorldStateTimerEnd number ----@field RunTime number ----@field TimeInCombat number ----@field SegmentID string ----@field RunID number ----@field OverallSegment boolean ----@field ZoneName string ----@field EJID number ----@field MapID number ----@field Level number ----@field OnTime boolean ----@field KeystoneUpgradeLevels number ----@field PracticeRun boolean ----@field OldDungeonScore number ----@field NewDungeonScore number ----@field IsAffixRecord boolean ----@field IsMapRecord boolean ----@field PrimaryAffix number ----@field IsEligibleForScore boolean ----@field UpgradeMembers table ----@field TimeLimit number ----@field DungeonName string ----@field DungeonID number ----@field DungeonTexture string ----@field DungeonBackgroundTexture string|number +---@field StartedAt number? +---@field EndedAt number? +---@field WorldStateTimerStart number? +---@field WorldStateTimerEnd number? +---@field RunTime number? +---@field TimeInCombat number? +---@field SegmentID string? +---@field RunID number? +---@field OverallSegment boolean? +---@field ZoneName string? +---@field EJID number? +---@field MapID number? +---@field Level number? +---@field OnTime boolean? +---@field KeystoneUpgradeLevels number? +---@field PracticeRun boolean? +---@field OldDungeonScore number? +---@field NewDungeonScore number? +---@field IsAffixRecord boolean? +---@field IsMapRecord boolean? +---@field PrimaryAffix number? +---@field IsEligibleForScore boolean? +---@field UpgradeMembers table? +---@field TimeLimit number? +---@field DungeonName string? +---@field DungeonID number? +---@field DungeonTexture string? +---@field DungeonBackgroundTexture string|number? +---@field SegmentType number? +---@field SegmentName string? ---@alias containertype number this container type is the number used to identify the actorcontainer type when using combat:GetContainer(containertype), can be 1, 2, 3, or 4. @@ -236,7 +238,7 @@ ---@field raid_roster table [unitName] = unitGUID ---@field overall_added boolean is true when the combat got added into the overall combat ---@field is_mythic_dungeon mythicdungeoninfo ----@field is_mythic_dungeon_trash mythicdungeontrashinfo +---@field is_mythic_dungeon_trash boolean ---@field is_mythic_dungeon_run_id number ---@field is_mythic_dungeon_segment boolean ---@field trinketProcs table> diff --git a/boot.lua b/boot.lua index 2f3f2e30c..2f4d34730 100644 --- a/boot.lua +++ b/boot.lua @@ -23,7 +23,7 @@ Details.dont_open_news = true Details.game_version = version Details.userversion = version .. " " .. Details.build_counter - Details.realversion = 155 --core version, this is used to check API version for scripts and plugins (see alias below) + Details.realversion = 156 --core version, this is used to check API version for scripts and plugins (see alias below) Details.APIVersion = Details.realversion --core version Details.version = Details.userversion .. " (core " .. Details.realversion .. ")" --simple stirng to show to players diff --git a/classes/class_combat.lua b/classes/class_combat.lua index 054f2ea41..3740a26fc 100644 --- a/classes/class_combat.lua +++ b/classes/class_combat.lua @@ -30,6 +30,8 @@ local detailsFramework = DetailsFramework --[[global]] DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL = 12 --[[global]] DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASHOVERALL = 13 --not in use at the moment --[[global]] DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS = 14 +--[[global]] DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSTRASH = 15 +--[[global]] DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSWIPE = 16 --[[global]] DETAILS_SEGMENTTYPE_PVP_ARENA = 20 --[[global]] DETAILS_SEGMENTTYPE_PVP_BATTLEGROUND = 21 @@ -204,7 +206,7 @@ local segmentTypeToString = { ---@return boolean ---@return number function classCombat:IsMythicDungeon() - local bIsMythicPlusSegment = self.is_mythic_dungeon_segment + local bIsMythicPlusSegment = self.is_mythic_dungeon_segment and self:GetMythicDungeonInfo() local runId = self.is_mythic_dungeon_run_id return bIsMythicPlusSegment, runId end @@ -383,8 +385,11 @@ local segmentTypeToString = { elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL or combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON) then return textureAtlas["segment-icon-mythicplus"] - --elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASHOVERALL) then - -- return textureAtlas["segment-icon-mythicplus"] + elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSTRASH) then + return textureAtlas["segment-icon-mythicplus"] + + elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSWIPE) then + return textureAtlas["segment-icon-mythicplus"] elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS) then return textureAtlas["segment-icon-mythicplus"] @@ -422,6 +427,7 @@ local segmentTypeToString = { local bossKillColor = "lime" local bossWipeColor = "red" local mythicDungeonBossColor = {170/255, 167/255, 255/255, 1} + local mythicDungeonBossWipeColor = {0.803922, 0.360784, 0.360784, 1} local mythicDungeonBossColor2 = {210/255, 200/255, 255/255, 1} function classCombat:GetCombatName(bOnlyName, bTryFind) @@ -440,27 +446,40 @@ local segmentTypeToString = { local mythicDungeonInfo = self:GetMythicDungeonInfo() local isMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = Details:UnpackMythicDungeonInfo(mythicDungeonInfo) - --print("mythic combat type", combatType, self.combat_id) - if (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then - local overallIconString = detailsFramework:CreateAtlasString(Details.TextureAtlas["segment-icon-mythicplus-overall"]) - local combatName = zoneName .. " +" .. mythicLevel if (bOnlyName) then - return combatName, unpack(partyColor) + return mythicDungeonInfo.SegmentName, unpack(partyColor) else - return overallIconString .. zoneName .. " +" .. mythicLevel .. " (" .. Loc["STRING_SEGMENTS_LIST_OVERALL"] .. ")", unpack(partyColor) + local overallIconString = detailsFramework:CreateAtlasString(Details.TextureAtlas["segment-icon-mythicplus-overall"]) + return overallIconString .. mythicDungeonInfo.SegmentName .. " (" .. Loc["STRING_SEGMENTS_LIST_OVERALL"] .. ")", unpack(partyColor) end + end + + if (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH) then --"Trash #" .. (Details.MythicPlus.SegmentID or 0) + return mythicDungeonInfo.SegmentName + end + + if (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS) then + return mythicDungeonInfo.SegmentName, detailsFramework:ParseColors(mythicDungeonBossColor) + end - --elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASHOVERALL) then - -- local trashIconString = detailsFramework:CreateAtlasString(Details.TextureAtlas["segment-icon-broom"]) - -- return trashIconString .. zoneName .. " +" .. mythicLevel .. " (" .. Loc["STRING_SEGMENT_TRASH"] .. ")" + if (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSWIPE) then + return mythicDungeonInfo.SegmentName, detailsFramework:ParseColors(mythicDungeonBossWipeColor) + end - elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH) then - return (encounterName or Loc["STRING_UNKNOW"]) .. " (" .. string.lower(Loc["STRING_SEGMENTS_LIST_TRASH"]) .. ")" + if (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSTRASH) then + return mythicDungeonInfo.SegmentName, unpack(partyColor) + end - elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS) then - return (encounterName or Loc["STRING_UNKNOW"]) .. " (" .. string.lower(_G["BOSS"]) .. ")", detailsFramework:ParseColors(mythicDungeonBossColor) + if (mythicDungeonInfo.SegmentName) then + if (bOnlyName) then + return mythicDungeonInfo.SegmentName, unpack(partyColor) + else + return mythicDungeonInfo.SegmentName .. " +" .. mythicLevel, unpack(partyColor) + end end + + return "--x--x--" end if (combatType == DETAILS_SEGMENTTYPE_PVP_BATTLEGROUND) then @@ -529,39 +548,30 @@ local segmentTypeToString = { --mythic dungeon local bIsMythicDungeon = self:IsMythicDungeon() if (bIsMythicDungeon) then - --check for for regular trash mythic plus segment for a quick exit - local mythicDungeonTrachInfo = self:GetMythicDungeonTrashInfo() - if (mythicDungeonTrachInfo) then - return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH, DETAILS_SEGMENTTYPE_MYTHICDUNGEON - end - local mythicDungeonInfo = self:GetMythicDungeonInfo() - local bIsMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = Details:UnpackMythicDungeonInfo(mythicDungeonInfo) - if (bIsMythicOverallSegment) then - return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL, DETAILS_SEGMENTTYPE_MYTHICDUNGEON + if (not mythicDungeonInfo) then + print("sem mythicDungeonInfo") + return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH, DETAILS_SEGMENTTYPE_MYTHICDUNGEON end - --self.is_mythic_dungeon_trash only exists if the segment isn't a boss trash overall - local isMythicDungeonTrash = self.is_mythic_dungeon_trash - if (segmentID == "trashoverall" and encounterName) then + if (mythicDungeonInfo.SegmentType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH) then return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH, DETAILS_SEGMENTTYPE_MYTHICDUNGEON - end - --if (segmentID == "trashoverall") then --overall trash for the whole dungeon doesn't exists anymore - -- return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASHOVERALL, DETAILS_SEGMENTTYPE_MYTHICDUNGEON - --end + elseif (mythicDungeonInfo.SegmentType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then + return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL, DETAILS_SEGMENTTYPE_MYTHICDUNGEON - local bossEncounter = self.is_boss - if (bossEncounter) then + elseif (mythicDungeonInfo.SegmentType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS) then return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS, DETAILS_SEGMENTTYPE_MYTHICDUNGEON + + elseif (mythicDungeonInfo.SegmentType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSWIPE) then + return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSWIPE, DETAILS_SEGMENTTYPE_MYTHICDUNGEON + + elseif (mythicDungeonInfo.SegmentType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSTRASH) then + return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSTRASH, DETAILS_SEGMENTTYPE_MYTHICDUNGEON end return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_GENERIC, DETAILS_SEGMENTTYPE_MYTHICDUNGEON - else - --local mythicDungeonInfo = self:GetMythicDungeonInfo() - --local bIsMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = Details:UnpackMythicDungeonInfo(mythicDungeonInfo) - --segmentID == "trashoverall" end --arena @@ -725,6 +735,11 @@ local segmentTypeToString = { self.end_time = thisTime end + function classCombat:seta_tempo_decorrido() --deprecated march 2024 + --self.end_time = _tempo + self.end_time = GetTime() + end + ---Return how many attempts were made for this boss ---@return number|nil function classCombat:GetTryNumber() @@ -1107,11 +1122,6 @@ end end end - function classCombat:seta_tempo_decorrido() - --self.end_time = _tempo - self.end_time = GetTime() - end - ---set combat metatable and class lookup ---@self any ---@param combatObject combat diff --git a/core/control.lua b/core/control.lua index 7aad7312c..c71bbdc03 100644 --- a/core/control.lua +++ b/core/control.lua @@ -552,7 +552,7 @@ local bSetStartTime = false local bSetEndTime = true currentCombat:SetDateToNow(bSetStartTime, bSetEndTime) - currentCombat:seta_tempo_decorrido() + currentCombat:SetEndTime(GetTime()) --drop last events table to garbage collector currentCombat.player_last_events = {} @@ -621,14 +621,23 @@ --is inside a mythic+ dungeon and this is not a boss segment, so tag it as a dungeon mythic+ trash segment local zoneName, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo() - ---@type mythicdungeontrashinfo - local mythicPlusTrashInfo = { - ZoneName = zoneName, - MapID = instanceMapID, + ---@type mythicdungeoninfo + local mythicPlusInfo = { + ZoneName = Details.MythicPlus.DungeonName or zoneName, + MapID = Details.MythicPlus.DungeonID or instanceMapID, Level = Details.MythicPlus.Level, EJID = Details.MythicPlus.ejID, + RunID = Details.mythic_dungeon_id, + StartedAt = time() - currentCombat:GetCombatTime(), + EndedAt = time(), + SegmentID = Details.MythicPlus.SegmentID, --segment number within the dungeon + OverallSegment = false, + SegmentType = DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH, + SegmentName = "Trash #" .. (Details.MythicPlus.SegmentID or 0), --localize-me } - currentCombat.is_mythic_dungeon_trash = mythicPlusTrashInfo + currentCombat.is_mythic_dungeon = mythicPlusInfo + + currentCombat.is_mythic_dungeon_trash = true if (Details.debug) then Details:Msg("segment tagged as mythic+ trash.") diff --git a/core/meta.lua b/core/meta.lua index c4c96c8f9..060db5be6 100644 --- a/core/meta.lua +++ b/core/meta.lua @@ -746,7 +746,7 @@ local classTypeUtility = Details.atributos.misc local amountCleaned = 0 --do not collect things in a mythic+ dungeon segment - if (combatObject.is_mythic_dungeon_trash or combatObject.is_mythic_dungeon_run_id or combatObject.is_mythic_dungeon_segment) then + if (combatObject.is_mythic_dungeon_run_id or combatObject.is_mythic_dungeon_segment) then return amountCleaned end diff --git a/frames/window_main.lua b/frames/window_main.lua index 19f89ad86..05ce00d6f 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -6403,11 +6403,11 @@ local buildSegmentTooltip = function(self, deltaTime) end local mythicDungeonInfo = thisCombat:GetMythicDungeonInfo() - local mythicDungeonTrashInfo = thisCombat:GetMythicDungeonTrashInfo() + local isMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = Details:UnpackMythicDungeonInfo(mythicDungeonInfo) - if (mythicDungeonTrashInfo) then - --the combat has mythic dungeon tag but doesn't have a mythic dungeon table information - --so this is a trash cleanup segment + --if is bIsMythicDungeon but no mythicDungeonInfo, it will show as M+ 'Trash Cleanup' + --is a boss, trash overall or run overall segment + if (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH or combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSTRASH) then gameCooltip:AddLine(thisCombat:GetCombatName(), detailsFramework:IntegerToTimer(thisCombat:GetCombatTime()), 1, dungeonColorTrash, "gray") gameCooltip:AddIcon(thisCombat:GetCombatIcon(), "main", "left", nil, nil, nil, nil, nil, nil, nil, nil, true) @@ -6418,139 +6418,111 @@ local buildSegmentTooltip = function(self, deltaTime) gameCooltip:AddLine(Loc["STRING_SEGMENT_START"] .. ":", thisCombat:GetDate(), 2, "white", "white") gameCooltip:AddLine(Loc["STRING_SEGMENT_END"] .. ":", dateEnd or "in progress", 2, "white", "white") - if (mythicDungeonTrashInfo) then - local backgroundImage = Details:GetRaidIcon(mythicDungeonTrashInfo.MapID, mythicDungeonTrashInfo.EJID, "party") - if (backgroundImage and bCanUseBackgroundImage) then - gameCooltip:SetWallpaper(2, backgroundImage, {0.070, 0.695, 0.087, 0.566}, {1, 1, 1, 0.5}, true) - end + local backgroundImage = Details:GetRaidIcon(mapID, EJID, "party") + if (backgroundImage and bCanUseBackgroundImage) then + gameCooltip:SetWallpaper(2, backgroundImage, {0.070, 0.695, 0.087, 0.566}, {1, 1, 1, 0.5}, true) end - else - local isMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = Details:UnpackMythicDungeonInfo(mythicDungeonInfo) - - --if is bIsMythicDungeon but no mythicDungeonInfo, it will show as M+ 'Trash Cleanup' - --is a boss, trash overall or run overall segment - if (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH) then - --this code is repeated because GetMythic_DungeonInfo() doesn't return trash information and would crash if called on a trash segment - --the combat has mythic dungeon tag but doesn't have a mythic dungeon table information - --so this is a trash cleanup segment - local trashInfo = thisCombat:GetMythicDungeonTrashInfo() - gameCooltip:AddLine(thisCombat:GetCombatName(), detailsFramework:IntegerToTimer(thisCombat:GetCombatTime()), 1, dungeonColorTrash, "gray") - gameCooltip:AddIcon(thisCombat:GetCombatIcon(), "main", "left", nil, nil, nil, nil, nil, nil, nil, nil, true) - - --submenu - gameCooltip:AddLine(Loc["STRING_SEGMENT_TRASH"], nil, 2, "white", "white") - gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_COMBATTIME"] .. ":", detailsFramework:IntegerToTimer(thisCombat:GetCombatTime()), 2, "white", "white") - gameCooltip:AddLine("", "", 2, "white", "white") - gameCooltip:AddLine(Loc["STRING_SEGMENT_START"] .. ":", thisCombat:GetDate(), 2, "white", "white") - gameCooltip:AddLine(Loc["STRING_SEGMENT_END"] .. ":", dateEnd or "in progress", 2, "white", "white") - if (trashInfo) then - local backgroundImage = Details:GetRaidIcon(trashInfo.MapID, trashInfo.EJID, "party") - if (backgroundImage and bCanUseBackgroundImage) then - gameCooltip:SetWallpaper(2, backgroundImage, {0.070, 0.695, 0.087, 0.566}, {1, 1, 1, 0.5}, true) - end - end + elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then + gameCooltip:AddLine(thisCombat:GetCombatName(), detailsFramework:IntegerToTimer(endedAt - startedAt), 1, dungeonColor) + gameCooltip:AddIcon(thisCombat:GetCombatIcon(), "main", "left") + gameCooltip:AddStatusBar(100, 1, .5, .1, 0, 0.55, false, false, statusBarTexture) + --submenu + gameCooltip:AddLine(zoneName .. " +" .. mythicLevel .. " (" .. Loc["STRING_SEGMENTS_LIST_OVERALL"] .. ")", nil, 2, "white", "white") + gameCooltip:AddStatusBar(100, 2, 0, 0, 0, 0.85, false, false, statusBarTexture) - elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then - gameCooltip:AddLine(thisCombat:GetCombatName(), detailsFramework:IntegerToTimer(endedAt - startedAt), 1, dungeonColor) - gameCooltip:AddIcon(thisCombat:GetCombatIcon(), "main", "left") - gameCooltip:AddStatusBar(100, 1, .5, .1, 0, 0.55, false, false, statusBarTexture) - --submenu - gameCooltip:AddLine(zoneName .. " +" .. mythicLevel .. " (" .. Loc["STRING_SEGMENTS_LIST_OVERALL"] .. ")", nil, 2, "white", "white") - gameCooltip:AddStatusBar(100, 2, 0, 0, 0, 0.85, false, false, statusBarTexture) - - elseif (DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS) then - local addIconAndStatusBar = function(redTint) - gameCooltip:AddIcon(Details:GetTextureAtlas("segment-icon-empty"), 2, 1) - gameCooltip:AddStatusBar(100, 2, redTint or 0, 0, 0, 0.85, false, false, statusBarTexture) - end + elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS or combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSWIPE) then + local addIconAndStatusBar = function(redTint) + gameCooltip:AddIcon(Details:GetTextureAtlas("segment-icon-empty"), 2, 1) + gameCooltip:AddStatusBar(100, 2, redTint or 0, 0, 0, 0.85, false, false, statusBarTexture) + end - local skull = "|TInterface\\AddOns\\Details\\images\\icons:16:16:0:0:512:512:496:512:0:16|t" + local skull = "|TInterface\\AddOns\\Details\\images\\icons:16:16:0:0:512:512:496:512:0:16|t" - gameCooltip:AddLine(skull .. "" .. thisCombat:GetCombatName(), detailsFramework:IntegerToTimer(elapsedCombatTime), 1, dungeonColor, "gray") - gameCooltip:AddIcon(thisCombat:GetCombatIcon(), "main", "left") - addIconAndStatusBar() + local combatName, combatColor = thisCombat:GetCombatName() + gameCooltip:AddLine(skull .. "" .. combatName, detailsFramework:IntegerToTimer(elapsedCombatTime), 1, combatColor, "gray") + gameCooltip:AddIcon(thisCombat:GetCombatIcon(), "main", "left") + addIconAndStatusBar() - gameCooltip:AddLine(thisCombat:GetCombatName(), nil, 2, "white", "white") - addIconAndStatusBar() + gameCooltip:AddLine(thisCombat:GetCombatName(), nil, 2, "white", "white") + addIconAndStatusBar() - do - local avatarPoint = {"bottomleft", "topleft", -3, -4} - local backgroundPoint = {{"bottomleft", "topleft", 0, -3}, {"bottomright", "topright", 0, -3}} - local textPoint = {"left", "right", -11, -5} - local avatarTexCoord = {0, 1, 0, 1} - local backgroundColor = {0, 0, 0, 0.6} - local avatarTextColor = {1, 1, 1, 1} + do + local avatarPoint = {"bottomleft", "topleft", -3, -4} + local backgroundPoint = {{"bottomleft", "topleft", 0, -3}, {"bottomright", "topright", 0, -3}} + local textPoint = {"left", "right", -11, -5} + local avatarTexCoord = {0, 1, 0, 1} + local backgroundColor = {0, 0, 0, 0.6} + local avatarTextColor = {1, 1, 1, 1} - --gameCooltip:SetBannerImage(2, 1, avatar [2], 80, 40, avatarPoint, avatarTexCoord, nil) --overlay [2] avatar path - local anchor = {"bottom", "top", 0, 0} + --gameCooltip:SetBannerImage(2, 1, avatar [2], 80, 40, avatarPoint, avatarTexCoord, nil) --overlay [2] avatar path + local anchor = {"bottom", "top", 0, 0} - --these need to be per line, current are per frame - --gameCooltip:SetBannerImage(2, 2, [[Interface\PetBattles\Weather-Windy]], 200, 55, anchor, {1, 0.129609375, 1, 0}) - --gameCooltip:SetBannerText(2, 2, encounterName, textPoint, avatarTextColor, 14, SharedMedia:Fetch("font", Details.tooltip.fontface)) - end - - local instanceData - if (thisCombat.is_boss) then - instanceData = Details222.EJCache.GetInstanceData(thisCombat.is_boss.zone, thisCombat.is_boss.ej_instance_id, thisCombat.is_boss.id, thisCombat.is_boss.mapid) - end + --these need to be per line, current are per frame + --gameCooltip:SetBannerImage(2, 2, [[Interface\PetBattles\Weather-Windy]], 200, 55, anchor, {1, 0.129609375, 1, 0}) + --gameCooltip:SetBannerText(2, 2, encounterName, textPoint, avatarTextColor, 14, SharedMedia:Fetch("font", Details.tooltip.fontface)) + end - if (instanceData) then - local encounterData = Details222.EJCache.GetEncounterDataFromInstanceData(instanceData, thisCombat.is_boss.encounter, thisCombat.is_boss.name, thisCombat.is_boss.id) - if (encounterData) then - gameCooltip:AddIcon(encounterData.creatureIcon, 2, "top", 128, 64, 0, 1, 0, 0.96) - end - end + local instanceData + if (thisCombat.is_boss) then + instanceData = Details222.EJCache.GetInstanceData(thisCombat.is_boss.zone, thisCombat.is_boss.ej_instance_id, thisCombat.is_boss.id, thisCombat.is_boss.mapid) + end - local backgroundImage = Details:GetRaidIcon(mapID, EJID, "party") - if (backgroundImage and bCanUseBackgroundImage) then - gameCooltip:SetWallpaper(2, backgroundImage, {0.070, 0.695, 0.087, 0.566}, {1, 1, 1, 0.5}, true) + if (instanceData) then + local encounterData = Details222.EJCache.GetEncounterDataFromInstanceData(instanceData, thisCombat.is_boss.encounter, thisCombat.is_boss.name, thisCombat.is_boss.id) + if (encounterData) then + gameCooltip:AddIcon(encounterData.creatureIcon, 2, "top", 128, 64, 0, 1, 0, 0.96) end + end - --sub menu - local timeInCombat = thisCombat:GetCombatTime() - - if (segmentID == "trashoverall") then - gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TIMEINCOMBAT"] .. ":", detailsFramework:IntegerToTimer(timeInCombat), 2, "white", "white") - addIconAndStatusBar() - local totalRealTime = endedAt - startedAt - local wasted = totalRealTime - timeInCombat + local backgroundImage = Details:GetRaidIcon(mapID, EJID, "party") + if (backgroundImage and bCanUseBackgroundImage) then + gameCooltip:SetWallpaper(2, backgroundImage, {0.070, 0.695, 0.087, 0.566}, {1, 1, 1, 0.5}, true) + end - --wasted time - gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_WASTED_TIME"] .. ":", "|cFFFF3300" .. detailsFramework:IntegerToTimer(wasted) .. " (" .. floor(wasted / totalRealTime * 100) .. "%)|r", 2, "white", "white") - addIconAndStatusBar(0.15) - gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TOTALTIME"] .. ":", detailsFramework:IntegerToTimer(endedAt - startedAt), 2, "white", "white") - addIconAndStatusBar() + --sub menu + local timeInCombat = thisCombat:GetCombatTime() - elseif (isMythicOverallSegment) then - gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TIMEINCOMBAT"] .. ":", detailsFramework:IntegerToTimer(timeInCombat), 2, "white", "white") - addIconAndStatusBar() + if (segmentID == "trashoverall") then + gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TIMEINCOMBAT"] .. ":", detailsFramework:IntegerToTimer(timeInCombat), 2, "white", "white") + addIconAndStatusBar() + local totalRealTime = endedAt - startedAt + local wasted = totalRealTime - timeInCombat - local totalRealTime = thisCombat:GetRunTimeNoDefault() or (endedAt - startedAt) - local notInCombatTime = totalRealTime - timeInCombat + --wasted time + gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_WASTED_TIME"] .. ":", "|cFFFF3300" .. detailsFramework:IntegerToTimer(wasted) .. " (" .. floor(wasted / totalRealTime * 100) .. "%)|r", 2, "white", "white") + addIconAndStatusBar(0.15) + gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TOTALTIME"] .. ":", detailsFramework:IntegerToTimer(endedAt - startedAt), 2, "white", "white") + addIconAndStatusBar() - gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TOTALTIME"] .. ":", detailsFramework:IntegerToTimer(totalRealTime), 2, "white", "white") - addIconAndStatusBar() + elseif (isMythicOverallSegment) then + gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TIMEINCOMBAT"] .. ":", detailsFramework:IntegerToTimer(timeInCombat), 2, "white", "white") + addIconAndStatusBar() - --wasted time - gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_WASTED_TIME"] .. ":", "|cFFFF3300" .. detailsFramework:IntegerToTimer(notInCombatTime) .. " (" .. floor(notInCombatTime / totalRealTime * 100) .. "%)|r", 2, "white", "white") - addIconAndStatusBar(0.15) + local totalRealTime = thisCombat:GetRunTimeNoDefault() or (endedAt - startedAt) + local notInCombatTime = totalRealTime - timeInCombat - else - gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_COMBATTIME"] .. ":", detailsFramework:IntegerToTimer(timeInCombat), 2, "white", "white") - addIconAndStatusBar() - end + gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TOTALTIME"] .. ":", detailsFramework:IntegerToTimer(totalRealTime), 2, "white", "white") + addIconAndStatusBar() - if (thisCombat.is_boss) then - gameCooltip:AddLine("", "", 2, "white", "white") - addIconAndStatusBar() - end + --wasted time + gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_WASTED_TIME"] .. ":", "|cFFFF3300" .. detailsFramework:IntegerToTimer(notInCombatTime) .. " (" .. floor(notInCombatTime / totalRealTime * 100) .. "%)|r", 2, "white", "white") + addIconAndStatusBar(0.15) - gameCooltip:AddLine(Loc["STRING_SEGMENT_START"] .. ":", thisCombat:GetDate(), 2, "white", "white") + else + gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_COMBATTIME"] .. ":", detailsFramework:IntegerToTimer(timeInCombat), 2, "white", "white") addIconAndStatusBar() - gameCooltip:AddLine(Loc["STRING_SEGMENT_END"] .. ":", dateEnd or "in progress", 2, "white", "white") + end + + if (thisCombat.is_boss) then + gameCooltip:AddLine("", "", 2, "white", "white") addIconAndStatusBar() end + + gameCooltip:AddLine(Loc["STRING_SEGMENT_START"] .. ":", thisCombat:GetDate(), 2, "white", "white") + addIconAndStatusBar() + gameCooltip:AddLine(Loc["STRING_SEGMENT_END"] .. ":", dateEnd or "in progress", 2, "white", "white") + addIconAndStatusBar() end segmentInfoAdded = true @@ -6641,6 +6613,8 @@ local buildSegmentTooltip = function(self, deltaTime) gameCooltip:AddLine(thisCombat:GetCombatName(false, bFindEnemyName), _, 1, "yellow") gameCooltip:AddIcon(thisCombat:GetCombatIcon(), "main", "left") + --print("passing here...") + if (Details.tooltip.submenu_wallpaper and bCanUseBackgroundImage) then gameCooltip:SetWallpaper(2, [[Interface\ACHIEVEMENTFRAME\UI-Achievement-StatsBackground]], segments_common_tex, segments_common_color, true) end @@ -6779,12 +6753,6 @@ local buildSegmentTooltip = function(self, deltaTime) --the combat has mythic dungeon tag but doesn't have a mythic dungeon table information --so this is a trash cleanup segment - local trashInfo = thisCombat:GetMythicDungeonTrashInfo() - - --CoolTip:AddLine(Loc["STRING_SEGMENT_TRASH"], _detalhes.gump:IntegerToTimer(thisCombat:GetCombatTime()), 1, dungeon_color_trash, "gray") - --CoolTip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 16, 12, 0.02734375, 0.11328125, 0.19140625, 0.3125, "red") - --CoolTip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 14, 10, 479/512, 510/512, 24/512, 51/512, nil, nil, true) - --submenu gameCooltip:AddLine(Loc["STRING_SEGMENT_TRASH"], nil, 2, "white", "white") gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_COMBATTIME"] .. ":", detailsFramework:IntegerToTimer(thisCombat:GetCombatTime()), 2, "white", "white") @@ -6792,10 +6760,10 @@ local buildSegmentTooltip = function(self, deltaTime) gameCooltip:AddLine(Loc["STRING_SEGMENT_START"] .. ":", thisCombat:GetDate(), 2, "white", "white") gameCooltip:AddLine(Loc["STRING_SEGMENT_END"] .. ":", dateEnd or "in progress", 2, "white", "white") - if (trashInfo) then - local backgroundImage = Details:GetRaidIcon (trashInfo.MapID, trashInfo.EJID, "party") + if (mythicDungeonInfo) then + local backgroundImage = Details:GetRaidIcon(mythicDungeonInfo.MapID, mythicDungeonInfo.EJID, "party") if (backgroundImage and bCanUseBackgroundImage) then - gameCooltip:SetWallpaper (2, backgroundImage, {0.070, 0.695, 0.087, 0.566}, {1, 1, 1, 0.5}, true) + gameCooltip:SetWallpaper(2, backgroundImage, {0.070, 0.695, 0.087, 0.566}, {1, 1, 1, 0.5}, true) end end end diff --git a/functions/mythicdungeon/mythicdungeon.lua b/functions/mythicdungeon/mythicdungeon.lua index 984bb4ddf..153767eb7 100644 --- a/functions/mythicdungeon/mythicdungeon.lua +++ b/functions/mythicdungeon/mythicdungeon.lua @@ -220,18 +220,31 @@ function DetailsMythicPlusFrame.EventListener.OnDetailsEvent(contextObject, even local zoneName = combatObject.is_boss.zone local mythicLevel = C_ChallengeMode.GetActiveKeystoneInfo() + local currentCombat = Details:GetCurrentCombat() + --just in case the combat get tagged as boss fight - Details:GetCurrentCombat().is_boss = nil + combatObject.is_boss = nil --tag the combat as mythic dungeon trash local zoneName, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo() - Details:GetCurrentCombat().is_mythic_dungeon_trash = { - ZoneName = zoneName, - MapID = instanceMapID, + + ---@type mythicdungeoninfo + local mythicPlusInfo = { + ZoneName = Details.MythicPlus.DungeonName or zoneName, + MapID = Details.MythicPlus.DungeonID or instanceMapID, Level = Details.MythicPlus.Level, EJID = Details.MythicPlus.ejID, + RunID = Details.mythic_dungeon_id, + StartedAt = time() - currentCombat:GetCombatTime(), + EndedAt = time(), + SegmentID = Details.MythicPlus.SegmentID, --segment number within the dungeon + OverallSegment = false, + SegmentType = DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSWIPE, + SegmentName = (encounterName or Loc["STRING_UNKNOW"]) .. " (" .. string.lower(_G["BOSS"]) .. ")" } + combatObject.is_mythic_dungeon = mythicPlusInfo + Details222.MythicPlus.LogStep("COMBAT_PLAYER_LEAVE | wiped on boss | key level: | " .. mythicLevel .. " | " .. (encounterName or "") .. " " .. zoneName) else DetailsMythicPlusFrame.BossDefeated(false, combatObject.is_boss.id, combatObject.is_boss.name, combatObject.is_boss.diff, 5, 1) diff --git a/functions/mythicdungeon/segments.lua b/functions/mythicdungeon/segments.lua index 883982278..b420d0cf4 100644 --- a/functions/mythicdungeon/segments.lua +++ b/functions/mythicdungeon/segments.lua @@ -15,15 +15,6 @@ local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details") all mythic segments have: .is_mythic_dungeon_segment = true .is_mythic_dungeon_run_id = run id from details.profile.mythic_dungeon_id - boss, 'trash overall' and 'dungeon overall' segments have: - .is_mythic_dungeon - boss segments have: - .is_boss - 'trash overall' segments have: - .is_mythic_dungeon with .SegmentID = "trashoverall" - 'dungeon overall' segment have: - .is_mythic_dungeon with .SegmentID = "overall" - --]] local DetailsMythicPlusFrame = _G["DetailsMythicPlusFrame"] @@ -114,6 +105,8 @@ function Details222.MythicPlus.OnBossDefeated(encounterID, encounterName) OverallSegment = false, Level = Details.MythicPlus.Level, EJID = Details.MythicPlus.ejID, + SegmentType = DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS, + SegmentName = (encounterName or Loc["STRING_UNKNOW"]) .. " (" .. string.lower(_G["BOSS"]) .. ")" } local mythicLevel = C_ChallengeMode.GetActiveKeystoneInfo() @@ -243,6 +236,8 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() --~merge DungeonID = Details222.MythicPlus.DungeonID, DungeonTexture = Details222.MythicPlus.Texture, DungeonBackgroundTexture = Details222.MythicPlus.BackgroundTexture, + SegmentType = DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL, + SegmentName = Details.MythicPlus.DungeonName .. " +" .. Details222.MythicPlus.Level, } --add all boss segments from this run to this new segment @@ -283,7 +278,6 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() --~merge end newCombat.total_segments_added = totalSegments - newCombat.is_mythic_dungeon_segment = true newCombat.is_mythic_dungeon_run_id = Details.mythic_dungeon_id --check if both values are valid, this can get invalid if the player leaves the dungeon before the timer ends or the game crashes @@ -309,6 +303,7 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() --~merge --immediatly finishes the segment just started Details:SairDoCombate() + newCombat.is_mythic_dungeon_segment = true --update all windows Details:InstanceCallDetailsFunc(Details.FadeHandler.Fader, "IN", nil, "barras") @@ -394,6 +389,8 @@ function DetailsMythicPlusFrame.MergeTrashCleanup() EJID = Details.MythicPlus.ejID, EncounterID = segmentsToMerge.EncounterID, EncounterName = segmentsToMerge.EncounterName or Loc ["STRING_UNKNOW"], + SegmentType = DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSTRASH, + SegmentName = (segmentsToMerge.EncounterName or Loc ["STRING_UNKNOW"]) .. " (" .. string.lower(Loc["STRING_SEGMENTS_LIST_TRASH"]) .. ")", } newCombat.is_mythic_dungeon_segment = true diff --git a/textures.lua b/textures.lua index 23eb8837a..fef823f64 100644 --- a/textures.lua +++ b/textures.lua @@ -45,7 +45,7 @@ Details.TextureAtlas = { ["segment-icon-broom"] = { file = [[Interface\AddOns\Details\images\icons]], - width = 12, + width = 14, height = 16, leftTexCoord = 14/512, rightTexCoord = 58/512,