feat(rynthai): enhance T11 item support and logging

- Added new command `/ra t11` for T11 loot management, including wield counters and aug overrides.
- Improved logging for item info requests and decisions, providing clearer insights into item handling.
- Updated item info processing to accommodate T11-specific attributes and conditions.
- Enhanced settings to allow for T11 item augmentation overrides.
- Adjusted various components to ensure compatibility with T11 features, including loot rules and item descriptions.

This update aims to streamline the integration of T11 mechanics into the RynthAi plugin, enhancing user experience and functionality.
This commit is contained in:
BlankenshipG 2026-10-06 00:34:28 -04:00
commit 2f38fd6baf
25 changed files with 1993 additions and 39 deletions

View file

@ -39,6 +39,8 @@ public enum LongValueKey
public enum StringValueKey
{
Name = 1,
// ACECustom puts the T11 "Modifiers:" block of armor, clothing and jewelry here.
Use = 14,
ShortDesc = 15,
LongDesc = 16,
PluralName = 20,
@ -117,13 +119,27 @@ public class WorldObject
public int Values(int key, int defaultValue)
{
// T11 virtual keys are computed from the item's text, never stored on the object.
if (RynthCore.Loot.T11.T11Keys.IsVirtual(key))
return Loot.T11ItemSupport.VirtualValue(this, key, defaultValue);
var o = Overlay;
if (o != null)
{
if (o.Ints.TryGetValue(unchecked((uint)key), out int v)) return v;
if (!o.LiveFallback) return defaultValue;
if (!o.LiveFallback) return Loot.T11ItemSupport.StrippedValue(this, key, defaultValue);
}
return Cache?.GetIntProperty(Id, (uint)key, defaultValue) ?? defaultValue;
if (Cache == null) return Loot.T11ItemSupport.StrippedValue(this, key, defaultValue);
// T11 appraisals omit the item-aug wield gate (158-160) and modifier-carried ratings
// (370-379); an absent or zero value there falls back to what the item's text says.
if (RynthCore.Loot.T11.T11Keys.IsStrippedKey(key))
{
int live = Cache.GetIntProperty(Id, (uint)key, int.MinValue);
if (live != int.MinValue && live != 0) return live;
return Loot.T11ItemSupport.StrippedValue(this, key, live == int.MinValue ? defaultValue : 0);
}
return Cache.GetIntProperty(Id, (uint)key, defaultValue);
}
public string Values(StringValueKey key, string defaultValue)

View file

@ -1,17 +1,26 @@
// MagItemDescriber.cs — one-line "Mag-style" item info (Mag-Tools ItemInfo / UtilityBelt ub-IT ItemInfo).
//
// Gold Ornate Long Sword (Slash Sword), Noble Relic Set, CS, Undead Slayer, Tinks 4,
// Applied: Steel x2, 152.48-236, 0.35v, +18%a, 12%md, Legendary Blood Thirst, Wield Lvl 180,
// Applied: Steel x2, 152-236, 0.35v, +18%a, +12%md, Legendary Blood Thirst, Wield Lvl 180,
// Heavy Weapons 375, Diff 270, Craft 8, [D 3, CD 2]
//
// The same fields can also print as the pet-roster layout (IltPetStats: identity line, stats
// line, ratings/requirements line), plus a spells line:
//
// Gold Ornate Long Sword (Slash Sword), Noble Relic Set, Tinks 4, Applied: Steel x2, Craft 8
// CS, Undead Slayer, 152.48-236, 0.35v, 18%a, 12%md
// CS, Undead Slayer, 152-236, 0.35v, +18%a, +12%md
// [D 3, CD 2] Wield Lvl 180, Heavy Weapons 375, Diff 270
// Spells: Legendary Blood Thirst
//
// Values follow what the ACECustom appraisal panel shows: the low damage end is rounded like the
// client, Crushing Blow is the dealt multiplier (1 + CriticalMultiplier), and imbue strengths,
// the T11 weapon grade, procs, zone modifiers and item-aug wield gates come from the description
// text because the server keeps those properties off the wire:
//
// Flaming Quarter Staff (Fire Staff), Grade S (100%), Craft 9
// FireRend +176%, Crushing Blow 3.66x, 1790-2069, 0.135v, +20%a, +20%md
// [CD 24] Wield 2,000 Item Augs
//
// Field order and per-class gating follow ub-IT (Tools/ItemInfo.cs ItemDescriptions.ToString,
// Lib/ItemDescribeMagShorthand.cs, Lib/ItemInfoHelper/ItemIdentifyFieldSet.cs); labels and the
// spell filter follow Mag-Tools. All ids are raw ACE properties (RynthCore reads CBaseQualities by
@ -20,7 +29,9 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
using RynthCore.Loot;
using RynthCore.Loot.T11;
namespace RynthCore.Plugin.RynthAi.ItemInfo;
@ -186,8 +197,13 @@ internal static class MagItemDescriber
private const uint FloatIgnoreArmor = 155; // armor cleaving
// ── ACE PropertyString ids ───────────────────────────────────────────────
private const uint StringUse = 14; // ACECustom: T11 armor/jewelry "Modifiers:" block
private const uint StringLongDesc = 16; // ACECustom: "Property Details:" lines (imbue strengths, grade, gates)
private const uint StringTinkerLog = 9007; // ACECustom: CSV of applied material ids
/// <summary>ACECustom's WieldRequirement.Int64Stat: the client gets it as text, never as properties.</summary>
private const int WieldReqInt64Stat = 13;
/// <summary>Gear ratings are small (1..~50). Anything above is a wrong key leaking through.</summary>
private const int MaxPlausibleRating = 200;
@ -270,6 +286,10 @@ internal static class MagItemDescriber
const MagItemSection Id = MagItemSection.Identity, Cbt = MagItemSection.Combat, Req = MagItemSection.Requirements;
string I(int v) => v.ToString(CultureInfo.InvariantCulture);
// Text-only appraisal data (empty until the item has been IDed).
string longDesc = item.GetString(StringLongDesc);
T11ItemInfo t11 = T11ItemInfo.Parse(item.Name, longDesc, item.GetString(StringUse));
// ── Set ─────────────────────────────────────────────────────────────────
int set = Int(IntEquipmentSet);
if (set > 0 && Show(MagItemInfoField.Set))
@ -281,19 +301,27 @@ internal static class MagItemDescriber
// ── Imbues (ImbuedEffect 179 plus ImbuedEffect2..5 = 303..306) ─────────
if (Show(MagItemInfoField.Imbues))
d.Add(Cbt, ImbueLabels(Int(IntImbued) | Int(303) | Int(304) | Int(305) | Int(306)));
d.Add(Cbt, ImbueLabels(Int(IntImbued) | Int(303) | Int(304) | Int(305) | Int(306), ImbueStrengths(longDesc)));
if (Has(Field.ArmorCleave) && Show(MagItemInfoField.ArmorCleave) && Dbl(FloatIgnoreArmor, 0) != 0)
d.Add(Cbt, "AC");
if (Has(Field.CritStats) && Show(MagItemInfoField.CritStats))
{
// A crit deals 1 + CriticalMultiplier; a stored 1.0 is a normal 2x crit, so ACE only
// calls it Crushing Blow above 1.0.
double critMult = Dbl(FloatCritMultiplier, 0);
if (critMult > 0) d.Add(Cbt, $"CritMult ({Fmt(critMult)})");
if (critMult > 1) d.Add(Cbt, $"Crushing Blow {Fmt(critMult + 1)}x");
// Biting Strike replaces the base crit chance with this fraction.
double critFreq = Dbl(FloatCritFrequency, 0);
if (critFreq > 0) d.Add(Cbt, $"CritFreq ({Fmt(critFreq)})");
if (critFreq > 0) d.Add(Cbt, $"Biting Strike {Math.Round(critFreq * 100).ToString(CultureInfo.InvariantCulture)}%");
}
// T11 Cast on Strike procs: "Proc Force Arc 13%".
if (Show(MagItemInfoField.Imbues))
foreach (var (procName, chance) in t11.Procs)
d.Add(Cbt, $"Proc {procName} {Fmt(chance)}%");
if (Has(Field.Splits) && Show(MagItemInfoField.Splits))
{
int splits = Int(IntSplitArrows);
@ -333,6 +361,10 @@ internal static class MagItemDescriber
}
// ── Damage ──────────────────────────────────────────────────────────────
// T11 weapon grade sits with the identity fields: "Grade S (100%)".
if (Has(Field.Damage) && Show(MagItemInfoField.Damage) && t11.GradeRank > 0)
d.Add(Id, t11.DamagePercent >= 0 ? $"Grade {t11.Grade} ({I(t11.DamagePercent)}%)" : $"Grade {t11.Grade}");
if (Has(Field.Damage) && Show(MagItemInfoField.Damage))
AddDamage(d, cls, Int(IntMaxDamage), Dbl(FloatVariance, 0), Int(IntElementalBonus),
Dbl(FloatDamageMod, 1), Dbl(FloatVsMonsters, 1));
@ -359,6 +391,9 @@ internal static class MagItemDescriber
{
AddWieldRequirement(d, Int(IntWieldReq), Int(IntWieldSkill), Int(IntWieldValue));
AddWieldRequirement(d, Int(IntWieldReq2), Int(IntWieldSkill2), Int(IntWieldValue2));
// T11 gates (item augs, Triune Weave, charms) only exist as "Wield requires:" text.
foreach (T11WieldGate gate in t11.WieldGates)
d.Add(Req, $"Wield {gate.Amount.ToString("N0", CultureInfo.InvariantCulture)} {GateName(gate.Counter)}");
}
if (Show(MagItemInfoField.Activation))
@ -418,7 +453,18 @@ internal static class MagItemDescriber
// ── Ratings ─────────────────────────────────────────────────────────────
if (Show(MagItemInfoField.Ratings))
{
d.Add(MagItemSection.Ratings, RatingsCluster(item, options.HiddenRatings));
// T11 zone modifiers: the server drops a modifier's Gear* rating from the ratings it
// sends, so the modifier lines are the only place those values appear.
if (t11.Modifiers.Count > 0)
{
var mods = new List<string>(t11.Modifiers.Count);
foreach (T11Modifier m in t11.Modifiers)
mods.Add(m.Value != 0 ? $"{m.Name} {(m.Value > 0 ? "+" : "")}{I(m.Value)}" : m.Name);
d.Add(MagItemSection.Ratings, "Mods: " + string.Join(", ", mods));
}
}
if (cls == AcObjectClass.Misc && Show(MagItemInfoField.Keyring)
&& item.Name.Contains("Keyring", StringComparison.OrdinalIgnoreCase))
@ -432,15 +478,18 @@ internal static class MagItemDescriber
/// <summary>Mag imbue labels ("CS AR"), plus the ACE flags Mag predates (missile imbue, nether
/// rend); empty when no known bit is set.</summary>
private static string ImbueLabels(int mask)
private static string ImbueLabels(int mask, IReadOnlyDictionary<int, string> strengths)
{
if (mask == 0) return string.Empty;
var sb = new StringBuilder();
// Bare labels stay Mag-style "CS AR"; once a strength is shown, commas keep values readable.
string sep = strengths.Count > 0 ? ", " : " ";
void Flag(int bit, string label)
{
if ((mask & bit) == 0) return;
if (sb.Length > 0) sb.Append(' ');
if (sb.Length > 0) sb.Append(sep);
sb.Append(label);
if (strengths.TryGetValue(bit, out string? value)) sb.Append(' ').Append(value);
}
Flag(0x0001, "CS");
Flag(0x0002, "CB");
@ -461,6 +510,52 @@ internal static class MagItemDescriber
return sb.ToString(); // only unknown bits → empty → field skipped
}
// ACECustom "Property Details:" imbue lines, e.g. "- Fire Rending: +176% Dmg",
// "- Armor Rending: 12.5% Ignored", "- Crippling Blow: 2.5x Crit Dmg". The value may carry a
// culture space before '%' and group separators.
private static readonly Regex ImbueDetailLine = new(
@"^\s*-\s*(?<name>[A-Za-z' ]+?)\s*:\s*(?<value>[+-]?[\d.,]+\s?[%x])",
RegexOptions.Multiline | RegexOptions.CultureInvariant);
/// <summary>
/// Imbue bit → strength text ("+176%", "12.5%", "2.5x") from the description. Rendings are
/// matched by damage keyword because the server builds their names from DamageType.DisplayName.
/// </summary>
private static IReadOnlyDictionary<int, string> ImbueStrengths(string longDesc)
{
var result = new Dictionary<int, string>();
if (string.IsNullOrEmpty(longDesc)) return result;
foreach (Match m in ImbueDetailLine.Matches(longDesc))
{
int bit = ImbueBitForDetail(m.Groups["name"].Value);
if (bit != 0 && !result.ContainsKey(bit))
result[bit] = m.Groups["value"].Value.Replace(" ", "");
}
return result;
}
private static int ImbueBitForDetail(string name)
{
bool Has(string s) => name.Contains(s, StringComparison.OrdinalIgnoreCase);
if (Has("Critical Strike")) return 0x0001;
if (Has("Crippling Blow")) return 0x0002;
if (Has("Armor Rending")) return 0x0004;
if (!Has("Rending")) return 0;
if (Has("Slash")) return 0x0008;
if (Has("Pierc")) return 0x0010;
if (Has("Bludg")) return 0x0020;
if (Has("Acid")) return 0x0040;
if (Has("Cold") || Has("Frost")) return 0x0080;
if (Has("Electric") || Has("Lightning")) return 0x0100;
if (Has("Fire")) return 0x0200;
if (Has("Nether")) return 0x4000;
return 0;
}
/// <summary>Short wield-gate counter names: "Item Augs", "Triune Weave", charm names.</summary>
private static string GateName(T11Counter counter) =>
counter == T11Counter.ItemAugmentations ? "Item Augs" : T11Catalog.CounterName(counter);
/// <summary>Melee "min-max", variance, "+elem", "+mod%", wand "+N% vs. Monsters" (combat line).</summary>
private static void AddDamage(MagItemDescription d, AcObjectClass cls, int maxDmg, double variance,
int elemBonus, double dmgMod, double vsMonsters)
@ -469,12 +564,13 @@ internal static class MagItemDescriber
if (cls != AcObjectClass.MissileWeapon && maxDmg > 0)
{
string max = maxDmg.ToString(CultureInfo.InvariantCulture);
d.Add(Cbt, variance > 0
? (maxDmg - maxDmg * variance).ToString("N2", CultureInfo.InvariantCulture) + "-" + max
: max);
// The appraisal panel rounds the low end to a whole number (2069 * 0.865 → 1790).
long min = (long)Math.Round(maxDmg * (1 - variance), MidpointRounding.AwayFromZero);
d.Add(Cbt, variance > 0 ? min.ToString(CultureInfo.InvariantCulture) + "-" + max : max);
}
// Three places: loot variances are often x.xx5 and two places would misreport them.
if (variance > 0)
d.Add(Cbt, Math.Round(variance, 2).ToString(CultureInfo.InvariantCulture) + "v");
d.Add(Cbt, Math.Round(variance, 3).ToString("0.###", CultureInfo.InvariantCulture) + "v");
if (elemBonus != 0)
d.Add(Cbt, "+" + elemBonus.ToString(CultureInfo.InvariantCulture));
// A missing/zero multiplier means "no bonus" (0 would print as -100%).
@ -484,18 +580,21 @@ internal static class MagItemDescriber
d.Add(Cbt, "+" + Math.Round((vsMonsters - 1) * 100).ToString(CultureInfo.InvariantCulture) + "% vs. Monsters");
}
/// <summary>Mag "18%a" from a 1.0-based multiplier; skips missing (≤0) and neutral 1.0.</summary>
/// <summary>Mag "+18%a" from a 1.0-based multiplier; skips missing (≤0) and neutral 1.0.</summary>
private static void AddPercent(MagItemDescription d, double multiplier, string suffix, int decimals)
{
if (multiplier <= 0 || multiplier == 1) return;
double pct = Math.Round((multiplier - 1) * 100, decimals);
d.Add(MagItemSection.Combat, pct.ToString(CultureInfo.InvariantCulture) + suffix);
if (pct == 0) return; // rounds to nothing at this precision
// Signed like the appraisal panel ("Bonus to Attack Skill +20%"); penalties keep their '-'.
d.Add(MagItemSection.Combat, (pct > 0 ? "+" : "") + pct.ToString(CultureInfo.InvariantCulture) + suffix);
}
/// <summary>"Wield Lvl 180" for a level requirement, else "Heavy Weapons 375".</summary>
private static void AddWieldRequirement(MagItemDescription d, int reqType, int skillOrAttr, int value)
{
if (value <= 0) return;
// Int64 gates name a counter, not a skill; the T11 text supplies those.
if (value <= 0 || reqType == WieldReqInt64Stat) return;
string v = value.ToString(CultureInfo.InvariantCulture);
d.Add(MagItemSection.Requirements, reqType == 7 // WieldRequirement.Level
? "Wield Lvl " + v

View file

@ -1773,6 +1773,7 @@ internal sealed partial class LegacyDashboardRenderer
dst.YieldToVTank = tmp.YieldToVTank;
dst.ShowTerrainPassability = tmp.ShowTerrainPassability;
dst.GiveQueueIntervalMs = tmp.GiveQueueIntervalMs;
dst.T11ItemAugsOverride = tmp.T11ItemAugsOverride;
dst.SpellCastIntervalMs = tmp.SpellCastIntervalMs;
dst.AttackSpellIntervalMs = tmp.AttackSpellIntervalMs;
dst.EmbeddedNavs = tmp.EmbeddedNavs;

View file

@ -267,6 +267,13 @@ public sealed class LegacyUiSettings
public int GiveQueueIntervalMs = 150;
/// <summary>
/// Item augmentation count used for T11 wield gates in loot rules ("T11: Can Wield").
/// -1 = automatic (read from the server's "/aug" reply). ACECustom doesn't send the count
/// at login, so this is the fallback when "/aug" is unavailable. Set with /ra t11 augs.
/// </summary>
public int T11ItemAugsOverride = -1;
public int SpellCastIntervalMs = 400;
/// <summary>

View file

@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using RynthCore.Loot.T11;
namespace RynthCore.Plugin.RynthAi.Loot;
/// <summary>
/// T11 (tier 11+ ACECustom) loot support for <see cref="WorldObject.Values(int, int)"/>:
/// answers the virtual T11 keys (<see cref="T11Keys"/>) and puts back the wield-requirement and
/// rating properties the server strips from T11 appraisals. Parsed item text is cached per
/// object and re-parsed only when the text changes. Holds the player's "/aug" counters for
/// the "Can Wield" key. One character per process, so the state is static.
/// </summary>
internal static class T11ItemSupport
{
/// <summary>The logged-in character's T11 wield counters.</summary>
public static T11PlayerAugs Player { get; } = new();
private static readonly T11AugReportParser AugParser = new();
private static readonly object Gate = new();
private static readonly Dictionary<int, Entry> Parsed = new();
// Bound so a long session's corpse items can't grow the cache without limit; a full
// clear is fine because re-parsing is cheap and only happens for items still in use.
private const int MaxEntries = 4096;
private sealed class Entry
{
public string Name = string.Empty;
public string LongDesc = string.Empty;
public string Use = string.Empty;
public T11ItemInfo Info = T11ItemInfo.None;
}
/// <summary>True when <paramref name="name"/> carries the server's T11 drop prefix.</summary>
public static bool HasT11Name(string? name)
=> !string.IsNullOrEmpty(name) && name.StartsWith(T11Catalog.NamePrefix, StringComparison.Ordinal);
/// <summary>The parsed T11 view of <paramref name="item"/> (<see cref="T11ItemInfo.None"/> for other items).</summary>
public static T11ItemInfo Get(WorldObject item)
{
string name = item.Name.Length > 0 ? item.Name : item.Values(StringValueKey.Name, string.Empty);
string longDesc = item.Values(StringValueKey.LongDesc, string.Empty);
string use = item.Values(StringValueKey.Use, string.Empty);
lock (Gate)
{
if (Parsed.TryGetValue(item.Id, out Entry? e)
&& string.Equals(e.Name, name, StringComparison.Ordinal)
&& string.Equals(e.LongDesc, longDesc, StringComparison.Ordinal)
&& string.Equals(e.Use, use, StringComparison.Ordinal))
return e.Info;
}
T11ItemInfo info = T11ItemInfo.Parse(name, longDesc, use);
lock (Gate)
{
if (Parsed.Count >= MaxEntries) Parsed.Clear();
Parsed[item.Id] = new Entry { Name = name, LongDesc = longDesc, Use = use, Info = info };
}
return info;
}
/// <summary>A virtual T11 key's value, or <paramref name="defaultValue"/> for an unused id.</summary>
public static int VirtualValue(WorldObject item, int key, int defaultValue)
{
try
{
return T11Keys.TryGetValue(Get(item), key, Player, out int value) ? value : defaultValue;
}
catch
{
return defaultValue;
}
}
/// <summary>
/// The value a T11 appraisal stripped for a retail key (158/159/160, 370-379), else
/// <paramref name="fallback"/>. Only T11-named items are parsed, so other items pay a
/// string compare.
/// </summary>
public static int StrippedValue(WorldObject item, int key, int fallback)
{
if (!T11Keys.IsStrippedKey(key)) return fallback;
try
{
string name = item.Name.Length > 0 ? item.Name : item.Values(StringValueKey.Name, string.Empty);
if (!HasT11Name(name)) return fallback;
return T11Keys.TryGetStrippedValue(Get(item), key, out int value) ? value : fallback;
}
catch
{
return fallback;
}
}
/// <summary>Feeds a chat line to the "/aug" reader. Returns true when a counter changed.</summary>
public static bool OnChat(string? text) => AugParser.Feed(text, Environment.TickCount64, Player);
/// <summary>Applies the saved item-aug override (-1 = automatic). Cheap; called every tick.</summary>
public static void SyncOverride(int itemAugsOverride)
=> Player.ItemAugOverride = itemAugsOverride >= 0 ? itemAugsOverride : null;
/// <summary>Drops the cached parse of a deleted object.</summary>
public static void Forget(int objectId)
{
lock (Gate) Parsed.Remove(objectId);
}
/// <summary>Forgets the character's counters and every cached item (logout).</summary>
public static void Reset()
{
Player.Clear();
lock (Gate) Parsed.Clear();
}
}

View file

@ -36,6 +36,7 @@ public sealed partial class RynthAiPlugin
ChatLine("[RynthAi] /ra attackable — check if target is attackable");
ChatLine("[RynthAi] /ra wielded — show wielded items");
ChatLine("[RynthAi] /ra dumpprops [0xId] — every property of the selection (else yourself)");
ChatLine("[RynthAi] /ra t11 [augs <n|auto>|refresh|item] — T11 loot: wield counters, aug override, parsed item");
ChatLine("[RynthAi] /ra mexec <expr> — evaluate meta expression");
ChatLine("[RynthAi] /ra listvars — show session variables");
ChatLine("[RynthAi] /ra listpvars — show persistent variables");

View file

@ -215,10 +215,14 @@ public sealed partial class RynthAiPlugin
return;
}
if (requestId && Host.HasRequestId) Host.RequestId(uid);
ItemInfoLog($"0x{uid:X8}: waiting for ID data (requested={requestId && Host.HasRequestId})");
_itemInfoPendingId = itemId;
_itemInfoPendingSince = Environment.TickCount64;
}
/// <summary>One "[ItemInfo]" line in the engine log and the daily RynthAi file per trigger decision.</summary>
private static void ItemInfoLog(string message) => RynthLog.Write(LogCat.UI, "[ItemInfo] " + message);
/// <summary>
/// Select / click triggers: <see cref="QueueItemInfo"/> unless the same item was queued
/// automatically within <see cref="AutoDedupeMs"/> (one click can raise both triggers).
@ -226,7 +230,11 @@ public sealed partial class RynthAiPlugin
internal void QueueAutoItemInfo(int itemId, bool requestId)
{
long now = Environment.TickCount64;
if (itemId == _itemInfoLastAutoId && now - _itemInfoLastAutoAt < AutoDedupeMs) return;
if (itemId == _itemInfoLastAutoId && now - _itemInfoLastAutoAt < AutoDedupeMs)
{
ItemInfoLog($"0x{(uint)itemId:X8}: already queued by the other trigger");
return;
}
_itemInfoLastAutoId = itemId;
_itemInfoLastAutoAt = now;
QueueItemInfo(itemId, requestId);
@ -288,12 +296,19 @@ public sealed partial class RynthAiPlugin
var s = ItemInfoSettings;
if (s == null || s.ClickTrigger == MagItemInfoSettings.ClickOff || !Host.HasGetSelectedItemId) return;
string button = MagItemInfoCatalog.ClickTriggers[s.ClickTrigger];
uint selected = Host.GetSelectedItemId();
if (selected == 0) return;
if (selected == 0) { ItemInfoLog($"{button}: nothing selected"); return; }
int id = unchecked((int)selected);
WorldObject? obj = _objectCache?[id];
if (obj == null || !IsLootableClass(obj.ObjectClass) || !ItemInfoWantsClass(s, obj.ObjectClass)) return;
if (obj == null) { ItemInfoLog($"{button}: 0x{selected:X8} not in the object cache"); return; }
if (!IsLootableClass(obj.ObjectClass) || !ItemInfoWantsClass(s, obj.ObjectClass))
{
ItemInfoLog($"{button}: '{obj.Name}' ({obj.ObjectClass}) skipped by the class filters");
return;
}
ItemInfoLog($"{button}: 0x{selected:X8} '{obj.Name}': click queue");
QueueAutoItemInfo(id, requestId: true);
}
@ -344,8 +359,14 @@ public sealed partial class RynthAiPlugin
private void PrintItemInfo(int itemId, bool identified)
{
List<string>? lines = BuildItemInfoLines(itemId, out string? error);
if (lines == null || lines.Count == 0) { ChatLine("[RynthAi] " + error); return; }
if (lines == null || lines.Count == 0)
{
ItemInfoLog($"0x{(uint)itemId:X8}: not printed: {error}");
ChatLine("[RynthAi] " + error);
return;
}
if (!identified) lines[0] += " (not identified — stats may be incomplete)";
ItemInfoLog($"0x{(uint)itemId:X8}: printed {lines.Count} line(s), identified={identified}: {lines[0]}");
var s = ItemInfoSettings;
string prefix = s?.Prefix ?? "[RynthAi] ";

View file

@ -140,6 +140,7 @@ public sealed partial class RynthAiPlugin
catch (Exception ex) { RynthLog.Exception(LogCat.General, ex, "item info tick"); }
try { _navBreadcrumbs?.Tick(); }
catch (Exception ex) { RynthLog.Exception(LogCat.Navigation, ex, "nav breadcrumbs tick"); }
Loot.T11ItemSupport.SyncOverride(_dashboard?.Settings.T11ItemAugsOverride ?? -1);
}
/// <summary>Drop per-character feature objects. The translator is disposed only on plugin shutdown.</summary>
@ -158,6 +159,7 @@ public sealed partial class RynthAiPlugin
_huds = null;
_itemInfoUi = null;
ResetGroundLoot(clearCaches: true);
Loot.T11ItemSupport.Reset();
if (!disposeTranslator) return;
try { _translator?.Dispose(); }
catch (Exception ex) { RynthLog.Exception(LogCat.Chat, ex, "translator dispose"); }

