mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-16 18:00:48 +00:00
fixed missing combo point logics
This commit is contained in:
+77
-15
@@ -189,6 +189,10 @@ pfUI.libdebuff_recent_casts = pfUI.libdebuff_recent_casts or {}
|
|||||||
local recentCasts = pfUI.libdebuff_recent_casts
|
local recentCasts = pfUI.libdebuff_recent_casts
|
||||||
local AURA_CAST_DEDUPE_WINDOW = 0.1 -- Ignore duplicates within 100ms
|
local AURA_CAST_DEDUPE_WINDOW = 0.1 -- Ignore duplicates within 100ms
|
||||||
|
|
||||||
|
-- Captured combo points from SPELL_CAST_EVENT (before client consumes them)
|
||||||
|
-- SPELL_CAST_EVENT fires BEFORE UnitAura updates, so GetComboPoints() still works
|
||||||
|
local capturedCP = nil
|
||||||
|
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
-- STATIC POPUP DIALOGS
|
-- STATIC POPUP DIALOGS
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
@@ -251,18 +255,39 @@ local debuffOverwritePairs = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- Combopoint-based abilities: Only show timers for OUR casts
|
-- Combopoint-based abilities: Only show timers for OUR casts
|
||||||
|
-- Format: [spellName] = { base = N, perCP = N }
|
||||||
|
-- Duration formula: duration = base + combopoints * perCP
|
||||||
local combopointAbilities = {
|
local combopointAbilities = {
|
||||||
["Rip"] = true,
|
-- Druid
|
||||||
["Rupture"] = true,
|
["Rip"] = { base = 8, perCP = 2 },
|
||||||
["Kidney Shot"] = true,
|
|
||||||
["Slice and Dice"] = true,
|
-- Rogue
|
||||||
["Expose Armor"] = true,
|
["Rupture"] = { base = 6, perCP = 2 },
|
||||||
|
["Kidney Shot"] = { base = 1, perCP = 1 },
|
||||||
|
["Slice and Dice"] = { base = 9, perCP = 3 },
|
||||||
|
["Expose Armor"] = { base = 30, perCP = 0 }, -- fixed 30s
|
||||||
}
|
}
|
||||||
|
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
-- HELPER FUNCTIONS
|
-- HELPER FUNCTIONS
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
|
|
||||||
|
-- Check if spell is a combo-point ability
|
||||||
|
local function IsComboPointAbility(spellName)
|
||||||
|
if not spellName then return false end
|
||||||
|
return combopointAbilities[spellName] ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Get combo-point spell data (base duration and per-CP bonus)
|
||||||
|
local function GetComboPointData(spellName)
|
||||||
|
if not spellName then return nil, nil end
|
||||||
|
local cpData = combopointAbilities[spellName]
|
||||||
|
if cpData then
|
||||||
|
return cpData.base, cpData.perCP
|
||||||
|
end
|
||||||
|
return nil, nil
|
||||||
|
end
|
||||||
|
|
||||||
-- Player GUID Cache
|
-- Player GUID Cache
|
||||||
local playerGUID = nil
|
local playerGUID = nil
|
||||||
local function GetPlayerGUID()
|
local function GetPlayerGUID()
|
||||||
@@ -1119,6 +1144,7 @@ if hasNampower then
|
|||||||
frame:RegisterEvent("SPELL_GO_SELF")
|
frame:RegisterEvent("SPELL_GO_SELF")
|
||||||
frame:RegisterEvent("SPELL_GO_OTHER")
|
frame:RegisterEvent("SPELL_GO_OTHER")
|
||||||
frame:RegisterEvent("SPELL_FAILED_OTHER")
|
frame:RegisterEvent("SPELL_FAILED_OTHER")
|
||||||
|
frame:RegisterEvent("SPELL_CAST_EVENT")
|
||||||
frame:RegisterEvent("AURA_CAST_ON_SELF")
|
frame:RegisterEvent("AURA_CAST_ON_SELF")
|
||||||
frame:RegisterEvent("AURA_CAST_ON_OTHER")
|
frame:RegisterEvent("AURA_CAST_ON_OTHER")
|
||||||
frame:RegisterEvent("DEBUFF_ADDED_OTHER")
|
frame:RegisterEvent("DEBUFF_ADDED_OTHER")
|
||||||
@@ -1265,6 +1291,29 @@ if hasNampower then
|
|||||||
pfUI.libdebuff_casts[casterGuid] = nil
|
pfUI.libdebuff_casts[casterGuid] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
elseif event == "SPELL_CAST_EVENT" then
|
||||||
|
-- Capture combo points BEFORE they're consumed
|
||||||
|
-- This event fires when YOU cast a spell (before server processes it)
|
||||||
|
local success = arg1
|
||||||
|
local spellId = arg2
|
||||||
|
|
||||||
|
if success ~= 1 or not spellId then return end
|
||||||
|
|
||||||
|
-- Get spell name
|
||||||
|
local spellName = nil
|
||||||
|
if GetSpellRec then
|
||||||
|
local rec = GetSpellRec(spellId)
|
||||||
|
spellName = rec and rec.name or nil
|
||||||
|
end
|
||||||
|
if not spellName and SpellInfo then
|
||||||
|
spellName = SpellInfo(spellId)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Only capture CPs for combo-point abilities
|
||||||
|
if spellName and IsComboPointAbility(spellName) then
|
||||||
|
capturedCP = GetComboPoints() or 0
|
||||||
|
end
|
||||||
|
|
||||||
elseif event == "AURA_CAST_ON_SELF" or event == "AURA_CAST_ON_OTHER" then
|
elseif event == "AURA_CAST_ON_SELF" or event == "AURA_CAST_ON_OTHER" then
|
||||||
local spellId = arg1
|
local spellId = arg1
|
||||||
local casterGuid = arg2
|
local casterGuid = arg2
|
||||||
@@ -1312,18 +1361,31 @@ if hasNampower then
|
|||||||
debugStats.aura_cast = debugStats.aura_cast + 1
|
debugStats.aura_cast = debugStats.aura_cast + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
-- CP-based spells: Use GetDuration for our casts
|
-- Combo-point abilities: Calculate duration based on CPs used
|
||||||
if isOurs and combopointAbilities[spellName] then
|
if IsComboPointAbility(spellName) then
|
||||||
duration = libdebuff:GetDuration(spellName, rankNum)
|
if isOurs then
|
||||||
end
|
-- OWN casts: use captured CPs from SPELL_CAST_EVENT (if available)
|
||||||
|
local cp = capturedCP or 0
|
||||||
-- CP-based spells: Force duration=0 for others (unknown!)
|
local base, perCP = GetComboPointData(spellName)
|
||||||
if not isOurs and combopointAbilities[spellName] then
|
if base and perCP then
|
||||||
if spellName == "Expose Armor" then
|
duration = base + cp * perCP
|
||||||
duration = 30 -- Fixed duration for Expose Armor
|
else
|
||||||
|
-- Fallback to legacy database
|
||||||
|
duration = libdebuff:GetDuration(spellName, rankNum)
|
||||||
|
end
|
||||||
|
capturedCP = nil -- consumed
|
||||||
else
|
else
|
||||||
duration = 0
|
-- OTHER players: CP unknown, no timer (except Expose Armor = fixed 30s)
|
||||||
|
local base, perCP = GetComboPointData(spellName)
|
||||||
|
if perCP and perCP == 0 and base then
|
||||||
|
duration = base -- fixed duration (Expose Armor)
|
||||||
|
else
|
||||||
|
duration = 0 -- CP unknown for other players
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
elseif duration == 0 then
|
||||||
|
-- Non-CP managed spells: use database if AURA_CAST returned 0
|
||||||
|
duration = libdebuff:GetDuration(spellName, rankNum) or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Store in allAuraCasts
|
-- Store in allAuraCasts
|
||||||
|
|||||||
Reference in New Issue
Block a user