Files
coa-details/functions/journal.lua
T
Tercio Jose 1830359943 General Fixes, Backend Improvements, Library Updates.
Release Documentation:
- Classic now uses the same combat log reader as retail (Flamanis).
- Merged Rage of Fyr'alath spells (equara).
- Added Rogue Ambushes to merged spells (WillowGryph).
- The Remove Common Segments option now also removes segments trash between raid bosses.
- Fixed an issue where auras applied before combat start, such as Power Infusion and Prescience, which are counted towards the target, were not being accounted for.
- Added to Combat Class: classCombat:GetRunTimeNoDefault(). This returns the run time of the Mythic+ if available, nil otherwise.

Technical Notes:
- Classic now uses retail parser.
- Combat class now have the member: classCombat:GetRunTimeNoDefault(); Returns the run time of a M+ (after completed).
- The Utility class's buff scan at the start of combat has been improved, and the code has been cleaned. Also, the scan runs now on the next frame after combat start.
- Augmentation Evoker won't track auras from the combat start aura scan, if the player isn't in combat (example: a player in the group enters in combat).
- Remove tier bonus for Augmentation Evoker Ebon Might damage prediction and nerfed Close as Cluthmates to 10%.
- Segments Container's ResetDataByCombatType() now supports multiple combat types per classification.
- Code cleanup on Segments menu code to use the new Mythic+ functions added to Combat class.
- Mythic+ start detection produced errors if a WORLD_STATE_TIMER_START event triggered before the CHALLENGE_MODE_START event.
- Mythic+ finish code was bugging when 'time' returned by C_ChallengeMode.GetCompletionInfo() wasn't being checked again nil value.
- Rogue's Ambush ability and Rage of Fyr'alath spellIds added to override_spellId within the parser.
- Details! Framework updated.
- Open Raid Library updated.
2023-12-14 11:33:30 -03:00

145 lines
6.0 KiB
Lua

local Details = _G.Details
local DF = _G.DetailsFramework
local C_Timer = _G.C_Timer
local addonName, Details222 = ...
--get the sectionInfo and try to extract the spellID from it
--sectionInfo is always a valid table
local parseSectionInfoForSpellID = function(sectionInfo)
local spellId = sectionInfo.spellID
if (spellId) then
spellId = tonumber(spellId)
if (spellId) then
local spellName = GetSpellInfo(spellId)
if (spellName) then
return spellId
end
end
end
end
---this function is called when the player clicks on a link in the chat window to open a section in the encounter journal
---Details! then will check if that spell linked did damage to the raid and show a small box with the damage done
---@param tag any tag isn't used
---@param journalTypeString string
---@param idString string
function Details222.EJCache.OnClickEncounterJournalLink(tag, journalTypeString, idString) --not in use
local journalType = tonumber(journalTypeString)
local id = tonumber(idString)
local instanceId, encounterId, sectionId, tierIndex = EJ_HandleLinkPath(journalType, id)
if (sectionId) then
local sectionInfo = C_EncounterJournal.GetSectionInfo(sectionId)
if (sectionInfo and type(sectionInfo) == "table") then
local spellId = parseSectionInfoForSpellID(sectionInfo)
--spellId is guaranteed to be a valid spellId or nil
if (spellId) then
local damageDoneTable = Details222.DamageSpells.GetDamageDoneToPlayersBySpell(spellId)
local topDamage = damageDoneTable[1] and damageDoneTable[1][2]
if (topDamage and topDamage > 0) then
--build a cooltip with the damage done to players by the spellId
local gameCooltip = GameCooltip
gameCooltip:Preset(2)
gameCooltip:SetType("tooltip")
gameCooltip:SetOption("LeftPadding", -5)
gameCooltip:SetOption("RightPadding", 5)
gameCooltip:SetOption("LinePadding", 1)
gameCooltip:SetOption("StatusBarTexture", [[Interface\AddOns\Details\images\bar_hyanda]])
for i = 1, #damageDoneTable do
local targetName, damageDone = unpack(damageDoneTable[i])
local nameWithoutRealm = DF:RemoveRealmName(targetName)
local formattedDamage = Details:ToK2(damageDone)
local className = Details222.ClassCache.GetClass(targetName)
local classTexture, left, right, top, bottom = Details:GetClassIcon(className)
gameCooltip:AddLine(nameWithoutRealm, formattedDamage)
gameCooltip:AddIcon(classTexture, 1, 1, 14, 14, left, right, top, bottom)
gameCooltip:AddStatusBar(damageDone / topDamage * 100, 1, .5, .5, .5, 1, false, {value = 100, color = {.2, .2, .2, 0.9}, texture = [[Interface\AddOns\Details\images\bar_hyanda]]})
end
local abilityString = DF:MakeStringFromSpellId(spellId)
if (abilityString) then
abilityString = abilityString .. " (damage to)"
end
local anchor = {"bottom", "top", 0, 0}
gameCooltip:SetBannerImage(1, 2, [[Interface\PetBattles\Weather-Blizzard]], 220, 55, anchor, {0.85, 0.189609375, 1, 0}, {0, 0, 0, 1})
gameCooltip:SetBannerText(1, 2, abilityString or "Ability Damage Done", {"bottomleft", "topleft", 0, 2}, "white", 14)
gameCooltip:SetOwner(EncounterJournal, "topleft", "topright", 50, -10)
gameCooltip:Show()
end
end
end
end
if (not Details222.EJCache.HasJournalOnHideHooked) then
Details222.EJCache.HasJournalOnHideHooked = true
EncounterJournal:HookScript("OnHide", function()
GameCooltip:Hide()
end)
end
end
--search the damage container within the combatObject index[1] for actor that used the spellId passed and inflicted damage to players
---@param spellId number
---@param combatId any
---@return table
function Details222.DamageSpells.GetDamageDoneToPlayersBySpell(spellId, combatId)
local combatObject = Details:GetCombat(combatId)
if (not combatObject) then
return {}
end
local damageContainer = combatObject:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
if (not damageContainer) then
return {}
end
local damageDoneTable = {}
for index, actorObject in damageContainer:ListActors() do
if (actorObject:IsNeutralOrEnemy()) then
local spellTable = actorObject:GetSpell(spellId)
if (spellTable) then
for targetName, damageDone in pairs(spellTable.targets) do
damageDoneTable[targetName] = (damageDoneTable[targetName] or 0) + damageDone
end
end
end
end
local sortedResult = {}
for targetName, damageDone in pairs(damageDoneTable) do
local className = Details222.ClassCache.GetClass(targetName)
sortedResult[#sortedResult + 1] = {targetName, damageDone, className}
end
table.sort(sortedResult, function(a, b) return a[2] > b[2] end)
return sortedResult
end
--[=[
["description"] = "Eranog wreathes several players in flames. Upon expiration a Flamerift forms at each player's location, inflicting 144,550 Fire damage to players within 4 yards.
A Flamescale Tarasek spills forth from each Flamerift, leaving behind a Lava Flow.
On Mythic difficulty, Eranog also opens a Greater Flamerift that creates a Flamescale Captain.",
["link"] = "[Flamerift]",
["siblingSectionID"] = 26037,
["startsOpen"] = false,
["creatureDisplayID"] = 0,
["headerType"] = 2,
["title"] = "Flamerift",
["firstChildSectionID"] = 26036,
["uiModelSceneID"] = 0,
["filteredByDifficulty"] = false,
["abilityIcon"] = 134153,
["spellID"] = 390715,
--]=]