Skip to content

Commit

Permalink
Fixed the Mythic+ Graphic not showing after clicking in "Show"; Fixed…
Browse files Browse the repository at this point in the history
… Health Bar on deathlog;
  • Loading branch information
Tercioo committed Nov 12, 2023
1 parent ba7d2c2 commit 7e7dda8
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 30 deletions.
3 changes: 3 additions & 0 deletions Definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 9 additions & 5 deletions core/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -2579,7 +2579,7 @@
thisEvent[5] = 0
end
else
thisEvent[5] = UnitHealth(targetName)
thisEvent[5] = UnitHealth(Details:Ambiguate(targetName))
end

thisEvent[6] = sourceName
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
10 changes: 10 additions & 0 deletions functions/classes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
41 changes: 18 additions & 23 deletions functions/dungeon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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,
Expand All @@ -63,7 +57,7 @@ local addPlayerDamage = function(unitName, unitRealm)
LastCombatID = -1,
}

mythicDungeonCharts.ChartTable.Players[CLName] = playerData
mythicDungeonCharts.ChartTable.Players[unitCleuName] = playerData
bIsFirstTick = true
end

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()

Expand All @@ -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)

Expand Down

0 comments on commit 7e7dda8

Please sign in to comment.