ForeverScale, Goldbeutel und Leistenabstand mit dem Chatverlauf im README, Stand 23.11.2026, vor dem Code-Review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
70 lines
2.1 KiB
Lua
70 lines
2.1 KiB
Lua
-- ForeverScale: re-applies a fixed UIParent scale on every login/reload,
|
|
-- so values below Blizzard's 0.64 slider floor stick.
|
|
-- /fscale 0.5333 set a scale (0.30 - 1.50), saved account-wide
|
|
-- /fscale pixel pixel-perfect: 768 / your vertical resolution
|
|
-- /fscale reset stop overriding (then /reload)
|
|
|
|
local ADDON = ...
|
|
local f = CreateFrame("Frame")
|
|
|
|
local function apply()
|
|
local s = ForeverScaleDB and ForeverScaleDB.scale
|
|
if not s then return end
|
|
if InCombatLockdown() then
|
|
-- UIParent has protected children; wait until combat ends
|
|
f:RegisterEvent("PLAYER_REGEN_ENABLED")
|
|
return
|
|
end
|
|
if math.abs(UIParent:GetScale() - s) > 0.0001 then
|
|
UIParent:SetScale(s)
|
|
end
|
|
end
|
|
|
|
f:RegisterEvent("ADDON_LOADED")
|
|
f:RegisterEvent("PLAYER_LOGIN")
|
|
f:RegisterEvent("PLAYER_ENTERING_WORLD")
|
|
f:RegisterEvent("UI_SCALE_CHANGED")
|
|
f:RegisterEvent("DISPLAY_SIZE_CHANGED")
|
|
|
|
f:SetScript("OnEvent", function(self, event, arg1)
|
|
if event == "ADDON_LOADED" then
|
|
if arg1 == ADDON then
|
|
ForeverScaleDB = ForeverScaleDB or {}
|
|
self:UnregisterEvent("ADDON_LOADED")
|
|
end
|
|
return
|
|
end
|
|
if event == "PLAYER_REGEN_ENABLED" then
|
|
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
|
|
end
|
|
-- Blizzard may re-apply its own scale during these events; go after it
|
|
C_Timer.After(0, apply)
|
|
end)
|
|
|
|
SLASH_FOREVERSCALE1 = "/fscale"
|
|
SlashCmdList.FOREVERSCALE = function(msg)
|
|
msg = strtrim(msg or ""):lower()
|
|
|
|
if msg == "reset" then
|
|
ForeverScaleDB.scale = nil
|
|
print("ForeverScale: override cleared. /reload to return to Blizzard's scale.")
|
|
return
|
|
elseif msg == "pixel" then
|
|
local _, h = GetPhysicalScreenSize()
|
|
ForeverScaleDB.scale = 768 / h
|
|
else
|
|
local v = tonumber(msg)
|
|
if not v or v < 0.3 or v > 1.5 then
|
|
print(string.format(
|
|
"ForeverScale: /fscale <0.30-1.50> | pixel | reset (current %.4f)",
|
|
UIParent:GetScale()))
|
|
return
|
|
end
|
|
ForeverScaleDB.scale = v
|
|
end
|
|
|
|
apply()
|
|
print(string.format("ForeverScale: scale set to %.4f%s", ForeverScaleDB.scale,
|
|
InCombatLockdown() and " (applies after combat)" or ""))
|
|
end
|