Snapshot for release 2026.10.28.3 (internal db7f094)
This commit is contained in:
parent
636adfcef2
commit
e6642d0e10
102 changed files with 4821 additions and 782 deletions
|
|
@ -91,6 +91,8 @@ internal static unsafe class FakeHost
|
|||
// ── What tested code sent to the engine ───────────────────────────────────
|
||||
public static readonly List<string> Logs = new();
|
||||
public static readonly List<string> Chat = new();
|
||||
/// <summary>The chat type (colour) of each <see cref="Chat"/> line, in the same order.</summary>
|
||||
public static readonly List<int> ChatTypes = new();
|
||||
public static readonly List<string> ChatCommands = new();
|
||||
/// <summary>Every SetAutoRun call, in order; AutoRun is the last value sent.</summary>
|
||||
public static readonly List<bool> AutoRunCalls = new();
|
||||
|
|
@ -302,7 +304,7 @@ internal static unsafe class FakeHost
|
|||
ServerTime = 0; Vitae = 1.0f; Portaling = false; PlayerPose = default; HasPose = true;
|
||||
Vitals = default; BaseVitals = default; WorldName = ""; AccountName = "";
|
||||
HeadingDeg = 0; Wcids.Clear(); Spellbook.Clear(); PlayerIdValue = 0;
|
||||
Logs.Clear(); Chat.Clear(); ChatCommands.Clear(); AfterCastSpell = null;
|
||||
Logs.Clear(); Chat.Clear(); ChatTypes.Clear(); ChatCommands.Clear(); AfterCastSpell = null;
|
||||
AutoRunCalls.Clear(); AutoRun = false; Jumps = 0; TapJumpCalls = false; TapJumps = 0; TapJumpRefuse = false; Turns = 0; Casts.Clear(); CastRefused = false; CastsRefused = 0; StopCalls = false; Stops = 0; SetMotionCalls = false; MotionCalls.Clear(); AttackSendCalls = false; AttackCalls.Clear(); Sent.Clear(); GiveCalls = false; Gives.Clear(); GiveLands = true; GiveHandler = null;
|
||||
Uses.Clear(); IdRequests.Clear(); TargetCalls = false; HealthQueries.Clear(); IdTimes.Clear(); Moves.Clear(); Appraised.Clear(); WeaponCalls = false; ContentsCalls = false; CombatModeValue = 1;
|
||||
RequestIdAccepts = true; RefusedIdRequests = 0; UseObjectAccepts = true;
|
||||
|
|
@ -608,7 +610,7 @@ internal static unsafe class FakeHost
|
|||
}
|
||||
|
||||
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
|
||||
private static int WriteToChat(IntPtr text, int type) { Chat.Add(Marshal.PtrToStringUni(text) ?? ""); return 1; }
|
||||
private static int WriteToChat(IntPtr text, int type) { Chat.Add(Marshal.PtrToStringUni(text) ?? ""); ChatTypes.Add(type); return 1; }
|
||||
|
||||
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
|
||||
private static int SendPluginCommand(IntPtr plugin, IntPtr action, IntPtr value)
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@ internal static class Program
|
|||
DifficultyTierTests.Register(runner);
|
||||
TickIsolationTests.Register(runner);
|
||||
ChoresInFightTests.Register(runner);
|
||||
CommandReplyTests.Register(runner);
|
||||
return runner.Run("RynthAi host tests", args.Length > 0 ? args[0] : null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
754
Tools/RynthCore.RynthAiHostTests/Tests/CommandReplyTests.cs
Normal file
754
Tools/RynthCore.RynthAiHostTests/Tests/CommandReplyTests.cs
Normal file
|
|
@ -0,0 +1,754 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using RynthCore.Plugin.RynthAi;
|
||||
using RynthCore.Plugin.RynthAi.LegacyUi;
|
||||
using RynthCore.Plugin.RynthAi.Meta;
|
||||
using RynthCore.PluginCore;
|
||||
using RynthCore.RynthAiHostTests.Fakes;
|
||||
using RynthCore.RynthAiTests.Harness;
|
||||
|
||||
namespace RynthCore.RynthAiHostTests.Tests;
|
||||
|
||||
// Every chat command answers (2026-10-28, CommandReply.cs). A /ra, /ub, /mt or /vt line the player
|
||||
// types always says in chat whether it worked: what changed and the value now, or why not and the
|
||||
// usage, never nothing and never the catch-all "Ran:" line. The same line from a meta is quiet when
|
||||
// it works (the log has it) and still shows its errors, a repeated one once a minute.
|
||||
//
|
||||
// One table: every verb RynthAi's dispatchers take, with a form that works in this rig and a wrong
|
||||
// one. Verbs whose working form writes under C:\Games (nav / meta / settings saves, dumpspells,
|
||||
// translateroute, logs prune, trace on) or plays a sound only run their wrong form here.
|
||||
internal static class CommandReplyTests
|
||||
{
|
||||
public static void Register(Runner r)
|
||||
{
|
||||
r.Add("command replies: CommandReply - typed always answers, a script's success is quiet, errors once a minute", HelperRules);
|
||||
r.Add("command replies: every typed command answers in chat, never with the catch-all line", TypedAlwaysAnswers);
|
||||
r.Add("command replies: a typed command's wrong form answers with a failure line (the failure colour)", TypedWrongFormsFail);
|
||||
r.Add("command replies: a meta's command is quiet when it works; its error shows, a repeat not within a minute", MetaQuietOnSuccess);
|
||||
r.Add("command replies: /ub opt set AutoVendor.Enabled true answers 'AutoVendor.Enabled = True' (a meta's: log only)", UbOptSetSaysValue);
|
||||
r.Add("command replies: deferred answers (LootThisCont, Meta Manager) keep who sent the line", DeferredAnswers);
|
||||
}
|
||||
|
||||
private const uint Lb = 0xA9B40000;
|
||||
private const uint Player = 0x50000F61, Robe = 0x80282301, Sword = 0x80282302, Cloak = 0x80282303;
|
||||
private const uint Crier = 0x80000601, Drudge = 0x80000602;
|
||||
private const BindingFlags Any = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public;
|
||||
|
||||
/// <summary>What a row's working form must do. Act: answer typed, quiet from a meta. Query: output
|
||||
/// asked for, shown either way. Elsewhere: the server, the engine or another plugin answers (it is
|
||||
/// handed on). Ignored: an accepted no-equivalent verb (typed: a failure line; a meta: once).</summary>
|
||||
private enum K { Act, Query, Elsewhere, Ignored }
|
||||
|
||||
/// <summary>A verb: a working form, a wrong one, and a line typed first (state the working form needs).</summary>
|
||||
private sealed record Row(string? Valid, string? Invalid, K Kind, string? Setup = null);
|
||||
|
||||
private static readonly Row[] Rows =
|
||||
{
|
||||
// ── /ra: settings and actions ──
|
||||
new("/ra power 80", "/ra power banana", K.Act),
|
||||
new("/ra offhand shield", "/ra offhand banana", K.Act),
|
||||
new("/ra offhand dual on", "/ra offhand default", K.Act),
|
||||
new("/ra follow off", "/ra follow Nobody Here", K.Act),
|
||||
new("/ra follow Town Crier", null, K.Act),
|
||||
new("/ra navrec on", null, K.Act),
|
||||
new("/ra navhud off", null, K.Act),
|
||||
new("/ra navtrail on", null, K.Act),
|
||||
new("/ra navtrail clear", null, K.Act),
|
||||
new("/ra navoverlay off", null, K.Act),
|
||||
new("/ra debug off", null, K.Act),
|
||||
new("/ra lootcheck off", "/ra lootcheck", K.Act),
|
||||
new("/ra groundloot scan", null, K.Act),
|
||||
new("/ra groundloot on", null, K.Act),
|
||||
new("/ra vtankyield off", "/ra vtankyield banana", K.Act),
|
||||
new("/ra stop", null, K.Act),
|
||||
new("/ra start", null, K.Act),
|
||||
new("/ra resume", null, K.Act),
|
||||
new("/ra pause 5", null, K.Act),
|
||||
new("/ra clearbusy", null, K.Act),
|
||||
new("/ra panic", null, K.Act),
|
||||
new("/ra use Faran Robe", "/ra use Nothing Here", K.Act),
|
||||
new("/ra usep Robe", "/ra usep", K.Act),
|
||||
new("/ra usei Faran Robe", "/ra usei Nothing Here", K.Act),
|
||||
new("/ra usel Town Crier", "/ra usel Nothing Here", K.Act),
|
||||
new("/ra usepi Robe", null, K.Act),
|
||||
new("/ra uselp Crier", null, K.Act),
|
||||
new("/ra select Faran Robe", "/ra select Nothing Here", K.Act),
|
||||
new("/ra selectp Robe", "/ra selectp", K.Act),
|
||||
new("/ra selecti Faran Robe", null, K.Act),
|
||||
new("/ra selectl Town Crier", null, K.Act),
|
||||
new("/ra give Faran Robe to Town Crier", "/ra give Faran Robe", K.Act),
|
||||
new("/ra givep Robe to Town Crier", "/ra givep Robe to Nobody", K.Act),
|
||||
new("/ra givexp Faran Robe to Crier", null, K.Act),
|
||||
new("/ra givepp Robe to Crier", null, K.Act),
|
||||
new("/ra giver ^Faran to Town Crier", "/ra giver ([ to Town Crier", K.Act),
|
||||
new("/ra givea Faran Robe to Town Crier", "/ra givea Nothing Here to Town Crier", K.Act),
|
||||
new("/ra giveap Robe to Town Crier", null, K.Act),
|
||||
new("/ra giveaxp Faran Robe to Crier", null, K.Act),
|
||||
new("/ra giveapp Robe to Crier", null, K.Act),
|
||||
new("/ra gap Robe to Crier", null, K.Act),
|
||||
new("/ra givear ^Faran to Town Crier", null, K.Act),
|
||||
new("/ra givea stop", null, K.Act),
|
||||
new(null, "/ra ig NoSuchProfileHere to Town Crier", K.Act),
|
||||
new(null, "/ra igp NoSuchProfileHere", K.Act),
|
||||
new("/ra cast 1234", "/ra cast banana", K.Act),
|
||||
new("/ra targetlock off", null, K.Act),
|
||||
new("/ra meleelow", null, K.Act),
|
||||
new("/ra meleemid", null, K.Act),
|
||||
new("/ra meleehigh", null, K.Act),
|
||||
new("/ra navprio on", null, K.Act),
|
||||
new("/ra lootprio off", null, K.Act),
|
||||
new("/ra navlootprio on", null, K.Act),
|
||||
new("/ra setmetastate Hunt", "/ra setmetastate", K.Act),
|
||||
new("/ra metastate Hunt", null, K.Act),
|
||||
new("/ra equipfor Drudge Skulker", "/ra equipfor", K.Act),
|
||||
new("/ra myquests", null, K.Act),
|
||||
new("/ra refreshquests", null, K.Act),
|
||||
new("/ra ghosts forget", null, K.Act),
|
||||
new("/ra jump", "/ra jumpq", K.Act),
|
||||
new("/ra jumpsw 90 200", "/ra jumpw 90 banana", K.Act),
|
||||
new("/ra spells hide", null, K.Act),
|
||||
new("/ra trade decline", "/ra trade banana", K.Act),
|
||||
new("/ra owncorpse stop", null, K.Act),
|
||||
new(null, "/ra testitem", K.Act),
|
||||
new(null, "/ra hazard add", K.Act),
|
||||
new(null, "/ra hazard texture add banana", K.Act),
|
||||
new(null, "/ra dunnav 1 2", K.Act),
|
||||
new(null, "/ra dunnav", K.Act),
|
||||
new(null, "/ra dunnav-patrol", K.Act),
|
||||
new(null, "/ra nav restart", K.Act),
|
||||
new(null, "/ra nav banana", K.Act),
|
||||
new(null, "/ra meta banana", K.Act),
|
||||
new(null, "/ra settings", K.Act),
|
||||
new(null, "/ra settings loadchar", K.Act),
|
||||
new(null, "/ra loot add banana", K.Act),
|
||||
new(null, "/ra lootparse", K.Act),
|
||||
new(null, "/ra lootcheckinv", K.Act),
|
||||
new(null, "/ra autotrade", K.Act),
|
||||
new(null, "/ra forcebuff", K.Act),
|
||||
new(null, "/ra cancelforcebuff", K.Act),
|
||||
new(null, "/ra buff force", K.Act),
|
||||
new(null, "/ra buff skipped", K.Act),
|
||||
new(null, "/ra bufftest", K.Act),
|
||||
new(null, "/ra swaptest", K.Act),
|
||||
new(null, "/ra recharge", K.Act),
|
||||
new(null, "/ra heal", K.Act),
|
||||
new(null, "/ra stam", K.Act),
|
||||
new(null, "/ra mana", K.Act),
|
||||
new(null, "/ra hub", K.Act),
|
||||
new(null, "/ra quests", K.Act),
|
||||
new(null, "/ra pets", K.Act),
|
||||
new(null, "/ra huds show", K.Act),
|
||||
new(null, "/ra itemhud add Faran Robe", K.Act),
|
||||
new(null, "/ra remote toggle", K.Act),
|
||||
new(null, "/ra miniremote hide", K.Act),
|
||||
new(null, "/ra translate status", K.Act),
|
||||
new(null, "/ra tr status", K.Act),
|
||||
new(null, "/ra iteminfo", K.Act),
|
||||
new(null, "/ra ii", K.Act),
|
||||
new(null, "/ra corpseopen", K.Act),
|
||||
new(null, "/ra fellow", K.Act),
|
||||
new(null, "/ra fellowship leader", K.Act),
|
||||
new(null, "/ra nosuchverb", K.Act),
|
||||
// ── /ra: output asked for ──
|
||||
new("/ra help", null, K.Query),
|
||||
new("/ra", null, K.Query),
|
||||
new("/ra version", null, K.Query),
|
||||
new("/ra server", null, K.Query),
|
||||
new("/ra buffs", null, K.Query),
|
||||
new("/ra cache", null, K.Query),
|
||||
new("/ra cache2", null, K.Query),
|
||||
new("/ra attackable", null, K.Query),
|
||||
new("/ra mexec 1+1", "/ra mexec", K.Query),
|
||||
new("/ra listvars", null, K.Query),
|
||||
new("/ra listpvars", null, K.Query),
|
||||
new("/ra listgvars", null, K.Query),
|
||||
new("/ra dumpprops", null, K.Query),
|
||||
new("/ra propertydump", null, K.Query),
|
||||
new("/ra wielded", null, K.Query),
|
||||
new("/ra scan", null, K.Query),
|
||||
new("/ra buildinfo", null, K.Query),
|
||||
new("/ra navdebug", null, K.Query),
|
||||
new("/ra raycast", null, K.Query),
|
||||
new("/ra lostest", null, K.Query),
|
||||
new("/ra landtest", null, K.Query),
|
||||
new("/ra rayland", null, K.Query),
|
||||
new("/ra corpseinfo", null, K.Query),
|
||||
new("/ra corpsecheck", null, K.Query),
|
||||
new("/ra fellowinfo", null, K.Query),
|
||||
new("/ra dumpinv", null, K.Query),
|
||||
new("/ra combat", null, K.Query),
|
||||
new("/ra why", null, K.Query),
|
||||
new("/ra ghosts", null, K.Query),
|
||||
new("/ra ghost", null, K.Query),
|
||||
new("/ra navstate", null, K.Query),
|
||||
new("/ra salvstate", null, K.Query),
|
||||
new("/ra mapdump", null, K.Query),
|
||||
new("/ra busyinfo", null, K.Query),
|
||||
new("/ra pace", null, K.Query),
|
||||
new("/ra owncorpse", null, K.Query),
|
||||
new("/ra mycorpse", null, K.Query),
|
||||
new("/ra vtkeys", null, K.Query),
|
||||
new("/ra discord", null, K.Query),
|
||||
new("/ra items", null, K.Query),
|
||||
new("/ra trace list", "/ra trace nosuchcategory", K.Query),
|
||||
new("/ra logs", null, K.Query),
|
||||
new("/ra debug", null, K.Query),
|
||||
new("/ra loot", null, K.Query),
|
||||
new("/ra hazard", null, K.Query),
|
||||
new("/ra hazard list", null, K.Query),
|
||||
new("/ra hazard texture list", null, K.Query),
|
||||
new("/ra groundloot", null, K.Query),
|
||||
new("/ra trade state", null, K.Query),
|
||||
new("/ra vtankyield", null, K.Query),
|
||||
new("/ra navtrail", null, K.Query),
|
||||
new("/ra metamgr status", null, K.Elsewhere), // answered on the next tick
|
||||
// ── /ra: answered by the engine or another plugin ──
|
||||
new("/ra lua run Hello", null, K.Elsewhere),
|
||||
new("/ra quit", null, K.Elsewhere),
|
||||
new("/ra exit", null, K.Elsewhere),
|
||||
new("/ra videopatch status", null, K.Elsewhere),
|
||||
new("/ra lootthis", null, K.Elsewhere), // answered on the loot tick (DeferredAnswers)
|
||||
new("/ra metamgr on", null, K.Elsewhere), // answered on the next tick (DeferredAnswers)
|
||||
|
||||
// ── /mt ──
|
||||
new("/mt opt set AutoVendor.Enabled true", "/mt opt set AutoVendor.Enabled", K.Act),
|
||||
new("/mt opt set enablecombat 0", "/mt opt", K.Act),
|
||||
new("/mt opt remember enablecombat", "/mt opt remember", K.Act),
|
||||
new("/mt opt restore enablecombat", "/mt opt restore NoSuchOption", K.Act, Setup: "/mt opt remember enablecombat"),
|
||||
new("/mt opt get enablecombat", "/mt opt get NoSuchOption", K.Query),
|
||||
new("/mt opt list", null, K.Query),
|
||||
new("/mt config", null, K.Query),
|
||||
new("/mt combatstate melee", "/mt combatstate banana", K.Act),
|
||||
new("/mt face 90", "/mt face banana", K.Act),
|
||||
new("/mt cast 1234", "/mt cast No Such Spell Ever", K.Act),
|
||||
new("/mt castp 1234", "/mt castp", K.Act),
|
||||
new("/mt use Faran Robe", "/mt use", K.Act),
|
||||
new("/mt usep Robe", "/mt usep", K.Act),
|
||||
new("/mt usei Faran Robe", null, K.Act),
|
||||
new("/mt useip Robe", null, K.Act),
|
||||
new("/mt usel Town Crier", null, K.Act),
|
||||
new("/mt uselp Crier", null, K.Act),
|
||||
new(null, "/mt use closestvendor", K.Act),
|
||||
new("/mt select Faran Robe", "/mt select Nothing Here", K.Act),
|
||||
new("/mt selectp Robe", null, K.Act),
|
||||
new("/mt give Faran Robe to Town Crier", "/mt give Faran Robe", K.Act),
|
||||
new("/mt givep Robe to Crier", "/mt givep Nothing to Crier", K.Act),
|
||||
new("/mt loot Gem", "/mt loot", K.Act),
|
||||
new("/mt lootp Gem", "/mt lootp", K.Act),
|
||||
new("/mt drop Faran Robe", "/mt drop Nothing Here", K.Act),
|
||||
new("/mt dropp Robe", "/mt dropp", K.Act),
|
||||
new("/mt equip Sharp Sword", "/mt equip Nothing Here", K.Act),
|
||||
new("/mt equipp Sword", "/mt equipp", K.Act),
|
||||
new("/mt dequip Worn Cloak", "/mt dequip Nothing Here", K.Query),
|
||||
new("/mt dequipp Cloak", "/mt dequipp", K.Query),
|
||||
new("/mt fellow open", "/mt fellow create", K.Elsewhere),
|
||||
new("/mt fellow close", "/mt fellow recruit", K.Elsewhere),
|
||||
new("/mt fellow disband", "/mt fellow banana", K.Elsewhere),
|
||||
new("/mt fellow quit", "/mt fellow", K.Elsewhere),
|
||||
new("/mt fellow create Hunters", null, K.Elsewhere),
|
||||
new("/mt fellow recruit Town Crier", null, K.Elsewhere),
|
||||
new("/mt logout", null, K.Elsewhere),
|
||||
new("/mt logoff", null, K.Elsewhere),
|
||||
new("/mt quit", null, K.Elsewhere),
|
||||
new("/mt exit", null, K.Elsewhere),
|
||||
new("/mt send /say hi", "/mt send", K.Elsewhere),
|
||||
new("/mt send enter", "/mt send banana", K.Act),
|
||||
new("/mt send msg hello", "/mt send msg", K.Act),
|
||||
new("/mt send cntrl+a", null, K.Act),
|
||||
new("/mt jump 100", null, K.Act),
|
||||
new("/mt sjumpw 100", null, K.Act),
|
||||
new("/mt trade decline", "/mt trade", K.Act),
|
||||
new("/mt trade reset", "/mt trade add", K.Act),
|
||||
new("/mt trade end", "/mt trade banana", K.Act),
|
||||
new("/mt trade add Faran Robe", "/mt trade add Nothing Here", K.Act),
|
||||
new(null, "/mt trade accept", K.Act),
|
||||
new("/mt vendor addsell Faran Robe", "/mt vendor", K.Act),
|
||||
new("/mt vendor clearbuy", "/mt vendor addsell Nothing Here", K.Act),
|
||||
new("/mt vendor clearsell", "/mt vendor banana", K.Act),
|
||||
new(null, "/mt vendor sell", K.Act),
|
||||
new(null, "/mt vendor buy", K.Act),
|
||||
new("/mt autopack", null, K.Act),
|
||||
new("/mt click ok", "/mt click", K.Act),
|
||||
new("/mt click 10 20", "/mt click banana", K.Act),
|
||||
new("/mt movement w 0", "/mt movement", K.Act),
|
||||
new("/mt strafe left 0", "/mt strafe up 5", K.Act),
|
||||
new("/mt client minimize", "/mt client banana", K.Act),
|
||||
new("/mt client restore", null, K.Act),
|
||||
new("/mt client frame", null, K.Query),
|
||||
new("/mt get xy", "/mt get banana", K.Query),
|
||||
new("/mt cursor", null, K.Query),
|
||||
new("/mt test", null, K.Query),
|
||||
new(null, "/mt nosuchverb", K.Act),
|
||||
new(null, "/mt", K.Act),
|
||||
|
||||
// ── /ub ──
|
||||
new("/ub opt set AutoVendor.Enabled true", "/ub opt set AutoVendor.Enabled", K.Act),
|
||||
new("/ub opt toggle EnableLooting", "/ub opt toggle NoSuchOption", K.Act),
|
||||
new("/ub opt get enablecombat", null, K.Query),
|
||||
new("/ub opt list", null, K.Query),
|
||||
new("/ub setvar[cr,1]", null, K.Act),
|
||||
new("/ub jumpw", "/ub jumpq", K.Act),
|
||||
new("/ub simplejump 100", null, K.Act),
|
||||
new("/ub give Faran Robe to Town Crier", "/ub give Nothing Here to Town Crier", K.Act),
|
||||
new("/ub givep Robe to Crier", null, K.Act),
|
||||
new("/ub give 1 Faran Robe to Crier", null, K.Act),
|
||||
new("/ub follow off", null, K.Act),
|
||||
new("/ub followp Crier", null, K.Act),
|
||||
new("/ub selecti Faran Robe", "/ub selecti Nothing Here", K.Act),
|
||||
new("/ub selectlp Crier", null, K.Act),
|
||||
new("/ub myquests", null, K.Act),
|
||||
new("/ub clearbugged", null, K.Act),
|
||||
new("/ub mexec 1+1", "/ub mexec", K.Query),
|
||||
new("/ub listvars", null, K.Query),
|
||||
new("/ub listpvars", null, K.Query),
|
||||
new("/ub listgvars", null, K.Query),
|
||||
new("/ub propertydump", null, K.Query),
|
||||
new(null, "/ub ig NoSuchProfileHere to Crier", K.Act),
|
||||
new("/ub delay 1000 /ra stop", "/ub delay banana", K.Act),
|
||||
new("/ub count item Faran Robe", "/ub count", K.Query),
|
||||
new("/ub count player 50", "/ub count player banana", K.Query),
|
||||
new("/ub date", null, K.Query),
|
||||
new("/ub dateutc yyyy", null, K.Query),
|
||||
new("/ub id", null, K.Query),
|
||||
new("/ub pos", null, K.Query),
|
||||
new("/ub vitae", null, K.Elsewhere),
|
||||
new(null, "/ub portal Nowhere At All", K.Act),
|
||||
new(null, "/ub portalp", K.Act),
|
||||
new(null, "/ub closestportal", K.Act),
|
||||
new(null, "/ub playsound NoSuchSound.wav", K.Act),
|
||||
new("/ub setmotion Forward 0", "/ub setmotion", K.Act),
|
||||
new("/ub getmotion", null, K.Query),
|
||||
new("/ub clearmotion", null, K.Act),
|
||||
new("/ub autostack", null, K.Act),
|
||||
new("/ub autocram", null, K.Act),
|
||||
new("/ub help", null, K.Query),
|
||||
new(null, "/ub dumpskills", K.Act),
|
||||
new("/ub quests check SomeFlag", "/ub quests", K.Elsewhere),
|
||||
new(null, "/ub translateroute", K.Act),
|
||||
new("/ub wear Sharp Sword", "/ub wear Nothing Here", K.Act),
|
||||
new("/ub wearp Sword", "/ub wear", K.Act),
|
||||
new("/ub getxy", null, K.Query),
|
||||
new("/ub stfl 0", "/ub stfl", K.Act),
|
||||
new("/ub stfr 0", null, K.Act),
|
||||
new("/ub debug off", null, K.Act),
|
||||
new(null, "/ub close corpse", K.Act),
|
||||
new("/ub globalframelimit 45", "/ub globalframelimit banana", K.Act),
|
||||
new("/ub bgframelimit 20", "/ub bgframelimit", K.Act),
|
||||
new("/ub fellow dismiss Storm", "/ub fellow dismiss", K.Elsewhere),
|
||||
new("/ub fellow leaderp Storm", null, K.Elsewhere),
|
||||
new("/ub fellow status", null, K.Query),
|
||||
new("/ub arrow point 42.1N, 33.6E", null, K.Elsewhere),
|
||||
new("/ub navgoto -12.5 40.25", "/ub navgoto banana", K.Elsewhere),
|
||||
new("/ub packsort", null, K.Elsewhere),
|
||||
new("/ub packsortshow", null, K.Elsewhere),
|
||||
new("/ub bc /say hi", null, K.Elsewhere),
|
||||
new("/ub netclients", null, K.Elsewhere),
|
||||
new("/ub videopatch status", null, K.Elsewhere),
|
||||
new("/ub bank status", null, K.Elsewhere), // ub-Rythai answers its own verbs
|
||||
new("/ub combat on", null, K.Act),
|
||||
new("/ub sloot off", null, K.Act),
|
||||
new("/ub meta state Hunt", null, K.Act),
|
||||
new("/ub meta status", null, K.Query),
|
||||
new("/ub lps", null, K.Query),
|
||||
new(null, "/ub miniremote show", K.Act),
|
||||
new(null, "/ub autovendor", K.Act),
|
||||
new(null, "/ub vendor buyall", K.Act),
|
||||
new(null, "/ub autotrade", K.Act),
|
||||
new("/ub soak on", null, K.Ignored),
|
||||
new("/ub window save", null, K.Ignored),
|
||||
new("/ub arrow face", null, K.Ignored),
|
||||
new("/ub packsortreload", null, K.Ignored),
|
||||
new("/ub qblist", null, K.Ignored),
|
||||
new("/ub meta banana", null, K.Ignored),
|
||||
new("/ub usep Robe", "/ub usep", K.Act),
|
||||
new("/ub face 90", "/ub face", K.Act),
|
||||
new("/ub combatstate peace", "/ub combatstate", K.Act),
|
||||
new("/ub cast 1234", "/ub cast", K.Act),
|
||||
new("/ub equip Sharp Sword", "/ub equip", K.Act),
|
||||
new("/ub drop Faran Robe", "/ub drop", K.Act),
|
||||
new("/ub select Faran Robe", "/ub select", K.Act),
|
||||
new("/ub loot Gem", "/ub loot", K.Act),
|
||||
new("/ub fellow open", "/ub fellow create", K.Elsewhere),
|
||||
new("/ub logout", null, K.Elsewhere),
|
||||
new("/ub quit", null, K.Elsewhere),
|
||||
new(null, "/ub nosuchverb", K.Act),
|
||||
|
||||
// ── /vt ──
|
||||
new("/vt opt set enablecombat true", "/vt opt set enablecombat", K.Act),
|
||||
new("/vt opt set NoSuchVtOption 5", "/vt opt", K.Act),
|
||||
new("/vt opt get enablecombat", null, K.Query),
|
||||
new("/vt opt list", null, K.Query),
|
||||
new("/vt stop", null, K.Act),
|
||||
new("/vt start", null, K.Act),
|
||||
new("/vt e", null, K.Act),
|
||||
new("/vt jump", null, K.Act),
|
||||
new("/vt tapjump", null, K.Act),
|
||||
new("/vt equipitemsfor Drudge Skulker", "/vt equipitemsfor", K.Act),
|
||||
new(null, "/vt loot load NoSuchProfileHere", K.Act),
|
||||
new(null, "/vt meta", K.Act),
|
||||
new(null, "/vt nav", K.Act),
|
||||
new("/vt setmetastate Hunt", "/vt setmetastate", K.Act),
|
||||
new("/vt attackdistance 0.1", null, K.Act),
|
||||
new("/vt setattackbar 0.5", "/vt setattackbar banana", K.Act),
|
||||
new("/vt reverseroute", null, K.Act),
|
||||
new("/vt mexec 1+1", null, K.Query),
|
||||
new("/vt clearbusy", null, K.Act),
|
||||
new("/vt propertydump", null, K.Query),
|
||||
new(null, "/vt testitem", K.Act),
|
||||
new(null, "/vt forcebuff", K.Act),
|
||||
new(null, "/vt cancelforcebuff", K.Act),
|
||||
new(null, "/vt cancelbuff", K.Act),
|
||||
new("/vt echo hello", null, K.Query),
|
||||
new("/vt settings banana", null, K.Ignored),
|
||||
new("/vt deletemonster", null, K.Ignored),
|
||||
new(null, "/vt nosuchverb", K.Act),
|
||||
new(null, "/vt", K.Act),
|
||||
};
|
||||
|
||||
// ── The rig: a logged-in RynthAi with a meta manager, combat, a jumper and the fakes ──
|
||||
|
||||
private sealed class Rig : IDisposable
|
||||
{
|
||||
public readonly RynthAiPlugin P = new();
|
||||
public readonly LegacyUiSettings S = new();
|
||||
public readonly MetaManager M;
|
||||
public readonly List<(uint Msg, uint W, uint L)> Posted = new();
|
||||
|
||||
public Rig()
|
||||
{
|
||||
FakeHost.Reset();
|
||||
FakeHost.WeaponCalls = FakeHost.SalvageCalls = FakeHost.GiveCalls = FakeHost.CombatModeCalls = true;
|
||||
FakeHost.PluginCommandCalls = FakeHost.CloseContainerCalls = FakeHost.TradeVendorCalls = true;
|
||||
FakeHost.BusyCalls = FakeHost.StopCalls = FakeHost.SetMotionCalls = FakeHost.TapJumpCalls = true;
|
||||
FakeHost.Names[Player] = "Tester";
|
||||
FakeHost.PlayerIdValue = Player;
|
||||
FakeHost.PlayerPose = (Lb | 0x1C, 96f, 96f, 0f);
|
||||
FakeHost.Positions[Player] = (Lb | 0x1C, 96f, 96f, 0f);
|
||||
foreach (var (id, name) in new[] { (Robe, "Faran Robe"), (Sword, "Sharp Sword"), (Cloak, "Worn Cloak") })
|
||||
{
|
||||
FakeHost.Names[id] = name;
|
||||
FakeHost.Containers[id] = Player;
|
||||
FakeHost.ItemTypes[id] = 0x2;
|
||||
}
|
||||
FakeHost.Wielded[Cloak] = 0x0400;
|
||||
foreach (var (id, name, y) in new[] { (Crier, "Town Crier", 98f), (Drudge, "Drudge Skulker", 99f) })
|
||||
{
|
||||
FakeHost.Names[id] = name;
|
||||
FakeHost.Positions[id] = (Lb | 0x1C, 96f, y, 0f);
|
||||
FakeHost.ItemTypes[id] = 0x10;
|
||||
}
|
||||
var host = FakeHost.Create(playerId: Player);
|
||||
typeof(RynthPluginBase).GetMethod("Attach", Any)!.Invoke(P, new object[] { FakeHost.LastApi });
|
||||
var dash = (LegacyDashboardRenderer)RuntimeHelpers.GetUninitializedObject(typeof(LegacyDashboardRenderer));
|
||||
typeof(LegacyDashboardRenderer).GetField("_settings", Any)!.SetValue(dash, S);
|
||||
Set("_dashboard", dash);
|
||||
|
||||
var cache = new WorldObjectCache(host);
|
||||
cache.SetPlayerId(Player);
|
||||
foreach (uint id in new[] { Robe, Sword, Cloak }) cache.OnCreateObject(id);
|
||||
cache.Tick();
|
||||
foreach (uint id in new[] { Crier, Drudge }) _ = cache[unchecked((int)id)];
|
||||
Set("_objectCache", cache);
|
||||
Set("_playerId", Player);
|
||||
Set("_currentTargetId", Drudge);
|
||||
|
||||
M = new MetaManager(S, host, new PlayerVitalsCache());
|
||||
M.SetPlayerId(Player);
|
||||
M.SetObjectCache(cache);
|
||||
M.SetMtCommandHandler(line => (bool)Call("HandleMetaChatCommand", line)!);
|
||||
M.SetRaCommandHandler(line => Call("HandleRaCommand", line));
|
||||
M.Reply = P.Reply;
|
||||
Set("_metaManager", M);
|
||||
|
||||
var combat = new CombatManager(host, S, cache);
|
||||
combat.SetPlayerId(Player);
|
||||
combat.SetDamageStores(null, new RynthCore.Plugin.RynthAi.CreatureData.MonsterDamageStore());
|
||||
Set("_combatManager", combat);
|
||||
Set("_fellowshipTracker", new FellowshipTracker());
|
||||
Set("_jumper", new Jumper(host, S, text => P.Reply.Fail(text)));
|
||||
Set("_initialized", true);
|
||||
Set("_loginComplete", true);
|
||||
|
||||
S.AllowMetaKeystrokes = true; // the key verbs act (into the test sink) instead of refusing
|
||||
S.MonsterRules.Add(new MonsterRule { Name = "Default" });
|
||||
S.CurrentRoute.Points.Add(new NavPoint { NS = 1.0, EW = 1.0 });
|
||||
S.CurrentRoute.Points.Add(new NavPoint { NS = 1.1, EW = 1.1 });
|
||||
GameInput.TestSink = (m, w, l) => Posted.Add((m, w, l));
|
||||
}
|
||||
|
||||
public void Set(string f, object? v) => typeof(RynthAiPlugin).GetField(f, Any)!.SetValue(P, v);
|
||||
public object? Get(string f) => typeof(RynthAiPlugin).GetField(f, Any)!.GetValue(P);
|
||||
public object? Call(string method, params object[] args) => typeof(RynthAiPlugin).GetMethod(method, Any)!.Invoke(P, args);
|
||||
|
||||
/// <summary>A line typed in the chat bar; the chat lines it wrote.</summary>
|
||||
public List<(string Text, int Type)> Typed(string line) => Lines(() => { int eat = 0; P.OnChatBarEnter(line, ref eat); });
|
||||
|
||||
/// <summary>The same line run by a meta (RunAsMeta, as HandleMetaChatCommand does); the chat lines it wrote.</summary>
|
||||
public List<(string Text, int Type)> Meta(string line) => Lines(() =>
|
||||
{
|
||||
var run = typeof(RynthAiPlugin).GetMethod("RunAsMeta", Any)!.MakeGenericMethod(typeof(bool));
|
||||
run.Invoke(P, new object[] { (Func<bool>)(() => { int eat = 0; P.OnChatBarEnter(line, ref eat); return true; }) });
|
||||
});
|
||||
|
||||
public static List<(string Text, int Type)> Lines(Action act)
|
||||
{
|
||||
int before = FakeHost.Chat.Count;
|
||||
act();
|
||||
var lines = new List<(string, int)>();
|
||||
for (int i = before; i < FakeHost.Chat.Count; i++)
|
||||
lines.Add((FakeHost.Chat[i], i < FakeHost.ChatTypes.Count ? FakeHost.ChatTypes[i] : -1));
|
||||
return lines;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GameInput.Shutdown();
|
||||
GameInput.TestSink = null;
|
||||
RynthLog.DebugToChat = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Set RYNTH_SHOW_REPLIES=1 to print every typed line's answer (to read them over).</summary>
|
||||
private static readonly bool ShowReplies = Environment.GetEnvironmentVariable("RYNTH_SHOW_REPLIES") == "1";
|
||||
|
||||
private static string Show(List<(string Text, int Type)> lines)
|
||||
=> lines.Count == 0 ? "(nothing)" : string.Join(" | ", lines.Select(l => $"[{l.Type}] {l.Text}"));
|
||||
|
||||
/// <summary>A reply that is the catch-all line or a caught exception: the command has no answer of its own.</summary>
|
||||
private static string? Bad(List<(string Text, int Type)> lines)
|
||||
{
|
||||
foreach (var (t, _) in lines)
|
||||
{
|
||||
if (t.StartsWith(CommandReply.RanPrefix, StringComparison.Ordinal)) return "only the catch-all 'Ran:' line";
|
||||
if (t.Contains(": failed (", StringComparison.Ordinal)) return "threw: " + t;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void Report(List<string> problems, string what)
|
||||
{
|
||||
foreach (string p in problems) Console.WriteLine(" " + p);
|
||||
Check.Eq(problems.Count, 0, what);
|
||||
}
|
||||
|
||||
// ── The table ─────────────────────────────────────────────────────────────
|
||||
|
||||
private static void TypedAlwaysAnswers()
|
||||
{
|
||||
var problems = new List<string>();
|
||||
foreach (var row in Rows)
|
||||
{
|
||||
foreach (string? line in new[] { row.Valid, row.Invalid })
|
||||
{
|
||||
if (line == null) continue;
|
||||
using var r = new Rig();
|
||||
if (row.Setup != null && line == row.Valid) r.Typed(row.Setup);
|
||||
int handedOn = FakeHost.ChatCommands.Count + FakeHost.PluginCommands.Count;
|
||||
var lines = r.Typed(line);
|
||||
if (ShowReplies) Console.WriteLine($" {line} => {Show(lines)}");
|
||||
bool elsewhere = row.Kind == K.Elsewhere && line == row.Valid;
|
||||
if (Bad(lines) is string bad) problems.Add($"{line}: {bad}");
|
||||
else if (elsewhere)
|
||||
{
|
||||
bool passedOn = FakeHost.ChatCommands.Count + FakeHost.PluginCommands.Count > handedOn;
|
||||
bool deferred = line is "/ra lootthis" or "/ub bank status" || line.StartsWith("/ra metamgr", StringComparison.Ordinal);
|
||||
if (!passedOn && lines.Count == 0 && !deferred) problems.Add($"{line}: nothing said and nothing handed on");
|
||||
}
|
||||
else if (lines.Count == 0) problems.Add($"{line}: said nothing");
|
||||
}
|
||||
}
|
||||
Report(problems, "every typed command answers with a line of its own");
|
||||
}
|
||||
|
||||
private static void TypedWrongFormsFail()
|
||||
{
|
||||
var problems = new List<string>();
|
||||
foreach (var row in Rows)
|
||||
{
|
||||
if (row.Invalid == null) continue;
|
||||
using var r = new Rig();
|
||||
var lines = r.Typed(row.Invalid);
|
||||
if (!lines.Any(l => l.Type == CommandReply.FailColor))
|
||||
problems.Add($"{row.Invalid}: no failure line: {Show(lines)}");
|
||||
}
|
||||
Report(problems, "a wrong form answers with a failure line");
|
||||
|
||||
// Each typed failure answers every time (no once-a-minute for the player).
|
||||
using var again = new Rig();
|
||||
int first = again.Typed("/ra power banana").Count;
|
||||
int second = again.Typed("/ra power banana").Count;
|
||||
Check.True(first >= 1 && second == first, $"typed twice, answered twice ({first}, {second})");
|
||||
|
||||
// A key verb with "Allow metas to send keystrokes" off: typed, refused every time; a meta, once.
|
||||
using var keys = new Rig();
|
||||
keys.S.AllowMetaKeystrokes = false;
|
||||
int t1 = keys.Typed("/mt send enter").Count(l => l.Type == CommandReply.FailColor);
|
||||
int t2 = keys.Typed("/mt send enter").Count(l => l.Type == CommandReply.FailColor);
|
||||
int m1 = keys.Meta("/mt send enter").Count;
|
||||
int m2 = keys.Meta("/mt send enter").Count;
|
||||
Check.True(t1 == 1 && t2 == 1 && m1 == 1 && m2 == 0, $"keys off: typed {t1}+{t2}, meta {m1}+{m2}");
|
||||
Check.Eq(keys.Posted.Count, 0, "and no key went out");
|
||||
}
|
||||
|
||||
private static void MetaQuietOnSuccess()
|
||||
{
|
||||
var problems = new List<string>();
|
||||
foreach (var row in Rows)
|
||||
{
|
||||
if (row.Valid != null && row.Kind is K.Act or K.Elsewhere)
|
||||
{
|
||||
using var r = new Rig();
|
||||
if (row.Setup != null) r.Typed(row.Setup);
|
||||
var lines = r.Meta(row.Valid);
|
||||
if (lines.Count > 0) problems.Add($"{row.Valid} (meta, works): said {Show(lines)}");
|
||||
if (lines.Any(l => l.Text.StartsWith(CommandReply.RanPrefix, StringComparison.Ordinal)))
|
||||
problems.Add($"{row.Valid} (meta): the catch-all line");
|
||||
}
|
||||
if (row.Valid != null && row.Kind == K.Ignored)
|
||||
{
|
||||
using var r = new Rig();
|
||||
var once = r.Meta(row.Valid);
|
||||
var twice = r.Meta(row.Valid);
|
||||
if (once.Count > 1 || twice.Count > 0) problems.Add($"{row.Valid} (meta, ignored): {Show(once)} then {Show(twice)}");
|
||||
}
|
||||
if (row.Invalid != null && row.Kind != K.Ignored)
|
||||
{
|
||||
using var r = new Rig();
|
||||
var lines = r.Meta(row.Invalid);
|
||||
if (!lines.Any(l => l.Type == CommandReply.FailColor))
|
||||
problems.Add($"{row.Invalid} (meta, wrong): no failure line: {Show(lines)}");
|
||||
var repeat = r.Meta(row.Invalid);
|
||||
if (repeat.Any(l => l.Type == CommandReply.FailColor))
|
||||
problems.Add($"{row.Invalid} (meta, wrong, again within a minute): said again: {Show(repeat)}");
|
||||
}
|
||||
}
|
||||
Report(problems, "a meta's command: quiet when it works, its error once a minute");
|
||||
|
||||
// The quiet success is in the log.
|
||||
using var logged = new Rig();
|
||||
logged.Meta("/ra power 80");
|
||||
Check.True(FakeHost.Logs.Any(l => l.Contains("Attack power set to 80%")), "a meta's quiet success is logged");
|
||||
Check.Eq(logged.S.MeleeAttackPower, 80, "and it worked");
|
||||
}
|
||||
|
||||
private static void UbOptSetSaysValue()
|
||||
{
|
||||
using var r = new Rig();
|
||||
Check.False(r.S.AutoVendorEnabled, "AutoVendor starts off");
|
||||
var lines = r.Typed("/ub opt set AutoVendor.Enabled true");
|
||||
Check.True(r.S.AutoVendorEnabled, "the setting changed");
|
||||
Check.Eq(Show(lines), "[1] [RynthAi] AutoVendor.Enabled = True", "one line: the option and its value now");
|
||||
|
||||
lines = r.Meta("/ub opt set AutoVendor.Enabled false");
|
||||
Check.False(r.S.AutoVendorEnabled, "a meta's set works");
|
||||
Check.Eq(lines.Count, 0, "and says nothing in chat");
|
||||
Check.True(FakeHost.Logs.Any(l => l == "[RynthAi] AutoVendor.Enabled = False"), "the log has it");
|
||||
|
||||
// The real meta route (MetaManager's chat-command action -> HandleMetaChatCommand) is quiet too.
|
||||
lines = Rig.Lines(() => r.Call("HandleMetaChatCommand", "/ub opt set AutoVendor.Enabled true"));
|
||||
Check.True(r.S.AutoVendorEnabled && lines.Count == 0, "HandleMetaChatCommand: set, quiet");
|
||||
lines = Rig.Lines(() => r.M.TryHandleVtCommand("/vt opt set enablecombat false"));
|
||||
Check.Eq(lines.Count, 1, "MetaManager's /vt outside a meta (typed): one line");
|
||||
Check.Eq(lines[0].Text, "[RynthAi] enablecombat = False", "the option and its value now");
|
||||
|
||||
// An option RynthAi doesn't map is kept for metas, and says so.
|
||||
lines = r.Typed("/ub opt set NoSuchOption 5");
|
||||
Check.True(lines.Count == 1 && lines[0].Text.Contains("NoSuchOption = 5") && lines[0].Text.Contains("kept only for metas"),
|
||||
"an unmapped option: its value, and that it is only kept for metas: " + Show(lines));
|
||||
}
|
||||
|
||||
private static void DeferredAnswers()
|
||||
{
|
||||
// /ra lootthis answers on the loot tick, as the line that asked: typed in chat ...
|
||||
using (var r = new Rig())
|
||||
{
|
||||
r.Typed("/ra lootthis");
|
||||
var lines = Rig.Lines(() => r.Call("TakeLootThisRequest", r.S));
|
||||
Check.True(lines.Count == 1 && lines[0].Text.Contains("LootThisCont"), "typed lootthis: the tick answers: " + Show(lines));
|
||||
}
|
||||
|
||||
// /ra metamgr is applied on the next tick; a meta's answer stays quiet there, a typed one shows.
|
||||
foreach (bool meta in new[] { false, true })
|
||||
{
|
||||
using var r = new Rig();
|
||||
if (meta) r.Meta("/ra metamgr on"); else r.Typed("/ra metamgr on");
|
||||
var queue = (System.Collections.Concurrent.ConcurrentQueue<(string[] Parts, bool FromScript)>)r.Get("_metaMgrCommands")!;
|
||||
var lines = Rig.Lines(() =>
|
||||
{
|
||||
while (queue.TryDequeue(out var q))
|
||||
r.P.Reply.RunQueued(q.FromScript, () => r.Call("HandleMetaMgrCommand", new object[] { q.Parts }));
|
||||
});
|
||||
Check.Eq(lines.Count, meta ? 0 : 1, meta ? "a meta's metamgr on: quiet on the tick" : "typed metamgr on: answered on the tick");
|
||||
}
|
||||
}
|
||||
|
||||
// ── The helper itself ───────────────────────────────────────────────────────
|
||||
|
||||
private static void HelperRules()
|
||||
{
|
||||
var chat = new List<(string Text, int Type)>();
|
||||
var log = new List<string>();
|
||||
bool meta = false;
|
||||
long now = 1_000_000;
|
||||
var reply = new CommandReply((t, c) => chat.Add((t, c)), log.Add, () => meta) { Clock = () => now };
|
||||
|
||||
reply.Run("/ra quiet", () => { });
|
||||
Check.True(chat.Count == 1 && chat[0].Text == CommandReply.RanPrefix + "/ra quiet", "typed, no answer: the catch-all line");
|
||||
Check.True(log.Any(l => l.Contains("gave no reply of its own")), "and the log names the command");
|
||||
|
||||
chat.Clear();
|
||||
reply.Run("/ra ok", () => reply.Ok("done"));
|
||||
Check.True(chat.Count == 1 && chat[0] == ("done", CommandReply.OkColor), "typed Ok: one line, the Ok colour");
|
||||
chat.Clear();
|
||||
reply.Run("/ra fail", () => reply.Fail("nope"));
|
||||
Check.True(chat.Count == 1 && chat[0] == ("nope", CommandReply.FailColor), "typed Fail: one line, the failure colour");
|
||||
chat.Clear();
|
||||
reply.Run("/ra throws", () => throw new InvalidOperationException("boom"));
|
||||
Check.True(chat.Count == 1 && chat[0].Text.Contains("failed (InvalidOperationException: boom)"), "typed, threw: says so, nothing escapes");
|
||||
chat.Clear();
|
||||
reply.Run("/ra answered", () => reply.Answered());
|
||||
Check.Eq(chat.Count, 0, "answered another way: no catch-all line");
|
||||
reply.Run("/ra ignored", () => reply.Ignored("not here"));
|
||||
Check.True(chat.Count == 1 && chat[0].Type == CommandReply.FailColor, "typed Ignored: a failure line");
|
||||
|
||||
// A meta's lines.
|
||||
chat.Clear(); log.Clear();
|
||||
meta = true;
|
||||
reply.Run("/ra ok", () => reply.Ok("done"));
|
||||
Check.Eq(chat.Count, 0, "meta Ok: no chat");
|
||||
Check.True(log.Contains("done"), "meta Ok: the log");
|
||||
reply.Run("/ra quiet", () => { });
|
||||
Check.Eq(chat.Count, 0, "meta, no answer: no catch-all line");
|
||||
reply.Ignored("not here");
|
||||
Check.Eq(chat.Count, 0, "meta Ignored: log only");
|
||||
reply.Fail("nope");
|
||||
reply.Fail("nope");
|
||||
Check.Eq(chat.Count, 1, "meta Fail: in chat, a repeat within a minute not");
|
||||
reply.Fail("other");
|
||||
Check.Eq(chat.Count, 2, "a different error is said");
|
||||
now += CommandReply.FailRepeatMs;
|
||||
reply.Fail("nope");
|
||||
Check.Eq(chat.Count, 3, "after a minute the same error is said again");
|
||||
Check.Eq(log.Count(l => l == "nope"), 3, "every one is logged");
|
||||
bool threw = false;
|
||||
try { reply.Run("/ra throws", () => throw new InvalidOperationException("boom")); }
|
||||
catch (InvalidOperationException) { threw = true; }
|
||||
Check.True(threw, "a meta's exception goes on as before");
|
||||
|
||||
// A script's line (RynthLua, a route's chat waypoint) is a meta's; a queued command keeps its sender.
|
||||
chat.Clear();
|
||||
meta = false;
|
||||
reply.AsScript(() => { reply.Ok("script done"); return true; });
|
||||
Check.Eq(chat.Count, 0, "AsScript Ok: quiet");
|
||||
reply.RunQueued(true, () => reply.Ok("queued by a meta"));
|
||||
Check.Eq(chat.Count, 0, "RunQueued(meta) Ok: quiet");
|
||||
reply.RunQueued(false, () => reply.Ok("queued by the player"));
|
||||
Check.Eq(chat.Count, 1, "RunQueued(typed) Ok: in chat");
|
||||
meta = true;
|
||||
reply.RunQueued(false, () => reply.Ok("typed, run while a meta acts"));
|
||||
Check.Eq(chat.Count, 2, "the queued sender wins over a meta running now");
|
||||
}
|
||||
}
|
||||
|
|
@ -105,7 +105,7 @@ internal static class MetaSampleCompatTests
|
|||
FakeHost.GroundContainer = 0x80F00001;
|
||||
w.Ub("/ub close corpse");
|
||||
Check.True(FakeHost.Closes.Contains(0x80F00001), "closes the open container");
|
||||
Check.False(FakeHost.Chat.Any(c => c.Contains("Unrecognized")), "never 'Unrecognized /ub command'");
|
||||
Check.False(FakeHost.Chat.Any(c => c.Contains("Unrecognized") || c.Contains("Unknown /ub command")), "never 'Unknown /ub command'");
|
||||
}
|
||||
|
||||
private static void UbExpression()
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ internal static class UbCompatTests
|
|||
|
||||
public static void Register(Runner r)
|
||||
{
|
||||
r.Add("ub compat: ub-IT verbs with no RynthAi equivalent are accepted, said once", NoEquivalentAccepted);
|
||||
r.Add("ub compat: ub-IT verbs with no RynthAi equivalent are accepted, said once to a meta and every time typed", NoEquivalentAccepted);
|
||||
r.Add("ub compat: ub-Rythai's verbs get no RynthAi reply, and a meta passes them on", UbRythaiVerbsLeftAlone);
|
||||
r.Add("ub compat: aliases and features map onto RynthAi, RynthNav, RynthSort and the server", AliasesAndFeatures);
|
||||
r.Add("ub compat: a meta's /ub line uses the /ub meaning, not /mt's", MetaUsesUbMeaning);
|
||||
|
|
@ -70,13 +70,17 @@ internal static class UbCompatTests
|
|||
private static void NoEquivalentAccepted()
|
||||
{
|
||||
var w = new World();
|
||||
Check.True(w.Ub("/ub soak on"), "/ub soak is handled");
|
||||
Check.True(w.Ub("/ub soak off"), "again");
|
||||
Check.Eq(w.ChatWith("/ub soak"), 1, "said once per session, not per meta pulse");
|
||||
Check.True(w.Meta("/ub soak on"), "/ub soak is handled");
|
||||
Check.True(w.Meta("/ub soak off"), "again");
|
||||
Check.Eq(w.ChatWith("/ub soak"), 1, "a meta's: said once per session, not per meta pulse");
|
||||
// Typed, it answers every time (a typed command always answers, CommandReply.cs).
|
||||
Check.True(w.Ub("/ub soak on"), "typed /ub soak is handled");
|
||||
Check.True(w.Ub("/ub soak on"), "typed again");
|
||||
Check.Eq(w.ChatWith("/ub soak"), 3, "typed: said each time");
|
||||
// /ub videopatch is not here: RynthAi already forwards it to the engine's /rc videopatch.
|
||||
foreach (string line in new[] { "/ub chat max", "/ub playeroption AutoRepeatAttack on", "/ub statushud toggle", "/ub professor war 7", "/ub xp level" })
|
||||
Check.True(w.Ub(line), line + " is handled");
|
||||
Check.Eq(w.ChatWith("Unrecognized"), 0, "no 'Unrecognized /ub command'");
|
||||
Check.Eq(w.ChatWith("Unrecognized") + w.ChatWith("Unknown /ub command"), 0, "no 'Unknown /ub command'");
|
||||
Check.False(w.Ub("/ub notaubitcommand"), "a verb ub-IT doesn't have is still unknown");
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +125,7 @@ internal static class UbCompatTests
|
|||
w.Ub("/ub packsort");
|
||||
Check.True(FakeHost.PluginCommands.Contains(("RynthSort", "rsort", "now")), "packsort -> /rsort now");
|
||||
|
||||
// Server and engine commands go to the chat parser.
|
||||
// Server commands go to the chat parser.
|
||||
w.Ub("/ub qblist");
|
||||
w.Ub("/ub augs");
|
||||
w.Ub("/ub window save");
|
||||
|
|
@ -129,7 +133,9 @@ internal static class UbCompatTests
|
|||
// qblist / augs are ACECustom's commands: the server plugin's (RynthILT) since 2026-10-20.
|
||||
Check.False(FakeHost.ChatCommands.Contains("/qb list") || FakeHost.ChatCommands.Contains("/aug"),
|
||||
"qblist / augs: no server plugin, so nothing is sent to the server");
|
||||
Check.True(FakeHost.ChatCommands.Contains("/rc window save"), "window save -> /rc window save");
|
||||
// The engine has no /rc window save (it never had): RynthAi says where the setting is instead.
|
||||
Check.False(FakeHost.ChatCommands.Contains("/rc window save"), "window save sends no engine command");
|
||||
Check.Eq(w.ChatWith("Remember Game Window Position"), 1, "window save says where RynthCore keeps the window");
|
||||
Check.True(FakeHost.ChatCommands.Contains("/fellowship dismiss Storm"), "fellow dismiss -> /fellowship dismiss");
|
||||
|
||||
// With a server plugin they are its verbs ("ub qblist", "ub augs").
|
||||
|
|
|
|||
|
|
@ -285,7 +285,10 @@ internal static class UbMtSafetyTests
|
|||
w.Meta("/mt trade accept");
|
||||
Check.Eq(FakeHost.TradeActions.Count, 0, "macro off or Meta off: no trade accept");
|
||||
Check.Eq(FakeHost.VendorSells.Count, 0, "macro off: no sale");
|
||||
Check.Eq(w.ChatWith("only runs from a meta that is running"), 6, "all refused with the reason");
|
||||
// A meta repeating the same refusal says it once a minute (CommandReply.cs): the second
|
||||
// "/mt trade accept" refusal is in the log, not in chat again.
|
||||
Check.Eq(w.ChatWith("only runs from a meta that is running"), 5, "all refused with the reason (a meta's repeat once)");
|
||||
Check.Eq(w.LogWith("/mt trade accept only runs from a meta that is running"), 3, "every refusal is logged (one typed, two from the meta)");
|
||||
}
|
||||
finally { w.Dispose(); }
|
||||
}
|
||||
|
|
|
|||
199
Tools/RynthDefective.Tests/CorpseTests.cs
Normal file
199
Tools/RynthDefective.Tests/CorpseTests.cs
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using RynthCore.Plugin.RynthDefective.Corpses;
|
||||
|
||||
namespace RynthDefective.Tests
|
||||
{
|
||||
internal static partial class Program
|
||||
{
|
||||
private static readonly DateTime T0 = new(2026, 10, 23, 22, 0, 0, DateTimeKind.Utc);
|
||||
|
||||
// An outdoor landcell: landblock 0xA9B4 (Holtburg), outdoor cell 0x0016; a dungeon one: 0x6146 cell 0x0258.
|
||||
private const uint Outdoor = 0xA9B40016u, Dungeon = 0x61460258u;
|
||||
|
||||
private static void CorpseLinesParse()
|
||||
{
|
||||
Check(CorpseLines.TryLocated("Your corpse is located at (42.1N, 33.6E).", out double ns, out double ew) && ns == 42.1 && ew == 33.6, "N/E");
|
||||
Check(CorpseLines.TryLocated("Your corpse is located at (0.5S, 12.0W).", out ns, out ew) && ns == -0.5 && ew == -12.0, "S/W");
|
||||
Check(CorpseLines.IsCorpseLine("Your corpse is located at (42.1N, 33.6E)."), "a corpse line");
|
||||
Check(CorpseLines.IsNothingDropped("You have retained all your items. You do not need to recover your corpse!"), "nothing dropped");
|
||||
Check(!CorpseLines.IsCorpseLine("Corpse of Olthoi Slayer"), "a corpse's name isn't a line");
|
||||
}
|
||||
|
||||
private static void CorpseDeaths()
|
||||
{
|
||||
var b = new CorpseBook();
|
||||
b.Died(T0, Outdoor, 100f, 50f, 20f, level: 30);
|
||||
Eq(b.Corpses.Count, 1, "a death is a corpse");
|
||||
Eq(b.Corpses[0].RotsUtc, T0.AddSeconds(30 * 300), "rots after level x 5 min");
|
||||
b.ServerLine(T0.AddSeconds(1), 42.1, 33.6, 30);
|
||||
Eq(b.Corpses.Count, 1, "the server's line is the same death");
|
||||
Check(b.Corpses[0].ServerCoords && b.Corpses[0].Ns == 42.1 && b.Corpses[0].Cell == Outdoor, "the server's coordinates added to the place");
|
||||
|
||||
// The line first, then the health.
|
||||
var b2 = new CorpseBook();
|
||||
b2.ServerLine(T0, 42.1, 33.6, 5);
|
||||
Check(b2.Corpses.Count == 1 && b2.Corpses[0].Cell == 0, "the line alone: map coordinates only");
|
||||
Eq(b2.Corpses[0].RotsUtc, T0.AddHours(1), "low level: an hour");
|
||||
b2.Died(T0.AddSeconds(1), Outdoor, 100f, 50f, 20f, 5);
|
||||
Check(b2.Corpses.Count == 1 && b2.Corpses[0].Cell == Outdoor, "the death fills in the place");
|
||||
|
||||
// Nothing dropped, after and before the death.
|
||||
var b3 = new CorpseBook();
|
||||
b3.Died(T0, Dungeon, 10f, 20f, -6f, 100);
|
||||
b3.NothingDropped(T0.AddSeconds(1));
|
||||
Eq(b3.Corpses.Count, 0, "nothing dropped: no corpse to note");
|
||||
b3.NothingDropped(T0.AddMinutes(10));
|
||||
b3.Died(T0.AddMinutes(10).AddSeconds(1), Dungeon, 10f, 20f, -6f, 100);
|
||||
Eq(b3.Corpses.Count, 0, "the line before the health: still nothing noted");
|
||||
b3.Died(T0.AddMinutes(20), Dungeon, 10f, 20f, -6f, 100);
|
||||
Eq(b3.Corpses.Count, 1, "a later death is noted again");
|
||||
|
||||
// Two deaths, minutes apart: two corpses, the newest first.
|
||||
var b4 = new CorpseBook();
|
||||
b4.Died(T0, Outdoor, 100f, 50f, 20f, 50);
|
||||
b4.Died(T0.AddMinutes(5), Dungeon, 10f, 20f, -6f, 50);
|
||||
b4.ServerLine(T0.AddMinutes(5).AddSeconds(1), 1, 1, 50);
|
||||
Check(b4.Corpses.Count == 2 && b4.Corpses[0].Cell == Dungeon && !b4.Corpses[1].ServerCoords, "the line goes to the latest death only");
|
||||
}
|
||||
|
||||
private static void CorpseSeen()
|
||||
{
|
||||
var b = new CorpseBook();
|
||||
b.Died(T0, Dungeon, 10f, 20f, -6f, 100);
|
||||
CorpseRecord r = b.Seen(T0.AddMinutes(3), 0x80001234u, Dungeon, 11f, 21f, -6f);
|
||||
Check(b.Corpses.Count == 1 && r.ObjectId == 0x80001234u && r.X == 11f, "the corpse seen is the death next to it");
|
||||
Eq(r.DiedUtc, T0, "it keeps the death's time");
|
||||
b.Seen(T0.AddMinutes(4), 0x80001234u, Dungeon, 11f, 21f, -6f);
|
||||
Eq(b.Corpses.Count, 1, "seen again by id");
|
||||
|
||||
// Another dungeon, and the same dungeon far away: found corpses of their own.
|
||||
b.Seen(T0.AddMinutes(5), 0x80005555u, 0x01E90100u, 1f, 1f, 0f);
|
||||
Eq(b.Corpses.Count, 2, "another dungeon: a corpse found");
|
||||
Check(b.Corpses[1].DiedUtc == DateTime.MinValue || b.Corpses[0].DiedUtc == DateTime.MinValue, "found: no death time");
|
||||
var b2 = new CorpseBook();
|
||||
b2.Died(T0, Dungeon, 10f, 20f, -6f, 100);
|
||||
b2.Seen(T0.AddMinutes(1), 0x80000001u, Dungeon, 10f + 80f, 20f, -6f);
|
||||
Eq(b2.Corpses.Count, 2, "80 m off: not that death");
|
||||
// Two corpses near a death (as on the test client): the one 30 m off is found, the one beside it is the death.
|
||||
var b2b = new CorpseBook();
|
||||
b2b.Died(T0, Dungeon, 30f, -202.8f, -24f, 100);
|
||||
b2b.Seen(T0.AddSeconds(3), 0x8000383Au, Dungeon, 48.2f, -178.9f, -18f);
|
||||
b2b.Seen(T0.AddSeconds(3), 0x80003841u, Dungeon, 28.3f, -204.8f, -24f);
|
||||
CorpseRecord death = b2b.Corpses[0].DiedUtc == T0 ? b2b.Corpses[0] : b2b.Corpses[1];
|
||||
Check(b2b.Corpses.Count == 3 - 1 && death.ObjectId == 0x80003841u, "the death goes to the corpse beside it, not the first seen");
|
||||
|
||||
// Outdoors, the server's coordinates only: matched by map distance.
|
||||
var b3 = new CorpseBook();
|
||||
CorpseBook.MapCoords(Outdoor, 100f, 50f, out double ns, out double ew);
|
||||
b3.ServerLine(T0, Math.Round(ns, 1), Math.Round(ew, 1), 100);
|
||||
b3.Seen(T0.AddMinutes(2), 0x80000002u, Outdoor, 100f, 50f, 20f);
|
||||
Check(b3.Corpses.Count == 1 && b3.Corpses[0].Cell == Outdoor && b3.Corpses[0].ObjectId == 0x80000002u, "matched to the server's line");
|
||||
}
|
||||
|
||||
private static void CorpseGoneAndExpiry()
|
||||
{
|
||||
// Leaving view: gone only when opened, due to rot, or right beside you.
|
||||
var v = new CorpseRecord { DiedUtc = T0, RotsUtc = T0.AddHours(5), Cell = Dungeon, ObjectId = 1 };
|
||||
Check(!CorpseBook.VanishMeansGone(v, 30, T0.AddMinutes(20)), "30 m off, not opened: only out of sight");
|
||||
Check(CorpseBook.VanishMeansGone(v, 8, T0.AddMinutes(20)), "beside you: gone");
|
||||
var vb = new CorpseBook();
|
||||
vb.Seen(T0, 0x80000010u, Dungeon, 10f, 20f, -6f);
|
||||
vb.Opened(0x80000010u, T0.AddMinutes(1));
|
||||
Check(CorpseBook.VanishMeansGone(vb.Corpses[0], 30, T0.AddMinutes(2)), "opened: its vanishing is the looting");
|
||||
Check(!CorpseBook.VanishMeansGone(vb.Corpses[0], 30, T0.AddMinutes(30)), "opened long ago: no longer");
|
||||
Check(CorpseBook.VanishMeansGone(v, 500, T0.AddHours(5).AddMinutes(-2)), "due to rot: gone");
|
||||
|
||||
// Standing at its place without it there.
|
||||
var n = new CorpseRecord { DiedUtc = T0, Cell = Dungeon, ObjectId = 5 };
|
||||
Check(!CorpseBook.NotThere(n, 3, false, T0.AddSeconds(30)) && !CorpseBook.NotThere(n, 3, false, T0.AddSeconds(50)), "not in the first 2 minutes");
|
||||
Check(!CorpseBook.NotThere(n, 3, false, T0.AddMinutes(3)), "missing: the timer starts");
|
||||
Check(!CorpseBook.NotThere(n, 3, false, T0.AddMinutes(3).AddSeconds(5)), "5 s: not yet");
|
||||
Check(!CorpseBook.NotThere(n, 3, true, T0.AddMinutes(3).AddSeconds(6)), "in view: the timer stops");
|
||||
Check(!CorpseBook.NotThere(n, 3, false, T0.AddMinutes(3).AddSeconds(7)) && CorpseBook.NotThere(n, 3, false, T0.AddMinutes(3).AddSeconds(17)), "10 s missing: dropped");
|
||||
var far = new CorpseRecord { DiedUtc = T0, Cell = Dungeon };
|
||||
Check(!CorpseBook.NotThere(far, 30, false, T0.AddMinutes(3)) && !CorpseBook.NotThere(far, 30, false, T0.AddMinutes(4)), "30 m off: never");
|
||||
|
||||
var b = new CorpseBook();
|
||||
b.Died(T0, Dungeon, 10f, 20f, -6f, 12); // rots after an hour (level 12 x 5 min is less)
|
||||
b.Seen(T0.AddMinutes(1), 0x80001234u, Dungeon, 10f, 20f, -6f);
|
||||
Check(!b.Gone(0x80009999u) && b.Gone(0x80001234u) && b.Corpses.Count == 0, "gone by its id");
|
||||
|
||||
b.Died(T0, Dungeon, 10f, 20f, -6f, 12);
|
||||
Check(!b.Expire(T0.AddMinutes(65)), "kept through the grace after its rot time");
|
||||
Check(b.Expire(T0.AddMinutes(71)) && b.Corpses.Count == 0, "dropped 10 min after it");
|
||||
|
||||
b.Seen(T0, 0x80000003u, Dungeon, 10f, 20f, -6f);
|
||||
Check(!b.Expire(T0.AddHours(47)) && b.Expire(T0.AddHours(49)), "a found corpse: 48 h after it was last seen");
|
||||
|
||||
for (int i = 0; i < CorpseBook.MaxCorpses + 5; i++) b.Died(T0.AddMinutes(10 * i), Dungeon, i * 100f, 0f, 0f, 200);
|
||||
Eq(b.Corpses.Count, CorpseBook.MaxCorpses, "at most 20");
|
||||
Eq(b.Corpses[0].DiedUtc, T0.AddMinutes(10 * (CorpseBook.MaxCorpses + 4)), "the newest first, the oldest dropped");
|
||||
Check(b.Forget(b.Corpses[0]) && b.Corpses.Count == CorpseBook.MaxCorpses - 1, "forget");
|
||||
}
|
||||
|
||||
private static void CorpseStoreFiles()
|
||||
{
|
||||
var st = new CorpseStore(Path.Combine(_temp, "corpses-store"));
|
||||
var b = new CorpseBook();
|
||||
b.Died(T0, Outdoor, 100.25f, 50.5f, 20f, 60);
|
||||
b.ServerLine(T0.AddSeconds(1), 42.1, -33.6, 60);
|
||||
b.Seen(T0.AddMinutes(1), 0x80001234u, Outdoor, 100.25f, 50.5f, 20f);
|
||||
b.Seen(T0.AddMinutes(2), 0x80005678u, Dungeon, 1f, 2f, 3f);
|
||||
Check(st.Save("Aelrynth", "Drak/kon", b.Corpses) == null, "saved");
|
||||
Check(File.Exists(Path.Combine(_temp, "corpses-store", "corpses", "Aelrynth_Drak_kon.json")), "the file name is safe");
|
||||
var back = st.Load("Aelrynth", "Drak/kon", out string? problem);
|
||||
Check(problem == null && back.Count == 2, "loaded both");
|
||||
CorpseRecord a = back.Find(c => c.ObjectId == 0x80001234u)!;
|
||||
Check(a != null && a.DiedUtc == T0 && a.RotsUtc == T0.AddSeconds(60 * 300) && a.Cell == Outdoor && a.X == 100.25f
|
||||
&& a.ServerCoords && a.Ns == 42.1 && a.Ew == -33.6, "a death's corpse round-trips");
|
||||
CorpseRecord f = back.Find(c => c.ObjectId == 0x80005678u)!;
|
||||
Check(f != null && f.DiedUtc == DateTime.MinValue && f.SeenUtc == T0.AddMinutes(2), "a found corpse round-trips");
|
||||
|
||||
st.Save("Aelrynth", "Aryze", new[] { new CorpseRecord { DiedUtc = T0, RotsUtc = T0.AddHours(2), Cell = Dungeon } });
|
||||
st.Save("Aelrynth", "Old", new[] { new CorpseRecord { DiedUtc = T0.AddDays(-3), RotsUtc = T0.AddDays(-2), Cell = Dungeon } });
|
||||
File.WriteAllText(Path.Combine(_temp, "corpses-store", "corpses", "broken.json"), "{ not json");
|
||||
var others = st.LoadOthers("Aelrynth", "Drak/kon", T0.AddMinutes(5));
|
||||
Check(others.Count == 1 && others[0].Character == "Aryze" && others[0].Corpses.Count == 1, "others: rotted and broken files skipped, own left out");
|
||||
Check(st.Load("Aelrynth", "Nobody", out problem).Count == 0 && problem == null, "no file: no corpses");
|
||||
}
|
||||
|
||||
private static void CorpseRowText()
|
||||
{
|
||||
PlaceNames.LoadForTests("{\"locations\":[{\"name\":\"Matron Hive East\",\"type\":\"Dungeon\",\"ns\":-49.78,\"ew\":61.97,\"cell\":\"CC410000\",\"lb\":\"6146\"},"
|
||||
+ "{\"name\":\"Holtburg\",\"type\":\"Town\",\"ns\":42.1,\"ew\":33.6,\"cell\":\"A9B40016\"}]}");
|
||||
var dungeon = new CorpseRecord { DiedUtc = T0, RotsUtc = T0.AddHours(3), Cell = Dungeon, X = 10f, Y = 20f, Z = -6f };
|
||||
Eq(CorpseRows.Place(dungeon), "Matron Hive East", "a dungeon by its name");
|
||||
Eq(CorpseRows.Place(new CorpseRecord { Cell = 0x01E90100u }), "Dungeon 01E9", "an unnamed dungeon by its landblock");
|
||||
CorpseBook.MapCoords(Outdoor, 100f, 50f, out double ns, out double ew);
|
||||
Eq(CorpseRows.Place(new CorpseRecord { Cell = Outdoor, X = 100f, Y = 50f }), CorpseRows.Coords(ns, ew), "outdoors: the map coordinates");
|
||||
Eq(CorpseRows.Place(new CorpseRecord { Cell = 0xA9B40105u, X = 100f, Y = 50f }), CorpseRows.Coords(ns, ew) + " (indoors)", "a building in town");
|
||||
Eq(CorpseRows.Coords(-49.78, 61.97), "49.8S, 62.0E", "coordinates");
|
||||
|
||||
Eq(CorpseRows.Span(TimeSpan.FromSeconds(40)), "40s", "seconds");
|
||||
Eq(CorpseRows.Span(TimeSpan.FromMinutes(25.5)), "25m", "minutes");
|
||||
Eq(CorpseRows.Span(TimeSpan.FromMinutes(190)), "3h 10m", "hours");
|
||||
Eq(CorpseRows.Span(TimeSpan.FromHours(52)), "2d 4h", "days");
|
||||
Eq(CorpseRows.Age(dungeon, T0.AddMinutes(25)), "died 25m ago", "age");
|
||||
Eq(CorpseRows.Rot(dungeon, T0.AddMinutes(25)), "rots in ~2h 35m", "rot estimate");
|
||||
Eq(CorpseRows.Rot(dungeon, T0.AddHours(4)), "may have rotted", "past its time");
|
||||
|
||||
// Standing in the same dungeon 30 m south of it, facing north: ahead, 30 yd N.
|
||||
var me = new PlayerSpot(Dungeon, 10f, -10f, -6f, 0);
|
||||
CorpsesView v = CorpseRows.Build(new[] { dungeon }, Array.Empty<OtherCorpses>(), me, T0.AddMinutes(25));
|
||||
Eq(v.Mine[0].Detail, "died 25m ago · rots in ~2h 35m · 30 yd N", "the detail line");
|
||||
Check(MathF.Abs(v.Mine[0].Relative) < 0.01f, "the arrow points ahead");
|
||||
// Facing east: it's to the left.
|
||||
v = CorpseRows.Build(new[] { dungeon }, Array.Empty<OtherCorpses>(), me with { FacingDeg = 90 }, T0.AddMinutes(25));
|
||||
Check(MathF.Abs(v.Mine[0].Relative + 90f) < 0.01f, "the arrow points left");
|
||||
// Another dungeon: no distance, no arrow.
|
||||
v = CorpseRows.Build(new[] { dungeon }, Array.Empty<OtherCorpses>(), new PlayerSpot(0x01E90100u, 1, 1, 0, 0), T0.AddMinutes(25));
|
||||
Check(v.Mine[0].Detail == "died 25m ago · rots in ~2h 35m" && float.IsNaN(v.Mine[0].Relative), "elsewhere: no distance");
|
||||
// Another character's: its name first.
|
||||
var other = new OtherCorpses("Aelrynth", "Aryze", new[] { dungeon });
|
||||
v = CorpseRows.Build(Array.Empty<CorpseRecord>(), new[] { other }, me, T0.AddMinutes(25));
|
||||
Check(v.Mine.Count == 0 && v.Others.Count == 1 && v.Others[0].Detail.StartsWith("Aryze · died 25m ago", StringComparison.Ordinal)
|
||||
&& v.Others[0].Record == null, "another character's row");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -56,6 +56,8 @@ namespace RynthDefective.Tests
|
|||
Run("picker: favourites and recent weapons first", PickerShortcuts);
|
||||
Run("pack list: one line per kind of item", PackLists);
|
||||
Run("commands: /rdef parsing", Commands);
|
||||
Run("replies: the shared queue (tag, colours, retry, drop, quiet)", ReplyQueue);
|
||||
Run("replies: every /rdef verb answers, typed right or wrong", ReplyEveryVerb);
|
||||
Run("store: save and load", StoreRoundTrip);
|
||||
Run("store: odd files", StoreOddFiles);
|
||||
Run("hotkeys: the engine's file read for the key under a slot", HotkeyFile);
|
||||
|
|
@ -93,6 +95,12 @@ namespace RynthDefective.Tests
|
|||
Run("bar: making it independent offers to copy the game's 18 slots", BarIndependentCopy);
|
||||
Run("store: the independent bar setting; files from before read it off", BarStoreIndependent);
|
||||
Run("window: the settings window parses and its switches reach their code", BarSettingsWindow);
|
||||
Run("corpses: the server's lines", CorpseLinesParse);
|
||||
Run("corpses: a death, the server's line before or after it, nothing dropped", CorpseDeaths);
|
||||
Run("corpses: a corpse in view is the death beside it, else one found", CorpseSeen);
|
||||
Run("corpses: gone, rotted, at most 20, forget", CorpseGoneAndExpiry);
|
||||
Run("corpses: the files, this character's and the others'", CorpseStoreFiles);
|
||||
Run("corpses: rows: places, times, distance and the arrow", CorpseRowText);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
|||
133
Tools/RynthDefective.Tests/ReplyTests.cs
Normal file
133
Tools/RynthDefective.Tests/ReplyTests.cs
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthDefective.Model;
|
||||
using RynthCore.Plugin.Shared;
|
||||
|
||||
namespace RynthDefective.Tests
|
||||
{
|
||||
// Every /rdef command answers in chat (2026-10-28). The commands themselves need the game (the
|
||||
// plugin's host), so these check the shared reply queue and, verb by verb, the parse and the line
|
||||
// the plugin says for it.
|
||||
internal static partial class Program
|
||||
{
|
||||
/// <summary>The shared queue every plugin answers through (Plugins/Shared/CommandReply.cs).</summary>
|
||||
private static void ReplyQueue()
|
||||
{
|
||||
var chat = new List<(string Line, int Type)>();
|
||||
var log = new List<string>();
|
||||
bool accept = true;
|
||||
var r = new CommandReply("[RynthTest]", (t, c) => { if (!accept) return false; chat.Add((t, c)); return true; }, log.Add);
|
||||
|
||||
// Nothing waiting: written at once.
|
||||
r.Ok("Bar shown.");
|
||||
r.Fail("Which slot? e.g. /rdef clear 3");
|
||||
r.Ok("[Mini Remote] already tagged");
|
||||
Eq(r.Pending, 0, "the host took every line at once");
|
||||
Eq(r.Count, 3, "three replies counted");
|
||||
Eq(chat.Count, 3, "all three written");
|
||||
Eq(chat[0], ("[RynthTest] Bar shown.", CommandReply.OkChatType), "ok: the tag in front, green");
|
||||
Eq(chat[1], ("[RynthTest] Which slot? e.g. /rdef clear 3", CommandReply.FailChatType), "fail: its own colour");
|
||||
Eq(chat[2].Line, "[Mini Remote] already tagged", "a line with its own tag keeps it");
|
||||
Check(log.Contains("[RynthTest] Which slot? e.g. /rdef clear 3"), "a failure is logged too");
|
||||
Check(!r.Flush(), "nothing left");
|
||||
|
||||
// The host refuses (another plugin wrote within 100 ms): the line waits, and so does every
|
||||
// line after it (they stay in order); Flush offers them again, one per tick.
|
||||
chat.Clear();
|
||||
accept = false;
|
||||
r.Ok("Using Stamina Kit (slot 1).");
|
||||
r.Ok("second");
|
||||
for (int i = 0; i < 5; i++) r.Flush();
|
||||
Eq(r.Pending, 2, "refused lines wait");
|
||||
accept = true;
|
||||
r.Ok("third");
|
||||
Eq(chat.Count, 0, "a new line waits behind the refused ones, even when the host would take it");
|
||||
Check(r.Flush(), "the first goes out when the host takes it");
|
||||
Eq(r.Pending, 2, "one line per flush (the host drops a second one within 100 ms)");
|
||||
r.Flush(); r.Flush();
|
||||
Eq(string.Join("|", chat.ConvertAll(c => c.Line)), "[RynthTest] Using Stamina Kit (slot 1).|[RynthTest] second|[RynthTest] third", "in order");
|
||||
|
||||
// A line the host never takes goes to the log after MaxTries, and the next one moves up.
|
||||
chat.Clear();
|
||||
accept = false;
|
||||
log.Clear();
|
||||
r.Ok("first");
|
||||
r.Ok("next");
|
||||
for (int i = 0; i < CommandReply.MaxTries; i++) r.Flush();
|
||||
Eq(r.Pending, 1, "the stuck line is dropped after MaxTries");
|
||||
Check(log.Exists(l => l.Contains("[RynthTest] first", StringComparison.Ordinal)), "and logged");
|
||||
accept = true;
|
||||
r.Flush();
|
||||
Eq(chat[^1].Line, "[RynthTest] next", "the next line moves up");
|
||||
|
||||
// Line breaks: one chat line each, each tagged. Quiet: logged only. Blank: nothing.
|
||||
chat.Clear();
|
||||
log.Clear();
|
||||
int before = r.Count;
|
||||
r.Ok("line one\nline two");
|
||||
r.Ok("a script's success", quiet: true);
|
||||
r.Fail(" ");
|
||||
while (r.Flush()) { }
|
||||
Eq(chat.Count, 2, "two lines for a text with a line break");
|
||||
Eq(chat[1].Line, "[RynthTest] line two", "the second line tagged too");
|
||||
Check(log.Contains("[RynthTest] a script's success"), "quiet: in the log");
|
||||
Check(!chat.Exists(c => c.Line.Contains("script's success", StringComparison.Ordinal)), "quiet: not in chat");
|
||||
Eq(r.Count - before, 2, "quiet counts as an answer, a blank text doesn't");
|
||||
accept = false;
|
||||
r.Ok("x"); r.Clear();
|
||||
Eq(r.Pending, 0, "Clear forgets the waiting lines");
|
||||
Eq(CommandReply.Shown("Weapon picker", false), "Weapon picker hidden.", "the shared shown/hidden wording");
|
||||
}
|
||||
|
||||
/// <summary>Each /rdef verb, typed right and typed wrong: what it answers.</summary>
|
||||
private static void ReplyEveryVerb()
|
||||
{
|
||||
// Wrong words: the parser's error is the reply, with an example or the usage.
|
||||
string[] wrong = { "use", "set", "set x", "set 0", "spell 3", "spell", "clear", "clear x", "bind 3", "bind", "unbind", "unbind x", "slots", "slots 99" };
|
||||
foreach (string w in wrong)
|
||||
{
|
||||
DefCommand c = DefCommandParser.Parse(w);
|
||||
Check(c.Verb == DefVerb.Error && c.Error.Length > 0, $"'/rdef {w}' answers why");
|
||||
Check(c.Error.Contains("e.g.", StringComparison.Ordinal) || c.Error.Contains("Usage", StringComparison.Ordinal)
|
||||
|| c.Error.Contains("How many", StringComparison.Ordinal), $"'/rdef {w}' shows how it's typed: {c.Error}");
|
||||
}
|
||||
|
||||
// Right words: every verb the parser knows maps to an answer.
|
||||
var right = new (string Typed, DefVerb Verb)[]
|
||||
{
|
||||
("", DefVerb.Toggle), ("help", DefVerb.Help), ("list", DefVerb.List), ("status", DefVerb.Status),
|
||||
("panels", DefVerb.Panels), ("settings", DefVerb.Settings), ("selection", DefVerb.Selection),
|
||||
("selection 0x80001234", DefVerb.Selection), ("fav", DefVerb.Favourite), ("weapons", DefVerb.Weapons),
|
||||
("weapons fire", DefVerb.Weapons), ("use 1", DefVerb.Use), ("use Stamina Kit", DefVerb.Use),
|
||||
("set 2", DefVerb.Set), ("spell 3 Heal Self VI", DefVerb.Spell), ("clear 4", DefVerb.Clear),
|
||||
("bind 3 F9", DefVerb.Bind), ("unbind 3", DefVerb.Unbind), ("slots 12", DefVerb.Slots),
|
||||
("Stamina Kit", DefVerb.Use), ("corpses", DefVerb.Corpses), ("corpses clear", DefVerb.Corpses),
|
||||
};
|
||||
var seen = new HashSet<DefVerb>();
|
||||
foreach (var (typed, verb) in right)
|
||||
{
|
||||
Eq(DefCommandParser.Parse(typed).Verb, verb, $"'/rdef {typed}'");
|
||||
seen.Add(verb);
|
||||
}
|
||||
foreach (DefVerb v in Enum.GetValues<DefVerb>())
|
||||
Check(v == DefVerb.Error || seen.Contains(v), $"the table covers /rdef's {v}");
|
||||
|
||||
// The lines for the verbs that used to say nothing.
|
||||
Eq(DefReplies.Window("Shortcuts bar", 1), (true, "Shortcuts bar shown."), "toggle: shown");
|
||||
Eq(DefReplies.Window("Shortcuts bar", 0), (true, "Shortcuts bar hidden."), "toggle: hidden");
|
||||
Check(!DefReplies.Window("Selection window", -1).Ok, "a window the engine doesn't have: why not");
|
||||
var item = new DefSlot { Item = new ItemRef { Name = "Stamina Kit" } };
|
||||
Eq(DefReplies.UseSlot(item, 1), "Using Stamina Kit (slot 1).", "use: an item slot");
|
||||
var spell = new DefSlot { SpellId = 1, SpellName = "Strength Other I" };
|
||||
Check(DefReplies.UseSlot(spell, 2).StartsWith("Casting ", StringComparison.Ordinal), "use: a spell slot casts");
|
||||
Eq(DefReplies.UseName(" Peerless Healing Kit "), "Using Peerless Healing Kit.", "use by name");
|
||||
Eq(DefReplies.Weapons(true, "fire"), "Weapon picker shown, searching 'fire'.", "weapons with a search");
|
||||
Eq(DefReplies.Weapons(false, ""), "Weapon picker hidden.", "weapons: hidden");
|
||||
Check(DefReplies.TryParseSelection("0x80001234", out uint id, out _) && id == 0x80001234, "selection: a hex id");
|
||||
Check(!DefReplies.TryParseSelection("bob", out _, out string why) && why.Contains("Usage", StringComparison.Ordinal), "selection: not an id, the usage");
|
||||
Check(DefReplies.Selected(0x80001234, true, "Pack").Ok, "selection: selected");
|
||||
Check(!DefReplies.Selected(0x80001234, false, null).Ok, "selection: the game said no");
|
||||
Check(DefReplies.NoStack.Length > 0, "selection stack: none to select");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -37,6 +37,7 @@
|
|||
<Compile Include="..\..\Plugins\Shared\RynthAiActivityApi.cs" Link="Shared\RynthAiActivityApi.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\RynthAiStatusApi.cs" Link="Shared\RynthAiStatusApi.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\RynthInstallPaths.cs" Link="Shared\RynthInstallPaths.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\CommandReply.cs" Link="Shared\CommandReply.cs" />
|
||||
<!-- The shortcut bar, panel buttons and Selection windows (2026-10-22) draw with the shared ImGui look. -->
|
||||
<Compile Include="..\..\Plugins\Shared\ImGuiNativeBinding.cs" Link="Shared\ImGuiNativeBinding.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\SafeImGui.cs" Link="Shared\SafeImGui.cs" />
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ namespace RynthInventory.Tests
|
|||
Run("window events", Events);
|
||||
Run("banking: no Banking tab (it is RynthILT's own, 2026-10-21)", NoBankingTab);
|
||||
Run("storage from other plugins (StorageFeed)", StorageFeedTests);
|
||||
Run("replies: every /ginv word answers", Replies);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
|||
36
Tools/RynthInventory.Tests/ReplyTests.cs
Normal file
36
Tools/RynthInventory.Tests/ReplyTests.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthInventory;
|
||||
|
||||
namespace RynthInventory.Tests
|
||||
{
|
||||
// Every /ginv command answers in chat (2026-10-28). RunCommand needs the plugin's host, so the parse
|
||||
// of every /ginv word and the lines it says are checked here.
|
||||
internal static partial class Program
|
||||
{
|
||||
private static void Replies()
|
||||
{
|
||||
var words = new (string Typed, InventoryVerb Verb, string Text)[]
|
||||
{
|
||||
("", InventoryVerb.Window, ""), ("scan", InventoryVerb.Scan, ""), ("RESCAN", InventoryVerb.Scan, ""),
|
||||
("keep", InventoryVerb.Keep, ""), ("reload", InventoryVerb.Reload, ""), ("status", InventoryVerb.Status, ""),
|
||||
("help", InventoryVerb.Help, ""), ("?", InventoryVerb.Help, ""),
|
||||
("Pyreal Mote", InventoryVerb.Search, "Pyreal Mote"), (" scan me ", InventoryVerb.Search, "scan me"),
|
||||
};
|
||||
var seen = new HashSet<InventoryVerb>();
|
||||
foreach (var (typed, verb, text) in words)
|
||||
{
|
||||
InventoryCommand c = InventoryCommand.Parse(typed);
|
||||
Eq(c.Verb, verb, $"'/ginv {typed}'");
|
||||
Eq(c.Text, text, $"'/ginv {typed}': the search keeps its case");
|
||||
seen.Add(c.Verb);
|
||||
}
|
||||
foreach (InventoryVerb v in Enum.GetValues<InventoryVerb>()) Check(seen.Contains(v), $"the table covers /ginv's {v}");
|
||||
Eq(InventoryCommand.Window(true), "Global Inventory shown.", "/ginv: shown");
|
||||
Eq(InventoryCommand.Window(false), "Global Inventory hidden.", "/ginv: hidden");
|
||||
Eq(InventoryCommand.Searching(" Pyreal Mote "), "Global Inventory: searching for 'Pyreal Mote'.", "/ginv <text>");
|
||||
Check(InventoryCommand.Usage.Contains("/ginv status"), "help: the usage");
|
||||
Check(InventoryCommand.NoWindows.Contains("can't show plugin windows"), "no plugin windows: why");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -31,6 +31,7 @@
|
|||
<Compile Include="..\..\..\RynthCore\src\RynthCore.Engine\UI\ScriptWindows\DisplayListParser.cs" Link="Engine\DisplayListParser.cs" />
|
||||
<!-- The plugin links this one from Plugins/Shared (the glob above only covers the plugin's folder). -->
|
||||
<Compile Include="..\..\Plugins\Shared\StorageFeed.cs" Link="Shared\StorageFeed.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\CommandReply.cs" Link="Shared\CommandReply.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -261,6 +261,12 @@ internal static class Harness
|
|||
});
|
||||
// A second script in the same plugin (another script competing for a handler).
|
||||
Fn("runScript", a => { Plugin!.RunCode(Str(a, 0), Str(a, 1)); return DynValue.Nil; });
|
||||
// A script file in the (temp) Scripts folder, for "/lua start <name>" (replies.lua).
|
||||
Fn("writeScript", a =>
|
||||
{
|
||||
System.IO.File.WriteAllText(System.IO.Path.Combine(RynthLuaPaths.Scripts, Str(a, 0) + ".lua"), Str(a, 1));
|
||||
return DynValue.Nil;
|
||||
});
|
||||
Fn("stopScript", a => DynValue.NewBoolean(Plugin!.StopScript(Str(a, 0))));
|
||||
Fn("scriptLoaded", a => DynValue.NewBoolean(Plugin!.ScriptIsLoaded(Str(a, 0))));
|
||||
Fn("scriptConsole", a => DynValue.NewString(Plugin!.ScriptConsoleText(Str(a, 0))));
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
<ItemGroup>
|
||||
<!-- RynthLuaPaths.cs uses the install-folder resolver. -->
|
||||
<Compile Include="..\..\Plugins\Shared\RynthInstallPaths.cs" Link="Shared\RynthInstallPaths.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\CommandReply.cs" Link="Shared\CommandReply.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
64
Tools/RynthLua.CompatTests/Scripts/replies.lua
Normal file
64
Tools/RynthLua.CompatTests/Scripts/replies.lua
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
-- Every /lua command answers in chat (2026-10-28): each built-in verb typed right and typed wrong
|
||||
-- gives a "[RynthLua]" line, a wrong one saying why (and the usage). The lines go through the shared
|
||||
-- reply queue (Plugins/Shared/CommandReply.cs), written on the ticks after the command.
|
||||
|
||||
local function settle(ms)
|
||||
local t = 0
|
||||
while t < ms do sleep(20); t = t + 20 end
|
||||
end
|
||||
|
||||
-- Types the command and returns the RynthLua lines it answered with.
|
||||
local function answer(cmd)
|
||||
harness.clearCalls()
|
||||
check(harness.chatInput(cmd), cmd .. ": eaten")
|
||||
settle(200)
|
||||
local lines = {}
|
||||
for _, l in ipairs(harness.chatLog()) do
|
||||
if string.find(l, "[RynthLua]", 1, true) == 1 then lines[#lines + 1] = l end
|
||||
end
|
||||
return lines
|
||||
end
|
||||
|
||||
local function says(cmd, needle)
|
||||
local lines = answer(cmd)
|
||||
check(#lines > 0, cmd .. ": answers")
|
||||
local found = false
|
||||
for _, l in ipairs(lines) do
|
||||
if string.find(l, needle, 1, true) then found = true end
|
||||
end
|
||||
check(found, cmd .. ": says '" .. needle .. "' (got: " .. table.concat(lines, " / ") .. ")")
|
||||
end
|
||||
|
||||
harness.writeScript("helper", "while true do sleep(1000) end")
|
||||
|
||||
-- right forms
|
||||
says("/lua list", "Scripts (")
|
||||
says("/lua start helper", "Running helper.")
|
||||
says("/lua restart helper", "Restarted helper.")
|
||||
says("/lua execin helper x = 1", "execin helper: started")
|
||||
says("/lua autostart helper none", "helper: autostart none.")
|
||||
says("/lua stop helper", "Stopped helper.")
|
||||
says("/lua exec y = 2", "exec: started")
|
||||
says("/lua exec while true do sleep(1000) end", "exec: started")
|
||||
says("/lua stop exec", "Stopped exec.")
|
||||
says("/lua hud list", "No huds.")
|
||||
says("/lua", "/lua list | start")
|
||||
says("/lua help", "/lua list | start")
|
||||
|
||||
-- wrong forms: why, and how it's typed
|
||||
says("/lua start nosuch", "No script named 'nosuch'")
|
||||
says("/lua restart", "No script named")
|
||||
says("/lua stop nosuch", "nosuch isn't running.")
|
||||
says("/lua exec", "Usage: /lua exec <code>")
|
||||
says("/lua exec this is not lua", "exec: the code didn't run")
|
||||
says("/lua execin", "Usage: /lua execin <script> <code>")
|
||||
says("/lua execin nosuch x = 1", "nosuch isn't running.")
|
||||
says("/lua autostart", "Usage: /lua autostart")
|
||||
says("/lua autostart helper sometimes", "Usage: /lua autostart")
|
||||
says("/lua hud show nosuch/hud", "No hud named")
|
||||
says("/lua hud bench lots", "Usage: /lua hud bench")
|
||||
says("/lua hud bench off", "The bench isn't running.")
|
||||
says("/lua hud wobble", "Unknown '/lua hud wobble'.")
|
||||
says("/lua wobble", "Unknown '/lua wobble'.")
|
||||
|
||||
done()
|
||||
|
|
@ -42,6 +42,7 @@
|
|||
<ItemGroup>
|
||||
<!-- RynthLuaPaths.cs uses the install-folder resolver. -->
|
||||
<Compile Include="..\..\Plugins\Shared\RynthInstallPaths.cs" Link="Shared\RynthInstallPaths.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\CommandReply.cs" Link="Shared\CommandReply.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ internal static partial class Program
|
|||
Run(nameof(ArrowSingleTarget), ArrowSingleTarget);
|
||||
Run(nameof(ArrowAlongRoute), ArrowAlongRoute);
|
||||
Run(nameof(FavoritesAndRecent), FavoritesAndRecent);
|
||||
Run(nameof(CommandReplies), CommandReplies);
|
||||
Run(nameof(CoordinateParsing), CoordinateParsing);
|
||||
Run(nameof(BearingAndDistance), BearingAndDistance);
|
||||
Run(nameof(RealData), RealData);
|
||||
|
|
@ -512,6 +513,31 @@ internal static partial class Program
|
|||
Check(back.RemoveFavorite("HOLTBURG") && back.Favorites.Count == 0, "remove by name");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The /rnav words that used to answer nothing (2026-10-28: every command answers): "recent" without
|
||||
/// "clear", "arrive" alone or with a wrong number, an unknown word. The rest of /rnav already
|
||||
/// answered; RunCommand itself needs the game, so its lines are checked here.
|
||||
/// </summary>
|
||||
private static void CommandReplies()
|
||||
{
|
||||
var s = new AtlasStore();
|
||||
Check(NavReplies.Recent(s.Recent).StartsWith("no recent places", StringComparison.Ordinal), "recent: none yet");
|
||||
s.Touch(new SavedPlace { Name = "Holtburg", Ns = 42.08, Ew = 33.6 });
|
||||
s.Touch(new SavedPlace { Name = "Yaraq", Ns = -21.5, Ew = -1.8 });
|
||||
string recent = NavReplies.Recent(s.Recent);
|
||||
Check(recent.Contains("(2): Yaraq, Holtburg") && recent.Contains("/rnav recent clear"), "recent: newest first, and how to clear: " + recent);
|
||||
|
||||
foreach (var (typed, ok) in new[] { ("10", true), ("2", true), ("200", true), ("1", false), ("201", false), ("far", false), ("", false) })
|
||||
{
|
||||
Check(NavReplies.TryArrive(typed, out double yd) == ok, $"arrive '{typed}' {(ok ? "taken" : "refused")}");
|
||||
if (ok) Check(NavReplies.Arrived(yd).Contains($"{yd:F0} yd"), $"arrive {typed}: the new distance");
|
||||
else Check(NavReplies.ArriveUsage(typed, 10).Contains("/rnav arrive <yards 2-200>"), $"arrive '{typed}': the usage");
|
||||
}
|
||||
Check(NavReplies.ArriveUsage("far", 10).StartsWith("'far' isn't 2-200 yd.", StringComparison.Ordinal), "arrive far: says why");
|
||||
Check(NavReplies.ArriveUsage("", 12).Contains("within 12 yd"), "arrive alone: the distance now");
|
||||
Check(NavReplies.Unknown("gogo") == "unknown 'gogo' — /rnav help", "an unknown word");
|
||||
}
|
||||
|
||||
// ── Coordinates ──────────────────────────────────────────────────────────
|
||||
|
||||
private static void CoordinateParsing()
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNav\NavCoords.cs" Link="Linked\NavCoords.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNav\Atlas.cs" Link="Linked\Atlas.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNav\AtlasStore.cs" Link="Linked\AtlasStore.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNav\NavReplies.cs" Link="Linked\NavReplies.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNav\ArrowGuide.cs" Link="Linked\ArrowGuide.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNav\RecallMemory.cs" Link="Linked\RecallMemory.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNav\RecallPlanner.cs" Link="Linked\RecallPlanner.cs" />
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ internal static partial class Program
|
|||
StableOrder();
|
||||
Vitals();
|
||||
WindowChecks();
|
||||
Replies();
|
||||
|
||||
Console.WriteLine($"{_checks} checks, {_failed} failed");
|
||||
return _failed == 0 ? 0 : 1;
|
||||
|
|
|
|||
44
Tools/RynthNet.Tests/ReplyTests.cs
Normal file
44
Tools/RynthNet.Tests/ReplyTests.cs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
using RynthCore.Plugin.RynthNet;
|
||||
using RynthCore.Plugin.Shared;
|
||||
|
||||
namespace RynthNet.Tests;
|
||||
|
||||
// Every /rn command answers in chat (2026-10-28). They all did; what was missing is that a several-line
|
||||
// answer (/rn help, /rn list, /rn status) lost every line but the first to the host's 100 ms limit, and
|
||||
// that a refusal looked like a success. HandleLocal needs the network node and the host, so the
|
||||
// argument parsing behind each verb's right and wrong forms, and the shared queue, are checked here.
|
||||
internal static partial class Program
|
||||
{
|
||||
private static void Replies()
|
||||
{
|
||||
// bc / bca: "[delay] command".
|
||||
CommandParser.DelayAndCommand("500 /say hi", out int delay, out string command);
|
||||
Check(delay == 500 && command == "/say hi", "/rn bc 500 /say hi: the delay, then the command");
|
||||
CommandParser.DelayAndCommand("/say hi", out delay, out command);
|
||||
Check(delay == 0 && command == "/say hi", "/rn bc /say hi: no delay");
|
||||
CommandParser.DelayAndCommand("", out _, out command);
|
||||
Check(command.Length == 0, "/rn bc alone: no command (it answers 'no command given.')");
|
||||
|
||||
// bct: tags first; none is the usage.
|
||||
Check(CommandParser.TagsAndRest("heal,box 250 /ra start", out var tags, out string after)
|
||||
&& tags.Count == 2 && after == "250 /ra start", "/rn bct heal,box 250 /ra start");
|
||||
Check(!CommandParser.TagsAndRest("", out _, out _), "/rn bct alone: the usage");
|
||||
|
||||
// tell: a name and a command; a name alone is the usage.
|
||||
var known = new[] { "Zed Healer", "Alpha" };
|
||||
Check(CommandParser.NameAndCommand("Zed Healer /ra start", known, out string name, out command)
|
||||
&& name == "Zed Healer" && command == "/ra start", "/rn tell Zed Healer /ra start: the longest known name");
|
||||
Check(CommandParser.NameAndCommand("Somebody, /say hi", known, out name, out command) && name == "Somebody",
|
||||
"/rn tell Somebody, /say hi: the comma splits");
|
||||
Check(!CommandParser.NameAndCommand("Alpha", known, out _, out _), "/rn tell Alpha alone: the usage");
|
||||
Check(!CommandParser.NameAndCommand("", known, out _, out _), "/rn tell alone: the usage");
|
||||
|
||||
// A several-line answer: every line goes out, one per tick, even when the host refuses some.
|
||||
var written = new List<string>();
|
||||
int call = 0;
|
||||
var reply = new CommandReply("[RynthNet]", (t, c) => { if (++call % 2 == 0) return false; written.Add(t); return true; });
|
||||
for (int i = 0; i < 11; i++) reply.Ok("help line " + i);
|
||||
for (int i = 0; i < 40 && reply.Pending > 0; i++) reply.Flush();
|
||||
Check(written.Count == 11 && written[10] == "[RynthNet] help line 10", "/rn help: all 11 lines written, in order");
|
||||
}
|
||||
}
|
||||
|
|
@ -24,6 +24,8 @@
|
|||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNet\Characters\CharactersRows.cs" Link="RynthNet\CharactersRows.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNet\Characters\AtlasNames.cs" Link="RynthNet\AtlasNames.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNet\Characters\CharactersManifest.cs" Link="RynthNet\CharactersManifest.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthNet\CommandParser.cs" Link="RynthNet\CommandParser.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\CommandReply.cs" Link="Shared\CommandReply.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\RynthUi\RynthIcons.cs" Link="Shared\RynthIcons.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ namespace RynthOracle.Tests
|
|||
Refreshes();
|
||||
SkillsTabs();
|
||||
ServerMove();
|
||||
Replies();
|
||||
Console.WriteLine($"{_pass} passed, {_fail} failed");
|
||||
return _fail == 0 ? 0 : 1;
|
||||
}
|
||||
|
|
|
|||
58
Tools/RynthOracle.Tests/ReplyTests.cs
Normal file
58
Tools/RynthOracle.Tests/ReplyTests.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthOracle;
|
||||
using RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
namespace RynthOracle.Tests
|
||||
{
|
||||
// Every /ro command answers in chat (2026-10-28). RunCommand needs the plugin's host (its windows),
|
||||
// so the parse of every /ro word and the line each verb says are checked here.
|
||||
internal static partial class Program
|
||||
{
|
||||
private static void Replies()
|
||||
{
|
||||
var words = new (string Typed, OracleVerb Verb, string Tab)[]
|
||||
{
|
||||
("", OracleVerb.Window, ""), ("void", OracleVerb.Void, ""), ("timers", OracleVerb.Timers, ""), ("timer", OracleVerb.Timers, ""),
|
||||
("quests", OracleVerb.Quests, ""), ("refresh", OracleVerb.Quests, ""),
|
||||
("fellowship", OracleVerb.Tab, OracleView.TabFellowship), ("fellow", OracleVerb.Tab, OracleView.TabFellowship), ("fship", OracleVerb.Tab, OracleView.TabFellowship),
|
||||
("character", OracleVerb.Tab, OracleView.TabCharacter), ("char", OracleVerb.Tab, OracleView.TabCharacter),
|
||||
("legendary", OracleVerb.Trackers, OracleView.TabQuests), ("legend", OracleVerb.Trackers, OracleView.TabQuests), ("john", OracleVerb.Trackers, OracleView.TabQuests),
|
||||
("markers", OracleVerb.Trackers, OracleView.TabQuests), ("marker", OracleVerb.Trackers, OracleView.TabQuests), ("trackers", OracleVerb.Trackers, OracleView.TabQuests),
|
||||
("skills", OracleVerb.Tab, OracleView.TabSkills), ("skill", OracleVerb.Tab, OracleView.TabSkills),
|
||||
("attributes", OracleVerb.Tab, OracleView.TabAttributes), ("attrs", OracleVerb.Tab, OracleView.TabAttributes),
|
||||
("attribute", OracleVerb.Tab, OracleView.TabAttributes), ("vitals", OracleVerb.Tab, OracleView.TabAttributes),
|
||||
("progress", OracleVerb.Tab, OracleView.TabProgress), ("progression", OracleVerb.Tab, OracleView.TabProgress),
|
||||
("status", OracleVerb.Status, ""), ("about", OracleVerb.About, OracleView.TabAbout), ("help", OracleVerb.Help, ""), ("?", OracleVerb.Help, ""),
|
||||
("STATUS", OracleVerb.Status, ""), ("questz", OracleVerb.Unknown, ""), ("dynamic", OracleVerb.Unknown, ""),
|
||||
};
|
||||
var seen = new HashSet<OracleVerb>();
|
||||
foreach (var (typed, verb, tab) in words)
|
||||
{
|
||||
OracleCommand c = OracleCommand.Parse(typed);
|
||||
Check(c.Verb == verb && c.Tab == tab, $"'/ro {typed}': {verb} {tab} (got {c.Verb} {c.Tab})");
|
||||
seen.Add(c.Verb);
|
||||
}
|
||||
foreach (OracleVerb v in Enum.GetValues<OracleVerb>()) Check(seen.Contains(v), $"the table covers /ro's {v}");
|
||||
Check(OracleCommand.Parse("legendary").Trackers == QuestKind.Legendary && OracleCommand.Parse("markers").Trackers == QuestKind.Marker
|
||||
&& OracleCommand.Parse("trackers").Trackers == null, "the trackers each word shows");
|
||||
Check(OracleCommand.Parse("void").ShowsWindow && !OracleCommand.Parse("status").ShowsWindow && !OracleCommand.Parse("quests").ShowsWindow,
|
||||
"which verbs show a window (they say why not without plugin windows)");
|
||||
|
||||
// The lines.
|
||||
Check(OracleCommand.Shown("Oracle window", true) == "Oracle window shown.", "/ro: shown");
|
||||
Check(OracleCommand.Shown("Void window", false) == "Void window hidden.", "/ro void: hidden");
|
||||
Check(OracleCommand.OnTab(OracleView.TabSkills) == "Oracle window shown on its Skills tab.", "a tab");
|
||||
foreach (QuestKind? k in new QuestKind?[] { QuestKind.Legendary, QuestKind.Marker, null })
|
||||
Check(OracleCommand.OnTrackers(k).StartsWith("Oracle window shown on the Quests tab", StringComparison.Ordinal), $"trackers {k}");
|
||||
Check(OracleCommand.Quests(true, true, 0) == (true, "Reading your quest flags (/myquests)..."), "quests: sent");
|
||||
Check(!OracleCommand.Quests(false, false, 0).Ok, "quests: not in the world");
|
||||
var wait = OracleCommand.Quests(true, false, 42);
|
||||
Check(!wait.Ok && wait.Text.Contains("42s"), "quests: the server's minute, with the wait");
|
||||
Check(!OracleCommand.Quests(true, false, 0).Ok, "quests: one already out");
|
||||
string unknown = OracleCommand.Unknown("questz");
|
||||
Check(unknown.StartsWith("Unknown '/ro questz'.", StringComparison.Ordinal) && unknown.Contains("/ro status"), "an unknown word: named, with the usage");
|
||||
Check(OracleCommand.NoWindows.Contains("can't show plugin windows"), "no plugin windows: why");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -38,6 +38,7 @@
|
|||
<!-- "RynthServer.QuestPack": the active server plugin's quest pack (as in the plugin's csproj). -->
|
||||
<Compile Include="..\..\Plugins\Shared\RynthServerQuestPackApi.cs" Link="RynthOracle\Shared\RynthServerQuestPackApi.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\ServerQuestPackClient.cs" Link="RynthOracle\Shared\ServerQuestPackClient.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\CommandReply.cs" Link="RynthOracle\Shared\CommandReply.cs" />
|
||||
<Compile Include="..\..\..\RynthCore\src\RynthCore.Engine\UI\ScriptWindows\DisplayListParser.cs" Link="Engine\DisplayListParser.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ namespace RynthSort.Tests
|
|||
Run("order: slot orders and the pack column", SlotOrders);
|
||||
Run("plan: stacks and order inside packs", PlanInPack);
|
||||
Run("moves: answers for moves within a pack", MoveAnswersInPlace);
|
||||
Run("replies: every /rsort word answers", Replies);
|
||||
Run("plan: a fixed inventory runs out of moves", Converges);
|
||||
Run("loop: auto-sort tidies every pack, then stays still", ConvergesInTheLoop);
|
||||
Run("remote: another plugin's \"rsort\" command reaches /rsort, anything else is not ours", RemoteCommand);
|
||||
|
|
|
|||
42
Tools/RynthSort.Tests/ReplyTests.cs
Normal file
42
Tools/RynthSort.Tests/ReplyTests.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthSort;
|
||||
|
||||
namespace RynthSort.Tests
|
||||
{
|
||||
// Every /rsort command answers in chat (2026-10-28). RunCommand needs the plugin's host, so the parse
|
||||
// of every /rsort word, which ones wait for the login, and the lines are checked here.
|
||||
internal static partial class Program
|
||||
{
|
||||
private static void Replies()
|
||||
{
|
||||
var words = new (string Typed, SortVerb Verb, bool Quiet, int? Pack)[]
|
||||
{
|
||||
("", SortVerb.Window, false, null), ("on", SortVerb.On, false, null), ("off", SortVerb.Off, false, null),
|
||||
("on quiet", SortVerb.On, true, null), ("OFF Quiet", SortVerb.Off, true, null),
|
||||
("now", SortVerb.Now, false, null), ("tidy", SortVerb.Now, false, null), ("clean", SortVerb.Clean, false, null),
|
||||
("unpack", SortVerb.Unpack, false, null), ("unpack 2", SortVerb.Unpack, false, 2), ("unpack x", SortVerb.Unpack, false, null),
|
||||
("unpack 0", SortVerb.Unpack, false, null), ("status", SortVerb.Status, false, null), ("help", SortVerb.Help, false, null),
|
||||
("?", SortVerb.Help, false, null), ("sortt", SortVerb.Unknown, false, null),
|
||||
};
|
||||
var seen = new HashSet<SortVerb>();
|
||||
foreach (var (typed, verb, quiet, pack) in words)
|
||||
{
|
||||
SortCommand c = SortCommand.Parse(typed);
|
||||
Check(c.Verb == verb && c.Quiet == quiet && c.Pack == pack, $"'/rsort {typed}': {verb} quiet={quiet} pack={pack} (got {c.Verb} {c.Quiet} {c.Pack})");
|
||||
seen.Add(c.Verb);
|
||||
}
|
||||
foreach (SortVerb v in Enum.GetValues<SortVerb>()) Check(seen.Contains(v), $"the table covers /rsort's {v}");
|
||||
Check(!SortCommand.Parse("").NeedsLogin && !SortCommand.Parse("help").NeedsLogin, "the window and help work before login");
|
||||
Check(SortCommand.Parse("now").NeedsLogin && SortCommand.Parse("sortt").NeedsLogin, "the rest says 'Log in first.' before login");
|
||||
|
||||
Eq(SortCommand.Window(true), "RynthSort window shown.", "/rsort: shown");
|
||||
Eq(SortCommand.Started(SortVerb.Now), "Sorting every pack now.", "now / tidy");
|
||||
Check(SortCommand.Started(SortVerb.Clean).StartsWith("Cleaning", StringComparison.Ordinal), "clean");
|
||||
Check(SortCommand.Unpacking(3).StartsWith("Emptying pack 3", StringComparison.Ordinal), "unpack 3");
|
||||
Check(SortCommand.Unpacking(null).StartsWith("Emptying your side packs", StringComparison.Ordinal), "unpack");
|
||||
string unknown = SortCommand.Unknown("sortt");
|
||||
Check(unknown.StartsWith("Unknown '/rsort sortt'.", StringComparison.Ordinal) && unknown.Contains(SortCommand.Usage), "an unknown word: named, with the usage");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -38,6 +38,7 @@
|
|||
<Compile Include="..\..\Plugins\Shared\RynthAiActivityApi.cs" Link="Shared\RynthAiActivityApi.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\RynthAiStatusApi.cs" Link="Shared\RynthAiStatusApi.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\RynthInstallPaths.cs" Link="Shared\RynthInstallPaths.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\CommandReply.cs" Link="Shared\CommandReply.cs" />
|
||||
<Compile Include="..\..\..\RynthCore\src\RynthCore.Engine\UI\ScriptWindows\DisplayListParser.cs" Link="Engine\DisplayListParser.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ internal static class Program
|
|||
Percents();
|
||||
Colours();
|
||||
Commands();
|
||||
Replies();
|
||||
Status();
|
||||
SettingsJson();
|
||||
Manifest();
|
||||
|
|
@ -322,4 +323,54 @@ internal static class Program
|
|||
&& back.SlopeFloorZ == 0.5f && back.SlopeHeightBias == 0.25f && back.WaterRenderRadius == 6, "the tuning");
|
||||
Check(back.WaterTerrainTypes.SequenceEqual(new[] { 17, 19 }), "the water types");
|
||||
}
|
||||
/// <summary>
|
||||
/// Every /rv command answers in chat (2026-10-28): each verb typed right and typed wrong, and the
|
||||
/// line it says. The commands themselves run on the plugin's tick with the game's host, so the
|
||||
/// parse and the reply wording are checked here.
|
||||
/// </summary>
|
||||
private static void Replies()
|
||||
{
|
||||
var verbs = new (string Typed, VisionVerb Verb)[]
|
||||
{
|
||||
("", VisionVerb.Status), ("radar", VisionVerb.Radar), ("slopes", VisionVerb.Slopes), ("water", VisionVerb.Water),
|
||||
("watertypes", VisionVerb.WaterTypes), ("debug", VisionVerb.Debug), ("light", VisionVerb.Light),
|
||||
("light 60", VisionVerb.Light), ("rader", VisionVerb.Unknown), ("lightning", VisionVerb.Unknown),
|
||||
};
|
||||
var seen = new HashSet<VisionVerb>();
|
||||
foreach (var (typed, verb) in verbs)
|
||||
{
|
||||
Eq(VisionCommands.Parse(typed, out _), verb, $"'/rv {typed}'");
|
||||
seen.Add(verb);
|
||||
}
|
||||
foreach (VisionVerb v in Enum.GetValues<VisionVerb>()) Check(seen.Contains(v), $"the table covers /rv's {v}");
|
||||
VisionCommands.Parse("light color torch", out string rest);
|
||||
Eq(rest.Trim(), "color torch", "/rv light passes the rest on");
|
||||
|
||||
Eq(VisionCommands.Switched(VisionVerb.Radar, true), "Radar ring on.", "radar: the new state");
|
||||
Eq(VisionCommands.Switched(VisionVerb.Water, false), "Impassable water off.", "water: the new state");
|
||||
Check(VisionCommands.State(true, false, true).Contains("Radar ring on, unclimbable slopes off, impassable water on"), "/rv alone: the state");
|
||||
Check(VisionCommands.State(true, false, true).Contains(VisionCommands.Usage), "/rv alone: and the usage");
|
||||
Check(VisionCommands.Debug(true).StartsWith("Debug on", StringComparison.Ordinal), "debug: the new state");
|
||||
string unknown = VisionCommands.Unknown("rader");
|
||||
Check(unknown.Contains("'/rv rader'") && unknown.Contains("Usage"), "an unknown word: named, with the usage");
|
||||
|
||||
// /rv light: every kind answers (the change's summary, show, status, help, or the error with the usage).
|
||||
foreach (string typed in new[] { "", "on", "off", "toggle", "60", "dungeons", "color torch", "show", "status", "help", "101", "color", "brighter" })
|
||||
{
|
||||
LightCommand c = DungeonLight.ParseCommand(typed);
|
||||
string reply = c.Kind switch
|
||||
{
|
||||
LightCommandKind.Error => c.Error + " " + DungeonLight.Usage,
|
||||
LightCommandKind.Help => DungeonLight.Usage,
|
||||
LightCommandKind.Status => "Dungeon light: " + DungeonLight.StatusLine(S()),
|
||||
LightCommandKind.Show => "Vision window shown, on its Light tab.",
|
||||
_ => DungeonLight.Summary(true, 40, LightScope.Dungeons, DungeonLight.DefaultColor, engineHasApi: true),
|
||||
};
|
||||
Check(reply.Trim().Length > 0, $"/rv light {typed}: answers");
|
||||
if (c.Kind == LightCommandKind.Error) Check(c.Error.Length > 0 && reply.Contains("/rv light"), $"/rv light {typed}: why, and the usage");
|
||||
}
|
||||
string summary = DungeonLight.Summary(true, 60, LightScope.Indoors, DungeonLight.DefaultColor, engineHasApi: true);
|
||||
Check(summary.StartsWith("Dungeon light on: strength 60%", StringComparison.Ordinal), "the light's summary: " + summary);
|
||||
Check(DungeonLight.Summary(false, 40, LightScope.Dungeons, DungeonLight.DefaultColor, engineHasApi: false).Contains("newer RynthCore"), "an old engine says why");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthVision\Ui\VisionManifest.cs" Link="RynthVision\VisionManifest.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthVision\Ui\VisionFields.cs" Link="RynthVision\VisionFields.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthVision\VisionSettings.cs" Link="RynthVision\VisionSettings.cs" />
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthVision\VisionCommands.cs" Link="RynthVision\VisionCommands.cs" />
|
||||
<Compile Include="..\..\Plugins\Shared\CommandReply.cs" Link="Shared\CommandReply.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
Loading…
Reference in a new issue