mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-21 23:26:56 +00:00
f497c71523
Eight commits off classicapi_next. ClassicAPI's RegisterUnitEvent registers for an event but only delivers it when arg1 is one of the given units, so a handler for one unit stops waking for every other one in the world. The 26 registrations whose unit set is fixed at registration time now name it. The rule throughout is register the superset and keep the handler's own check -- the filter narrows what arrives, it does not decide what to act on. Guards that look unreachable stay put: the filter applies only when arg1 is a string, so an event that fires with a number or no argument is delivered as if plainly registered. Frames whose unit changes at runtime own their subscriptions instead of sorting events out per event. unitframes points them at the unitstr UpdateVisibility already computes -- replacing a string concat, and on a miss a second concat plus a UnitGUID call, for every frame on every unit event in the world -- and a frame that is not in use drops its unit events entirely. nameplates registers per plate against the plate's own token, which is also the only workable shape: slots have no cap, so any nameplate1..N list would have been a guess that fails in exactly the crowded scenes where plates matter. marktracking names mark1 through mark8. A registration keeps its kind, so none of these can be plain-registered first. Both teardown paths PLAYER_LOGOUT guards -- the crash 132 -- now cover the per-frame subscriptions: plates tear down rather than dispatching through logout, and a unit frame takes itself off the visibility scan so it cannot re-register what it just dropped. marktracking also drops its once-a-second full rebuild, which ran for the whole session whether or not a marker existed anywhere. The ticker is created and cancelled with group membership. It is deliberately not keyed on a mark being visible -- a marker on an out-of-range unit shows no row, and that is the case the poll exists to catch. nameplates gates the per-plate update against the floor across all four throttle categories before classifying it, instead of running a GetAlpha, a castbar IsShown, a cast lookup and up to two libthrottle:Get resolutions on plates throttled to 10fps that were going to return anyway. Nothing that would have updated can be turned away by a floor. The four throttles resolve in CacheConfig, where config changes already land. energytick sweeps the clock the server actually runs. There is one regen timer for every power, re-armed every 2s by Player::RegenerateAll and never touched by casting; the five-second rule changes what a tick pays, not when it lands. The sweep is a free-running phase lock on that clock, so Illumination refunds, potions and a Mana Spring totem on its own phase no longer snap the spark mid-cycle, and an 80ms band keeps a correct tick from hitching it at the wrap. The FSR window shades rather than predicting a share of spirit the client cannot compute -- the Casting Regen item ladder is equip auras absent from the buff list. The energy period is summed from SPELL_AURA_MOD_ENERGY_REGEN_TIME across the spellbook and buffs, so Blade Rush is found without GetTalentInfo(2, 16), an ordinal that does not fail when the tree changes but reads another talent's rank. macrotweak is gone -- ClassicAPI 1.15 covers it -- with its config entry, its GUI block, its translations in all eight locales, and actionbar's ButtonMacroScan, the #showtooltip scanner that fed it.
79 lines
3.3 KiB
Lua
79 lines
3.3 KiB
Lua
do
|
|
-- ClassicAPI dependency gate.
|
|
--
|
|
-- Which TOC the client opened already answers "is ClassicAPI here?". Whenever
|
|
-- the DLL is loaded it redirects the read of `pfUI\pfUI.toc` to
|
|
-- `pfUI_Turtle.toc` (Turtle clients) or `pfUI_ClassicAPI.toc` (everything
|
|
-- else). Reaching this file from the plain `pfUI.toc` therefore means
|
|
-- ClassicAPI is absent -- and that TOC deliberately loads nothing but this
|
|
-- file, so there is nothing to disable, only a notice to show.
|
|
--
|
|
-- The flavor TOCs still need a version gate of their own: the redirect has
|
|
-- existed since ClassicAPI v1.11.0, well below the API surface pfUI relies
|
|
-- on. There pfUI does load, and will throw wherever it reaches for something
|
|
-- the installed DLL doesn't have yet -- the popup names the cause so those
|
|
-- errors aren't a mystery.
|
|
local PFUI_CLASSIC_API_MIN = 11500 -- (X*10000 + Y*100 + Z)
|
|
local PFUI_CLASSIC_API_LATEST = PFUI_CLASSIC_API_MIN
|
|
local PFUI_CLASSIC_API_WEBSITE = "https://github.com/brues-code/ClassicAPI"
|
|
local PFUI_CLASSIC_API_LATEST_URL = PFUI_CLASSIC_API_WEBSITE .. "/releases/latest"
|
|
local function FormatVersion(packed)
|
|
local x = math.floor(packed / 10000)
|
|
local y = math.floor(math.mod(packed, 10000) / 100)
|
|
local z = math.mod(packed, 100)
|
|
return string.format("v%d.%d.%d", x, y, z)
|
|
end
|
|
|
|
local headline, detail
|
|
if not CLASSIC_API_VERSION then
|
|
headline = "|cff33ffccpf|cffffffffUI|r has been disabled."
|
|
detail = "The ClassicAPI DLL isn't loaded. Download the latest release from:"
|
|
elseif CLASSIC_API_VERSION < PFUI_CLASSIC_API_MIN then
|
|
headline = "|cff33ffccpf|cffffffffUI|r will not work correctly on ClassicAPI " .. FormatVersion(CLASSIC_API_VERSION) .. "."
|
|
detail = FormatVersion(PFUI_CLASSIC_API_MIN) .. " or newer is required -- any errors alongside this one are the APIs it is missing. Download the latest release from:"
|
|
end
|
|
|
|
if detail then
|
|
local function ShowRequiredPopup()
|
|
StaticPopupDialogs["PFUI_CLASSICAPI_REQUIRED"] = {
|
|
text = headline .. "\n\n" .. detail,
|
|
button1 = OKAY,
|
|
hasEditBox = 1,
|
|
editBoxWidth = 280,
|
|
timeout = 0,
|
|
whileDead = 1,
|
|
hideOnEscape = 1,
|
|
preferredIndex = 3,
|
|
OnShow = function()
|
|
local editBox = getglobal(this:GetName().."EditBox")
|
|
if editBox then
|
|
editBox:SetText(PFUI_CLASSIC_API_LATEST_URL)
|
|
editBox:HighlightText()
|
|
editBox:SetFocus()
|
|
end
|
|
end,
|
|
}
|
|
StaticPopup_Show("PFUI_CLASSICAPI_REQUIRED")
|
|
DEFAULT_CHAT_FRAME:AddMessage(
|
|
headline .. " " .. detail .. " " .. PFUI_CLASSIC_API_LATEST_URL,
|
|
1, 0.3, 0.3
|
|
)
|
|
end
|
|
local loginFrame = CreateFrame("Frame")
|
|
loginFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
|
loginFrame:SetScript("OnEvent", function()
|
|
loginFrame:UnregisterEvent("PLAYER_ENTERING_WORLD")
|
|
ShowRequiredPopup()
|
|
end)
|
|
elseif CLASSIC_API_VERSION < PFUI_CLASSIC_API_LATEST then
|
|
EventUtil.ContinueOnPlayerLogin(function()
|
|
C_Timer.After(8, function()
|
|
DEFAULT_CHAT_FRAME:AddMessage(
|
|
"|cff33ffccpf|rUI: ClassicAPI " .. FormatVersion(PFUI_CLASSIC_API_LATEST) .. " is available — " .. PFUI_CLASSIC_API_LATEST_URL,
|
|
1, 0.85, 0.3
|
|
)
|
|
end)
|
|
end)
|
|
end
|
|
end
|