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:
parent
7bcc954ecc
commit
2f38fd6baf
25 changed files with 1993 additions and 39 deletions
|
|
@ -37,6 +37,8 @@ internal static class Program
|
|||
var runner = new Runner();
|
||||
NativeLootTests.Register(runner);
|
||||
VTankLootTests.Register(runner);
|
||||
T11LootTests.Register(runner);
|
||||
MagItemDescriberTests.Register(runner);
|
||||
ExpressionTests.Register(runner);
|
||||
MetaTests.Register(runner);
|
||||
MetaSchedulerTests.Register(runner);
|
||||
|
|
|
|||
125
Tools/RynthCore.RynthAiHostTests/Tests/MagItemDescriberTests.cs
Normal file
125
Tools/RynthCore.RynthAiHostTests/Tests/MagItemDescriberTests.cs
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
using System.Collections.Generic;
|
||||
using RynthCore.Loot;
|
||||
using RynthCore.Plugin.RynthAi.ItemInfo;
|
||||
using RynthCore.RynthAiTests.Harness;
|
||||
|
||||
namespace RynthCore.RynthAiHostTests.Tests;
|
||||
|
||||
// The Mag-style item info line (/ra iteminfo, ID-on-click) against what the ACECustom appraisal
|
||||
// panel shows for the same item: whole-number damage range, signed bonuses, Crushing Blow as the
|
||||
// dealt multiplier, and the imbue strength / grade / wield gate that only exist as text.
|
||||
internal static class MagItemDescriberTests
|
||||
{
|
||||
public static void Register(Runner r)
|
||||
{
|
||||
r.Add("iteminfo: T11 fire staff matches the appraisal panel", T11FireStaff);
|
||||
r.Add("iteminfo: Biting Strike and a defense penalty", BitingStrikeAndPenalty);
|
||||
r.Add("iteminfo: retail imbues stay bare labels without detail text", RetailImbuesBare);
|
||||
r.Add("iteminfo: Int64 wield requirement never prints as a skill", Int64WieldHidden);
|
||||
r.Add("iteminfo: T11 armor modifiers print on the ratings line", T11ArmorModifiers);
|
||||
}
|
||||
|
||||
/// <summary>In-memory property bag standing in for the client object cache.</summary>
|
||||
private sealed class FakeItem : IItemPropertySource
|
||||
{
|
||||
public readonly Dictionary<uint, int> Ints = new();
|
||||
public readonly Dictionary<uint, double> Doubles = new();
|
||||
public readonly Dictionary<uint, string> Strings = new();
|
||||
|
||||
public FakeItem(string name, AcObjectClass cls) { Name = name; ObjectClass = cls; }
|
||||
|
||||
public string Name { get; }
|
||||
public AcObjectClass ObjectClass { get; }
|
||||
public bool TryGetInt(uint stype, out int value) => Ints.TryGetValue(stype, out value);
|
||||
public bool TryGetDouble(uint stype, out double value) => Doubles.TryGetValue(stype, out value);
|
||||
public string GetString(uint stype) => Strings.TryGetValue(stype, out string? v) ? v : string.Empty;
|
||||
public IReadOnlyList<int> SpellIds { get; } = new List<int>();
|
||||
}
|
||||
|
||||
private static List<string> Pet(FakeItem item) => MagItemDescriber.Build(item, MagItemInfoOptions.Default).ToPetLines();
|
||||
|
||||
// The item from the bug report: ACECustom shows Damage 1790 - 2069, Bonus to Attack Skill
|
||||
// +20%, Melee Defense +20.0%, Crushing Blow 3.66x, Fire Rending +176%, Grade S (100%),
|
||||
// Crit Dam 24, Wield requires 2,000 Item Augmentations.
|
||||
private static void T11FireStaff()
|
||||
{
|
||||
var staff = new FakeItem("Flaming Quarter Staff", AcObjectClass.MeleeWeapon);
|
||||
staff.Ints[44] = 2069; // max damage
|
||||
staff.Ints[45] = 0x10; // fire
|
||||
staff.Ints[353] = 7; // staff mastery
|
||||
staff.Ints[105] = 9; // workmanship
|
||||
staff.Ints[179] = 0x0200; // Fire Rending
|
||||
staff.Ints[374] = 24; // crit damage rating
|
||||
staff.Doubles[22] = 0.135; // variance
|
||||
staff.Doubles[62] = 1.20; // attack
|
||||
staff.Doubles[29] = 1.20; // melee defense
|
||||
staff.Doubles[136] = 2.66; // CriticalMultiplier (Crushing Blow 3.66x)
|
||||
staff.Strings[16] =
|
||||
"Property Details:\n" +
|
||||
"- Weapon Grade: S (100% of max damage)\n" +
|
||||
"- Properties: 2 of 5\n" +
|
||||
"- Crushing Blow: 3.66x Crit Dmg\n" +
|
||||
"- Fire Rending: +176% Dmg\n" +
|
||||
"- Effective Melee Defense: 39851\n" +
|
||||
"- Wield requires: 2,000 Item Augmentations\n";
|
||||
|
||||
List<string> lines = Pet(staff);
|
||||
Check.Eq(lines.Count, 3, "line count");
|
||||
Check.Eq(lines[0], "Flaming Quarter Staff (Fire Staff), Grade S (100%), Craft 9", "identity line");
|
||||
Check.Eq(lines[1], "FireRend +176%, Crushing Blow 3.66x, 1790-2069, 0.135v, +20%a, +20%md", "combat line");
|
||||
Check.Eq(lines[2], "[CD 24] Wield 2,000 Item Augs", "ratings / requirements line");
|
||||
}
|
||||
|
||||
private static void BitingStrikeAndPenalty()
|
||||
{
|
||||
var sword = new FakeItem("Sword", AcObjectClass.MeleeWeapon);
|
||||
sword.Ints[44] = 100;
|
||||
sword.Doubles[147] = 0.15; // Biting Strike
|
||||
sword.Doubles[136] = 1.0; // normal 2x crit, not Crushing Blow
|
||||
sword.Doubles[29] = 0.95; // -5% melee defense
|
||||
string line = MagItemDescriber.Describe(sword, MagItemInfoOptions.Default);
|
||||
Check.True(line.Contains("Biting Strike 15%"), $"Biting Strike shown: {line}");
|
||||
Check.False(line.Contains("Crushing Blow"), $"1.0 multiplier is not Crushing Blow: {line}");
|
||||
Check.True(line.Contains("-5%md"), $"penalty keeps its sign: {line}");
|
||||
Check.True(line.Contains(", 100,") || line.EndsWith(", 100"), $"no variance prints max only: {line}");
|
||||
}
|
||||
|
||||
private static void RetailImbuesBare()
|
||||
{
|
||||
var axe = new FakeItem("Axe", AcObjectClass.MeleeWeapon);
|
||||
axe.Ints[179] = 0x0001 | 0x0004; // CS + AR
|
||||
string line = MagItemDescriber.Describe(axe, MagItemInfoOptions.Default);
|
||||
Check.True(line.Contains(", CS AR"), $"bare Mag labels: {line}");
|
||||
|
||||
axe.Strings[16] =
|
||||
"Property Details:\n" +
|
||||
"- Critical Strike: +12.5 % Crit Chance\n" + // culture space before %
|
||||
"- Armor Rending: 30.0% Ignored\n";
|
||||
line = MagItemDescriber.Describe(axe, MagItemInfoOptions.Default);
|
||||
Check.True(line.Contains("CS +12.5%, AR 30.0%"), $"strengths from detail text: {line}");
|
||||
}
|
||||
|
||||
private static void Int64WieldHidden()
|
||||
{
|
||||
var mace = new FakeItem("Mace", AcObjectClass.MeleeWeapon);
|
||||
mace.Ints[158] = 13; // WieldRequirement.Int64Stat
|
||||
mace.Ints[159] = 9008; // LumAugItemCount
|
||||
mace.Ints[160] = 2500;
|
||||
string line = MagItemDescriber.Describe(mace, MagItemInfoOptions.Default);
|
||||
Check.False(line.Contains("Skill 9008"), $"no fake skill name: {line}");
|
||||
}
|
||||
|
||||
private static void T11ArmorModifiers()
|
||||
{
|
||||
var helm = new FakeItem("T11 - Helm", AcObjectClass.Armor);
|
||||
helm.Strings[16] = "Wield requires: 500 Triune Weave\n";
|
||||
helm.Strings[14] =
|
||||
"Modifiers:\n" +
|
||||
"- Damage Resist +6 [2-12]\n" +
|
||||
"- Max Health +100 [40-200]\n";
|
||||
List<string> lines = Pet(helm);
|
||||
string last = lines[^1];
|
||||
Check.True(last.Contains("Mods: Damage Resist +6, Max Health +100"), $"modifiers listed: {last}");
|
||||
Check.True(last.Contains("Wield 500 Triune Weave"), $"triune gate listed: {last}");
|
||||
}
|
||||
}
|
||||
127
Tools/RynthCore.RynthAiHostTests/Tests/T11LootTests.cs
Normal file
127
Tools/RynthCore.RynthAiHostTests/Tests/T11LootTests.cs
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
using RynthCore.Loot;
|
||||
using RynthCore.Loot.T11;
|
||||
using RynthCore.Loot.VTank;
|
||||
using RynthCore.Plugin.RynthAi;
|
||||
using RynthCore.Plugin.RynthAi.Loot;
|
||||
using RynthCore.RynthAiHostTests.Fakes;
|
||||
using RynthCore.RynthAiTests.Harness;
|
||||
using N = RynthCore.Loot.VTank.VTankNodeTypes;
|
||||
|
||||
namespace RynthCore.RynthAiHostTests.Tests;
|
||||
|
||||
// T11 (ACECustom tier 11+) items through the real evaluator: the virtual T11 keys answered by
|
||||
// WorldObject.Values, the wield requirement and ratings the server strips put back from the
|
||||
// item text, and "Can Wield" fed by the "/aug" reply.
|
||||
internal static class T11LootTests
|
||||
{
|
||||
private const string WeaponLongDesc =
|
||||
"Property Details:\n" +
|
||||
"- Weapon Grade: A- (91% of max damage)\n" +
|
||||
"- Wield requires: 2,500 Item Augmentations\n" +
|
||||
"\n" +
|
||||
"Modifiers:\n" +
|
||||
"- Damage Rating +30 [14-69]\n" +
|
||||
"- Crit Chance +4 [1-8]\n";
|
||||
|
||||
private const string ArmorUse =
|
||||
"Modifiers:\n" +
|
||||
"- Damage Resist +6 [2-12]\n" +
|
||||
"- Max Health +100 [40-200]\n";
|
||||
|
||||
public static void Register(Runner r)
|
||||
{
|
||||
r.Add("loot t11: virtual keys read the item text", VirtualKeys);
|
||||
r.Add("loot t11: stripped wield requirement 158/159/160 restored", StrippedWield);
|
||||
r.Add("loot t11: modifier ratings feed Gear* keys and TotalRatings", ModifierRatings);
|
||||
r.Add("loot t11: a live rating wins over the modifier text", LiveRatingWins);
|
||||
r.Add("loot t11: retail items are untouched", RetailUntouched);
|
||||
r.Add("loot t11: Can Wield from the /aug reply and the override", CanWield);
|
||||
}
|
||||
|
||||
private static VTankLootCondition C(int node, params string[] data) => new(node, "0", data);
|
||||
|
||||
private static bool M(WorldObject item, params VTankLootCondition[] conds)
|
||||
{
|
||||
var rule = new VTankLootRule { Name = "r", Action = VTankLootAction.Keep };
|
||||
rule.Conditions.AddRange(conds);
|
||||
return VTankLootEvaluator.Match(rule, item);
|
||||
}
|
||||
|
||||
private static string K(int key) => key.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
||||
|
||||
private static Item Weapon() => new Item("T11 - Tachi", AcObjectClass.MeleeWeapon).Str(16, WeaponLongDesc);
|
||||
|
||||
private static void VirtualKeys()
|
||||
{
|
||||
T11ItemSupport.Reset();
|
||||
WorldObject w = Weapon();
|
||||
Check.Eq(w.Values(T11Keys.IsT11, -5), 1, "IsT11");
|
||||
Check.Eq(w.Values(T11Keys.EstimatedTier, -5), 12, "2,500 gate = T12");
|
||||
Check.Eq(w.Values(T11Keys.WeaponGrade, -5), 13, "A- = 13");
|
||||
Check.True(M(w, C(N.LongValKeyGE, "12", K(T11Keys.WeaponGrade))), "rule: grade B+ or better");
|
||||
Check.False(M(w, C(N.LongValKeyGE, "14", K(T11Keys.WeaponGrade))), "rule: grade A or better");
|
||||
Check.True(M(w, C(N.LongValKeyGE, "25", K(T11Keys.ForModifier(28)))), "rule: Damage Rating mod >= 25");
|
||||
Check.True(M(w, C(N.LongValKeyE, "0", K(T11Keys.ZoneLocked))), "rule: not zone locked");
|
||||
Check.Eq(w.Values(T11Keys.Base + 0x1FF, -5), -5, "unused virtual id = default");
|
||||
Check.Eq(new Item("Tachi").Wo.Values(T11Keys.IsT11, -5), 0, "retail item: IsT11 = 0");
|
||||
}
|
||||
|
||||
private static void StrippedWield()
|
||||
{
|
||||
T11ItemSupport.Reset();
|
||||
WorldObject w = Weapon();
|
||||
Check.Eq(w.Values(158, 0), T11Keys.WieldRequirementInt64Stat, "158 = Int64 Property");
|
||||
Check.Eq(w.Values(159, 0), 9008, "159 = item augs");
|
||||
Check.Eq(w.Values(160, 0), 2500, "160 = gate");
|
||||
Check.True(M(w, C(N.LongValKeyLE, "2500", "160")), "rule: wield difficulty <= 2500");
|
||||
Check.False(M(w, C(N.LongValKeyLE, "2000", "160")), "rule: wield difficulty <= 2000");
|
||||
Check.Eq(w.Values(161, -1), -1, "other keys keep the default");
|
||||
}
|
||||
|
||||
private static void ModifierRatings()
|
||||
{
|
||||
T11ItemSupport.Reset();
|
||||
WorldObject w = Weapon();
|
||||
Check.Eq(w.Values(370, 0), 30, "370 Damage Rating from text");
|
||||
Check.Eq(w.Values(372, 0), 4, "372 Crit from text");
|
||||
Check.True(M(w, C(N.TotalRatingsGE, "34")), "TotalRatings counts modifier ratings");
|
||||
Check.False(M(w, C(N.TotalRatingsGE, "35")), "TotalRatings exact");
|
||||
|
||||
WorldObject armor = new Item("T11 - Celdon Breastplate", AcObjectClass.Armor).Str(14, ArmorUse);
|
||||
Check.Eq(armor.Values(371, 0), 6, "371 from the Use string");
|
||||
Check.True(M(armor, C(N.TotalRatingsGE, "106")), "armor TotalRatings 371 + 379");
|
||||
}
|
||||
|
||||
private static void LiveRatingWins()
|
||||
{
|
||||
T11ItemSupport.Reset();
|
||||
WorldObject w = Weapon().Int(370, 7);
|
||||
Check.Eq(w.Values(370, 0), 7, "a property the item has is never replaced");
|
||||
}
|
||||
|
||||
private static void RetailUntouched()
|
||||
{
|
||||
T11ItemSupport.Reset();
|
||||
WorldObject retail = new Item("Tachi", AcObjectClass.MeleeWeapon).Str(16, WeaponLongDesc);
|
||||
Check.Eq(retail.Values(160, 0), 0, "no T11 prefix: no stripped-key fallback");
|
||||
Check.Eq(retail.Values(370, -1), -1, "no T11 prefix: rating default kept");
|
||||
}
|
||||
|
||||
private static void CanWield()
|
||||
{
|
||||
T11ItemSupport.Reset();
|
||||
WorldObject w = Weapon();
|
||||
Check.Eq(w.Values(T11Keys.CanWield, -5), -1, "unknown before /aug");
|
||||
T11ItemSupport.OnChat("Advanced Augmentation Levels:");
|
||||
T11ItemSupport.OnChat("Item:2,400");
|
||||
Check.Eq(w.Values(T11Keys.CanWield, -5), 0, "2,400 < 2,500");
|
||||
Check.False(M(w, C(N.LongValKeyE, "1", K(T11Keys.CanWield))), "rule: wieldable fails");
|
||||
T11ItemSupport.SyncOverride(2500);
|
||||
Check.Eq(w.Values(T11Keys.CanWield, -5), 1, "override 2,500 meets the gate");
|
||||
T11ItemSupport.SyncOverride(-1);
|
||||
Check.Eq(w.Values(T11Keys.CanWield, -5), 0, "back to the /aug count");
|
||||
Check.Eq(new Item("T11 - Robe").Wo.Values(T11Keys.CanWield, -5), -1, "not appraised yet: unknown");
|
||||
Check.Eq(new Item("T11 - Robe").Str(16, "A robe.").Wo.Values(T11Keys.CanWield, -5), 1, "appraised, no gate: wieldable");
|
||||
T11ItemSupport.Reset();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue