RynthSuite as of 2026-12-02 (internal a58302e): hotfix 2026.12.2.1
This commit is contained in:
parent
6b5a9c7e99
commit
ba4ea691fe
18 changed files with 263 additions and 148 deletions
|
|
@ -7,6 +7,7 @@ using RynthCore.Plugin.RynthAi;
|
|||
using RynthCore.Plugin.RynthAi.LegacyUi;
|
||||
using RynthCore.Plugin.RynthAi.Meta;
|
||||
using RynthCore.PluginCore;
|
||||
using RynthCore.Plugin.Shared;
|
||||
using RynthCore.RynthAiHostTests.Fakes;
|
||||
using RynthCore.RynthAiTests.Harness;
|
||||
|
||||
|
|
@ -25,6 +26,7 @@ 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("day/night timer (R-20261202-122606-0b16): RynthAi's now - its window in the manifest, /ra daynight show|hide|clear|box, /rdef's hand-over", DayNightInRynthAi);
|
||||
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);
|
||||
|
|
@ -472,6 +474,57 @@ internal static class CommandReplyTests
|
|||
|
||||
// ── The rig: a logged-in RynthAi with a meta manager, combat, a jumper and the fakes ──
|
||||
|
||||
// R-20261202-122606-0b16: /rdef daynight box said "Unknown command: rdef" (no RynthDefective loaded).
|
||||
// 2026-12-02: the timer lives in RynthAi, so players don't need RynthDefective for it.
|
||||
private static void DayNightInRynthAi()
|
||||
{
|
||||
// The window: in RynthAi's manifest, same title as before (RynthCore keeps its place), a bar button, frameless.
|
||||
string json = RynthCore.Plugin.RynthAi.Huds.SectionsManifest.Build(
|
||||
RynthCore.Plugin.RynthAi.Huds.SectionsManifest.Views(), RynthCore.Plugin.RynthAi.Huds.SectionsManifest.OwnSections, dayNight: true);
|
||||
var m = RynthCore.Engine.UI.Sections.SectionManifestParser.Parse("RynthAi", json, out string error);
|
||||
Check.Eq(error, string.Empty, "the manifest parses");
|
||||
var w = m.Windows.SingleOrDefault(x => x.Surface == "window:daynight");
|
||||
Check.True(w != null, "the Day/Night window is RynthAi's");
|
||||
Check.Eq(w!.Title, "Day/Night", "the same title as RynthDefective's (its saved place and the Settings rows)");
|
||||
Check.True(w.Bar && w.Frameless && w.FitHeight, "a bar button, frameless, its height from the draw");
|
||||
Check.False(RynthCore.Plugin.RynthAi.Huds.SectionsManifest.Build(
|
||||
RynthCore.Plugin.RynthAi.Huds.SectionsManifest.Views(), RynthCore.Plugin.RynthAi.Huds.SectionsManifest.OwnSections).Contains("window:daynight"),
|
||||
"not declared when the engine can't host it");
|
||||
|
||||
// The view counts down from its reading; the tooltip names RynthAi's command.
|
||||
var v = new RynthCore.Plugin.RynthAi.DayNight.DayNightView(true, DerethClock.At(DerethClock.TicksInDay + 5715 - 100 - 3600), 1000);
|
||||
Check.Near(v.SecondsLeft(3500), 97.5, 1e-9, "2.5 s after the reading");
|
||||
string tip = RynthCore.Plugin.RynthAi.DayNight.DayNightWindow.Tip(v, 100);
|
||||
Check.True(tip.Contains("/ra daynight", StringComparison.Ordinal) && !tip.Contains("/rdef", StringComparison.Ordinal), "the tooltip says /ra daynight: " + tip);
|
||||
|
||||
// Its background: clear by default, a profile from before loads clear; /ra daynight box | clear, said in chat.
|
||||
Check.False(new LegacyUiSettings().DayNightBox, "clear by default");
|
||||
var old = System.Text.Json.JsonSerializer.Deserialize("{\"EnableBuffing\":true}", RynthAiJsonContext.Default.LegacyUiSettings);
|
||||
Check.True(old != null && !old.DayNightBox, "a profile from before: clear");
|
||||
using var rig = new Rig();
|
||||
RynthAiPlugin.GameClockOverride = () => DerethClock.TicksInDay + 5715 - 3600; // dusk (no AC memory in a test)
|
||||
try
|
||||
{
|
||||
var said = rig.Typed("/ra daynight box");
|
||||
Check.True(rig.S.DayNightBox, "/ra daynight box: the dark box");
|
||||
Check.True(said.Any(l => l.Text.Contains("dark box", StringComparison.Ordinal)), "said: " + string.Join(" | ", said.Select(l => l.Text)));
|
||||
said = rig.Typed("/ra daynight clear");
|
||||
Check.False(rig.S.DayNightBox, "/ra daynight clear: no background");
|
||||
Check.True(said.Any(l => l.Text.Contains("clear background", StringComparison.Ordinal)), "said");
|
||||
said = rig.Typed("/ra daynight soon");
|
||||
Check.True(said.Any(l => l.Text.Contains("Usage: /ra daynight", StringComparison.Ordinal)), "a wrong word: the usage");
|
||||
said = rig.Typed("/ra daynight show");
|
||||
Check.True(said.Count > 0 && said.All(l => !l.Text.Contains("Unknown", StringComparison.Ordinal)), "show answers: " + string.Join(" | ", said.Select(l => l.Text)));
|
||||
|
||||
// /rdef daynight hands over through the plugin-command broker ("daynight", the rest of the line).
|
||||
Rig.Lines(() => rig.Call("ApplyRemoteCommand", "daynight", "box"));
|
||||
Check.True(rig.S.DayNightBox, "RynthDefective's hand-over: box");
|
||||
Rig.Lines(() => rig.Call("ApplyRemoteCommand", "daynight", "clear"));
|
||||
Check.False(rig.S.DayNightBox, "and clear");
|
||||
}
|
||||
finally { RynthAiPlugin.GameClockOverride = null; }
|
||||
}
|
||||
|
||||
private sealed class Rig : IDisposable
|
||||
{
|
||||
public readonly RynthAiPlugin P = new();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using RynthCore.Plugin.RynthDefective.Clock;
|
||||
using RynthCore.Plugin.RynthDefective.Model;
|
||||
using RynthCore.Plugin.Shared;
|
||||
|
||||
|
|
@ -120,18 +119,7 @@ namespace RynthDefective.Tests
|
|||
|
||||
private static void ClockWindowAndCommand()
|
||||
{
|
||||
// The window counts down from when the tick read the clock.
|
||||
var v = new DayNightView(true, DerethClock.At(RawAt(5715 - 100)), 1000);
|
||||
Eq(v.SecondsLeft(1000), 100.0, "at the reading");
|
||||
Eq(v.SecondsLeft(3500), 97.5, "2.5 s later");
|
||||
Eq(v.SecondsLeft(1_000_000), 0.0, "long after: 0, not negative");
|
||||
Check(!DayNightView.NotReady.Ready, "before the world: not ready");
|
||||
Eq(DayNightWindow.NotInWorld, "—", "out of world it shows a dash");
|
||||
Check(DayNightWindow.Tip(DayNightView.NotReady, 0).Contains("in the world", StringComparison.Ordinal), "tooltip out of world");
|
||||
string tip = DayNightWindow.Tip(v, 100);
|
||||
Check(tip.Contains("Day now (Warmtide-and-Half)", StringComparison.Ordinal) && tip.Contains("Night comes at Evensong, in 1 min 40 s", StringComparison.Ordinal), "tooltip: " + tip);
|
||||
|
||||
// /rdef daynight [show|hide]: parsed, and every answer says what happened.
|
||||
// /rdef daynight [show|hide|clear|box]: still parsed; since 2026-12-02 it hands over to RynthAi (/ra daynight).
|
||||
Eq(DefCommandParser.Parse("daynight").Text, "", "alone: toggle");
|
||||
Eq(DefCommandParser.Parse("daynight show").Text, "show", "show");
|
||||
Eq(DefCommandParser.Parse("DayNight ON").Text, "show", "on = show, any case");
|
||||
|
|
@ -145,16 +133,7 @@ namespace RynthDefective.Tests
|
|||
Eq(DefCommandParser.Parse("daynight transparent").Text, "clear", "transparent = clear");
|
||||
Eq(DefCommandParser.Parse("daynight box").Text, "box", "daynight box");
|
||||
Check(DefCommandParser.Usage.Contains("daynight [show|hide|clear|box]", StringComparison.Ordinal), "clear and box in the usage");
|
||||
Check(!new DefSettings().DayNightBox, "a clear background by default (and for a settings file from before)");
|
||||
Check(DefReplies.DayNightLook(false).Text.Contains("clear background", StringComparison.Ordinal), "clear: said so");
|
||||
Check(DefReplies.DayNightLook(true).Text.Contains("dark box", StringComparison.Ordinal), "box: said so");
|
||||
|
||||
DerethNow dusk = DerethClock.At(RawAt(5715));
|
||||
Eq(DefReplies.DayNight(1, dusk), (true, "Day/Night timer shown. Night now (Evensong); day in 1h 4m of real time."), "shown, with the time");
|
||||
Eq(DefReplies.DayNight(0, null), (true, "Day/Night timer hidden."), "hidden, out of world: no time");
|
||||
var old = DefReplies.DayNight(-1, dusk);
|
||||
Check(!old.Ok && old.Text.Contains("v90", StringComparison.Ordinal) && old.Text.Contains("day in 1h 4m", StringComparison.Ordinal),
|
||||
"an engine without the window: why, and the time still");
|
||||
Check(DefReplies.DayNightMoved.Contains("/ra daynight", StringComparison.Ordinal), "without RynthAi: where it went");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ namespace RynthDefective.Tests
|
|||
Run("day/night: day or night, the hour and the real seconds to dawn or dusk", ClockDayNight);
|
||||
Run("day/night: the same as RynthAi's meta expressions, a countdown with no jumps", ClockMatchesRynthAi);
|
||||
Run("day/night: the countdown text (23m, 4m 10s, 45s)", ClockCountdownText);
|
||||
Run("day/night: the window's view and tooltip, /rdef daynight and its answers", ClockWindowAndCommand);
|
||||
Run("day/night: /rdef daynight is parsed and hands over to RynthAi", ClockWindowAndCommand);
|
||||
Run("appraisal: a weapon's lines (skill, damage, speed, bonuses, slayer, wield, workmanship, set, ratings)", AppraiseWeapon);
|
||||
Run("appraisal: armor's protections and coverage, mana, spellcraft, the flags", AppraiseArmorAndMana);
|
||||
Run("appraisal: a caster's bonuses", AppraiseCaster);
|
||||
|
|
|
|||
Loading…
Reference in a new issue