Snapshot for release 2026.10.19.1 (internal f0bdcf8)

This commit is contained in:
Tom Bohar 2026-10-19 09:11:22 -04:00
commit 39de36d3af
131 changed files with 11266 additions and 520 deletions

View file

@ -17,6 +17,11 @@
// refresh doesn't, so it has its own (client-side) spacing.
// Balance lines are parsed whenever they appear (player-typed /bank too) but only EATEN
// when the Hub asked. Transfers always need a confirmation (UB had none).
// Backstop (SilentKelpie's PR 12, narrowed): the capture queue eats a quiet refresh's reply, but if
// it misses, balance-dump lines arriving within QuietBalanceWindowMs of a quiet refresh are eaten
// here. Only the dump itself (header and "Label: N" lines): other [BANK] lines (errors, bound-coin
// notes), Transferred / Received lines, and balance reads nobody here asked for (a macro's or another
// plugin's /bank, outside the window) are left alone.
using System;
using System.Collections.Generic;
using System.Linq;
@ -57,6 +62,10 @@ internal sealed class IltBanking : IIltFeature
private long _moveUntil;
/// <summary>How long after a deposit / withdrawal reply the moved amounts are not income (covers the balance re-read).</summary>
private const long MoveWindowMs = 12_000;
/// <summary>Until this tick, a balance dump that reaches chat is the reply to a quiet Hub refresh (0 = no quiet refresh out).</summary>
private long _quietBalanceUntil;
/// <summary>How long after a quiet refresh is queued its leaked dump lines are still eaten here.</summary>
internal const long QuietBalanceWindowMs = 15_000;
// Render-thread form state.
private string _amountText = string.Empty;
@ -124,6 +133,7 @@ internal sealed class IltBanking : IIltFeature
long now = IltHubContext.NowMs;
if (now - _lastBalanceAt < BalanceSpacingMs) return;
_lastBalanceAt = now;
_quietBalanceUntil = quiet ? now + QuietBalanceWindowMs : 0;
_ctx.Capture.Enqueue(new IltChatRequest
{
Command = "/bank",
@ -293,8 +303,9 @@ internal sealed class IltBanking : IIltFeature
{
if (text.StartsWith("[BANK]", StringComparison.OrdinalIgnoreCase))
{
ParseBalanceLine(text);
return false; // eating is decided by the capture queue
bool dump = ParseBalanceLine(text);
// Eating is decided by the capture queue; this only backs it up for a quiet refresh's dump.
return EatLeakedDump(dump, IltHubContext.NowMs, _quietBalanceUntil);
}
// A deposit or withdrawal reply (ours or a typed /b): the next balance and pack changes are moves.
if (text.StartsWith("Deposited ", StringComparison.Ordinal) || text.StartsWith("Withdrew ", StringComparison.Ordinal))
@ -310,27 +321,67 @@ internal sealed class IltBanking : IIltFeature
// ── Parsing ─────────────────────────────────────────────────────────────
private void ParseBalanceLine(string text)
/// <summary>
/// True when a quiet refresh's dump line that reached chat should be eaten here: it is a balance
/// line (see <see cref="ParseBalanceLine"/>) and a quiet refresh was queued within the window.
/// </summary>
internal static bool EatLeakedDump(bool isBalanceLine, long nowMs, long quietUntilMs)
=> isBalanceLine && quietUntilMs != 0 && nowMs < quietUntilMs;
/// <summary>The balance key a dump label belongs to ("Weakly Enlightened Coins" -> WeaklyEnlightenedCoins), or null.</summary>
internal static string? BalanceKeyFor(string label)
{
// Order matters: "Weakly Enlightened Coins" also contains "Enlightened Coins".
if (label.Contains("Prestige", StringComparison.OrdinalIgnoreCase)) return "PrestigeCoins";
if (label.Contains("Weakly", StringComparison.OrdinalIgnoreCase)) return "WeaklyEnlightenedCoins";
if (label.Contains("Enlightened", StringComparison.OrdinalIgnoreCase)) return "EnlightenedCoins";
if (label.Contains("Mythical", StringComparison.OrdinalIgnoreCase)) return "MythicalKeys";
if (label.Contains("Legendary", StringComparison.OrdinalIgnoreCase)) return "LegendaryKeys";
if (label.Contains("Luminance", StringComparison.OrdinalIgnoreCase)) return "Luminance";
if (label.Contains("Pyreal", StringComparison.OrdinalIgnoreCase)) return "Pyreals";
return null;
}
/// <summary>
/// True when a "[BANK] ..." line is part of the /bank balance dump: the "Your balances are:" header
/// or a "Label: N" line for a known currency. Errors, the bound-coin note and the like are not.
/// </summary>
internal static bool IsBalanceDumpLine(string text)
{
if (!text.StartsWith("[BANK]", StringComparison.OrdinalIgnoreCase)) return false;
string body = text.Substring("[BANK]".Length).Trim();
if (body.StartsWith("Your balances", StringComparison.OrdinalIgnoreCase)) return true;
int colon = body.IndexOf(':');
if (colon <= 0) return false;
if (body.Substring(colon + 1).Trim().Length == 0) return true; // a header ending in a colon
return BalanceKeyFor(body.Substring(0, colon).Trim()) != null;
}
/// <summary>Reads a "[BANK] ..." line into the balances. Returns <see cref="IsBalanceDumpLine"/>.</summary>
private bool ParseBalanceLine(string text)
{
if (!IsBalanceDumpLine(text)) return false;
string body = text.Substring("[BANK]".Length).Trim();
int colon = body.IndexOf(':');
if (colon <= 0) return;
if (colon <= 0 || body.Substring(colon + 1).Trim().Length == 0) return true; // a header: nothing to read
string label = body.Substring(0, colon).Trim();
long value = IltParse.ParseLeadingLong(body.Substring(colon + 1));
if (body.Substring(colon + 1).Trim().Length == 0) return; // header "Your balances are:"
// Order matters: "Weakly Enlightened Coins" also contains "Enlightened Coins".
if (label.Contains("Prestige", StringComparison.OrdinalIgnoreCase)) Apply("PrestigeCoins", ref Bank.PrestigeCoins, value);
else if (label.Contains("Weakly", StringComparison.OrdinalIgnoreCase)) Apply("WeaklyEnlightenedCoins", ref Bank.WeaklyEnlightenedCoins, value);
else if (label.Contains("Enlightened", StringComparison.OrdinalIgnoreCase)) Apply("EnlightenedCoins", ref Bank.EnlightenedCoins, value);
else if (label.Contains("Mythical", StringComparison.OrdinalIgnoreCase)) Apply("MythicalKeys", ref Bank.MythicalKeys, value);
else if (label.Contains("Legendary", StringComparison.OrdinalIgnoreCase)) Apply("LegendaryKeys", ref Bank.LegendaryKeys, value);
else if (label.Contains("Luminance", StringComparison.OrdinalIgnoreCase)) Apply("Luminance", ref Bank.Luminance, value);
else if (label.Contains("Pyreal", StringComparison.OrdinalIgnoreCase)) Apply("Pyreals", ref Bank.Pyreals, value);
else return;
switch (BalanceKeyFor(label))
{
case "PrestigeCoins": Apply("PrestigeCoins", ref Bank.PrestigeCoins, value); break;
case "WeaklyEnlightenedCoins": Apply("WeaklyEnlightenedCoins", ref Bank.WeaklyEnlightenedCoins, value); break;
case "EnlightenedCoins": Apply("EnlightenedCoins", ref Bank.EnlightenedCoins, value); break;
case "MythicalKeys": Apply("MythicalKeys", ref Bank.MythicalKeys, value); break;
case "LegendaryKeys": Apply("LegendaryKeys", ref Bank.LegendaryKeys, value); break;
case "Luminance": Apply("Luminance", ref Bank.Luminance, value); break;
case "Pyreals": Apply("Pyreals", ref Bank.Pyreals, value); break;
default: return false;
}
Bank.LastUpdated = DateTime.Now;
_ctx.Options.Set(IltFeature.Bank, IltTri.On);
return true;
}
private void Apply(string key, ref long field, long value)

View file

@ -1,19 +1,34 @@
// IltChunkClap.cs — Lugian-hammer chunking and /clap automation (Gear tab).
// Originally SilentKelpie's ILT Hub (RynthAi IltHub/); moved to RynthILT 2026-10-13.
//
// Chunk: uses the Lugian Aetheria Hammer on eligible items, one at a time:
// Chunk: uses the Lugian Aetheria Hammer on eligible items, one at a time. The rules follow ub-IT
// (Leaftide AetheriaChunkGuard / IsValidCorruptedWep / CorruptedChunkGuard):
// Aetheria — "Aetheria"/"Coalesced Aetheria" gems, not equipped, appraised, not flagged
// never-chunk (bool 9030), never levelled (ItemTotalXp quad 4 == 0), no kept
// C / CD / CDR rating (gear ints 372 / 374 / 375; on by default), and max level
// (int 319, up to 10 on ILT) under the configured cap (Coalesced always qualifies).
// Corrupted — "Corrupted" melee/missile weapons with no tinks (171), no imbue (179),
// not equipped, not never-chunk, cleave (292) <= 1.
// Peace mode only unless ChunkInCombat; waits for the result line (10 s max).
// never-chunk (bool 9030), not tinkered (171) or imbued (179), never levelled
// (ItemTotalXp quad 4 == 0), no kept C / CD / CDR rating (gear ints 372 / 374 / 375;
// on by default; only a rating at or above the "rating level" keeps, a lower one
// chunks), and max level (int 319, up to 10 on ILT) under the configured cap.
// A levelled Coalesced piece gets the cap too; an unlevelled one (319 = 0 after
// appraisal, normal for Coalesced) is chunkable, as in ub-IT. RynthILT used to keep
// every unlevelled Coalesced piece forever.
// Corrupted — "Corrupted" melee/missile weapons, not equipped, not never-chunk, no tinks (171),
// no imbue (179), loot-gen workmanship (105) > 0, and cleave (292) <= 1, or <= 2 on a
// two-handed weapon that is not a thrust weapon (RynthILT used to cap every weapon
// at 1, so no two-handed corrupted weapon was ever chunked). Optional keep rules
// (Crushing Blow, Biting Strike, Armor Cleaving, slayer, multi-strike, elemental
// bonus, any spell, max damage, spell ids) are all off by default.
// Peace mode only unless ChunkInCombat. With ChunkInCombat on, a busy client in combat mode no
// longer blocks the hammer (a swinging bot is always busy); peace mode still waits for idle.
// Waits for the result line (10 s max); a target that leaves the pack first counts as chunked
// (ILT does not always send a known line). Each item's skip reason is logged when it changes
// and tallied in the status line.
// The tool is the "Lugian Aetheria Hammer" only. The Lugian Hammer weapons (Flaming, Acid, ...)
// are loot and chunk nothing: the server answers with no result line, so every item timed out
// into the skip list and the status sat on "nothing eligible" (SilentKelpie, 2026-10-15).
// Clap: "/clap all" converts aetheria chunks + trinkets into coins server-side. Needs the
// AutoCraftingEnabled stamp; 30 min ± 2 min interval, first attempt ~1 min after enable.
// Clap: "/clap all" converts aetheria + trinkets into coins server-side: red (Coalesced level 1-3,
// chunks, powder) with Empyrean Trinkets, blue with Falatacot Trinkets. Auto-clap sends it only
// when a pair is carried. Needs the AutoCraftingEnabled stamp; 30 min ± 2 min interval, first
// attempt ~1 min after enable.
using System;
using System.Collections.Generic;
using System.Linq;
@ -53,6 +68,10 @@ internal sealed class IltChunkClap : IIltFeature
private bool _manualPass;
private volatile string _chunkStatus = "idle";
private int _chunked;
// Last skip reason per item, so each reason is logged once instead of every pass.
private readonly Dictionary<int, string> _lastSkip = new();
// Skip reasons of the current pass (reason -> items), shown in the status line.
private readonly Dictionary<string, int> _passSkips = new();
// Clap state
private long _nextClapAt;
@ -74,59 +93,264 @@ internal sealed class IltChunkClap : IIltFeature
private WorldObject? FindHammer()
=> _ctx.Inventory.Items().FirstOrDefault(wo => IsChunkHammer(wo.Name) && !_ctx.Inventory.IsEquipped(wo));
/// <summary>True/false when decidable; null when appraisal is still needed.</summary>
private bool? IsChunkableAetheria(WorldObject wo)
/// <summary>Item kinds the hammer works on (the name and class gate, before any appraisal).</summary>
internal enum ChunkKind { None, Aetheria, Corrupted }
/// <summary>
/// Which chunk rules an item falls under, by class and name only. Aetheria chunks and powder
/// are clap material, not hammer targets. Pure: the tests drive it.
/// </summary>
internal static ChunkKind KindOf(AcObjectClass cls, string name)
{
if (cls == AcObjectClass.Gem)
{
if (name.Equals("Coalesced Aetheria", StringComparison.OrdinalIgnoreCase)) return ChunkKind.Aetheria;
if (name.Contains("Aetheria", StringComparison.OrdinalIgnoreCase)
&& !name.Contains("Chunk", StringComparison.OrdinalIgnoreCase)
&& !name.Contains("Powder", StringComparison.OrdinalIgnoreCase))
return ChunkKind.Aetheria;
return ChunkKind.None;
}
if (cls is AcObjectClass.MeleeWeapon or AcObjectClass.MissileWeapon
&& name.Contains("Corrupted", StringComparison.OrdinalIgnoreCase))
return ChunkKind.Corrupted;
return ChunkKind.None;
}
/// <summary>An aetheria piece's chunk facts, read after appraisal.</summary>
internal readonly record struct AetheriaFacts(
bool Coalesced, int MaxLevel, bool NeverChunk, long ItemXp, int Tinkers, int Imbue,
int Crit, int CritDamage, int CritDamageResist, string? Unreadable = null);
/// <summary>
/// Why an aetheria piece is kept, or null when it may be chunked (ub-IT AetheriaChunkGuard plus
/// RynthILT's C / CD / CDR keep switches). Pure: the tests drive it.
/// <para>
/// <see cref="AetheriaFacts.Unreadable"/> is set when the item's properties could not be read (the
/// host lacks a reader or the appraisal never arrived). A property that failed to read looks
/// exactly like one the item lacks (level 0, no XP, no tinks), so such a piece is kept: an
/// "unlevelled" Coalesced piece is only chunked when its level was truly read as none.
/// </para>
/// </summary>
internal static string? AetheriaSkip(IltGearState g, in AetheriaFacts f)
{
if (f.Unreadable != null) return $"item data unreadable ({f.Unreadable})";
if (f.NeverChunk) return "never-chunk flag";
if (f.Tinkers != 0 || f.Imbue != 0) return "tinkered or imbued";
if (f.ItemXp != 0) return "has item XP";
if (KeptForRatings(g, f.Crit, f.CritDamage, f.CritDamageResist)) return "kept for its C / CD / CDR rating";
if (!UnderChunkCap(f.MaxLevel, g.ChunkAetheriaUnderLevel, f.Coalesced))
return f.MaxLevel > 0 ? "level at or above the cap" : "no level read";
return null;
}
/// <summary>Why an aetheria item is kept (null = chunk it); "appraising" while its data is missing.</summary>
private string? AetheriaSkip(WorldObject wo)
{
if (wo.ObjectClass != AcObjectClass.Gem) return false;
bool coalesced = wo.Name.Equals("Coalesced Aetheria", StringComparison.OrdinalIgnoreCase);
if (!coalesced && (!wo.Name.Contains("Aetheria", StringComparison.OrdinalIgnoreCase) || wo.Name.Contains("Chunk", StringComparison.OrdinalIgnoreCase)))
return false;
var inv = _ctx.Inventory;
if (inv.IsEquipped(wo)) return false;
if (!inv.HasAppraisal(wo)) { inv.RequestAppraisal(wo); return null; }
if (inv.Bool(wo, IltInventory.BoolNeverChunk)) return false;
if (inv.Quad(wo, IltInventory.QuadItemTotalXp) != 0) return false;
if (KeptForRatings(G, inv.Int(wo, IltInventory.IntGearCrit), inv.Int(wo, IltInventory.IntGearCritDamage),
inv.Int(wo, IltInventory.IntGearCritDamageResist)))
return false;
return coalesced || inv.Int(wo, IltInventory.IntItemMaxLevel) < ClampUnderLevel(G.ChunkAetheriaUnderLevel);
if (inv.IsEquipped(wo)) return "equipped";
if (!inv.HasAppraisal(wo)) { inv.RequestAppraisal(wo); return Appraising; }
string? gap = inv.ReadGap(wo, quads: true);
var f = new AetheriaFacts(
Coalesced: wo.Name.Equals("Coalesced Aetheria", StringComparison.OrdinalIgnoreCase),
MaxLevel: inv.Int(wo, IltInventory.IntItemMaxLevel),
NeverChunk: inv.Bool(wo, IltInventory.BoolNeverChunk),
ItemXp: inv.Quad(wo, IltInventory.QuadItemTotalXp),
Tinkers: inv.Int(wo, IltInventory.IntNumTimesTinkered),
Imbue: inv.Int(wo, IltInventory.IntImbuedEffect),
Crit: inv.Int(wo, IltInventory.IntGearCrit),
CritDamage: inv.Int(wo, IltInventory.IntGearCritDamage),
CritDamageResist: inv.Int(wo, IltInventory.IntGearCritDamageResist),
Unreadable: gap);
return AetheriaSkip(G, f);
}
/// <summary>The chunk cap in range: 1 (chunk nothing by level) to one past the ILT maximum (every level).</summary>
internal static int ClampUnderLevel(int under) => Math.Clamp(under, 1, IltInventory.AetheriaMaxLevel + 1);
/// <summary>
/// True when an aetheria's C / CD / CDR rating is one the settings keep (any rating above 0 with
/// its keep switch on). Pure: the tests drive it.
/// True when an aetheria's max level (int 319) is under the cap. A levelled Coalesced piece
/// (ACECustom rolls 1-10; level 6+ can carry a rating) gets the same cap. Level 0 after
/// appraisal: an unlevelled Coalesced piece is chunkable (ub-IT: "ItemMaxLevel 0 after assess
/// is normal"); any other aetheria with no level is never chunked. Pure: the tests drive it.
/// </summary>
internal static bool UnderChunkCap(int maxLevel, int under, bool coalesced = false)
=> maxLevel > 0 ? maxLevel < ClampUnderLevel(under) : coalesced && maxLevel == 0;
/// <summary>Highest rating level the keep threshold accepts.</summary>
internal const int MaxRatingLevel = 50;
/// <summary>The rating keep threshold in range: 1 (any rating keeps) to <see cref="MaxRatingLevel"/>.</summary>
internal static int ClampRatingLevel(int level) => Math.Clamp(level, 1, MaxRatingLevel);
/// <summary>
/// True when an aetheria's C / CD / CDR rating is one the settings keep: its keep switch is on and
/// the rating is at or above the rating level (<see cref="IltGearState.KeepAetheriaRatingAtLeast"/>).
/// A rating below that level does not protect the piece, so e.g. a C 1 Coalesced Aetheria chunks
/// with the level at 2 while a C 2 one is kept. Pure: the tests drive it.
/// </summary>
internal static bool KeptForRatings(IltGearState g, int crit, int critDamage, int critDamageResist)
=> (g.KeepAetheriaWithCrit && crit > 0)
|| (g.KeepAetheriaWithCritDamage && critDamage > 0)
|| (g.KeepAetheriaWithCritDamageResist && critDamageResist > 0);
private bool? IsChunkableCorrupted(WorldObject wo)
{
if (wo.ObjectClass is not (AcObjectClass.MeleeWeapon or AcObjectClass.MissileWeapon)) return false;
if (!wo.Name.Contains("Corrupted", StringComparison.OrdinalIgnoreCase)) return false;
var inv = _ctx.Inventory;
if (inv.IsEquipped(wo)) return false;
if (!inv.HasAppraisal(wo)) { inv.RequestAppraisal(wo); return null; }
if (inv.Bool(wo, IltInventory.BoolNeverChunk)) return false;
if (inv.Int(wo, IltInventory.IntNumTimesTinkered) != 0 || inv.Int(wo, IltInventory.IntImbuedEffect) != 0) return false;
return inv.Int(wo, IltInventory.IntCleaving) <= 1;
int min = ClampRatingLevel(g.KeepAetheriaRatingAtLeast);
return (g.KeepAetheriaWithCrit && crit >= min)
|| (g.KeepAetheriaWithCritDamage && critDamage >= min)
|| (g.KeepAetheriaWithCritDamageResist && critDamageResist >= min);
}
private WorldObject? NextChunkTarget()
private const string Appraising = "appraising";
private const int SkillTwoHandedCombat = 41;
private const int WeaponTypeTwoHanded = 11;
private const int AttackTypeThrust = 2;
/// <summary>A corrupted weapon's chunk facts, read after appraisal.</summary>
internal sealed record CorruptedFacts
{
foreach (var wo in _ctx.Inventory.Items())
public bool NeverChunk { get; init; }
public int Tinkers { get; init; }
public int Imbue { get; init; }
public int Workmanship { get; init; }
public int AttackType { get; init; }
public int Cleaving { get; init; }
public int WieldSkill { get; init; }
public int WeaponType { get; init; }
public double CritFrequency { get; init; }
public double CritMultiplier { get; init; }
public double IgnoreArmor { get; init; }
public int Slayer { get; init; }
public int ElementalBonus { get; init; }
public int MaxDamage { get; init; }
public IReadOnlyList<int> Spells { get; init; } = Array.Empty<int>();
/// <summary>What could not be read (null = everything the rules need was); see AetheriaFacts.Unreadable.</summary>
public string? Unreadable { get; init; }
}
/// <summary>
/// The most cleave a chunkable corrupted weapon may have (ub-IT IsValidCorruptedWep): 2 on a
/// two-handed weapon that is not a thrust weapon, 1 on everything else. Pure: the tests drive it.
/// </summary>
internal static int MaxChunkCleave(int wieldSkill, int weaponType, int attackType)
=> (wieldSkill == SkillTwoHandedCombat || weaponType == WeaponTypeTwoHanded) && attackType != AttackTypeThrust ? 2 : 1;
/// <summary>
/// Why a corrupted weapon is kept, or null when it may be chunked: ub-IT's hard rules, then its
/// IdleActs keep rules from the settings. Pure: the tests drive it.
/// </summary>
internal static string? CorruptedSkip(IltGearState g, CorruptedFacts f)
{
// A property that failed to read looks like one the weapon lacks (0), which would chunk it.
if (f.Unreadable != null) return $"item data unreadable ({f.Unreadable})";
// Hard rules (always on).
if (f.NeverChunk) return "never-chunk flag";
if (f.Tinkers != 0 || f.Imbue != 0) return "tinkered or imbued";
if (f.Workmanship <= 0) return "no workmanship";
if (f.Cleaving > MaxChunkCleave(f.WieldSkill, f.WeaponType, f.AttackType)) return "cleave over the limit";
// Keep rules (each off by default).
if (g.KeepCorruptedCrushingBlow && f.CritFrequency > 0) return "kept: Crushing Blow";
if (g.KeepCorruptedBitingStrike && f.CritMultiplier > 0) return "kept: Biting Strike";
if (g.KeepCorruptedArmorCleaving && f.IgnoreArmor > 0) return "kept: Armor Cleaving";
if (g.KeepCorruptedAnySlayer && f.Slayer > 0) return "kept: slayer";
if (g.KeepCorruptedMultiStrike && f.AttackType is 160 or 166 or 486) return "kept: multi-strike";
if (g.KeepCorruptedElementalBonus && f.ElementalBonus > 0) return "kept: elemental bonus";
if (g.KeepCorruptedMaxDamageAtLeast > 0 && f.MaxDamage >= g.KeepCorruptedMaxDamageAtLeast) return "kept: max damage";
if (f.Spells.Count > 0)
{
if (_skip.Contains(wo.Id)) continue;
if ((G.AutoChunkAetheria || _manualPass) && IsChunkableAetheria(wo) == true) return wo;
if ((G.AutoChunkCorrupted || _manualPass) && IsChunkableCorrupted(wo) == true) return wo;
if (g.KeepCorruptedAnySpell) return "kept: has a spell";
var deny = ParseSpellIds(g.KeepCorruptedSpellIds);
if (deny.Count > 0 && f.Spells.Any(deny.Contains)) return "kept: listed spell";
}
return null;
}
/// <summary>Positive spell ids from a comma / semicolon / whitespace separated list. Pure: the tests drive it.</summary>
internal static HashSet<int> ParseSpellIds(string? csv)
{
var ids = new HashSet<int>();
if (string.IsNullOrWhiteSpace(csv)) return ids;
foreach (var part in csv.Split(new[] { ',', ';', ' ', '\t', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries))
if (int.TryParse(part, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture, out int id) && id > 0)
ids.Add(id);
return ids;
}
/// <summary>Why a corrupted weapon is kept (null = chunk it); "appraising" while its data is missing.</summary>
private string? CorruptedSkip(WorldObject wo)
{
var inv = _ctx.Inventory;
if (inv.IsEquipped(wo)) return "equipped";
if (!inv.HasAppraisal(wo)) { inv.RequestAppraisal(wo); return Appraising; }
bool needDoubles = G.KeepCorruptedCrushingBlow || G.KeepCorruptedBitingStrike || G.KeepCorruptedArmorCleaving;
bool needSpells = G.KeepCorruptedAnySpell || !string.IsNullOrWhiteSpace(G.KeepCorruptedSpellIds);
var f = new CorruptedFacts
{
Unreadable = inv.ReadGap(wo, doubles: needDoubles, spells: needSpells),
NeverChunk = inv.Bool(wo, IltInventory.BoolNeverChunk),
Tinkers = inv.Int(wo, IltInventory.IntNumTimesTinkered),
Imbue = inv.Int(wo, IltInventory.IntImbuedEffect),
Workmanship = inv.Int(wo, IltInventory.IntItemWorkmanship),
AttackType = inv.Int(wo, IltInventory.IntAttackType),
Cleaving = inv.Int(wo, IltInventory.IntCleaving),
WieldSkill = inv.Int(wo, IltInventory.IntWieldSkillType),
WeaponType = inv.Int(wo, IltInventory.IntWeaponType),
CritFrequency = inv.Double(wo, IltInventory.FloatCriticalFrequency),
CritMultiplier = inv.Double(wo, IltInventory.FloatCriticalMultiplier),
IgnoreArmor = inv.Double(wo, IltInventory.FloatIgnoreArmor),
Slayer = inv.Int(wo, IltInventory.IntSlayerCreatureType),
ElementalBonus = inv.Int(wo, IltInventory.IntElementalDamageBonus),
MaxDamage = inv.Int(wo, IltInventory.IntDamage),
// Spells are only read when a spell rule is on (the read copies the item's spell list).
Spells = needSpells ? inv.SpellIds(wo) : Array.Empty<int>(),
};
return CorruptedSkip(G, f);
}
/// <summary>
/// Chunk is allowed while the client is busy only in combat mode with ChunkInCombat on (ub-IT
/// AutoChunkCombatBusyPolicy v2.0.1059: a swinging bot is always busy). Peace mode still waits
/// for idle so the hammer never interrupts another use. Pure: the tests drive it.
/// </summary>
internal static bool AllowsChunkWhileBusy(bool isBusy, bool isPeace, bool chunkInCombat)
=> !isBusy || (!isPeace && chunkInCombat);
private WorldObject? NextChunkTarget()
{
_passSkips.Clear();
foreach (var wo in _ctx.Inventory.Items())
{
if (_skip.Contains(wo.Id)) continue;
string? reason;
switch (KindOf(wo.ObjectClass, wo.Name))
{
case ChunkKind.Aetheria when G.AutoChunkAetheria || _manualPass:
reason = AetheriaSkip(wo);
break;
case ChunkKind.Corrupted when G.AutoChunkCorrupted || _manualPass:
reason = CorruptedSkip(wo);
break;
default:
continue;
}
if (reason == null) { _lastSkip.Remove(wo.Id); return wo; }
NoteSkip(wo, reason);
}
return null;
}
/// <summary>Tallies a skip for the status line and logs it once per item and reason.</summary>
private void NoteSkip(WorldObject wo, string reason)
{
_passSkips[reason] = _passSkips.TryGetValue(reason, out int n) ? n + 1 : 1;
if (reason == Appraising) return;
if (_lastSkip.TryGetValue(wo.Id, out string? last) && last == reason) return;
_lastSkip[wo.Id] = reason;
RynthLog.Write(LogCat.IltGear, $"chunk: keep 0x{(uint)wo.Id:X8} '{wo.Name}': {reason}");
}
/// <summary>"3 kept for its C / CD / CDR rating, 1 appraising" — the current pass's skips.</summary>
private string PassSkipSummary()
=> string.Join(", ", _passSkips.OrderByDescending(kv => kv.Value).Select(kv => $"{kv.Value} {kv.Key}"));
/// <summary>Runs one chunk pass now (both item kinds) regardless of the auto toggles.</summary>
public void ChunkNow()
{
@ -143,23 +367,37 @@ internal sealed class IltChunkClap : IIltFeature
if (_waitingOn != 0)
{
if (now - _waitStartedAt < ChunkResultWaitMs) return;
_skip.Add(_waitingOn); // no result line — don't hammer the same item forever
RynthLog.Write(LogCat.IltGear, $"chunk: no result line for 0x{(uint)_waitingOn:X8} in {ChunkResultWaitMs / 1000} s, skipped until a manual pass");
int id = _waitingOn;
switch (WaitOutcome(now - _waitStartedAt, _ctx.Inventory.Items().Any(wo => wo.Id == id)))
{
case ChunkWait.Waiting:
return;
case ChunkWait.Gone:
_chunked++;
RynthLog.Write(LogCat.IltGear, $"chunk: 0x{(uint)id:X8} left the pack with no result line; counted as chunked");
break;
case ChunkWait.TimedOut:
_skip.Add(id); // still carried and no result line: don't hammer the same item forever
RynthLog.Write(LogCat.IltGear, $"chunk: no result line for 0x{(uint)id:X8} in {ChunkResultWaitMs / 1000} s, skipped until a manual pass");
break;
}
_waitingOn = 0;
}
if (now - _lastChunkAt < Math.Max(500, G.ChunkIntervalMs)) return;
_lastChunkAt = now;
if (!G.ChunkInCombat && !_ctx.Inventory.InPeaceMode) { _chunkStatus = "waiting for peace mode"; return; }
if (_ctx.Inventory.IsBusy) return;
bool peace = _ctx.Inventory.InPeaceMode;
if (!G.ChunkInCombat && !peace) { _chunkStatus = "waiting for peace mode"; return; }
if (!AllowsChunkWhileBusy(_ctx.Inventory.IsBusy, peace, G.ChunkInCombat)) { _chunkStatus = "waiting for idle"; return; }
var hammer = FindHammer();
if (hammer == null) { _chunkStatus = $"no {HammerName} carried"; _manualPass = false; return; }
var target = NextChunkTarget();
if (target == null)
{
string kept = PassSkipSummary();
_chunkStatus = (_chunked > 0 ? $"nothing left to chunk ({_chunked} this session)" : "nothing eligible")
+ (kept.Length > 0 ? $"; not chunked: {kept}" : "")
+ (_skip.Count > 0 ? $"; {_skip.Count} skipped with no answer (Chunk now retries them)" : "");
_manualPass = false;
return;
@ -174,21 +412,64 @@ internal sealed class IltChunkClap : IIltFeature
// ── Clap ────────────────────────────────────────────────────────────────
internal enum ClapPart { None, Red, Blue, Empyrean, Falatacot }
/// <summary>
/// Which side of /clap an item feeds (ACECustom PlayerCommands.HandleClap): red material (Red
/// Coalesced Aetheria, chunks, powder) pairs with Ancient Empyrean Trinkets, blue with Ancient
/// Falatacot Trinkets. Coalesced counts only unrevealed and at level 1-3; level 0 (not read yet)
/// counts, and the server has the last word. With no WCID yet, the chunk and trinket names
/// decide. Pure: the tests drive it.
/// </summary>
internal static ClapPart ClapPartOf(uint wcid, string name, int maxLevel)
{
bool lowCoalesced = name.Equals("Coalesced Aetheria", StringComparison.OrdinalIgnoreCase) && maxLevel <= 3;
switch (wcid)
{
case IltInventory.WcidRedCoalescedAetheria: return lowCoalesced ? ClapPart.Red : ClapPart.None;
case IltInventory.WcidBlueCoalescedAetheria: return lowCoalesced ? ClapPart.Blue : ClapPart.None;
case IltInventory.WcidRedAetheriaChunk:
case IltInventory.WcidRedAetheriaPowder: return ClapPart.Red;
case IltInventory.WcidBlueAetheriaChunk:
case IltInventory.WcidBlueAetheriaPowder: return ClapPart.Blue;
case IltInventory.WcidEmpyreanTrinket: return ClapPart.Empyrean;
case IltInventory.WcidFalatacotTrinket: return ClapPart.Falatacot;
case 0: break;
default: return ClapPart.None;
}
if (name.Equals("Red Aetheria Chunk", StringComparison.OrdinalIgnoreCase)) return ClapPart.Red;
if (name.Equals("Blue Aetheria Chunk", StringComparison.OrdinalIgnoreCase)) return ClapPart.Blue;
if (name.Equals("Ancient Empyrean Trinket", StringComparison.OrdinalIgnoreCase)) return ClapPart.Empyrean;
if (name.Equals("Ancient Falatacot Trinket", StringComparison.OrdinalIgnoreCase)) return ClapPart.Falatacot;
return ClapPart.None;
}
/// <summary>
/// True when /clap has a pair to work with: red material and an Empyrean Trinket, or blue
/// material and a Falatacot Trinket. One side alone gets "You don't have any aetheria materials".
/// Pure: the tests drive it.
/// </summary>
internal static bool CanClap(IEnumerable<ClapPart> parts)
{
bool red = false, blue = false, empyrean = false, falatacot = false;
foreach (var part in parts)
{
switch (part)
{
case ClapPart.Red: red = true; break;
case ClapPart.Blue: blue = true; break;
case ClapPart.Empyrean: empyrean = true; break;
case ClapPart.Falatacot: falatacot = true; break;
}
}
return (red && empyrean) || (blue && falatacot);
}
private bool HasClapMaterials()
{
var inv = _ctx.Inventory;
foreach (var wo in inv.Items())
{
uint w = inv.Wcid(wo);
if ((w == IltInventory.WcidRedAetheriaChunk || w == IltInventory.WcidBlueAetheriaChunk)
&& inv.Int(wo, IltInventory.IntItemMaxLevel) <= 3)
return true;
string n = wo.Name;
if (n.Equals("Red Aetheria Chunk", StringComparison.OrdinalIgnoreCase) || n.Equals("Blue Aetheria Chunk", StringComparison.OrdinalIgnoreCase)
|| n.Equals("Ancient Empyrean Trinket", StringComparison.OrdinalIgnoreCase) || n.Equals("Ancient Falatacot Trinket", StringComparison.OrdinalIgnoreCase))
return true;
}
return false;
return CanClap(inv.Items().Where(wo => !inv.IsEquipped(wo))
.Select(wo => ClapPartOf(inv.Wcid(wo), wo.Name, inv.Int(wo, IltInventory.IntItemMaxLevel))));
}
/// <summary>Sends "/clap all" through the capture queue (reply stays visible).</summary>
@ -197,7 +478,7 @@ internal sealed class IltChunkClap : IIltFeature
RynthLog.Trace(LogCat.IltGear, $"ClapNow(manual={manual})");
if (_ctx.Options.IsOff(IltFeature.Clap)) { _clapStatus = "/clap is not available (server or AutoCraftingEnabled stamp)"; return; }
if (_ctx.Capture.IsPending("/clap all")) return;
if (!manual && !HasClapMaterials()) { _clapStatus = "no aetheria materials carried"; return; }
if (!manual && !HasClapMaterials()) { _clapStatus = "no aetheria and trinket pair carried (red + Empyrean, blue + Falatacot)"; return; }
_clapStatus = "sending /clap all...";
_ctx.Capture.Enqueue(new IltChatRequest
{
@ -245,6 +526,21 @@ internal sealed class IltChunkClap : IIltFeature
internal enum ChunkResult { None, Busy, Done, Refused }
/// <summary>Where a chunk in flight stands when no chat line has ended the wait.</summary>
internal enum ChunkWait { Waiting, Gone, TimedOut }
/// <summary>
/// The wait for a chunk with no result line yet. The hammer destroys the target, so a target
/// that has left the pack was chunked: ILT does not always send a line the classifier knows
/// (Silentkelpie 2026-10-18: a Red Aetheria Chunk arrived and UseDone had no error, yet the
/// item was still filed as skipped after 10 s). Still carried after the wait = timed out.
/// Pure: the tests drive it.
/// </summary>
internal static ChunkWait WaitOutcome(long elapsedMs, bool targetStillCarried)
=> !targetStillCarried ? ChunkWait.Gone
: elapsedMs >= ChunkResultWaitMs ? ChunkWait.TimedOut
: ChunkWait.Waiting;
/// <summary>
/// What a chat line says about the chunk in flight. ILT names the item and the tool ("You
/// smash the Corrupted Sword with the Lugian Aetheria Hammer."), so a line naming a corrupted
@ -288,6 +584,7 @@ internal sealed class IltChunkClap : IIltFeature
{
_waitingOn = 0;
_skip.Clear();
_lastSkip.Clear();
_manualPass = false;
_clapWasEnabled = false;
}
@ -306,7 +603,7 @@ internal sealed class IltChunkClap : IIltFeature
ImGui.SetNextItemWidth(100);
if (ImGui.InputInt("Chunk aetheria with max level below", ref under)) G.ChunkAetheriaUnderLevel = ClampUnderLevel(under);
if (ImGui.IsItemHovered())
SafeImGui.SetTooltip($"Infinite Leaftide aetheria goes up to level {IltInventory.AetheriaMaxLevel}; {IltInventory.AetheriaMaxLevel + 1} chunks every level.");
SafeImGui.SetTooltip($"Infinite Leaftide aetheria goes up to level {IltInventory.AetheriaMaxLevel}; {IltInventory.AetheriaMaxLevel + 1} chunks every level.\nA levelled Coalesced Aetheria gets the cap too; an unlevelled one (level 0 after appraisal) is chunked, as in ub-IT.");
bool kc = G.KeepAetheriaWithCrit, kcd = G.KeepAetheriaWithCritDamage, kcdr = G.KeepAetheriaWithCritDamageResist;
ImGui.TextUnformatted("Never chunk aetheria with:");
ImGui.SameLine();
@ -318,6 +615,39 @@ internal sealed class IltChunkClap : IIltFeature
ImGui.SameLine();
if (ImGui.Checkbox("CDR##keepcdr", ref kcdr)) G.KeepAetheriaWithCritDamageResist = kcdr;
if (ImGui.IsItemHovered()) ImGui.SetTooltip("A Crit Damage Resist rating (GearCritDamageResist).");
int ratingAt = G.KeepAetheriaRatingAtLeast;
ImGui.SetNextItemWidth(100);
if (ImGui.InputInt("Keep when the rating is at least##keeprating", ref ratingAt)) G.KeepAetheriaRatingAtLeast = ClampRatingLevel(ratingAt);
if (ImGui.IsItemHovered())
ImGui.SetTooltip("Rating level for the C / CD / CDR switches above (Coalesced Aetheria and revealed aetheria).\n"
+ "At or above this level: kept. Below it: the rating does not protect the piece, so it chunks\n"
+ "if the level cap and the other rules allow. 1 = any rating keeps.");
if (ImGui.TreeNode("Corrupted weapon keep rules##corrkeep"))
{
// ub-IT IdleActs > Corr Chunk: each matching rule keeps the weapon.
bool cb = G.KeepCorruptedCrushingBlow, bs = G.KeepCorruptedBitingStrike, acl = G.KeepCorruptedArmorCleaving;
bool sl = G.KeepCorruptedAnySlayer, ms = G.KeepCorruptedMultiStrike, el = G.KeepCorruptedElementalBonus, sp = G.KeepCorruptedAnySpell;
if (ImGui.Checkbox("Crushing Blow##ck", ref cb)) G.KeepCorruptedCrushingBlow = cb;
ImGui.SameLine();
if (ImGui.Checkbox("Biting Strike##ck", ref bs)) G.KeepCorruptedBitingStrike = bs;
ImGui.SameLine();
if (ImGui.Checkbox("Armor Cleaving##ck", ref acl)) G.KeepCorruptedArmorCleaving = acl;
if (ImGui.Checkbox("Any slayer##ck", ref sl)) G.KeepCorruptedAnySlayer = sl;
ImGui.SameLine();
if (ImGui.Checkbox("Multi-strike##ck", ref ms)) G.KeepCorruptedMultiStrike = ms;
ImGui.SameLine();
if (ImGui.Checkbox("Elemental bonus##ck", ref el)) G.KeepCorruptedElementalBonus = el;
if (ImGui.Checkbox("Any spell##ck", ref sp)) G.KeepCorruptedAnySpell = sp;
int maxDmg = G.KeepCorruptedMaxDamageAtLeast;
ImGui.SetNextItemWidth(100);
if (ImGui.InputInt("Keep max damage at least (0 = off)##ck", ref maxDmg)) G.KeepCorruptedMaxDamageAtLeast = Math.Max(0, maxDmg);
string ids = G.KeepCorruptedSpellIds ?? "";
ImGui.SetNextItemWidth(220);
if (ImGui.InputText("Keep spell ids##ck", ref ids, 512)) G.KeepCorruptedSpellIds = ids;
if (ImGui.IsItemHovered()) ImGui.SetTooltip("Comma or space separated spell ids: a corrupted weapon carrying any of them is kept.");
SafeImGui.TextDisabled("Always kept: tinkered, imbued, no workmanship, cleave over 1 (2 on two-handed, non-thrust).");
ImGui.TreePop();
}
if (ImGui.Button("Chunk eligible items now...")) _ctx.Confirm("Chunk items",
"Run one chunk pass now on every eligible aetheria and corrupted weapon?\nChunked items are destroyed.",
ChunkNow, "Chunk");

View file

@ -111,7 +111,7 @@ internal static class IltFeatureCatalog
new("pets", "Pet log", GroupPets, "Mini Remote > Pets tab", "Captured pets, registered with Professor Ruggan (/pets).", IltFeature.Pets, IltKnown.Checked),
new("shinies", "Shiny log", GroupPets, "Mini Remote > Pets tab", "Rare shiny creature variants you captured (/shinies).", IltFeature.Shinies, IltKnown.Checked),
new("monster_capture", "Monster capture", GroupPets, "Mini Remote > Pets tab",
"Siphon lenses capture a creature's look into a pet essence (lens drops from kills are a separate server switch).", "monster_capture"),
"Siphon lenses capture a creature\'s look into a pet essence (<=20% health or under 20 HP; Asheron\'s Lens skips the gate). Auto-capture is the checkbox on the Pets roster.", "monster_capture"),
new("pet_breeding", "Pet breeding", GroupPets, "Mini Remote > Pets > Breeding",
"Breed two combat pet devices at the Seedy Motel for inherited and mutated offspring (/dance).", "pet_breeding"),
new("pet_maturity", "Pet maturity", GroupPets, "Mini Remote > Pets > Breeding",

View file

@ -64,6 +64,8 @@ internal sealed class IltHubController
public IltCharms CharmsTab { get; }
/// <summary>Temple guardians: riddle translator, hand-in, attribute turn-in tracker.</summary>
public IltGuardian Guardian { get; }
/// <summary>Vaulted Dungeons keeper (Mini Remote tab). ILT-only and behind RynthAi's master switch, off by default.</summary>
public IltVaultedDungeons VaultedDungeons { get; }
/// <param name="writesBlocked">True while this character's copy from RynthAi is unfinished (IltHubStore.WritesBlocked).</param>
/// <param name="legacyFolder">The character's RynthAi folder while that copy is unfinished (read-only fallback).</param>
@ -92,7 +94,8 @@ internal sealed class IltHubController
Charms = new IltCharmTracker(_ctx);
CharmsTab = new IltCharms(_ctx, Charms);
Guardian = new IltGuardian(_ctx, QuestBonus);
_features.AddRange(new IIltFeature[] { Banking, PetLogs, Breeding, Rates, QuestBonus, Progression, Gear, CharmsTab, Games, Guardian });
VaultedDungeons = new IltVaultedDungeons(_ctx);
_features.AddRange(new IIltFeature[] { Banking, PetLogs, Breeding, Rates, QuestBonus, Progression, Gear, CharmsTab, Games, VaultedDungeons, Guardian });
Banking.BalanceChanged += Rates.OnBankBalanceChanged;
Rates.MovingMoney = () => Banking.MovingMoney;
@ -192,6 +195,8 @@ internal sealed class IltHubController
IltSection.Character => true,
IltSection.Banking => Available && !_ctx.Options.IsOff(IltFeature.Bank),
IltSection.Games => Available && Games.AnyGameAvailable,
// Content, not a server feature bit: an ILT world and the master switch (RynthAi's setting).
IltSection.VaultedDungeons => _ctx.Options.IsIltLikeWorld && VaultedDungeons.MasterEnabled(),
_ => Available,
};
@ -320,6 +325,14 @@ internal sealed class IltHubController
}
}
/// <summary>The server's killer notification (pump thread): restarts the Vaulted Dungeons no-kill timer, on ILT only.</summary>
public void OnKillNotification()
{
if (!_ctx.Options.IsIltLikeWorld) return;
try { VaultedDungeons.OnKillNotification(); }
catch (Exception ex) { RynthLog.Exception(LogCat.IltHub, ex, "VaultedDungeons.OnKillNotification"); }
}
/// <summary>Pump-thread chat line. Returns true when the line should be hidden.</summary>
public bool OnChat(string text)
{
@ -346,6 +359,7 @@ internal sealed class IltHubController
IltProgression => LogCat.IltProgression,
IltGear or IltCharms => LogCat.IltGear,
IltGames => LogCat.IltGames,
IltVaultedDungeons => LogCat.IltHub,
_ => LogCat.IltHub,
};
@ -390,7 +404,11 @@ internal sealed class IltHubController
if (r.Lines.Count == 0) return;
switch (key)
{
case IltFeature.Aug: Progression.ApplyAugLines(r.Lines); break;
case IltFeature.Aug:
Progression.ApplyAugLines(r.Lines);
// Probe's OnComplete is not RequestAugs' — drain a queued Refresh current / empty retry.
Progression.AfterExternalAugCapture();
break;
case IltFeature.Pets: PetLogs.ApplyRoster(false, r.Lines); break;
case IltFeature.Shinies: PetLogs.ApplyRoster(true, r.Lines); break;
case IltFeature.Qb: QuestBonus.ApplyQbProbe(r.Lines); break;
@ -456,7 +474,7 @@ internal sealed class IltHubController
{
// Quests and Pets are RynthAi's tabs: not ours to open.
if (args.Length >= 2 && IltSections.IsUniversalTabName(args[1])) return false;
_ctx.Chat("[Mini Remote] Usage: /ra hub open pets|banking|gear|charms|games|guardian|bounties [show|hide|toggle] (character: /ro character, quests: /ro)");
_ctx.Chat("[Mini Remote] Usage: /ra hub open pets|banking|gear|charms|games|vaulted|guardian|bounties [show|hide|toggle] (character: /ro character, quests: /ro)");
break;
}
OpenSection(section, args.Length > 2 ? args[2] : "toggle");
@ -494,7 +512,8 @@ internal sealed class IltHubController
break;
default:
_ctx.Chat("[Mini Remote] /ra hub [show|hide|toggle] (Mini Remote)|refresh|bank|status|features|force on|off|servers [list]|clap|confirm|cancel");
_ctx.Chat("[Mini Remote] /ra hub open pets|banking|gear|charms|games [show|hide|toggle] (Mini Remote tabs; character: /ro character, quests: /ro)");
_ctx.Chat("[Mini Remote] /ra hub open pets|banking|gear|charms|games|vaulted [show|hide|toggle] (Mini Remote tabs; character: /ro character, quests: /ro)");
_ctx.Chat("[Mini Remote] /ilt vaulted [on|off|toggle|status] (Vaulted Dungeons; master switch: Settings > Navigation > Vaulted Dungeons)");
_ctx.Chat("[Mini Remote] /ra hub profile list|save <name> [shared]|load <name> /ra hub suit list|test|load [name]");
_ctx.Chat("[Mini Remote] /ra hub attr run|stop|costs|status|auto on|off|every <min>|raise <stat> <n> (Skills panel > Progression)");
_ctx.Chat("[Mini Remote] /ra quests refresh (quiet /myquests) /ra pets [show|hide] /ilt qb (the quest bonus list)");
@ -580,6 +599,13 @@ internal sealed class IltHubController
OpenEnginePanel(IltSections.TabId(section), IltSections.Label(section), mode);
return;
}
if (section == IltSection.VaultedDungeons && !SectionAvailable(section))
{
_ctx.Chat(_ctx.Options.IsIltLikeWorld
? "[Mini Remote] The Vaulted Dungeons tab is off: turn on \"Vaulted Dungeons\" in Settings > Navigation (the master switch, off by default)."
: "[Mini Remote] Vaulted Dungeons is not available on this server (Infinite Leaftide / ACECustom only).");
return;
}
string reply = _ctx.Ai.MiniRemoteTab(IltSections.TabId(section), mode);
if (!SectionAvailable(section) && !mode.Equals("hide", StringComparison.OrdinalIgnoreCase))
reply = $"The {IltSections.Label(section)} tab shows once the server reports that feature on.";

View file

@ -204,7 +204,7 @@ public sealed class IltGearState
public bool ChunkInCombat;
public int ChunkIntervalMs = 2000;
/// <summary>
/// Only chunk aetheria whose max level is below this (Coalesced always chunks). Infinite Leaftide
/// Only chunk aetheria whose max level is below this (Coalesced Aetheria too). Infinite Leaftide
/// aetheria goes up to level <see cref="IltInventory.AetheriaMaxLevel"/>, so the cap runs to one past it.
/// </summary>
public int ChunkAetheriaUnderLevel = 4;
@ -214,6 +214,32 @@ public sealed class IltGearState
public bool KeepAetheriaWithCritDamage = true;
/// <summary>Never chunk aetheria carrying a Crit Damage Resist rating (CDR, GearCritDamageResist 375).</summary>
public bool KeepAetheriaWithCritDamageResist = true;
/// <summary>
/// Rating level for the C / CD / CDR keep switches: a rating at or above this keeps the piece,
/// a lower one does not protect it (it chunks if the other rules allow). 1 = any rating keeps.
/// </summary>
public int KeepAetheriaRatingAtLeast = 1;
// Corrupted-weapon keep rules (ub-IT IdleActs > Corr Chunk). All off by default, as in ub-IT:
// the hard rules (unmodified, workmanship, cleaving, never-chunk) always apply on top.
/// <summary>Never chunk a corrupted weapon with Crushing Blow (CriticalFrequency float 147 &gt; 0).</summary>
public bool KeepCorruptedCrushingBlow;
/// <summary>Never chunk a corrupted weapon with Biting Strike (CriticalMultiplier float 136 &gt; 0).</summary>
public bool KeepCorruptedBitingStrike;
/// <summary>Never chunk a corrupted weapon with Armor Cleaving (IgnoreArmor float 155 &gt; 0).</summary>
public bool KeepCorruptedArmorCleaving;
/// <summary>Never chunk a corrupted weapon with any slayer (SlayerCreatureType int 166 &gt; 0).</summary>
public bool KeepCorruptedAnySlayer;
/// <summary>Never chunk a multi-strike corrupted weapon (AttackType int 47 = 160 / 166 / 486).</summary>
public bool KeepCorruptedMultiStrike;
/// <summary>Never chunk a corrupted weapon with an elemental damage bonus (int 204 &gt; 0).</summary>
public bool KeepCorruptedElementalBonus;
/// <summary>Never chunk a corrupted weapon with any spell on it.</summary>
public bool KeepCorruptedAnySpell;
/// <summary>Never chunk a corrupted weapon whose max damage (int 44) is at least this. 0 = off.</summary>
public int KeepCorruptedMaxDamageAtLeast;
/// <summary>Spell ids (comma / space separated): never chunk a corrupted weapon carrying any of them.</summary>
public string KeepCorruptedSpellIds = "";
// Auto-clap (/clap all)
public bool AutoClap;

View file

@ -70,6 +70,7 @@ internal sealed class IltHubUi
case IltSection.Gear: _hub.Gear.Render(); break;
case IltSection.Charms: _hub.CharmsTab.Render(); break;
case IltSection.Games: _hub.Games.Render(); break;
case IltSection.VaultedDungeons: _hub.VaultedDungeons.Render(); break;
default:
// A saved tab id from before the move: say where the section lives now.
if (IltSections.MovedCommand(section) is string moved)

View file

@ -36,8 +36,18 @@ internal sealed class IltInventory
public const uint WcidSummonRefillCharm = 78780030;
public const uint WcidUniversalMasteryCharm = 78780031;
public static readonly uint[] WcidInfiniteCastingStone = { 777700019, 777700055 };
public const uint WcidRedAetheriaChunk = 42636;
public const uint WcidBlueAetheriaChunk = 42635;
// Aetheria (ACECustom Aetheria.cs / PlayerCommands /clap). The Coalesced WCIDs stay the same once
// revealed (name "Aetheria", equipment set given), and /clap takes only unrevealed level 1-3 ones.
public const uint WcidBlueCoalescedAetheria = 42635;
public const uint WcidRedCoalescedAetheria = 42636;
public const uint WcidYellowCoalescedAetheria = 42637;
public const uint WcidRedAetheriaChunk = 310147;
public const uint WcidBlueAetheriaChunk = 310149;
public const uint WcidYellowAetheriaChunk = 310150;
public const uint WcidRedAetheriaPowder = 42644;
public const uint WcidBlueAetheriaPowder = 300019;
public const uint WcidEmpyreanTrinket = 34276;
public const uint WcidFalatacotTrinket = 34277;
// ── Property ids used by several features ───────────────────────────────
public const uint IntStackSize = 12;
@ -48,6 +58,27 @@ internal sealed class IltInventory
public const uint IntNumTimesTinkered = 171;
public const uint IntImbuedEffect = 179;
public const uint IntCleaving = 292;
// Corrupted-weapon chunk rules (ub-IT Leaftide.IsValidCorruptedWep / CorruptedChunkGuard).
/// <summary>ACE PropertyInt.Damage — a weapon's max damage.</summary>
public const uint IntDamage = 44;
/// <summary>ACE PropertyInt.AttackType — 2 = thrust; 160 / 166 / 486 are the multi-strike masks.</summary>
public const uint IntAttackType = 47;
/// <summary>ACE PropertyInt.ItemWorkmanship — loot-gen Craft (salvage-bag workmanship is not on weapons).</summary>
public const uint IntItemWorkmanship = 105;
/// <summary>ACE PropertyInt.WieldSkillType — 41 (Two Handed Combat) for two-handed weapons.</summary>
public const uint IntWieldSkillType = 159;
/// <summary>ACE PropertyInt.SlayerCreatureType.</summary>
public const uint IntSlayerCreatureType = 166;
/// <summary>ACE PropertyInt.ElementalDamageBonus.</summary>
public const uint IntElementalDamageBonus = 204;
/// <summary>ACE PropertyInt.WeaponType — 11 = TwoHanded.</summary>
public const uint IntWeaponType = 353;
/// <summary>ACE PropertyFloat.CriticalMultiplier — Biting Strike.</summary>
public const uint FloatCriticalMultiplier = 136;
/// <summary>ACE PropertyFloat.CriticalFrequency — Crushing Blow.</summary>
public const uint FloatCriticalFrequency = 147;
/// <summary>ACE PropertyFloat.IgnoreArmor — Armor Cleaving.</summary>
public const uint FloatIgnoreArmor = 155;
public const uint IntItemMaxLevel = 319;
/// <summary>Highest aetheria level on Infinite Leaftide (ACECustom AetheriaChance rolls up to 10; retail stops at 5).</summary>
public const int AetheriaMaxLevel = 10;
@ -176,6 +207,22 @@ internal sealed class IltInventory
public long Quad(WorldObject wo, uint stype)
=> _host.HasGetObjectQuadProperty && _host.TryGetObjectQuadProperty(unchecked((uint)wo.Id), stype, out long v) ? v : 0;
/// <summary>A float (PropertyFloat) value; 0 when the host cannot read it or the item has none.</summary>
public double Double(WorldObject wo, uint stype)
=> _host.HasGetObjectDoubleProperty && _host.TryGetObjectDoubleProperty(unchecked((uint)wo.Id), stype, out double v) ? v : 0;
/// <summary>The spell ids on an item (empty when none or the host cannot read them).</summary>
public IReadOnlyList<int> SpellIds(WorldObject wo)
{
if (!_host.HasGetObjectSpellIds) return Array.Empty<int>();
var buf = new uint[64];
int n = _host.GetObjectSpellIds(unchecked((uint)wo.Id), buf, buf.Length);
if (n <= 0) return Array.Empty<int>();
var ids = new int[Math.Min(n, buf.Length)];
for (int i = 0; i < ids.Length; i++) ids[i] = unchecked((int)buf[i]);
return ids;
}
public string Str(WorldObject wo, uint stype)
=> _host.HasGetObjectStringProperty && _host.TryGetObjectStringProperty(unchecked((uint)wo.Id), stype, out string v) ? v ?? string.Empty : string.Empty;
@ -191,6 +238,25 @@ internal sealed class IltInventory
public bool HasAppraisal(WorldObject wo)
=> !_host.HasHasAppraisalData || _host.HasAppraisalData(unchecked((uint)wo.Id));
/// <summary>
/// Why an item's property reads cannot be trusted (null = they can). Every property read here
/// answers 0 / false both for "the item has none" and for "the host cannot read it", so a chunk
/// rule that acts on a 0 must first know the read was real: the host must expose the readers
/// and confirm the item's appraisal arrived. <paramref name="quads"/> adds the 64-bit reads
/// (item XP), <paramref name="doubles"/> the float reads and <paramref name="spells"/> the
/// spell list, for the rules that use them.
/// </summary>
public string? ReadGap(WorldObject wo, bool quads = false, bool doubles = false, bool spells = false)
{
if (!_host.HasGetObjectIntProperty) return "int properties";
if (!_host.HasGetObjectBoolProperty) return "bool properties";
if (quads && !_host.HasGetObjectQuadProperty) return "item XP";
if (doubles && !_host.HasGetObjectDoubleProperty) return "float properties";
if (spells && !_host.HasGetObjectSpellIds) return "spells";
if (!_host.HasHasAppraisalData || !_host.HasAppraisalData(unchecked((uint)wo.Id))) return "appraisal";
return null;
}
/// <summary>Requests appraisal data, throttled per object. Returns true if a request was sent.</summary>
public bool RequestAppraisal(WorldObject wo)
{

View file

@ -48,6 +48,8 @@ internal static class LogEvents
public const string IltCommand = "IltHub.Command";
public const string IltConfirmation = "IltHub.Confirmation";
public const string IltLogout = "IltHub.Logout";
/// <summary>/aug ApplyAugLines outcome (Progress Refresh current / login probe).</summary>
public const string IltAugLoad = "IltHub.AugLoad";
/// <summary>Events written as a normal log line; the rest only while their category is traced.</summary>
internal static readonly Dictionary<string, (LogCat Cat, bool Info)> Catalog = new(StringComparer.Ordinal)
@ -61,6 +63,7 @@ internal static class LogEvents
[IltCommand] = (LogCat.IltHub, false),
[IltConfirmation] = (LogCat.IltHub, false),
[IltLogout] = (LogCat.IltHub, false),
[IltAugLoad] = (LogCat.IltProgression, true),
};
}

View file

@ -18,7 +18,7 @@ internal static class IltParse
/// "/aug" level line: "Creature:1,234", "Duration: 1,234", or "Specialize: 2".
/// Trailing notes ("Triune Weave: 5 (adds ...)") are allowed; the planner only keeps known keys.
/// </summary>
public static readonly Regex AugLine = new(@"^(\w+)\s*:\s*([\d,]+)", Opt);
public static readonly Regex AugLine = new(@"^(\w+)\s*:\s*(\d[\d,.\s']*)", Opt);
/// <summary>"/pets" / "/shinies" roster entry: "12. Shiny Drudge Ravener".</summary>
public static readonly Regex RosterLine = new(@"^\s*(\d+)\.\s+(.+)$", Opt);
@ -46,6 +46,22 @@ internal static class IltParse
/// <summary>"/attr" success: "[ATTR] Strength attribute raised by 10, costing 1,234!".</summary>
public static readonly Regex AttrRaised = new(@"^\[ATTR\] (\w+) attribute raised by (\d+), costing ([\d,]+)", Opt);
private static readonly Regex GroupedInt = new(@"^\d{1,3}(?:[,.\s']\d{3})+|^\d+", RegexOptions.CultureInvariant);
/// <summary>
/// The level in an AugLine value: digits grouped by a comma, period, space or apostrophe
/// ("4,300", "4.300", "4 300", "4'300") read as one number; "2 (adds 5)" as 2; "1.5" as 1. 0 when absent.
/// </summary>
public static long ParseAugValue(string text)
{
if (string.IsNullOrEmpty(text)) return 0;
var m = GroupedInt.Match(text.Trim());
if (!m.Success) return 0;
var digits = new System.Text.StringBuilder(m.Value.Length);
foreach (char c in m.Value) if (char.IsDigit(c)) digits.Append(c);
return long.TryParse(digits.ToString(), NumberStyles.None, CultureInfo.InvariantCulture, out long v) ? v : 0;
}
/// <summary>Strips commas and parses the leading integer; 0 when absent.</summary>
public static long ParseLeadingLong(string text)
{

View file

@ -65,6 +65,8 @@ internal sealed class IltProgression : IIltFeature
private bool _augAutoTried;
/// <summary>Second Refresh current while /aug is already queued or in flight (UB coalesces the same way).</summary>
private bool _augRefreshAgain;
/// <summary>One silent retry after the login probe left Current empty (chat-hold / ArmsIdle race).</summary>
private bool _augProbeRetryDone;
/// <summary>Passive /aug window: accept AugLine chat until this tick (like T11's report parser).</summary>
private long _augPassiveUntilMs;
@ -113,7 +115,8 @@ internal sealed class IltProgression : IIltFeature
_augStatus = "/aug is off for this world";
return;
}
// Coalesce: a click during an in-flight /aug runs again when that capture finishes (UB).
// Coalesce: a click during an in-flight /aug (login probe or a prior Refresh) runs again
// when that capture finishes — including via AfterExternalAugCapture for the probe.
if (_ctx.Capture.IsPending("/aug"))
{
_augRefreshAgain = true;
@ -121,15 +124,16 @@ internal sealed class IltProgression : IIltFeature
return;
}
_augStatus = "loading...";
_augPassiveUntilMs = IltHubContext.NowMs + 20_000; // also accept lines if capture finishes early
_augPassiveUntilMs = IltHubContext.NowMs + 30_000; // also accept lines if capture finishes early
_ctx.Capture.Enqueue(new IltChatRequest
{
Command = "/aug",
IsResponseLine = t => t.StartsWith("---") || t.Contains("Augmentation Levels", StringComparison.OrdinalIgnoreCase) || IltParse.AugLine.IsMatch(t),
// Idle must not start on the banner alone — chat-hold / pump lag used to finish with 0 level lines.
ArmsIdle = t => IltParse.AugLine.IsMatch(t),
IdleEndMs = 2000,
FirstLineTimeoutMs = 15000,
IdleEndMs = 2500,
// Login + chat-hold backlog can push Creature: past the old 15s first-line window.
FirstLineTimeoutMs = 30_000,
Eat = true,
OnComplete = r =>
{
@ -148,15 +152,36 @@ internal sealed class IltProgression : IIltFeature
if (have == 0)
_augStatus = "timed out waiting for /aug level lines";
}
if (_augRefreshAgain)
{
_augRefreshAgain = false;
RequestAugs();
}
DrainAugRefreshAgain();
},
});
}
/// <summary>
/// Login probe finished its "/aug" capture (or another path applied lines). Drains a queued
/// Refresh current and, if the probe left Current empty, retries once.
/// </summary>
public void AfterExternalAugCapture()
{
if (DrainAugRefreshAgain()) return;
int have;
lock (_augLevels) have = _augLevels.Count;
if (have > 0 || _augProbeRetryDone || _ctx.Options.IsOff(IltFeature.Aug)) return;
if (_ctx.Capture.IsPending("/aug")) return;
_augProbeRetryDone = true;
RynthLog.Event(LogEvents.IltAugLoad, "aug probe left Current empty — retrying /aug once");
RequestAugs();
}
/// <summary>Runs a coalesced Refresh current if one was queued. Returns true when it did.</summary>
private bool DrainAugRefreshAgain()
{
if (!_augRefreshAgain) return false;
_augRefreshAgain = false;
RequestAugs();
return true;
}
/// <summary>Parses "/aug" output (also fed from the login probe and passive chat).</summary>
public void ApplyAugLines(List<string> lines)
{
@ -166,8 +191,26 @@ internal sealed class IltProgression : IIltFeature
{
if (TryApplyAugLine(l)) n++;
}
_augStatus = n > 0 ? $"{n} aug types @ {DateTime.Now:t}" : "no aug lines in reply";
RynthLog.Trace(LogCat.IltProgression, $"ApplyAugLines done: {_augStatus} (raw lines={lines.Count})");
if (n > 0)
{
_augStatus = $"{n} aug types @ {DateTime.Now:t}";
_augPassiveUntilMs = IltHubContext.NowMs + 8_000;
}
else
{
bool sawBanner = false;
foreach (string l in lines)
{
if (l.Contains("Augmentation Levels", StringComparison.OrdinalIgnoreCase))
{ sawBanner = true; break; }
}
_augStatus = sawBanner
? "no level lines yet (banner only — waiting / retry)"
: "no aug lines in reply";
// Keep the passive reader open so late Creature: lines still fill Current.
if (sawBanner) _augPassiveUntilMs = IltHubContext.NowMs + 15_000;
}
RynthLog.Event(LogEvents.IltAugLoad, $"ApplyAugLines: {_augStatus} (raw={lines.Count})");
}
/// <summary>Applies one "/aug" Type: N line. Returns true when a known planner key was updated.</summary>
@ -182,7 +225,7 @@ internal sealed class IltProgression : IIltFeature
foreach (var (k, _) in IltAugCosts.Labels)
if (k.Equals(key, StringComparison.OrdinalIgnoreCase)) { known = true; break; }
if (!known) return false;
lock (_augLevels) _augLevels[key] = (int)IltParse.ParseLeadingLong(m.Groups[2].Value);
lock (_augLevels) _augLevels[key] = (int)IltParse.ParseAugValue(m.Groups[2].Value);
return true;
}
@ -249,6 +292,7 @@ internal sealed class IltProgression : IIltFeature
lock (_augLevels) _augLevels.Clear();
_augAutoTried = false;
_augRefreshAgain = false;
_augProbeRetryDone = false;
_augPassiveUntilMs = 0;
_augStatus = "not loaded";
}

