Snapshot for release 2026.10.20.1 (internal 7116fab)
This commit is contained in:
parent
2a20c7acd6
commit
bfcd48950d
215 changed files with 16200 additions and 2838 deletions
|
|
@ -179,6 +179,15 @@ internal sealed class MetaManager
|
|||
_expressions?.SetKillClock(clock);
|
||||
}
|
||||
|
||||
// Corpses this character opened (the plugin's loot bookkeeping), for ub-IT's
|
||||
// hascorpsebeenopenedbyme[] / getcorpsesunopenedbyme[].
|
||||
private Func<int, bool>? _corpseOpenedByMe;
|
||||
public void SetCorpseOpenedCheck(Func<int, bool>? check)
|
||||
{
|
||||
_corpseOpenedByMe = check;
|
||||
if (_expressions != null) _expressions.CorpseOpenedByMe = check;
|
||||
}
|
||||
|
||||
public void SetPlayerId(uint id)
|
||||
{
|
||||
_playerId = id;
|
||||
|
|
@ -231,6 +240,10 @@ internal sealed class MetaManager
|
|||
engine.SetSettings(_settings);
|
||||
engine.SetCreatureStore(_creatureStore);
|
||||
engine.SetKillClock(_killClock);
|
||||
engine.CorpseOpenedByMe = _corpseOpenedByMe;
|
||||
// vtsetsetting[] / vtgetsetting[] take VTank names and units, as '/vt opt set|get' does.
|
||||
engine.VtOptionSetter = TrySetVtOption;
|
||||
engine.VtOptionGetter = GetVtOption;
|
||||
return engine;
|
||||
}
|
||||
|
||||
|
|
@ -824,7 +837,20 @@ internal sealed class MetaManager
|
|||
|
||||
// ── Action execution ─────────────────────────────────────────────────────
|
||||
|
||||
// Depth of ExecuteAction on the call stack: a rule's action (a chat command, a chat expression,
|
||||
// an expression action) is running. The plugin's MetaCommandActive reads it, so a command is
|
||||
// known to come from a running meta whichever way it reaches the plugin.
|
||||
private int _actionDepth;
|
||||
internal bool IsExecutingAction => _actionDepth > 0;
|
||||
|
||||
private void ExecuteAction(MetaRule rule)
|
||||
{
|
||||
_actionDepth++;
|
||||
try { ExecuteActionCore(rule); }
|
||||
finally { _actionDepth--; }
|
||||
}
|
||||
|
||||
private void ExecuteActionCore(MetaRule rule)
|
||||
{
|
||||
string ProcessData(string raw)
|
||||
{
|
||||
|
|
@ -1171,6 +1197,39 @@ internal sealed class MetaManager
|
|||
return true;
|
||||
}
|
||||
|
||||
// /vt e — VTank's macro toggle (ub-IT sends it to switch VTank on or off).
|
||||
if (sub == "e")
|
||||
{
|
||||
_raCommandHandler?.Invoke(_settings.IsMacroRunning ? "/ra stop" : "/ra start");
|
||||
return true;
|
||||
}
|
||||
|
||||
// /vt jump [heading] [shift true|false] [holdms] — VTank's jump (universalremote.met, ub-IT):
|
||||
// RynthAi's jumper through /ra jump[s] [heading] [holdtime].
|
||||
if (sub == "jump")
|
||||
{
|
||||
string heading = parts.Length >= 3 ? parts[2] : "";
|
||||
bool shift = parts.Length >= 4 && (parts[3].Equals("true", StringComparison.OrdinalIgnoreCase) || parts[3] == "1");
|
||||
string hold = parts.Length >= 5 ? parts[4] : "";
|
||||
_raCommandHandler?.Invoke(("/ra jump" + (shift ? "s" : "") + " " + heading + " " + hold).Trim());
|
||||
return true;
|
||||
}
|
||||
|
||||
// /vt tapjump — a quick jump with no charge.
|
||||
if (sub == "tapjump")
|
||||
{
|
||||
if (!(_host.HasTapJump && _host.TapJump()))
|
||||
_host.WriteToChat("[RynthAi] /vt tapjump: the engine's jump isn't available.", 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
// /vt equipitemsfor <monster> — wield what that monster's rule names (weapon, off hand).
|
||||
if (sub == "equipitemsfor" && parts.Length >= 3)
|
||||
{
|
||||
_raCommandHandler?.Invoke("/ra equipfor " + string.Join(" ", parts, 2, parts.Length - 2));
|
||||
return true;
|
||||
}
|
||||
|
||||
// /vt meta load <name> — the same load as /ra meta load (LegacyDashboardRenderer.LoadMetaByName):
|
||||
// a meta in MetaFiles, or, when there is none by that name, a new blank one (2026-10-13).
|
||||
if (sub == "meta" && parts.Length >= 4 &&
|
||||
|
|
@ -1193,8 +1252,8 @@ internal sealed class MetaManager
|
|||
return true;
|
||||
}
|
||||
|
||||
// /vt loot load <name> — load a loot profile
|
||||
if ((sub == "loot" || sub == "lootprofile") && parts.Length >= 4 &&
|
||||
// /vt loot load <name> — load a loot profile ("looting load" too: FoundryIzexi.met, Meta_Society.met)
|
||||
if ((sub == "loot" || sub == "lootprofile" || sub == "looting") && parts.Length >= 4 &&
|
||||
parts[2].Equals("load", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
string name = string.Join(" ", parts, 3, parts.Length - 3).Trim().Trim('"');
|
||||
|
|
@ -1231,8 +1290,20 @@ internal sealed class MetaManager
|
|||
return true;
|
||||
}
|
||||
|
||||
// /vt settings load / loadchar — ignore silently
|
||||
if (sub == "settings") return true;
|
||||
// /vt settings loadchar|savechar <name> — RynthAi's settings profiles (/ra settings ...);
|
||||
// universalremote.met switches profiles this way. Any other /vt settings verb is ignored.
|
||||
if (sub == "settings")
|
||||
{
|
||||
if (parts.Length >= 4 && (parts[2].Equals("loadchar", StringComparison.OrdinalIgnoreCase)
|
||||
|| parts[2].Equals("savechar", StringComparison.OrdinalIgnoreCase)))
|
||||
_raCommandHandler?.Invoke($"/ra settings {parts[2].ToLowerInvariant()} {string.Join(" ", parts, 3, parts.Length - 3)}");
|
||||
return true;
|
||||
}
|
||||
|
||||
// /vt <option> <value> — an option written as a verb (DerethExploration: "/vt navclosestoprange
|
||||
// 0.005"): the same as /vt opt set, for the VTank options RynthAi maps.
|
||||
if (parts.Length == 3 && (VtOptionMap.ContainsKey(sub) || IsSpecialVtOption(sub)))
|
||||
return TrySetVtOption(sub, parts[2]);
|
||||
|
||||
// /vt <verb> aliases → existing /ra handlers (Phase 1.3 VTank-meta migration).
|
||||
// Re-dispatch through the /ra path (_raCommandHandler → HandleRaCommand).
|
||||
|
|
@ -1249,10 +1320,23 @@ internal sealed class MetaManager
|
|||
System.Globalization.CultureInfo.InvariantCulture, out double bar))
|
||||
{
|
||||
int pct = Math.Clamp((int)Math.Round(bar * 100), 0, 100);
|
||||
_lastAttackBarPct = pct;
|
||||
_raCommandHandler?.Invoke("/ra power " + pct.ToString(System.Globalization.CultureInfo.InvariantCulture));
|
||||
return true;
|
||||
}
|
||||
|
||||
// /vt deletemonster (S_Colo, leaving the arena): no RynthAi equivalent is known. Accepted so
|
||||
// it doesn't go on to AC's chat parser as an unknown command; logged once.
|
||||
if (sub == "deletemonster")
|
||||
{
|
||||
if (!_deleteMonsterLogged)
|
||||
{
|
||||
_deleteMonsterLogged = true;
|
||||
RynthLog.Write(LogCat.Meta, "[Meta] /vt deletemonster accepted and ignored (no RynthAi equivalent).");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// /vt reverseroute — reverse the active nav route in place (shared settings;
|
||||
// the engine re-reads CurrentRoute each tick, so the flip takes effect next tick).
|
||||
if (sub == "reverseroute")
|
||||
|
|
@ -1351,15 +1435,143 @@ internal sealed class MetaManager
|
|||
// converts it into FollowNavMin, the nav point reach (see ExpressionEngine).
|
||||
["navclosestoprange"] = "NavCloseStopRange",
|
||||
["follownavmin"] = "FollowNavMin", // RynthAi's own name, yards
|
||||
// 2026-10-17: options the metas in MetaFiles / MetaProfiles set that had no mapping.
|
||||
["navclosetoprange"] = "NavCloseStopRange", // the same option, misspelt in some metas
|
||||
["attackrange"] = "MonsterRange",
|
||||
["ringdistance"] = "RingRange",
|
||||
["minimumringtargets"] = "MinRingTargets",
|
||||
["corpseapproachrange"] = "CorpseApproachRangeMax",
|
||||
["corpseapproachrange-max"] = "CorpseApproachRangeMax",
|
||||
["corpseapproachrange-min"] = "CorpseApproachRangeMin",
|
||||
// 2026-10-18: the sample metas (S_*, Colo) set these and nothing read them.
|
||||
["rebufftimeremainingseconds"] = "RebuffSecondsRemaining", // VTank's spelling (the one above is a typo)
|
||||
["petcustomrange"] = "CustomPetRange", // landblock units -> whole yards
|
||||
["blacklistmonstertimeoutseconds"] = "BlacklistTimeoutSec",
|
||||
};
|
||||
|
||||
/// <summary>VTank options given in landblock units (x240 = yards) whose RynthAi setting is yards.
|
||||
/// NavCloseStopRange converts itself (the settings map takes landblock units).</summary>
|
||||
private static readonly HashSet<string> VtDistanceOptions = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"attackdistance", "attackrange", "approachdistance", "dooropenrange", "opendoorrange", "ringdistance",
|
||||
"corpseapproachrange", "corpseapproachrange-max", "corpseapproachrange-min", "petcustomrange",
|
||||
};
|
||||
|
||||
/// <summary>RynthAi distance settings kept in whole yards (their setter refuses a decimal).</summary>
|
||||
private static readonly HashSet<string> IntYardSettings = new(StringComparer.Ordinal)
|
||||
{
|
||||
"MonsterRange", "ApproachRange", "RingRange", "CustomPetRange",
|
||||
};
|
||||
|
||||
/// <summary>A RynthAi yards value as VTank's landblock units (yards / 240), for reading a distance back.</summary>
|
||||
internal static string YardsToVtDistance(string yards)
|
||||
{
|
||||
if (!double.TryParse(yards, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out double v))
|
||||
return yards;
|
||||
return (v / 240.0).ToString("0.######", System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A VTank distance as RynthAi yards: a value up to 1 is landblock units (x240; VTank's own
|
||||
/// unit), a larger one is taken as yards already (typed by hand). Invariant culture.
|
||||
/// </summary>
|
||||
internal static string VtDistanceToYards(string value, bool wholeYards)
|
||||
{
|
||||
if (!double.TryParse(value, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out double v))
|
||||
return value; // not a number (an unexpanded expression): left for the setter to refuse
|
||||
double yards = v > 0 && v <= 1.0 ? v * 240.0 : v;
|
||||
return wholeYards
|
||||
? Math.Max(0, (int)Math.Round(yards)).ToString(System.Globalization.CultureInfo.InvariantCulture)
|
||||
: yards.ToString("0.###", System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
/// <summary>VTank options handled by <see cref="TrySetSpecialVtOption"/> (no 1:1 RynthAi setting).</summary>
|
||||
private static bool IsSpecialVtOption(string vtName) => vtName.ToLowerInvariant() is
|
||||
"defaultmeleeattackheight" or "lootfellowcorpses" or "lootallcorpses" or "usearcs" or "minimumhealkitsuccesschance"
|
||||
or "autoattackpower";
|
||||
|
||||
// The last /vt setattackbar power (percent), for AutoAttackPower false after it was on (-1 = none yet).
|
||||
private int _lastAttackBarPct = -1;
|
||||
private bool _deleteMonsterLogged;
|
||||
|
||||
/// <summary>
|
||||
/// The VTank options whose value means something else in RynthAi:
|
||||
/// DefaultMeleeAttackHeight 1-3 (low/medium/high) is RynthAi's 0-2; LootFellowCorpses /
|
||||
/// LootAllCorpses pick the loot-ownership mode (my kills / fellowship / all); UseArcs is a VTank
|
||||
/// mode number (2, 3 in the metas) for RynthAi's on/off; MinimumHealKitSuccessChance is a
|
||||
/// percent (a fraction up to 1 is scaled). False when <paramref name="vtName"/> isn't one of them.
|
||||
/// </summary>
|
||||
private bool TrySetSpecialVtOption(string vtName, string value)
|
||||
{
|
||||
var inv = System.Globalization.CultureInfo.InvariantCulture;
|
||||
bool num = double.TryParse(value, System.Globalization.NumberStyles.Float, inv, out double n);
|
||||
switch (vtName.ToLowerInvariant())
|
||||
{
|
||||
case "defaultmeleeattackheight":
|
||||
if (!num) return true;
|
||||
_settings.MeleeAttackHeight = Math.Clamp((int)Math.Round(n) - 1, 0, 2);
|
||||
return true;
|
||||
case "lootfellowcorpses":
|
||||
if (!num) return true;
|
||||
if (n != 0 && _settings.LootOwnership < 1) _settings.LootOwnership = 1;
|
||||
else if (n == 0 && _settings.LootOwnership == 1) _settings.LootOwnership = 0;
|
||||
return true;
|
||||
case "lootallcorpses":
|
||||
if (!num) return true;
|
||||
if (n != 0) _settings.LootOwnership = 2;
|
||||
else if (_settings.LootOwnership == 2) _settings.LootOwnership = 0;
|
||||
return true;
|
||||
case "usearcs":
|
||||
if (!num) return true;
|
||||
_settings.UseArcs = n != 0;
|
||||
return true;
|
||||
case "minimumhealkitsuccesschance":
|
||||
if (!num) return true;
|
||||
_settings.KitMinSuccessPct = Math.Clamp((int)Math.Round(n > 0 && n <= 1 ? n * 100 : n), 0, 100);
|
||||
return true;
|
||||
case "autoattackpower":
|
||||
// On: RynthAi picks the power itself (-1, its "auto"). Off: the attack bar's value,
|
||||
// the last /vt setattackbar (a power already set by hand stays as it is).
|
||||
if (!num) return true;
|
||||
if (n != 0)
|
||||
{
|
||||
_settings.MeleeAttackPower = _settings.MissileAttackPower = -1;
|
||||
}
|
||||
else if (_settings.MeleeAttackPower < 0 || _settings.MissileAttackPower < 0)
|
||||
{
|
||||
if (_lastAttackBarPct >= 0)
|
||||
_settings.MeleeAttackPower = _settings.MissileAttackPower = _lastAttackBarPct;
|
||||
else
|
||||
RynthLog.Write(LogCat.Meta, "[Meta] AutoAttackPower off with no /vt setattackbar value yet: attack power stays automatic.");
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The special options as VTank reads them back (height 1-3, ownership as two flags).</summary>
|
||||
private string? GetSpecialVtOption(string vtName) => vtName.ToLowerInvariant() switch
|
||||
{
|
||||
"defaultmeleeattackheight" => (_settings.MeleeAttackHeight + 1).ToString(System.Globalization.CultureInfo.InvariantCulture),
|
||||
"lootfellowcorpses" => _settings.LootOwnership >= 1 ? "true" : "false",
|
||||
"lootallcorpses" => _settings.LootOwnership == 2 ? "true" : "false",
|
||||
"usearcs" => _settings.UseArcs ? "true" : "false",
|
||||
"minimumhealkitsuccesschance" => _settings.KitMinSuccessPct.ToString(System.Globalization.CultureInfo.InvariantCulture),
|
||||
"autoattackpower" => _settings.MeleeAttackPower < 0 ? "true" : "false",
|
||||
_ => null,
|
||||
};
|
||||
|
||||
/// <summary>A VTank option's current value (mapped setting, else a stored generic option).</summary>
|
||||
private string? GetVtOption(string vtName)
|
||||
{
|
||||
if (GetSpecialVtOption(vtName) is string special) return special;
|
||||
var map = Expressions.BuildSettingsMapPublic();
|
||||
if (VtOptionMap.TryGetValue(vtName, out string? raName))
|
||||
{
|
||||
if (map.TryGetValue(raName, out var entry)) return entry.Get();
|
||||
// Distances read back in VTank's landblock units, as they were set (6 yd reads 0.025).
|
||||
if (map.TryGetValue(raName, out var entry))
|
||||
return VtDistanceOptions.Contains(vtName) ? YardsToVtDistance(entry.Get()) : entry.Get();
|
||||
}
|
||||
// A RynthAi setting named directly (EnableCombat, OpenDoors, NavCloseStopRange...).
|
||||
if (map.TryGetValue(vtName, out var direct)) return direct.Get();
|
||||
|
|
@ -1372,6 +1584,15 @@ internal sealed class MetaManager
|
|||
// Translate VTank bool strings to numeric
|
||||
string value = NormalizeVtValue(vtValue);
|
||||
|
||||
// Options whose value means something else in RynthAi (a scale, an offset, a mode).
|
||||
if (TrySetSpecialVtOption(vtName, value)) return true;
|
||||
|
||||
// VTank distances are in landblock units (1 = 240 yd: AttackDistance .01666 is 4 yd); RynthAi's
|
||||
// are yards. Converted here, rounded where RynthAi keeps whole yards (an int setting refused
|
||||
// "0.01666" outright, so every meta's attack / approach distance was dropped).
|
||||
if (VtDistanceOptions.Contains(vtName) && VtOptionMap.TryGetValue(vtName, out string? distName))
|
||||
value = VtDistanceToYards(value, IntYardSettings.Contains(distName));
|
||||
|
||||
var map = Expressions.BuildSettingsMapPublic();
|
||||
if (VtOptionMap.TryGetValue(vtName, out string? raName))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue