Snapshot for release 2026.10.11.1 (internal d20160b)

This commit is contained in:
Tom Bohar 2026-10-11 15:00:56 -04:00
commit 504a6f080a
66 changed files with 7865 additions and 310 deletions

View file

@ -0,0 +1,98 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using RynthCore.Plugin.Shared;
namespace RynthCore.Plugin.RynthAi;
/// <summary>
/// RynthAi's side of the "RynthAi.Activity" interface (Shared/RynthAiActivityApi.cs): what the bot
/// is doing right now, as bits, for plugins that move items in the character's packs (RynthSort)
/// and must not land a move on top of a loot, salvage, buff, use or cast. Read only. Runs on the
/// plugin pump thread (the caller's OnTick), on the current plugin instance.
/// </summary>
internal static unsafe class ActivityInterface
{
private static RynthAiActivityApiV1* _table;
public static IntPtr Query(string iface, uint version)
{
if (iface != RynthAiActivityApiV1.InterfaceName || version == 0 || version > RynthAiActivityApiV1.InterfaceVersion) return IntPtr.Zero;
if (_table == null)
{
var t = (RynthAiActivityApiV1*)NativeMemory.AllocZeroed((nuint)sizeof(RynthAiActivityApiV1));
t->Version = RynthAiActivityApiV1.InterfaceVersion;
t->StructSize = (uint)sizeof(RynthAiActivityApiV1);
t->GetActivityFlags = &GetActivityFlags;
_table = t;
}
return (IntPtr)_table;
}
/// <summary>Frees the table (plugin shutdown). Callers resolve it every tick.</summary>
public static void Release()
{
var t = _table;
_table = null;
if (t != null) NativeMemory.Free(t);
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
private static int GetActivityFlags(uint* flags)
{
try
{
if (flags == null) return 0;
*flags = 0;
RynthAiActivity? a = PluginExports.Runtime.Plugin?.CurrentActivityFlags();
if (a == null) return 0;
*flags = (uint)a.Value;
return 1;
}
catch
{
return 0;
}
}
/// <summary>The bits from RynthAi's state (pure, so the host tests check the mapping).</summary>
internal static RynthAiActivity Compose(BotActivity activity, bool macroRunning, bool corpseInHand, bool salvageBusy,
bool serverWait, bool crafting, bool autoCram)
{
RynthAiActivity f = RynthAiActivity.None;
if (macroRunning) f |= RynthAiActivity.MacroRunning;
switch (activity)
{
case BotActivity.Buffing: f |= RynthAiActivity.Buffing; break;
case BotActivity.Combat: f |= RynthAiActivity.Combat; break;
case BotActivity.Looting: f |= RynthAiActivity.Looting; break;
case BotActivity.Salvaging: f |= RynthAiActivity.Salvaging; break;
case BotActivity.Navigating: f |= RynthAiActivity.Navigating; break;
}
if (corpseInHand) f |= RynthAiActivity.Looting;
if (salvageBusy) f |= RynthAiActivity.Salvaging;
if (serverWait) f |= RynthAiActivity.ServerAction;
if (crafting) f |= RynthAiActivity.Crafting;
if (autoCram) f |= RynthAiActivity.AutoCram;
return f;
}
}
public sealed partial class RynthAiPlugin
{
/// <summary>What the bot is doing now (RynthAi.Activity); null before login.</summary>
internal RynthAiActivity? CurrentActivityFlags()
{
var st = _dashboard?.Settings;
if (st == null || !_loginComplete) return null;
bool serverWait = _busyCount > 0 || (ActionPacer.Enabled && ActionPacer.Current(Host) != null);
return ActivityInterface.Compose(
st.IsMacroRunning ? _activity : BotActivity.Idle,
st.IsMacroRunning,
corpseInHand: _openedContainerId != 0 || _targetCorpseId != 0,
salvageBusy: _salvageManager?.IsBusy == true,
serverWait: serverWait,
crafting: _missileCraftingManager?.IsCrafting == true,
autoCram: st.EnableAutocram);
}
}

View file

@ -1720,7 +1720,7 @@ public class BuffManager : IDisposable
if (_worldObjectCache == null) return false;
foreach (var rule in _settings.ConsumableRules)
if (Array.FindIndex(types, t => t.Equals(rule.Type, StringComparison.OrdinalIgnoreCase)) >= 0
&& _worldObjectCache[rule.Id] != null)
&& ConsumableLookup.Resolve(_worldObjectCache, rule) != null)
return true;
return false;
}
@ -1733,10 +1733,10 @@ public class BuffManager : IDisposable
foreach (var rule in _settings.ConsumableRules)
{
if (Array.FindIndex(types, t => t.Equals(rule.Type, StringComparison.OrdinalIgnoreCase)) < 0) continue;
if (_worldObjectCache[rule.Id] == null) continue;
if (ConsumableLookup.Resolve(_worldObjectCache, rule) is not WorldObject potion) continue;
if (HeldCastBlocksItemUse(out string heldWhy)) return VitalNo(heldWhy);
_host.Log($"[RynthAi] Vitals: drinking {rule.Name} ({rule.Type}).");
_host.UseFor(unchecked((uint)rule.Id), "Buff", $"vitals: drink {rule.Name} ({rule.Type}) from the Items list");
_host.Log($"[RynthAi] Vitals: drinking {rule.Name} ({rule.Type})" + (potion.Id != rule.Id ? " from a new stack." : "."));
_host.UseFor(unchecked((uint)potion.Id), "Buff", $"vitals: drink {rule.Name} ({rule.Type}) from the Items list");
_lastPotionAt = DateTime.Now;
_lastCastAttempt = DateTime.Now;
if (IsHealthPotionType(types)) _healLatency.HealSent(Now, rule.Name);
@ -1879,7 +1879,7 @@ public class BuffManager : IDisposable
WorldObject? kit = null;
bool fromPack = false;
foreach (var r in _settings.ConsumableRules)
if (r.Type.Equals("HealthKit", StringComparison.OrdinalIgnoreCase) && _worldObjectCache[r.Id] is WorldObject wo) { kit = wo; break; }
if (r.Type.Equals("HealthKit", StringComparison.OrdinalIgnoreCase) && ConsumableLookup.Resolve(_worldObjectCache, r) is WorldObject wo) { kit = wo; break; }
if (kit == null) { kit = BestPackHealingKit(); fromPack = true; }
if (kit == null) return VitalNo("no healing kit");
if (KitRetryWait(out string kitWait)) return VitalNo(kitWait);

View file

@ -256,9 +256,9 @@ public partial class CombatManager : IDisposable
private DateTime _targetLostScanTime = DateTime.MinValue;
private const double TARGET_SCAN_GRACE_MS = 1500.0;
// Target lock — once committed to a mob, hold it until confirmed dead/gone.
// Prevents spinning caused by target thrashing when world-filter has a transient null
// or when a second mob briefly becomes slightly closer between scan ticks.
// The locked target (see HandleCombatTrigger: with Target Lock on it is held until it dies,
// leaves Monster Range or a higher-priority monster shows up). Prevents spinning caused by
// target thrashing when the world filter has a transient null.
private int _lockedTargetId = 0;
private bool _wasMacroRunning;
@ -521,25 +521,26 @@ public partial class CombatManager : IDisposable
private DateTime _lastScanTime = DateTime.MinValue;
private const int SCAN_INTERVAL_MS = 50;
// Utility-AI target switching: every candidate is scored each tick.
// The currently-locked target gets this bonus so we don't flap on near-ties —
// an alternative must beat (locked_score + STICKINESS) to take over.
private const double TARGET_SWITCH_STICKINESS = 25.0;
// Target selection (2026-10-10): the Targeting setting (TargetSelection) ranks the
// candidates by one rule (lowest health, closest, farthest, least turning) and Target
// Lock keeps a pick until it is no longer valid. It replaced a blended utility score
// (distance + health + threat + facing, plus a stickiness and a commitment bonus for the
// incumbent), which still switched targets mid-fight. See HandleCombatTrigger.
//
// With Target Lock off, a monster must beat the incumbent by these margins under the
// Targeting rule to take over, so near-ties don't flap.
private const float MoreWoundedMargin = 0.05f; // Lowest health: 5 percentage points
private const double CloserFartherMarginM = 1.5; // Closest / Farthest: metres
private const double LessTurningMarginDeg = 20.0; // Least turning: degrees of facing change
// Extra hold applied ON TOP of stickiness once we have actually landed damage
// on the locked target — "finish what you started". Stickiness alone only
// breaks near-ties; this is what stops combat walking away from a half-dead
// mob because something undamaged wandered closer. Cleared with the rest of
// the fight state on switch/DropTarget. See HandleCombatTrigger.
private const double DAMAGE_COMMITMENT_BONUS = 20.0;
// A monster this much lower in health than the wounded target takes over (a predicted kill
// that survived). See HandleCombatTrigger.
private const float MoreWoundedMargin = 0.15f;
/// <summary>The Targeting setting's choices (LegacyUiSettings.TargetSelection).</summary>
internal enum TargetScheme { LowestHealth = 0, Closest = 1, Farthest = 2, LeastTurning = 3 }
// Monster priority is a strict tier, not a score bonus: when a monster of a higher
// Priority is in range (MonsterRange), only monsters of that Priority are candidates,
// and a lower-priority target is left for it at once. As a +5-per-level bonus it lost
// to stickiness (+25) and commitment (+20) and did "little to nothing" (2026-10-03).
// and a lower-priority target is left for it at once, Target Lock or not. As a
// +5-per-level score bonus it lost to the incumbent's bonuses and did "little to
// nothing" (2026-10-03).
// Priority comes from GetRuleForTarget (name, match expression, else the DEFAULT row),
// cached per monster for PriorityCacheMs because match expressions aren't free and
// HandleCombatTrigger runs every tick over every scanned monster.
@ -548,42 +549,36 @@ public partial class CombatManager : IDisposable
private const double PriorityCacheMs = 1000;
private int _lockedPriority;
/// <summary>How long a cast-issue commitment arm survives without damage
/// landing. Covers a projectile's flight (Force Arc confirms at a ~650ms
/// median, damage follows) without granting open-ended immunity to a target
/// that never takes damage. See the arming block in HandleCombatTrigger.</summary>
/// <summary>With Target Lock off, an attack at the locked target this recent, with no
/// damage landed since, is still on its way: no switch until it lands or this passes.
/// Covers a projectile's flight (Force Arc has ~2 s of travel; switching with a bolt in
/// the air walked away from the mob it was about to hit, 2026-09-03). See
/// <see cref="AttackInFlightAtLocked"/>.</summary>
private const double CastCommitmentWindowMs = 4000.0;
/// <summary>Ceiling on how long a target that has never taken damage may keep
/// the commitment bonus after being locked. Past this it competes on its own
/// merits again, so an unkillable or unreachable mob cannot hold the lock
/// forever — the 2026-09-05 stall, where one Olthoi absorbed 5+ hours and
/// ~3,100 casts because commitment never expired and
/// TargetNoProgressTimeoutSec defaults to 0 (disabled).</summary>
/// <summary>Ceiling on the in-flight hold: once nothing has landed on the locked target
/// for this long (since its last damage, or since the lock when it never took any), an
/// attack at it no longer holds off a switch. Without a ceiling the hold refreshes on
/// every cast, so a target that never takes damage could keep it forever (the
/// 2026-09-05 stall: one Olthoi, 5+ hours, ~3,100 casts, no damage).</summary>
private const double UndamagedCommitmentMaxMs = 15000.0;
/// <summary>When the last offensive action was issued at
/// <see cref="_lastAttackedTargetId"/>. Bounds the cast-issue commitment arm.</summary>
/// <see cref="_lastAttackedTargetId"/>. Bounds the in-flight hold.</summary>
private DateTime _lastAttackedAt = DateTime.MinValue;
// Distance (m) at which the melee-threat bonus reaches full value. The bonus
// ramps continuously to this range instead of switching on at a hard edge —
// as a step it was worth more than TARGET_SWITCH_STICKINESS, so a mob
// drifting across the line flipped the winner every tick. See ScoreCandidate.
private const double THREAT_RANGE_M = 5.0;
// Incumbent continuity across scan gaps. ScanNearbyTargets drops a target on
// a single bad LOS result or a transient miss — the candidate list has been
// observed oscillating 14<->17 entries tick to tick. HandleCombatTrigger
// scores only what is in the list, so an incumbent that blinks out scores
// NOTHING and loses to any challenger. That is the "score=gone" switch, and
// it defeats TARGET_SCAN_GRACE_MS, whose stated job is that "one bad LOS
// result or scan gap shouldn't hand control to navigation" — it protected
// the target from being DROPPED but not from being OUTSCORED while absent.
// Carry the last computed score for the grace window instead.
private double _lockedLastScore = double.MinValue;
// observed oscillating 14<->17 entries tick to tick. Picking only from what is
// in the list handed the fight to whoever was visible that tick and back again
// the next (the A->B->A flapping of 2026-09-03, logged as "score=gone"). The
// incumbent stays valid for TARGET_SCAN_GRACE_MS at its last seen values instead.
private ScannedTarget _lockedLastSeen;
private DateTime _lockedLastSeenInScan = DateTime.MinValue;
/// <summary>Tests: the clock target selection reads (scan grace, in-flight hold).</summary>
internal Func<DateTime> TargetClock { get; set; } = () => DateTime.Now;
public struct ScannedTarget
{
public int Id;
@ -594,8 +589,14 @@ public partial class CombatManager : IDisposable
}
/// <summary>List of nearby, attackable, LOS-clear creatures. Re-scanned every tick (≤50 ms).
/// Sorted by distance — selection itself is score-based via HandleCombatTrigger.</summary>
/// Sorted by distance — HandleCombatTrigger picks from it by the Targeting setting.</summary>
public IReadOnlyList<ScannedTarget> ScannedTargets => _scannedTargets;
/// <summary>Tests: replace the scan list (distances and facing angles as given).</summary>
internal void SetScannedTargetsForTests(IEnumerable<ScannedTarget> targets)
{
_scannedTargets.Clear();
_scannedTargets.AddRange(targets);
}
internal MonsterDamageStore? DamageStore => _damageStore; // per-monster pet choice (PetManager)
internal CreatureProfileStore? CreatureStore => _creatureStore; // learned resists (PetManager)
@ -1733,6 +1734,36 @@ public partial class CombatManager : IDisposable
/// consecutive misses → blacklist. Called every combat cycle and before
/// recording a new cast so the last cast is still judged.
/// </summary>
// ── No-damage casts: evidence for an intermittent report (2026-10-09) ─────────────
// A player's mage cast Nether Arc VII again and again (components used, every cast answered)
// and the target's health never moved; it comes and goes, so it can't be caught by asking
// for a dump afterwards. When the judge counts BlacklistAttempts no-damage casts in a row,
// this writes the flight recorder (the casts sent, their targets and every server answer)
// and one line with what the casts were and where things stood, before the blacklist moves on.
private string _lastOffensiveCastLine = "";
private DateTime _lastNoDamageReportAt = DateTime.MinValue;
private const double NoDamageReportGapMs = 10 * 60_000; // one report per 10 min per client
private void ReportNoDamageCasts(int tid)
{
DateTime now = DateTime.Now;
if ((now - _lastNoDamageReportAt).TotalMilliseconds < NoDamageReportGapMs) return;
_lastNoDamageReportAt = now;
try
{
int me = (int)_host.GetPlayerId();
WorldObject? t = tid != 0 ? _worldFilter[tid] : null;
double dist = me != 0 && tid != 0 ? _worldFilter.Distance(me, tid) : -1;
_host.Log($"[CombatCast] NO DAMAGE: {_consecutiveCastMisses} casts in a row at 0x{(uint)tid:X8} '{t?.Name ?? "?"}' " +
$"landed nothing (no hit, resist or evade line within {_settings.BlacklistCastSettleMs} ms each). " +
$"Last: {_lastOffensiveCastLine}; distance {dist:0.0} m, target {(t == null ? "gone from the client" : "still known")}, " +
$"active=0x{(uint)activeTargetId:X8} mode={CurrentCombatMode} busy={BusyCount} castsSinceKill={CastsSinceLastKill}. " +
"Flight recorder written (Logs/flight-*.txt).");
}
catch { }
FlightRecorderSignal.Dump(_host, $"casts with no damage at 0x{(uint)tid:X8}");
}
private void JudgePendingCast()
{
if (_pendingJudgeCastAt == DateTime.MinValue) return;
@ -1749,6 +1780,7 @@ public partial class CombatManager : IDisposable
_consecutiveCastMisses++;
if (_consecutiveCastMisses >= _settings.BlacklistAttempts)
{
if (CurrentCombatMode == CombatMode.Magic) ReportNoDamageCasts(tid);
_blacklistManager.ReportFailure(tid);
if (_blacklistManager.IsBlacklisted(tid))
{
@ -1802,7 +1834,7 @@ public partial class CombatManager : IDisposable
/// "N real attacks with no damage" for casts, missile shots, and melee
/// swings alike — never raw interval ticks.
/// </summary>
private void RecordOffensiveCast(int targetId)
internal void RecordOffensiveCast(int targetId) // internal for tests
{
if (_lastAttackedTargetId != targetId)
{
@ -1813,10 +1845,10 @@ public partial class CombatManager : IDisposable
}
// Stamped on EVERY offensive action, not just a target change, so the
// cast-issue commitment window tracks the most recent cast. Stamping only
// on change would expire commitment mid-fight while still casting at the
// same mob — reintroducing the in-flight abandonment this exists to stop.
_lastAttackedAt = DateTime.Now;
// in-flight hold (Target Lock off, AttackInFlightAtLocked) tracks the most
// recent cast. Stamping only on change would end the hold mid-fight while
// still casting at the same mob — the in-flight abandonment it exists to stop.
_lastAttackedAt = TargetClock(); // DateTime.Now outside tests
JudgePendingCast(); // verdict on the prior attack if its settle window elapsed
@ -1857,7 +1889,7 @@ public partial class CombatManager : IDisposable
_returnToPhysicalCombat = false;
_targetLockedAt = DateTime.MinValue;
_lastDamageDealtAt = DateTime.MinValue;
_lockedLastScore = double.MinValue;
_lockedLastSeen = default;
_lockedLastSeenInScan = DateTime.MinValue;
_targetLostScanTime = DateTime.MinValue;
_pendingJudgeCastAt = DateTime.MinValue;
@ -2535,8 +2567,8 @@ public partial class CombatManager : IDisposable
// the stillScanned grace period below will handle a truly dead/vanished mob.
}
// Score every candidate every tick — handles initial pick AND switching when
// a meaningfully better target appears (stickiness bonus prevents flapping).
// Pick every tick: the initial pick, and a switch when the target is no longer valid,
// a higher-priority monster is in range, or (Target Lock off) another is clearly better.
HandleCombatTrigger();
if (activeTargetId == 0)
@ -3366,18 +3398,21 @@ public partial class CombatManager : IDisposable
}
}
/// <summary>
/// Target selection, every tick. Candidates are the top monster-rule Priority among monsters
/// inside MonsterRange (or among all scanned ones when none is inside it), ranked by the
/// Targeting setting (<see cref="TargetScheme"/>). Target Lock on: a valid incumbent is kept,
/// full stop. Off: it is kept unless another candidate beats it by the scheme's margin, and
/// never while an attack at it is still in flight. A higher-priority monster in range always
/// takes over at once (the tier filter: the incumbent is no longer a candidate).
/// </summary>
public void HandleCombatTrigger()
{
// Utility-AI selection: score every visible candidate, pick the highest.
// The locked target carries a stickiness bonus so we only switch when a
// genuinely better option appears — no flapping on near-ties.
if (_scannedTargets.Count == 0) return;
int bestId = 0;
double bestScore = double.MinValue;
double heldScore = double.MinValue; // scored total for the incumbent, for the switch log
bool incumbentSeen = false;
DateTime now = TargetClock();
double acquireRange = Math.Max(1.0, _settings.MonsterRange);
var scheme = (TargetScheme)Math.Clamp(_settings.TargetSelection, 0, 3);
// Strict priority: the highest Priority among monsters inside MonsterRange (or among
// all scanned ones when none is inside it) is the only tier that may be picked.
@ -3388,149 +3423,87 @@ public partial class CombatManager : IDisposable
if (p > topAnyRange) topAnyRange = p;
if (c.Distance <= acquireRange && p > topPriority) topPriority = p;
}
if (topPriority == int.MinValue) topPriority = topAnyRange;
// Finish what you started: a target we have damaged (or whose health is known to be below
// full) is kept while it's within MonsterRange and in the top priority tier, whatever a
// closer fresh monster scores. As a score bonus (stickiness 25 + commitment 20) it lost to
// a fresh monster ~2 m closer (20 points a metre at Monster Range 5): Mob A hit twice,
// Mob B killed, back to A (2026-10-04). Only a clearly more wounded monster in range takes
// over: a predicted kill that survived. Stuck targets are still dropped by the stall
// watchdog (it suppresses them out of the scan).
int forcedId = 0;
if (_lockedTargetId != 0)
{
ScannedTarget? inc = null;
foreach (var c in _scannedTargets) if (c.Id == _lockedTargetId) { inc = c; break; }
if (inc is { } held && held.Distance <= acquireRange && PriorityOf(held.Id) >= topPriority)
{
float heldHp = _worldFilter.GetHealthRatio(held.Id);
bool wounded = _lastDamageDealtAt != DateTime.MinValue || (heldHp >= 0f && heldHp < 0.99f);
if (wounded)
{
float best = heldHp >= 0f ? heldHp : 1f;
foreach (var c in _scannedTargets)
{
if (c.Id == held.Id || c.Distance > acquireRange || PriorityOf(c.Id) < topPriority) continue;
float r = _worldFilter.GetHealthRatio(c.Id);
if (r > 0f && r < best - MoreWoundedMargin) { best = r; forcedId = c.Id; }
}
if (forcedId == 0)
{
_lockedLastSeenInScan = DateTime.Now;
return; // keep the wounded target
}
}
}
}
bool anyInRange = topPriority != int.MinValue;
if (!anyInRange) topPriority = topAnyRange;
// The best candidate by the scheme. Only monsters inside MonsterRange when any is: the
// scan holds a locked target out to DisengageDistance (MonsterRange+3 by default) so a
// lone mob at the edge doesn't flip engage/peace, not so it can hold off monsters inside
// the range the user set (2026-09-27, Olthoi swarm: a target at 5-8 m kept for over a
// minute while mobs stood at 3-5 m with Monster Range 5).
ScannedTarget best = default;
double bestKey = 0;
bool haveBest = false;
ScannedTarget? incInScan = null;
foreach (var c in _scannedTargets)
{
if (c.Id == _lockedTargetId) incInScan = c;
if (PriorityOf(c.Id) < topPriority) continue; // a higher-priority monster is in range
double s = ScoreCandidate(c);
// The incumbent keeps stickiness and commitment only inside MonsterRange. The
// scan holds a locked target out to DisengageDistance (MonsterRange+3 by default)
// so a lone mob at the edge doesn't flip engage/peace, not so it can out-score
// mobs inside the range the user set. Beyond MonsterRange it competes on its
// merits, and any reasonable in-range mob takes over. Before this a target at
// 5-8 m kept +45 and could hold off mobs at 3-5 m (2026-09-27, Olthoi swarm:
// Monster Range 5, one target kept for over a minute, never out of range).
if (c.Id == _lockedTargetId)
{
double meritScore = s;
s += TARGET_SWITCH_STICKINESS;
// Commitment: once we have COMMITTED to the locked target,
// finishing it outranks any small positional edge a fresh mob
// holds. Stickiness alone only settles near-ties — it loses to a
// full-health mob that simply walked closer, which is how the bot
// left a trail of half-dead mobs.
//
// Armed at cast ISSUE as well as on confirmed damage, because
// Force Arc has ~2s of travel time and keying only on damage
// landing left that window looking "untouched" — a 2.4-point
// margin could walk away from a mob with a bolt already in the
// air (observed 2026-09-03 02:22:45).
//
// The cast-issue arm MUST expire. The first version keyed on
// _lastAttackedTargetId alone, which is set at issue and never
// cleared while the lock holds — granting a permanent +20 on top
// of the +25 stickiness to a target that had never taken damage
// and might never take any. With TargetNoProgressTimeoutSec
// defaulting to 0 (disabled) nothing else breaks that loop: on
// 2026-09-05 the bot held one Olthoi for 5+ hours, ~3,100 casts,
// zero damage, zero kills, switches down from 126 to 3 per 4h.
//
// Bounded to the projectile flight window instead: long enough to
// cover a bolt in the air, short enough that a target which never
// takes damage returns to competing on its merits.
// Two bounds, and BOTH are needed:
// * since the last cast — covers the bolt currently in flight;
// * since the target was locked — caps how long we extend that
// courtesy to a target that has never actually taken damage.
// The second bound is the important one. Without it the window
// refreshes on every cast, so a target under continuous fire keeps
// the bonus indefinitely, which is the same permanent-immunity bug
// in a different guise.
//
// Once damage HAS landed, _lastDamageDealtAt grants commitment with
// no time bound — finishing a wounded mob is exactly the intent.
bool undamaged = _lastDamageDealtAt == DateTime.MinValue;
bool withinFlightWindow =
_lastAttackedTargetId == c.Id
&& _lastAttackedAt != DateTime.MinValue
&& (DateTime.Now - _lastAttackedAt).TotalMilliseconds <= CastCommitmentWindowMs;
bool withinUndamagedGrace =
_targetLockedAt != DateTime.MinValue
&& (DateTime.Now - _targetLockedAt).TotalMilliseconds <= UndamagedCommitmentMaxMs;
if (!undamaged || (withinFlightWindow && withinUndamagedGrace))
s += DAMAGE_COMMITMENT_BONUS;
if (c.Distance > acquireRange)
s = meritScore; // beyond MonsterRange: no stickiness, no commitment (see above)
heldScore = s;
incumbentSeen = true;
_lockedLastScore = s;
_lockedLastSeenInScan = DateTime.Now;
}
if (s > bestScore) { bestScore = s; bestId = c.Id; }
if (anyInRange && c.Distance > acquireRange) continue;
double key = SchemeKey(scheme, c);
if (!haveBest || BetterCandidate(key, c, bestKey, best)) { best = c; bestKey = key; haveBest = true; }
}
if (!haveBest) return;
// Incumbent briefly absent from the scan: keep it in the running at its
// last known score for the grace window rather than letting it score
// nothing. Without this a transient scan gap hands the fight to whoever
// happens to be visible this tick, then the next tick hands it back —
// the A->B->A flapping seen repeatedly on 2026-09-03.
if (!incumbentSeen
&& _lockedTargetId != 0
&& _lockedPriority >= topPriority
&& _lockedLastScore > double.MinValue
&& _lockedLastSeenInScan != DateTime.MinValue
&& (DateTime.Now - _lockedLastSeenInScan).TotalMilliseconds <= TARGET_SCAN_GRACE_MS)
{
heldScore = _lockedLastScore;
if (heldScore >= bestScore)
return; // incumbent still wins on its last known score — no switch
}
if (forcedId != 0) { bestId = forcedId; bestScore = double.NaN; heldScore = double.MinValue; }
if (bestId == 0 || bestId == _lockedTargetId) return;
// One line per real switch. After the scoring fixes a switch should be a
// genuine event (target died, left, or something decisively better showed
// up) — if this floods the log, selection is thrashing again and the two
// scores say by how much.
int bestPriority = PriorityOf(bestId);
// Is the incumbent still valid? In the scan (or briefly out of it, within the scan
// grace, at its last seen values), in the top tier, inside MonsterRange, not
// blacklisted or suppressed by a watchdog.
string? invalidWhy = null;
ScannedTarget inc = default;
if (_lockedTargetId != 0)
{
string held = forcedId != 0 ? "wounded, but another is more wounded"
: _lockedPriority < bestPriority ? $"priority {_lockedPriority} < {bestPriority}"
: heldScore == double.MinValue ? "gone" : heldScore.ToString("0.0");
_host.Log($"[CombatTarget] switch 0x{_lockedTargetId:X8} '{_worldFilter[_lockedTargetId]?.Name}' (score={held}, {DescribeTargetPos(_lockedTargetId)}) " +
$"-> 0x{bestId:X8} '{_worldFilter[bestId]?.Name}' (score={bestScore:0.0}, priority {bestPriority}, {DescribeTargetPos(bestId)})");
bool gone = false;
if (incInScan is { } seen)
{
inc = seen;
_lockedPriority = PriorityOf(seen.Id);
_lockedLastSeen = seen;
_lockedLastSeenInScan = now;
}
else
{
inc = _lockedLastSeen; // its priority stays the last one seen (_lockedPriority)
gone = _lockedLastSeenInScan == DateTime.MinValue || inc.Id != _lockedTargetId
|| (now - _lockedLastSeenInScan).TotalMilliseconds > TARGET_SCAN_GRACE_MS;
}
invalidWhy = gone ? "gone"
: _lockedPriority < topPriority ? $"priority {_lockedPriority} < {topPriority}"
: inc.Distance > acquireRange ? $"out of Monster Range, {inc.Distance:0.0} m"
: _blacklistManager.IsBlacklisted(_lockedTargetId) ? "blacklisted"
: _recentlyKilled.ContainsKey(_lockedTargetId) ? "suppressed"
: null;
}
string? switchWhy = null;
if (_lockedTargetId != 0 && invalidWhy == null)
{
// Target Lock on: keep it until it is no longer valid. Nothing to log.
if (_settings.TargetLock || best.Id == _lockedTargetId) return;
// Target Lock off: switch only to a clearly better one, and never with an attack
// at the incumbent still on its way.
double incKey = SchemeKey(scheme, inc);
if (incKey - bestKey < SchemeMargin(scheme)) return;
if (AttackInFlightAtLocked(now)) return;
switchWhy = $"{SchemeName(scheme)}: {DescribeSchemeValue(scheme, inc)}, another is clearly better";
}
else if (_lockedTargetId != 0)
{
if (best.Id == _lockedTargetId) return; // its own tier's only choice (e.g. alone past the range)
switchWhy = invalidWhy;
}
// One line per real switch. A switch should be a genuine event (target died, left,
// or a higher priority showed up; with the lock off, something clearly better). If
// this floods the log, selection is thrashing again.
int bestId = best.Id;
int bestPriority = PriorityOf(bestId);
string picked = $"{SchemeName(scheme)}: {DescribeSchemeValue(scheme, best)}, priority {bestPriority}, {DescribeTargetPos(bestId)}";
if (_lockedTargetId != 0)
_host.Log($"[CombatTarget] switch 0x{_lockedTargetId:X8} '{_worldFilter[_lockedTargetId]?.Name}' ({switchWhy}, {DescribeTargetPos(_lockedTargetId)}) " +
$"-> 0x{bestId:X8} '{_worldFilter[bestId]?.Name}' ({picked})");
else
_host.Log($"[CombatTarget] lock 0x{bestId:X8} '{_worldFilter[bestId]?.Name}' (score={bestScore:0.0}, priority {bestPriority}, {DescribeTargetPos(bestId)})");
_host.Log($"[CombatTarget] lock 0x{bestId:X8} '{_worldFilter[bestId]?.Name}' ({picked})");
// [CombatLatency]: time this engagement from the lock to its first attack.
double lockMs = Environment.TickCount64;
@ -3542,8 +3515,8 @@ public partial class CombatManager : IDisposable
_lockedPriority = bestPriority;
_targetLockedAt = DateTime.Now;
_lastDamageDealtAt = DateTime.MinValue;
_lockedLastScore = double.MinValue; // new incumbent — no carried score yet
_lockedLastSeenInScan = DateTime.MinValue;
_lockedLastSeen = best; // it was in this tick's scan: the grace covers a blink next tick
_lockedLastSeenInScan = now;
_consecutiveCastMisses = 0;
_pendingJudgeCastAt = DateTime.MinValue;
_facingTarget = false;
@ -3564,41 +3537,84 @@ public partial class CombatManager : IDisposable
// inventory selection and drops an off-thread SetSelectedObject mutation.
}
private double ScoreCandidate(in ScannedTarget c)
/// <summary>
/// A candidate's rank under <paramref name="scheme"/>: lower is better. Health that isn't
/// known (-1) counts as full. Combat is selection-free (SelectItem removed 2026-06-03), so
/// ACE pushes health only for the mob we are fighting and every other candidate reads -1;
/// reading that as 0 ("at death's door") made every untouched mob look nearly dead, and a
/// target's rank collapsed the moment we hit it and its real health arrived: pick, turn,
/// hit once, re-pick, turn again (the spin). An un-engaged mob is almost certainly at full
/// health.
/// </summary>
internal double SchemeKey(TargetScheme scheme, in ScannedTarget c) => scheme switch
{
double maxDist = Math.Max(1.0, _settings.MonsterRange);
double distScore = Math.Clamp((maxDist - c.Distance) / maxDist, 0.0, 1.0) * 100.0;
TargetScheme.LowestHealth => HealthOrFull(c.Id),
TargetScheme.Farthest => -c.Distance,
TargetScheme.LeastTurning => c.Angle,
_ => c.Distance,
};
// GetHealthRatio returns -1 for "no vitals received for this mob yet".
// Combat is selection-free (SelectItem removed 2026-06-03), so ACE only
// pushes health for the mob we are actually fighting — every other
// candidate reads -1. Math.Clamp(-1, 0, 1) folded that to 0.0, i.e. "at
// death's door", so every untouched mob collected the FULL 50-point
// wounded bonus while the mob we were burning down scored its real,
// smaller one.
//
// The nastier half: a target's score COLLAPSED by up to 45 points the
// instant we hit it and its true health finally arrived. Engaging a mob
// made it a worse choice than the untouched mob standing next to it, so
// combat was pushed off whatever it had just committed to and onto the
// next one — pick, turn, hit once, re-pick, turn again. That is the spin.
//
// Unknown health means "not engaged yet", and an un-engaged mob is almost
// certainly at full health. Score it that way.
float hpRatio = _worldFilter.GetHealthRatio(c.Id);
double hpScore = hpRatio < 0f ? 0.0 : (1.0 - Math.Clamp(hpRatio, 0f, 1f)) * 50.0;
private double HealthOrFull(int id)
{
float r = _worldFilter.GetHealthRatio(id);
return r < 0f ? 1.0 : Math.Clamp(r, 0f, 1f);
}
// Continuous ramp rather than a hard step at 3.0m. As a step this was
// worth 30 points the moment a mob crossed the line — more than
// TARGET_SWITCH_STICKINESS (25) — so a mob jittering either side of 3.0m
// could flip the winner every tick regardless of our commitment.
double threatScore = Math.Clamp((THREAT_RANGE_M - c.Distance) / THREAT_RANGE_M, 0.0, 1.0) * 30.0;
/// <summary>Ranks <paramref name="c"/> ahead of the best so far: a lower key, ties to the
/// closer one, then the lower id (so the pick is stable tick to tick).</summary>
private static bool BetterCandidate(double key, in ScannedTarget c, double bestKey, in ScannedTarget best)
{
if (key != bestKey) return key < bestKey;
if (c.Distance != best.Distance) return c.Distance < best.Distance;
return (uint)c.Id < (uint)best.Id;
}
double facingScore = (1.0 - Math.Min(1.0, c.Angle / 180.0)) * 10.0;
/// <summary>With Target Lock off, how much better (in <see cref="SchemeKey"/> units) another
/// candidate must be than the incumbent to take over.</summary>
private static double SchemeMargin(TargetScheme scheme) => scheme switch
{
TargetScheme.LowestHealth => MoreWoundedMargin,
TargetScheme.LeastTurning => LessTurningMarginDeg,
_ => CloserFartherMarginM,
};
// Monster priority is not scored here: HandleCombatTrigger only scores monsters of
// the top Priority in range (see PriorityOf), so within the field it's a constant.
return distScore + hpScore + threatScore + facingScore;
internal static string SchemeName(TargetScheme scheme) => scheme switch
{
TargetScheme.LowestHealth => "lowest health",
TargetScheme.Closest => "closest",
TargetScheme.Farthest => "farthest",
_ => "least turning",
};
private string DescribeSchemeValue(TargetScheme scheme, in ScannedTarget c)
{
switch (scheme)
{
case TargetScheme.LowestHealth:
float r = _worldFilter.GetHealthRatio(c.Id);
return r < 0f ? "health unknown (as full)" : $"health {Math.Clamp(r, 0f, 1f) * 100:0}%";
case TargetScheme.LeastTurning:
return $"turn {c.Angle:0} deg";
default:
return $"{c.Distance:0.0} m";
}
}
/// <summary>
/// True while an attack at the locked target is still on its way: issued at it within
/// <see cref="CastCommitmentWindowMs"/> with no damage landed since. Capped by
/// <see cref="UndamagedCommitmentMaxMs"/> since the last damage (or the lock, when it never
/// took any), so continuous fire at a target that never takes damage can't hold it forever.
/// Only Target Lock off asks: with the lock on nothing switches a valid target anyway.
/// </summary>
private bool AttackInFlightAtLocked(DateTime now)
{
if (_lockedTargetId == 0 || _lastAttackedTargetId != _lockedTargetId || _lastAttackedAt == DateTime.MinValue)
return false;
if ((now - _lastAttackedAt).TotalMilliseconds > CastCommitmentWindowMs) return false;
if (_lastDamageDealtAt != DateTime.MinValue && _lastDamageDealtAt >= _lastAttackedAt) return false; // it landed
DateTime progress = _lastDamageDealtAt != DateTime.MinValue ? _lastDamageDealtAt : _targetLockedAt;
return progress != DateTime.MinValue && (now - progress).TotalMilliseconds <= UndamagedCommitmentMaxMs;
}
/// <summary>The Priority of the monster rule that applies to <paramref name="id"/> (its own
@ -5178,9 +5194,10 @@ public partial class CombatManager : IDisposable
LastCombatSkipReason = "cast"; // D4 record-only: offensive cast issued this tick
// Visibility: log exactly what war/void spell we're about to cast
// (id + resolved name + element/tier/target). Diagnostic only.
_host.Log($"[CombatCast] offensive id={offensiveSpellId} " +
_lastOffensiveCastLine = $"offensive id={offensiveSpellId} " +
$"'{SpellTableStub.GetById(offensiveSpellId)?.Name}' elem={element} " +
$"shape={ShapeName(castShape)} ring={isRing} warTier={warTier} voidTier={voidTier} target='{target.Name}'");
$"shape={ShapeName(castShape)} ring={isRing} warTier={warTier} voidTier={voidTier} target='{target.Name}'";
_host.Log("[CombatCast] " + _lastOffensiveCastLine);
try
{
_host.CastSpellFor((uint)activeTargetId, offensiveSpellId, "Combat", SpellTableStub.GetById(offensiveSpellId)?.Name ?? $"spell {offensiveSpellId}");

View file

@ -0,0 +1,25 @@
using System;
using RynthCore.Plugin.RynthAi.LegacyUi;
namespace RynthCore.Plugin.RynthAi;
/// <summary>
/// The item a Consumables rule means right now. A rule is saved with the stack it was added
/// from (its object id), and that stack disappears when it runs out: 200 Stamina Tinctures
/// used up, and the next stack was never touched until the player added it again (report
/// 2026-10-10). So: the listed stack while it is still known, else any carried item with the
/// same name. Potions, healing kits and lockpicks go through here; pets and mana stones
/// already matched by name.
/// </summary>
internal static class ConsumableLookup
{
public static WorldObject? Resolve(WorldObjectCache cache, ConsumableRule rule)
{
if (rule.Id != 0 && cache[rule.Id] is WorldObject byId) return byId;
if (string.IsNullOrWhiteSpace(rule.Name)) return null;
foreach (WorldObject wo in cache.GetInventory())
if (wo != null && wo.Name.Equals(rule.Name, StringComparison.OrdinalIgnoreCase))
return wo;
return null;
}
}

View file

@ -1122,7 +1122,13 @@ public sealed partial class RynthAiPlugin
return trimmed.Trim();
}
private static string? ExtractCorpseKillerName(string longDesc)
/// <summary>
/// X from the "Killed by X." line of a corpse's LongDesc, or null. Only that line counts:
/// the server appends more lines ("Corpse will decay in 56s") as a corpse ages, and reading
/// them as part of the name failed the own-kill match, so late-reached own kills were
/// skipped unopened (2026-10-06, Silentkelpie). Shared with the radar's killer column.
/// </summary>
internal static string? ExtractCorpseKillerName(string? longDesc)
{
if (string.IsNullOrWhiteSpace(longDesc))
return null;
@ -1133,8 +1139,11 @@ public sealed partial class RynthAiPlugin
return null;
string remainder = longDesc[(idx + prefix.Length)..];
remainder = remainder.TrimEnd('.', ' ', '\n', '\r');
return string.IsNullOrWhiteSpace(remainder) ? null : remainder;
int lineEnd = remainder.IndexOfAny(new[] { '\r', '\n' });
if (lineEnd >= 0)
remainder = remainder[..lineEnd];
remainder = remainder.Trim().TrimEnd('.').Trim();
return remainder.Length == 0 ? null : remainder;
}
private static string GetLootOwnershipModeName(int lootOwnership)
@ -1357,6 +1366,9 @@ public sealed partial class RynthAiPlugin
// Evaluate against loot profile — pure classification, no UseObject.
bool classified = ClassifyItemAgainstProfile(item, settings, out string actionLabel, out bool isSalvage, out string ruleLabel);
// Nothing to salvage with: an item only a Salvage rule wants stays on the corpse.
bool noUst = classified && isSalvage && _salvageManager != null && !_salvageManager.HasUst();
if (noUst) { classified = false; NoteNoUstLeft(item.Name); }
// Per-item decision to the LOG, not just chat. The "Loot rule:" line
// below uses ChatLine (Host.WriteToChat), so nothing about WHY an item
@ -1372,7 +1384,7 @@ public sealed partial class RynthAiPlugin
// rule it should not. If keeps correlate with appraised=False, that
// is the cause.
LootDiag($"[LootEval] '{item.Name}' cls={item.ObjectClass} id=0x{(uint)item.Id:X8} value={item.Values(19, 0)} stack={item.Values(12, 0)} type=0x{item.Values(1, 0):X} wcid={item.Values(unchecked((int)WorldObjectCache.DecalTypeKey), 0)} appraised={hasAppraisalData} timedOut={assessTimedOut} -> " +
(classified ? $"KEEP [{actionLabel}] rule='{ruleLabel}'" : "leave"));
(classified ? $"KEEP [{actionLabel}] rule='{ruleLabel}'" : noUst ? $"leave (Salvage rule '{ruleLabel}', no UST carried)" : "leave"));
if (classified)
{
@ -1913,6 +1925,17 @@ public sealed partial class RynthAiPlugin
/// taken; actionLabel/ruleLabel are what [LootEval] logs. The looter's calls record
/// what they approve (pending sets, counters, chat); ClassifyLootItem has the preview.
/// </summary>
private long _noUstLeftSaidAt = long.MinValue / 2;
/// <summary>Says once every 5 minutes in chat that salvage items are being left for want of a UST.</summary>
private void NoteNoUstLeft(string? name)
{
long now = Environment.TickCount64;
if (now - _noUstLeftSaidAt < 5 * 60_000) return;
_noUstLeftSaidAt = now;
ChatLine($"[RynthAi] No UST in your pack: leaving salvage items on corpses (first: {name}). Carry a Ust to salvage.");
}
private bool ClassifyItemAgainstProfile(WorldObject item, LegacyUiSettings settings, out string actionLabel, out bool isSalvage, out string ruleLabel) =>
ClassifyLootItem(item, settings, preview: false, out actionLabel, out isSalvage, out ruleLabel, out _);

View file

@ -380,13 +380,16 @@ public sealed partial class RynthAiPlugin
return "no-state";
}
private ConsumableRule? FindLockpickInConsumables()
/// <summary>The first listed lockpick still carried: its own stack, else one of the same name (ConsumableLookup).</summary>
private WorldObject? FindLockpickInConsumables()
{
var settings = _dashboard?.Settings;
if (settings == null || _objectCache == null) return null;
return settings.ConsumableRules
.Where(r => r.Type.Equals("Lockpick", StringComparison.OrdinalIgnoreCase))
.FirstOrDefault(r => _objectCache[r.Id] != null);
foreach (var r in settings.ConsumableRules)
if (r.Type.Equals("Lockpick", StringComparison.OrdinalIgnoreCase)
&& ConsumableLookup.Resolve(_objectCache, r) is WorldObject pick)
return pick;
return null;
}
}

