using AcDream.Content;
using DatReaderWriter;
using DatReaderWriter.Options;
namespace AcDream.Content.Tests;
///
/// Pins the school-to-foci-WCID map against the installed retail DATs.
///
///
///
/// Retail SpellComponentTable::SchoolOfMagic2WCID @ 0x005BC1F0 resolves
/// master map → category 0x10000001 → key 4 → the school→WCID
/// (0x27000003 in the
/// EoR dats). The catalog used to pass the decomp's 0x28 — the
/// EnumIDMap DBTYPE tag on that call — as the lookup category, which resolved
/// nothing: the map loaded EMPTY, a carried focus was never detected, and
/// every cast demanded the full component list while retail (and the spell
/// examine window there) asked only for scarabs and tapers.
///
///
/// The expected WCIDs are EXTERNAL constants — ACE's
/// Player_Spells.FociWCIDs, the server-side authority acdream must
/// agree with — deliberately not derived from the code under test, so an
/// empty or wrongly-resolved map cannot satisfy this vacuously.
///
///
[Trait("Lane", "InstalledDat")]
public sealed class InstalledMagicCatalogFociTests
{
[Fact]
public void FociMap_ResolvesEveryRetailSchoolToAcesFociWcid()
{
string? datDir = ContentConformanceDats.ResolveDatDir();
if (datDir is null)
Assert.Fail("Lane=InstalledDat requires an installed retail DAT directory; see docs/release-gate.md.");
using var dats = new DatCollection(datDir, DatAccessType.Read);
using var adapter = new DatCollectionAdapter(dats);
MagicCatalog catalog = MagicCatalog.Load(adapter);
// ACE Player_Spells.FociWCIDs: War=Strife, Life=Verdancy,
// Item=Artifice, Creature=Enchantment, Void=Shadow.
Assert.Equal(15271u, catalog.MagicPackWcidForSchool(1u));
Assert.Equal(15270u, catalog.MagicPackWcidForSchool(2u));
Assert.Equal(15269u, catalog.MagicPackWcidForSchool(3u));
Assert.Equal(15268u, catalog.MagicPackWcidForSchool(4u));
Assert.Equal(43173u, catalog.MagicPackWcidForSchool(5u));
}
}