Skip to content

Split EllesmereUIBlizzardSkin.lua into six files - #2730

Open
JuJuFX-dev wants to merge 5 commits into
EllesmereGaming:mainfrom
JuJuFX-dev:refactor/blizzardskin-main-split
Open

JuJuFX-dev wants to merge 5 commits into
EllesmereGaming:mainfrom
JuJuFX-dev:refactor/blizzardskin-main-split

Conversation

@JuJuFX-dev

Copy link
Copy Markdown
Contributor

What does this PR do?

Nothing changes for the player. EllesmereUIBlizzardSkin.lua (5,037 lines) becomes six files that load in the same order the code had inside the one file. This file was not near the 200-local limit (56 active chunk locals at most); the gain is readability: one feature area per file instead of fifteen unrelated blocks in one.

File Lines What it holds
EllesmereUIBlizzardSkin.lua 468 client gate, module namespace, FFD/GetFFD, window skin styles and looks, the one-time style seed
EUI_BlizzardSkin_TooltipSkin.lua 1,795 the tooltip skin with static popups, context menus, the resurrect glow and the LFG queue popup
EUI_BlizzardSkin_Dialogs.lua 473 Quick Keybind frame, premade group invite, LFG application dialog, game menu
EUI_BlizzardSkin_TooltipAnchor.lua 516 UberTooltips CVar, anchor to cursor, fixed position with its Unlock Mode mover, growth direction
EUI_BlizzardSkin_TooltipVisibility.lua 553 Show Tooltips mode with the peek modifier and comparison cleanup, unit health strip
EUI_BlizzardSkin_HUD.lua 1,325 tooltip progress and status bars, UI widget status bars, extra action button

The cut is a chain in source order: the six files concatenated are the old file. Every cut lies between two top-level statements, so no do block and neither of the two ;(function() ... end)() wrappers is opened. Because the files load back to back in the .toc, directly behind the main file and before EllesmereUIBlizzardSkin_DiminishingReturns.lua, every frame is created, every event registered and every hooksecurefunc/HookScript installed in the same order and at the same time as before (31 hooksecurefunc calls before, 31 after). The comment in the fixed-position block that asks for its hook to register before the growth-direction hook still holds: both blocks sit in EUI_BlizzardSkin_TooltipAnchor.lua in their old order.

Five commits, meant to be read separately:

  1. Move the Blizzard Skin code into five new files (verbatim): a byte-exact move, no line changed. This commit does not load on its own (the new files are not in the .toc yet, and two of them open with ;(function(), which only compiles once a head stands in front of it).
  2. Wire the Blizzard Skin files through ns._internals: the head of each new file, a guard table at the end of the main file, five .toc lines, eight comment lines whose "below" or "this file" pointed across a file boundary.
  3. Blizzard Skin split: point four comments at the files that hold the code: comment text only, one line in EUI_BlizzardSkin_HUD.lua, one in EllesmereUIBlizzardSkin_WindowPacks.lua, two in EUI_BlizzardSkin_Options.lua.
  4. Blizzard Skin split: review follow-ups: the load guard described below, ns bound once at the top of the main file instead of three select(2, ...) reads, the lazy engine lookup in EUI_BlizzardSkin_HUD.lua reads ns.WSkin directly, and one comment line in EllesmereUI.lua names the file that now holds the game menu skin.
  5. Regenerate the locale key list: EllesmereUILocales/_keys.txt as the CI script writes it from a clean checkout; only the count in its header changes (1306 to 1308), a drift that came in with upstream/main, not from this branch.

The wiring is the pattern of the Raid Frames and Cooldown Manager splits, in its smallest form. No chunk local of the old file is written across a cut, so there is no setter list at all. The new files read exactly two names from the main file, FFD and GetFFD, through ns._internals. The table has an error metatable, so a missing name fails where the file loads instead of as a nil upvalue later.

The load guard keeps the old failure behaviour: in one file, anything that stopped the load (a runtime error, or a compile error such as a blown local limit) took everything after it down too. Here every file checks at its first lines that the file before it loaded to its end (I.last), and records itself at its own end. So a file that errors, does not compile or is missing from the install stops the files behind it, instead of leaving later hooks installed that call functions an earlier file never defined. This differs from the broken flag of the earlier splits, which only catches a runtime error.

In the moved bodies exactly one statement changed, in WS() of EUI_BlizzardSkin_HUD.lua: _WS = ns.WSkin replaces the lookup of the same table through EllesmereUI._ModuleNS[ADDON_NAME]. In the main file, lines 8, 10 and 11 now share one ns binding. Everything else outside the heads and the table is comment text.

How was it tested?

Tested in-game on live.

Checklist

  • New settings default OFF (no behavior change without opt-in): N/A, no new setting
  • Zero cost while disabled: no events registered, no polling, no hooks doing work, no frames built: N/A, no new frame, event or hook; the existing ones are created by the same lines in the same order
  • Cheap while enabled: event-driven (no polling, no timer-based logic, no per-frame allocations): N/A, no new runtime code; the new files import two locals once at load
  • No writes onto Blizzard-owned frames (weak-table pattern used); HookScript/hooksecurefunc only, never SetScript on Blizzard frames: unchanged, every hook line moved verbatim; the guard table is a plain Lua table on the addon namespace
  • Tested in-game on live; no version gates or pre-Midnight APIs added

The load guard also stops the chain when a file is missing or does not compile, the main file binds ns once, the HUD engine lookup reads ns.WSkin, and one core comment names the new file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant