using System.Collections.Generic; using System.Globalization; using System.Linq; namespace RynthCore.Plugin.RynthNav; /// /// /rnav's lines for the words that used to answer nothing (2026-10-28: every command answers, /// Plugins/Shared/CommandReply.cs): "recent" without "clear", "arrive" with no or a wrong number, /// a word /rnav doesn't know. Pure, so RynthNav.RouteTests checks them. /// internal static class NavReplies { public const double ArriveMin = 2, ArriveMax = 200; /// "/rnav arrive <yards>": the distance when it is one the arrow takes. public static bool TryArrive(string rest, out double yards) => double.TryParse(rest, NumberStyles.Float, CultureInfo.InvariantCulture, out yards) && yards >= ArriveMin && yards <= ArriveMax; public static string Arrived(double yards) => $"the arrow counts you as arrived within {yards:F0} yd"; /// "/rnav arrive" alone or with a wrong number: the value now and the usage. public static string ArriveUsage(string rest, double now) => (rest.Trim().Length == 0 ? "" : $"'{rest.Trim()}' isn't {ArriveMin:F0}-{ArriveMax:F0} yd. ") + $"{Arrived(now)} — /rnav arrive "; /// "/rnav recent": the recent places, newest first. public static string Recent(IReadOnlyList recent) => recent.Count == 0 ? "no recent places (arrow, route and go targets land here)" : $"recent places ({recent.Count}): {string.Join(", ", recent.Select(p => p.Name))} — /rnav recent clear forgets them"; /// A word /rnav doesn't know. public static string Unknown(string word) => $"unknown '{word}' — /rnav help"; }