View file

@ -388,8 +388,9 @@ internal static partial class DungeonPathfinder
if (prev != null)
{
// Only the patrol looks into rooms; a path to somewhere (dunnav, a detour) doesn't.
bool revisit = i > 0 && (closed ? LooksIn(graph, rooms, lookedInto, steps[i - 1], steps[i], prev, approach) : steps[i - 1].Key == steps[i].Key);
CrossRoom(pts, graph, geo, rooms, rooms.RoomOf[steps[i].From], prev, prevCell, approach, steps[i].From, revisit);
string? why = null;
bool revisit = i > 0 && (closed ? LooksIn(graph, rooms, lookedInto, steps[i - 1], steps[i], prev, approach, out why) : steps[i - 1].Key == steps[i].Key);
CrossRoom(pts, graph, geo, rooms, rooms.RoomOf[steps[i].From], prev, prevCell, approach, steps[i].From, revisit, why);
}
else firstApproach = approach;
Append(pts, approach);
@ -402,8 +403,8 @@ internal static partial class DungeonPathfinder
if (closed && firstApproach != null && prev != null)
{
bool revisit = LooksIn(graph, rooms, lookedInto, steps[steps.Count - 1], steps[0], prev, firstApproach);
CrossRoom(pts, graph, geo, rooms, rooms.RoomOf[steps[0].From], prev, prevCell, firstApproach, steps[0].From, revisit);
bool revisit = LooksIn(graph, rooms, lookedInto, steps[steps.Count - 1], steps[0], prev, firstApproach, out string why);
CrossRoom(pts, graph, geo, rooms, rooms.RoomOf[steps[0].From], prev, prevCell, firstApproach, steps[0].From, revisit, why);
}
if (!closed && dest != null && prev != null && rooms.RoomOf.TryGetValue(destCell, out int rd))
CrossRoom(pts, graph, geo, rooms, rd, prev, prevCell, dest, destCell, revisit: false);
@ -521,13 +522,28 @@ internal static partial class DungeonPathfinder
// Once per room per lap: a hub room with many doorways was otherwise walked to its middle
// again every time the patrol passed between two of its doorways.
private static bool LooksIn(Dictionary<uint, DungeonNavNode> graph, DungeonRooms rooms, HashSet<int> lookedInto,
Step inStep, Step outStep, NavPoint entered, NavPoint leaving)
Step inStep, Step outStep, NavPoint entered, NavPoint leaving, out string why)
{
why = "cross";
if (!rooms.RoomOf.TryGetValue(outStep.From, out int r)) return false;
bool big = RoomSpreadMeters(graph, rooms.Cells[r]) >= LookInMinSpreadMeters;
bool look = (inStep.Key == outStep.Key && (big || rooms.Cells[r].Count == 1))
|| (big && NavPointYd(entered, leaving) < LookInMaxSkirtMeters);
return look && lookedInto.Add(r);
double spread = RoomSpreadMeters(graph, rooms.Cells[r]);
bool big = spread >= LookInMinSpreadMeters;
bool sameDoor = inStep.Key == outStep.Key;
double skirt = NavPointYd(entered, leaving);
bool look = (sameDoor && (big || rooms.Cells[r].Count == 1))
|| (big && skirt < LookInMaxSkirtMeters);
bool first = look && lookedInto.Add(r);
if (PointLog != null)
{
var inv = System.Globalization.CultureInfo.InvariantCulture;
string what = sameDoor && (big || rooms.Cells[r].Count == 1)
? (big ? "same-doorway,big" : "same-doorway,1-cell")
: "big,skirt" + skirt.ToString("F1", inv) + "m";
why = !look ? (sameDoor ? "cross(same-doorway,small)" : "cross(" + (big ? "big," : "small,") + "other-doorway)")
: first ? "look-in(" + what + ",spread" + spread.ToString("F0", inv) + "m)"
: "cross(already-looked-in)";
}
return first;
}
// The diagonal of the box round a room's cell origins: 0 for the pieces of one junction
@ -602,7 +618,7 @@ internal static partial class DungeonPathfinder
int prevStep = -1;
foreach (var (d, _, k) in doors)
{
var m = Tag(WorldPoint(d.X, d.Y, d.Z, !d.IsWide), "run-opening");
var m = Note(Tag(WorldPoint(d.X, d.Y, d.Z, !d.IsWide), "run-opening"), steps[k].From, steps[k].From, steps[k].To, "doorway-run");
if (prevM != null && k == prevStep + 1
&& rooms.RoomOf.TryGetValue(steps[prevStep].To, out int ra) && rooms.RoomOf.TryGetValue(steps[k].From, out int rb) && ra == rb)
PullThrough(middle, graph, geo, rooms, rooms.Cells[ra], prevM, steps[prevStep].To, m, steps[k].From);
@ -630,8 +646,8 @@ internal static partial class DungeonPathfinder
{
var (nx, ny) = d.NormalFrom(a);
narrow = !d.IsWide;
approach = Tag(DoorwayPoint(geo, rooms, a, d, -nx, -ny, narrow), "approach");
exit = Tag(DoorwayPoint(geo, rooms, b, d, nx, ny, narrow), "exit");
approach = Note(Tag(DoorwayPoint(geo, rooms, a, d, -nx, -ny, narrow), "approach"), a, a, b, "doorway");
exit = Note(Tag(DoorwayPoint(geo, rooms, b, d, nx, ny, narrow), "exit"), b, a, b, "doorway");
return true;
}
@ -639,6 +655,7 @@ internal static partial class DungeonPathfinder
double dNS = nb.NS - na.NS, dEW = nb.EW - na.EW, dZ = nb.Z - na.Z;
approach = Tag(new NavPoint { Type = NavPointType.Point, NS = na.NS + dNS * 0.3, EW = na.EW + dEW * 0.3, Z = (na.Z + dZ * 0.3) / 240.0 }, "cell-fallback");
exit = Tag(new NavPoint { Type = NavPointType.Point, NS = na.NS + dNS * 0.5, EW = na.EW + dEW * 0.5, Z = (na.Z + dZ * 0.5) / 240.0 }, "cell-fallback");
Note(approach, a, a, b, "doorway(no-opening)"); Note(exit, 0, a, b, "doorway(no-opening)");
PushOffWalls(geo, approach, RoomCells(rooms, a), CornerPushMax);
PushOffWalls(geo, exit, null, CornerPushMax); // on the line between the two rooms
return false;
@ -704,7 +721,7 @@ internal static partial class DungeonPathfinder
/// </summary>
private static void CrossRoom(List<NavPoint> pts, Dictionary<uint, DungeonNavNode> graph, DungeonGeometry geo,
DungeonRooms rooms, int room, NavPoint from, uint fromCell, NavPoint to, uint toCell,
bool revisit)
bool revisit, string? why = null)
{
var cells = rooms.Cells[room];
Trace?.Invoke($"cross room {room} ({cells.Count}) revisit={revisit} from={fromCell:X8} to={toCell:X8}");
@ -713,13 +730,18 @@ internal static partial class DungeonPathfinder
var mid = RoomMiddle(graph, geo, cells, out uint midCell);
if (mid != null)
{
int before = pts.Count;
Note(mid, midCell);
PullThrough(pts, graph, geo, rooms, cells, from, fromCell, mid, midCell);
Append(pts, mid);
PullThrough(pts, graph, geo, rooms, cells, mid, midCell, to, toCell);
NoteCrossing(pts, before, room, why ?? "look-in");
return;
}
}
int start = pts.Count;
PullThrough(pts, graph, geo, rooms, cells, from, fromCell, to, toCell);
NoteCrossing(pts, start, room, why ?? "cross");
}
internal static Action<string>? Trace;
@ -740,11 +762,11 @@ internal static partial class DungeonPathfinder
{
uint a = cellPath[i], b = cellPath[i + 1];
NavPoint corner;
if (geo.TryGetDoorway(a, b, out var d)) corner = Tag(WorldPoint(d.X, d.Y, d.Z, false), "pull-opening");
if (geo.TryGetDoorway(a, b, out var d)) corner = Note(Tag(WorldPoint(d.X, d.Y, d.Z, false), "pull-opening"), a, a, b);
else
{
var na = graph[a]; var nb = graph[b];
corner = Tag(new NavPoint { Type = NavPointType.Point, NS = (na.NS + nb.NS) * 0.5, EW = (na.EW + nb.EW) * 0.5, Z = (na.Z + nb.Z) * 0.5 / 240.0 }, "pull-midpoint");
corner = Note(Tag(new NavPoint { Type = NavPointType.Point, NS = (na.NS + nb.NS) * 0.5, EW = (na.EW + nb.EW) * 0.5, Z = (na.Z + nb.Z) * 0.5 / 240.0 }, "pull-midpoint"), a, a, b);
}
PushOffWalls(geo, corner, cells, CornerPushMax);
corners.Add(corner);
@ -861,12 +883,132 @@ internal static partial class DungeonPathfinder
/// cell-fallback.</summary>
internal static Dictionary<NavPoint, string>? KindLog;
/// <summary>Why one patrol point is where it is (diagnostics only; filled while
/// <see cref="PointLog"/> is set, never read by the route itself).</summary>
internal sealed class PatrolPointInfo
{
public string Kind = ""; // the rule that laid it (as KindLog)
public uint Cell; // the cell the rule put it in (0 = not known)
public uint OpenFrom, OpenTo; // the opening it belongs to (doorway-type points)
public int Room = -1; // the room being crossed, for points laid while crossing one
public string Why = ""; // doorway / cross / look-in reason
}
/// <summary>Set (per thread) around a route build to record a <see cref="PatrolPointInfo"/>
/// for every point laid: BuildDunPatrol's waypoint log, PatrolProof "waypoints".</summary>
[ThreadStatic] internal static Dictionary<NavPoint, PatrolPointInfo>? PointLog;
/// <summary>GetMainRouteNodes' sizes for the last build while <see cref="PointLog"/> was set.</summary>
[ThreadStatic] internal static string? MainRouteNote;
private static NavPoint Tag(NavPoint p, string kind)
{
if (KindLog != null) KindLog[p] = kind;
if (PointLog != null) Info(p).Kind = kind;
return p;
}
private static PatrolPointInfo Info(NavPoint p)
{
if (!PointLog!.TryGetValue(p, out var info)) PointLog[p] = info = new PatrolPointInfo();
return info;
}
// Records the cell (and opening) a point was laid for, when the point log is on.
private static NavPoint Note(NavPoint p, uint cell, uint openFrom = 0, uint openTo = 0, string? why = null)
{
if (PointLog == null) return p;
var info = Info(p);
info.Cell = cell;
if (openFrom != 0) { info.OpenFrom = openFrom; info.OpenTo = openTo; }
if (why != null) info.Why = why;
return p;
}
// Points added to pts from index `from` on were laid crossing `room` for `why`.
private static void NoteCrossing(List<NavPoint> pts, int from, int room, string why)
{
if (PointLog == null) return;
for (int k = Math.Max(0, from); k < pts.Count; k++)
{
var info = Info(pts[k]);
if (info.Room < 0) { info.Room = room; info.Why = why; }
}
}
/// <summary>The cell whose floor is under a point, else the nearest cell centre.</summary>
internal static uint CellAt(Dictionary<uint, DungeonNavNode> graph, DungeonGeometry? geo, NavPoint p)
{
if (geo != null)
{
double x = DungeonGeometry.NavToWorld(p.EW), y = DungeonGeometry.NavToWorld(p.NS), z = p.Z * 240.0;
uint best = 0; double bestD = double.MaxValue;
foreach (var n in graph.Values)
{
if (!geo.OnCellFloor(n.CellId, x, y, z)) continue;
double d = Math.Abs(n.Z - z);
if (d < bestD) { bestD = d; best = n.CellId; }
}
if (best != 0) return best;
}
return NearestCell(graph, p.NS, p.EW, (float)(p.Z * 240.0));
}
/// <summary>
/// One line per patrol waypoint (index, world x/y/z, cell, room and its size, the rule that
/// laid it, the opening for doorway points, why) and a summary line, from the point log of
/// the build. Rooms are BuildRooms(graph, geo, hazards), as the builder used them.
/// Lines carry no prefix; the plugin adds "[RynthAi] DunNav-Patrol ".
/// </summary>
internal static List<string> DescribePatrol(NavRouteParser route, Dictionary<uint, DungeonNavNode> graph,
DungeonGeometry? geo, IReadOnlySet<uint>? hazards,
Dictionary<NavPoint, PatrolPointInfo>? log, int tinyMaxCells = 5)
{
var lines = new List<string>();
var rooms = geo != null ? BuildRooms(graph, geo, hazards) : null;
int tiny = 0, tinyEntered = 0, tinyLooked = 0;
var tinyRooms = new SortedDictionary<int, (int Cells, int Entered, int Looked)>();
var inv = System.Globalization.CultureInfo.InvariantCulture;
for (int i = 0; i < route.Points.Count; i++)
{
var p = route.Points[i];
PatrolPointInfo? info = null;
log?.TryGetValue(p, out info);
uint cell = info != null && info.Cell != 0 ? info.Cell : CellAt(graph, geo, p);
int room = rooms != null && rooms.RoomOf.TryGetValue(cell, out int rr) ? rr : -1;
int size = room >= 0 ? rooms!.Cells[room].Count : 0;
string kind = info?.Kind is { Length: > 0 } k ? k : "unlogged";
string why = info?.Why ?? "";
string open = "";
if (info != null && info.OpenFrom != 0)
{
string w = geo != null && geo.TryGetDoorway(info.OpenFrom, info.OpenTo, out var d)
? (d.IsWide ? " wide " : " narrow ") + d.Width.ToString("F1", inv) + "m" : "";
open = $" open {info.OpenFrom:X8}>{info.OpenTo:X8}{w}";
}
string crossed = info != null && info.Room >= 0 && info.Room != room && rooms != null
? $" crossing room {info.Room} ({rooms.Cells[info.Room].Count})" : "";
bool haz = hazards != null && hazards.Contains(cell);
lines.Add(string.Format(inv, "wp {0} ({1:F1},{2:F1},{3:F1}) cell {4:X8} room {5} ({6} cells){7} {8}{9}{10}{11}{12}",
i, DungeonGeometry.NavToWorld(p.EW), DungeonGeometry.NavToWorld(p.NS), p.Z * 240.0,
cell, room, size, haz ? " HAZARD" : "", kind, p.Doorway ? " [door]" : "", open, crossed,
why.Length > 0 ? " why=" + why : ""));
if (room >= 0 && size <= tinyMaxCells)
{
tiny++;
bool looked = why.StartsWith("look-in", StringComparison.Ordinal) && info!.Room == room;
if (looked) tinyLooked++; else tinyEntered++;
tinyRooms.TryGetValue(room, out var t);
tinyRooms[room] = (size, t.Entered + (looked ? 0 : 1), t.Looked + (looked ? 1 : 0));
}
}
string roomList = string.Join(" ", tinyRooms.Select(kv => $"{kv.Key}({kv.Value.Cells}c:{kv.Value.Entered}e/{kv.Value.Looked}l)"));
if (MainRouteNote != null) lines.Add("wp " + MainRouteNote);
lines.Add($"wp summary: {route.Points.Count} points, {rooms?.Cells.Count ?? 0} rooms, {hazards?.Count ?? 0} hazard cells; " +
$"in rooms of <= {tinyMaxCells} cells: {tiny} (entered {tinyEntered}, looked into {tinyLooked}) in {tinyRooms.Count} rooms: {roomList}");
return lines;
}
private static NavPoint WorldPoint(double wx, double wy, double wz, bool doorway) => new()
{
Type = NavPointType.Point,

View file

@ -464,6 +464,88 @@ internal static partial class DungeonPathfinder
private static HashSet<uint> GetMainRouteNodes(
Dictionary<uint, DungeonNavNode> graph, uint startCell,
IReadOnlySet<uint>? hazardCells = null)
{
var (reachable, pruned) = ReachableAndCore(graph, startCell, hazardCells);
int originalCount = reachable.Count;
// Fall back to full reachable set if pruning collapsed the graph - judged on the dungeon
// itself, not on what the hazards left. 2026-10-10, 0x6146: 3 acid cells + 35 lava-floor
// cells cut the loops (2-core 277 -> 68, under 20% of reachable), the fallback fired and
// the patrol walked into every dead-end 1-cell room. A dungeon with loops keeps its
// (smaller) 2-core around the hazards; only a dungeon that is linear without hazards, or
// a core under PatrolMinKeepNodes, falls back.
bool collapsed = pruned.Count < PatrolMinKeepNodes || pruned.Count < originalCount * PatrolMinKeepFraction;
HashSet<uint> result = pruned;
string how = "2-core used";
if (collapsed && hazardCells != null && hazardCells.Count > 0)
{
var (freeReach, freeCore) = ReachableAndCore(graph, startCell, null);
bool dungeonIsLinear = freeCore.Count < PatrolMinKeepNodes || freeCore.Count < freeReach.Count * PatrolMinKeepFraction;
if (!dungeonIsLinear)
{
// The hazards cut the loops; the rest of the dungeon hangs off them as long branches.
// Walk those, but not the short spurs (closets, 1-2 cell rooms behind a door).
result = TrimShortSpurs(graph, reachable, startCell, PatrolMaxSpurCells);
how = $"hazards cut the loops: all reachable cells but spurs of <= {PatrolMaxSpurCells} cells ({result.Count} kept)";
}
else { result = reachable; how = $"FALLBACK: patrol uses all {originalCount} reachable cells, dead ends included"; }
}
else if (collapsed) { result = reachable; how = $"FALLBACK: patrol uses all {originalCount} reachable cells, dead ends included"; }
if (PointLog != null)
MainRouteNote = $"main route from {startCell:X8}: {originalCount} reachable cells, 2-core {pruned.Count} "
+ $"({hazardCells?.Count ?? 0} hazard cells) -> " + how;
return result;
}
/// <summary>Dead-end spurs this short (cells from the tip to the first junction) are left out
/// when the hazards collapsed the 2-core.</summary>
internal const int PatrolMaxSpurCells = 3;
/// <summary>
/// <paramref name="cells"/> without every dead-end spur of at most <paramref name="maxSpur"/> cells:
/// from each tip (one walkable neighbour) walk inward through corridor cells (two neighbours)
/// to the first junction; a chain that short goes. One pass, so a long branch keeps its far end.
/// </summary>
internal static HashSet<uint> TrimShortSpurs(Dictionary<uint, DungeonNavNode> graph, HashSet<uint> cells, uint keep, int maxSpur)
{
int Degree(uint id)
{
if (!graph.TryGetValue(id, out var n)) return 0;
int d = 0;
foreach (uint nb in n.Neighbors)
if (cells.Contains(nb) && graph.TryGetValue(nb, out var o) && !IsDropEdge(n, o)) d++;
return d;
}
var drop = new HashSet<uint>();
foreach (uint tip in cells)
{
if (tip == keep || Degree(tip) != 1) continue;
var chain = new List<uint> { tip };
uint prev = 0, cur = tip;
bool shortSpur = false;
while (true)
{
uint next = 0;
foreach (uint nb in graph[cur].Neighbors)
if (nb != prev && cells.Contains(nb) && graph.TryGetValue(nb, out var o) && !IsDropEdge(graph[cur], o)) { next = nb; break; }
if (next == 0) break; // an isolated pair: leave it
int d = Degree(next);
if (d >= 3) { shortSpur = true; break; } // reached a junction
if (d <= 1 || next == keep) break; // the whole thing is a line, or runs into the start
chain.Add(next);
if (chain.Count > maxSpur) break; // long branch: keep it
prev = cur; cur = next;
}
if (shortSpur && chain.Count <= maxSpur) foreach (uint c in chain) drop.Add(c);
}
var result = new HashSet<uint>(cells);
result.ExceptWith(drop);
return result;
}
/// <summary>The cells reachable from startCell (no drops, no hazards) and their 2-core.</summary>
private static (HashSet<uint> Reachable, HashSet<uint> Core) ReachableAndCore(
Dictionary<uint, DungeonNavNode> graph, uint startCell, IReadOnlySet<uint>? hazardCells)
{
// BFS to collect all cells reachable from startCell without drops or hazards.
// The start cell is always kept (player is already standing there) even if
@ -490,7 +572,6 @@ internal static partial class DungeonPathfinder
}
}
int originalCount = reachable.Count;
var pruned = new HashSet<uint>(reachable);
// Prune to convergence: repeatedly remove every node whose effective
@ -521,12 +602,7 @@ internal static partial class DungeonPathfinder
foreach (uint id in toRemove) pruned.Remove(id);
}
// Fall back to full reachable set if pruning collapsed the graph.
if (pruned.Count < PatrolMinKeepNodes ||
pruned.Count < originalCount * PatrolMinKeepFraction)
return reachable;
return pruned;
return (reachable, pruned);
}
/// <summary>

View file

@ -14,6 +14,7 @@ internal sealed class LegacyAdvancedSettingsUi
private static readonly string[] AttackHeights = { "Low", "Medium", "High" };
private static readonly string[] NavLabelModeNames = { "Off", "Numbers", "Numbers and names" };
private static readonly string[] TargetSelectionNames = { "Lowest health", "Closest", "Farthest", "Least turning" };
private static readonly string[] LootOwnershipModes = { "My Kills Only", "Fellowship Kills", "All Corpses" };
public LegacyAdvancedSettingsUi(LegacyUiSettings settings)
@ -570,6 +571,17 @@ internal sealed class LegacyAdvancedSettingsUi
ImGui.SetNextItemWidth(120);
ImGui.InputInt("Approach Range", ref _settings.ApproachRange);
ImGui.Spacing();
ImGui.Text("Combat Targeting");
ImGui.Separator();
ImGui.SetNextItemWidth(160);
ImGui.Combo("Targeting", ref _settings.TargetSelection, TargetSelectionNames, TargetSelectionNames.Length);
if (ImGui.IsItemHovered())
ImGui.SetTooltip("Which monster to attack, among those of the highest priority inside Monster Range.\nLeast turning: the one needing the smallest turn to face. Unknown health counts as full.");
ImGui.Checkbox("Target Lock", ref _settings.TargetLock);
if (ImGui.IsItemHovered())
ImGui.SetTooltip("On: keeps the target it picked until it dies, leaves Monster Range, or a higher-priority monster shows up.\nOff: switches whenever another monster is clearly better by the Targeting rule.");
ImGui.Spacing();
ImGui.Text("Corpse Acquisition (Yards)");
ImGui.Separator();

View file

@ -1002,6 +1002,8 @@ internal sealed class LegacyDashboardRenderer
// Ranges
MonsterRange = s.MonsterRange,
MonsterDisengageRange = s.MonsterDisengageRange,
TargetSelection = s.TargetSelection,
TargetLock = s.TargetLock,
RingRange = s.RingRange,
ApproachRange = s.ApproachRange,
CorpseApproachRangeMax = s.CorpseApproachRangeMax,
@ -1214,6 +1216,8 @@ internal sealed class LegacyDashboardRenderer
// Ranges
s.MonsterRange = p.MonsterRange;
if (p.MonsterDisengageRange >= 0) s.MonsterDisengageRange = p.MonsterDisengageRange; // -1 = not sent
if (p.TargetSelection is int targeting) s.TargetSelection = Math.Clamp(targeting, 0, 3); // absent = unchanged
if (p.TargetLock is bool targetLock) s.TargetLock = targetLock; // absent = unchanged
s.RingRange = p.RingRange;
s.ApproachRange = p.ApproachRange;
s.CorpseApproachRangeMax = p.CorpseApproachRangeMax;
@ -1652,6 +1656,8 @@ internal sealed class LegacyDashboardRenderer
dst.InfuseOthersAt = tmp.InfuseOthersAt;
dst.MonsterRange = tmp.MonsterRange;
dst.MonsterDisengageRange = tmp.MonsterDisengageRange;
dst.TargetSelection = Math.Clamp(tmp.TargetSelection, 0, 3);
dst.TargetLock = tmp.TargetLock;
dst.RingRange = tmp.RingRange;
dst.ApproachRange = tmp.ApproachRange;
dst.MinRingTargets = tmp.MinRingTargets;

