RynthSuite as of 2026-11-29 (internal 46bae49): release 2026.11.28.1
This commit is contained in:
parent
25552fa794
commit
598f49c899
131 changed files with 11825 additions and 329 deletions
|
|
@ -105,7 +105,9 @@ public sealed class LootEditSession
|
|||
_bom = bom;
|
||||
_crlf = text.Contains("\r\n", StringComparison.Ordinal);
|
||||
_finalNewline = finalNewline;
|
||||
return Ok(reason.Length == 0 ? $"Opened {FileName(path)} ({RuleCount} rules)." : $"Opened {FileName(path)} ({RuleCount} rules), read-only.");
|
||||
string opened = reason.Length == 0 ? $"Opened {FileName(path)} ({RuleCount} rules)." : $"Opened {FileName(path)} ({RuleCount} rules), read-only.";
|
||||
foreach (string hint in LootRuleText.ProfileHints(profile.Rules)) opened += " " + hint;
|
||||
return Ok(opened);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -286,7 +288,9 @@ public sealed class LootEditSession
|
|||
if (cmd.Rule == null) { Fail("No rule in the update."); return Outcome.Refused; }
|
||||
string? error = ApplyRule(rule, cmd.Rule);
|
||||
if (error != null) { Fail(error); return Outcome.Refused; }
|
||||
return Changed($"Updated \"{rule.Name}\" (not saved yet).", cmd.Index);
|
||||
string updated = $"Updated \"{rule.Name}\" (not saved yet).";
|
||||
foreach (string hint in LootRuleText.Hints(rule)) updated += " " + hint;
|
||||
return Changed(updated, cmd.Index);
|
||||
}
|
||||
}
|
||||
Fail($"Unknown loot edit command '{cmd.Op}'.");
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public sealed class LootItemAttribute
|
|||
|
||||
public static class LootItemAttributes
|
||||
{
|
||||
public const string GroupItem = "Item", GroupGear = "Weapon / Armor", GroupRatings = "Ratings", GroupSpells = "Spells",
|
||||
public const string GroupItem = "Item", GroupGear = "Weapon / Armor", GroupSpecials = "Weapon specials", GroupRatings = "Ratings", GroupSpells = "Spells",
|
||||
GroupPet = "Pet essence", GroupT11 = "T11", GroupRequirements = "Requirements";
|
||||
|
||||
/// <summary>Cantrip tiers, lowest first: "Major Strength" is tier 2.</summary>
|
||||
|
|
@ -96,10 +96,17 @@ public static class LootItemAttributes
|
|||
new(GroupItem, 92, false, "Uses left", Cmp.Min),
|
||||
new(GroupItem, 91, false, "Max uses", Cmp.Min),
|
||||
new(GroupItem, 265, false, "Armor set", Cmp.Named, "The set id (the same set's pieces share it)."),
|
||||
new(GroupItem, 353, false, "Imbue", Cmp.Named),
|
||||
new(GroupItem, 179, false, "Imbue", Cmp.Named, "The item's imbues (ImbuedEffect, with ImbuedEffect2-5 folded in)."),
|
||||
new(GroupItem, 166, false, "Slayer", Cmp.Named),
|
||||
new(GroupItem, 45, false, "Damage type", Cmp.Named),
|
||||
// ACE appraisal properties (2026-11-27; spotted by SilentKelpie, Forgejo rynth PR #12).
|
||||
new(GroupItem, 171, false, "Times tinkered", Cmp.Max, "How many tinks it has had (fewer leaves more room)."),
|
||||
new(GroupItem, 17, false, "Rare", Cmp.Min, "A rare's id; any rare: at least 1."),
|
||||
new(GroupItem, 114, false, "Attuned", Cmp.Min, "1 when attuned (it can't be traded)."),
|
||||
new(GroupItem, 33, false, "Bonded", Cmp.Min, "1 when bonded (it stays on death)."),
|
||||
new(GroupItem, 319, false, "Max item level", Cmp.Min, "Items that level up (Aetheria, some keys and weapons)."),
|
||||
|
||||
new(GroupGear, 353, false, "Weapon type", Cmp.Named, "The weapon's mastery: sword, axe, bow, crossbow..."),
|
||||
new(GroupGear, LootItemRules.KeyWieldSkill, false, "Wield skill", Cmp.Named),
|
||||
new(GroupGear, LootItemRules.KeyWeaponSkill, false, "Weapon skill", Cmp.Named),
|
||||
new(GroupGear, LootItemRules.KeyDamage, false, "Max damage", Cmp.Min),
|
||||
|
|
@ -111,9 +118,18 @@ public static class LootItemAttributes
|
|||
new(GroupGear, 150, true, "Magic defense modifier", Cmp.Min),
|
||||
new(GroupGear, 144, true, "Mana conversion modifier", Cmp.Min),
|
||||
new(GroupGear, LootItemRules.KeyElementalDamageMod, true, "Elemental damage vs monsters", Cmp.Min),
|
||||
new(GroupGear, 204, false, "Elemental damage bonus", Cmp.Min, "A caster's or launcher's flat elemental damage bonus."),
|
||||
new(GroupGear, 159, true, "Absorb magic damage", Cmp.Min, "The share of magic damage absorbed (0.25 = 25%)."),
|
||||
new(GroupGear, LootItemRules.KeyEquipSlots, false, "Equip slots", Cmp.Named, "Where it is worn or wielded."),
|
||||
new(GroupGear, LootItemRules.KeyArmorLevel, false, "Armor level", Cmp.Min),
|
||||
|
||||
// A weapon's special properties, as the appraisal names them (2026-11-27).
|
||||
new(GroupSpecials, 147, true, "Biting Strike", Cmp.Min, "Its critical chance (0.4 = 40%)."),
|
||||
new(GroupSpecials, 136, true, "Crushing Blow", Cmp.Min, "Its critical damage multiplier."),
|
||||
new(GroupSpecials, 155, true, "Armor Cleaving", Cmp.Min, "The share of armor it ignores (any: at least 0.01)."),
|
||||
new(GroupSpecials, 157, true, "Resistance Cleaving", Cmp.Min, "The resistance it takes off its element."),
|
||||
new(GroupSpecials, 292, false, "Cleaving", Cmp.Min, "How many targets a swing hits."),
|
||||
|
||||
// The rating total comes first in this group (built separately); then each rating.
|
||||
new(GroupRatings, 370, false, "Damage rating", Cmp.Min),
|
||||
new(GroupRatings, 371, false, "Damage resist rating", Cmp.Min),
|
||||
|
|
@ -124,6 +140,9 @@ public static class LootItemAttributes
|
|||
new(GroupRatings, 376, false, "Heal boost rating", Cmp.Min),
|
||||
new(GroupRatings, 377, false, "Nether resist rating", Cmp.Min),
|
||||
new(GroupRatings, 379, false, "Vitality rating", Cmp.Min),
|
||||
new(GroupRatings, 378, false, "Life resist rating", Cmp.Min),
|
||||
new(GroupRatings, 388, false, "Overpower rating", Cmp.Min),
|
||||
new(GroupRatings, 389, false, "Overpower resist rating", Cmp.Min),
|
||||
|
||||
new(GroupPet, KeyBond, false, "Bond level", Cmp.Min),
|
||||
new(GroupPet, KeyUseRequiresLevel, false, "Level", Cmp.Min),
|
||||
|
|
|
|||
|
|
@ -35,10 +35,22 @@ public sealed class LootItemFacts
|
|||
/// <summary>The plugin knows it for a summoning essence (by WCID, icon, use requirement; added 2026-10-18).</summary>
|
||||
public bool IsPetEssence { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The item's description and use text (LongDesc, Use), for values only the text carries; empty when
|
||||
/// unknown (added 2026-11-27: the slayer bonus, <see cref="SlayerText"/>).
|
||||
/// </summary>
|
||||
public string ItemText { get; set; } = string.Empty;
|
||||
|
||||
public bool Stackable => MaxStackSize > 1 || StackSize > 1;
|
||||
|
||||
public int Int(int key) => Ints.TryGetValue(key, out int v) ? v : 0;
|
||||
public double Double(int key) => Doubles.TryGetValue(key, out double v) ? v : 0;
|
||||
|
||||
/// <summary>A float property; the slayer bonus (138) falls back to the item text when none was sent.</summary>
|
||||
public double Double(int key)
|
||||
{
|
||||
double v = Doubles.TryGetValue(key, out double d) ? d : 0;
|
||||
return SlayerText.Resolve(key, v, () => new string?[] { ItemText });
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>How the rule recognises the item.</summary>
|
||||
|
|
|
|||
|
|
@ -64,10 +64,14 @@ public static class LootRuleText
|
|||
(314, "Pet CritDamageRating"), (315, "Pet CritResistRating"), (316, "Pet CritDamageResistRating"),
|
||||
(362, "SummoningMastery"), (364, "UseLevelRequirement"), (366, "UseRequiresSkill"),
|
||||
(368, "UseRequiresSkillSpec"), (369, "UseRequiresLevel"),
|
||||
(179, "Imbued (Decal)"), (265, "EquipmentSetId (armor set)"),
|
||||
(218, "EquippedSlots"), (353, "ImbuedEffect"), (370, "DamageRating"), (371, "DamageResistRating"),
|
||||
(179, "ImbuedEffect"), (265, "EquipmentSetId (armor set)"),
|
||||
(218, "EquippedSlots"), (353, "WeaponType"), (370, "DamageRating"), (371, "DamageResistRating"),
|
||||
(372, "CritRating"), (373, "CritResistRating"), (374, "CritDamageRating"),
|
||||
(375, "CritDamageResistRating"), (376, "HealBoostRating"), (377, "NetherResistRating"), (379, "VitalityRating"),
|
||||
// The checklist's newer rows (2026-11-27).
|
||||
(17, "RareId"), (33, "Bonded"), (114, "Attuned"), (171, "NumTimesTinkered"), (204, "ElementalDamageBonus"),
|
||||
(292, "Cleaving (targets)"), (319, "ItemMaxLevel"), (378, "LifeResistRating"), (388, "OverpowerRating"),
|
||||
(389, "OverpowerResistRating"),
|
||||
(0x0D000000, "Type (WCID)"), // Decal's synthetic key: the weenie class id
|
||||
// Decal's other synthetic keys (Decal.Adapter LongValueKey), as VTank's editor names them;
|
||||
// RynthAi reads each as the game property it is (WorldObjectCache.GetDecalLongKey).
|
||||
|
|
@ -97,9 +101,11 @@ public static class LootRuleText
|
|||
public static readonly (int Id, string Name)[] DoubleKeys =
|
||||
{
|
||||
(5, "ManaRate"), (22, "DamageVariance"), (29, "WeaponDefense"), (62, "WeaponOffense"),
|
||||
(63, "DamageMod"), (138, "Slayer Damage Bonus"), // often unset on ACE appraisal; prefer LongDesc / int 166
|
||||
(63, "DamageMod"), (138, "Slayer Damage Bonus"), // never sent by ACE; read from the item text where a server writes it (SlayerText)
|
||||
(144, "ManaConversionMod"), (149, "WeaponMissileDefense"),
|
||||
(150, "WeaponMagicDefense"), (152, "ElementalDamageVsMonsters"), (167, "CooldownDuration"),
|
||||
(136, "CriticalMultiplier (Crushing Blow)"), (147, "CriticalFrequency (Biting Strike)"),
|
||||
(155, "IgnoreArmor (Armor Cleaving)"), (157, "ResistanceModifier (Resistance Cleaving)"), (159, "AbsorbMagicDamage"),
|
||||
(0x0A000009, "SalvageWorkmanship"), (0x0A00000B, "Variance"),
|
||||
(0x0A00000C, "AttackBonus"), (0x0A00000E, "DamageBonus"),
|
||||
};
|
||||
|
|
@ -216,8 +222,8 @@ public static class LootRuleText
|
|||
/// number. Unknown values are still valid: show them as "value N".
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// ImbuedEffect (353): ACE's ImbuedEffectType flags. A combination (two imbues) shows as
|
||||
/// "value N".
|
||||
/// ImbuedEffect (179): ACE's ImbuedEffectType flags. A combination (two imbues) shows as
|
||||
/// "value N". These names sat on 353 until 2026-11-27; 353 is the weapon type.
|
||||
/// </summary>
|
||||
public static readonly (int Id, string Name)[] ImbuedEffects =
|
||||
{
|
||||
|
|
@ -227,6 +233,13 @@ public static class LootRuleText
|
|||
(4096, "Magic Defense"), (8192, "Spellbook"), (16384, "Nether Rending"),
|
||||
};
|
||||
|
||||
/// <summary>WeaponType (353): the weapon's mastery (ACE WeaponType). A crossbow is "353 = 9".</summary>
|
||||
public static readonly (int Id, string Name)[] WeaponTypes =
|
||||
{
|
||||
(1, "Unarmed"), (2, "Sword"), (3, "Axe"), (4, "Mace"), (5, "Spear"), (6, "Dagger"), (7, "Staff"),
|
||||
(8, "Bow"), (9, "Crossbow"), (10, "Thrown"), (11, "Two Handed"), (12, "Magic"),
|
||||
};
|
||||
|
||||
/// <summary>SummoningMastery (362): the pet school an essence needs (ACE SummoningMastery).</summary>
|
||||
public static readonly (int Id, string Name)[] SummoningMasteries =
|
||||
{
|
||||
|
|
@ -241,7 +254,8 @@ public static class LootRuleText
|
|||
158 => WieldRequirements,
|
||||
159 or 366 or 368 => Skills,
|
||||
166 => CreatureTypes,
|
||||
353 => ImbuedEffects,
|
||||
179 => ImbuedEffects,
|
||||
353 => WeaponTypes,
|
||||
362 => SummoningMasteries,
|
||||
T11.T11Keys.WeaponGrade => T11.T11Catalog.Grades,
|
||||
T11.T11Keys.GearGrade => T11.T11Catalog.Grades,
|
||||
|
|
@ -249,11 +263,11 @@ public static class LootRuleText
|
|||
};
|
||||
|
||||
/// <summary>True when the long key's value is a set of flags (a named value is one flag or a common pair).</summary>
|
||||
public static bool ValueTableIsFlags(int longKey) => longKey is 45 or 0x0D000021 or 9054 or 353;
|
||||
public static bool ValueTableIsFlags(int longKey) => longKey is 45 or 0x0D000021 or 9054 or 179;
|
||||
|
||||
/// <summary>The long keys that have a value table, for the vocabulary.</summary>
|
||||
public static readonly int[] KeysWithValueTables =
|
||||
{ 45, 48, 131, 158, 159, 166, 353, 362, 366, 368, 9054, 0x0D000020, 0x0D000021, T11.T11Keys.WeaponGrade, T11.T11Keys.GearGrade };
|
||||
{ 45, 48, 131, 158, 159, 166, 179, 353, 362, 366, 368, 9054, 0x0D000020, 0x0D000021, T11.T11Keys.WeaponGrade, T11.T11Keys.GearGrade };
|
||||
|
||||
/// <summary>
|
||||
/// True for the conditions whose value is picked by name when the key has a
|
||||
|
|
@ -425,6 +439,34 @@ public static class LootRuleText
|
|||
return sb.Length > maxLength ? sb.ToString(0, maxLength - 3) + "..." : sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What the author of <paramref name="rule"/> should know about its conditions (2026-11-27): a test of the
|
||||
/// slayer bonus (float 138) works only where the server writes the bonus in the item text.
|
||||
/// </summary>
|
||||
public static List<string> Hints(VTankLootRule rule)
|
||||
{
|
||||
var hints = new List<string>();
|
||||
foreach (VTankLootCondition c in rule.Conditions)
|
||||
if (c.NodeType is VTankNodeTypes.DoubleValKeyGE or VTankNodeTypes.DoubleValKeyLE or VTankNodeTypes.BuffedDoubleValKeyGE
|
||||
&& c.DataLines.Count > 1 && TryParseValue(c.DataLines[1], out int key) && key == SlayerText.SlayerDamageBonusKey)
|
||||
{
|
||||
hints.Add(SlayerText.Hint);
|
||||
break;
|
||||
}
|
||||
return hints;
|
||||
}
|
||||
|
||||
/// <summary>The rules of a profile whose <see cref="Hints"/> aren't empty, as "N rule(s) ...: hint" lines.</summary>
|
||||
public static List<string> ProfileHints(IEnumerable<VTankLootRule> rules)
|
||||
{
|
||||
var names = new List<string>();
|
||||
foreach (VTankLootRule r in rules)
|
||||
if (Hints(r).Count > 0) names.Add(r.Name ?? string.Empty);
|
||||
if (names.Count == 0) return new List<string>();
|
||||
string list = string.Join(", ", names.GetRange(0, Math.Min(3, names.Count))) + (names.Count > 3 ? ", ..." : "");
|
||||
return new List<string> { $"{names.Count} rule(s) test Slayer damage bonus ({list}). {SlayerText.Hint}" };
|
||||
}
|
||||
|
||||
/// <summary>One condition in words.</summary>
|
||||
public static string Condition(VTankLootCondition c)
|
||||
{
|
||||
|
|
|
|||
60
Shared/RynthCore.LootSdk/SlayerText.cs
Normal file
60
Shared/RynthCore.LootSdk/SlayerText.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace RynthCore.Loot;
|
||||
|
||||
/// <summary>
|
||||
/// A slayer weapon's damage bonus as its appraisal text gives it (2026-11-27).
|
||||
/// <para>
|
||||
/// ACE never sends SlayerDamageBonus (float 138) in an appraisal: the property isn't an assessment
|
||||
/// property, so a loot rule's "Slayer damage bonus at least 1.01" read 0 on every weapon and never
|
||||
/// matched. Servers built on ACECustom write the bonus into the weapon's text instead
|
||||
/// ("- Shadow Slayer: 1.5x Damage"). The loot readers (RynthAi's WorldObject and LootItemFacts) fall
|
||||
/// back to that text for key 138 when no value was sent; a value the server does send still wins.
|
||||
/// Where no server writes the line the bonus stays unreadable: the slayer type (int 166) is the test
|
||||
/// that works everywhere (<see cref="Hint"/>).
|
||||
/// </para>
|
||||
/// Spotted by SilentKelpie (Forgejo rynth PR #12); re-implemented here.
|
||||
/// </summary>
|
||||
public static class SlayerText
|
||||
{
|
||||
/// <summary>SlayerDamageBonus (STypeFloat 138).</summary>
|
||||
public const int SlayerDamageBonusKey = 138;
|
||||
|
||||
/// <summary>SlayerCreatureType (STypeInt 166), the test every ACE server answers.</summary>
|
||||
public const int SlayerTypeKey = 166;
|
||||
|
||||
/// <summary>What the Loot Editor says about a rule that tests the bonus.</summary>
|
||||
public const string Hint =
|
||||
"Slayer damage bonus can only be read on servers that write it in the item text (\"Shadow Slayer: 1.5x Damage\"); elsewhere use Slayer type.";
|
||||
|
||||
// "- Shadow Slayer: 1.5x Damage", "Olthoi Slayer: 2x". One line each; the dash is optional.
|
||||
private static readonly Regex Line = new(@"^[ \t]*-?[ \t]*(?<who>[^\r\n:]+?)[ \t]+Slayer:[ \t]*(?<x>\d+(?:\.\d+)?)[ \t]*x",
|
||||
RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Compiled);
|
||||
|
||||
/// <summary>The best "<creature> Slayer: N.Nx" multiplier in the texts (1.5 for "1.5x"), or 0 when none says one.</summary>
|
||||
public static double BonusOf(params string?[] texts)
|
||||
{
|
||||
double best = 0;
|
||||
foreach (string? t in texts)
|
||||
{
|
||||
if (string.IsNullOrEmpty(t) || t.IndexOf("Slayer", StringComparison.OrdinalIgnoreCase) < 0) continue;
|
||||
foreach (Match m in Line.Matches(t))
|
||||
if (double.TryParse(m.Groups["x"].Value, NumberStyles.Float, CultureInfo.InvariantCulture, out double x) && x > best)
|
||||
best = x;
|
||||
}
|
||||
return best;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Key 138's value for a loot rule: the sent value when there is one (above 0), else the text's.
|
||||
/// Any other key: <paramref name="sent"/> unchanged.
|
||||
/// </summary>
|
||||
public static double Resolve(int key, double sent, Func<string?[]> texts)
|
||||
{
|
||||
if (key != SlayerDamageBonusKey || sent > 0) return sent;
|
||||
double x = BonusOf(texts());
|
||||
return x > 0 ? x : sent;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue