RynthSuite/Tools/RynthCore.RynthAiHostTests/Program.cs
BlankenshipG 688f948c98 feat(rynthai): track ACECustom bounties for the engine's Bounties window
ACECustom keeps bounty progress server-side only, so RynthAi reads
"/bounty list" (every active bounty and this character's standing,
wherever the player is) and hides the reply from chat. Reads run only while
the engine's Bounties window polls the export: on open, ~2 s after kills (at
most every MinRefreshSeconds), after bounty chat events, periodically, and
on Refresh. Typed /bounty output updates the list too; cooldowns count down
locally; "Unknown command: bounty" stops automatic reads.

- Bounty/BountyParse.cs: /bounty list, /bounty, status, wait and event lines
- Bounty/BountyTracker.cs: schedule, quiet capture, merge, per-character
  bounties.json, bridge JSON and commands
- Exports RynthPluginGetBountiesJson / RynthPluginBountyCommand (UTF-8)
- /ra bounty [list|refresh]; remote command "bounty"
- Host tests: 8 tests / 150 checks, incl. the engine's JSON reader when the
  engine side is present
2026-10-09 08:39:39 -04:00

92 lines
4.1 KiB
C#

using System;
using System.IO;
using RynthCore.Plugin.RynthAi;
using RynthCore.Plugin.RynthAi.Meta;
using RynthCore.RynthAiHostTests.Tests;
using RynthCore.RynthAiTests.Harness;
namespace RynthCore.RynthAiHostTests;
// Offline tests for RynthAi's host-bound logic: loot rule matching and metas. Each test prints
// PASS / FAIL, or KNOWN for a registered real bug (which does not fail the run).
//
// Run: dotnet run -c Release (all tests)
// dotnet run -c Release -- vtank (tests whose name contains "vtank")
internal static class Program
{
/// <summary>Scratch folder next to the exe for files tests write. Emptied at start.</summary>
public static string TempRoot { get; } = Path.Combine(AppContext.BaseDirectory, "scratch");
/// <summary>DungeonHazardStore's folder before Main pointed it at the scratch folder.</summary>
public static string LiveHazardFolder { get; private set; } = "";
private static int Main(string[] args)
{
if (Directory.Exists(TempRoot)) Directory.Delete(TempRoot, recursive: true);
Directory.CreateDirectory(TempRoot);
// SAFETY: the expression engine reads and writes pvars/gvars (and reads ItemGiver
// profiles) under C:\Games\RynthSuite\RynthAi. Point them at the scratch folder before
// any engine exists. The "expr: safety" test checks this held.
ExpressionEngine.PvarsDir = Path.Combine(TempRoot, "pvars");
ExpressionEngine.GvarsPath = Path.Combine(TempRoot, "gvars.txt");
ExpressionEngine.ItemGiverDir = Path.Combine(TempRoot, "ItemGiver");
// The dungeon map bake writes floor plans under C:\Games\RynthSuite\RynthAi\Maps.
RynthCore.Plugin.RynthAi.Maps.DungeonMapBake.CacheDir = Path.Combine(TempRoot, "Maps");
// A sighted lava/acid hotspot is persisted under C:\Games\RynthSuite\RynthAi\DungeonHazards.
LiveHazardFolder = RynthCore.Plugin.RynthAi.DungeonHazardStore.Folder;
RynthCore.Plugin.RynthAi.DungeonHazardStore.Folder = Path.Combine(TempRoot, "DungeonHazards");
// Spell names (item spells, spell expiry by name) come from the plugin's embedded table.
SpellDatabase.Load();
var runner = new Runner();
NativeLootTests.Register(runner);
VTankLootTests.Register(runner);
T11LootTests.Register(runner);
ExpressionTests.Register(runner);
MetaTests.Register(runner);
NoKillTests.Register(runner);
MetaSchedulerTests.Register(runner);
NavEngineTests.Register(runner);
NavReachTests.Register(runner);
PatrolDoorwayTests.Register(runner);
BuffTests.Register(runner);
CombatMathTests.Register(runner);
WeaponTests.Register(runner);
RadarSnapshotTests.Register(runner);
AmmoTests.Register(runner);
VTankYieldTests.Register(runner);
OffhandTests.Register(runner);
FloodPerfTests.Register(runner);
LootSalvageTests.Register(runner);
LootCorpseTests.Register(runner);
OwnCorpseTests.Register(runner);
UseRefusalTests.Register(runner);
VitalsTests.Register(runner);
MultiTargetTests.Register(runner);
CastSafetyTests.Register(runner);
HealLatencyTests.Register(runner);
BlastTests.Register(runner);
ArcWhenClearTests.Register(runner);
WallTests.Register(runner);
UseAtLoginTests.Register(runner);
LearnSpellsTests.Register(runner);
AttackLatencyTests.Register(runner);
LootAddItemTests.Register(runner);
GiveTests.Register(runner);
DungeonMapBakeTests.Register(runner);
MonsterEditorTests.Register(runner);
InstallPathsTests.Register(runner);
PetRefillTests.Register(runner);
WorldCacheTypedTests.Register(runner);
ItemInfoTests.Register(runner);
NavOverlayTests.Register(runner);
ActionPacingTests.Register(runner);
HazardEscapeTests.Register(runner);
ManaStoneChoiceTests.Register(runner);
CustomDebuffTests.Register(runner);
BountyTests.Register(runner);
return runner.Run("RynthAi host tests", args.Length > 0 ? args[0] : null);
}
}