View file

@ -151,6 +151,15 @@ public sealed class LegacyUiSettings
// can push a mob just past MonsterRange, dropping it and flipping to peace,
// then re-approaching — an endless engage/peace oscillation at the edge.
public int MonsterDisengageRange = 0;
// Targeting (2026-10-10): how combat ranks the monsters of the top Priority inside Monster
// Range (CombatManager.TargetScheme): 0 lowest health (unknown counts as full), 1 closest,
// 2 farthest, 3 least turning. Ties go to the closest.
public int TargetSelection;
// Target Lock: keep the picked target until it dies or goes, leaves Monster Range, is
// blacklisted or skipped by a watchdog, or a higher-priority monster is in range. Off: switch
// when another is clearly better by Targeting. On by default; a profile saved before this
// setting loads it as on.
public bool TargetLock = true;
public int RingRange = 5;
public int ApproachRange = 4;
public int MinRingTargets = 4;
@ -890,6 +899,9 @@ public sealed class SettingsBridgePayload
// Ranges
public int MonsterRange { get; set; }
public int MonsterDisengageRange { get; set; } = -1; // -1 = absent, see BlacklistCastSettleMs
// Nullable: an engine that predates them doesn't send them, and its save must leave them alone.
public int? TargetSelection { get; set; }
public bool? TargetLock { get; set; }
public int RingRange { get; set; }
public int ApproachRange { get; set; }
public double CorpseApproachRangeMax { get; set; }

