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>
This commit is contained in:
mikeandClaude Opus 5.5 committed 2026-11-24 12:02:06 +01:00
1 parent da38820c2e
commit f1eca2d1c5
7 files changed
+425 -50

No files matched your search

+28 -4
View File
@@ -48,9 +48,22 @@ local function classColored(name, class)
return name
end
-- string.lower kennt nur A-Z. Fuer Namen wie "Ärger" auch À-Þ (UTF-8 C3 80-9E,
-- ausser ×) in Kleinbuchstaben umwandeln.
local function lower(s)
return (s:lower():gsub("\195([\128-\158])", function(c)
if c ~= "\151" then return "\195" .. string.char(c:byte() + 32) end
end))
end
-- Felder aktualisieren statt den Eintrag zu ersetzen, damit der
-- Sitzungsstart (session) erhalten bleibt
local function record()
local chars = db.chars[realm]
local me = chars[player] or {}
chars[player] = me
local _, class = UnitClass("player")
db.chars[realm][player] = { money = GetMoney(), class = class }
me.money, me.class = GetMoney(), class
end
local function update()
@@ -171,7 +184,8 @@ ev:RegisterEvent("ADDON_LOADED")
ev:RegisterEvent("PLAYER_LOGIN")
ev:RegisterEvent("PLAYER_MONEY")
ev:RegisterEvent("PLAYER_LOGOUT")
ev:SetScript("OnEvent", function(self, event, arg1)
ev:RegisterEvent("PLAYER_ENTERING_WORLD")
ev:SetScript("OnEvent", function(self, event, arg1, arg2)
if event == "ADDON_LOADED" then
if arg1 ~= ADDON then return end
GoldbeutelDB = GoldbeutelDB or {}
@@ -184,6 +198,16 @@ ev:SetScript("OnEvent", function(self, event, arg1)
sessionStart = GetMoney()
createFrame()
update()
elseif event == "PLAYER_ENTERING_WORLD" then
-- PLAYER_LOGIN kommt auch bei /reload. Erst hier steht fest, ob es nur ein
-- Reload war (arg2 = isReloadingUi); dann zaehlt die Sitzung weiter.
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
local me = db.chars[realm][player]
if arg2 and me.session then
sessionStart = me.session
else
me.session = sessionStart
end
elseif event == "PLAYER_MONEY" then
if frame then update() end
elseif event == "PLAYER_LOGOUT" then
@@ -209,9 +233,9 @@ SlashCmdList.GOLDBEUTEL = function(input)
frame:Show()
say("Position zurückgesetzt.")
elseif cmd == "forget" and arg ~= "" then
local chars = db.chars[realm]
local chars, want = db.chars[realm], lower(arg)
for name in pairs(chars) do
if name:lower() == arg:lower() and name ~= player then
if lower(name) == want and name ~= player then
chars[name] = nil
say(name .. " entfernt.")
return