Files
mikeandClaude Opus 5.5 f1eca2d1c5 Fehler aus dem Code-Review behoben, Tests hinzugefügt
Leistenabstand: Leere, ausgeblendete Slots ("Immer Buttons anzeigen" aus)
werden mit angeordnet. Vorher wurde ihre Lücke zugeschoben, und sobald
sie wieder erschienen, lagen sie fast genau auf dem Nachbarbutton.
Buttons jenseits von "Anzahl Symbole" bleiben außen vor (numShowingButtons,
sonst bis zum letzten sichtbaren Button). Die Haltungsleiste ordnet weiter
nur sichtbare Buttons an.

Goldbeutel: "Diese Sitzung" läuft über /reload weiter (Startwert pro
Charakter gespeichert, Reset nur bei echtem Login). /gold forget findet
auch Namen mit Umlauten und Akzenten unabhängig von Groß-/Kleinschreibung.

ForeverScale: /fscale pixel ist jetzt ein Modus und wird bei jedem
Auflösungswechsel neu berechnet. Kann absichtlich unter 0,30 liegen.

README: Quellcode-Anhang auf den neuen Stand gebracht.
tests/: Mock-Tests für alle drei Addons (luajit tests/<datei>.lua).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 12:02:06 +01:00

84 lines
2.6 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, worked out
-- again whenever the resolution changes. Not limited to
-- 0.30 - 1.50, so on 5K/6K screens it goes below 0.30.
-- /fscale reset stop overriding (then /reload)
local ADDON = ...
local f = CreateFrame("Frame")
-- the scale to enforce, or nil if there is no override
local function target()
local db = ForeverScaleDB
if not db then return end
if db.pixel then
local _, h = GetPhysicalScreenSize()
if h and h > 0 then return 768 / h end
return
end
return db.scale
end
local function apply()
local s = target()
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, ForeverScaleDB.pixel = nil, nil
print("ForeverScale: override cleared. /reload to return to Blizzard's scale.")
return
elseif msg == "pixel" then
ForeverScaleDB.scale, ForeverScaleDB.pixel = nil, true
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, ForeverScaleDB.pixel = v, nil
end
apply()
print(string.format("ForeverScale: scale set to %.4f%s%s", target() or UIParent:GetScale(),
ForeverScaleDB.pixel and " (pixel, follows your resolution)" or "",
InCombatLockdown() and " (applies after combat)" or ""))
end