View file

@ -1,7 +1,7 @@
// IltSections.cs - The Infinite Leaftide tabs of RynthAi's Mini Remote and the Guardian panel.
// Originally SilentKelpie's ILT Hub sections (RynthAi IltHub/); moved to RynthILT 2026-10-13.
//
// Banking, Gear, Charms and Games are Mini Remote tabs: RynthAi's MiniRemoteHud draws the tab bar
// Banking, Gear, Charms, Games and Vaulted Dungeons are Mini Remote tabs: RynthAi's MiniRemoteHud draws the tab bar
// (after its Remote, Pets and Crafting tabs) and asks RynthILT for each tab's body (RynthILT.Hub
// GetTabs / RenderTab); "/ra hub open <section>" picks one, and with RynthCore's sections rail
// RynthAi lists them as "section:<tab>" views (Inventory). Guardian is a RynthCore ILT panel
@ -29,6 +29,11 @@ internal enum IltSection
Banking,
Gear,
Games,
/// <summary>
/// Vaulted Dungeons keeper (portal-recall gem + kill-client). A Mini Remote tab on ILT worlds only,
/// and only while RynthAi's "Vaulted Dungeons" master switch (Settings > Navigation) is on.
/// </summary>
VaultedDungeons,
/// <summary>Registry charms (acquired / status / tier / server) and the Guardian Hand.</summary>
Charms,
// Keep Guardian last.
@ -40,7 +45,7 @@ internal static class IltSections
/// <summary>The ILT tabs, in tab-bar order (RynthAi puts them after its own tabs).</summary>
public static readonly IltSection[] Tabs =
{
IltSection.Banking, IltSection.Gear, IltSection.Charms, IltSection.Games,
IltSection.Banking, IltSection.Gear, IltSection.Charms, IltSection.Games, IltSection.VaultedDungeons,
};
/// <summary>The Mini Remote's own tab (the remote itself): its tab id.</summary>
@ -55,6 +60,7 @@ internal static class IltSections
IltSection.Banking => "Banking",
IltSection.Gear => "Gear",
IltSection.Games => "Games",
IltSection.VaultedDungeons => "Vaulted Dungeons",
IltSection.Charms => "Charms",
IltSection.Guardian => "Guardian",
_ => s.ToString(),
@ -70,13 +76,15 @@ internal static class IltSections
IltSection.Banking => "banking",
IltSection.Gear => "gear",
IltSection.Games => "games",
IltSection.VaultedDungeons => "vaulted",
IltSection.Charms => "charms",
IltSection.Guardian => "guardian",
_ => s.ToString().ToLowerInvariant(),
};
/// <summary>True for the sections drawn as Mini Remote tabs (Banking, Gear, Charms, Games).</summary>
public static bool IsTab(IltSection s) => s is IltSection.Banking or IltSection.Gear or IltSection.Charms or IltSection.Games;
/// <summary>True for the sections drawn as Mini Remote tabs (Banking, Gear, Charms, Games, Vaulted Dungeons).</summary>
public static bool IsTab(IltSection s) => s is IltSection.Banking or IltSection.Gear or IltSection.Charms or IltSection.Games
or IltSection.VaultedDungeons;
/// <summary>
/// Where a section that moved out of the Mini Remote lives now, as the chat command that opens
@ -104,6 +112,8 @@ internal static class IltSections
case "banking": case "bank": section = IltSection.Banking; return true;
case "gear": section = IltSection.Gear; return true;
case "games": case "game": section = IltSection.Games; return true;
case "vaulted": case "vaulteddungeons": case "vaulted-dungeons":
section = IltSection.VaultedDungeons; return true;
case "charms": case "charm": section = IltSection.Charms; return true;
case "guardian": case "temple": case "riddle": section = IltSection.Guardian; return true;
default: section = IltSection.Gear; return false;
@ -120,6 +130,7 @@ internal static class IltSections
IltSection.Gear => new Vector2(560, 520),
IltSection.Charms => new Vector2(560, 520),
IltSection.Games => new Vector2(520, 440),
IltSection.VaultedDungeons => new Vector2(360, 420),
_ => new Vector2(520, 440),
};