View file

@ -582,13 +582,7 @@ internal sealed class RynthRadarUi
/// <summary>"Killed by X." in a corpse's LongDesc: X, or "" (read as CorpseOpenController reads it).</summary>
internal static string ExtractKiller(string? longDesc)
{
if (string.IsNullOrWhiteSpace(longDesc)) return string.Empty;
const string prefix = "Killed by ";
int idx = longDesc.IndexOf(prefix, StringComparison.OrdinalIgnoreCase);
if (idx < 0) return string.Empty;
return longDesc[(idx + prefix.Length)..].TrimEnd('.', ' ', '\n', '\r').Trim();
}
=> RynthAiPlugin.ExtractCorpseKillerName(longDesc) ?? string.Empty;
/// <summary>Without GM sigils (+, @, #): the server leaves them out of "Killed by X".</summary>
private static string NormalizeCharName(string name)

View file

@ -173,6 +173,26 @@ public sealed class SalvageManager
_cache = cache;
}
private const long HasUstCacheMs = 3000;
private long _hasUstCheckedAt = long.MinValue / 2;
private bool _hasUst;
/// <summary>
/// A UST is carried (cached 3 s; FindUst can force an inventory walk). Without one there is
/// nothing to salvage with: looting leaves items that only a Salvage rule wants, and the
/// combine sweep doesn't run (2026-10-10).
/// </summary>
public bool HasUst()
{
long now = NowMs;
if (now - _hasUstCheckedAt >= HasUstCacheMs)
{
_hasUstCheckedAt = now;
_hasUst = FindUst() != 0;
}
return _hasUst;
}
/// <summary>Returns true while a salvage operation is in flight.</summary>
public bool IsBusy => _phase != Phase.Idle || _queue.Count > 0;
@ -310,7 +330,7 @@ public sealed class SalvageManager
{
_pendingCombineScan = false;
_lastCombineSweepAt = now;
BeginCombineSalvage(now);
if (HasUst()) BeginCombineSalvage(now);
return;
}
// Periodic standalone sweep: if 30s have passed since the last
@ -323,7 +343,7 @@ public sealed class SalvageManager
&& now - _lastCombineSweepAt >= CombineSweepIntervalMs)
{
_lastCombineSweepAt = now;
BeginCombineSalvage(now);
if (HasUst()) BeginCombineSalvage(now);
}
return;
}
@ -344,6 +364,7 @@ public sealed class SalvageManager
return;
uint ustId = FindUst();
_hasUstCheckedAt = now; _hasUst = ustId != 0;
if (ustId == 0)
{
// Keep the items (they used to be dropped here for good) and look again later.

View file

@ -57,10 +57,37 @@ internal sealed class ManaStoneManager
// Stones we've positively confirmed are charged via AC chat ("is already
// full of mana"). Distinct from the cooldown so the cache's stale CurrentMana
// reading doesn't auto-clear them. Only cleared when the stone disappears
// from cache (consumed via use-on-player).
// reading doesn't auto-clear them. Cleared when the stone gives its mana away
// (see _stoneKnownEmpty below).
private readonly HashSet<int> _stoneKnownCharged = new();
// A stone's charge is read from its last appraisal, and the server never sends a change to it:
// after a stone pours its mana into worn gear the read still shows the old charge, and after a
// drain charges it the read still shows it empty (or can't be read at all). So what the server
// said about a stone since then wins over the read:
// * _stoneKnownCharged (above): "drains N points" into it, "already full of mana", or "no items
// equipped that need mana" (only said for a charged stone). It refills worn gear even when its
// charge can't be read; it never could, so a charged stone whose charge wasn't readable was
// tried as an empty stone, called charged by the server, and then never used on the gear
// (Khanda-handled Mace at 0% for over an hour with five charged stones in the pack, 2026-10-10).
// * _stoneKnownEmpty: it gave its mana ("The Mana Stone gives ..."). Value = the read at that
// moment; a different read later is a newer appraisal and supersedes the mark. Without it the
// same, now empty, stone was picked again 600 ms later (the read still said charged), the
// server cancelled the use without a word, and it timed out and was parked for 5 minutes, stone
// after stone (2026-10-08).
private readonly Dictionary<int, int?> _stoneKnownEmpty = new();
// Stones whose charge can't be read are identified (at most every 5 minutes each) so a charged one
// can refill gear with tapping off, where nothing else ever tells us it is charged.
private readonly Dictionary<int, long> _stoneIdRequestedAt = new();
private const long StoneIdRetryMs = 5 * 60 * 1000;
// The server said the worn gear is full ("Your items are fully charged." / "You have no items
// equipped that need mana."). Worn-item mana is read from appraisals too, so the gear can still read
// low; no refill for a while instead of a stone every think tick.
private long _refillHoldUntil;
private const long RefillHoldMs = 2 * 60 * 1000;
private long _lastNoStoneDiagAt;
// Worn equipment is only treated as "needs refill" when current mana drops
// below this fraction of its MaxMana. Prevents the bot from continually
// dumping stones on the player just because an item dipped slightly.
@ -74,7 +101,9 @@ internal sealed class ManaStoneManager
private const long ThinkIntervalMs = 600;
private const long ActionTimeoutMs = 8000;
private static long NowMs => Environment.TickCount64;
/// <summary>Clock (ms); tests replace it.</summary>
internal static Func<long> Clock { get; set; } = static () => Environment.TickCount64;
private static long NowMs => Clock();
/// <summary>
/// Set by the plugin: true when a Keep or Keep # rule in the active loot profile
@ -209,18 +238,31 @@ internal sealed class ManaStoneManager
|| text.Contains("is destroyed")
|| text.Contains("has been destroyed"))
{
// The stone is charged now; its read still shows it empty until it is appraised again.
if (text.Contains("The Mana Stone drains")) MarkStoneCharged(_activeStoneId);
if (_activeItemId != 0) _lootedForTap.Remove(_activeItemId); // drained and destroyed
GoIdle();
return;
}
// "The Mana Stone gives N points of mana to the X." - the stone was charged after all and
// poured its mana into the item (ACE does that for a charged stone used on an item that
// isn't full). The stone is empty now.
if (text.Contains("The Mana Stone gives"))
{
_host.Log($"[RynthAi] ManaStone: stone 0x{(uint)_activeStoneId:X8} was charged and gave its mana to the item instead - it is empty now.");
MarkStoneEmpty(_activeStoneId);
GoIdle();
return;
}
// "The X is already full of mana." — AC's response when we used a
// CHARGED stone on a non-equipped item (or a fully-loaded item). Our
// cache mis-read this stone as empty. Blacklist it for the tap path
// immediately so the next think tick picks a different stone.
if (text.Contains("is already full of mana") && _activeStoneId != 0)
{
_stoneKnownCharged.Add(_activeStoneId);
MarkStoneCharged(_activeStoneId);
_stoneTapCooldownUntil.Remove(_activeStoneId); // supersede cooldown
_host.Log($"[RynthAi] ManaStone: stone 0x{(uint)_activeStoneId:X8} is actually charged (server: 'already full') — marking known-charged.");
GoIdle();
@ -234,14 +276,62 @@ internal sealed class ManaStoneManager
// "The Mana Stone gives X points of mana to ..." — transfer complete.
// The stone may also have been destroyed in the process; either way
// reset and let the next tick pick a fresh stone.
if (text.Contains("The Mana Stone gives")
|| text.Contains("The Mana Stone is destroyed"))
if (text.Contains("The Mana Stone gives"))
{
// The stone gave its mana and is empty now (an Eternal charge refills itself), though
// its read still shows the old charge.
WorldObject? stone = _activeStoneId != 0 ? _objectCache[_activeStoneId] : null;
if (stone == null || !IsEternal(stone)) MarkStoneEmpty(_activeStoneId);
if (text.Contains("fully charged")) HoldRefills("the server says the worn items are fully charged");
Reset();
return;
}
if (text.Contains("The Mana Stone is destroyed"))
{
Reset();
return;
}
// ACE says this only for a charged stone: the stone keeps its charge, the gear is full.
if (text.Contains("no items equipped that need mana"))
{
MarkStoneCharged(_activeStoneId);
HoldRefills("the server says no worn item needs mana");
Reset();
}
}
}
private void HoldRefills(string why)
{
_refillHoldUntil = NowMs + RefillHoldMs;
_host.Log($"[RynthAi] ManaStone: no worn-gear refill for {RefillHoldMs / 1000}s ({why}; the gear's mana reads are from its last appraisal).");
}
private int? ReadStoneMana(int id) =>
_host.TryGetObjectIntProperty(unchecked((uint)id), (uint)AcIntProperty.CurrentMana, out int cur) ? cur : null;
/// <summary>The server showed this stone empty since its read was taken (and no newer read came in).</summary>
private bool IsKnownEmpty(int id, int? read)
{
if (!_stoneKnownEmpty.TryGetValue(id, out int? atMark)) return false;
if (read != atMark) { _stoneKnownEmpty.Remove(id); return false; } // a newer appraisal: trust it
return true;
}
private void MarkStoneEmpty(int id)
{
if (id == 0) return;
_stoneKnownCharged.Remove(id);
_stoneKnownEmpty[id] = ReadStoneMana(id);
}
private void MarkStoneCharged(int id)
{
if (id == 0) return;
_stoneKnownEmpty.Remove(id);
_stoneKnownCharged.Add(id);
}
/// <summary>
/// CorpseOpenController calls this when it picks an item up as "ManaTap" (no loot
/// rule matched, it holds enough mana and an empty stone is free): when the pickup
@ -316,7 +406,7 @@ internal sealed class ManaStoneManager
// Priority 2 (was 1): refill worn gear with a charged stone, but only
// when there is nothing to drain right now.
if (WornEquipmentNeedsMana(threshold))
if (WornEquipmentNeedsMana(threshold) && NowMs >= _refillHoldUntil)
{
int chargedStone = FindChargedStone();
if (chargedStone != 0)
@ -326,8 +416,13 @@ internal sealed class ManaStoneManager
IssueUseOnPlayer();
return;
}
long now = NowMs;
if (now - _lastNoStoneDiagAt > 60_000)
{
_lastNoStoneDiagAt = now;
_host.Log($"[RynthAi] ManaStone: worn gear needs mana but no charged stone is known ({_stoneKnownCharged.Count} known charged, {_stoneKnownEmpty.Count} known empty).");
}
}
}
private void IssueTapItem(int stoneId, int itemId)
@ -387,13 +482,13 @@ internal sealed class ManaStoneManager
if (!IsOwnedByPlayer(item, playerId)) continue;
if (_stoneKnownCharged.Contains(item.Id)) continue;
bool readMana = _host.TryGetObjectIntProperty(unchecked((uint)item.Id),
(uint)AcIntProperty.CurrentMana, out int cur);
if (readMana && cur == 0)
int? read = ReadStoneMana(item.Id);
bool knownEmpty = IsKnownEmpty(item.Id, read); // keep in sync with FindEmptyStone
if (knownEmpty || read == 0)
_stoneTapCooldownUntil.Remove(item.Id);
if (_stoneTapCooldownUntil.TryGetValue(item.Id, out long until) && now < until) continue;
if (readMana && cur > 0) continue;
if (!knownEmpty && read > 0) continue;
count++;
}
return count;
@ -608,13 +703,14 @@ internal sealed class ManaStoneManager
// mana") are never empty until they're consumed/destroyed.
if (_stoneKnownCharged.Contains(item.Id)) continue;
bool readMana = _host.TryGetObjectIntProperty(unchecked((uint)item.Id),
(uint)AcIntProperty.CurrentMana, out int curMana);
int? read = ReadStoneMana(item.Id);
// It gave its mana to worn gear: empty, whatever the (older) read says.
bool knownEmpty = IsKnownEmpty(item.Id, read);
// If we can read CurrentMana and it's truly 0, the stone IS empty —
// clear any stale blacklist entry. This makes the cooldown self-heal
// once the cache catches up to the actual state.
if (readMana && curMana == 0)
if (knownEmpty || read == 0)
_stoneTapCooldownUntil.Remove(item.Id);
// Skip stones that recently failed a tap so we don't loop on the
@ -629,8 +725,7 @@ internal sealed class ManaStoneManager
// strict here makes us blind to real empty stones; the stone-tap
// blacklist handles the misfires when an "empty-looking" stone
// is actually charged server-side.
if (_host.TryGetObjectIntProperty(unchecked((uint)item.Id), (uint)AcIntProperty.CurrentMana, out int cur)
&& cur > 0)
if (!knownEmpty && read > 0)
continue;
return item.Id;
@ -648,6 +743,7 @@ internal sealed class ManaStoneManager
int bestId = 0;
int bestMana = 0;
bool requestedId = false;
foreach (var item in _objectCache.AllKnownObjects())
{
@ -661,16 +757,41 @@ internal sealed class ManaStoneManager
// Eternal: always charged (its mana often can't be read), never used up — first choice.
if (IsEternal(item)) return item.Id;
if (!_host.TryGetObjectIntProperty(unchecked((uint)item.Id), (uint)AcIntProperty.CurrentMana, out int cur))
continue;
if (cur <= 0) continue;
int? read = ReadStoneMana(item.Id);
// It already gave its mana; the read is from before that.
if (IsKnownEmpty(item.Id, read)) continue;
if (cur > bestMana) { bestMana = cur; bestId = item.Id; }
int mana;
if (read > 0) mana = read.Value;
else if (_stoneKnownCharged.Contains(item.Id)) mana = 1; // the server said charged; amount unknown
else
{
if (read == null && !requestedId) requestedId = RequestStoneId(item.Id, now);
continue;
}
if (mana > bestMana) { bestMana = mana; bestId = item.Id; }
}
return bestId;
}
/// <summary>
/// Identifies a stone whose charge can't be read (at most every 5 minutes), so a charged one shows
/// its charge. Not when it already has appraisal data: ACE leaves CurrentMana out for an empty
/// stone, so an appraised stone with no readable charge is empty.
/// </summary>
private bool RequestStoneId(int id, long now)
{
if (!_host.HasRequestId) return false;
if (_host.HasHasAppraisalData && _host.HasAppraisalData(unchecked((uint)id))) return false;
if (_stoneIdRequestedAt.TryGetValue(id, out long at) && now - at < StoneIdRetryMs) return false;
_stoneIdRequestedAt[id] = now;
_host.Log($"[RynthAi] ManaStone: identifying stone 0x{(uint)id:X8} (its charge can't be read).");
_host.RequestId(unchecked((uint)id));
return true;
}
/// <summary>
/// The next item to drain. Only items the looter picked up as "ManaTap" are
/// candidates (the drain destroys the item); every check below is a second
@ -813,7 +934,8 @@ internal sealed class ManaStoneManager
{
_lastGearDiagAt = now;
_host.Log($"[RynthAi] ManaStone: gear check - worn={worn} manaReadable={readable} lowest={(readable > 0 ? $"{lowestPct}% ({lowestName})" : "n/a")} " +
$"refillBelow={(int)(pct * 100)}% eternal={eternal} needs={needs} tapping={_settings.EnableManaTapping}");
$"refillBelow={(int)(pct * 100)}% eternal={eternal} needs={needs} tapping={_settings.EnableManaTapping}" +
(now < _refillHoldUntil ? $" hold={(_refillHoldUntil - now) / 1000}s" : ""));
}
return needs;

View file

@ -3415,6 +3415,9 @@ internal sealed class ExpressionEngine
["OffhandDefault"] = (() => s.OffhandDefault, v => { if (OffhandRules.TryParse(v, out var m)) s.OffhandDefault = OffhandRules.SettingValue(m); }),
["PreferDualWield"] = (() => B(s.PreferDualWield), v => s.PreferDualWield = ToDouble(v) != 0),
["MonsterRange"] = (() => I(s.MonsterRange), v => { if (int.TryParse(v, out int i)) s.MonsterRange = i; }),
// Targeting: 0 lowest health, 1 closest, 2 farthest, 3 least turning.
["TargetSelection"] = (() => I(s.TargetSelection), v => { if (int.TryParse(v, out int i)) s.TargetSelection = Math.Clamp(i, 0, 3); }),
["TargetLock"] = (() => B(s.TargetLock), v => s.TargetLock = ToDouble(v) != 0),
["RingRange"] = (() => I(s.RingRange), v => { if (int.TryParse(v, out int i)) s.RingRange = i; }),
["ApproachRange"] = (() => I(s.ApproachRange), v => { if (int.TryParse(v, out int i)) s.ApproachRange = i; }),
["MinRingTargets"] = (() => I(s.MinRingTargets), v => { if (int.TryParse(v, out int i)) s.MinRingTargets = i; }),

View file

@ -14,7 +14,9 @@ public static unsafe class PluginExports
internal static readonly RynthPluginRuntime<RynthAiPlugin> Runtime = new();
// Typed interfaces for other plugins (host GetPluginInterface, API v68): "RynthAi.Script" v1
// for RynthLua, "RynthAi.Status" v1 for RynthNet (the bot state it shares with the other clients). Fixed signature: void* (const char* iface, uint version).
// for RynthLua, "RynthAi.Status" v1 for RynthNet (the bot state it shares with the other clients),
// "RynthAi.Activity" v1 for RynthSort (what the bot is doing, so pack moves stay out of its way).
// Fixed signature: void* (const char* iface, uint version).
[UnmanagedCallersOnly(EntryPoint = "RynthPluginQueryInterface", CallConvs = new[] { typeof(CallConvCdecl) })]
private static IntPtr QueryInterface(IntPtr ifaceAnsi, uint version)
{
@ -22,7 +24,8 @@ public static unsafe class PluginExports
{
string iface = ifaceAnsi == IntPtr.Zero ? "" : Marshal.PtrToStringAnsi(ifaceAnsi) ?? "";
IntPtr table = ScriptInterface.Query(iface, version);
return table != IntPtr.Zero ? table : StatusInterface.Query(iface, version);
if (table == IntPtr.Zero) table = StatusInterface.Query(iface, version);
return table != IntPtr.Zero ? table : ActivityInterface.Query(iface, version);
}
catch
{
@ -38,6 +41,7 @@ public static unsafe class PluginExports
{
Runtime.Shutdown();
StatusInterface.Release();
ActivityInterface.Release();
// The loot editor's state can be a few hundred KB (LootSnobV4): don't leave it behind on a reload.
foreach (IntPtr p in new[] { Interlocked.Exchange(ref _lootStatePtr, IntPtr.Zero),
Interlocked.Exchange(ref _lootRulePtr, IntPtr.Zero), Interlocked.Exchange(ref _lootVocabPtr, IntPtr.Zero) })

View file

@ -1495,6 +1495,7 @@ public sealed partial class RynthAiPlugin
_dashboard.Settings.CurrentLootPath = candidatePath;
ChatLine($"[RynthAi] Loaded loot profile '{System.IO.Path.GetFileName(candidatePath)}' with {profile.Rules.Count} rule(s).");
ReportLootProfileProblems(profile, System.IO.Path.GetFileName(candidatePath));
return true;
}
catch (Exception ex)
@ -1504,6 +1505,42 @@ public sealed partial class RynthAiPlugin
}
}
/// <summary>
/// Reports, in chat and the log, a header rule count that disagrees with the rules
/// found, and names the rules that use condition types RynthAi cannot evaluate. The
/// evaluator treats such a rule as never matching, so the items it was written for
/// stay on corpses with nothing in chat or the log to say why.
/// </summary>
private void ReportLootProfileProblems(VTankLootProfile profile, string fileName)
{
if (profile.DeclaredRuleCount >= 0 && profile.DeclaredRuleCount != profile.Rules.Count)
{
string countMessage = $"[RynthAi] Loot profile '{fileName}': header declares {profile.DeclaredRuleCount} rule(s) " +
$"but the file holds {profile.Rules.Count}; all {profile.Rules.Count} are in use. " +
"Re-save the profile in the loot editor to correct the header.";
ChatLine(countMessage);
Host.Log(countMessage);
}
var bad = new List<string>();
foreach (VTankLootRule rule in profile.Rules)
{
var types = rule.Conditions
.Select(c => c.NodeType)
.Where(t => VTankNodeTypes.GetDataLineCount(t) < 0)
.Distinct()
.ToList();
if (types.Count > 0)
bad.Add($"'{rule.Name.Trim()}' (type {string.Join("/", types)})");
}
if (bad.Count == 0) return;
string message = $"[RynthAi] Loot profile '{fileName}': {bad.Count} rule(s) use condition types " +
$"RynthAi does not support and will never match: {string.Join(", ", bad)}.";
ChatLine(message);
Host.Log(message);
}
// ── Loot Editor (engine ImGui panel) ────────────────────────────────────
private LootEditorBridge? _lootEditor;
@ -2772,6 +2809,25 @@ public sealed partial class RynthAiPlugin
/// after a new hazard was sighted mid-patrol — it reroutes silently (no fresh
/// "patrol started" chatter, just a one-line note) and never flips IsMacroRunning.
/// </summary>
// One log line per patrol waypoint and a summary (diagnostics: which rule put each point
// where it is, e.g. the patrol walking into small rooms it should only look into).
private void LogPatrolWaypoints(NavRouteParser route, Dictionary<uint, DungeonNavNode> graph, DungeonGeometry? geometry,
IReadOnlySet<uint>? hazards, Dictionary<NavPoint, DungeonPathfinder.PatrolPointInfo> pointLog,
uint playerCell, uint startCell)
{
try
{
Host.Log($"[RynthAi] DunNav-Patrol wp build: player cell {playerCell:X8}, start cell {startCell:X8}, {route.Points.Count} points, geometry {(geometry != null ? "on" : "off")}"
+ (hazards is { Count: > 0 } ? $", hazards {string.Join(",", hazards.Where(c => c >> 16 == startCell >> 16).OrderBy(c => c).Select(c => (c & 0xFFFF).ToString("X4")))}" : ""));
foreach (string line in DungeonPathfinder.DescribePatrol(route, graph, geometry, hazards, pointLog))
Host.Log("[RynthAi] DunNav-Patrol " + line);
}
catch (Exception ex)
{
Host.Log($"[RynthAi] DunNav-Patrol wp log failed: {ex.Message}");
}
}
private void BuildDunPatrol(bool isRebuild)
{
var settings = _dashboard?.Settings;
@ -2857,11 +2913,21 @@ public sealed partial class RynthAiPlugin
// The dungeon map geometry (doorways, floors, walls): doorways taken straight on and
// big rooms crossed directly. Null (old cell walk) until DungeonLOS is up.
var geometry = DungeonPathfinder.GetGeometry(landblockKey, cellDat, _raycast?.GeometryLoader?.DungeonLOS);
var route = DungeonPathfinder.BuildPatrolRoute(graph, startCell, hazards, geometry);
// Diagnostics: record which rule laid each waypoint (logged below, one line each).
var pointLog = new Dictionary<NavPoint, DungeonPathfinder.PatrolPointInfo>(ReferenceEqualityComparer.Instance);
DungeonPathfinder.PointLog = pointLog;
NavRouteParser route;
try { route = DungeonPathfinder.BuildPatrolRoute(graph, startCell, hazards, geometry); }
finally { DungeonPathfinder.PointLog = null; }
// Lead the bot out of the hazard first.
if (evacuate)
route.Points.Insert(0, new NavPoint { Type = NavPointType.Point, NS = evacNS, EW = evacEW, Z = evacZ });
{
var lead = new NavPoint { Type = NavPointType.Point, NS = evacNS, EW = evacEW, Z = evacZ };
route.Points.Insert(0, lead);
pointLog[lead] = new DungeonPathfinder.PatrolPointInfo { Kind = "evacuate", Cell = startCell, Why = "start cell is a hazard" };
}
LogPatrolWaypoints(route, graph, geometry, hazards, pointLog, playerCell, startCell);
// Empty-route guard: a single-cell / hazard-locked start yields no waypoints. Do NOT claim the
// patrol started or enable nav — the bot would just stand in place (in the hazard) taking damage.

View file

@ -15,8 +15,9 @@ namespace RynthCore.Plugin.RynthAi;
/// looting, the route, the meta: OnTick returns here, like the death hold) and walks the character
/// back out along its own footsteps (the positions it just came through, so a path it could walk)
/// to where it stood just before the hit. It hands back once it got there and no hit came
/// for HazardQuietMs. A dungeon cell it was hurt in is a hazard from then on (persisted), so the
/// patrol reroutes around it now and on later visits.
/// for HazardQuietMs. The cell it was hurt in is NOT made a patrol hazard: from 2026-10-07 it was
/// (persisted, patrol rerouted around it), and the reroutes sent the patrol through doors into small
/// side rooms (2026-10-10). The patrol is back to how it was before; the escape alone stays.
/// </summary>
public sealed partial class RynthAiPlugin
{
@ -59,6 +60,8 @@ public sealed partial class RynthAiPlugin
private bool _hazardRunning;
private long _hazardRunBeatAt;
private string _hazardSource = "";
/// <summary>Cells hurt in this session: the escape steers its target out of them. Not patrol hazards.</summary>
private readonly System.Collections.Generic.HashSet<uint> _hazardHurtCells = new();
/// <summary>True while the escape owns the character.</summary>
internal bool HazardEscaping => _hazardEscapeSince != 0;
@ -79,17 +82,15 @@ public sealed partial class RynthAiPlugin
internal void NoteHotspotChat(string? text, int chatType)
{
if (chatType != 0 || !TryParseHotspotDamage(text, out int amount, out string source)) return;
// Off (Escape Acid and Lava): neither the escape nor the learning - a character that walks
// through acid on purpose doesn't want the patrol rerouted around it either.
// Off (Escape Acid and Lava): no escape.
if (_dashboard?.Settings is { EscapeHazards: false }) return;
long now = HazardClock();
bool fresh = _hazardLastHitAt == 0 || now - _hazardLastHitAt > HazardQuietMs;
if (fresh) _hazardFirstHitAt = now;
_hazardLastHitAt = now;
_hazardSource = source;
if (Host.TryGetPlayerPose(out uint cell, out _, out _, out _, out _, out _, out _, out _))
_objectCache?.RegisterDamageHazardCell(cell, source);
if (Host.TryGetPlayerPose(out uint cell, out _, out _, out _, out _, out _, out _, out _) && cell != 0)
_hazardHurtCells.Add(cell);
if (_dashboard?.Settings is not { IsMacroRunning: true }) return;
if (!HazardEscaping)
@ -155,7 +156,7 @@ public sealed partial class RynthAiPlugin
if (p.At >= olderThan || (p.Cell >> 16) != (cell >> 16)) continue;
double d = Math.Sqrt((p.X - px) * (p.X - px) + (p.Y - py) * (p.Y - py));
if (d < HazardMinBackMeters) continue;
if (_objectCache?.IsHazardCell(p.Cell) == true)
if (_objectCache?.IsHazardCell(p.Cell) == true || _hazardHurtCells.Contains(p.Cell))
{
if (fallback < 0) fallback = i;
continue;

View file

@ -152,7 +152,34 @@ public sealed partial class RynthAiPlugin
private void PrintItemInfo(uint id, bool identified)
{
var source = new HostItemInfoSource(Host, id);
ChatLine(ItemPrefix + ItemInfoText.Describe(source, SpellDatabase.GetSpellName, identified));
ChatLine(ItemPrefix + ItemInfoText.Describe(source, SpellDatabase.GetSpellName, identified) + LootVerdictSuffix(id));
}
/// <summary>
/// " | Loot: [Keep] (A) MajorSkill Set": the looter's own verdict on the item, as a preview
/// (nothing recorded), so it says exactly what [LootEval] would. Item info on select replaced
/// the separate verdict line (95df8ed), which was the only place it showed (Tom, 2026-10-10:
/// lots of Major armor kept and no way to tell which rule). "" when there's no loot profile,
/// or /ra lootcheck off (the toggle that hid the old verdict line too).
/// </summary>
private string LootVerdictSuffix(uint id)
{
try
{
LegacyUi.LegacyUiSettings? settings = _dashboard?.Settings;
WorldObject? wo = _objectCache?[unchecked((int)id)];
if (!_lootInspectMode || settings == null || wo == null || string.IsNullOrEmpty(settings.CurrentLootPath)) return "";
if (!ClassifyLootItem(wo, settings, preview: true, out string action, out _, out string rule, out string builtIn))
// A rule can match and still not take it (its Keep # reached, a Read rule on a non-scroll).
return rule.Length > 0 ? $" | Loot: leave ({rule} matched, not taken)" : " | Loot: no rule matched";
if (builtIn.Length > 0) return $" | Loot: [{action}] built-in - {builtIn}";
return $" | Loot: [{action}] {(rule.Length > 0 ? rule : "(unnamed rule)")}";
}
catch (Exception ex)
{
Host.Log($"[RynthAi] Item info: loot verdict failed for 0x{id:X8}: {ex.GetType().Name}: {ex.Message}");
return "";
}
}
/// <summary>The live appraisal through the host (tick thread).</summary>

View file

@ -887,7 +887,7 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
["SpellCastIntervalMs"] = (100, 1500), ["AttackSpellIntervalMs"] = (0, 5000), ["MinRingTargets"] = (1, 20), ["MinBlastTargets"] = (1, 20), ["BlastRange"] = (0, 100), ["MinWallTargets"] = (1, 20), ["WallRange"] = (0, 100),
["MinSkillLevelTier1"] = (1, 500), ["MinSkillLevelTier2"] = (1, 500), ["MinSkillLevelTier3"] = (1, 500), ["MinSkillLevelTier4"] = (1, 500),
["MinSkillLevelTier5"] = (1, 500), ["MinSkillLevelTier6"] = (1, 500), ["MinSkillLevelTier7"] = (1, 500), ["MinSkillLevelTier8"] = (1, 500),
["MonsterRange"] = (1, 200), ["MonsterDisengageRange"] = (0, 200), ["RingRange"] = (1, 50), ["ApproachRange"] = (1, 50),
["MonsterRange"] = (1, 200), ["MonsterDisengageRange"] = (0, 200), ["TargetSelection"] = (0, 3), ["RingRange"] = (1, 50), ["ApproachRange"] = (1, 50),
["CorpseApproachRangeMax"] = (0.5, 50), ["CorpseApproachRangeMin"] = (0.5, 20),
["FollowNavMin"] = (0.5, 20), ["NavRingThickness"] = (1, 16), ["NavLineThickness"] = (1, 16),
["NavHeightOffset"] = (-5, 5), ["NavSlopeSink"] = (0, 8), ["NavLabelMode"] = (0, 2), ["OpenDoorRange"] = (0.1, 70), ["MovementMode"] = (0, 0),

View file

@ -33,6 +33,8 @@
<Compile Include="..\Shared\RynthAiScriptApi.cs" Link="Shared\RynthAiScriptApi.cs" />
<!-- RynthNet reads the bot state through RynthAi.Status. -->
<Compile Include="..\Shared\RynthAiStatusApi.cs" Link="Shared\RynthAiStatusApi.cs" />
<!-- RynthSort reads what the bot is doing through RynthAi.Activity (read only). -->
<Compile Include="..\Shared\RynthAiActivityApi.cs" Link="Shared\RynthAiActivityApi.cs" />
<!-- RynthNav's navmesh path queries (stuck-recovery detours outdoors). -->
<Compile Include="..\Shared\RynthNavPathApi.cs" Link="Shared\RynthNavPathApi.cs" />
<!-- Reading our hits out of the combat log (victim + amount); RynthTracker reads the same lines. -->