7 Commits
Author SHA1 Message Date
dfj d8fefc947e Close the window when Escape is pressed
Register the main frame ("AmibisMainFrame") in UISpecialFrames so Escape
hides it and suppresses the game menu while it is open, matching the
default UI panels.

Move the stats-retry timer cleanup into the frame's OnHide script so the
close button, Escape, and /amibis all stop the timer.

Tests: the mock now registers named frames in _G and runs OnHide scripts.
The UI suite simulates FrameXML's CloseSpecialWindows() and asserts the
frame hides and the retry timer is cleared. 108 passing.
2026-10-24 13:57:09 +02:00
dfj cc3971fe93 Fix stat panel not rebuilding when switching specs
RebuildStatRows hid the previous rows through vals.label, but StatValues
never stored the label font string. The first spec change that altered
the stat keys raised "attempt to index a nil value (field 'label')",
aborting RefreshUI before the new rows were created. The previous spec's
panel stayed on screen, so a Holy priest kept seeing Shadow's
"+Spell Damage" row instead of "+Healing".

Store the label in StatValues so old rows hide correctly and the panel
rebuilds with the new spec's profile.

Add a UI smoke test using mocked frames (font strings now record
text/shown; frames track Show/Hide/IsShown). It switches Shadow -> Holy
and asserts the visible rows change; with the bug reverted it fails with
the same nil-label error.

Also print usage for a bare "/amibis spec" instead of toggling the
window, which was a surprising side effect and made tests order-dependent.

107 passing.
2026-10-24 13:42:08 +02:00
dfj 5fba4ac10c Keep latest-phase progress independent of the selected phase
The bar could change when switching phases: latestCompletionRatio was nil
until the selected phase's stats were complete AND the latest list was
cached, and the UI then fell back to the selected phase's own completion
ratio. Right after login the latest list's items are often not cached
yet, so switching phases visibly moved the bar.

Always compute a latest-phase ratio inside CompareGear: stats-based when
both the latest list and the equipped items are cached, otherwise slot
completion against the latest list. Return latestStatsComplete so the UI
can mark the estimate with "~" and keep retrying until stats load
(capped at 20 attempts). The UI now uses latestCompletionRatio directly
instead of falling back to the selected phase.

Also refresh on PLAYER_EQUIPMENT_CHANGED so gear swaps update the bar.

Tests: phase-independent ratio, slot-based fallback while the latest
list is uncached, and equal ratios across selected phases once cached.
106 passing.
2026-10-24 13:37:33 +02:00
dfj b66491c5be Tailor stat comparison and scoring to each spec
Replace the flat per-spec key list with SPEC_STAT_PROFILES: an ordered
{ stat, weight } table for every class/spec. The panel now shows what
matters to the selected spec instead of falling back to spell stats for
physical specs: casters get spell damage/hit/crit/haste, melee get
strength/AP/hit/expertise/armor pen, tanks get stamina/armor/defense/
dodge/parry/block, healers get healing/spirit/MP5.

The same weights drive upgrade ranking, the completion ratio, and which
two gains are shown in the top-upgrades line, so e.g. spell damage
outweighs spirit for Shadow while stamina outweighs expertise for a
Protection tank.

Add GetItemStats mappings for physical stats (attack power, ranged/feral
AP, strength, agility, hit, expertise, armor pen, defense, dodge, parry,
block, block value, armor). TBC per-school hit/crit/haste keys fold into
one stat. Drop the unused spellPower row from TBC profiles.

Tests: weighted scoring expectations, physical/tank mappings, profile
coverage and 8-row panel limit, weighted ratios. 104 passing.
2026-10-24 01:00:24 +02:00
dfj c59a705d05 Add T4/T6 phase data, phase selector bar, and latest-phase progress
Data: T4 (Karazhan/Gruul/Magtheridon) and T6 (Black Temple/Hyjal) BiS
lists for all 9 classes x 3 specs, sourced from wowtbc.gg page-data
JSON. Phase registry gains PHASE_ORDER-driven ordering, GetLatestPhase
and ResolvePhase fallback. Stat scanning takes MAX across all alias-key
stats (spell damage schools, healing, haste/crit/mp5 ratings).

UI: horizontal phase selector bar between title and summary with a
progress fill that measures completion against the latest available
phase regardless of the selected phase. CompareGear returns latestPhase
and latestCompletionRatio; GetCompletionRatio delegates to a new
StatRatio helper. Default phase switched to T6.
2026-10-11 15:59:32 +02:00
dfj 5ff421bd09 Add spec-aware stats panel, top upgrades display, and wider source column 2026-06-17 20:14:54 +02:00
dfj 5284007998 Initial publication 2026-06-04 00:04:49 +02:00