View file

@ -0,0 +1,919 @@
// IltVaultedDungeons.cs — Mini Remote "Vaulted Dungeons" tab (ILT / ACECustom only).
// Written by Silentkelpie (RynthSuite PR #12), a port of the UtilityBelt VaultedDungeons.lua script
// (owner 2026-09-27 / 2026-10-03): keeps the character in one Vaulted Dungeon via a tied Portal
// Recall Gem, and optionally /rc quit after N minutes without a kill.
//
// Safety rules (the owner's, added when it was taken in):
// * ILT only. The module does nothing (no tick work, no recall, no quit, no tab) unless
// IltServerOptions.IsIltLikeWorld says this is an Infinite Leaftide / ACECustom world, the same
// verdict every other ILT feature follows. A command answers "not available on this server".
// * Master switch, off by default: RynthAi's "Vaulted Dungeons" setting (Settings > Navigation),
// read through RynthAi.Hub VaultedDungeonsEnabled. It is the only copy. While it is off the module
// ignores AutoStart, never ticks, sends no recall and no /rc quit, and the tab is hidden. Turning
// it off while running stops the keeper at once and says so once.
// * Active is never resumed from the saved settings. It starts when the player turns it on, or on
// arriving in the chosen dungeon with Auto Start On Arrival on (master on); a relog starts Off.
// * No recall gem while RynthAi is in combat, buffing or waiting on the server, or the client is
// busy: the recall waits until it is clear (a warning on the normal 30 s cadence).
// * /rc quit goes out at most once per activation, and only if Active, ILT and the master are all
// still true at the moment of sending.
// * The no-kill timer restarts on the luminance line, on the server's killer notification (a
// killing blow of yours) and on a pet-capture success reply. Kills by pets or fellows that pay
// no luminance still don't count; the tab says so.
using System;
using System.Collections.Generic;
using System.IO;
using System.Numerics;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using ImGuiNET;
using RynthCore.Plugin.Shared;
using RynthCore.PluginSdk;
namespace RynthCore.Plugin.RynthILT.Hub;
/// <summary>One known Vaulted Dungeon (landblock high word; the client does not see the layer).</summary>
internal readonly record struct VaultedDungeon(string Name, uint Landblock);
internal sealed class IltVaultedDungeons : IIltFeature
{
// Keep order stable: saved picks are by 1-based index into this list.
private static readonly VaultedDungeon[] Dungeons =
{
new("Tyrant's Quarry", 0x01F7),
new("Tusgian Barracks", 0x8C03),
new("Wailing Cells", 0x01C2),
new("Chamber of Idols", 0x5649),
new("Fiun Redoubt", 0x0178), // added 2026-09-27
new("Tumerok Tunnels", 0x5754), // added 2026-10-03
};
private static readonly string[] GemNames =
{
"Primary Portal Recall Gem",
"Secondary Portal Recall Gem",
};
private static readonly (string Name, float Value)[] Powers =
{
("Fast", 0f), ("Medium", 0.5f), ("Full Power", 1f),
};
private static readonly int[] QuitPresets = { 1, 2, 5, 10, 15, 30 };
private const long FirstRecallAfterMs = 1000;
private const long RecallAfterMs = 5000;
private const int QuitMin = 1, QuitMax = 30;
private const long WarnEveryMs = 30_000;
private const string SettingsFileName = "settings.json";
private const string SettingsBadFileName = "settings.unreadable.json";
private const string CmdMetaOff = "/vt opt set EnableMeta False";
private const string CmdNavOff = "/vt opt set EnableNav False";
private const string CmdRepeatOn = "/ub playeroption AutoRepeatAttack on";
private const string CmdAttackBar = "/vt setattackbar ";
private const string CmdQuit = "/rc quit";
// System line only (no player sender): "You've banked 1,234 Luminance."
private static readonly Regex KillLine = new(
@"^You've banked [\d,]+ Luminance\.\s*$",
RegexOptions.Compiled | RegexOptions.CultureInvariant);
/// <summary>Why the keeper is idle (<see cref="Snapshot.Gate"/>): "" = it may run.</summary>
private const string GateWorld = "world", GateMaster = "master";
private readonly IltHubContext _ctx;
private readonly object _gate = new();
private Cfg _cfg = new();
private bool _loaded;
private bool _dirty;
private string? _lastGoodJson;
// Seams (the tests fake them): the master switch, what RynthAi is doing, the clock, the gem use.
internal Func<bool> MasterEnabled;
internal Func<RynthAiActivity?> Activity;
internal Func<long> Clock = () => IltHubContext.NowMs;
/// <summary>Uses the named gem from the pack; false when the pack has none.</summary>
internal Func<string, bool> UseGem;
// Runtime (pump thread).
private long _outSinceMs;
private long _lastRecallMs;
private long _clockStartMs;
private long _realKillMs;
private bool _wasInside;
private bool _quitSent;
private long _lastWarnMs = -WarnEveryMs;
private string _publishedGate = "?";
private string _state = "paused"; // paused / setup / in / out / portal / nogem
private long? _quitLeftMs;
private bool? _presentBefore;
private long _idleSecs;
private long _inSinceMs;
private long _portalSinceMs;
private int _kills;
private long _dungeonSecs;
private long _lastTickMs;
// Snapshot for the render thread (copied under _gate).
private Snapshot _snap = Snapshot.Empty;
public IltVaultedDungeons(IltHubContext ctx)
{
_ctx = ctx;
MasterEnabled = () => _ctx.Ai.VaultedDungeonsEnabled;
Activity = () => _ctx.Ai.Activity();
UseGem = gemName =>
{
var gem = _ctx.Inventory.FindByName(n => n.Equals(gemName, StringComparison.OrdinalIgnoreCase));
if (gem == null) return false;
_ctx.Inventory.Use(gem);
return true;
};
}
/// <summary>Whether the keeper is running (tests, status).</summary>
internal bool IsActive => _cfg.Active;
private long Now() => Clock();
/// <summary>
/// The two hard rules, asked fresh each time: an ILT-like world, and the master switch on.
/// <paramref name="gate"/> says which one failed ("" when allowed).
/// </summary>
private bool Allowed(out string gate)
{
gate = !_ctx.Options.IsIltLikeWorld ? GateWorld : !MasterEnabled() ? GateMaster : string.Empty;
return gate.Length == 0;
}
/// <summary>Same, for commands and the tab: why the keeper can't be used now (null = it can).</summary>
private static string? GateReply(string gate) => gate switch
{
GateWorld => "Not available on this server (Infinite Leaftide / ACECustom only).",
GateMaster => "Off: turn on \"Vaulted Dungeons\" in Settings > Navigation first (the master switch, off by default).",
_ => null,
};
// ── Persistence ─────────────────────────────────────────────────────────
private string SettingsDir => Path.Combine(_ctx.Store.CharFolder, "VaultedDungeons");
private string SettingsPath => Path.Combine(SettingsDir, SettingsFileName);
private void EnsureLoaded()
{
if (_loaded) return;
_loaded = true;
try
{
string path = SettingsPath;
if (!File.Exists(path)) return;
string text = File.ReadAllText(path);
var cfg = JsonSerializer.Deserialize(text, IltVaultedDungeonsJsonContext.Default.Cfg);
if (cfg == null) return;
_cfg = Sanitize(cfg);
_lastGoodJson = text;
}
catch (Exception ex)
{
RynthLog.Write(LogCat.IltHub, $"Vaulted Dungeons: settings load failed: {ex.Message}");
}
}
private void SaveIfDirty()
{
if (!_dirty) return;
_dirty = false;
try
{
Directory.CreateDirectory(SettingsDir);
string path = SettingsPath;
// Corrupt / mid-write: keep a copy, then rewrite from last good + current cfg.
if (File.Exists(path))
{
try
{
string existing = File.ReadAllText(path);
if (_lastGoodJson == null)
JsonSerializer.Deserialize(existing, IltVaultedDungeonsJsonContext.Default.Cfg); // throws if bad
}
catch
{
try
{
File.Copy(path, Path.Combine(SettingsDir, SettingsBadFileName), overwrite: true);
_ctx.Chat("[Vaulted Dungeons] settings.json would not read — kept a copy as "
+ SettingsBadFileName + ".");
}
catch { /* best effort */ }
}
}
string json = JsonSerializer.Serialize(_cfg, IltVaultedDungeonsJsonContext.Default.Cfg);
File.WriteAllText(path, json);
_lastGoodJson = json;
}
catch (Exception ex)
{
RynthLog.Write(LogCat.IltHub, $"Vaulted Dungeons: settings save failed: {ex.Message}");
}
}
private static Cfg Sanitize(Cfg c)
{
// Never resumed from disk: the file keeps its "active" field, but a relog (or turning the
// master switch back on) starts Off. Auto Start On Arrival is the only way back in by itself.
c.Active = false;
c.Dungeon = ClampInt(c.Dungeon, 0, Dungeons.Length, 0);
c.Gem = ClampInt(c.Gem, 0, GemNames.Length, 0);
c.QuitMinutes = ClampInt(c.QuitMinutes, QuitMin, QuitMax, 2);
c.AttackPower = Powers[PowerIndex(c.AttackPower)].Value;
return c;
}
private static int ClampInt(int v, int lo, int hi, int def)
=> v < lo || v > hi ? def : v;
private static int PowerIndex(float v)
{
int best = 0;
float bestGap = float.MaxValue;
for (int i = 0; i < Powers.Length; i++)
{
float gap = Math.Abs(Powers[i].Value - v);
if (gap < bestGap) { best = i; bestGap = gap; }
}
return best;
}
private static string PowerText(float p)
{
string t = p.ToString("0.##", System.Globalization.CultureInfo.InvariantCulture);
return t;
}
// ── IIltFeature ─────────────────────────────────────────────────────────
public void Tick(long nowMs)
{
// The hard rules first: ILT only, master switch on. Nothing below runs otherwise (not even
// reading the settings file), and a keeper that was running is stopped on the spot.
if (!Allowed(out string gate))
{
StopForGate(gate);
PublishGate(gate);
return;
}
EnsureLoaded();
SaveIfDirty();
// Time in dungeon (kills/hour): only while last state was "in".
if (_lastTickMs > 0 && _state == "in")
_dungeonSecs += Math.Max(0, (nowMs - _lastTickMs) / 1000);
_lastTickMs = nowMs;
if (!_ctx.Host.HasGetPlayerPose || !_ctx.Host.TryGetPlayerPose(out uint cell, out _, out _, out _, out _, out _, out _, out _) || cell == 0)
{
Publish();
return;
}
uint landblock = cell >> 16;
bool portaling = _ctx.Host.HasIsPortaling && _ctx.Host.IsPortaling();
VaultedDungeon? dungeon = _cfg.Dungeon > 0 && _cfg.Dungeon <= Dungeons.Length
? Dungeons[_cfg.Dungeon - 1]
: null;
// Present check (for Auto Start / arrive actions) even while Off.
if (dungeon == null)
_presentBefore = null;
else if (!portaling)
{
bool here = landblock == dungeon.Value.Landblock;
if (here && _presentBefore != true) OnArrive(dungeon.Value, nowMs);
_presentBefore = here;
}
_quitLeftMs = null;
if (!_cfg.Active)
{
_state = "paused";
_outSinceMs = 0;
Publish();
return;
}
string? gemName = _cfg.Gem > 0 && _cfg.Gem <= GemNames.Length ? GemNames[_cfg.Gem - 1] : null;
if (dungeon == null || gemName == null)
{
_state = "setup";
_wasInside = false;
Warn(nowMs, dungeon == null
? "Pick a dungeon in the Vaulted Dungeons tab."
: "Pick a recall gem in the Vaulted Dungeons tab.");
Publish();
return;
}
bool inside = landblock == dungeon.Value.Landblock;
if (inside && !portaling)
{
if (!_wasInside)
{
_clockStartMs = nowMs;
_inSinceMs = nowMs;
}
_wasInside = true;
_outSinceMs = 0;
_portalSinceMs = 0;
_state = "in";
_idleSecs = Math.Max(0, (nowMs - _clockStartMs) / 1000);
if (_cfg.Quit)
{
long quitAfterMs = _cfg.QuitMinutes * 60_000L;
_quitLeftMs = Math.Max(0, quitAfterMs - (nowMs - _clockStartMs));
if (nowMs - _clockStartMs >= quitAfterMs && !_quitSent)
{
// Once per activation, and only if ILT, the master switch and Active are all
// still true right now (asked again: they may have changed since the top of the tick).
string nowGate = string.Empty;
if (!_cfg.Active || !Allowed(out nowGate))
{
StopForGate(nowGate);
PublishGate(nowGate);
return;
}
_quitSent = true;
_ctx.Chat($"[Vaulted Dungeons] No kill in {_cfg.QuitMinutes} minute"
+ (_cfg.QuitMinutes == 1 ? "" : "s") + " — quitting.");
Invoke(CmdQuit);
}
}
Publish();
return;
}
_wasInside = false;
if (portaling)
{
_state = "portal";
_outSinceMs = 0;
if (_portalSinceMs == 0) _portalSinceMs = nowMs;
Publish();
return;
}
_portalSinceMs = 0;
if (_outSinceMs == 0) _outSinceMs = nowMs;
_state = "out";
bool tried = _lastRecallMs >= _outSinceMs;
bool due = (!tried && nowMs - _outSinceMs >= FirstRecallAfterMs)
|| (tried && nowMs - _lastRecallMs >= RecallAfterMs);
if (due)
{
// Not in the middle of a fight, a buff chain or an unanswered use/cast: the recall waits
// (still due, so it goes out on the first clear tick) and says so on the normal cadence.
string? busy = BusyReason();
if (busy != null)
{
_state = "busy";
Warn(nowMs, $"Waiting to use the {gemName}: {busy}.");
}
else if (UseGem(gemName))
{
_lastRecallMs = nowMs;
_ctx.Chat($"[Vaulted Dungeons] Not in {dungeon.Value.Name} — using the {gemName}.");
}
else
{
_state = "nogem";
Warn(nowMs, $"No {gemName} in your pack.");
}
}
Publish();
}
/// <summary>
/// Why a recall gem must not be used now, or null when it may. RynthAi's activity (its "RynthAi.Activity"
/// bits: combat, buffing, loot, salvage, crafting, a use/cast waiting on the server) and the client's
/// busy hourglass; RynthAi not answering counts as busy (nothing is known, so nothing is used).
/// </summary>
private string? BusyReason()
{
RynthAiActivity? a = Activity();
if (a is null) return "RynthAi is not ready";
RynthAiActivity f = a.Value;
if ((f & RynthAiActivity.Combat) != 0) return "RynthAi is in combat";
if ((f & RynthAiActivity.Buffing) != 0) return "RynthAi is buffing";
if ((f & RynthAiActivity.ServerAction) != 0) return "RynthAi is waiting on the server";
if ((f & RynthAiActivity.Looting) != 0) return "RynthAi is looting";
if ((f & RynthAiActivity.Salvaging) != 0) return "RynthAi is salvaging";
if ((f & RynthAiActivity.Crafting) != 0) return "RynthAi is crafting";
if (_ctx.Inventory.IsBusy) return "the client is busy";
return null;
}
/// <summary>
/// A rule failed (not ILT any more, or the master switch went off): a running keeper stops at once
/// and says so once; an idle one has nothing to do. Safe to call every tick.
/// </summary>
private void StopForGate(string gate)
{
_outSinceMs = 0;
_wasInside = false;
_quitLeftMs = null;
_presentBefore = null;
if (!_cfg.Active) return;
_cfg.Active = false;
_dirty = true;
_state = "paused";
_ctx.Chat("[Vaulted Dungeons] Stopped: " + (gate == GateWorld
? "this is not an Infinite Leaftide / ACECustom world."
: "\"Vaulted Dungeons\" was turned off in Settings > Navigation."));
SaveIfDirty();
}
/// <summary>The idle snapshot (only when the reason changes: nothing else runs while gated).</summary>
private void PublishGate(string gate)
{
if (gate == _publishedGate) return;
_publishedGate = gate;
Publish(gate);
}
public bool OnChat(string text)
{
if (string.IsNullOrEmpty(text)) return false;
string line = text.TrimEnd();
bool luminance = KillLine.IsMatch(line);
// A pet-capture success counts as a kill for the timer too (the same replies RynthAi's Pets
// tab matches); nothing else is guessed.
if (!luminance && !PetCaptureLines.IsSuccess(line)) return false;
if (!_cfg.Active || !Allowed(out _)) return false;
NoteKill(Now(), countKill: luminance);
return false; // never eat the luminance line
}
/// <summary>
/// The server's killer notification: this character landed a killing blow (RynthILTPlugin
/// .OnKillNotification, pump thread). Restarts the no-kill timer, like the luminance line.
/// </summary>
public void OnKillNotification()
{
if (!_cfg.Active || !Allowed(out _)) return;
NoteKill(Now(), countKill: false);
}
/// <summary>Restarts the Kill Client timer. The kill counter moves only on the luminance line (one per kill).</summary>
private void NoteKill(long now, bool countKill)
{
_clockStartMs = now;
_realKillMs = now;
if (countKill && _state == "in") _kills++;
Publish();
}
public void OnLogout()
{
// Logging out ends the run: Active is never carried over (see Sanitize).
_cfg.Active = false;
SaveIfDirty();
_wasInside = false;
_outSinceMs = 0;
_presentBefore = null;
_state = "paused";
Publish();
}
// ── Arrive / commands ───────────────────────────────────────────────────
private void OnArrive(VaultedDungeon dungeon, long nowMs)
{
// Only called while ILT and the master switch are on (Tick's gate), so Auto Start is honoured here only.
if (_cfg.AutoStart && !_cfg.Active)
{
Activate(nowMs);
_ctx.Chat($"[Vaulted Dungeons] Arrived in {dungeon.Name} — switched On (Auto Start On Arrival).");
}
// The arrival settings are part of running the keeper: nothing is sent while it is Off.
if (!_cfg.Active) return;
if (_cfg.DisableMeta) Invoke(CmdMetaOff);
if (_cfg.DisableNav) Invoke(CmdNavOff);
if (_cfg.RepeatAttack) Invoke(CmdRepeatOn);
if (_cfg.SetPower) Invoke(CmdAttackBar + PowerText(_cfg.AttackPower));
}
private void Invoke(string cmd)
{
if (_ctx.Host.HasInvokeChatParser) _ctx.Host.InvokeChatParser(cmd);
}
private void Warn(long nowMs, string text)
{
if (nowMs - _lastWarnMs < WarnEveryMs) return;
_lastWarnMs = nowMs;
_ctx.Chat("[Vaulted Dungeons] " + text);
}
/// <summary>Pump-thread: /ilt vaulted [on|off|toggle|status].</summary>
public bool HandleCommand(string[] args)
{
// ILT only, master switch on: otherwise the only answer is why (the keeper itself stays idle).
if (!Allowed(out string gate))
{
if (_cfg.Active) StopForGate(gate);
_ctx.Chat("[Vaulted Dungeons] " + GateReply(gate));
return true;
}
EnsureLoaded();
string sub = args.Length > 0 ? args[0].ToLowerInvariant() : "status";
switch (sub)
{
case "on":
case "start":
SetActive(true);
return true;
case "off":
case "stop":
SetActive(false);
_ctx.Chat("[Vaulted Dungeons] Off.");
return true;
case "toggle":
SetActive(!_cfg.Active);
if (!_cfg.Active) _ctx.Chat("[Vaulted Dungeons] Off.");
return true;
default:
string d = _cfg.Dungeon > 0 && _cfg.Dungeon <= Dungeons.Length
? Dungeons[_cfg.Dungeon - 1].Name : "(none)";
string g = _cfg.Gem > 0 && _cfg.Gem <= GemNames.Length
? GemNames[_cfg.Gem - 1] : "(none)";
_ctx.Chat($"[Vaulted Dungeons] {(_cfg.Active ? "On" : "Off")} — dungeon={d}, gem={g}, "
+ $"kill-client={(_cfg.Quit ? $"{_cfg.QuitMinutes}m" : "off")}, state={_state}.");
_ctx.Chat("[Vaulted Dungeons] /ilt vaulted [on|off|toggle|status] (Mini Remote tab; master switch: Settings > Navigation > Vaulted Dungeons)");
return true;
}
}
/// <summary>Starts the keeper (the player's own action, or Auto Start On Arrival). Pump thread; ILT and master already checked.</summary>
private void Activate(long nowMs)
{
_cfg.Active = true;
_dirty = true;
_outSinceMs = 0;
_wasInside = false; // the no-kill clock starts when the first in-dungeon tick sees us inside
_clockStartMs = nowMs;
_quitSent = false; // /rc quit: once per activation
_lastRecallMs = 0;
Publish();
}
private void SetActive(bool value)
{
if (value)
{
// From the tab's button too (posted to the pump): re-check, the switch may have gone off since.
if (!Allowed(out string gate))
{
_ctx.Chat("[Vaulted Dungeons] " + GateReply(gate));
return;
}
EnsureLoaded();
if (!_cfg.Active)
{
Activate(Now());
_ctx.Chat("[Vaulted Dungeons] On.");
}
return;
}
_cfg.Active = false;
_outSinceMs = 0;
_dirty = true;
_clockStartMs = Now();
_wasInside = false;
_quitLeftMs = null;
_state = "paused";
Publish();
}
// ── Render snapshot ─────────────────────────────────────────────────────
private void Publish(string gate = "")
{
_publishedGate = gate;
lock (_gate)
{
_snap = new Snapshot(
_cfg.Active, _cfg.Dungeon, _cfg.Gem, _cfg.Quit, _cfg.QuitMinutes,
_cfg.ShowInDungeon, _cfg.AutoStart, _cfg.DisableMeta, _cfg.DisableNav,
_cfg.RepeatAttack, _cfg.SetPower, _cfg.AttackPower,
_state, _quitLeftMs, _idleSecs, _inSinceMs, _outSinceMs, _portalSinceMs,
_realKillMs, _kills, _dungeonSecs, Now(), gate);
}
}
private Snapshot Take()
{
lock (_gate) return _snap;
}
// ── UI (render thread) ──────────────────────────────────────────────────
private bool _showAdvanced;
// Pending edits from the UI, applied on the next pump tick via Post.
private void PostEdit(Action<Cfg> edit)
{
_ctx.Post(() =>
{
if (!Allowed(out _)) return; // gated while it waited: an edit changes nothing
EnsureLoaded();
edit(_cfg);
_dirty = true;
Publish();
});
}
public void Render()
{
// Settings load on the pump (Tick); the window only reads the snapshot.
Snapshot s = Take();
Vector4 colLabel = new(0.53f, 0.53f, 0.53f, 1f);
Vector4 colValue = new(1f, 1f, 1f, 1f);
Vector4 colGreen = new(0.27f, 0.80f, 0.40f, 1f);
Vector4 colAmber = new(0.95f, 0.65f, 0.20f, 1f);
Vector4 colRed = new(0.90f, 0.30f, 0.30f, 1f);
Vector4 colPurple = new(0.72f, 0.52f, 0.95f, 1f);
Vector4 colTitleRed = new(0.85f, 0.25f, 0.25f, 1f);
// Title row: Vaulted (red) Dungeons (white) + On/Off + Advanced.
ImGui.TextColored(colTitleRed, "Vaulted");
ImGui.SameLine(0, ImGui.CalcTextSize(" ").X);
ImGui.TextColored(colValue, "Dungeons");
// Not offered right now (the tab is hidden then; this covers a stale frame or a direct open).
if (s.Gate.Length > 0)
{
ImGui.Separator();
ImGui.TextWrapped(GateReply(s.Gate) ?? "Not available.");
return;
}
ImGui.SameLine(0, 16);
Vector4 pill = s.Active ? colGreen : new(0.85f, 0.10f, 0.10f, 1f);
ImGui.PushStyleColor(ImGuiCol.Button, pill);
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, pill);
ImGui.PushStyleColor(ImGuiCol.ButtonActive, pill);
ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(0.05f, 0.05f, 0.05f, 1f));
if (ImGui.SmallButton((s.Active ? " On " : " Off ") + "##vdactive"))
_ctx.Post(() => SetActive(!s.Active));
ImGui.PopStyleColor(4);
if (ImGui.IsItemHovered())
ImGui.SetTooltip(s.Active
? "On: keeping this character in the chosen dungeon.\nClick: turn off."
: "Off: doing nothing.\nClick: turn on.");
ImGui.SameLine();
if (ImGui.SmallButton("Advanced##vdoptions")) _showAdvanced = !_showAdvanced;
ImGui.Separator();
float labelW = ImGui.CalcTextSize("Recall Gem").X + 12;
void Label(string text)
{
ImGui.AlignTextToFramePadding();
ImGui.TextColored(colLabel, text);
ImGui.SameLine(labelW);
}
// Status
var (statusWord, statusCol) = s.State switch
{
"in" => ("In Dungeon", colGreen),
"out" => ("Recalling", colAmber),
"portal" => ("Portal Space", colPurple),
"setup" => ("Setup Needed", colAmber),
"nogem" => ("No Gem", colRed),
"busy" => ("Waiting (busy)", colAmber),
_ => ("Not Running", colRed),
};
long since = s.State == "in" ? s.InSinceMs
: s.State == "out" ? s.OutSinceMs
: s.State == "portal" ? s.PortalSinceMs : 0;
string statusText = statusWord;
if (since > 0)
{
long secs = Math.Max(0, (s.NowMs - since) / 1000);
long h = secs / 3600, m = (secs / 60) % 60, sec = secs % 60;
statusText += h > 0 ? $" ({h}:{m:D2}:{sec:D2})" : $" ({m}:{sec:D2})";
}
Label("Status");
ImGui.TextColored(statusCol, statusText);
// Dungeon combo (0 = pick, 1..N = Dungeons[i-1])
Label("Dungeon");
string[] dungeonChoices = BuildDungeonChoices();
int dungeonIdx = s.Dungeon;
ImGui.SetNextItemWidth(260);
if (ImGui.Combo("##vddungeon", ref dungeonIdx, dungeonChoices, dungeonChoices.Length))
PostEdit(c => { c.Dungeon = dungeonIdx; });
Label("Recall Gem");
string[] gemChoices = { "Pick a gem", GemNames[0], GemNames[1] };
int gemIdx = s.Gem;
ImGui.SetNextItemWidth(260);
if (ImGui.Combo("##vdgem", ref gemIdx, gemChoices, gemChoices.Length))
PostEdit(c => { c.Gem = gemIdx; });
if (ImGui.IsItemHovered())
ImGui.SetTooltip("Tie this gem to the dungeon's portal first.");
Label("Last Kill");
if (s.State == "in" && s.RealKillMs > 0)
ImGui.TextUnformatted($"{(s.NowMs - s.RealKillMs) / 1000} s ago");
else
ImGui.TextUnformatted("-");
Label("Session");
string perHour = s.DungeonSecs < 60 ? "-"
: Commas((long)(s.Kills * 3600.0 / Math.Max(1, s.DungeonSecs)));
ImGui.TextUnformatted($"{Commas(s.Kills)} kills ({perHour} Per Hour)");
if (s.QuitLeftMs is long left && s.QuitMinutes > 0)
{
float frac = (float)(left / (double)(s.QuitMinutes * 60_000L));
string barLabel = $"Kill Client ({left / 60_000}:{(left / 1000) % 60:D2})";
ImGui.ProgressBar(Math.Clamp(frac, 0f, 1f), new Vector2(-1, ImGui.GetTextLineHeight()), barLabel);
}
if (_showAdvanced)
{
ImGui.Separator();
ImGui.TextColored(colValue, "Advanced");
bool quit = s.Quit;
if (ImGui.Checkbox("Kill Client##vdquit", ref quit))
{
bool on = quit;
_ctx.Post(() =>
{
if (!Allowed(out _)) return;
EnsureLoaded();
_cfg.Quit = on;
_cfg.QuitMinutes = ClampInt(_cfg.QuitMinutes, QuitMin, QuitMax, 2);
_clockStartMs = Now();
_dirty = true;
Publish();
});
}
if (ImGui.IsItemHovered())
ImGui.SetTooltip("No kill for the set minutes in the dungeon: /rc quit closes the client (once per run).\n"
+ "The timer restarts on the server's \"You've banked N Luminance.\" line, on your own killing blow,\n"
+ "and on a successful pet capture. Kills by pets or fellows that pay you no luminance\n"
+ "do NOT restart it, so keep the minutes generous if you hunt with pets.");
ImGui.SameLine();
ImGui.TextColored(colLabel, "after");
ImGui.SameLine();
if (ImGui.SmallButton($"{s.QuitMinutes} minute{(s.QuitMinutes == 1 ? "" : "s")}##vdmincycle"))
_ctx.Post(() =>
{
if (!Allowed(out _)) return;
EnsureLoaded();
_cfg.QuitMinutes = StepPreset(_cfg.QuitMinutes, +1);
_clockStartMs = Now();
_dirty = true;
Publish();
});
if (ImGui.IsItemClicked(ImGuiMouseButton.Right))
_ctx.Post(() =>
{
if (!Allowed(out _)) return;
EnsureLoaded();
_cfg.QuitMinutes = StepPreset(_cfg.QuitMinutes, -1);
_clockStartMs = Now();
_dirty = true;
Publish();
});
if (ImGui.IsItemHovered())
ImGui.SetTooltip("Minutes with no kill before Kill Client quits.\nClick: longer. Right-click: shorter. (1, 2, 5, 10, 15, 30)");
BoolRow("Auto Start On Arrival##vdautostart", s.AutoStart,
v => PostEdit(c => c.AutoStart = v),
"Switch On by itself when you arrive in the chosen dungeon (logging in there counts).");
BoolRow("Disable Meta##vdnometa", s.DisableMeta,
v => PostEdit(c => c.DisableMeta = v),
"On arriving: " + CmdMetaOff);
BoolRow("Disable Nav##vdnonav", s.DisableNav,
v => PostEdit(c => c.DisableNav = v),
"On arriving: " + CmdNavOff);
BoolRow("Repeat Attacks On##vdrepeat", s.RepeatAttack,
v => PostEdit(c => c.RepeatAttack = v),
"On arriving: " + CmdRepeatOn);
BoolRow("Set Attack Power##vdpower", s.SetPower,
v => PostEdit(c => c.SetPower = v),
"On arriving: " + CmdAttackBar + PowerText(s.AttackPower));
ImGui.SameLine();
int pi = PowerIndex(s.AttackPower);
if (ImGui.SmallButton(Powers[pi].Name + "##vdpowercycle"))
PostEdit(c => c.AttackPower = Powers[(pi + 1) % Powers.Length].Value);
if (ImGui.IsItemClicked(ImGuiMouseButton.Right))
PostEdit(c => c.AttackPower = Powers[(pi - 1 + Powers.Length) % Powers.Length].Value);
if (ImGui.IsItemHovered())
ImGui.SetTooltip("Fast (0), Medium (0.5) or Full Power (1).\nClick: next. Right-click: back.");
}
ImGui.Spacing();
ImGui.TextDisabled("Note: the client sees the landblock, not the layer - standing in the retail copy also counts as \"in it\".");
ImGui.TextDisabled("Kill Client: pet or fellow kills that pay you no luminance do not restart its timer.");
ImGui.TextDisabled("Recalls wait while RynthAi is in combat, buffing or waiting on the server.");
ImGui.TextDisabled("/ilt vaulted [on|off|toggle|status]");
}
private static void BoolRow(string id, bool value, Action<bool> set, string tip)
{
bool v = value;
if (ImGui.Checkbox(id, ref v)) set(v);
if (ImGui.IsItemHovered()) ImGui.SetTooltip(tip);
}
private static string[] BuildDungeonChoices()
{
var list = new string[Dungeons.Length + 1];
list[0] = "Pick a dungeon";
for (int i = 0; i < Dungeons.Length; i++) list[i + 1] = Dungeons[i].Name;
return list;
}
private static int StepPreset(int current, int dir)
{
if (dir > 0)
{
foreach (int m in QuitPresets) if (m > current) return m;
return QuitPresets[0];
}
for (int i = QuitPresets.Length - 1; i >= 0; i--)
if (QuitPresets[i] < current) return QuitPresets[i];
return QuitPresets[^1];
}
private static string Commas(long n)
{
string s = Math.Abs(n).ToString();
var chars = new List<char>();
for (int i = 0; i < s.Length; i++)
{
if (i > 0 && (s.Length - i) % 3 == 0) chars.Add(',');
chars.Add(s[i]);
}
return (n < 0 ? "-" : "") + new string(chars.ToArray());
}
// ── Config / snapshot types ─────────────────────────────────────────────
// internal (not private) so the source-generated IltVaultedDungeonsJsonContext can reach it.
internal sealed class Cfg
{
public bool Active { get; set; }
/// <summary>0 = none, 1..N = Dungeons index.</summary>
public int Dungeon { get; set; }
/// <summary>0 = none, 1 = primary, 2 = secondary.</summary>
public int Gem { get; set; }
public bool Quit { get; set; }
public int QuitMinutes { get; set; } = 2;
public bool ShowInDungeon { get; set; }
public bool AutoStart { get; set; }
public bool DisableMeta { get; set; }
public bool DisableNav { get; set; }
public bool RepeatAttack { get; set; }
public bool SetPower { get; set; }
public float AttackPower { get; set; }
}
private readonly record struct Snapshot(
bool Active, int Dungeon, int Gem, bool Quit, int QuitMinutes,
bool ShowInDungeon, bool AutoStart, bool DisableMeta, bool DisableNav,
bool RepeatAttack, bool SetPower, float AttackPower,
string State, long? QuitLeftMs, long IdleSecs, long InSinceMs, long OutSinceMs, long PortalSinceMs,
long RealKillMs, int Kills, long DungeonSecs, long NowMs, string Gate)
{
/// <summary>Before the first tick (the tab is only offered while the keeper may run).</summary>
public static Snapshot Empty => new(false, 0, 0, false, 2,
false, false, false, false, false, false, 0f,
"paused", null, 0, 0, 0, 0, 0, 0, 0, 0, string.Empty);
}
}
// Source-generated JSON only: the NativeAOT build (what the installer ships) has reflection-based
// serialization turned off, so JsonSerializer.Deserialize<Cfg>(text, options) failed there and the
// Vaulted Dungeons settings never loaded or saved. Same file format as before (camelCase,
// indented, nulls left out, case-sensitive property names on read).
[JsonSerializable(typeof(IltVaultedDungeons.Cfg))]
[JsonSourceGenerationOptions(
WriteIndented = true,
PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
internal partial class IltVaultedDungeonsJsonContext : JsonSerializerContext { }

View file

@ -123,6 +123,44 @@ internal sealed unsafe class RynthAiClient
}
}
// ── Vaulted Dungeons (master switch, activity) ──────────────────────────
/// <summary>
/// RynthAi's "Vaulted Dungeons" setting (Settings > Navigation): the master switch of the Vaulted
/// Dungeons keeper, and the only place it is stored. False when RynthAi isn't loaded, is older than
/// the call, hasn't logged in, or has it off (the default): the keeper then does nothing. Any thread.
/// </summary>
public bool VaultedDungeonsEnabled
{
get
{
var t = AnyThreadTable;
return t != null && RynthAiHubApiV1.Has(t, RynthAiHubApiV1.VaultedDungeonsEnabledOffset)
&& t->VaultedDungeonsEnabled != null && t->VaultedDungeonsEnabled() != 0;
}
}
/// <summary>
/// What RynthAi is doing now (its "RynthAi.Activity" interface: combat, buffing, loot, a use or cast
/// waiting on the server...); null when RynthAi isn't loaded or isn't ready. Resolved again every
/// call, as that interface requires (a RynthAi reload frees its table). Pump thread.
/// </summary>
public RynthAiActivity? Activity()
{
if (!_host.HasGetPluginInterface) return null;
try
{
var act = (RynthAiActivityApiV1*)_host.GetPluginInterface(RynthAiHub.PluginName, RynthAiActivityApiV1.InterfaceName, RynthAiActivityApiV1.InterfaceVersion);
if (act == null || act->Version < 1 || act->StructSize < (uint)sizeof(RynthAiActivityApiV1) || act->GetActivityFlags == null) return null;
uint flags = 0;
return act->GetActivityFlags(&flags) != 0 ? (RynthAiActivity)flags : null;
}
catch
{
return null; // a RynthAi mid-reload: not there this tick
}
}
// ── Quests (/myquests) ──────────────────────────────────────────────────
/// <summary>A /myquests flag from RynthAi's tracker (pump thread).</summary>

