Snapshot for release 2026.10.19.1 (internal f0bdcf8)
This commit is contained in:
parent
5419838250
commit
39de36d3af
131 changed files with 11266 additions and 520 deletions
|
|
@ -143,6 +143,22 @@ internal sealed class Atlas
|
|||
|
||||
// ── Search ───────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// "a || b || c": the first candidate that is coordinates, or that names a place on the map as a
|
||||
/// whole word or more (<see cref="MatchScore"/> 60+: "Mite Maze" yes, "Bur" inside "Burun" no),
|
||||
/// so a loose candidate never picks an unrelated place. Null when none does.
|
||||
/// </summary>
|
||||
public string? FirstOnMap(string alternatives, bool hasPos, double ns, double ew)
|
||||
{
|
||||
foreach (string raw in alternatives.Split("||", StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries))
|
||||
{
|
||||
if (NavCoords.TrySplitCoordsAndName(raw, out _, out _, out _)) return raw;
|
||||
AtlasLocation? best = FindBest(raw, hasPos, ns, ew);
|
||||
if (best != null && MatchScore(best.Name, raw) >= 60) return raw;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>How well <paramref name="name"/> matches <paramref name="q"/> (lower case): 0 = not at all.</summary>
|
||||
public static int MatchScore(string name, string q)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -669,6 +669,25 @@ public sealed partial class RynthNavPlugin
|
|||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// "a || b || c": the first candidate that is coordinates, or that names a place on the map
|
||||
/// as a whole word or more (Atlas.MatchScore 60+: "Mite Maze" yes, "Bur" inside "Burun" no),
|
||||
/// so a loose candidate never sends the character to an unrelated place. False (and why)
|
||||
/// when none does.
|
||||
/// </summary>
|
||||
private bool PickAlternative(string text, out string picked, out string why)
|
||||
{
|
||||
why = "";
|
||||
bool hasPos = PlayerMapPos(out double pns, out double pew);
|
||||
picked = _atlas.FirstOnMap(text, hasPos, pns, pew) ?? "";
|
||||
if (picked.Length > 0) return true;
|
||||
// Coordinates are always taken, so here every candidate was a name.
|
||||
why = _atlas.Locations.Count == 0
|
||||
? "the Atlas isn't loaded (" + _atlasStatus + ")"
|
||||
: "none of these is a place on the map: " + text.Replace("||", ",");
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>The Atlas place the last ResolveTarget picked (null for bare coordinates). Tick thread.</summary>
|
||||
private AtlasLocation? _resolvedPlace;
|
||||
|
||||
|
|
@ -995,6 +1014,12 @@ public sealed partial class RynthNavPlugin
|
|||
int sp = raw.IndexOf(' ');
|
||||
string cmd = (sp < 0 ? raw : raw.Substring(0, sp)).ToLowerInvariant();
|
||||
string rest = sp < 0 ? string.Empty : raw.Substring(sp + 1).Trim();
|
||||
// "go a || b || c" (Oracle's Dynamic Stamps, any caller): the first candidate on the map.
|
||||
if (cmd is "go" or "goto" or "route" or "arrow" && rest.Contains("||", StringComparison.Ordinal))
|
||||
{
|
||||
if (!PickAlternative(rest, out string picked, out string why)) { Note(why); return; }
|
||||
rest = picked;
|
||||
}
|
||||
switch (cmd)
|
||||
{
|
||||
case "":
|
||||
|
|
|
|||
Loading…
Reference in a new issue