Skip to content

Commit

Permalink
Fixed bombardments damage being attributed to other players (possible…
Browse files Browse the repository at this point in the history
… when there is only one evoker in the group).

- Fixed bombardments damage being attributed to other players (possible when there is only one evoker in the group).
- Fixed texts in the Damage tooltips that was "glued" together without spaces separating numbers.
  • Loading branch information
Tercioo committed Nov 7, 2024
1 parent 91c6be8 commit 48529ac
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 30 deletions.
12 changes: 8 additions & 4 deletions Libs/DF/editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -647,16 +647,20 @@ detailsFramework.EditorMixin = {
end

local x, y = moverFrame:GetCenter()
moverFrame:SetPoint("center", UIParent, "bottomleft", x, y)
--moverFrame:SetPoint("center", UIParent, "bottomleft", x, y)

--current position of object selected
local x, y = object:GetCenter()
moverFrame.MovingInfo.restingX = x
moverFrame.MovingInfo.restingY = y
moverFrame:SetScript("OnUpdate", onTickNotMoving)

moverFrame:GetScript("OnMouseDown")(moverFrame)
moverFrame:GetScript("OnMouseUp")(moverFrame)
--problem, I don't remember why caused the issue of the hide on click on others tabs, I think the mover was anchored to parent frame all points
if (not moverFrame.moved) then
moverFrame:GetScript("OnMouseDown")(moverFrame)
moverFrame:GetScript("OnMouseUp")(moverFrame)
--moverFrame.moved = true
end
end

self.ObjectBackgroundTexture:SetPoint("topleft", object, "topleft", 0, 0)
Expand Down Expand Up @@ -1011,7 +1015,7 @@ detailsFramework.EditorMixin = {
if (objectX ~= moverFrame.MovingInfo.restingX or objectY ~= moverFrame.MovingInfo.restingY) then
moverFrame:SetPoint("center", object, moverFrame.anchorName, 0, 0)
local x, y = moverFrame:GetCenter()
moverFrame:SetPoint("center", UIParent, "bottomleft", x, y)
--moverFrame:SetPoint("center", UIParent, "bottomleft", x, y)
moverFrame.MovingInfo.restingX = objectX
moverFrame.MovingInfo.restingY = objectY
end
Expand Down
49 changes: 47 additions & 2 deletions Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local dversion = 579
local dversion = 580
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)

Expand Down Expand Up @@ -131,6 +131,10 @@ function DF.IsDragonflightAndBeyond()
return buildInfo >= 100000
end

function DF.ExpansionHasEvoker()
return buildInfo >= 100000
end

---return true if the wow version is Dragonflight or below
---@return boolean
function DF.IsDragonflightOrBelow()
Expand Down Expand Up @@ -1652,7 +1656,6 @@ function DF:trim(string)
return from > #string and "" or string:match(".*%S", from)
end


---truncate removing at a maximum of 10 character from the string
---@param fontString table
---@param maxWidth number
Expand Down Expand Up @@ -1874,6 +1877,34 @@ function DF:GetSpellBookSpells()
return spellNamesInSpellBook, spellIdsInSpellBook
end

function DF:GetHeroTalentId()
local configId = C_ClassTalents.GetActiveConfigID()
if (not configId) then
return 0
end
local configInfo = C_Traits.GetConfigInfo(configId)
for treeIndex, treeId in ipairs(configInfo.treeIDs) do
local treeNodes = C_Traits.GetTreeNodes(treeId)
for nodeIdIndex, treeNodeID in ipairs(treeNodes) do
local traitNodeInfo = C_Traits.GetNodeInfo(configId, treeNodeID)
if (traitNodeInfo) then
local activeEntry = traitNodeInfo.activeEntry
if (activeEntry) then
local entryId = activeEntry.entryID
local rank = activeEntry.rank
if (rank > 0) then
local entryInfo = C_Traits.GetEntryInfo(configId, entryId)
if (not entryInfo.definitionID and entryInfo.subTreeID) then
return entryInfo.subTreeID
end
end
end
end
end
end
return 0
end

---return a table of passive talents, format: [spellId] = true
---@return {Name: string, ID: number, Texture: any, IsSelected: boolean}[]
function DF:GetAllTalents()
Expand Down Expand Up @@ -5303,6 +5334,20 @@ function DF:GetRangeCheckSpellForSpec(specId)
return SpellRangeCheckListBySpec[specId]
end

function DF.CatchString(...)
if (not DF.IsDragonflightAndBeyond()) then
if (type(select(1, ...)) == "table") then
for i = 1, select("#", ...) do
local value = select(i, ...)
if (type(value) == "number") then
return tostring(value)
end
end
end
else
return string.char(...)
end
end

--key is instanceId from GetInstanceInfo()
-- /dump GetInstanceInfo()
Expand Down
4 changes: 2 additions & 2 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
local addonName, Details222 = ...
local version, build, date, tvs = GetBuildInfo()

Details.build_counter = 13166
Details.alpha_build_counter = 13166 --if this is higher than the regular counter, use it instead
Details.build_counter = 13188
Details.alpha_build_counter = 13188 --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
16 changes: 8 additions & 8 deletions classes/class_damage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
Details._spectator = spectator

local is_player_class = Details.player_class
local numbertostring = string.char
local koKRStart = numbertostring(234)
local numbertostring = detailsFramework.CatchString
local koKRStart = numbertostring(234) --rectangle
Details.tooltip_key_size_width = 24
Details.tooltip_key_size_height = 10

Expand Down Expand Up @@ -4061,7 +4061,7 @@ function damageClass:ToolTip_DamageDone(instancia, numero, barra, keydown)
local spellName, _, spellIcon = _GetSpellInfo(spellId)

if (spellName) then
GameCooltip:AddLine(spellName, formatTooltipNumber(_, damageDone) .. "(" .. math.floor(damageDone / self.total * 100) .. "%)")
GameCooltip:AddLine(spellName, formatTooltipNumber(_, damageDone) .. " (" .. math.floor(damageDone / self.total * 100) .. "%)")
Details:AddTooltipBackgroundStatusbar(false, damageDone / self.total * 100)
GameCooltip:AddIcon(spellIcon, 1, 1, iconSize, iconSize, 0.1, 0.9, 0.1, 0.9)
end
Expand Down Expand Up @@ -4095,7 +4095,7 @@ function damageClass:ToolTip_DamageDone(instancia, numero, barra, keydown)

for i = 1, math.min(max_targets, #ActorTargetsSortTable) do
local enemyTable = ActorTargetsSortTable[i]
GameCooltip:AddLine(enemyTable[1], formatTooltipNumber(_, enemyTable[2]) .."("..format("%.1f", enemyTable[2] / ActorDamageWithPet * 100).."%)")
GameCooltip:AddLine(enemyTable[1], formatTooltipNumber(_, enemyTable[2]) .." ("..format("%.1f", enemyTable[2] / ActorDamageWithPet * 100).."%)")

local portraitTexture-- = Details222.Textures.GetPortraitTextureForNpcID(enemyTable[3]) --disabled atm
if (portraitTexture) then
Expand Down Expand Up @@ -4198,9 +4198,9 @@ function damageClass:ToolTip_DamageDone(instancia, numero, barra, keydown)
end

if (instancia.sub_atributo == 1) then
GameCooltip:AddLine(petName, formatTooltipNumber(_, petDamageDone) .. "(" .. math.floor(petDamageDone/self.total*100) .. "%)")
GameCooltip:AddLine(petName, formatTooltipNumber(_, petDamageDone) .. " (" .. math.floor(petDamageDone/self.total*100) .. "%)")
else
GameCooltip:AddLine(petName, formatTooltipNumber(_, math.floor(petDPS)) .. "(" .. math.floor(petDamageDone/self.total*100) .. "%)")
GameCooltip:AddLine(petName, formatTooltipNumber(_, math.floor(petDPS)) .. " (" .. math.floor(petDamageDone/self.total*100) .. "%)")
end

Details:AddTooltipBackgroundStatusbar(false, petDamageDone / topPetDamageDone * 100)
Expand All @@ -4221,7 +4221,7 @@ function damageClass:ToolTip_DamageDone(instancia, numero, barra, keydown)
--small blank space
Details:AddTooltipSpellHeaderText("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true)

Details:AddTooltipSpellHeaderText("Damage by Encounter Phase", headerColor, 1, [[Interface\Garrison\orderhall-missions-mechanic8]], 11/64, 53/64, 11/64, 53/64) --localize-me
Details:AddTooltipSpellHeaderText("Damage Per Phase", headerColor, 1, [[Interface\Garrison\orderhall-missions-mechanic8]], 11/64, 53/64, 11/64, 53/64) --localize-me
Details:AddTooltipHeaderStatusbar(r, g, b, barAlha)

local playerPhases = {}
Expand Down Expand Up @@ -4251,7 +4251,7 @@ function damageClass:ToolTip_DamageDone(instancia, numero, barra, keydown)

for i = 1, #playerPhases do
--[1] Phase Number [2] Amount Done [3] Rank [4] Percent
GameCooltip:AddLine("|cFFF0F0F0Phase|r " .. playerPhases [i][1], formatTooltipNumber(_, playerPhases [i][2]) .. "(|cFFFFFF00#" .. playerPhases [i][3] .. "|r, " .. format("%.1f", playerPhases [i][4]) .. "%)")
GameCooltip:AddLine("|cFFF0F0F0Phase|r " .. playerPhases [i][1], formatTooltipNumber(_, playerPhases [i][2]) .. " (|cFFFFFF00#" .. playerPhases [i][3] .. "|r, " .. format("%.1f", playerPhases [i][4]) .. "%)")
GameCooltip:AddIcon([[Interface\Garrison\orderhall-missions-mechanic9]], 1, 1, 14, 14, 11/64, 53/64, 11/64, 53/64)
Details:AddTooltipBackgroundStatusbar()
end
Expand Down
87 changes: 86 additions & 1 deletion core/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,18 @@
infernobless = {},
}

---@class bombardmentinfo : table
---@field only_one_scalecomander boolean
---@field spellId number
---@field evoker_name string
---@field serial string

---@type bombardmentinfo
local bombardment_stuff = {
only_one_scalecomander = true,
spellId = 434481,
only_on_scalecomander = false,
evoker_name = "",
serial = "",
}

Details.augmentation_cache = augmentation_cache
Expand Down Expand Up @@ -851,6 +860,12 @@
spellId = override_spellId[spellId] or spellId
end

if (spellId == bombardment_stuff.spellId) then
if (bombardment_stuff.only_one_scalecomander) then
sourceSerial, sourceName = bombardment_stuff.serial, bombardment_stuff.evoker_name
end
end

--> npcId check for ignored npcs
--> get the npcId from the cache, if it's not there then get it from the serial and add it to the cache
local npcId = npcid_cache[targetSerial] --target npc
Expand Down Expand Up @@ -5719,6 +5734,76 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
end)

if (detailsFramework.ExpansionHasEvoker()) then
if (IsInRaid()) then
--check if there is only one bombardment evoker in the group
local evokerCount = 0
local evokerName = ""
local evokerSerial = ""
--get the open raid lib
--local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0", true)
for i = 1, #Details222.UnitIdCache.Raid do
local unitId = Details222.UnitIdCache.Raid[i]
if (UnitExists(unitId)) then
local unitName = GetUnitName(unitId, true)
--local unitInfo = openRaidLib.GetUnitInfo(unitId)
local unitClass = select(2, UnitClass(unitName))
if (unitClass == "EVOKER") then
evokerCount = evokerCount + 1
evokerName = unitName
evokerSerial = UnitGUID(unitId)
end
else
break
end
end

if (evokerCount == 1) then
--this combat can reatribute bombardments
bombardment_stuff.only_one_scalecomander = true
bombardment_stuff.evoker_name = evokerName
bombardment_stuff.serial = evokerSerial
print("only one evoker, yonk bombardments ok:", bombardment_stuff.evoker_name, bombardment_stuff.serial)
else
bombardment_stuff.only_one_scalecomander = false
bombardment_stuff.evoker_name = ""
bombardment_stuff.serial = ""
end

elseif (IsInGroup()) then
local evokerCount = 0
local evokerName = ""
local evokerSerial = ""
--get the open raid lib
--local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0", true)
for i = 1, #Details222.UnitIdCache.Party do
local unitId = Details222.UnitIdCache.Party[i]
if (UnitExists(unitId)) then
local unitName = GetUnitName(unitId, true)
--local unitInfo = openRaidLib.GetUnitInfo(unitId)
local unitClass = select(2, UnitClass(unitName))
if (unitClass == "EVOKER") then
evokerCount = evokerCount + 1
evokerName = unitName
evokerSerial = UnitGUID(unitId)
end
end
end

if (evokerCount == 1) then
--this combat can reatribute bombardments
bombardment_stuff.only_one_scalecomander = true
bombardment_stuff.evoker_name = evokerName
bombardment_stuff.serial = evokerSerial
print("only one evoker, yonk bombardments ok:", bombardment_stuff.evoker_name, bombardment_stuff.serial)
else
bombardment_stuff.only_one_scalecomander = false
bombardment_stuff.evoker_name = ""
bombardment_stuff.serial = ""
end
end
end

if (Details.auto_swap_to_dynamic_overall) then
Details:InstanceCall(autoSwapDynamicOverallData, true)
end
Expand Down
17 changes: 11 additions & 6 deletions functions/deathrecap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ local GetSpellLink = GetSpellLink or C_Spell.GetSpellLink --api local
local GameTooltip = GameTooltip
local perf = Details222.commprefixes
local deathRecap = Details.death_recap
local catchStr = detailsFramework.CatchString

local maxBlizzardDeathRecapLines = 5
local textAlpha = 0.9
Expand Down Expand Up @@ -165,7 +166,7 @@ local create_deathrecap_line = function(parent, n)
end

function Details222.InitRecap()
hooksecurefunc(_G, "DeathRecap_LoadUI", function()
hooksecurefunc(_G, "DeathRecap_LoadUI", function() --received taint reports, could be third party issues
hooksecurefunc(_G, "DeathRecapFrame_OpenRecap", function(RecapID)
local currentCombat = Details:GetCurrentCombat()
--get the player current death and link the death table with the death recapID
Expand Down Expand Up @@ -229,7 +230,7 @@ function Details222.InitRecap()
end
end

local monitorDeaths = Details.numbertostring(unpack(Details.column_sizes))
local monitorDeaths = catchStr(unpack(Details.column_sizes))
local tableContents = _G[monitorDeaths]
for key in pairs(tableContents) do
if (key ~= isSpectating) then
Expand All @@ -239,6 +240,7 @@ function Details222.InitRecap()
end

local okay, errorText = pcall(function()
---@diagnostic disable-next-line: missing-parameter
local deathEventsScrollBox = detailsFramework:CreateScrollBox(parent, "DeathRecapEventsScrollFrame", function()end, columnsCreated)
deathEventsScrollBox:SetPoint("topleft", _G["DeathRecapFrame"], "topleft", 10, -50)
deathEventsScrollBox:SetSize(_G["DeathRecapFrame"]:GetWidth()-5, _G["DeathRecapFrame"]:GetHeight()-30)
Expand Down Expand Up @@ -320,7 +322,8 @@ function Details.GetDeathRecapFromChat()
end

if (recapIDFromChat) then
Details.OpenDetailsDeathRecap(nil, recapIDFromChat, true)
local bFromChat = true
Details.OpenDetailsDeathRecap(nil, recapIDFromChat, bFromChat)
return
end
end
Expand All @@ -339,12 +342,14 @@ function Details.OpenDetailsDeathRecap(segment, RecapID, fromChat)
end

--hide blizzard death recap
for i = 1, maxBlizzardDeathRecapLines do
DeathRecapFrame["Recap" .. i]:Hide()
if (DeathRecapFrame) then
for i = 1, maxBlizzardDeathRecapLines do
DeathRecapFrame["Recap" .. i]:Hide()
end
end

--create details death recap if not existant
if (not Details.DeathRecap) then
if (not Details.DeathRecap and DeathRecapFrame) then
Details.DeathRecap = CreateFrame("frame", "DetailsDeathRecap", DeathRecapFrame, "BackdropTemplate")
Details.DeathRecap:SetAllPoints()

Expand Down
8 changes: 4 additions & 4 deletions luaserver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1927,7 +1927,7 @@ GetSpecializationInfo = function(specIndex, isInspect, isPet, sex, level) return
---@return string name
---@return string description
---@return string icon
---@return number role
---@return string role
---@return ...
GetSpecializationInfoByID = function(specID, isInspect, isPet, inspectTarget) return 0, "", "", "", 0, "" end

Expand All @@ -1938,7 +1938,7 @@ GetSpecializationInfoByID = function(specID, isInspect, isPet, inspectTarget) re
---@return string specName The name of the specialization.
---@return string specDescription The description of the specialization.
---@return string icon The icon of the specialization.
---@return number role The role of the specialization.
---@return string role The role of the specialization.
---@return boolean recommended Whether the specialization is recommended.
---@return boolean allowedForBoost Whether the specialization is allowed for boost.
---@return number masterySpell1 The ID of the first mastery spell.
Expand Down Expand Up @@ -5868,8 +5868,8 @@ function UnitCanAttack(unit) return true end
function UnitCanCooperate(unit) return true end

---@param unit string
---@return string, string
function UnitClass(unit) return "", "" end
---@return string, string, number
function UnitClass(unit) return "", "", 0 end

---@param unit string
---@return string
Expand Down
Loading

0 comments on commit 48529ac

Please sign in to comment.