View file

@ -2041,17 +2041,25 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
if (Host.HasQueryHealth) Host.QueryHealth(currentTargetId);
}
if (_lootInspectMode && currentTargetId != 0)
if (currentTargetId != 0)
{
int sid = unchecked((int)currentTargetId);
WorldObject? obj = _objectCache?[sid];
// Skip non-items (monsters, players, NPCs, doors, corpses, portals, etc.)
if (obj != null && IsLootableClass(obj.ObjectClass))
{
InspectLootRuleForItem(sid, quiet: true);
var itemInfo = _dashboard?.Settings.ItemInfoSettings;
if (itemInfo != null && ItemInfoWantsClass(itemInfo, obj.ObjectClass))
bool infoWanted = itemInfo != null && ItemInfoWantsClass(itemInfo, obj.ObjectClass);
// Item info (on select or on click) is the answer for this item; the loot
// verdict line would print in its place. /ra lootcheck still prints it on demand.
bool infoHandles = infoWanted && (itemInfo!.OnSelect || itemInfo.ClickTrigger != ItemInfo.MagItemInfoSettings.ClickOff);
if (_lootInspectMode && !infoHandles)
InspectLootRuleForItem(sid, quiet: true);
if (infoWanted && itemInfo!.OnSelect)
{
ItemInfoLog($"select 0x{currentTargetId:X8} '{obj.Name}': on-select queue");
QueueAutoItemInfo(sid, requestId: false);
}
}
}
}
@ -2087,6 +2095,9 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
_scrollLearner?.OnChat(text);
_metaManager?.HandleChat(text, chatType);
_questTracker?.OnChatLine(text);
// The "/aug" reply carries the T11 wield counters (ILT Hub requests it at login).
try { Loot.T11ItemSupport.OnChat(text); }
catch (Exception ex) { RynthLog.Exception(LogCat.Looting, ex, "T11 /aug parse"); }
CheckChatForSafetyStops(text);
try { OnOwnCorpseChat(text); } catch { }
}
@ -2120,6 +2131,7 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
_objectCache?.OnDeleteObject(objectId);
_combatManager?.OnObjectDeleted(objectId); // D7/D8: free per-id maps + clear cast-wait if it was our target
_scrollLearner?.OnObjectDeleted(objectId); // a read scroll is consumed
Loot.T11ItemSupport.Forget(unchecked((int)objectId));
HandleCorpseObjectDeleted(objectId);
}
catch (Exception ex)
@ -3121,6 +3133,7 @@ public sealed partial class RynthAiPlugin : RynthPluginBase
case "listgvars": HandleListGvarsCommand(); break;
case "dumpprops": HandleDumpPropsCommand(parts); break;
case "version": HandleVersionCommand(); break;
case "t11": HandleT11Command(parts); break;
case "wielded": HandleWieldedCommand(); break;
case "scan": HandleScanCommand(); break;
case "buildinfo": HandleBuildInfoCommand(); break;

