RynthSuite as of 2026-11-05 (internal a77109a): release 2026.11.3.2

This commit is contained in:
Tom Bohar 2026-11-05 07:42:37 -05:00
commit 7166d256ce
62 changed files with 330 additions and 17 deletions

View file

@ -211,6 +211,14 @@ internal sealed class HudController
_combat.OnLogout();
}
/// <summary>
/// What the character carries, from a walk of the client's own pack contents (the loot step's
/// Keep # count reads the same). The cache's inventory set, kept up from object events, drifts over
/// a long session: after 10+ hours of macro the HUD showed 1 healing kit of 4 and 4 mana stones of
/// 6 (report R-20261103-125252-251c, 2026-11-03).
/// </summary>
private static IEnumerable<WorldObject> Carried(WorldObjectCache cache) => cache.GetDirectInventory();
/// <summary>Aggregates the pack by item name and refreshes pinned entries' icon / WCID.</summary>
private void RebuildPack()
{
@ -219,7 +227,7 @@ internal sealed class HudController
var byName = new Dictionary<string, HudPackRow>(StringComparer.OrdinalIgnoreCase);
var seen = new HashSet<int>();
foreach (var wo in cache.GetInventory())
foreach (var wo in Carried(cache))
{
if (wo == null || string.IsNullOrWhiteSpace(wo.Name)) continue;
seen.Add(wo.Id);
@ -270,7 +278,7 @@ internal sealed class HudController
if (entry.IsEmpty) return;
var cache = _cache();
if (cache == null || !_host.HasUseObject) return;
var inv = cache.GetInventory().Where(w => w != null).ToList();
var inv = Carried(cache).Where(w => w != null).ToList();
var wo = inv.FirstOrDefault(w => w.Name.Equals(entry.Name, StringComparison.OrdinalIgnoreCase))
?? (entry.Wcid != 0 ? inv.FirstOrDefault(w => Wcid(w) == entry.Wcid) : null);
if (wo == null) { Chat($"[RynthAi] No {entry.Name} in your pack."); return; }
@ -280,7 +288,7 @@ internal sealed class HudController
/// <summary>Carried item by object id, or null.</summary>
private WorldObject? PackItem(int id)
=> id == 0 ? null : _cache()?.GetInventory().FirstOrDefault(w => w != null && w.Id == id);
=> id == 0 || _cache() is not WorldObjectCache cache ? null : Carried(cache).FirstOrDefault(w => w != null && w.Id == id);
/// <summary>
/// Remembers the last pack item selected in the game (native inventory, or the RynthCore

View file

@ -333,10 +333,15 @@ internal sealed class LegacyAdvancedSettingsUi
ImGui.Separator();
ImGui.Spacing();
ImGui.Checkbox("Auto Cram", ref _settings.EnableAutocram);
if (ImGui.IsItemHovered())
ImGui.BeginDisabled(_settings.AutoSortOn);
bool cramShown = _settings.EnableAutocram && !_settings.AutoSortOn;
if (ImGui.Checkbox("Auto Cram", ref cramShown)) _settings.EnableAutocram = cramShown;
ImGui.EndDisabled();
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
{
ImGui.SetTooltip("Automatically moves items from your main pack into side packs.\nNote: recently used weapons stay in the main pack.");
ImGui.SetTooltip(_settings.AutoSortOn
? "Off while RynthSort's auto-sort is on: RynthSort keeps your packs sorted, and the two fight."
: "Automatically moves items from your main pack into side packs.\nNote: recently used weapons stay in the main pack.");
}
ImGui.Spacing();
@ -1142,7 +1147,12 @@ internal sealed class LegacyAdvancedSettingsUi
ImGui.Spacing();
ImGui.Text("Inventory Management");
ImGui.Checkbox("Enable Autostack", ref _settings.EnableAutostack);
ImGui.Checkbox("Enable Autocram", ref _settings.EnableAutocram);
ImGui.BeginDisabled(_settings.AutoSortOn);
bool cramShown2 = _settings.EnableAutocram && !_settings.AutoSortOn;
if (ImGui.Checkbox("Enable Autocram", ref cramShown2)) _settings.EnableAutocram = cramShown2;
ImGui.EndDisabled();
if (_settings.AutoSortOn && ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
ImGui.SetTooltip("Off while RynthSort's auto-sort is on: RynthSort keeps your packs sorted, and the two fight.");
ImGui.Checkbox("Combine Salvage Bags", ref _settings.EnableCombineSalvage);
if (ImGui.IsItemHovered())
ImGui.SetTooltip("After the salvage queue empties, move same-name bags together so the server merges them.");

View file

@ -91,6 +91,15 @@ internal sealed partial class LegacyDashboardRenderer
// ── Per-character settings persistence ───────────────────────────────────
private string _charFolder = string.Empty;
private string _settingsFilePath = string.Empty;
// The character's profile is in memory (LoadSettings finished; cleared at logout). Until then the
// settings here are the built-in defaults, and they must never reach the engine or be taken back
// from it: after an engine hot reload the engine read them, and the next click in its dashboard
// sent the whole default copy back, which was applied and saved over the profile (2026-11-05, and
// the same way raycasting kept turning off).
private volatile bool _profileLoaded;
/// <summary>The character's profile is loaded: settings may be read and changed from outside.</summary>
public bool ProfileLoaded => _profileLoaded;
private string _lastSavedJson = string.Empty;
private Vector2 _expandedSize = new(430, 452);
@ -505,6 +514,7 @@ internal sealed partial class LegacyDashboardRenderer
try { CaptureTransientUiState(); _lastSavedJson = JsonSerializer.Serialize(_settings, RynthAiJsonContext.Default.LegacyUiSettings); }
catch { _lastSavedJson = string.Empty; }
}
_profileLoaded = true;
}
/// <summary>
@ -515,6 +525,7 @@ internal sealed partial class LegacyDashboardRenderer
/// </summary>
public void ResetCharacterSession()
{
_profileLoaded = false;
_charFolder = string.Empty;
_settingsFilePath = string.Empty;
_lastSavedJson = string.Empty;
@ -613,6 +624,7 @@ internal sealed partial class LegacyDashboardRenderer
// DXVK change, the launcher's stuck-client kill) left a cut-off file that then loaded
// as defaults.
string tmp = path + "." + Environment.ProcessId + ".tmp";
KeepDailyCopy(path);
try
{
File.WriteAllText(tmp, json);
@ -628,6 +640,31 @@ internal sealed partial class LegacyDashboardRenderer
/// <summary>The last good profile kept by each save (profile path + this).</summary>
internal const string BackupSuffix = ".bak";
/// <summary>Daily copies kept of each profile (profile path + ".yyyy-MM-dd.bak").</summary>
internal const int DailyCopiesKept = 7;
/// <summary>
/// The first save of a day keeps the profile as it was (Default.json.2026-11-05.bak), the last
/// <see cref="DailyCopiesKept"/> days kept: .bak alone is the save before, so a reset that was saved
/// twice left nothing to go back to (2026-11-05). Best effort: a copy that fails never stops the save.
/// </summary>
internal static void KeepDailyCopy(string path)
{
try
{
if (!File.Exists(path)) return;
string today = path + "." + RynthClock.Now.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture) + BackupSuffix;
if (File.Exists(today)) return;
File.Copy(path, today);
string dir = Path.GetDirectoryName(path)!, name = Path.GetFileName(path);
var old = Directory.GetFiles(dir, name + ".????-??-??" + BackupSuffix);
Array.Sort(old, StringComparer.Ordinal);
for (int i = 0; i < old.Length - DailyCopiesKept; i++)
try { File.Delete(old[i]); } catch { }
}
catch { }
}
/// <summary>Reads and parses a settings profile; false (with the reason) when it's missing or doesn't parse.</summary>
private static bool TryReadProfile(string path, out LegacyUiSettings? settings, out string json, out string error)
{
@ -1234,6 +1271,7 @@ internal sealed partial class LegacyDashboardRenderer
TargetFPSFocused = s.TargetFPSFocused,
TargetFPSBackground = s.TargetFPSBackground,
EnableAutocram = s.EnableAutocram,
AutoSortOn = s.AutoSortOn,
PeaceModeWhenIdle = s.PeaceModeWhenIdle,
RearmAfterVitals = s.RearmAfterVitals,
StartMacroOnLogin = s.StartMacroOnLogin,
@ -1465,6 +1503,13 @@ internal sealed partial class LegacyDashboardRenderer
public void ApplySettingsJson(string json)
{
if (string.IsNullOrWhiteSpace(json)) return;
if (!_profileLoaded)
{
// Nothing from outside lands on the defaults held before the profile loads (they'd be saved
// over it once it does): the engine's copy then can only be the defaults it read.
try { _host.Log("[RynthAi] Settings: a settings change from the engine came before this character's profile loaded; ignored."); } catch { }
return;
}
try
{
// Lay the sent fields over the current settings, so a field the sender leaves

View file

@ -19,6 +19,11 @@ public sealed class LegacyUiSettings
{
// ── Runtime-only state — never persisted ────────────────────────────────
[JsonIgnore] public bool IsMacroRunning;
/// <summary>
/// RynthSort's auto-sort is on (read from RynthSort every couple of seconds): Auto Cram stands down and
/// its checkboxes are greyed out, as the two fought over the packs (owner, 2026-11-03). Never saved.
/// </summary>
[JsonIgnore] public bool AutoSortOn;
/// <summary>Meta state — set only by meta actions (SetState, CallState, ReturnFromCall, UI, meta load).</summary>
[JsonIgnore] public string CurrentState = "Default";
/// <summary>Bot action state — what the bot is doing right now (Default, Combat, Looting, Navigating, Buffing).
@ -1172,6 +1177,8 @@ public sealed class SettingsBridgePayload
public int TargetFPSFocused { get; set; }
public int TargetFPSBackground { get; set; }
public bool EnableAutocram { get; set; }
/// <summary>RynthSort's auto-sort is on: the engine greys out Auto Cram (sent, never read back).</summary>
public bool AutoSortOn { get; set; }
public bool PeaceModeWhenIdle { get; set; }
// Optional: an engine without the row doesn't send it, and that must not turn it off.
public bool? RearmAfterVitals { get; set; }
@ -1190,7 +1197,7 @@ public sealed class SettingsBridgePayload
public float? OutdoorHuntRadius { get; set; }
// Absent from an older engine's payload: must not read as off.
public bool YieldToVTank { get; set; } = true;
public bool EnableRaycasting { get; set; }
public bool EnableRaycasting { get; set; } = true; // on unless the player turns it off (2026-11-05)
public bool UseArcs { get; set; }
public float BowArcVelocity { get; set; }
public float CrossbowArcVelocity { get; set; }

View file

@ -134,7 +134,9 @@ public sealed class InventoryManager
private bool ProcessAutoCram(List<WorldObject> inv, int playerId)
{
if (!_settings.EnableAutocram && !ManualCram) return false;
// RynthSort's auto-sort on: it owns the packs, and Auto Cram moving items back out of the main pack
// fought it (owner, 2026-11-03). A cram asked for by hand (/ra cram) still runs.
if ((!_settings.EnableAutocram || _settings.AutoSortOn) && !ManualCram) return false;
int crammable = 0;
foreach (var item in inv)

View file

@ -683,7 +683,11 @@ public static unsafe class PluginExports
{
try
{
string json = Runtime.Plugin?.DashboardRenderer?.BuildSettingsJson() ?? "{}";
// Nothing until the character's profile is loaded (not "{}": the engine read that as a full
// settings copy of its own defaults, and its next save wrote them over the profile, 2026-11-05).
var renderer = Runtime.Plugin?.DashboardRenderer;
if (renderer == null || !renderer.ProfileLoaded) return IntPtr.Zero;
string json = renderer.BuildSettingsJson();
IntPtr newPtr = Marshal.StringToHGlobalAnsi(json);
IntPtr oldPtr = Interlocked.Exchange(ref _settingsPtr, newPtr);
if (oldPtr != IntPtr.Zero)

View file

@ -105,10 +105,12 @@ public sealed partial class RynthAiPlugin
_dashboard?.RefreshDashboardVitals();
_dashFight = ReadFightTarget(_dashFight);
}
if (shown && now >= _nextDashSortMs)
if (now >= _nextDashSortMs)
{
_nextDashSortMs = now + 500;
// Twice a second for the dashboard's key; every 2 s otherwise, for Auto Cram (AutoSortOn).
_nextDashSortMs = now + (shown ? 500 : 2000);
_dashSort = ReadAutoSort();
if (_dashboard?.Settings is { } sortSettings) sortSettings.AutoSortOn = _dashSort == 1;
}
if (now >= _nextDashClassicMs)
{

View file

@ -459,9 +459,14 @@ internal static class AutoVendorPlanner
if (chosen.Count < 1)
{
int newStack = unit > 0 ? (int)Math.Floor((p.FreeMainSlots - 2) * (double)Math.Max(1, p.PyrealStackSize) / unit) : 0;
// A partial sold whole frees its own slot for the pyreals, so it may be one slot's worth
// bigger than a split: the stack a split just made took a slot, and judged against the
// split's own margin it no longer fitted, was merged back, and the split came again
// until the 8-try stop left the last stack of peas unsold (2026-11-05).
int sellWholeUpTo = unit > 0 ? (int)Math.Floor((p.FreeMainSlots - 1) * (double)Math.Max(1, p.PyrealStackSize) / unit) : 0;
newStack = Math.Min(newStack, stack - 1);
if (newStack > 0)
return SplitClean(v, sells, item, newStack, "the pyreals for the whole stack won't fit");
return SplitClean(v, sells, item, newStack, "the pyreals for the whole stack won't fit", sellWholeUpTo);
return VendorPlan.Fatal($"AutoVendor Fatal - No inventory room to sell {item.Name}");
}
break;
@ -535,7 +540,10 @@ internal static class AutoVendorPlanner
/// fits, else split from it (nothing else partial for the new stack to join); with none, split as
/// asked. An unknown max stack size keeps the old plain split.
/// </summary>
internal static VendorPlan SplitClean(VendorView v, IReadOnlyList<SellItem> sells, SellItem item, int amount, string why)
/// <param name="sellWholeUpTo">The biggest partial that can be sold whole (its own slot counted free; at
/// least <paramref name="amount"/>), else <paramref name="amount"/>.</param>
internal static VendorPlan SplitClean(VendorView v, IReadOnlyList<SellItem> sells, SellItem item, int amount, string why,
int sellWholeUpTo = -1)
{
if (item.MaxStack <= 1)
return VendorPlan.Split(item, amount, why);
@ -547,7 +555,8 @@ internal static class AutoVendorPlanner
// A partial that fits is sold whole first: the stack a split just made, or any leftover. (Merging
// it back instead looped split-merge-split three times a second, 2026-10-19.)
SellItem? fits = partials.FirstOrDefault(s => s.StackSize <= amount);
int wholeUpTo = Math.Max(amount, sellWholeUpTo);
SellItem? fits = partials.FirstOrDefault(s => s.StackSize <= wholeUpTo);
if (fits != null)
return new VendorPlan { Kind = PlanKind.Sell, Sells = new List<SellItem> { fits }, Total = VendorPays(v, fits.IsNote, fits.Value) };

View file

@ -36,7 +36,7 @@ internal sealed class SlopeOverlay
public void Submit(TickContext ctx)
{
if (!_settings.ShowUnclimbableSlopes || ctx.Terrain == null || !ctx.OnLandscape)
if (!_settings.ShowUnclimbableSlopes || ctx.Terrain == null || !ctx.OnLandscape || ctx.Indoors)
return;
if (!_host.HasNav3DTriangle) // requires API v60+
return;

View file

@ -23,6 +23,12 @@ internal sealed class TickContext
/// </summary>
public bool OnLandscape;
/// <summary>
/// True inside a building or dungeon cell (EnvCell). The terrain under a building runs
/// through its floors, so the slope and water overlays stay off there.
/// </summary>
public bool Indoors => (CellId & 0xFFFF) >= 0x100;
/// <summary>The terrain around the player, or null while terrain data isn't loaded.</summary>
public LandblockWindow? Terrain;

View file

@ -61,7 +61,7 @@ internal sealed class WaterOverlay
public void Submit(TickContext ctx)
{
if (!_settings.ShowImpassableWater || ctx.Terrain == null || !ctx.OnLandscape)
if (!_settings.ShowImpassableWater || ctx.Terrain == null || !ctx.OnLandscape || ctx.Indoors)
return;
if (!_host.HasNav3DTriangle) // requires API v60+
return;