From 465ad13e9af39faceb216191bb6da3c7dca1680f Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Wed, 17 Jun 2026 21:15:07 -0500 Subject: [PATCH] pfUI: derive ClassicAPI version string from PFUI_CLASSIC_API_MIN The popup text and chat message both had hard-coded "v1.2.0" strings that fell out of sync every time the constant bumped. Decode the packed X*10000 + Y*100 + Z form into "vX.Y.Z" via a FormatVersion helper and substitute it into both messages. The edit-box URL also deep-links to the matching releases/tag/ page so users land directly on the release they need. --- pfUI.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pfUI.lua b/pfUI.lua index 9699b4c2..41c0ad45 100644 --- a/pfUI.lua +++ b/pfUI.lua @@ -27,14 +27,21 @@ pfUI.bootup = true -- pfUI relies pervasively on the modern C_* / SuperWoW / nameplate / focus -- API surface that ClassicAPI polyfills, so presence is required. local PFUI_CLASSIC_API_MIN = 10314 -- v1.3.14 (X*10000 + Y*100 + Z) +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 if not CLASSIC_API_VERSION or CLASSIC_API_VERSION < PFUI_CLASSIC_API_MIN then pfUI.disabled = true + local minVersion = FormatVersion(PFUI_CLASSIC_API_MIN) local alertFrame = CreateFrame("Frame") alertFrame:RegisterEvent("PLAYER_LOGIN") alertFrame:SetScript("OnEvent", function() StaticPopupDialogs["PFUI_CLASSICAPI_REQUIRED"] = { - text = "This fork of |cff33ffccpf|cffffffffUI|r requires ClassicAPI\n v1.2.0 or newer.\n\nAll |cff33ffccpf|cffffffffUI|r modules have been disabled.\nInstall ClassicAPI from:", + text = "This fork of |cff33ffccpf|cffffffffUI|r requires ClassicAPI\n " .. minVersion .. " or newer.\n\nAll |cff33ffccpf|cffffffffUI|r modules have been disabled.\nInstall ClassicAPI from:", button1 = OKAY, hasEditBox = 1, editBoxWidth = 280, @@ -45,7 +52,7 @@ if not CLASSIC_API_VERSION or CLASSIC_API_VERSION < PFUI_CLASSIC_API_MIN then OnShow = function() local editBox = _G[this:GetName().."EditBox"] if editBox then - editBox:SetText("https://github.com/brues-code/ClassicAPI") + editBox:SetText("https://github.com/brues-code/ClassicAPI/releases/tag/" .. minVersion) editBox:HighlightText() editBox:SetFocus() end @@ -54,7 +61,7 @@ if not CLASSIC_API_VERSION or CLASSIC_API_VERSION < PFUI_CLASSIC_API_MIN then StaticPopup_Show("PFUI_CLASSICAPI_REQUIRED") if DEFAULT_CHAT_FRAME then DEFAULT_CHAT_FRAME:AddMessage( - "This fork of pfUI requires ClassicAPI v1.2.0+. Get it at https://github.com/brues-code/ClassicAPI", + "This fork of pfUI requires ClassicAPI " .. minVersion .. "+. Get it at https://github.com/brues-code/ClassicAPI/releases/tag/" .. minVersion, 1, 0.3, 0.3 ) end