diff --git a/Definitions.lua b/Definitions.lua index a56e7fe8..8032e8eb 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -465,17 +465,17 @@ ---spelltableadv is similar to spelltable but allow custom members, methods and any modification isn't save to saved variables ---@class spelltableadv : spelltable, spelltablemixin ----@field expanded boolean if is true the show the nested spells +---@field expanded boolean? if is true the show the nested spells ---@field spellTables spelltable[] ---@field nestedData bknesteddata[] ---@field bCanExpand boolean ----@field expandedIndex number ----@field bIsExpanded boolean ----@field statusBarValue number ----@field npcId npcid ----@field actorName string --when showing an actor header, this is the actor name ----@field bIsActorHeader boolean if this is true, the spellbar is an actor header, which is a bar with the actor name with the actor spells nested ----@field actorIcon textureid|texturepath +---@field expandedIndex number? +---@field bIsExpanded boolean? +---@field statusBarValue number? +---@field npcId any +---@field actorName string? --when showing an actor header, this is the actor name +---@field bIsActorHeader boolean? if this is true, the spellbar is an actor header, which is a bar with the actor name with the actor spells nested +---@field actorIcon textureid|texturepath? ---@class bknesteddata : {spellId: number, spellTable: spelltable, actorName: string, value: number, bIsActorHeader: boolean} fills .nestedData table in spelltableadv, used to store the nested spells data, 'value' is set when the breakdown sort the values by the selected header diff --git a/Libs/DF/timebar.lua b/Libs/DF/timebar.lua index f33e28b7..031a66ef 100644 --- a/Libs/DF/timebar.lua +++ b/Libs/DF/timebar.lua @@ -270,10 +270,14 @@ local OnUpdateFunc = function(self, deltaTime) if (not self.dontShowSpark) then if (self.direction == "right") then - local pct = abs((timeNow - endTime) / (endTime - startTime)) - pct = abs(1 - pct) - spark:SetPoint("left", self, "left", (self:GetWidth() * pct) - 16, 0) - spark:Show() + if (endTime - startTime > 0) then + local pct = abs((timeNow - endTime) / (endTime - startTime)) + pct = abs(1 - pct) + spark:SetPoint("left", self, "left", (self:GetWidth() * pct) - 16, 0) + spark:Show() + else + spark:Hide() + end else spark:SetPoint("right", self, "right", self:GetWidth() * (timeNow/self.endTime), 0) end diff --git a/boot.lua b/boot.lua index 306f061a..40a0df40 100644 --- a/boot.lua +++ b/boot.lua @@ -103,6 +103,7 @@ Schedules = {}, } Details222.TimeMachine = {} + Details222.OnUseItem = {Trinkets = {}} Details222.Date = { GetDateForLogs = function() diff --git a/classes/class_damage.lua b/classes/class_damage.lua index a7d62f6d..59b8120a 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -5046,7 +5046,6 @@ function damageClass:MontaInfoDamageDone() --I guess this fills the list of spel if (spellName) then ---@type number in which index the spell with the same name was stored - local index = alreadyAdded[spellName] if (index and bShouldMergePlayerSpells) then ---@type spelltableadv @@ -5758,6 +5757,9 @@ function damageClass:BuildSpellDetails(spellBar, spellBlockContainer, blockIndex blockLine1.leftText:SetText("Procs: " .. trinketProc.total) end end + + elseif (Details.GetItemSpellInfo(spellId)) then + blockLine1.leftText:SetText("Uses: " .. totalCasts) end blockLine1.rightText:SetText(Loc ["STRING_HITS"]..": " .. totalHits) --hits and uptime diff --git a/core/parser.lua b/core/parser.lua index a1236fd5..d81bbfc2 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -1588,7 +1588,7 @@ end end - if (_trinket_data_cache[spellId] and _in_combat) then + if (_trinket_data_cache[spellId] and _in_combat) then --~trinket ---@type trinketdata local thisData = _trinket_data_cache[spellId] if (thisData.lastCombatId == _global_combat_counter) then @@ -2140,7 +2140,7 @@ ----------------------------------------------------------------------------------------------------------------------------------------- --SPELL_EMPOWER ----------------------------------------------------------------------------------------------------------------------------------------- - function parser:spell_empower(token, time, sourceGUID, sourceName, sourceFlags, targetGUID, targetName, targetFlags, targetRaidFlags, spellId, spellName, spellSchool, empowerLevel) + function parser:spell_empower(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetRaidFlags, spellId, spellName, spellSchool, empowerLevel) --empowerLevel only exists on _END and _INTERRUPT if (token == "SPELL_EMPOWER_START" or token == "SPELL_EMPOWER_INTERRUPT") then return @@ -2151,7 +2151,7 @@ end --early checks - if (not sourceGUID or not sourceName or not sourceFlags) then + if (not sourceSerial or not sourceName or not sourceFlags) then return end @@ -2160,17 +2160,22 @@ return end - local sourceObject = damage_cache[sourceGUID] or damage_cache[sourceName] + local sourceObject = damage_cache[sourceSerial] or damage_cache[sourceName] if (not sourceObject) then - sourceObject = _current_damage_container:GetOrCreateActor(sourceGUID, sourceName, sourceFlags, true) + sourceObject = _current_damage_container:GetOrCreateActor(sourceSerial, sourceName, sourceFlags, true) end if (not sourceObject) then return end - empower_cache[sourceGUID] = empower_cache[sourceGUID] or {} + --add to the amount of spell casts + --nop, SPELL_EMPOWER_END does not trigger when Tip The Scales is enabled + --perhaps UNIT_SPELLCAST_SUCCEEDED checking if tip the scales buff is enabled and checking if the spell is an empowered spell + --parser:spellcast(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetRaidFlags, spellId, spellName) + + empower_cache[sourceSerial] = empower_cache[sourceSerial] or {} local empowerTable = { spellName = spellName, empowerLevel = empowerLevel, @@ -2178,7 +2183,7 @@ counted_healing = false, counted_damage = false, } - empower_cache[sourceGUID][spellName] = empowerTable + empower_cache[sourceSerial][spellName] = empowerTable end --parser.spell_empower --10/30 15:32:11.515 SPELL_EMPOWER_START,Player-4184-00242A35,"Isodrak-Valdrakken",0x514,0x0,Player-4184-00242A35,"Isodrak-Valdrakken",0x514,0x0,382266,"Fire Breath",0x4 @@ -4053,7 +4058,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 ---@param targetRaidFlags number ---@param spellId number ---@param spellName string - ---@param spellType number + ---@param spellType number? function parser:spellcast(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetRaidFlags, spellId, spellName, spellType) --only capture if is in combat if (not _in_combat) then @@ -4083,6 +4088,9 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 end end + --check if this is an item usage + spellId = Details222.OnUseItem.Trinkets[spellId] or spellId + ------------------------------------------------------------------------------------------------ --build containers on the fly --amount of casts by actors ~casts diff --git a/frames/window_breakdown/breakdown_spells_spellframes.lua b/frames/window_breakdown/breakdown_spells_spellframes.lua index cedf6883..1d5ec5e0 100644 --- a/frames/window_breakdown/breakdown_spells_spellframes.lua +++ b/frames/window_breakdown/breakdown_spells_spellframes.lua @@ -912,8 +912,8 @@ local updateSpellBar = function(spellBar, index, actorName, combatObject, scroll ---@cast spellTable spelltable spellBar.spellTable = spellTable - ---@type string, number, any - local spellName, _, spellIcon = Details.GetSpellInfo(spellId) + ---@type string, number, any, string?, boolean? + local spellName, _, spellIcon, defaultName, bBreakdownCanStack = Details.GetCustomSpellInfo(spellId) if (not spellName) then spellName = actorName ---@type npcid @@ -921,8 +921,12 @@ local updateSpellBar = function(spellBar, index, actorName, combatObject, scroll spellIcon = Details.NpcIdToIcon[npcId] or bkSpellData.actorIcon or "" end + --if this damage was made by an item, then get the default spellName of the damaging spell + --the name from GetSpellInfo are probably modified by a custom spell name + --amount of casts does not use custom names but always the damaging spell name from combatlog + local defaultSpellName = Details.GetItemSpellInfo(spellId) ---@type number - local amtCasts = combatObject:GetSpellCastAmount(actorName, spellName) + local amtCasts = combatObject:GetSpellCastAmount(actorName, defaultSpellName or spellName) spellBar.amountCasts = amtCasts ---@type number diff --git a/functions/spellcache.lua b/functions/spellcache.lua index 1ecc424a..7707daea 100644 --- a/functions/spellcache.lua +++ b/functions/spellcache.lua @@ -283,11 +283,13 @@ do customItemList[421994] = {itemId = 207173, isPassive = true} --trinket: Gift of Ursine Vengeance (buff) customItemList[422441] = {itemId = 207169, isPassive = true} --trinket: Branch of the Tormented Ancient (buff) - customItemList[427161] = {itemId = 208615, onUse = true, castId = 422956} --trinket: Nymue's Unraveling Spindle - customItemList[425701] = {itemId = 207174, onUse = true, castId = 422750} --trinket: Fyrakk's Tainted Rageheart - customItemList[425509] = {itemId = 207169, onUse = true, castId = 422441} --trinket: Branch of the Tormented Ancient - customItemList[422146] = {itemId = 207172, onUse = true, castId = 422146} --trinket: Belor'relos, the Sunstone - customItemList[426898] = {itemId = 207167, onUse = true, castId = 423611, nameExtra = "*on use*"} --trinket: Ashes of the Embersoul + customItemList[427161] = {itemId = 208615, onUse = true, castId = 422956, defaultName = GetSpellInfo(422956)} --trinket: Nymue's Unraveling Spindle + customItemList[425701] = {itemId = 207174, onUse = true, castId = 422750, defaultName = GetSpellInfo(422750)} --trinket: Fyrakk's Tainted Rageheart + customItemList[425509] = {itemId = 207169, onUse = true, castId = 422441, defaultName = GetSpellInfo(422441)} --trinket: Branch of the Tormented Ancient + customItemList[422146] = {itemId = 207172, onUse = true, castId = 422146, defaultName = GetSpellInfo(422146)} --trinket: Belor'relos, the Sunstone + customItemList[427430] = {itemId = 207165, onUse = true, castId = 422146, defaultName = GetSpellInfo(422303), nameExtra = "*return*"} --trinket: Bandolier of Twisted Blades + customItemList[422303] = {itemId = 207165, onUse = true, castId = 422146, defaultName = GetSpellInfo(422303), nameExtra = "*throw*"} --trinket: Bandolier of Twisted Blades + customItemList[426898] = {itemId = 207167, onUse = true, castId = 423611, nameExtra = "*on use*", defaultName = GetSpellInfo(423611)} --trinket: Ashes of the Embersoul end @@ -429,12 +431,21 @@ do function Details.GetCustomSpellInfo(spellId) local spellName, _, spellIcon = Details.GetSpellInfo(spellId) + local customInfo = defaultSpellCustomization[spellId] if (customInfo) then local defaultName, bCanStack = customInfo.defaultName, customInfo.breakdownCanStack return spellName, _, spellIcon, defaultName, bCanStack - else - return spellName, _, spellIcon + end + + return spellName, _, spellIcon + end + + function Details.GetItemSpellInfo(spellId) + local spellInfo = customItemList[spellId] + if (spellInfo) then + local defaultSpellName, castSpellId, itemId, bIsPassive, bOnUse, nameExtra = spellInfo.defaultName, spellInfo.castId, spellInfo.itemId, spellInfo.onUse, spellInfo.isPassive, spellInfo.nameExtra + return defaultSpellName, castSpellId, itemId, bIsPassive, bOnUse, nameExtra end end diff --git a/startup.lua b/startup.lua index 49d3d6b4..31de31a3 100644 --- a/startup.lua +++ b/startup.lua @@ -493,6 +493,9 @@ function Details:StartMeUp() } trinketData[spellId] = thisTrinketData end + + elseif (trinketTable.onUse and trinketTable.castId) then + Details222.OnUseItem.Trinkets[trinketTable.castId] = spellId end end