View file

@ -0,0 +1,124 @@
using System;
using System.Globalization;
using System.Linq;
using RynthCore.Loot.T11;
using RynthCore.Plugin.RynthAi.Loot;
namespace RynthCore.Plugin.RynthAi;
public sealed partial class RynthAiPlugin
{
/// <summary>
/// /ra t11 [augs &lt;n|auto&gt; | refresh | item [0xId]]: T11 loot support.
/// No argument shows the wield counters the loot rules use; "augs" sets or clears the
/// item-aug override; "refresh" asks the server for "/aug"; "item" shows how the selected
/// item's T11 text was read and the values its virtual loot keys return.
/// </summary>
private void HandleT11Command(string[] parts)
{
string sub = parts.Length >= 3 ? parts[2].ToLowerInvariant() : string.Empty;
switch (sub)
{
case "":
case "status":
PrintT11Status();
break;
case "augs":
SetT11ItemAugOverride(parts.Length >= 4 ? parts[3] : string.Empty);
break;
case "refresh":
if (!Host.HasInvokeChatParser) { ChatLine("[RynthAi] This engine can't send chat commands."); break; }
Host.InvokeChatParser("/aug");
ChatLine("[RynthAi] T11: sent /aug - the counters update from its reply.");
break;
case "item":
PrintT11Item(parts.Length >= 4 ? parts[3] : null);
break;
default:
ChatLine("[RynthAi] Usage: /ra t11 [augs <n|auto> | refresh | item [0xId]]");
break;
}
}
/// <summary>The counters the "T11: Can Wield" loot key compares wield gates against.</summary>
private void PrintT11Status()
{
T11PlayerAugs p = T11ItemSupport.Player;
int saved = _dashboard?.Settings.T11ItemAugsOverride ?? -1;
string updated = p.UpdatedUtc is DateTime t ? t.ToLocalTime().ToString("t", CultureInfo.CurrentCulture) : "never";
ChatLine($"[RynthAi] === T11 loot (last /aug read: {updated}) ===");
foreach ((T11Counter counter, string name) in T11Catalog.CounterNames)
{
long? v = p.Get(counter);
string source = counter == T11Counter.ItemAugmentations && saved >= 0 ? " (override)" : string.Empty;
ChatLine($"[RynthAi] {name}: {(v.HasValue ? v.Value.ToString("N0", CultureInfo.CurrentCulture) : "unknown")}{source}");
}
if (p.UpdatedUtc == null && saved < 0)
ChatLine("[RynthAi] Unknown counters make \"T11: Can Wield\" -1. Use /ra t11 refresh, or /ra t11 augs <n>.");
}
/// <summary>/ra t11 augs &lt;n|auto&gt;: saves the item-aug override (-1 = read from /aug).</summary>
private void SetT11ItemAugOverride(string arg)
{
if (_dashboard == null) { ChatLine("[RynthAi] Settings aren't loaded yet."); return; }
int value;
if (arg.Equals("auto", StringComparison.OrdinalIgnoreCase) || arg == "-1")
value = -1;
else if (!int.TryParse(arg.Replace(",", string.Empty), NumberStyles.Integer, CultureInfo.InvariantCulture, out value) || value < 0)
{
ChatLine("[RynthAi] Usage: /ra t11 augs <n|auto> (n = your item augmentation count)");
return;
}
_dashboard.Settings.T11ItemAugsOverride = value;
_dashboard.SaveSettings();
T11ItemSupport.SyncOverride(value);
ChatLine(value < 0
? "[RynthAi] T11: item augmentations now come from /aug."
: $"[RynthAi] T11: item augmentations fixed at {value:N0} for loot rules.");
}
/// <summary>/ra t11 item [0xId]: the parsed T11 text of an item (selected item by default).</summary>
private void PrintT11Item(string? idArg)
{
uint id = 0;
if (!string.IsNullOrEmpty(idArg))
uint.TryParse(idArg.StartsWith("0x", StringComparison.OrdinalIgnoreCase) ? idArg[2..] : idArg,
NumberStyles.HexNumber, CultureInfo.InvariantCulture, out id);
if (id == 0 && Host.HasGetSelectedItemId) id = Host.GetSelectedItemId();
if (id == 0) { ChatLine("[RynthAi] T11: select an item first (or pass 0xId)."); return; }
int iid = unchecked((int)id);
WorldObject item = _objectCache?[iid]
?? new WorldObject(iid, Host.TryGetObjectName(id, out string n) ? n : string.Empty) { Cache = _objectCache };
T11ItemInfo info = T11ItemSupport.Get(item);
if (!info.IsT11)
{
bool appraised = !Host.HasHasAppraisalData || Host.HasAppraisalData(id);
ChatLine(appraised
? $"[RynthAi] T11: {item.Name} is not a T11 item."
: $"[RynthAi] T11: {item.Name} isn't appraised yet - ID it and try again.");
return;
}
ChatLine($"[RynthAi] === T11: {item.Name} (0x{id:X8}) ===");
ChatLine($"[RynthAi] Tier ~{info.EstimatedTier}" + (info.Grade != null ? $", grade {info.Grade} ({info.DamagePercent}% of max damage)" : string.Empty)
+ (info.ZoneLocked ? ", zone locked" : string.Empty));
foreach (T11WieldGate g in info.WieldGates)
ChatLine($"[RynthAi] Wield requires {g.Amount:N0} {T11Catalog.CounterName(g.Counter)}");
foreach (T11Modifier m in info.Modifiers)
{
string band = m.Min.HasValue && m.Max.HasValue ? $" [{m.Min}-{m.Max}] roll {m.RollPercent}%" : string.Empty;
ChatLine($"[RynthAi] Mod {m.Name} {(m.IsSlotSpecial ? "(special)" : "+" + m.Value)}{band}");
}
foreach ((string name, double chance) in info.Procs)
ChatLine($"[RynthAi] Cast on strike: {name} ({chance.ToString("0.#", CultureInfo.CurrentCulture)}%)");
int canWield = item.Values(T11Keys.CanWield, -1);
ChatLine($"[RynthAi] Can wield: {(canWield == 1 ? "yes" : canWield == 0 ? "no" : "unknown (no /aug read, or not appraised)")}"
+ $", modifier ratings {info.ModifierRatingTotal}, average roll {info.AverageRollPercent}%");
string keys = string.Join(", ", T11Keys.Names()
.Where(k => k.Id < T11Keys.ModifierBase)
.Select(k => $"{k.Name.Replace("T11: ", string.Empty)}={item.Values(k.Id, 0)}"));
ChatLine($"[RynthAi] Loot keys: {keys}");
}
}

View file

@ -44,7 +44,7 @@ public sealed partial class RynthAiPlugin
private static unsafe class PluginModule
{
/// <summary>RynthPluginVersion's hand-written string (it never changes between builds).</summary>
public const string HandWrittenVersion = "0.5.0-legacy-ui";
public const string HandWrittenVersion = "0.5.18-legacy-ui";
private const uint FromAddress = 0x4, UnchangedRefCount = 0x2;