From 7e7dda8ee74a17bb92bc46af84e65e0036fc3366 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sun, 12 Nov 2023 16:01:17 -0300 Subject: [PATCH] Fixed the Mythic+ Graphic not showing after clicking in "Show"; Fixed Health Bar on deathlog; --- Definitions.lua | 3 +++ boot.lua | 4 ++-- core/parser.lua | 14 +++++++++----- functions/classes.lua | 10 ++++++++++ functions/dungeon.lua | 41 ++++++++++++++++++----------------------- 5 files changed, 42 insertions(+), 30 deletions(-) diff --git a/Definitions.lua b/Definitions.lua index 49dbb1d8d..fd419fced 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -56,6 +56,8 @@ ---@alias actorspec number this is the specID of the actor ---@alias uniquecombatid number a unique ID to point to a single combat, each character has its ID counter, use with Details:DoesCombatWithUIDExists(); Details:GetCombatByUID(); retrive with combat:GetCombatUID() +---@alias cleuname string + ---@class petinfo : table ---@field key1 ownername ---@field key2 guid @@ -82,6 +84,7 @@ ---@field GetSpellSchoolFormatedName fun(self: details, spellschool: spellschool) : string ---@field CommaValue fun(self: details, number: number) : string ---@field CreateEventListener fun(self: details) : table +---@field GetFullName fun(self: details, unitId: any, ambiguateString: any) : string create a CLEU compatible name of the unit passed, return string is in the format "playerName-realmName", the string will also be ambiguated using the ambiguateString passed ---@class detailseventlistener : table ---@field RegisterEvent fun(self: detailseventlistener, event: detailsevent, callback: function) diff --git a/boot.lua b/boot.lua index cb2684e9d..8f66d106a 100644 --- a/boot.lua +++ b/boot.lua @@ -13,8 +13,8 @@ local addonName, Details222 = ... local version, build, date, tocversion = GetBuildInfo() - Details.build_counter = 12034 - Details.alpha_build_counter = 12034 --if this is higher than the regular counter, use it instead + Details.build_counter = 12035 + Details.alpha_build_counter = 12035 --if this is higher than the regular counter, use it instead Details.dont_open_news = true Details.game_version = version Details.userversion = version .. " " .. Details.build_counter diff --git a/core/parser.lua b/core/parser.lua index 03b4ec5ea..39acda62e 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -2555,7 +2555,7 @@ end previousEvent[7] = previousEvent[7] or bIsShield previousEvent[1] = false --true if this is a damage || false for healing - previousEvent[5] = UnitHealth(targetName) + previousEvent[5] = UnitHealth(Details:Ambiguate(targetName)) previousEvent[11] = (previousEvent[11] or 0) + 1 --attempt to perform arithmetic on a boolean value (during battlegrounds - fix 02 Nov 2023) else local thisEvent = t[i] @@ -2579,7 +2579,7 @@ thisEvent[5] = 0 end else - thisEvent[5] = UnitHealth(targetName) + thisEvent[5] = UnitHealth(Details:Ambiguate(targetName)) end thisEvent[6] = sourceName @@ -7065,6 +7065,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 function Details:GetUnitId(unitName) unitName = unitName or self.nome + unitName = Details:Ambiguate(unitName) + local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0", true) if (openRaidLib) then local unitId = openRaidLib.GetUnitID(unitName) @@ -7130,9 +7132,11 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 local _player, realmName = UnitFullName("player") if (not realmName) then realmName = GetRealmName() - realmName = realmName:gsub("%s+", "") + realmName = realmName:gsub("[%s-]", "") end + local currentCombat = Details:GetCurrentCombat() + for i = 1, players do local name, killingBlows, honorableKills, deaths, honorGained, faction, race, rank, class, classToken, damageDone, healingDone, bgRating, ratingChange, preMatchMMR, mmrChange, talentSpec if (isWOTLK) then @@ -7148,7 +7152,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 end --damage done - local actor = Details.tabela_vigente(1, name) + local actor = currentCombat:GetActor(DETAILS_ATTRIBUTE_DAMAGE, name) if (actor) then if (damageDone == 0) then damageDone = damageDone + Details:GetOrderNumber() @@ -7178,7 +7182,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 end --healing done - local actor = Details.tabela_vigente(2, name) + local actor = currentCombat:GetActor(DETAILS_ATTRIBUTE_HEAL, name) if (actor) then if (healingDone == 0) then healingDone = healingDone + Details:GetOrderNumber() diff --git a/functions/classes.lua b/functions/classes.lua index 36f9fbe60..9d56565c2 100644 --- a/functions/classes.lua +++ b/functions/classes.lua @@ -206,6 +206,12 @@ do end local UnitFullName = UnitFullName + + ---create a CLEU compatible name of the unit passed + ---return string is in the format "playerName-realmName" + ---the string will also be ambiguated using the ambiguateString passed + ---@param unitId any + ---@param ambiguateString any function Details:GetFullName(unitId, ambiguateString) --UnitFullName is guarantee to return the realm name of the unit queried local playerName, realmName = UnitFullName(unitId) @@ -225,6 +231,10 @@ do end end + function Details:GetUnitNameForAPI(unitId) + return Details:GetFullName(unitId, "none") + end + if (toc < 100200) then Details.GetFullName = Details.GetCLName end diff --git a/functions/dungeon.lua b/functions/dungeon.lua index 73887b86c..6c07d6675 100644 --- a/functions/dungeon.lua +++ b/functions/dungeon.lua @@ -6,6 +6,8 @@ local verbosemode = false --auto open the chart panel local _ local addonName, Details222 = ... +local detailsFramework = DetailsFramework + local Loc = _G.LibStub("AceLocale-3.0"):GetLocale( "Details" ) --constants @@ -30,17 +32,9 @@ function mythicDungeonCharts:Debug(...) end end -local addPlayerDamage = function(unitName, unitRealm) - --get the combatlog name - local CLName - if (unitRealm and unitRealm ~= "") then - CLName = unitName .. "-" .. unitRealm - else - CLName = unitName - end - +local addPlayerDamage = function(unitCleuName) --get the player data - local playerData = mythicDungeonCharts.ChartTable.Players[CLName] + local playerData = mythicDungeonCharts.ChartTable.Players[unitCleuName] --if this is the first tick for the player, ignore the damage done on this tick --this is done to prevent a tick tick with all the damage the player did on the previous segment @@ -49,9 +43,9 @@ local addPlayerDamage = function(unitName, unitRealm) --check if the player data doesn't exists if (not playerData) then playerData = { - Name = unitName, + Name = detailsFramework:RemoveRealmName(unitCleuName), ChartData = {max_value = 0}, - Class = select(2, UnitClass(CLName)), + Class = select(2, UnitClass(Details:Ambiguate(unitCleuName))), --spec zero for now, need to retrive later during combat Spec = 0, @@ -63,7 +57,7 @@ local addPlayerDamage = function(unitName, unitRealm) LastCombatID = -1, } - mythicDungeonCharts.ChartTable.Players[CLName] = playerData + mythicDungeonCharts.ChartTable.Players[unitCleuName] = playerData bIsFirstTick = true end @@ -86,10 +80,10 @@ local addPlayerDamage = function(unitName, unitRealm) playerData.LastDamage = 0 playerData.LastCombatID = segmentId - --mythicDungeonCharts:Debug("Combat changed for player", CLName) + --mythicDungeonCharts:Debug("Combat changed for player", unitCleuName) end - local actorTable = currentCombat:GetActor(DETAILS_ATTRIBUTE_DAMAGE, CLName) + local actorTable = currentCombat:GetActor(DETAILS_ATTRIBUTE_DAMAGE, unitCleuName) if (actorTable) then --update the player spec playerData.Spec = actorTable.spec @@ -108,7 +102,7 @@ local addPlayerDamage = function(unitName, unitRealm) --add the damage to the chart table table.insert(playerData.ChartData, eDps) - --mythicDungeonCharts:Debug("Added dps for " , CLName, ":", eDps) + --mythicDungeonCharts:Debug("Added dps for " , unitCleuName, ":", eDps) if (eDps > playerData.ChartData.max_value) then playerData.ChartData.max_value = eDps @@ -120,7 +114,7 @@ local addPlayerDamage = function(unitName, unitRealm) --add the damage to the chart table table.insert(playerData.ChartData, damageDiff) - --mythicDungeonCharts:Debug("Added damage for " , CLName, ":", damageDiff) + --mythicDungeonCharts:Debug("Added damage for " , unitCleuName, ":", damageDiff) if (damageDiff > playerData.ChartData.max_value) then playerData.ChartData.max_value = damageDiff @@ -151,13 +145,14 @@ local tickerCallback = function(tickerObject) --tick damage local totalPlayers = GetNumGroupMembers() for i = 1, totalPlayers-1 do - local unitName, unitRealm = UnitFullName ("party" .. i) - if (unitName) then - addPlayerDamage(unitName, unitRealm) + ---@type cleuname + local cleuName = Details:GetFullName("party" .. i) + if (cleuName) then + addPlayerDamage(cleuName) end end - addPlayerDamage(UnitFullName("player")) + addPlayerDamage(Details:GetFullName("player")) end function mythicDungeonCharts:OnBossDefeated() @@ -290,7 +285,7 @@ function mythicDungeonCharts.ShowReadyPanel() readyFrame:EnableMouse(true) readyFrame:SetMovable(true) DetailsFramework:ApplyStandardBackdrop(readyFrame) - DetailsFramework:CreateTitleBar (readyFrame, "Details! Damage Graphic for M+") + DetailsFramework:CreateTitleBar (readyFrame, "Details! Damage Chart for M+") readyFrame:Hide() @@ -302,7 +297,7 @@ function mythicDungeonCharts.ShowReadyPanel() LibWindow.SavePosition(readyFrame) --show button - readyFrame.ShowButton = DetailsFramework:CreateButton(readyFrame, function() mythicDungeonCharts.ShowChart(); readyFrame:Hide() end, 80, 20, Loc ["STRING_SLASH_SHOW"]) + readyFrame.ShowButton = DetailsFramework:CreateButton(readyFrame, function() mythicDungeonCharts.ShowChart(); readyFrame:Hide() end, 80, 20, Loc ["STRING_SLASH_SHOW"]:gsub("^%l", string.upper)) readyFrame.ShowButton:SetTemplate(DetailsFramework:GetTemplate("button", "DETAILS_PLUGIN_BUTTON_TEMPLATE")) readyFrame.ShowButton:SetPoint("topright", readyFrame, "topright", -5, -30)