feat: port SK test branch (2026.10.18.24) onto sk
Squash of test/hotbuild-2026-10-16 as merged onto aelrynth main 2026.10.17.1, matching the 2026.10.18.24 test installer. The test branch wins where both changed the same lines; sk-only changes kept; duplicate features cut to the test branch's copy. RynthAi HandWrittenVersion stays 0.5.0-legacy-ui on sk. Highlights: RynthOracle 0.6.0 (Legendary, Markers, Dynamic Stamps and Temple guardians merged into the Quests list, RynthNav Go to), RynthILT 0.2.20 (ub-IT auto-chunk rules, rating level, RynthILT.Data v3), RynthAi ub-IT /ub and VT/MT meta compatibility and the loot attribute checklist, RynthNav destination alternatives. Changelog/2026-10-18-sk-port-test-branch-2026.10.18.24.md.
This commit is contained in:
parent
23efcfee87
commit
7797901d69
287 changed files with 22602 additions and 1090 deletions
|
|
@ -1,7 +1,8 @@
|
|||
// DataInterface.cs - RynthILT's side of the "RynthILT.Data" interface (Plugins/Shared/RynthIltDataApi.cs):
|
||||
// the charms list and the bank balances (every character RynthILT has seen on this server) the
|
||||
// Mini Remote's Charms and Banking tabs show, for other plugins to draw, with the charm Toggle and
|
||||
// the bank verbs they send back; since version 2 also the pet breeding tracker's JSON and verbs.
|
||||
// the bank verbs they send back; since version 2 also the pet breeding tracker's JSON and verbs;
|
||||
// since version 3 the Temple guardians' JSON and verbs (RynthOracle's Quests tab).
|
||||
//
|
||||
// The table is allocated once per loaded copy of RynthILT and never freed (a plugin DLL is never
|
||||
// unloaded); after Release() it reports Version 0 and every function answers 0. Before login there
|
||||
|
|
@ -37,6 +38,8 @@ internal static unsafe class DataInterface
|
|||
t->BankCommand = &BankCommand;
|
||||
t->GetPetBreedingJson = &GetPetBreedingJson;
|
||||
t->PetBreedingCommand = &PetBreedingCommand;
|
||||
t->GetGuardianJson = &GetGuardianJson;
|
||||
t->GuardianCommand = &GuardianCommand;
|
||||
t->Version = RynthIltDataApiV1.InterfaceVersion;
|
||||
_table = t;
|
||||
}
|
||||
|
|
@ -128,6 +131,32 @@ internal static unsafe class DataInterface
|
|||
catch { return 0; }
|
||||
}
|
||||
|
||||
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
|
||||
private static int GetGuardianJson(byte* buffer, int capacity)
|
||||
{
|
||||
try
|
||||
{
|
||||
string? json = Hub?.GuardianJson;
|
||||
return string.IsNullOrEmpty(json) ? 0 : ProfileInterface.Write(json, buffer, capacity);
|
||||
}
|
||||
catch { return 0; }
|
||||
}
|
||||
|
||||
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
|
||||
private static int GuardianCommand(byte* utf8)
|
||||
{
|
||||
try
|
||||
{
|
||||
IltHubController? hub = Hub;
|
||||
if (hub == null) return 0;
|
||||
string? line = ReadVerb(utf8);
|
||||
if (line == null) return 0;
|
||||
hub.RequestGuardianVerb(line);
|
||||
return 1;
|
||||
}
|
||||
catch { return 0; }
|
||||
}
|
||||
|
||||
/// <summary>A reader's verb line, or null when it is empty, too long or not plain ASCII (no control characters reach a chat command).</summary>
|
||||
private static string? ReadVerb(byte* utf8)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,16 +1,27 @@
|
|||
// 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 Aetheria has its
|
||||
// level from loot too, so the cap applies to it (it used to skip the cap and could
|
||||
// chunk a level 10 piece).
|
||||
// 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 on ILT: the server answers "done" with no result line. Matching
|
||||
// them by name ending used the Flaming Lugian Hammer on Silentkelpie's 9 Coalesced Aetheria,
|
||||
|
|
@ -58,6 +69,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;
|
||||
|
|
@ -79,66 +94,248 @@ 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);
|
||||
|
||||
/// <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.
|
||||
/// </summary>
|
||||
internal static string? AetheriaSkip(IltGearState g, in AetheriaFacts f)
|
||||
{
|
||||
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 UnderChunkCap(inv.Int(wo, IltInventory.IntItemMaxLevel), G.ChunkAetheriaUnderLevel);
|
||||
if (inv.IsEquipped(wo)) return "equipped";
|
||||
if (!inv.HasAppraisal(wo)) { inv.RequestAppraisal(wo); return Appraising; }
|
||||
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));
|
||||
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 max level (int 319) is under the cap. Coalesced Aetheria has its level
|
||||
/// from loot (ACECustom rolls 1-10; level 6+ can carry a rating), so it gets the same cap.
|
||||
/// 0 = no level read: never chunked. 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) => maxLevel > 0 && maxLevel < ClampUnderLevel(under);
|
||||
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 (any rating above 0 with
|
||||
/// its keep switch on). Pure: the tests drive it.
|
||||
/// 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>
|
||||
/// 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)
|
||||
{
|
||||
// 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; }
|
||||
var f = new CorruptedFacts
|
||||
{
|
||||
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 = G.KeepCorruptedAnySpell || !string.IsNullOrWhiteSpace(G.KeepCorruptedSpellIds)
|
||||
? 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()
|
||||
{
|
||||
|
|
@ -155,23 +352,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;
|
||||
|
|
@ -300,6 +511,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
|
||||
|
|
@ -343,6 +569,7 @@ internal sealed class IltChunkClap : IIltFeature
|
|||
{
|
||||
_waitingOn = 0;
|
||||
_skip.Clear();
|
||||
_lastSkip.Clear();
|
||||
_manualPass = false;
|
||||
_clapWasEnabled = false;
|
||||
}
|
||||
|
|
@ -361,7 +588,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())
|
||||
ImGui.SetTooltip($"Infinite Leaftide aetheria goes up to level {IltInventory.AetheriaMaxLevel}; {IltInventory.AetheriaMaxLevel + 1} chunks every level.\nApplies to Coalesced Aetheria too: it has its level before it is revealed.");
|
||||
ImGui.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();
|
||||
|
|
@ -373,6 +600,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");
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
// nearest vendor (VendorBuy). Runs as a small pump-thread state machine with timeouts; the
|
||||
// client busy state is respected between steps.
|
||||
// * Attribute tracker: IltTempleAttributes.
|
||||
// * Reader: the same state as JSON with verbs back ("RynthILT.Data" version 3), for RynthOracle's
|
||||
// Quests tab. The automation (auto hand-in, buy if missing) stays here either way.
|
||||
//
|
||||
// Threading: OnChat / Tick / commands run on the pump thread; Render only reads volatile fields
|
||||
// and posts actions through IltHubContext.Post.
|
||||
|
|
@ -426,6 +428,90 @@ internal sealed class IltGuardian : IIltFeature
|
|||
}
|
||||
}
|
||||
|
||||
// ── Reader ("RynthILT.Data" GetGuardianJson / GuardianCommand; RynthOracle's Quests tab) ──
|
||||
|
||||
/// <summary>
|
||||
/// The reader JSON (Plugins/Shared/RynthIltDataApi.cs header has the shape): the switches, the
|
||||
/// last answer and hand-in status, and the attribute turn-in rows. Built on demand: everything it
|
||||
/// reads is volatile or an immutable snapshot. Any thread.
|
||||
/// </summary>
|
||||
public string ReaderJson(string world)
|
||||
{
|
||||
TimeSpan age = LastAnswerAge;
|
||||
return BuildJson(world, S.AutoDetectFromChat, S.AutoHandIn, S.BuyMissingFromVendor, S.CooldownHoursAssumed,
|
||||
_lastAnswer, _lastNpc, age == TimeSpan.MaxValue ? -1 : (long)age.TotalSeconds,
|
||||
IltGuardianPhrasebook.MessageOf(_lastLine), HandInRunning, _handInStatus, Attributes.SyncedUtc, Attributes.Snapshot);
|
||||
}
|
||||
|
||||
/// <summary>The reader JSON from its parts. Pure: the tests drive it.</summary>
|
||||
internal static string BuildJson(string world, bool chat, bool auto, bool buy, int cooldownHours,
|
||||
string answer, string npc, long answerAgeSec, string heard, bool running, string status,
|
||||
DateTime syncedUtc, System.Collections.Generic.IReadOnlyList<IltTempleAttrStatus> rows)
|
||||
{
|
||||
var sb = new System.Text.StringBuilder(1024);
|
||||
sb.Append("{\"available\":true");
|
||||
Str(sb, "world", world);
|
||||
sb.Append(",\"chat\":").Append(chat ? "true" : "false");
|
||||
sb.Append(",\"auto\":").Append(auto ? "true" : "false");
|
||||
sb.Append(",\"buy\":").Append(buy ? "true" : "false");
|
||||
sb.Append(",\"cooldownHours\":").Append(cooldownHours);
|
||||
Str(sb, "answer", answer);
|
||||
Str(sb, "npc", npc);
|
||||
sb.Append(",\"answerAgeSec\":").Append(answerAgeSec);
|
||||
Str(sb, "heard", heard);
|
||||
sb.Append(",\"running\":").Append(running ? "true" : "false");
|
||||
Str(sb, "status", status);
|
||||
Str(sb, "synced", syncedUtc == DateTime.MinValue ? "" : syncedUtc.ToString("yyyy-MM-ddTHH:mm:ssZ", System.Globalization.CultureInfo.InvariantCulture));
|
||||
sb.Append(",\"rows\":[");
|
||||
for (int i = 0; i < rows.Count; i++)
|
||||
{
|
||||
IltTempleAttrStatus r = rows[i];
|
||||
if (i > 0) sb.Append(',');
|
||||
sb.Append('{');
|
||||
Str(sb, "attribute", r.Attribute, first: true);
|
||||
Str(sb, "npc", r.Npc);
|
||||
sb.Append(",\"count\":").Append(r.Count);
|
||||
Str(sb, "status", r.Status);
|
||||
Str(sb, "eta", r.Eta);
|
||||
sb.Append(",\"ready\":").Append(r.Ready ? "true" : "false");
|
||||
sb.Append(",\"exact\":").Append(r.FromMyQuests ? "true" : "false");
|
||||
sb.Append('}');
|
||||
}
|
||||
sb.Append("]}");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static void Str(System.Text.StringBuilder sb, string name, string? value, bool first = false)
|
||||
{
|
||||
if (!first) sb.Append(',');
|
||||
sb.Append('"').Append(name).Append("\":\"").Append(IltStyle.JsonEscape(value ?? string.Empty)).Append('"');
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A reader's verb line (header of Plugins/Shared/RynthIltDataApi.cs): handin | stop | refresh |
|
||||
/// chat on|off | auto on|off | buy on|off. The reader shows the new state, so the switches don't
|
||||
/// echo in chat; hand-in and refresh report as the Guardian window's buttons do. Pump thread.
|
||||
/// </summary>
|
||||
public void RunVerb(string line)
|
||||
{
|
||||
string[] parts = line.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||||
if (parts.Length == 0) return;
|
||||
string arg = parts.Length > 1 ? parts[1] : "";
|
||||
switch (parts[0].ToLowerInvariant())
|
||||
{
|
||||
case "handin": StartHandIn(_lastAnswer, _lastNpc, asked: true); break;
|
||||
case "stop": StopHandIn(); break;
|
||||
case "refresh": _ctx.Chat("[ILT Guardian] " + Attributes.Refresh()); break;
|
||||
case "chat": S.AutoDetectFromChat = Toggle(arg, S.AutoDetectFromChat); break;
|
||||
case "auto": S.AutoHandIn = Toggle(arg, S.AutoHandIn); break;
|
||||
case "buy": S.BuyMissingFromVendor = Toggle(arg, S.BuyMissingFromVendor); break;
|
||||
default:
|
||||
RynthLog.Trace(LogCat.IltHub, $"[IltGuardian] reader verb ignored: {line}");
|
||||
return;
|
||||
}
|
||||
RynthLog.Write(LogCat.IltHub, $"[IltGuardian] reader verb: {line}");
|
||||
}
|
||||
|
||||
private static bool Toggle(string mode, bool current) => mode.Trim().ToLowerInvariant() switch
|
||||
{
|
||||
"on" or "true" or "1" or "show" => true,
|
||||
|
|
|
|||
|
|
@ -168,6 +168,20 @@ internal sealed class IltHubController
|
|||
Breeding.RunVerb(line);
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// The Temple guardian JSON ("RynthILT.Data" GetGuardianJson): switches, last answer, hand-in
|
||||
/// status and attribute turn-ins. "" off an ILT world. Any thread.
|
||||
/// </summary>
|
||||
public string GuardianJson => _ctx.Options.IsIltLikeWorld ? Guardian.ReaderJson(_ctx.Options.WorldName) : string.Empty;
|
||||
|
||||
/// <summary>A reader's guardian verb line, posted to the pump (IltGuardian.RunVerb). Any thread.</summary>
|
||||
public void RequestGuardianVerb(string line)
|
||||
=> _ctx.Post(() =>
|
||||
{
|
||||
if (!_ctx.Options.IsIltLikeWorld) return;
|
||||
Guardian.RunVerb(line);
|
||||
});
|
||||
|
||||
/// <summary>A reader's bank verb line, posted to the pump (IltBanking.RunVerb). Any thread.</summary>
|
||||
public void RequestBankVerb(string line)
|
||||
=> _ctx.Post(() =>
|
||||
|
|
@ -426,7 +440,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;
|
||||
|
|
|
|||
|
|
@ -218,6 +218,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 > 0).</summary>
|
||||
public bool KeepCorruptedCrushingBlow;
|
||||
/// <summary>Never chunk a corrupted weapon with Biting Strike (CriticalMultiplier float 136 > 0).</summary>
|
||||
public bool KeepCorruptedBitingStrike;
|
||||
/// <summary>Never chunk a corrupted weapon with Armor Cleaving (IgnoreArmor float 155 > 0).</summary>
|
||||
public bool KeepCorruptedArmorCleaving;
|
||||
/// <summary>Never chunk a corrupted weapon with any slayer (SlayerCreatureType int 166 > 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 > 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;
|
||||
|
|
|
|||
|
|
@ -58,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;
|
||||
|
|
@ -190,6 +211,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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
@ -116,7 +118,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;
|
||||
|
|
@ -124,15 +127,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 =>
|
||||
{
|
||||
|
|
@ -151,15 +155,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)
|
||||
{
|
||||
|
|
@ -169,8 +194,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>
|
||||
|
|
@ -252,6 +295,7 @@ internal sealed class IltProgression : IIltFeature
|
|||
lock (_augLevels) _augLevels.Clear();
|
||||
_augAutoTried = false;
|
||||
_augRefreshAgain = false;
|
||||
_augProbeRetryDone = false;
|
||||
_augPassiveUntilMs = 0;
|
||||
_augStatus = "not loaded";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ internal sealed class IltVaultedDungeons : IIltFeature
|
|||
string path = SettingsPath;
|
||||
if (!File.Exists(path)) return;
|
||||
string text = File.ReadAllText(path);
|
||||
var cfg = JsonSerializer.Deserialize<Cfg>(text, JsonOpts);
|
||||
var cfg = JsonSerializer.Deserialize(text, IltVaultedDungeonsJsonContext.Default.Cfg);
|
||||
if (cfg == null) return;
|
||||
_cfg = Sanitize(cfg);
|
||||
_lastGoodJson = text;
|
||||
|
|
@ -136,7 +136,7 @@ internal sealed class IltVaultedDungeons : IIltFeature
|
|||
{
|
||||
string existing = File.ReadAllText(path);
|
||||
if (_lastGoodJson == null)
|
||||
JsonSerializer.Deserialize<Cfg>(existing, JsonOpts); // throws if bad
|
||||
JsonSerializer.Deserialize(existing, IltVaultedDungeonsJsonContext.Default.Cfg); // throws if bad
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -149,7 +149,7 @@ internal sealed class IltVaultedDungeons : IIltFeature
|
|||
catch { /* best effort */ }
|
||||
}
|
||||
}
|
||||
string json = JsonSerializer.Serialize(_cfg, JsonOpts);
|
||||
string json = JsonSerializer.Serialize(_cfg, IltVaultedDungeonsJsonContext.Default.Cfg);
|
||||
File.WriteAllText(path, json);
|
||||
_lastGoodJson = json;
|
||||
}
|
||||
|
|
@ -159,12 +159,6 @@ internal sealed class IltVaultedDungeons : IIltFeature
|
|||
}
|
||||
}
|
||||
|
||||
private static readonly JsonSerializerOptions JsonOpts = new()
|
||||
{
|
||||
WriteIndented = true,
|
||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
};
|
||||
|
||||
private static Cfg Sanitize(Cfg c)
|
||||
{
|
||||
|
|
@ -676,7 +670,8 @@ internal sealed class IltVaultedDungeons : IIltFeature
|
|||
|
||||
// ── Config / snapshot types ─────────────────────────────────────────────
|
||||
|
||||
private sealed class Cfg
|
||||
// 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>
|
||||
|
|
@ -706,3 +701,15 @@ internal sealed class IltVaultedDungeons : IIltFeature
|
|||
"paused", null, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// 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).
|
||||
[JsonSerializable(typeof(IltVaultedDungeons.Cfg))]
|
||||
[JsonSourceGenerationOptions(
|
||||
WriteIndented = true,
|
||||
PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase,
|
||||
PropertyNameCaseInsensitive = true,
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
internal partial class IltVaultedDungeonsJsonContext : JsonSerializerContext { }
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ namespace RynthCore.Plugin.RynthILT;
|
|||
public sealed class RynthILTPlugin : RynthPluginBase
|
||||
{
|
||||
internal static readonly IntPtr NamePointer = Marshal.StringToHGlobalAnsi("RynthILT");
|
||||
// Previous release: 0.2.13 (ProductVersion 2026.10.16.5).
|
||||
internal static readonly IntPtr VersionPointer = Marshal.StringToHGlobalAnsi("0.2.14");
|
||||
// Previous release: 0.2.19 (ProductVersion 2026.10.18.22).
|
||||
internal static readonly IntPtr VersionPointer = Marshal.StringToHGlobalAnsi("0.2.20");
|
||||
|
||||
/// <summary>
|
||||
/// The settings view's surface. No longer in the sections manifest (the force-server override
|
||||
|
|
@ -156,6 +156,9 @@ public sealed class RynthILTPlugin : RynthPluginBase
|
|||
_nextNameTryMs = 0;
|
||||
_nextHubTryMs = 0;
|
||||
_ai?.Reset();
|
||||
// RynthCore's verdict first, so the Hub (and RynthAi's Mini Remote through RynthILT.Hub)
|
||||
// starts on the engine's ILT flag and this character's override, not RynthILT's own list.
|
||||
PollServerState(force: true);
|
||||
TryStartBounties();
|
||||
TryStartHub();
|
||||
}
|
||||
|
|
@ -172,6 +175,7 @@ public sealed class RynthILTPlugin : RynthPluginBase
|
|||
while (_typedBounty.TryDequeue(out _)) { }
|
||||
while (_engineCommands.TryDequeue(out _)) { }
|
||||
_settingsModel.Clear();
|
||||
_serverStateJson = string.Empty; // the next character's verdict is read fresh
|
||||
}
|
||||
|
||||
// Plugin unload (hot reload, update, client closing): keep the list and the Hub state for the
|
||||
|
|
@ -191,6 +195,7 @@ public sealed class RynthILTPlugin : RynthPluginBase
|
|||
try { RynthLog.Pump(); } catch { }
|
||||
if (!_loginComplete) return;
|
||||
_ai?.Tick();
|
||||
PollServerState(force: false);
|
||||
if (_bounties == null) TryStartBounties();
|
||||
if (_hub == null) TryStartHub();
|
||||
DrainTypedBounty();
|
||||
|
|
@ -208,6 +213,31 @@ public sealed class RynthILTPlugin : RynthPluginBase
|
|||
catch (Exception ex) { RynthLog.Exception(LogCat.IltHub, ex, "PublishHubFeatures"); }
|
||||
}
|
||||
|
||||
private const long ServerStatePollMs = 2000;
|
||||
private long _serverStateNextAt;
|
||||
private string _serverStateJson = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Plugin tick, every 2 s (and at login): RynthCore's server list (plugin API v86,
|
||||
/// GetServerStateJson) into the settings model, whose "ilt" entry the Hub's world check follows
|
||||
/// (IltEngineVerdict). Parsed only when the text changed. An older engine leaves it empty, and
|
||||
/// RynthILT's own list decides. Without this the engine's verdict and the character's
|
||||
/// "/rc server ilt on|off|auto" override never reached the Hub or the Mini Remote.
|
||||
/// </summary>
|
||||
private void PollServerState(bool force)
|
||||
{
|
||||
long now = Environment.TickCount64;
|
||||
if (!force && now < _serverStateNextAt) return;
|
||||
_serverStateNextAt = now + ServerStatePollMs;
|
||||
try
|
||||
{
|
||||
if (!Host.HasGetServerStateJson || !Host.TryGetServerStateJson(out string json) || json == _serverStateJson) return;
|
||||
_serverStateJson = json;
|
||||
_settingsModel.ApplyServerState(EngineServerState.Parse(json));
|
||||
}
|
||||
catch (Exception ex) { RynthLog.Exception(LogCat.IltHub, ex, "PollServerState"); }
|
||||
}
|
||||
|
||||
/// <summary>Plugin tick: runs the settings and fellowship views' chat commands through the engine.</summary>
|
||||
private void DrainChatCommands()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue