Commit Graph
16 Commits
Author SHA1 Message Date
dfj 1fda0d3817 Allow manual runs of the test workflow
Lua tests / test (push) Failing after 51s
2026-10-24 15:56:05 +02:00
dfj f46b039328 Run the test suite in Gitea Actions on every push
Lua tests / test (push) Failing after 56s
Add .gitea/workflows/tests.yaml per the Gitea Actions quick start:
check out the repo, install Lua 5.4, then run the offline suite
(lua5.4 Amibis/Tests/run.lua). A failed test fails the job.

Document the workflow in README, AGENTS.md, and the tests README.
2026-10-24 15:53:04 +02:00
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 e08e288f73 Read TBC school-specific haste and crit item stats
TBC items report per-school ratings with a different key shape than the
WotLK-era names the addon mapped: "spell haste" is
ITEM_MOD_HASTE_SPELL_RATING(_SHORT), not ITEM_MOD_SPELL_HASTE_RATING,
and crit is ITEM_MOD_CRIT_SPELL_RATING/MELEE/RANGED rather than
ITEM_MOD_SPELL_CRIT_RATING. As a result spell haste (and spell/melee
crit) on TBC gear scanned as zero, so the stats panel showed no haste
and upgrade scoring ignored it.

Map the TBC haste/crit keys alongside the existing generic ones, plus
non-_SHORT variants for safety. The alias logic still takes MAX per
stat, so an item that reports both forms is not double counted.

Tests cover TBC spell haste + crit, melee/ranged haste keys, and
generic+school-specific de-duplication. 96 passing.
2026-10-24 00:50:02 +02:00
dfj 912ed8f255 Fix /amibis spec clear being stored as a spec override
The generic "spec <name>" branch matched before the "spec clear" check,
so clearing an override set overrideSpec to "Clear" and the UI then
looked for a spec called Clear instead of falling back to auto-detection.

Check the clear command first, collapse whitespace so "spec   clear"
parses, and refresh the frame immediately when the override changes.
Spec names are also title-cased per word now, so "/amibis spec beast
mastery" resolves to "Beast Mastery".

Add test_slash.lua covering set/clear, case/whitespace normalization,
and the clear-as-spec-name regression. 93 tests passing.
2026-10-24 00:45:28 +02:00
dfj 907d274b3a Add ZA (Phase 4) BiS lists for all specs
Populate Zul'Aman gear for all 9 classes x 3 specs from the wowtbc.gg
page-data JSON, using the same per-phase `bis` extraction (group/raid
variant preferred) as the earlier tiers. ZA becomes the fourth phase in
PHASE_ORDER and the new default, so the progress bar now measures
completion against ZA.

Shared lists mirror the existing phase conventions: Discipline = Holy,
BM = MM, Combat = Subtlety, and all three warlock specs share one ZA
list. Relic entries (idols/librams/totems) stay omitted like T4-T6.

Two source corrections are folded in: one site data bug where Holy
Paladin's ZA main hand pointed at Hammer of Sanctification (Sunwell
only) is replaced with the T6 pick, Crystal Spire of Karabor, and
canonical item names replace the site's case/typo variants.

Tests: 88 passing, including ZA coverage, shared-list invariants, and
latest-phase progress against ZA.
2026-10-24 00:42:37 +02:00
dfj 48040c3ae1 Refresh T5 BiS lists from wowtbc.gg and normalize source formatting
All 20 T5 tables regenerated from the current wowtbc.gg page-data
JSON (same group/raid-variant extraction as T4/T6): fixes 9 stale items
(Quagmirran's Eye trinket, Corruptor set, Shapeshifter's Signet,
Ranger-General's Chestguard, Band of Eternity v2, etc.) and aligns
slot sets with the site's default view. Warlock T5 now splits:
Affliction gets WARLOCK_AFFLICTION_T5 (Corruptor), Demonology and
Destruction keep Voidheart. Source strings normalized: quest rewards
and dungeon bosses dash-joined, professions space-joined, site typos
folded (Mother Sharaz, Karanthress, Blood Furnace HC). 81 tests.
2026-10-11 16:41:29 +02:00
dfj 7fda3db472 Add offline unit test suite for data and core logic
76 tests covering BIS data integrity (all classes/specs/phases, slot
shape, spot checks), ScanItemStats alias aggregation (Frozen
Shadoweave double-count regression), CompareGear upgrade ranking with
spec-specific stat keys, phase resolution, and latest-phase completion.
Runs with any Lua 5.3+ interpreter via mocked WoW API; no client
required. Not referenced in the .toc.
2026-10-11 16: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 0e7a0c909a Add per-spec stat scoring and top upgrades computation 2026-06-17 20:14:54 +02:00
dfj 87059f128d Update AGENTS.md
Update to reflect the addition of other spec's bis lists
2026-06-04 00:29:22 +02:00
dfj 5284007998 Initial publication 2026-06-04 00:04:49 +02:00