Files
moon-well-ui/data/addon/ForeverUI/Achievements.lua
T
Adrestie 5842eb7a2b ForeverUI : code en anglais, commentaires resserres, code mort retire
Traduction
- Identifiants en anglais dans tout le module : addon, ecrans d'accueil,
  outils Python, banc d'essai et patcheur C#.
- Fichiers au nom francais renommes (Gabarits.lua -> Templates.lua,
  Textes_*.lua -> Texts_*.lua, deployer.py -> deploy.py,
  tools/patcheur -> tools/patcher, etc.).
- Commandes /fui et options de deploy.py en anglais (--check, --server,
  --remove-dbc).
- Cles des variables sauvegardees et de data/dbc/statistics.json
  traduites, sans reprise des anciennes cles.
- API de la micro-barre : ForeverUI.AddMicroButton(def) avec les champs
  name, atlasSet, after, tooltip, onClick, ready, et
  ForeverUI.UpdateMicro(name, isOpen).
- Commentaires reecrits en anglais, courts, sans dates ni historique ;
  les fonctions au nom peu parlant et leurs parametres sont expliques.

Code mort
- Exports, fonctions et variables jamais lus retires.
- Retires a la demande des modules : ForeverUI.PvPJauge, les exports
  FondEntete / TuilerEntete / Polices de TradeSkill, l'art legacy-up-c60,
  honorfill(half)blue et inv_misc_book_09, leurs entrees d'atlas et les
  parties d'outils correspondantes.

Verifications : liaisons des noms comparees avant et apres, banc vert,
chemins de textures inchanges, generateurs reproduisant les fichiers,
patcheur identique octet pour octet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 09:15:52 +02:00

70 lines
2.1 KiB
Lua

-- ForeverUI: makes the achievement window (Blizzard_AchievementUI, load-on-demand) movable.
-- camelot has no achievement UI, so the window keeps its 3.3.5 look and stays a UI panel.
-- The panel system (UpdateUIPanelPositions) re-anchors it on every panel open or close, so
-- the saved place (ForeverUIDB.positions) is applied again after it and on show.
local ForeverUI = ForeverUI or {}
_G.ForeverUI = ForeverUI
local A = {}
ForeverUI.Achievements = A
local KEY = "achievements"
-- Saved window positions (ForeverUIDB.positions), created on first use.
local function positions()
ForeverUIDB = ForeverUIDB or {}
ForeverUIDB.positions = ForeverUIDB.positions or {}
return ForeverUIDB.positions
end
-- Anchors the window's top centre at its saved place, as WindowStack.lua does.
function A.Reposition()
local f = AchievementFrame
local p = positions()[KEY]
if not f or not p then return end
f:ClearAllPoints()
f:SetPoint("TOP", UIParent, "TOP", p.x, p.y)
end
-- Makes the window movable by its header, once. No secure code, so it also works in combat.
function A.Skin()
local f = AchievementFrame
local handle = AchievementFrameHeader
if not f or not handle or f.foreverMovable then return end
f.foreverMovable = true
f:SetMovable(true)
f:SetClampedToScreen(true)
handle:EnableMouse(true)
handle:RegisterForDrag("LeftButton")
handle:SetScript("OnDragStart", function()
f:StartMoving()
end)
handle:SetScript("OnDragStop", function()
f:StopMovingOrSizing()
local cx = f:GetCenter()
local ux = UIParent:GetCenter()
local x, y = cx - ux, f:GetTop() - UIParent:GetTop()
f:ClearAllPoints()
f:SetPoint("TOP", UIParent, "TOP", x, y)
-- we save the place ourselves: keep the client from saving it too
if f.SetUserPlaced then f:SetUserPlaced(false) end
positions()[KEY] = { x = x, y = y }
end)
f:HookScript("OnShow", A.Reposition)
hooksecurefunc("UpdateUIPanelPositions", function()
if f:IsShown() then A.Reposition() end
end)
A.Reposition()
end
A.Skin()
local watcher = CreateFrame("Frame")
watcher:RegisterEvent("ADDON_LOADED")
watcher:SetScript("OnEvent", function(_, _, name)
if name == "Blizzard_AchievementUI" then
A.Skin()
end
end)