View file

@ -56,6 +56,10 @@
<!-- The two interfaces between RynthILT and RynthAi (linked into both plugins). -->
<Compile Include="..\Shared\RynthIltHubApi.cs" Link="Shared\RynthIltHubApi.cs" />
<Compile Include="..\Shared\RynthAiHubApi.cs" Link="Shared\RynthAiHubApi.cs" />
<!-- "RynthAi.Activity": what the bot is doing (the Vaulted Dungeons keeper waits out combat and buffing). -->
<Compile Include="..\Shared\RynthAiActivityApi.cs" Link="Shared\RynthAiActivityApi.cs" />
<!-- The pet-capture success lines (shared with RynthAi's Pets tab): they count as a kill for Vaulted Dungeons' timer. -->
<Compile Include="..\Shared\PetCaptureLines.cs" Link="Shared\PetCaptureLines.cs" />
<!-- "RynthILT.Data": the charms list and bank balances for other plugins (DataInterface.cs). -->
<Compile Include="..\Shared\RynthIltDataApi.cs" Link="Shared\RynthIltDataApi.cs" />
<!-- RynthCore's server list (API v86): the ILT verdict the Hub follows (IltSettingsView/). -->

View file

@ -520,7 +520,11 @@ public sealed class RynthILTPlugin : RynthPluginBase
}
// The server's killer notification: this character landed the killing blow.
public override void OnKillNotification(string? deathMessage) => _bounties?.OnKill();
public override void OnKillNotification(string? deathMessage)
{
_bounties?.OnKill();
_hub?.OnKillNotification();
}
private void DrainTypedBounty()
{
@ -674,6 +678,15 @@ public sealed class RynthILTPlugin : RynthPluginBase
case "hub":
case "rates":
break;
case "vaulted":
case "vaulteddungeons":
{
// "/ilt vaulted [on|off|toggle|status]": the Vaulted Dungeons keeper (ILT only; the
// module answers "not available" elsewhere, and while the master switch is off).
if (_hub == null) { ChatLine("[RynthILT] ILT features not ready (log in first)."); return; }
_hub.VaultedDungeons.HandleCommand(args);
return;
}
case "settings":
case "options":
{
@ -694,6 +707,7 @@ public sealed class RynthILTPlugin : RynthPluginBase
case "help":
ChatLine("[RynthILT] /ilt hub ... (the Mini Remote's ILT tabs; same as /ra hub ...), /ilt guardian ..., /ilt servers [list|<names>|default],");
ChatLine("[RynthILT] /ilt bounty [list|refresh] - the tracked ACECustom bounties (the Bounties window: the ILT button on the RynthCore bar, or /rc bounties),");
ChatLine("[RynthILT] /ilt vaulted [on|off|toggle|status] - Vaulted Dungeons keeper (ILT only; master switch: RynthAi Settings > Navigation > Vaulted Dungeons, off by default),");
ChatLine("[RynthILT] /ilt settings [show|hide|toggle] - the ILT settings: the world verdict, the ILT world names and the server's features (force a server: RynthCore Options > Diagnostics),");
ChatLine("[RynthILT] /ilt fellow [show|hide|toggle] - ILT's /fship commands as buttons (also in the Mini Remote's Fellowship section),");
ChatLine("[RynthILT] /ilt trace <category|all|list> [on|off], /ilt debug [on|off].");