mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-07 14:10:01 +00:00
casts: route everything through C_Spell, drop libcast + libdebuff_casts
ClassicAPI's recent C_Spell additions cover remote-unit casts natively
(SMSG_SPELL_START co-hook caching per caster GUID), so the two parallel
cast trackers pfUI was running — libcast.lua and the libdebuff_casts
table inside libdebuff.lua — can both retire.
Migrations:
- modules/castbar.lua: focus/player cast-info gathering reads
C_Spell.UnitCastingInfo / UnitChannelInfo directly. Fallback ladder
(libdebuff_casts → pfGetCastInfo → pfGetChannelInfo) collapses into a
single call. Pushback handlers stop writing back into a non-existent
cache; the local this.endTime is the source of truth.
- modules/nameplates.lua: GetCastInfo(guid) now resolves to a unit token
via UnitTokenFromGUID and queries C_Spell, returning the same compact
struct shape downstream code expected. UpdateCastbar collapses from a
three-branch hierarchy (dead IterDebuffs / libdebuff_casts / libcast)
to one C_Spell read.
- modules/afkcam.lua: pfGetCastInfo+pfGetChannelInfo round-trip becomes
a single C_Spell.UnitCastingInfo("player") or UnitChannelInfo fallback.
- libs/libpredict.lua: HealComm timing uses C_Spell on the sender's unit
token after a small group-roster walk to resolve the sender's name.
Deletions:
- libs/libcast.lua entirely (-571 lines) plus its init/libs.xml entry.
- libdebuff_casts / libdebuff_item_icons tables and their write sites
in libs/libdebuff.lua (the SPELL_START_*, SPELL_GO_*, SPELL_FAILED_*
event handlers stop maintaining them but keep firing the
libdebuff_*_hooks broadcast surface for actionbar / swingtimer /
libtotem). SPELLCAST_CHANNEL_STOP now reads the active channel from
C_Spell.ChannelInfo.
- modules/superwow.lua's supercast block — UNIT_CASTEVENT writes into
libcast.db are redundant now that C_Spell co-hooks the same packet.
- The cast-bar item-icon override that swapped in a potion/trinket
icon for item-triggered casts. Spell icon stays; the item-icon
metadata path (libdebuff_item_icons) went with libdebuff_casts.
Steady Shot synthetic cast bar — Turtle WoW-specific:
- castbar.lua gains a pfUI.synthetic_casts[unit] fallback that fires
only when C_Spell returns nil, so abilities the engine treats as
instant but which have a meaningful wait window can still render a
cast bar.
- modules/turtle-wow.lua replaces the old libcast.customcast block with
a Nampower SPELL_QUEUE_EVENT subscriber. ON_SWING_QUEUED matching
the localized "Steady Shot" name writes a 1.4s synthetic entry;
ON_SWING_QUEUE_POPPED clears it; castbar's endMs guard self-expires
the entry as a safety net. Note: haste scaling (libcast.ApplyShotHaste)
is gone — bar may finish slightly early under +ranged haste buffs.
Net: 152 insertions, 972 deletions.
This commit is contained in:
+32
-33
@@ -312,42 +312,41 @@ pfUI:RegisterModule("turtle-wow", function ()
|
||||
end
|
||||
end)
|
||||
|
||||
-- add Trueshot recognition to to custom castbars.
|
||||
if not libcast.customcast["steadyshot"] then
|
||||
-- add trueshot to pfUI's custom casts
|
||||
local player = UnitName("player")
|
||||
-- Synthetic Steady Shot cast bar. The engine treats Steady Shot as
|
||||
-- instant, but the arrow doesn't actually fire until the next ranged
|
||||
-- swing (~1.4s baseline). Drive a synthetic entry off Nampower's
|
||||
-- SPELL_QUEUE_EVENT so hunters see a tickdown matching the swing wait.
|
||||
-- castbar.lua reads pfUI.synthetic_casts[unit] as a fallback when
|
||||
-- C_Spell.UnitCastingInfo returns nil.
|
||||
pfUI_locale["enUS"]["customcast"]["TRUESHOT"] = "Steady Shot"
|
||||
pfUI_locale["zhCN"]["customcast"]["TRUESHOT"] = "稳固射击"
|
||||
pfUI.synthetic_casts = pfUI.synthetic_casts or {}
|
||||
|
||||
-- add locales
|
||||
pfUI_locale["enUS"]["customcast"]["TRUESHOT"] = "Steady Shot"
|
||||
pfUI_locale["zhCN"]["customcast"]["TRUESHOT"] = "稳固射击"
|
||||
local trueshot = L["customcast"]["TRUESHOT"] or ""
|
||||
local steadyShotName = L["customcast"]["TRUESHOT"]
|
||||
local STEADY_SHOT_ICON = "Interface\\Icons\\Ability_hunter_steadyshot"
|
||||
local STEADY_SHOT_DURATION_MS = 1400 -- not haste-scaled; close enough for the visual cue
|
||||
local ON_SWING_QUEUED, ON_SWING_QUEUE_POPPED = 0, 1
|
||||
|
||||
libcast.customcast[strlower(trueshot)] = function(begin, duration)
|
||||
if begin then
|
||||
-- cast time is 1sec, however it takes 1.4sec to fire in average
|
||||
local duration = libcast.ApplyShotHaste(duration or 1400)
|
||||
|
||||
local _,_, lag = GetNetStats()
|
||||
local start = GetTime() + lag/1000
|
||||
|
||||
-- add cast action to the database
|
||||
libcast.db[player].cast = trueshot
|
||||
libcast.db[player].rank = lastrank
|
||||
libcast.db[player].start = start
|
||||
libcast.db[player].casttime = duration
|
||||
libcast.db[player].icon = "Interface\\Icons\\Ability_hunter_steadyshot"
|
||||
libcast.db[player].channel = nil
|
||||
else
|
||||
-- remove cast action to the database
|
||||
libcast.db[player].cast = nil
|
||||
libcast.db[player].rank = nil
|
||||
libcast.db[player].start = nil
|
||||
libcast.db[player].casttime = nil
|
||||
libcast.db[player].icon = nil
|
||||
libcast.db[player].channel = nil
|
||||
end
|
||||
local steadyShot = CreateFrame("Frame")
|
||||
steadyShot:RegisterEvent("SPELL_QUEUE_EVENT")
|
||||
steadyShot:SetScript("OnEvent", function()
|
||||
if event ~= "SPELL_QUEUE_EVENT" then return end
|
||||
local eventCode, spellId = arg1, arg2
|
||||
if eventCode ~= ON_SWING_QUEUED and eventCode ~= ON_SWING_QUEUE_POPPED then return end
|
||||
if C_Spell.GetSpellName(spellId) ~= steadyShotName then return end
|
||||
if eventCode == ON_SWING_QUEUED then
|
||||
local now = GetTime() * 1000
|
||||
pfUI.synthetic_casts["player"] = {
|
||||
name = steadyShotName,
|
||||
icon = STEADY_SHOT_ICON,
|
||||
startMs = now,
|
||||
endMs = now + STEADY_SHOT_DURATION_MS,
|
||||
spellID = spellId,
|
||||
}
|
||||
else
|
||||
pfUI.synthetic_casts["player"] = nil
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- add skin to twow's talent inspect frame
|
||||
if pfUI.skin["Inspect"] and pfUI_config["disabled"]["skin_Inspect"] ~= "1" then
|
||||
|
||||
Reference in New Issue
Block a user