feat: SK backlog from test through 2026.11.22.48 (Trade Shop, Oracle, quests, loot, nav)
Squash of test/main-merge-2026-10-25 onto aelrynth main 2026.11.19.1 for the standing sk PR. Includes Trade Shop, Oracle wiki/ILT tracker, quest runs, loot checklist, RynthNav, VTank import. HandWrittenVersion remains 0.5.0-legacy-ui. See Changelog/2026-11-22-sk-backlog-test-merge.md.
This commit is contained in:
parent
660e6b5b1c
commit
dc08e1abba
521 changed files with 47247 additions and 795 deletions
110
Shared/RynthCore.LootSdk/AcItemClassifier.cs
Normal file
110
Shared/RynthCore.LootSdk/AcItemClassifier.cs
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
using System;
|
||||
|
||||
namespace RynthCore.Loot;
|
||||
|
||||
/// <summary>
|
||||
/// An item's <see cref="AcObjectClass"/> from what the client knows about it without an
|
||||
/// identify: its ItemType flags (STypeInt 1), whether it carries a spell in its header (data
|
||||
/// id 28), its name, ValidLocations (STypeInt 9) and WeaponSkill (STypeInt 48). The same
|
||||
/// decisions as RynthAi's WorldObjectCache (ClassifyByItemType, then ClassifyItem's scroll and
|
||||
/// weapon-slot corrections), for a plugin that has no object cache of its own: RynthInventory
|
||||
/// stores the class with each saved item so a "like this" rule can be judged on another
|
||||
/// character's items (2026-10-24). Pure.
|
||||
/// </summary>
|
||||
public static class AcItemClassifier
|
||||
{
|
||||
public const uint ItemTypeMeleeWeapon = 0x00000001;
|
||||
public const uint ItemTypeArmor = 0x00000002;
|
||||
public const uint ItemTypeClothing = 0x00000004;
|
||||
public const uint ItemTypeJewelry = 0x00000008;
|
||||
public const uint ItemTypeFood = 0x00000020;
|
||||
public const uint ItemTypeMoney = 0x00000040;
|
||||
public const uint ItemTypeMisc = 0x00000080;
|
||||
public const uint ItemTypeMissileWeapon = 0x00000100;
|
||||
public const uint ItemTypeContainer = 0x00000200;
|
||||
public const uint ItemTypeGem = 0x00000800;
|
||||
public const uint ItemTypeSpellComponents = 0x00001000;
|
||||
public const uint ItemTypeWritable = 0x00002000;
|
||||
public const uint ItemTypeKey = 0x00004000;
|
||||
public const uint ItemTypeCaster = 0x00008000;
|
||||
public const uint ItemTypePortal = 0x00010000;
|
||||
public const uint ItemTypePromissoryNote = 0x00040000;
|
||||
public const uint ItemTypeManaStone = 0x00080000;
|
||||
public const uint ItemTypeService = 0x00100000;
|
||||
public const uint ItemTypeCraftCookingBase = 0x00400000;
|
||||
public const uint ItemTypeCraftAlchemyBase = 0x00800000;
|
||||
public const uint ItemTypeCraftFletchingBase = 0x02000000;
|
||||
public const uint ItemTypeCraftAlchemyIntermediate = 0x04000000;
|
||||
public const uint ItemTypeCraftFletchingIntermediate = 0x08000000;
|
||||
public const uint ItemTypeLifeStone = 0x10000000;
|
||||
public const uint ItemTypeTinkeringTool = 0x20000000;
|
||||
public const uint ItemTypeTinkeringMaterial = 0x40000000;
|
||||
|
||||
// ValidLocations (EquipMask) weapon slots.
|
||||
private const uint SlotMeleeWeapon = 0x00100000, SlotMissileWeapon = 0x00400000, SlotTwoHanded = 0x02000000;
|
||||
|
||||
/// <summary>The class the ItemType flags give (most specific first), as RynthAi's ClassifyByItemType.</summary>
|
||||
public static AcObjectClass FromItemType(uint typeFlags)
|
||||
{
|
||||
if ((typeFlags & ItemTypePromissoryNote) != 0) return AcObjectClass.TradeNote;
|
||||
if ((typeFlags & ItemTypeManaStone) != 0) return AcObjectClass.ManaStone;
|
||||
if ((typeFlags & ItemTypeSpellComponents) != 0) return AcObjectClass.SpellComponent;
|
||||
if ((typeFlags & ItemTypeGem) != 0) return AcObjectClass.Gem;
|
||||
if ((typeFlags & ItemTypeKey) != 0) return AcObjectClass.Key;
|
||||
if ((typeFlags & ItemTypeLifeStone) != 0) return AcObjectClass.Lifestone;
|
||||
if ((typeFlags & ItemTypeTinkeringMaterial) != 0) return AcObjectClass.Salvage;
|
||||
if ((typeFlags & ItemTypeTinkeringTool) != 0) return AcObjectClass.Ust;
|
||||
if ((typeFlags & ItemTypeCraftCookingBase) != 0) return AcObjectClass.BaseCooking;
|
||||
if ((typeFlags & ItemTypeCraftAlchemyBase) != 0) return AcObjectClass.BaseAlchemy;
|
||||
if ((typeFlags & ItemTypeCraftFletchingBase) != 0) return AcObjectClass.BaseFletching;
|
||||
if ((typeFlags & ItemTypeCraftAlchemyIntermediate) != 0) return AcObjectClass.CraftedAlchemy;
|
||||
if ((typeFlags & ItemTypeCraftFletchingIntermediate) != 0) return AcObjectClass.CraftedFletching;
|
||||
if ((typeFlags & ItemTypeService) != 0) return AcObjectClass.Services;
|
||||
if ((typeFlags & ItemTypePortal) != 0) return AcObjectClass.Portal;
|
||||
if ((typeFlags & ItemTypeWritable) != 0) return AcObjectClass.Book;
|
||||
if ((typeFlags & ItemTypeContainer) != 0) return AcObjectClass.Container;
|
||||
if ((typeFlags & ItemTypeCaster) != 0) return AcObjectClass.WandStaffOrb;
|
||||
if ((typeFlags & ItemTypeMissileWeapon) != 0) return AcObjectClass.MissileWeapon;
|
||||
if ((typeFlags & ItemTypeArmor) != 0) return AcObjectClass.Armor;
|
||||
if ((typeFlags & ItemTypeMeleeWeapon) != 0) return AcObjectClass.MeleeWeapon;
|
||||
if ((typeFlags & ItemTypeClothing) != 0) return AcObjectClass.Clothing;
|
||||
if ((typeFlags & ItemTypeJewelry) != 0) return AcObjectClass.Jewelry;
|
||||
if ((typeFlags & ItemTypeFood) != 0) return AcObjectClass.Food;
|
||||
if ((typeFlags & ItemTypeMoney) != 0) return AcObjectClass.Money;
|
||||
if ((typeFlags & ItemTypeMisc) != 0) return AcObjectClass.Misc;
|
||||
return AcObjectClass.Unknown;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="FromItemType"/>, then: a writable that carries a spell or is named "Scroll ..." is a
|
||||
/// Scroll; an item typed Misc (or nothing) that fits a weapon slot is that weapon (custom content
|
||||
/// does this), and one with a weapon skill but no slot reads as melee.
|
||||
/// </summary>
|
||||
public static AcObjectClass Classify(uint itemType, string? name, bool hasSpellDid, int validLocations, int weaponSkill)
|
||||
{
|
||||
AcObjectClass cls = FromItemType(itemType);
|
||||
if (cls == AcObjectClass.Book
|
||||
&& (hasSpellDid || (name ?? string.Empty).StartsWith("Scroll", StringComparison.OrdinalIgnoreCase)))
|
||||
return AcObjectClass.Scroll;
|
||||
if (cls == AcObjectClass.Misc || cls == AcObjectClass.Unknown)
|
||||
{
|
||||
if (validLocations != 0)
|
||||
{
|
||||
uint s = unchecked((uint)validLocations);
|
||||
if ((s & SlotMissileWeapon) != 0) return AcObjectClass.MissileWeapon;
|
||||
if ((s & (SlotMeleeWeapon | SlotTwoHanded)) != 0) return AcObjectClass.MeleeWeapon;
|
||||
}
|
||||
else if (weaponSkill > 0)
|
||||
return AcObjectClass.MeleeWeapon;
|
||||
}
|
||||
return cls;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An ObjectClass condition's test, as RynthAi's looter runs it (ScrollLearner.ClassMatches):
|
||||
/// Scroll also takes a spell-carrying writable, Book also takes a Scroll.
|
||||
/// </summary>
|
||||
public static bool ClassMatches(int itemClass, int wanted)
|
||||
=> itemClass == wanted
|
||||
|| (wanted == (int)AcObjectClass.Book && itemClass == (int)AcObjectClass.Scroll);
|
||||
}
|
||||
|
|
@ -550,6 +550,75 @@ public sealed class LootEditSession
|
|||
return Ok($"Added \"{rule.Name}\" at {at + 1} and saved {FileName(_path)} ({RuleCount} rules).");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces rule <paramref name="index"/> with <paramref name="rule"/> and saves at once (old file kept as
|
||||
/// .bak; 2026-11-07, edit with the checklist). .utl only; refused while there are unsaved edits, when the
|
||||
/// rule there isn't named <paramref name="expectName"/> any more, or when the profile wouldn't read back
|
||||
/// with every other rule unchanged.
|
||||
/// </summary>
|
||||
public bool ReplaceAndSave(int index, string expectName, VTankLootRule rule)
|
||||
{
|
||||
if (!IsOpen) return Fail("No profile open.");
|
||||
if (_dirty) return Fail($"Unsaved changes in {FileName(_path)}. Save or discard them in the Loot Editor first.");
|
||||
if (_json != null) return Fail("Edit a native-format rule in the Loot Editor's rule view.");
|
||||
if (_utl == null) return Fail(_readOnlyReason);
|
||||
List<VTankLootRule> rules = _utl.Rules;
|
||||
if (index < 0 || index >= rules.Count || (rules[index].Name ?? string.Empty) != (expectName ?? string.Empty))
|
||||
return Fail("That rule is no longer there. The list has been refreshed.");
|
||||
if (_utl.FileVersion < 1) rule.CustomExpression = null;
|
||||
else rule.CustomExpression ??= rules[index].CustomExpression ?? string.Empty;
|
||||
|
||||
var before = new List<string>(rules.Count);
|
||||
foreach (VTankLootRule r in rules) before.Add(RuleText(_utl, r));
|
||||
VTankLootRule old = rules[index];
|
||||
rules[index] = rule;
|
||||
string? bad = VerifyReplace(before, index);
|
||||
if (bad != null)
|
||||
{
|
||||
rules[index] = old;
|
||||
return Fail("Not saved (the profile would not read back the same): " + bad);
|
||||
}
|
||||
_dirty = true;
|
||||
if (!Save())
|
||||
{
|
||||
string why = _message;
|
||||
rules[index] = old;
|
||||
_dirty = false;
|
||||
if (_changedOnDisk)
|
||||
{
|
||||
Open(_path, force: true);
|
||||
return Fail($"Not saved: {FileName(_path)} changed on disk; reloaded it. Try again.");
|
||||
}
|
||||
return Fail("Not saved. " + why);
|
||||
}
|
||||
_focus = index;
|
||||
return Ok($"Saved rule {index + 1} \"{rule.Name}\" in {FileName(_path)}.");
|
||||
}
|
||||
|
||||
/// <summary>Null when the model reads back with only rule <paramref name="at"/> changed.</summary>
|
||||
private string? VerifyReplace(List<string> before, int at)
|
||||
{
|
||||
VTankLootProfile back;
|
||||
try { back = VTankLootParser.LoadFromText(Decode(Encode(), out _, out _)); }
|
||||
catch (Exception ex) { return ex.Message; }
|
||||
if (back.Rules.Count != before.Count) return $"{back.Rules.Count} rules instead of {before.Count}.";
|
||||
if (!SameSalvage(back.SalvageCombine, _utl!.SalvageCombine)) return "the salvage combine settings changed.";
|
||||
for (int i = 0; i < back.Rules.Count; i++)
|
||||
{
|
||||
string text = RuleText(back, back.Rules[i]);
|
||||
if (i == at)
|
||||
{
|
||||
if (text != RuleText(_utl, _utl.Rules[at])) return "the edited rule reads back differently.";
|
||||
continue;
|
||||
}
|
||||
if (text != before[i]) return $"rule {i + 1} would change.";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>Rule <paramref name="index"/> of an open .utl profile, or null.</summary>
|
||||
public VTankLootRule? UtlRule(int index) => _utl != null && index >= 0 && index < _utl.Rules.Count ? _utl.Rules[index] : null;
|
||||
|
||||
private static string RuleText(VTankLootProfile owner, VTankLootRule r) =>
|
||||
VTankLootWriter.Serialize(new VTankLootProfile { FileVersion = owner.FileVersion, Rules = { r } });
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ public sealed class LootEditState
|
|||
{
|
||||
/// <summary>Changes whenever anything below changes.</summary>
|
||||
public long Revision { get; set; }
|
||||
/// <summary>On Infinite Leaftide (added 2026-11-07): the vocabulary to ask for (LootEditVocab.Ilt).</summary>
|
||||
public bool Ilt { get; set; } = true;
|
||||
|
||||
/// <summary>Full path of the open profile; empty when none is open.</summary>
|
||||
public string Path { get; set; } = string.Empty;
|
||||
|
|
@ -47,6 +49,12 @@ public sealed class LootEditState
|
|||
/// Added 2026-10; an older engine ignores it.
|
||||
/// </summary>
|
||||
public LootEditItemDraft? ItemDraft { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Inventory panel's "Filter like this" result (item_find / find_refresh), or null.
|
||||
/// Added 2026-10-24; an older engine ignores it.
|
||||
/// </summary>
|
||||
public LootEditItemFind? ItemFind { get; set; }
|
||||
}
|
||||
|
||||
public sealed class LootEditFile
|
||||
|
|
@ -97,7 +105,11 @@ public sealed class LootEditCondition
|
|||
/// <summary>An edit from the face. Commands that target a rule carry the name the face saw (Expect).</summary>
|
||||
public sealed class LootEditCommand
|
||||
{
|
||||
/// <summary>open, reload, save, set_enabled, move, add, duplicate, delete, rename, update_rule.</summary>
|
||||
/// <summary>
|
||||
/// open, reload, save, set_enabled, move, add, duplicate, delete, rename, update_rule;
|
||||
/// item_preview, item_add, item_close (Add to loot profile); item_find, find_refresh,
|
||||
/// find_close (Filter like this, 2026-10-24).
|
||||
/// </summary>
|
||||
public string Op { get; set; } = string.Empty;
|
||||
public int Index { get; set; } = -1;
|
||||
/// <summary>move: the index the rule ends up at.</summary>
|
||||
|
|
@ -146,6 +158,52 @@ public sealed class LootEditItemRequest
|
|||
public List<LootEditItemChoice>? Choices { get; set; }
|
||||
/// <summary>Echoed in the draft so the popup knows the answer is to its latest ask.</summary>
|
||||
public int Seq { get; set; }
|
||||
/// <summary>
|
||||
/// A filter, not a rule to add (added 2026-10-24): item_preview builds the draft without a
|
||||
/// loot profile (no action, name or place in a list); item_find filters with it.
|
||||
/// </summary>
|
||||
public bool Find { get; set; }
|
||||
/// <summary>item_find: <see cref="LootFindScopes"/> (the items in <see cref="Candidates"/>, or Global Inventory).</summary>
|
||||
public string Scope { get; set; } = string.Empty;
|
||||
/// <summary>item_find / find_refresh, scope inventory: the items to judge (what the panel lists).</summary>
|
||||
public List<uint>? Candidates { get; set; }
|
||||
/// <summary>
|
||||
/// No item (added 2026-10-24): the checklist lists every attribute (LootItemAttributes.ForBlank),
|
||||
/// for the Inventory panel's own filter. ItemId is ignored.
|
||||
/// </summary>
|
||||
public bool Blank { get; set; }
|
||||
/// <summary>Spells and cantrips the player added from the standard lists (added 2026-10-24).</summary>
|
||||
public List<LootEditItemExtra>? Extras { get; set; }
|
||||
/// <summary>
|
||||
/// Blank: edit this rule of the open profile (its index) instead of adding one (added 2026-11-07); -1 adds.
|
||||
/// Without Choices the checklist starts from the rule's conditions.
|
||||
/// </summary>
|
||||
public int EditIndex { get; set; } = -1;
|
||||
/// <summary>EditIndex's rule name as the editor showed it (refused when the rule there changed).</summary>
|
||||
public string EditName { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>A spell picked from the standard lists (LootSpellCatalog), required by the rule.</summary>
|
||||
public sealed class LootEditItemExtra
|
||||
{
|
||||
public const string Spell = "spell", Cantrip = "cantrip";
|
||||
/// <summary><see cref="Spell"/> (a leveled family) or <see cref="Cantrip"/>.</summary>
|
||||
public string Kind { get; set; } = Spell;
|
||||
/// <summary>The family ("Strength", "Aura of Defender") or the cantrip without its tier ("Coordination").</summary>
|
||||
public string Name { get; set; } = string.Empty;
|
||||
/// <summary>Spell: the level, 1-8. Cantrip: the tier, 0 Minor ... 4 Paragon.</summary>
|
||||
public int Level { get; set; }
|
||||
/// <summary>A LootItemAttributeOp (or better, exact, any tier); -1 = or better.</summary>
|
||||
public int Op { get; set; } = -1;
|
||||
}
|
||||
|
||||
/// <summary>Where "Filter like this" looks (LootEditItemRequest.Scope).</summary>
|
||||
public static class LootFindScopes
|
||||
{
|
||||
/// <summary>The items the request lists (the Inventory panel's).</summary>
|
||||
public const string Inventory = "inventory";
|
||||
/// <summary>RynthInventory's Global Inventory: the result carries the spec for "/ginv like".</summary>
|
||||
public const string Global = "global";
|
||||
}
|
||||
|
||||
/// <summary>One checklist row as the player set it (LootEditItemAttribute.Id).</summary>
|
||||
|
|
@ -180,6 +238,16 @@ public sealed class LootEditItemAttribute
|
|||
public List<int> Ops { get; set; } = new();
|
||||
/// <summary>The value can be typed (a number); named values and spells can't.</summary>
|
||||
public bool Editable { get; set; }
|
||||
/// <summary>
|
||||
/// The values a named row can take (added 2026-10-24): the popup offers them in a list and
|
||||
/// sends the picked Id as the choice's Value. Null for typed and fixed rows.
|
||||
/// </summary>
|
||||
public List<LootEditName>? Choices { get; set; }
|
||||
/// <summary>
|
||||
/// The Choices are flags (imbues, damage types; added 2026-11-07): with "has any" / "has all"
|
||||
/// several can be picked, the Value is their sum.
|
||||
/// </summary>
|
||||
public bool Flags { get; set; }
|
||||
/// <summary>The rule requires this row now.</summary>
|
||||
public bool On { get; set; }
|
||||
public string Tip { get; set; } = string.Empty;
|
||||
|
|
@ -235,6 +303,49 @@ public sealed class LootEditItemDraft
|
|||
/// <summary>item_add went through; Message says what was added where.</summary>
|
||||
public bool Added { get; set; }
|
||||
public string Message { get; set; } = string.Empty;
|
||||
/// <summary>A filter's draft (the request's Find; added 2026-10-24): no profile, action or place.</summary>
|
||||
public bool Find { get; set; }
|
||||
/// <summary>
|
||||
/// A rule from the blank checklist (the request's Blank without Find; added 2026-11-07, the Loot
|
||||
/// Editor's Add rule): no item; it goes in at the end. False from an older RynthAi.
|
||||
/// </summary>
|
||||
public bool Blank { get; set; }
|
||||
/// <summary>The rule this draft edits (the request's EditIndex), -1 when it adds one (added 2026-11-07).</summary>
|
||||
public int EditIndex { get; set; } = -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// "Filter like this" (added 2026-10-24): the rule the checklist made and, for the panel's
|
||||
/// items, which match. item_find builds it from the item; find_refresh judges the panel's
|
||||
/// items again with the same rule (new loot, identifies that came in); find_close drops it.
|
||||
/// </summary>
|
||||
public sealed class LootEditItemFind
|
||||
{
|
||||
/// <summary>The request's Seq (item_find or find_refresh).</summary>
|
||||
public int Seq { get; set; }
|
||||
public bool Ok { get; set; }
|
||||
public string Error { get; set; } = string.Empty;
|
||||
/// <summary><see cref="LootFindScopes"/>.</summary>
|
||||
public string Scope { get; set; } = string.Empty;
|
||||
public uint ItemId { get; set; }
|
||||
public string ItemName { get; set; } = string.Empty;
|
||||
/// <summary>What the filter is called ("like Gold Ring").</summary>
|
||||
public string Label { get; set; } = string.Empty;
|
||||
/// <summary>The rule's conditions in words, one per line (ASCII).</summary>
|
||||
public List<string> Lines { get; set; } = new();
|
||||
/// <summary>Scope inventory: the candidates the rule takes.</summary>
|
||||
public List<uint> Ids { get; set; } = new();
|
||||
/// <summary>
|
||||
/// Scope inventory: candidates that failed only on something an identify would tell
|
||||
/// (not identified yet), or that RynthAi doesn't know yet.
|
||||
/// </summary>
|
||||
public List<uint> Unknown { get; set; } = new();
|
||||
/// <summary>How many candidates were judged.</summary>
|
||||
public int Checked { get; set; }
|
||||
/// <summary>Scope global: the "/ginv like" argument (LootFindSpec).</summary>
|
||||
public string Spec { get; set; } = string.Empty;
|
||||
/// <summary>Some condition needs an identify to judge (so unidentified items can be Unknown).</summary>
|
||||
public bool NeedsIdentify { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Names for the face's pickers. Sent once per plugin load.</summary>
|
||||
|
|
@ -243,6 +354,8 @@ public sealed class LootEditVocab
|
|||
public List<LootEditName> Actions { get; set; } = new();
|
||||
public List<LootEditNodeType> NodeTypes { get; set; } = new();
|
||||
public List<LootEditName> ObjectClasses { get; set; } = new();
|
||||
/// <summary>Built for Infinite Leaftide (ACECustom keys offered; added 2026-11-07).</summary>
|
||||
public bool Ilt { get; set; } = true;
|
||||
public List<LootEditName> LongKeys { get; set; } = new();
|
||||
public List<LootEditName> DoubleKeys { get; set; } = new();
|
||||
public List<LootEditName> StringKeys { get; set; } = new();
|
||||
|
|
@ -253,6 +366,21 @@ public sealed class LootEditVocab
|
|||
/// with an older RynthAi gets it empty and keeps the value a text box.
|
||||
/// </summary>
|
||||
public List<LootEditValueTable> LongValueTables { get; set; } = new();
|
||||
/// <summary>The standard spell lists (LootSpellCatalog, added 2026-10-24): leveled families by school.</summary>
|
||||
public List<LootEditSpellFamily> SpellFamilies { get; set; } = new();
|
||||
/// <summary>Cantrip names without their tier ("Coordination").</summary>
|
||||
public List<string> Cantrips { get; set; } = new();
|
||||
/// <summary>The cantrip tiers, lowest first (Minor ... Paragon).</summary>
|
||||
public List<string> CantripTiers { get; set; } = new();
|
||||
}
|
||||
|
||||
/// <summary>One leveled spell family the popup offers (LootSpellFamily).</summary>
|
||||
public sealed class LootEditSpellFamily
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string School { get; set; } = string.Empty;
|
||||
public int MinLevel { get; set; } = 1;
|
||||
public int MaxLevel { get; set; } = 8;
|
||||
}
|
||||
|
||||
public sealed class LootEditName
|
||||
|
|
|
|||
198
Shared/RynthCore.LootSdk/Editing/LootFactsMatcher.cs
Normal file
198
Shared/RynthCore.LootSdk/Editing/LootFactsMatcher.cs
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
using RynthCore.Loot.T11;
|
||||
using RynthCore.Loot.VTank;
|
||||
|
||||
namespace RynthCore.Loot.Editing;
|
||||
|
||||
/// <summary>What a rule says about an item known only by its saved facts.</summary>
|
||||
public enum LootFactsVerdict
|
||||
{
|
||||
Match,
|
||||
NoMatch,
|
||||
/// <summary>
|
||||
/// A condition that needs an identify failed on an item that wasn't identified when it was
|
||||
/// read: it might match once identified.
|
||||
/// </summary>
|
||||
Unknown,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Judges a loot rule's conditions on <see cref="LootItemFacts"/> instead of a live object: for
|
||||
/// items RynthAi can't see (another character's, read back from RynthInventory's files; added
|
||||
/// 2026-10-24 for "Find in Global Inventory"). The semantics follow RynthAi's
|
||||
/// VTankLootEvaluator for every condition the "Add to loot profile" checklist makes (class,
|
||||
/// name, long / double keys including T11's virtual keys, rating total, spells); conditions
|
||||
/// about the character (skills, level, pack space) and colours can't be judged on saved data
|
||||
/// and never match. Pure; regexes are cached.
|
||||
/// </summary>
|
||||
public static class LootFactsMatcher
|
||||
{
|
||||
private const RegexOptions Rx = RegexOptions.IgnoreCase | RegexOptions.CultureInvariant;
|
||||
private static readonly TimeSpan RxTimeout = TimeSpan.FromMilliseconds(100);
|
||||
private static readonly Dictionary<string, Regex?> RegexCache = new(StringComparer.Ordinal);
|
||||
private static readonly object RegexGate = new();
|
||||
|
||||
/// <summary>
|
||||
/// Int keys every item sends with its description (no identify needed): item type, burden,
|
||||
/// valid locations, stack, value, material. A failed test on any other key, a float, the
|
||||
/// ratings or the spells only means "no" once the item has been identified.
|
||||
/// </summary>
|
||||
private static readonly HashSet<int> PublicLongKeys = new() { 1, 5, 9, 11, 12, 19, 131, T11Keys.IsT11 };
|
||||
|
||||
/// <summary>
|
||||
/// The rule's verdict. <paramref name="identified"/>: the facts include the item's appraisal
|
||||
/// (spells, workmanship, ratings...).
|
||||
/// </summary>
|
||||
public static LootFactsVerdict Match(IReadOnlyList<VTankLootCondition> conditions, LootItemFacts f, bool identified)
|
||||
{
|
||||
bool unknown = false;
|
||||
foreach (VTankLootCondition c in conditions)
|
||||
{
|
||||
if (c.NodeType == VTankNodeTypes.DisabledRule)
|
||||
{
|
||||
if (IsDisabled(c)) return LootFactsVerdict.NoMatch;
|
||||
continue;
|
||||
}
|
||||
bool ok;
|
||||
try { ok = Test(c, f); }
|
||||
catch (FormatException) { return LootFactsVerdict.NoMatch; }
|
||||
catch (ArgumentOutOfRangeException) { return LootFactsVerdict.NoMatch; }
|
||||
catch (OverflowException) { return LootFactsVerdict.NoMatch; }
|
||||
if (ok) continue;
|
||||
if (!identified && NeedsIdentify(c)) unknown = true;
|
||||
else return LootFactsVerdict.NoMatch;
|
||||
}
|
||||
return unknown ? LootFactsVerdict.Unknown : LootFactsVerdict.Match;
|
||||
}
|
||||
|
||||
/// <summary>Some condition can only be judged on an identified item.</summary>
|
||||
public static bool NeedsIdentify(IReadOnlyList<VTankLootCondition> conditions)
|
||||
{
|
||||
foreach (VTankLootCondition c in conditions)
|
||||
if (c.NodeType != VTankNodeTypes.DisabledRule && NeedsIdentify(c)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool NeedsIdentify(VTankLootCondition c)
|
||||
{
|
||||
switch (c.NodeType)
|
||||
{
|
||||
case VTankNodeTypes.ObjectClass:
|
||||
case VTankNodeTypes.StringValueMatch:
|
||||
return false;
|
||||
case VTankNodeTypes.LongValKeyE:
|
||||
case VTankNodeTypes.LongValKeyNE:
|
||||
case VTankNodeTypes.LongValKeyGE:
|
||||
case VTankNodeTypes.LongValKeyLE:
|
||||
case VTankNodeTypes.LongValKeyFlagExists:
|
||||
return !(c.DataLines.Count > 1
|
||||
&& int.TryParse(c.DataLines[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out int key)
|
||||
&& PublicLongKeys.Contains(key));
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool Test(VTankLootCondition c, LootItemFacts f)
|
||||
{
|
||||
IList<string> d = c.DataLines;
|
||||
switch (c.NodeType)
|
||||
{
|
||||
case VTankNodeTypes.ObjectClass:
|
||||
return AcItemClassifier.ClassMatches(f.ObjectClass, I(d, 0));
|
||||
case VTankNodeTypes.StringValueMatch:
|
||||
// Saved items keep their name only (key 1); any other string reads empty, as a missing one does live.
|
||||
return IsMatch(I(d, 1) == 1 ? f.Name : string.Empty, d[0]);
|
||||
case VTankNodeTypes.LongValKeyE: return f.Int(I(d, 1)) == I(d, 0);
|
||||
case VTankNodeTypes.LongValKeyNE: return f.Int(I(d, 1)) != I(d, 0);
|
||||
case VTankNodeTypes.LongValKeyGE: return f.Int(I(d, 1)) >= I(d, 0);
|
||||
case VTankNodeTypes.LongValKeyLE: return f.Int(I(d, 1)) <= I(d, 0);
|
||||
case VTankNodeTypes.LongValKeyFlagExists: return (f.Int(I(d, 1)) & I(d, 0)) != 0;
|
||||
case VTankNodeTypes.DoubleValKeyGE: return f.Double(FloatKey(I(d, 1))) >= D(d, 0);
|
||||
case VTankNodeTypes.DoubleValKeyLE: return f.Double(FloatKey(I(d, 1))) <= D(d, 0);
|
||||
case VTankNodeTypes.TotalRatingsGE:
|
||||
{
|
||||
int total = 0;
|
||||
foreach (int k in LootItemRules.RatingKeys) total += f.Int(k);
|
||||
return total >= D(d, 0);
|
||||
}
|
||||
case VTankNodeTypes.SpellNameMatch:
|
||||
{
|
||||
Regex? rx = Get(d[0]);
|
||||
if (rx == null) return false;
|
||||
foreach (string n in f.Spells)
|
||||
if (!string.IsNullOrEmpty(n) && SafeMatch(rx, n)) return true;
|
||||
return false;
|
||||
}
|
||||
case VTankNodeTypes.SpellMatch:
|
||||
{
|
||||
Regex? pos = Get(d[0]);
|
||||
if (pos == null) return false;
|
||||
Regex? neg = string.IsNullOrWhiteSpace(d[1]) ? null : Get(d[1]);
|
||||
int want = I(d, 2), n = 0;
|
||||
foreach (string name in f.Spells)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name)) continue;
|
||||
if (SafeMatch(pos, name) && (neg == null || !SafeMatch(neg, name)) && ++n >= want) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
case VTankNodeTypes.SpellCountGE: return f.Spells.Count >= I(d, 0);
|
||||
case VTankNodeTypes.MinDamageGE:
|
||||
{
|
||||
int max = f.Int(LootItemRules.KeyDamage);
|
||||
if (max == 0) return false;
|
||||
return max - f.Double(22) * max >= D(d, 0);
|
||||
}
|
||||
case VTankNodeTypes.BuffedLongValKeyGE: return f.Int(I(d, 1)) >= D(d, 0);
|
||||
case VTankNodeTypes.BuffedDoubleValKeyGE: return f.Double(FloatKey(I(d, 1))) >= D(d, 0);
|
||||
case VTankNodeTypes.CalcdBuffedTinkedDamageGE: return f.Int(LootItemRules.KeyDamage) >= D(d, 0);
|
||||
default:
|
||||
// Character, colour and palette conditions: nothing saved to judge them on.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsDisabled(VTankLootCondition c) =>
|
||||
c.DataLines.Count > 0 && string.Equals(c.DataLines[0].Trim(), "true", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
private static int I(IList<string> d, int i) => int.Parse(d[i], NumberStyles.Integer, CultureInfo.InvariantCulture);
|
||||
private static double D(IList<string> d, int i) =>
|
||||
double.Parse(d[i], NumberStyles.Float | NumberStyles.AllowThousands, CultureInfo.InvariantCulture);
|
||||
|
||||
/// <summary>VTank's appraisal-profile float keys (Decal 0x0A0000xx) as the property they read (RynthAi's FloatKey).</summary>
|
||||
private static int FloatKey(int key) => unchecked((uint)key) switch
|
||||
{
|
||||
0x0A000000 => 13, 0x0A000001 => 14, 0x0A000002 => 15, 0x0A000003 => 18, 0x0A000004 => 19,
|
||||
0x0A000005 => 17, 0x0A000006 => 16, 0x0A000009 => 280, 0x0A00000B => 22, 0x0A00000C => 62, 0x0A00000E => 63,
|
||||
_ => key,
|
||||
};
|
||||
|
||||
private static bool IsMatch(string value, string pattern)
|
||||
{
|
||||
Regex? rx = Get(pattern);
|
||||
return rx != null && SafeMatch(rx, value ?? string.Empty);
|
||||
}
|
||||
|
||||
private static bool SafeMatch(Regex rx, string s)
|
||||
{
|
||||
try { return rx.IsMatch(s); }
|
||||
catch (RegexMatchTimeoutException) { return false; }
|
||||
}
|
||||
|
||||
private static Regex? Get(string pattern)
|
||||
{
|
||||
lock (RegexGate)
|
||||
{
|
||||
if (RegexCache.TryGetValue(pattern, out Regex? rx)) return rx;
|
||||
try { rx = new Regex(pattern, Rx, RxTimeout); }
|
||||
catch (ArgumentException) { rx = null; }
|
||||
if (RegexCache.Count > 512) RegexCache.Clear();
|
||||
RegexCache[pattern] = rx;
|
||||
return rx;
|
||||
}
|
||||
}
|
||||
}
|
||||
103
Shared/RynthCore.LootSdk/Editing/LootFindSpec.cs
Normal file
103
Shared/RynthCore.LootSdk/Editing/LootFindSpec.cs
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using RynthCore.Loot.VTank;
|
||||
|
||||
namespace RynthCore.Loot.Editing;
|
||||
|
||||
// "Find items like this" (2026-10-24): the Inventory panel's right-click builds a rule with the
|
||||
// "Add to loot profile" checklist, but instead of saving it, filters with it. For the current
|
||||
// inventory RynthAi judges each item itself (its looter's evaluator); for Global Inventory the
|
||||
// rule travels to RynthInventory as one chat-command argument, "/ginv like <spec>", and is
|
||||
// judged there on the saved items (LootFactsMatcher). This is that argument.
|
||||
//
|
||||
// Format: base64url (no padding) of UTF-8 text, one line each:
|
||||
// rf1 the tag (version)
|
||||
// <label> what the filter is called ("like Gold Ring")
|
||||
// <nodeType>\t<line>\t<line>... one per condition, its VTank data lines
|
||||
// Tabs and line breaks inside a line are turned into spaces (no condition the checklist makes
|
||||
// has either). Unknown tags are refused, so a newer engine's spec can't be misread.
|
||||
|
||||
/// <summary>A filter rule as it travels to Global Inventory: a label and the rule's conditions.</summary>
|
||||
public sealed class LootFindSpec
|
||||
{
|
||||
public const string Tag = "rf1";
|
||||
/// <summary>The longest encoded spec accepted (a checklist rule is a few hundred characters).</summary>
|
||||
public const int MaxLength = 16 * 1024;
|
||||
|
||||
public string Label { get; set; } = string.Empty;
|
||||
public List<VTankLootCondition> Conditions { get; } = new();
|
||||
|
||||
/// <summary>The spec for <paramref name="conditions"/> (disabled-rule markers left out).</summary>
|
||||
public static string Encode(string label, IEnumerable<VTankLootCondition> conditions)
|
||||
{
|
||||
var sb = new StringBuilder(256);
|
||||
sb.Append(Tag).Append('\n').Append(Clean(label)).Append('\n');
|
||||
foreach (VTankLootCondition c in conditions)
|
||||
{
|
||||
if (c.NodeType == VTankNodeTypes.DisabledRule) continue;
|
||||
sb.Append(c.NodeType.ToString(CultureInfo.InvariantCulture));
|
||||
foreach (string line in c.DataLines) sb.Append('\t').Append(Clean(line));
|
||||
sb.Append('\n');
|
||||
}
|
||||
return Convert.ToBase64String(Encoding.UTF8.GetBytes(sb.ToString())).TrimEnd('=').Replace('+', '-').Replace('/', '_');
|
||||
}
|
||||
|
||||
/// <summary>Reads a spec; false (with a reason for the player) when it isn't one.</summary>
|
||||
public static bool TryDecode(string? text, out LootFindSpec spec, out string error)
|
||||
{
|
||||
spec = new LootFindSpec();
|
||||
error = string.Empty;
|
||||
string s = (text ?? string.Empty).Trim();
|
||||
if (s.Length == 0 || s.Length > MaxLength)
|
||||
{
|
||||
error = s.Length == 0 ? "No filter given." : "The filter is too long.";
|
||||
return false;
|
||||
}
|
||||
string body;
|
||||
try
|
||||
{
|
||||
string b64 = s.Replace('-', '+').Replace('_', '/');
|
||||
b64 = b64.PadRight(b64.Length + (4 - b64.Length % 4) % 4, '=');
|
||||
body = Encoding.UTF8.GetString(Convert.FromBase64String(b64));
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
error = "That isn't a filter from the Inventory panel.";
|
||||
return false;
|
||||
}
|
||||
string[] lines = body.Replace("\r", string.Empty).Split('\n');
|
||||
if (lines.Length < 2 || lines[0] != Tag)
|
||||
{
|
||||
error = "That filter comes from a newer or older RynthAi; right-click the item again.";
|
||||
return false;
|
||||
}
|
||||
spec.Label = lines[1].Trim();
|
||||
for (int i = 2; i < lines.Length; i++)
|
||||
{
|
||||
if (lines[i].Length == 0) continue;
|
||||
string[] parts = lines[i].Split('\t');
|
||||
if (!int.TryParse(parts[0], NumberStyles.Integer, CultureInfo.InvariantCulture, out int type))
|
||||
{
|
||||
error = "The filter is damaged (a condition without a type).";
|
||||
return false;
|
||||
}
|
||||
var data = new List<string>(parts.Length - 1);
|
||||
for (int j = 1; j < parts.Length; j++) data.Add(parts[j]);
|
||||
spec.Conditions.Add(new VTankLootCondition(type, "0", data));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>The conditions in words, one line each ("Class is Jewelry", "Workmanship >= 7").</summary>
|
||||
public List<string> Describe()
|
||||
{
|
||||
var lines = new List<string>(Conditions.Count);
|
||||
foreach (VTankLootCondition c in Conditions) lines.Add(LootRuleText.Condition(c));
|
||||
return lines;
|
||||
}
|
||||
|
||||
private static string Clean(string? s) =>
|
||||
string.IsNullOrEmpty(s) ? string.Empty : s.Replace('\t', ' ').Replace('\r', ' ').Replace('\n', ' ');
|
||||
}
|
||||
|
|
@ -21,6 +21,15 @@ public enum LootItemAttributeOp
|
|||
Exactly = 1,
|
||||
AtMost = 2,
|
||||
Not = 3,
|
||||
/// <summary>
|
||||
/// A flags value (imbues, damage types) has any of the picked flags (2026-11-07): "has Fire Rending",
|
||||
/// "has Any elemental rend". VTank's Long Key Has Flag, (value AND flags) != 0.
|
||||
/// </summary>
|
||||
HasAny = 4,
|
||||
/// <summary>Any value at all (2026-11-07): "any slayer", "any imbue". Long Key >= 1.</summary>
|
||||
Any = 5,
|
||||
/// <summary>A flags value has every picked flag (2026-11-07, multi imbues): one Long Key Has Flag per flag.</summary>
|
||||
HasAll = 6,
|
||||
/// <summary>A spell by its exact name.</summary>
|
||||
SpellExact = 10,
|
||||
/// <summary>This spell at this tier or a higher one (Major Strength: Major, Epic or Legendary).</summary>
|
||||
|
|
@ -32,7 +41,7 @@ public enum LootItemAttributeOp
|
|||
/// <summary>One checklist row while a rule is built (the wire form is LootEditItemAttribute).</summary>
|
||||
public sealed class LootItemAttribute
|
||||
{
|
||||
internal enum Shape { Long, Double, TotalRatings, Spell, CantripTier, SpellCount }
|
||||
internal enum Shape { Long, Double, TotalRatings, Spell, CantripTier, SpellCount, SpellFamily, ObjectClass }
|
||||
|
||||
public string Id { get; init; } = string.Empty;
|
||||
public string Group { get; init; } = string.Empty;
|
||||
|
|
@ -43,11 +52,17 @@ public sealed class LootItemAttribute
|
|||
internal int Key { get; init; }
|
||||
internal double ItemValue { get; init; }
|
||||
public string ItemText { get; init; } = string.Empty;
|
||||
public LootItemAttributeOp[] Ops { get; init; } = Array.Empty<LootItemAttributeOp>();
|
||||
public LootItemAttributeOp[] Ops { get; set; } = Array.Empty<LootItemAttributeOp>();
|
||||
/// <summary>The item's value can be replaced by a typed number.</summary>
|
||||
public bool Editable { get; init; }
|
||||
/// <summary>Spell rows: the spell's name.</summary>
|
||||
/// <summary>Spell rows: the spell's name (SpellFamily rows: the family, Key its level).</summary>
|
||||
internal string Spell { get; init; } = string.Empty;
|
||||
/// <summary>The values a named row can take (material names, skills, classes...), or null: the value is typed or fixed.</summary>
|
||||
internal (int Id, string Name)[]? Choices { get; set; }
|
||||
/// <summary>The value is a set of flags (imbues, damage types): several can be picked at once (2026-11-07).</summary>
|
||||
public bool Flags { get; set; }
|
||||
/// <summary>SpellFamily rows: the family's spells by level (the catalog's), or null: a name pattern.</summary>
|
||||
internal LootSpellFamily? Family { get; init; }
|
||||
|
||||
// Where the row stands now (defaults, then the player's choice).
|
||||
public bool On { get; set; }
|
||||
|
|
@ -60,17 +75,31 @@ public sealed class LootItemAttribute
|
|||
{
|
||||
Id = Id, Group = Group, Label = Label, ItemValue = ItemText, Tip = Tip, Editable = Editable, On = On,
|
||||
Op = (int)Op, Ops = new List<int>(Array.ConvertAll(Ops, o => (int)o)),
|
||||
Value = Editable ? LootItemAttributes.Number(Value) : ItemText,
|
||||
Value = Editable || Choices != null ? LootItemAttributes.Number(Value) : ItemText,
|
||||
Choices = Choices == null ? null : new List<LootEditName>(Array.ConvertAll(Choices, c => new LootEditName { Id = c.Id, Name = c.Name })),
|
||||
Flags = Flags,
|
||||
};
|
||||
}
|
||||
|
||||
public static class LootItemAttributes
|
||||
{
|
||||
public const string GroupItem = "Item", GroupGear = "Weapon / Armor", GroupRatings = "Ratings", GroupSpells = "Spells",
|
||||
public const string GroupItem = "Item", GroupGear = "Weapon / Armor", GroupCards = "Weapon cards", GroupRatings = "Ratings", GroupSpells = "Spells",
|
||||
GroupPet = "Pet essence", GroupT11 = "T11", GroupRequirements = "Requirements";
|
||||
|
||||
/// <summary>Cantrip tiers, lowest first: "Major Strength" is tier 2.</summary>
|
||||
public static readonly string[] CantripTiers = { "Minor", "Major", "Epic", "Legendary" };
|
||||
public static readonly string[] CantripTiers = { "Minor", "Major", "Epic", "Legendary", "Paragon" };
|
||||
|
||||
/// <summary>
|
||||
/// The regex alternation for cantrip tiers <paramref name="from"/> and up. Paragon is also
|
||||
/// written "Paragon's" by some servers, so it takes an optional "'s".
|
||||
/// </summary>
|
||||
public static string TierAlternation(int from)
|
||||
{
|
||||
var parts = new List<string>();
|
||||
for (int i = Math.Max(0, from); i < CantripTiers.Length; i++)
|
||||
parts.Add(CantripTiers[i] == "Paragon" ? "Paragon(?:'s)?" : CantripTiers[i]);
|
||||
return string.Join("|", parts);
|
||||
}
|
||||
private static readonly string[] Roman = { "I", "II", "III", "IV", "V", "VI", "VII", "VIII" };
|
||||
|
||||
// Pet essence property ids (ACECustom; the Mini Remote's PetStats reads the same).
|
||||
|
|
@ -96,10 +125,20 @@ 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). \"has any\" matches an item with any of the picked ones: "
|
||||
+ "\"Any elemental rend\" is every element, one rend is that element only. A caster's spell armor rend is the "
|
||||
+ "Armor Rending imbue on a wand, staff or orb."),
|
||||
new(GroupItem, 166, false, "Slayer", Cmp.Named),
|
||||
new(GroupItem, 45, false, "Damage type", Cmp.Named),
|
||||
// ACECustom appraisal properties (2026-11-07).
|
||||
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 retail rare (its rare id); any rare: >= 1."),
|
||||
new(GroupItem, 114, false, "Attuned", Cmp.Min, "1 when attuned (can't be traded)."),
|
||||
new(GroupItem, 33, false, "Bonded", Cmp.Min, "1 when bonded (stays on death)."),
|
||||
new(GroupItem, 319, false, "Max item level", Cmp.Min, "Items that level up (Aetheria, legendary keys...)."),
|
||||
|
||||
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 +150,26 @@ 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, "Fraction 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),
|
||||
|
||||
// ACECustom's weapon cards: the real properties, then the ones only the appraisal text carries
|
||||
// (RynthAi's virtual keys, read from "Property Details:").
|
||||
new(GroupCards, 147, true, "Biting Strike", Cmp.Min, "Crit chance (0.4 = 40%)."),
|
||||
new(GroupCards, 136, true, "Crushing Blow", Cmp.Min, "Stored as the crit damage multiplier minus 1 (4.0 = 5x crit damage)."),
|
||||
new(GroupCards, 155, true, "Armor Cleaving", Cmp.Min, "Any armor cleaving: >= 0.01 (the server only checks that it is set)."),
|
||||
new(GroupCards, 157, true, "Resistance Cleaving", Cmp.Min, "The vuln it applies (0.5 = +50% damage)."),
|
||||
new(GroupCards, 263, false, "Resistance Cleaving element", Cmp.Named),
|
||||
new(GroupCards, 292, false, "Cleaving targets", Cmp.Min, "Total targets it hits (the extra targets plus one)."),
|
||||
new(GroupCards, 9031, false, "Split arrows", Cmp.Min, "Extra arrows a launcher fires."),
|
||||
new(GroupCards, T11Keys.SlayerDamage, false, "Slayer damage %", Cmp.Min, "The slayer card's damage, 2.1x = 210 (from the appraisal text)."),
|
||||
new(GroupCards, T11Keys.AllCreaturesSlayer, false, "All Creatures slayer", Cmp.Min, "1 for an all-creatures slayer (from the appraisal text; Slayer Type is 0 on these)."),
|
||||
new(GroupCards, T11Keys.RendPower, false, "Rend power %", Cmp.Min, "The rend card's bonus, +213% = 213 (from the appraisal text)."),
|
||||
new(GroupCards, T11Keys.SpellArmorRend, false, "Spell Armor Rend %", Cmp.Min, "Casters: the Spell Armor the spells ignore, 35% = 35 (from the appraisal text; there is no imbue bit for it)."),
|
||||
new(GroupCards, T11Keys.Phantom, false, "Phantom", Cmp.Min, "1 when it ignores magic protections (from the appraisal text)."),
|
||||
|
||||
// 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 +180,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),
|
||||
|
|
@ -160,7 +219,7 @@ public static class LootItemAttributes
|
|||
foreach (Spec s in Specs)
|
||||
if (s.IsDouble == isDouble && !keys.Contains(s.Key)) keys.Add(s.Key);
|
||||
if (!isDouble)
|
||||
foreach (int k in new[] { KeyUseRequiresSkill, KeyUseRequiresSkillSpec })
|
||||
foreach (int k in new[] { KeyUseRequiresSkill, KeyUseRequiresSkillSpec, 303, 304, 305, 306, 51100, 9060 })
|
||||
if (!keys.Contains(k)) keys.Add(k);
|
||||
return keys.ToArray();
|
||||
}
|
||||
|
|
@ -178,6 +237,14 @@ public static class LootItemAttributes
|
|||
/// The item's rows with their defaults: ticked for "items like this" (<paramref name="like"/>)
|
||||
/// what that match always required, the T11 rows when <paramref name="includeT11"/>.
|
||||
/// </summary>
|
||||
/// <summary>An item's checklist; off Infinite Leaftide (<paramref name="ilt"/> false) without the T11, card and pet rows.</summary>
|
||||
public static List<LootItemAttribute> For(LootItemFacts f, bool like, bool includeT11, bool ilt)
|
||||
{
|
||||
List<LootItemAttribute> rows = For(f, like, includeT11 && ilt);
|
||||
if (!ilt) rows.RemoveAll(r => r.Group == GroupT11 || r.Group == GroupPet || (r.Kind == LootItemAttribute.Shape.Long && IsCustomServerKey(r.Key)));
|
||||
return rows;
|
||||
}
|
||||
|
||||
public static List<LootItemAttribute> For(LootItemFacts f, bool like, bool includeT11)
|
||||
{
|
||||
var rows = new List<LootItemAttribute>();
|
||||
|
|
@ -192,7 +259,18 @@ public static class LootItemAttributes
|
|||
if (s.Cmp == Cmp.Named ? v == 0 : v <= 0) continue;
|
||||
// A pet's level comes from 369 when it has one (PetStats does the same).
|
||||
if (s.Key == KeyUseLevelRequirement && f.Int(KeyUseRequiresLevel) > 0) continue;
|
||||
rows.Add(PropertyRow(s, v, likeKeys.Contains(s.IsDouble ? -s.Key : s.Key)));
|
||||
LootItemAttribute pr = PropertyRow(s, v, likeKeys.Contains(s.IsDouble ? -s.Key : s.Key));
|
||||
if (!s.IsDouble && s.Key == LootItemFacts.ImbuedEffectKey)
|
||||
{
|
||||
// Two or more imbues (Armor Rending + Cold Rending): the item's set is "has all", not "has any"
|
||||
// (2026-11-08: a rule that took any one of them).
|
||||
long iv = (long)v;
|
||||
if ((iv & (iv - 1)) != 0) pr.Op = LootItemAttributeOp.HasAll;
|
||||
rows.Add(pr);
|
||||
rows.Add(RendRow(on: false));
|
||||
continue;
|
||||
}
|
||||
rows.Add(pr);
|
||||
}
|
||||
// Spells and T11 go after the ratings and before Requirements.
|
||||
int req = rows.FindIndex(r => r.Group == GroupRequirements);
|
||||
|
|
@ -200,6 +278,7 @@ public static class LootItemAttributes
|
|||
if (req >= 0) rows.RemoveRange(req, rows.Count - req);
|
||||
AddSpellRows(rows, f, like);
|
||||
AddT11Rows(rows, f, includeT11);
|
||||
AddT11ItemRows(rows, f);
|
||||
rows.AddRange(tail);
|
||||
return rows;
|
||||
}
|
||||
|
|
@ -240,22 +319,57 @@ public static class LootItemAttributes
|
|||
return k;
|
||||
}
|
||||
|
||||
// ── "Plus a rend" (2026-11-08, Silentkelpie: "armor rend is one imbue, and then a elemental rend also can be on
|
||||
// a item ... it should be able to find items with armor rend + bs + cs, but also with any elemental on it") ──
|
||||
// A second row on the imbue key: "has any" of the rends, besides the Imbue row's own test. "Imbue has all
|
||||
// Armor Rending" with "Plus a rend: Any elemental rend" is an Armor Rending weapon with a rend of any element.
|
||||
|
||||
/// <summary>The rend row's id (the Imbue row is "L:179").</summary>
|
||||
public const string RendRowId = "L:179:rend";
|
||||
private const int RendBits = Physical | Elements | Nether;
|
||||
|
||||
private static LootItemAttribute RendRow(bool on)
|
||||
{
|
||||
var list = new List<(int, string)>();
|
||||
foreach (var c in LootRuleText.ImbuedEffects)
|
||||
if ((c.Id & ~RendBits) == 0) list.Add((c.Id, c.Name));
|
||||
// The "any" picks first: the row is for one rend of several.
|
||||
list.Sort((a, b) => (IsSingle(b.Item1) ? 0 : 1).CompareTo(IsSingle(a.Item1) ? 0 : 1));
|
||||
var ops = new[] { LootItemAttributeOp.HasAny };
|
||||
return new LootItemAttribute
|
||||
{
|
||||
Id = RendRowId, Group = GroupItem, Label = "Plus a rend",
|
||||
Tip = "Besides the Imbue row: the item also has one of these rends (\"Any elemental rend\": any element). "
|
||||
+ "Imbue \"has all\" Armor Rending with this row on: Armor Rending and a rend of any element.",
|
||||
Kind = LootItemAttribute.Shape.Long, Key = LootItemFacts.ImbuedEffectKey, ItemText = "any",
|
||||
Ops = ops, Op = ops[0], Editable = false, On = on, Choices = list.ToArray(), Flags = true,
|
||||
Value = list.Count > 0 ? list[0].Item1 : 0,
|
||||
};
|
||||
}
|
||||
|
||||
private static LootItemAttribute PropertyRow(Spec s, double v, bool on)
|
||||
{
|
||||
LootItemAttributeOp[] ops = s.Cmp switch
|
||||
{
|
||||
Cmp.Named => new[] { LootItemAttributeOp.Exactly, LootItemAttributeOp.Not },
|
||||
// Flags (imbues, damage types): "has any" / "has all" of several picks; for imbues they come first
|
||||
// (an item can carry two). Every named row can ask for "any" value: any slayer, any imbue.
|
||||
Cmp.Named when LootRuleText.ValueTableIsFlags(s.Key) && s.Key == LootItemFacts.ImbuedEffectKey
|
||||
=> new[] { LootItemAttributeOp.HasAny, LootItemAttributeOp.HasAll, LootItemAttributeOp.Exactly, LootItemAttributeOp.Not, LootItemAttributeOp.Any },
|
||||
Cmp.Named when LootRuleText.ValueTableIsFlags(s.Key)
|
||||
=> new[] { LootItemAttributeOp.Exactly, LootItemAttributeOp.HasAny, LootItemAttributeOp.HasAll, LootItemAttributeOp.Not, LootItemAttributeOp.Any },
|
||||
Cmp.Named => new[] { LootItemAttributeOp.Exactly, LootItemAttributeOp.Not, LootItemAttributeOp.Any },
|
||||
Cmp.Max => new[] { LootItemAttributeOp.AtMost, LootItemAttributeOp.Exactly, LootItemAttributeOp.AtLeast },
|
||||
_ => new[] { LootItemAttributeOp.AtLeast, LootItemAttributeOp.Exactly, LootItemAttributeOp.AtMost },
|
||||
};
|
||||
string text = s.IsDouble ? Number(v) : NamedOrNumber(s.Key, (int)v);
|
||||
(int Id, string Name)[]? choices = s.Cmp == Cmp.Named && !s.IsDouble ? LootRuleText.ValueTableFor(s.Key) : null;
|
||||
return new LootItemAttribute
|
||||
{
|
||||
Id = (s.IsDouble ? "D:" : "L:") + s.Key.ToString(CultureInfo.InvariantCulture),
|
||||
Group = s.Group, Label = s.Label, Tip = s.Tip,
|
||||
Kind = s.IsDouble ? LootItemAttribute.Shape.Double : LootItemAttribute.Shape.Long,
|
||||
Key = s.Key, ItemValue = v, ItemText = text, Ops = ops, Editable = s.Cmp != Cmp.Named,
|
||||
On = on, Op = ops[0], Value = v,
|
||||
On = on, Op = ops[0], Value = v, Choices = choices, Flags = choices != null && LootRuleText.ValueTableIsFlags(s.Key),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -321,7 +435,7 @@ public static class LootItemAttributes
|
|||
if (TryCantrip(spell, out int tier, out string rest))
|
||||
{
|
||||
from = op == LootItemAttributeOp.SpellAnyTier ? 0 : tier;
|
||||
return "^(" + string.Join("|", CantripTiers, from, CantripTiers.Length - from) + ") " + LootItemRules.EscapeText(rest) + "$";
|
||||
return "^(" + TierAlternation(from) + ") " + LootItemRules.EscapeText(rest) + "$";
|
||||
}
|
||||
if (TryLevel(spell, out int level, out rest))
|
||||
{
|
||||
|
|
@ -362,7 +476,7 @@ public static class LootItemAttributes
|
|||
{
|
||||
Id = "spell:" + s, Group = GroupSpells, Label = s, Kind = LootItemAttribute.Shape.Spell, Spell = s,
|
||||
ItemText = cantrip ? CantripTiers[tier] + " cantrip" : leveled ? "level " + Roman[level - 1] : "spell",
|
||||
Tip = cantrip ? "Or better: this cantrip at this tier or higher. Any tier: Minor to Legendary."
|
||||
Tip = cantrip ? "Or better: this cantrip at this tier or higher. Any tier: Minor to Paragon."
|
||||
: leveled ? "Or better: this spell at this level or higher. Any tier: any level."
|
||||
: "The item has this spell.",
|
||||
Ops = ops, On = on, Op = ops[0],
|
||||
|
|
@ -407,6 +521,32 @@ public static class LootItemAttributes
|
|||
/// off by default. Left out on purpose: Can Wield (the character), Zone Locked (where it
|
||||
/// was appraised), property slots and Tainted (bag state, not quality).
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// ACECustom's newer loot items (2026-11-11, <see cref="T11Items"/>): a clicked item bounty, school gem, Charm Infusion
|
||||
/// Gem, levelled charm or lum token gets "T11 item is (kind)", ticked, and its tier / coins, not ticked.
|
||||
/// </summary>
|
||||
private static void AddT11ItemRows(List<LootItemAttribute> rows, LootItemFacts f)
|
||||
{
|
||||
int kind = f.Int(T11Keys.ItemKind);
|
||||
if (kind <= 0) return;
|
||||
void Row(string id, string label, int key, int v, bool named, bool on)
|
||||
{
|
||||
LootItemAttributeOp[] ops = named ? new[] { LootItemAttributeOp.Exactly, LootItemAttributeOp.Not }
|
||||
: new[] { LootItemAttributeOp.AtLeast, LootItemAttributeOp.Exactly, LootItemAttributeOp.AtMost };
|
||||
rows.Add(new LootItemAttribute
|
||||
{
|
||||
Id = "t11:" + id, Group = GroupT11, Label = label, Kind = LootItemAttribute.Shape.Long, Key = key,
|
||||
ItemValue = v, ItemText = named ? NamedOrNumber(key, v) : Number(v), Ops = ops, Choices = named ? T11Items.Kinds : null,
|
||||
Editable = !named, On = on, Op = ops[0], Value = v,
|
||||
});
|
||||
}
|
||||
Row("itemkind", "T11 item", T11Keys.ItemKind, kind, named: true, on: true);
|
||||
int tier = f.Int(T11Keys.ItemTier);
|
||||
if (tier > 0) Row("itemtier", kind == T11Items.SchoolGem ? "Earned at tier" : "Bounty tier", T11Keys.ItemTier, tier, named: false, on: false);
|
||||
int coins = f.Int(T11Keys.InfusionCoins);
|
||||
if (coins > 0) Row("coins", "Infusion gem coins", T11Keys.InfusionCoins, coins, named: false, on: false);
|
||||
}
|
||||
|
||||
private static void AddT11Rows(List<LootItemAttribute> rows, LootItemFacts f, bool on)
|
||||
{
|
||||
T11ItemInfo? t = f.T11;
|
||||
|
|
@ -439,6 +579,8 @@ public static class LootItemAttributes
|
|||
}
|
||||
if (valuelessSpecial) Row("special", "Has slot special", T11Keys.HasSlotSpecial, 1, named: false, equal: true);
|
||||
if (t.Procs.Count > 0) Row("cos", "Cast on Strike count", T11Keys.CastOnStrikeCount, t.Procs.Count, named: false);
|
||||
if (f.Int(51100) > 0) Row("rare", "T11 rare", 51100, f.Int(51100), named: true, def: false);
|
||||
if (t.WeaponQuality > 0) Row("quality", "Weapon quality (0-1000)", 9060, t.WeaponQuality, named: false, def: false);
|
||||
|
||||
foreach (var (key, label) in new[] { (T11Keys.ModifierCount, "Modifier count"), (T11Keys.ModifierRatingTotal, "Modifier rating total"), (T11Keys.BestRollPercent, "Best roll %") })
|
||||
if (T11Keys.TryGetValue(t, key, null, out int v) && v > 0)
|
||||
|
|
@ -471,7 +613,19 @@ public static class LootItemAttributes
|
|||
r.On = c.On;
|
||||
if (c.Op >= 0 && Array.IndexOf(r.Ops, (LootItemAttributeOp)c.Op) >= 0) r.Op = (LootItemAttributeOp)c.Op;
|
||||
string typed = (c.Value ?? string.Empty).Trim();
|
||||
if (!r.Editable || typed.Length == 0) continue;
|
||||
if (typed.Length == 0) continue;
|
||||
if (r.Choices != null)
|
||||
{
|
||||
// A named value picked from the row's list (another material, skill, class...).
|
||||
if (int.TryParse(typed, NumberStyles.Integer, CultureInfo.InvariantCulture, out int pick)
|
||||
&& (Array.Exists(r.Choices, x => x.Id == pick) || (r.Flags && pick != 0 && (pick & ~AllBits(r.Choices)) == 0)))
|
||||
{
|
||||
r.Value = pick;
|
||||
r.Typed = typed;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!r.Editable) continue;
|
||||
bool whole = r.Kind != LootItemAttribute.Shape.Double;
|
||||
if (double.TryParse(typed, NumberStyles.Float, CultureInfo.InvariantCulture, out double v) && v >= 0 && (!whole || v == Math.Floor(v)))
|
||||
{
|
||||
|
|
@ -494,6 +648,24 @@ public static class LootItemAttributes
|
|||
string key = r.Key.ToString(CultureInfo.InvariantCulture);
|
||||
switch (r.Kind)
|
||||
{
|
||||
case LootItemAttribute.Shape.Long when r.Op == LootItemAttributeOp.Any:
|
||||
rule.Conditions.Add(Cond(VTankNodeTypes.LongValKeyGE, "1", key));
|
||||
break;
|
||||
case LootItemAttribute.Shape.Long when r.Op == LootItemAttributeOp.HasAll:
|
||||
{
|
||||
// One "has flag" per picked flag: the item needs every one of them.
|
||||
long mask = (long)r.Value;
|
||||
bool any = false;
|
||||
for (int bit = 0; bit < 31; bit++)
|
||||
{
|
||||
long f = 1L << bit;
|
||||
if ((mask & f) == 0) continue;
|
||||
rule.Conditions.Add(Cond(VTankNodeTypes.LongValKeyFlagExists, f.ToString(CultureInfo.InvariantCulture), key));
|
||||
any = true;
|
||||
}
|
||||
if (!any) n--;
|
||||
break;
|
||||
}
|
||||
case LootItemAttribute.Shape.Long:
|
||||
string iv = ((long)r.Value).ToString(CultureInfo.InvariantCulture);
|
||||
int type = r.Op switch
|
||||
|
|
@ -501,6 +673,7 @@ public static class LootItemAttributes
|
|||
LootItemAttributeOp.Exactly => VTankNodeTypes.LongValKeyE,
|
||||
LootItemAttributeOp.AtMost => VTankNodeTypes.LongValKeyLE,
|
||||
LootItemAttributeOp.Not => VTankNodeTypes.LongValKeyNE,
|
||||
LootItemAttributeOp.HasAny => VTankNodeTypes.LongValKeyFlagExists,
|
||||
_ => VTankNodeTypes.LongValKeyGE,
|
||||
};
|
||||
rule.Conditions.Add(Cond(type, iv, key));
|
||||
|
|
@ -517,8 +690,14 @@ public static class LootItemAttributes
|
|||
rule.Conditions.Add(Cond(VTankNodeTypes.SpellNameMatch, SpellPattern(r.Spell, r.Op)));
|
||||
break;
|
||||
case LootItemAttribute.Shape.CantripTier:
|
||||
string tiers = string.Join("|", CantripTiers, r.Key, CantripTiers.Length - r.Key);
|
||||
rule.Conditions.Add(Cond(VTankNodeTypes.SpellMatch, "^(" + tiers + ") ", string.Empty, Number(r.Value)));
|
||||
rule.Conditions.Add(Cond(VTankNodeTypes.SpellMatch, "^(" + TierAlternation(r.Key) + ") ", string.Empty, Number(r.Value)));
|
||||
break;
|
||||
case LootItemAttribute.Shape.SpellFamily:
|
||||
rule.Conditions.Add(Cond(VTankNodeTypes.SpellNameMatch,
|
||||
r.Family != null ? r.Family.Pattern(r.Key, r.Op) : FamilyPattern(r.Spell, r.Key, r.Op)));
|
||||
break;
|
||||
case LootItemAttribute.Shape.ObjectClass:
|
||||
rule.Conditions.Add(Cond(VTankNodeTypes.ObjectClass, ((long)r.Value).ToString(CultureInfo.InvariantCulture)));
|
||||
break;
|
||||
case LootItemAttribute.Shape.SpellCount:
|
||||
rule.Conditions.Add(Cond(VTankNodeTypes.SpellCountGE, Number(r.Value)));
|
||||
|
|
@ -530,6 +709,409 @@ public static class LootItemAttributes
|
|||
|
||||
private static VTankLootCondition Cond(int type, params string[] lines) => new(type, "0", lines);
|
||||
|
||||
// ── Spells picked from the standard lists (2026-10-24) ──────────────────
|
||||
|
||||
/// <summary>
|
||||
/// The spell condition for a family at a level: "Strength" level 6, or better: the Self or
|
||||
/// Other spell at VI, VII or VIII (exact: VI only; any tier: I to VIII).
|
||||
/// </summary>
|
||||
public static string FamilyPattern(string family, int level, LootItemAttributeOp op)
|
||||
{
|
||||
int from = op == LootItemAttributeOp.SpellAnyTier ? 0 : Math.Clamp(level, 1, Roman.Length) - 1;
|
||||
string levels = op == LootItemAttributeOp.SpellExact ? Roman[from] : string.Join("|", Roman, from, Roman.Length - from);
|
||||
return "^" + LootItemRules.EscapeText(family) + "( Self| Other)? (" + levels + ")$";
|
||||
}
|
||||
|
||||
/// <summary>The roman numeral for a spell level (1-8).</summary>
|
||||
public static string RomanLevel(int level) => Roman[Math.Clamp(level, 1, Roman.Length) - 1];
|
||||
|
||||
/// <summary>
|
||||
/// Rows for the spells the player added from the lists: a leveled family ("spell", Name the
|
||||
/// family, Level 1-8) or a cantrip ("cantrip", Name without tier, Level the tier index).
|
||||
/// Ticked; "or better" unless the extra says otherwise. They go after the item's spells.
|
||||
/// </summary>
|
||||
public static void AddExtras(List<LootItemAttribute> rows, IReadOnlyList<LootEditItemExtra>? extras, LootSpellCatalog? spells = null)
|
||||
{
|
||||
if (extras == null || extras.Count == 0) return;
|
||||
int at = rows.FindIndex(r => r.Group == GroupPet || r.Group == GroupT11 || r.Group == GroupRequirements);
|
||||
if (at < 0) at = rows.Count;
|
||||
var ops = new[] { LootItemAttributeOp.SpellOrBetter, LootItemAttributeOp.SpellExact, LootItemAttributeOp.SpellAnyTier };
|
||||
var add = new List<LootItemAttribute>();
|
||||
foreach (LootEditItemExtra x in extras)
|
||||
{
|
||||
string name = LootItemRules.OneLine(x.Name).Trim();
|
||||
if (name.Length == 0) continue;
|
||||
string id = ExtraId(x);
|
||||
if (rows.Exists(r => r.Id == id) || add.Exists(r => r.Id == id)) continue;
|
||||
LootItemAttributeOp op = Array.IndexOf(ops, (LootItemAttributeOp)x.Op) >= 0 ? (LootItemAttributeOp)x.Op : ops[0];
|
||||
if (x.Kind == LootEditItemExtra.Cantrip)
|
||||
{
|
||||
string spell = CantripTiers[Math.Clamp(x.Level, 0, CantripTiers.Length - 1)] + " " + name;
|
||||
add.Add(new LootItemAttribute
|
||||
{
|
||||
Id = id, Group = GroupSpells, Label = spell, Kind = LootItemAttribute.Shape.Spell, Spell = spell,
|
||||
ItemText = "added", Tip = "Added from the cantrip list. Or better: this tier or higher; any tier: Minor to Paragon.",
|
||||
Ops = ops, On = true, Op = op,
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
int level = Math.Clamp(x.Level, 1, Roman.Length);
|
||||
add.Add(new LootItemAttribute
|
||||
{
|
||||
Id = id, Group = GroupSpells, Label = name + " " + Roman[level - 1], Kind = LootItemAttribute.Shape.SpellFamily,
|
||||
Spell = name, Key = level, ItemText = "added", Family = spells?.Find(name),
|
||||
Tip = "Added from the spell list (the Self or Other spell). Or better: this level or higher; any tier: any level.",
|
||||
Ops = ops, On = true, Op = op,
|
||||
});
|
||||
}
|
||||
}
|
||||
rows.InsertRange(at, add);
|
||||
}
|
||||
|
||||
/// <summary>The row id an extra spell gets ("x:spell:Strength:6", "x:cantrip:3:Strength").</summary>
|
||||
public static string ExtraId(LootEditItemExtra x) =>
|
||||
x.Kind == LootEditItemExtra.Cantrip
|
||||
? "x:cantrip:" + x.Level.ToString(CultureInfo.InvariantCulture) + ":" + LootItemRules.OneLine(x.Name).Trim()
|
||||
: "x:spell:" + LootItemRules.OneLine(x.Name).Trim() + ":" + x.Level.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
/// <summary>
|
||||
/// The checklist without an item (the Inventory panel's and Global Inventory's own filter,
|
||||
/// 2026-10-24): every attribute a rule can test, unticked and with a value to fill in; a
|
||||
/// Class row first; named values pick from their lists; a row per cantrip tier; T11's
|
||||
/// summary keys. The spells come from the lists (<see cref="AddExtras"/>).
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// An ACECustom / Infinite Leaftide-only key (2026-11-07, Silentkelpie: "make sure all t11 attributes
|
||||
/// stuff is gated behind infinite leaftide"): RynthAi's virtual T11 and weapon-card keys, ACECustom's
|
||||
/// own property range (9000+: pets, split arrows, T11 weapon quality) and its Zc keys (50000+).
|
||||
/// Decal's and VTank's synthetic keys (0x0A..., 0x0D...) are retail.
|
||||
/// </summary>
|
||||
public static bool IsCustomServerKey(int key) => T11Keys.IsVirtual(key) || (key >= 9000 && key < 0x0A000000);
|
||||
|
||||
/// <summary>The blank checklist (every attribute); off Infinite Leaftide without the T11, card and pet rows.</summary>
|
||||
public static List<LootItemAttribute> ForBlank(bool ilt = true)
|
||||
{
|
||||
List<LootItemAttribute> all = ForBlankAll();
|
||||
if (!ilt) all.RemoveAll(r => r.Group == GroupT11 || r.Group == GroupPet || (r.Kind == LootItemAttribute.Shape.Long && IsCustomServerKey(r.Key)));
|
||||
return all;
|
||||
}
|
||||
|
||||
private static List<LootItemAttribute> ForBlankAll()
|
||||
{
|
||||
var rows = new List<LootItemAttribute>();
|
||||
var classes = Array.FindAll(LootRuleText.ObjectClasses, c => c.Id != (int)AcObjectClass.Unknown && !NotAnItem((AcObjectClass)c.Id));
|
||||
Array.Sort(classes, (a, b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase));
|
||||
rows.Add(new LootItemAttribute
|
||||
{
|
||||
Id = "class", Group = GroupItem, Label = "Class", Kind = LootItemAttribute.Shape.ObjectClass,
|
||||
Tip = "The kind of item (Decal / VTank object class).", ItemText = "any",
|
||||
Ops = new[] { LootItemAttributeOp.Exactly }, Op = LootItemAttributeOp.Exactly, Choices = classes,
|
||||
Value = classes.Length > 0 ? classes[0].Id : 0,
|
||||
});
|
||||
foreach (Spec s in Specs)
|
||||
{
|
||||
if (s.Group == GroupRatings && s.Key == 370)
|
||||
rows.Add(new LootItemAttribute
|
||||
{
|
||||
Id = "ratings", Group = GroupRatings, Label = "Total ratings", Kind = LootItemAttribute.Shape.TotalRatings,
|
||||
Tip = "Damage, damage resist, crit, crit resist, crit damage, crit damage resist, heal boost and vitality ratings added up.",
|
||||
ItemText = "any", Ops = new[] { LootItemAttributeOp.AtLeast }, Editable = true, Op = LootItemAttributeOp.AtLeast,
|
||||
});
|
||||
if (s.Group == GroupRequirements && !rows.Exists(r => r.Group == GroupSpells)) AddBlankSpellRows(rows);
|
||||
LootItemAttribute r = PropertyRow(s, 0, false);
|
||||
(int Id, string Name)[]? table = r.Choices;
|
||||
rows.Add(new LootItemAttribute
|
||||
{
|
||||
Id = r.Id, Group = r.Group, Label = r.Label, Tip = r.Tip, Kind = r.Kind, Key = r.Key, Ops = r.Ops, Op = r.Op,
|
||||
// A named value without a list (equip slots, armor set) is typed as its number here.
|
||||
Editable = r.Editable || table == null, Choices = table, Flags = r.Flags, ItemText = "any",
|
||||
Value = table != null && table.Length > 0 ? table[0].Id : 0,
|
||||
});
|
||||
if (!s.IsDouble && s.Key == LootItemFacts.ImbuedEffectKey) rows.Add(RendRow(on: false));
|
||||
}
|
||||
if (!rows.Exists(r => r.Group == GroupSpells)) AddBlankSpellRows(rows);
|
||||
|
||||
// T11: the keys that need no particular item, before Requirements.
|
||||
int t11At = rows.FindIndex(r => r.Group == GroupRequirements);
|
||||
if (t11At < 0) t11At = rows.Count;
|
||||
var t11 = new List<LootItemAttribute>();
|
||||
void T11Row(string id, string label, int key, bool named, bool equal = false)
|
||||
{
|
||||
LootItemAttributeOp[] ops = equal ? new[] { LootItemAttributeOp.Exactly }
|
||||
: new[] { LootItemAttributeOp.AtLeast, LootItemAttributeOp.Exactly, LootItemAttributeOp.AtMost };
|
||||
(int Id, string Name)[]? choices = named ? LootRuleText.ValueTableFor(key) : null;
|
||||
t11.Add(new LootItemAttribute
|
||||
{
|
||||
Id = "t11:" + id, Group = GroupT11, Label = label, Kind = LootItemAttribute.Shape.Long, Key = key,
|
||||
ItemText = equal ? "yes" : "any", Ops = ops, Op = ops[0], Editable = !named && !equal, Choices = choices,
|
||||
Value = equal ? 1 : choices != null && choices.Length > 0 ? choices[0].Id : 0,
|
||||
});
|
||||
}
|
||||
T11Row("is", "Is T11", T11Keys.IsT11, named: false, equal: true);
|
||||
T11Row("tier", "Tier", T11Keys.EstimatedTier, named: false);
|
||||
T11Row("grade", "Weapon grade", T11Keys.WeaponGrade, named: true);
|
||||
T11Row("dmgpct", "Damage %", T11Keys.DamagePercent, named: false);
|
||||
T11Row("geargrade", "Gear grade", T11Keys.GearGrade, named: true);
|
||||
T11Row("cos", "Cast on Strike count", T11Keys.CastOnStrikeCount, named: false);
|
||||
T11Row("rare", "T11 rare", 51100, named: true);
|
||||
T11Row("quality", "Weapon quality (0-1000)", 9060, named: false);
|
||||
T11Row("sum:" + T11Keys.ModifierCount.ToString(CultureInfo.InvariantCulture), "Modifier count", T11Keys.ModifierCount, named: false);
|
||||
T11Row("sum:" + T11Keys.ModifierRatingTotal.ToString(CultureInfo.InvariantCulture), "Modifier rating total", T11Keys.ModifierRatingTotal, named: false);
|
||||
// ACECustom's newer loot items (2026-11-11, T11Items): "T11 item is School gem", "Item tier at least 15".
|
||||
T11Row("itemkind", "T11 item (bounty, gem, token...)", T11Keys.ItemKind, named: true);
|
||||
T11Row("itemtier", "T11 item tier (bounty, school gem)", T11Keys.ItemTier, named: false);
|
||||
T11Row("coins", "Infusion gem coins", T11Keys.InfusionCoins, named: false);
|
||||
rows.InsertRange(t11At, t11);
|
||||
return rows;
|
||||
}
|
||||
|
||||
// ── A rule back onto the checklist (2026-11-07: edit a rule with the same checklist) ──────
|
||||
|
||||
/// <summary>
|
||||
/// The checklist choices that make <paramref name="conditions"/> again, on the blank checklist's
|
||||
/// <paramref name="rows"/>; what no row can say (spells by name, string matches, the Disabled
|
||||
/// marker, a second condition on the same key...) goes to <paramref name="leftovers"/>, kept as
|
||||
/// written. Rebuilding with the choices plus the leftovers gives the same tests back.
|
||||
/// </summary>
|
||||
public static List<LootEditItemChoice> ChoicesFromRule(List<LootItemAttribute> rows, IReadOnlyList<VTankLootCondition> conditions,
|
||||
out List<VTankLootCondition> leftovers)
|
||||
{
|
||||
var picked = new Dictionary<string, LootEditItemChoice>();
|
||||
leftovers = new List<VTankLootCondition>();
|
||||
static bool Int(IList<string> d, int i, out long v)
|
||||
{
|
||||
v = 0;
|
||||
return i < d.Count && long.TryParse(d[i].Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, out v);
|
||||
}
|
||||
static bool Dbl(IList<string> d, int i, out double v)
|
||||
{
|
||||
v = 0;
|
||||
return i < d.Count && double.TryParse(d[i].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out v);
|
||||
}
|
||||
bool Take(LootItemAttribute? r, LootItemAttributeOp op, string value)
|
||||
{
|
||||
if (r == null || picked.ContainsKey(r.Id) || Array.IndexOf(r.Ops, op) < 0) return false;
|
||||
// A named value the row's list doesn't have would be dropped by Apply: keep it as written.
|
||||
if (r.Choices != null && op != LootItemAttributeOp.Any
|
||||
&& long.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out long pv)
|
||||
&& !Array.Exists(r.Choices, x => x.Id == pv)
|
||||
&& !(r.Flags && pv > 0 && (pv & ~(long)AllBits(r.Choices)) == 0)) return false;
|
||||
picked[r.Id] = new LootEditItemChoice { Id = r.Id, On = true, Op = (int)op, Value = value };
|
||||
return true;
|
||||
}
|
||||
string N(double v) => Number(v);
|
||||
|
||||
foreach (VTankLootCondition c in conditions)
|
||||
{
|
||||
IList<string> d = c.DataLines;
|
||||
bool ok = false;
|
||||
switch (c.NodeType)
|
||||
{
|
||||
case VTankNodeTypes.ObjectClass when Int(d, 0, out long cls):
|
||||
ok = Take(rows.Find(r => r.Kind == LootItemAttribute.Shape.ObjectClass), LootItemAttributeOp.Exactly, N(cls));
|
||||
break;
|
||||
case VTankNodeTypes.LongValKeyGE or VTankNodeTypes.LongValKeyLE or VTankNodeTypes.LongValKeyE
|
||||
or VTankNodeTypes.LongValKeyNE or VTankNodeTypes.LongValKeyFlagExists when Int(d, 0, out long val) && Int(d, 1, out long key):
|
||||
{
|
||||
LootItemAttribute? r = rows.Find(x => x.Kind == LootItemAttribute.Shape.Long && x.Key == key && x.Id != RendRowId);
|
||||
if (r == null) break;
|
||||
// "Has flag" of several rends (any elemental rend) on the imbue key: the "Plus a rend" row, when
|
||||
// the Imbue row has its own test already or the rule tests the imbue key more than once.
|
||||
LootItemAttribute? rend = rows.Find(x => x.Id == RendRowId);
|
||||
if (c.NodeType == VTankNodeTypes.LongValKeyFlagExists && rend != null && key == LootItemFacts.ImbuedEffectKey
|
||||
&& !IsSingle(val) && (val & ~RendBits) == 0 && !picked.ContainsKey(rend.Id)
|
||||
&& (picked.ContainsKey(r.Id) || ImbueTests(conditions) > 1))
|
||||
{
|
||||
ok = Take(rend, LootItemAttributeOp.HasAny, N(val));
|
||||
break;
|
||||
}
|
||||
if (c.NodeType == VTankNodeTypes.LongValKeyFlagExists && picked.TryGetValue(r.Id, out LootEditItemChoice? had)
|
||||
&& (had.Op == (int)LootItemAttributeOp.HasAny || had.Op == (int)LootItemAttributeOp.HasAll)
|
||||
&& Array.IndexOf(r.Ops, LootItemAttributeOp.HasAll) >= 0
|
||||
&& long.TryParse(had.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out long hv)
|
||||
&& hv > 0 && IsSingle(val)
|
||||
&& (had.Op == (int)LootItemAttributeOp.HasAll || IsSingle(hv)))
|
||||
{
|
||||
// A second "has flag" on the same key: the item needs both (has all).
|
||||
had.Op = (int)LootItemAttributeOp.HasAll;
|
||||
had.Value = N(hv | val);
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
LootItemAttributeOp op = c.NodeType switch
|
||||
{
|
||||
VTankNodeTypes.LongValKeyLE => LootItemAttributeOp.AtMost,
|
||||
VTankNodeTypes.LongValKeyE => LootItemAttributeOp.Exactly,
|
||||
VTankNodeTypes.LongValKeyNE => LootItemAttributeOp.Not,
|
||||
VTankNodeTypes.LongValKeyFlagExists => LootItemAttributeOp.HasAny,
|
||||
_ => r.Choices != null && val == 1 && Array.IndexOf(r.Ops, LootItemAttributeOp.Any) >= 0
|
||||
? LootItemAttributeOp.Any : LootItemAttributeOp.AtLeast,
|
||||
};
|
||||
// A named row has no >= / <=: those stay as written.
|
||||
ok = Take(r, op, N(val));
|
||||
break;
|
||||
}
|
||||
case VTankNodeTypes.DoubleValKeyGE or VTankNodeTypes.DoubleValKeyLE when Dbl(d, 0, out double dv) && Int(d, 1, out long dkey):
|
||||
{
|
||||
LootItemAttribute? r = rows.Find(x => x.Kind == LootItemAttribute.Shape.Double && x.Key == dkey);
|
||||
if (r == null) break;
|
||||
bool ge = c.NodeType == VTankNodeTypes.DoubleValKeyGE;
|
||||
if (picked.TryGetValue(r.Id, out LootEditItemChoice? had) && had.Value == N(dv)
|
||||
&& had.Op == (int)(ge ? LootItemAttributeOp.AtMost : LootItemAttributeOp.AtLeast))
|
||||
{
|
||||
had.Op = (int)LootItemAttributeOp.Exactly; // >= and <= the same value
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
ok = Take(r, ge ? LootItemAttributeOp.AtLeast : LootItemAttributeOp.AtMost, N(dv));
|
||||
break;
|
||||
}
|
||||
case VTankNodeTypes.TotalRatingsGE when Dbl(d, 0, out double tr):
|
||||
ok = Take(rows.Find(r => r.Kind == LootItemAttribute.Shape.TotalRatings), LootItemAttributeOp.AtLeast, N(tr));
|
||||
break;
|
||||
case VTankNodeTypes.SpellCountGE when Dbl(d, 0, out double sc):
|
||||
ok = Take(rows.Find(r => r.Kind == LootItemAttribute.Shape.SpellCount), LootItemAttributeOp.AtLeast, N(sc));
|
||||
break;
|
||||
case VTankNodeTypes.SpellMatch when d.Count >= 3 && (d[1] ?? string.Empty).Length == 0 && Dbl(d, 2, out double cn):
|
||||
{
|
||||
LootItemAttribute? r = rows.Find(x => x.Kind == LootItemAttribute.Shape.CantripTier
|
||||
&& d[0] == "^(" + TierAlternation(x.Key) + ") ");
|
||||
ok = Take(r, LootItemAttributeOp.AtLeast, N(cn));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!ok) leftovers.Add(c);
|
||||
}
|
||||
return new List<LootEditItemChoice>(picked.Values);
|
||||
}
|
||||
|
||||
private static bool IsSingle(long v) => v > 0 && (v & (v - 1)) == 0;
|
||||
|
||||
/// <summary>How many of the conditions test the imbue key (179).</summary>
|
||||
private static int ImbueTests(IReadOnlyList<VTankLootCondition> conditions)
|
||||
{
|
||||
int n = 0;
|
||||
foreach (VTankLootCondition c in conditions)
|
||||
if (c.NodeType is VTankNodeTypes.LongValKeyGE or VTankNodeTypes.LongValKeyLE or VTankNodeTypes.LongValKeyE
|
||||
or VTankNodeTypes.LongValKeyNE or VTankNodeTypes.LongValKeyFlagExists
|
||||
&& c.DataLines.Count > 1 && c.DataLines[1]?.Trim() == "179") n++;
|
||||
return n;
|
||||
}
|
||||
|
||||
/// <summary>Every flag a flags row's list names (single flags and the "any of" picks).</summary>
|
||||
internal static int AllBits((int Id, string Name)[] choices)
|
||||
{
|
||||
int all = 0;
|
||||
foreach (var c in choices) all |= c.Id;
|
||||
return all;
|
||||
}
|
||||
|
||||
// ── Imbues by class (2026-11-07, from ACECustom's loot and recipes) ──────────────────────
|
||||
// Melee and missile weapons: Critical Strike, Crippling Blow, Armor Rending and the physical and
|
||||
// elemental rends; ACECustom's drops OR a rend matching the weapon's element with Armor Rending, so
|
||||
// they can carry several. Casters: the same, with Nether Rending (ACECustom casters carry Armor
|
||||
// Rending too, besides the Spell Armor Rend card). Armor, clothing and jewelry: the defense imbues,
|
||||
// one at a time.
|
||||
private const int Crit = 1, Cripple = 2, ArmorRend = 4, Slash = 8, Pierce = 16, Bludge = 32, Acid = 64, Cold = 128,
|
||||
Elec = 256, Fire = 512, MeleeDef = 1024, MissileDef = 2048, MagicDef = 4096, Nether = 16384;
|
||||
private const int Physical = Slash | Pierce | Bludge, Elements = Acid | Cold | Elec | Fire;
|
||||
|
||||
/// <summary>The imbue flags a class can carry (null: no class, every imbue), and whether it can carry several.</summary>
|
||||
public static int? ImbuesFor(int objectClass, out bool several)
|
||||
{
|
||||
several = true;
|
||||
switch ((AcObjectClass)objectClass)
|
||||
{
|
||||
case AcObjectClass.MeleeWeapon:
|
||||
case AcObjectClass.MissileWeapon:
|
||||
return Crit | Cripple | ArmorRend | Physical | Elements;
|
||||
case AcObjectClass.WandStaffOrb:
|
||||
// Armor Rending too: ACECustom casters carry it (rules like "Caster Slayer + Nether Rend + AR").
|
||||
return Crit | Cripple | ArmorRend | Physical | Elements | Nether;
|
||||
case AcObjectClass.Armor:
|
||||
case AcObjectClass.Clothing:
|
||||
case AcObjectClass.Jewelry:
|
||||
several = false;
|
||||
return MeleeDef | MissileDef | MagicDef;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Imbue row's list for the class (<paramref name="objectClass"/>; 0 or unknown: every imbue):
|
||||
/// only the imbues it can carry, the "any of" picks cut down to them, and "has all" only where a
|
||||
/// class carries several.
|
||||
/// </summary>
|
||||
public static void FilterImbues(List<LootItemAttribute> rows, int objectClass)
|
||||
{
|
||||
LootItemAttribute? r = rows.Find(x => x.Kind == LootItemAttribute.Shape.Long && x.Key == LootItemFacts.ImbuedEffectKey && x.Choices != null && x.Id != RendRowId);
|
||||
if (r == null) return;
|
||||
int? allowed = ImbuesFor(objectClass, out bool several);
|
||||
if (allowed is not int ok) return;
|
||||
// "Plus a rend": the class's rends only; none (armor, jewelry): no row (2026-11-08).
|
||||
LootItemAttribute? rend = rows.Find(x => x.Id == RendRowId);
|
||||
if (rend?.Choices != null)
|
||||
{
|
||||
// One rend: the class must carry it. An "any" pick: kept while two or more of its rends fit the class
|
||||
// ("Any elemental rend" on a sword: nether never turns up there, the rest do).
|
||||
var keep = Array.FindAll(rend.Choices, c => IsSingle(c.Id) ? (c.Id & ok) == c.Id : !IsSingle(c.Id & ok) && (c.Id & ok) != 0);
|
||||
if (keep.Length == 0 || (ok & RendBits) == 0) { if (!rend.On) rows.Remove(rend); }
|
||||
else
|
||||
{
|
||||
rend.Choices = keep;
|
||||
if (!Array.Exists(keep, c => c.Id == (int)rend.Value)) rend.Value = keep[0].Id;
|
||||
}
|
||||
}
|
||||
var list = new List<(int, string)>();
|
||||
var seen = new HashSet<int>();
|
||||
foreach (var c in LootRuleText.ImbuedEffects)
|
||||
{
|
||||
int bits = c.Id & ok;
|
||||
if (bits == 0) continue;
|
||||
bool single = (c.Id & (c.Id - 1)) == 0;
|
||||
// An "any of" pick keeps its name only while every flag it names fits the class.
|
||||
if (!single && (bits != c.Id || (bits & (bits - 1)) == 0)) continue;
|
||||
if (seen.Add(c.Id)) list.Add((c.Id, c.Name));
|
||||
}
|
||||
r.Choices = list.ToArray();
|
||||
if (!several)
|
||||
{
|
||||
r.Ops = Array.FindAll(r.Ops, o => o != LootItemAttributeOp.HasAll);
|
||||
if (r.Op == LootItemAttributeOp.HasAll) r.Op = r.Ops[0];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The class the checklist is for: the ticked Class row's (blank), else 0.</summary>
|
||||
internal static int TickedClass(List<LootItemAttribute> rows)
|
||||
{
|
||||
LootItemAttribute? c = rows.Find(x => x.Kind == LootItemAttribute.Shape.ObjectClass);
|
||||
return c != null && c.On ? (int)c.Value : 0;
|
||||
}
|
||||
|
||||
/// <summary>The blank checklist's spell group: a cantrip count per tier and the spell count.</summary>
|
||||
private static void AddBlankSpellRows(List<LootItemAttribute> rows)
|
||||
{
|
||||
for (int t = 0; t < CantripTiers.Length; t++)
|
||||
rows.Add(new LootItemAttribute
|
||||
{
|
||||
Id = "cantrips:" + CantripTiers[t], Group = GroupSpells,
|
||||
Label = t == CantripTiers.Length - 1 ? CantripTiers[t] + " cantrips" : CantripTiers[t] + "-or-better cantrips",
|
||||
Kind = LootItemAttribute.Shape.CantripTier, Key = t, ItemText = "any", Ops = new[] { LootItemAttributeOp.AtLeast },
|
||||
Editable = true, Op = LootItemAttributeOp.AtLeast, Value = 1, Tip = "How many cantrips of this tier or higher.",
|
||||
});
|
||||
rows.Add(new LootItemAttribute
|
||||
{
|
||||
Id = "spellcount", Group = GroupSpells, Label = "Spell count", Kind = LootItemAttribute.Shape.SpellCount,
|
||||
ItemText = "any", Ops = new[] { LootItemAttributeOp.AtLeast }, Editable = true, Op = LootItemAttributeOp.AtLeast, Value = 1,
|
||||
});
|
||||
}
|
||||
|
||||
private static bool NotAnItem(AcObjectClass c) => c is AcObjectClass.Monster or AcObjectClass.Player or AcObjectClass.Vendor
|
||||
or AcObjectClass.Door or AcObjectClass.Corpse or AcObjectClass.Lifestone or AcObjectClass.Portal or AcObjectClass.Npc
|
||||
or AcObjectClass.Sign or AcObjectClass.Housing;
|
||||
|
||||
/// <summary>A number as rules write it: whole numbers plain, decimals to 4 places.</summary>
|
||||
public static string Number(double v) => v.ToString("0.####", CultureInfo.InvariantCulture);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,8 +37,30 @@ public sealed class LootItemFacts
|
|||
|
||||
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;
|
||||
public int Int(int key)
|
||||
{
|
||||
if (key != ImbuedEffectKey)
|
||||
{
|
||||
if (Ints.TryGetValue(key, out int v)) return v;
|
||||
// A virtual T11 / card key the scan didn't store: read it from the item's text.
|
||||
return T11Keys.IsVirtual(key) && T11 != null && T11Keys.TryGetValue(T11, key, null, out int t) ? t : 0;
|
||||
}
|
||||
// Every imbue: ImbuedEffect and ImbuedEffect2..5 ORed, as ACE's GetImbuedEffects (2026-11-07).
|
||||
int all = 0;
|
||||
foreach (int k in ImbuedEffectKeys) if (Ints.TryGetValue(k, out int b)) all |= b;
|
||||
return all;
|
||||
}
|
||||
|
||||
public const int ImbuedEffectKey = 179;
|
||||
/// <summary>ImbuedEffect (179) and ImbuedEffect2..5 (303-306).</summary>
|
||||
public static readonly int[] ImbuedEffectKeys = { 179, 303, 304, 305, 306 };
|
||||
public double Double(int key)
|
||||
{
|
||||
if (Doubles.TryGetValue(key, out double v) && (v != 0 || key != SlayerText.SlayerDamageBonusKey)) return v;
|
||||
// The server never sends the slayer bonus (float 138); the weapon's text has it ("Shadow Slayer: 1.5x Damage").
|
||||
if (key == SlayerText.SlayerDamageBonusKey && T11 is { SlayerDamagePercent: > 0 } t) return t.SlayerDamagePercent / 100.0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>How the rule recognises the item.</summary>
|
||||
|
|
@ -59,6 +81,18 @@ public sealed class LootItemRuleOptions
|
|||
public VTankLootAction? Action { get; set; }
|
||||
/// <summary>Keep # count; null: one full stack.</summary>
|
||||
public int? KeepCount { get; set; }
|
||||
/// <summary>BuildBlank makes a loot rule (the Loot Editor's Add rule), not a filter: its default name is the action and the conditions.</summary>
|
||||
public bool BlankRule { get; set; }
|
||||
/// <summary>
|
||||
/// On Infinite Leaftide (ACECustom; 2026-11-07): the T11, weapon-card and pet rows. False elsewhere:
|
||||
/// those rows aren't offered (a rule that has them keeps them as written).
|
||||
/// </summary>
|
||||
public bool Ilt { get; set; } = true;
|
||||
/// <summary>
|
||||
/// Conditions kept as written after the checklist's (editing a rule: what no checklist row can say,
|
||||
/// LootItemAttributes.ChoicesFromRule's leftovers; 2026-11-07).
|
||||
/// </summary>
|
||||
public List<VTankLootCondition>? KeepConditions { get; set; }
|
||||
/// <summary>Null or blank: "Keep Copper Pea" and the like.</summary>
|
||||
public string? RuleName { get; set; }
|
||||
/// <summary>
|
||||
|
|
@ -71,6 +105,10 @@ public sealed class LootItemRuleOptions
|
|||
/// default, which is the rule "items like this" and IncludeT11 always made.
|
||||
/// </summary>
|
||||
public IReadOnlyList<LootEditItemChoice>? Choices { get; set; }
|
||||
/// <summary>Spells and cantrips added from the standard lists (2026-10-24).</summary>
|
||||
public IReadOnlyList<LootEditItemExtra>? Extras { get; set; }
|
||||
/// <summary>The spell table's families, so an added spell lists its level VII / VIII names (null: a name pattern).</summary>
|
||||
public LootSpellCatalog? Spells { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>A built rule, ready to preview and insert.</summary>
|
||||
|
|
@ -203,8 +241,10 @@ public static class LootItemRules
|
|||
}
|
||||
|
||||
// The attribute checklist: defaults for this match, then the popup's choices.
|
||||
List<LootItemAttribute> rows = LootItemAttributes.For(f, match == LootItemMatch.Like, o.IncludeT11);
|
||||
List<LootItemAttribute> rows = LootItemAttributes.For(f, match == LootItemMatch.Like, o.IncludeT11, o.Ilt);
|
||||
LootItemAttributes.AddExtras(rows, o.Extras, o.Spells);
|
||||
LootItemAttributes.Apply(rows, o.Choices, notes);
|
||||
LootItemAttributes.FilterImbues(rows, f.ObjectClass);
|
||||
int added = LootItemAttributes.AddConditions(rule, rows);
|
||||
AddRowNotes(f, o, rows, match, notes);
|
||||
if (likeBare && added == 0)
|
||||
|
|
@ -220,6 +260,67 @@ public static class LootItemRules
|
|||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A filter rule without an item (2026-10-24): the blank checklist (every attribute,
|
||||
/// <see cref="LootItemAttributes.ForBlank"/>) with the player's choices and added spells.
|
||||
/// Only the ticked rows become conditions; nothing ticked matches every item.
|
||||
/// </summary>
|
||||
public static LootItemRuleDraft BuildBlank(LootItemRuleOptions o)
|
||||
{
|
||||
var notes = new List<string>();
|
||||
List<LootItemAttribute> rows = LootItemAttributes.ForBlank(o.Ilt);
|
||||
LootItemAttributes.AddExtras(rows, o.Extras, o.Spells);
|
||||
LootItemAttributes.Apply(rows, o.Choices, notes);
|
||||
LootItemAttributes.FilterImbues(rows, LootItemAttributes.TickedClass(rows));
|
||||
VTankLootAction action = o.Action ?? VTankLootAction.Keep;
|
||||
if (!LootRuleText.IsKnownAction((int)action)) action = VTankLootAction.Keep;
|
||||
int keep = Math.Max(0, o.KeepCount ?? 1);
|
||||
var rule = new VTankLootRule
|
||||
{
|
||||
CustomExpression = string.Empty, Action = action,
|
||||
KeepCount = action == VTankLootAction.KeepUpTo ? keep : null,
|
||||
};
|
||||
int added = LootItemAttributes.AddConditions(rule, rows);
|
||||
if (o.KeepConditions != null)
|
||||
foreach (VTankLootCondition k in o.KeepConditions)
|
||||
{
|
||||
rule.Conditions.Add(new VTankLootCondition(k.NodeType, k.LengthCode, k.DataLines));
|
||||
if (k.NodeType != VTankNodeTypes.DisabledRule)
|
||||
{
|
||||
added++;
|
||||
notes.Add("Kept as written: " + LootRuleText.Condition(k));
|
||||
}
|
||||
}
|
||||
if (added == 0) notes.Add("Nothing ticked yet: tick what the items must have.");
|
||||
string defaultName = o.BlankRule ? BlankRuleName(rule, action, keep) : "Filter";
|
||||
rule.Name = OneLine(o.RuleName).Trim().Length > 0 ? OneLine(o.RuleName).Trim() : defaultName;
|
||||
return new LootItemRuleDraft
|
||||
{
|
||||
Rule = rule, Match = LootItemMatch.Like, Action = action, KeepCount = keep, DefaultName = defaultName, Notes = notes, Attributes = rows,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A new rule's name from the checklist (2026-11-07, the Loot Editor's Add rule): the action and
|
||||
/// the first conditions in words, "Keep: Class is Jewelry, Workmanship >= 7"; "Keep (new rule)" with none.
|
||||
/// </summary>
|
||||
public static string BlankRuleName(VTankLootRule rule, VTankLootAction action, int keep)
|
||||
{
|
||||
string verb = action == VTankLootAction.KeepUpTo
|
||||
? "Keep " + keep.ToString(CultureInfo.InvariantCulture)
|
||||
: LootRuleText.ActionName(action);
|
||||
var parts = new List<string>();
|
||||
foreach (VTankLootCondition c in rule.Conditions)
|
||||
{
|
||||
if (c.NodeType == VTankNodeTypes.DisabledRule) continue;
|
||||
parts.Add(OneLine(LootRuleText.Condition(c)).Trim());
|
||||
if (parts.Count == 2) break;
|
||||
}
|
||||
if (parts.Count == 0) return verb + " (new rule)";
|
||||
string name = verb + ": " + string.Join(", ", parts);
|
||||
return name.Length <= 64 ? name : name.Substring(0, 61).TrimEnd() + "...";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What the player should know about the rows: spells "like this" left unticked, a T11 item
|
||||
/// not identified yet, T11 modifiers RynthAi has no key for, T11 asked of a non-T11 item.
|
||||
|
|
|
|||
|
|
@ -32,7 +32,38 @@ public static class LootRuleText
|
|||
};
|
||||
|
||||
/// <summary>A node type's name, ASCII.</summary>
|
||||
public static string NodeName(int type) => Ascii(VTankNodeTypes.DisplayName(type));
|
||||
/// <summary>A condition type in plain words (2026-11-07: no "Long Key" / "Double Key" jargon).</summary>
|
||||
public static string NodeName(int type) => type switch
|
||||
{
|
||||
VTankNodeTypes.ObjectClass => "Item class is",
|
||||
VTankNodeTypes.LongValKeyGE => "Property is at least",
|
||||
VTankNodeTypes.LongValKeyLE => "Property is at most",
|
||||
VTankNodeTypes.LongValKeyE => "Property equals",
|
||||
VTankNodeTypes.LongValKeyNE => "Property is not",
|
||||
VTankNodeTypes.LongValKeyFlagExists => "Property has",
|
||||
VTankNodeTypes.DoubleValKeyGE => "Decimal property is at least",
|
||||
VTankNodeTypes.DoubleValKeyLE => "Decimal property is at most",
|
||||
VTankNodeTypes.BuffedLongValKeyGE => "Buffed property is at least",
|
||||
VTankNodeTypes.BuffedDoubleValKeyGE => "Buffed decimal property is at least",
|
||||
VTankNodeTypes.StringValueMatch => "Text matches",
|
||||
VTankNodeTypes.SpellNameMatch => "Has a spell matching",
|
||||
VTankNodeTypes.SpellCountGE => "Number of spells is at least",
|
||||
VTankNodeTypes.SpellMatch => "Spells matching, at least",
|
||||
VTankNodeTypes.MinDamageGE => "Min damage is at least",
|
||||
VTankNodeTypes.DamagePercentGE => "Damage % is at least",
|
||||
VTankNodeTypes.TotalRatingsGE => "Total ratings are at least",
|
||||
VTankNodeTypes.BuffedMedianDamageGE => "Buffed median damage is at least",
|
||||
VTankNodeTypes.BuffedMissileDamageGE => "Buffed missile damage is at least",
|
||||
VTankNodeTypes.CalcdBuffedTinkedDamageGE => "Buffed tinked damage is at least",
|
||||
VTankNodeTypes.CalcedBuffedTinkedTargetMeleeGE => "Tinked target melee is at least",
|
||||
VTankNodeTypes.CharacterLevelGE => "Your level is at least",
|
||||
VTankNodeTypes.CharacterLevelLE => "Your level is at most",
|
||||
VTankNodeTypes.CharacterSkillGE => "Your buffed skill is at least",
|
||||
VTankNodeTypes.CharacterBaseSkill => "Your base skill is between",
|
||||
VTankNodeTypes.CharacterMainPackEmptySlotsGE => "Your free pack slots are at least",
|
||||
VTankNodeTypes.DisabledRule => "Rule disabled",
|
||||
_ => Ascii(VTankNodeTypes.DisplayName(type)),
|
||||
};
|
||||
|
||||
private static string Ascii(string s) => s.Replace("≥", ">=").Replace("≤", "<=").Replace("≠", "!=");
|
||||
|
||||
|
|
@ -45,44 +76,50 @@ public static class LootRuleText
|
|||
{
|
||||
var keys = new List<(int, string)>
|
||||
{
|
||||
(5, "EncumbVal"), (9, "Locations"), (19, "Value"), (25, "Level"), (28, "ArmorLevel"), (44, "Damage (max)"), (45, "DamageType"),
|
||||
(48, "WeaponSkill"), (54, "WeaponEncumbrance"), // 54 was labelled MaxDamage until 2026-10-07; max damage is 44
|
||||
(5, "Burden"), (9, "Equip locations"), (19, "Value (pyreals)"), (25, "Level"), (28, "Armor level"), (44, "Max damage"), (45, "Damage type"),
|
||||
(48, "Weapon skill"), (54, "Weapon burden"), // 54 was labelled MaxDamage until 2026-10-07; max damage is 44
|
||||
// 87 / 88 were labelled MaxStructure / Structure until 2026-10-18; uses are 91 / 92
|
||||
// (what the Pets tab reads for an essence's uses), and 107 is the current mana.
|
||||
(86, "MinLevelRestrict"), (87, "MaxLevelRestrict"), (88, "LockpickSkillBonus"),
|
||||
(91, "UsesTotal (MaxStructure)"), (92, "UsesRemaining (Structure)"),
|
||||
(105, "ItemWorkmanship"), (106, "ItemSpellcraft"), (107, "ItemCurMana"), (108, "ItemMaxMana"),
|
||||
(109, "ItemDifficulty (Arcane Lore)"),
|
||||
(131, "MaterialType"), (158, "WieldRequirements"), (159, "WieldSkilltype"), (160, "WieldDifficulty"),
|
||||
(86, "Min level to use"), (87, "Max level to use"), (88, "Lockpick bonus"),
|
||||
(91, "Total uses"), (92, "Uses left"),
|
||||
(105, "Workmanship"), (106, "Spellcraft"), (107, "Current mana"), (108, "Max mana"),
|
||||
(109, "Arcane lore difficulty"),
|
||||
(131, "Material"), (158, "Wield requirement"), (159, "Wield skill"), (160, "Wield difficulty"),
|
||||
// ACECustom / ACE appraisal: slayer weapons (166) and combat-essence pet stats (9053-9075).
|
||||
// "Slayer Type" is the player-facing name; the ACE property is still SlayerCreatureType.
|
||||
(166, "Slayer Type"), (9053, "Pet Bond Level"), (9054, "Pet Captured Damage Type"), (9056, "Pet Potency Stored"),
|
||||
(9057, "Pet Breeding Charges"), (9070, "Pet Damage Mutations"), (9071, "Pet Damage Resist Mutations"),
|
||||
(9072, "Pet Crit Mutations"), (9073, "Pet Vitality Mutations"), (9074, "Pet Potency Mutations"),
|
||||
(9075, "Pet Mutation Count"),
|
||||
(307, "Pet DamageRating"), (308, "Pet DamageResistRating"), (313, "Pet CritRating"),
|
||||
(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"),
|
||||
(372, "CritRating"), (373, "CritResistRating"), (374, "CritDamageRating"),
|
||||
(375, "CritDamageResistRating"), (376, "HealBoostRating"), (377, "NetherResistRating"), (379, "VitalityRating"),
|
||||
(166, "Slayer type"), (9053, "Pet bond level"), (9054, "Pet captured damage type"), (9056, "Pet potency stored"),
|
||||
(9057, "Pet breeding charges"), (9070, "Pet damage mutations"), (9071, "Pet damage resist mutations"),
|
||||
(9072, "Pet crit mutations"), (9073, "Pet vitality mutations"), (9074, "Pet potency mutations"),
|
||||
(9075, "Pet mutation count"),
|
||||
(307, "Pet damage rating"), (308, "Pet damage resist rating"), (313, "Pet crit rating"),
|
||||
(314, "Pet crit damage rating"), (315, "Pet crit resist rating"), (316, "Pet crit damage resist rating"),
|
||||
(362, "Summoning mastery"), (364, "Level to use"), (366, "Skill needed to use"),
|
||||
(368, "Specialized skill needed to use"), (369, "Level needed to use"),
|
||||
(179, "Imbue"), (265, "Armor set"),
|
||||
(218, "Equipped slots"), (353, "Weapon type"), (370, "Damage rating"), (371, "Damage resist rating"),
|
||||
(372, "Crit rating"), (373, "Crit resist rating"), (374, "Crit damage rating"),
|
||||
(375, "Crit damage resist rating"), (376, "Heal boost rating"), (377, "Nether resist rating"), (379, "Vitality rating"),
|
||||
(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).
|
||||
(0x0D000001, "Icon"), (0x0D000004, "ItemSlots"), (0x0D000005, "PackSlots"),
|
||||
(0x0D000006, "StackCount"), (0x0D000007, "StackMax"), (0x0D000008, "AssociatedSpell"),
|
||||
(0x0D00000B, "WieldingSlot"), (0x0D00000D, "Coverage"), (0x0D00000E, "EquipableSlots"),
|
||||
(0x0D00000F, "EquipType"), (0x0D000010, "IconOutline"), (0x0D000011, "MissileType"),
|
||||
(0x0D000012, "UsageMask"), (0x0D000014, "HookMask"), (0x0D000015, "HookType"),
|
||||
(0x0D00001A, "Category"), (0x0D00001F, "WeapSpeed"), (0x0D000020, "EquipSkill"),
|
||||
(0x0D000021, "DamageType (Decal)"), (0x0D000022, "MaxDamage"),
|
||||
(0x0D000029, "IconOverlay"), (0x0D00002A, "IconUnderlay"),
|
||||
(0x0D000001, "Icon"), (0x0D000004, "Item slots"), (0x0D000005, "Pack slots"),
|
||||
(0x0D000006, "Stack size"), (0x0D000007, "Max stack"), (0x0D000008, "Associated spell"),
|
||||
(0x0D00000B, "Wielding slot"), (0x0D00000D, "Coverage"), (0x0D00000E, "Equipable slots"),
|
||||
(0x0D00000F, "Equip type"), (0x0D000010, "Icon outline"), (0x0D000011, "Missile type"),
|
||||
(0x0D000012, "Usage mask"), (0x0D000014, "Hook mask"), (0x0D000015, "Hook type"),
|
||||
(0x0D00001A, "Category"), (0x0D00001F, "Weapon speed"), (0x0D000020, "Equip skill"),
|
||||
(0x0D000021, "Damage type (Decal)"), (0x0D000022, "Max damage (Decal)"),
|
||||
(0x0D000029, "Icon overlay"), (0x0D00002A, "Icon underlay"),
|
||||
// ACECustom T11 properties sent in the appraisal: real keys, so VTank reads them too.
|
||||
(T11.T11Catalog.PropWeaponAugScaleQuality, "WeaponAugScaleQuality"),
|
||||
(T11.T11Catalog.PropWeaponAugScaleTier, "WeaponAugScaleTier"),
|
||||
(T11.T11Catalog.PropZcTier, "ZcTier"),
|
||||
(T11.T11Catalog.PropWeaponAugScaleQuality, "T11 weapon quality"),
|
||||
(T11.T11Catalog.PropWeaponAugScaleTier, "T11 weapon quality tier"),
|
||||
(T11.T11Catalog.PropZcTier, "T11 zone tier"),
|
||||
// More of ACECustom's appraisal ints (2026-11-07).
|
||||
(17, "Rare"), (33, "Bonded"), (114, "Attuned"), (171, "Times tinkered"), (204, "Elemental damage bonus"),
|
||||
(263, "Resistance Cleaving element"), (292, "Cleaving targets"), (303, "Imbue 2"), (304, "Imbue 3"),
|
||||
(305, "Imbue 4"), (306, "Imbue 5"), (319, "Max item level"), (352, "Cloak weave proc"),
|
||||
(378, "Life resist rating"), (386, "Overpower"), (387, "Overpower resist"), (388, "Overpower rating"),
|
||||
(389, "Overpower resist rating"), (9031, "Split arrows"), (51100, "T11 rare"), (51101, "T11 rare gate tier"),
|
||||
};
|
||||
keys.AddRange(T11.T11Keys.Names());
|
||||
return keys.ToArray();
|
||||
|
|
@ -96,18 +133,20 @@ public static class LootRuleText
|
|||
/// </summary>
|
||||
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
|
||||
(144, "ManaConversionMod"), (149, "WeaponMissileDefense"),
|
||||
(150, "WeaponMagicDefense"), (152, "ElementalDamageVsMonsters"), (167, "CooldownDuration"),
|
||||
(0x0A000009, "SalvageWorkmanship"), (0x0A00000B, "Variance"),
|
||||
(0x0A00000C, "AttackBonus"), (0x0A00000E, "DamageBonus"),
|
||||
(5, "Mana rate"), (22, "Damage variance"), (29, "Melee defense bonus"), (62, "Attack bonus"),
|
||||
(63, "Damage modifier"), (138, "Slayer damage bonus"), // often unset on ACE appraisal; prefer LongDesc / int 166
|
||||
(144, "Mana conversion bonus"), (149, "Missile defense bonus"),
|
||||
(150, "Magic defense bonus"), (152, "Elemental damage vs monsters"), (167, "Cooldown (seconds)"),
|
||||
(136, "Crushing Blow"), (147, "Biting Strike"), (155, "Armor Cleaving"),
|
||||
(157, "Resistance Cleaving"), (159, "Absorb magic damage"),
|
||||
(0x0A000009, "Salvage workmanship"), (0x0A00000B, "Variance (VTank)"),
|
||||
(0x0A00000C, "Attack bonus (VTank)"), (0x0A00000E, "Damage bonus (VTank)"),
|
||||
};
|
||||
|
||||
/// <summary>String keys. Use (14) and LongDesc (16) hold the T11 "Modifiers:" / "Property Details:" text.</summary>
|
||||
public static readonly (int Id, string Name)[] StringKeys =
|
||||
{
|
||||
(1, "Name"), (5, "Inscription"), (7, "Title"), (14, "Use"), (16, "LongDesc"),
|
||||
(1, "Name"), (5, "Inscription"), (7, "Title"), (14, "Use text"), (16, "Description"),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -216,8 +255,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, Decal's Imbued): ACE's ImbuedEffectType flags. A combination (two imbues)
|
||||
/// shows as "value N". (Until 2026-11-07 these names sat on 353, which is the weapon type.)
|
||||
/// </summary>
|
||||
public static readonly (int Id, string Name)[] ImbuedEffects =
|
||||
{
|
||||
|
|
@ -225,8 +264,25 @@ public static class LootRuleText
|
|||
(16, "Pierce Rending"), (32, "Bludgeon Rending"), (64, "Acid Rending"), (128, "Cold Rending"),
|
||||
(256, "Electric Rending"), (512, "Fire Rending"), (1024, "Melee Defense"), (2048, "Missile Defense"),
|
||||
(4096, "Magic Defense"), (8192, "Spellbook"), (16384, "Nether Rending"),
|
||||
// Picks of several flags, for "has any" (2026-11-07): one rule for any of them.
|
||||
(17400, "Any elemental rend"), // slash, pierce, bludgeon, acid, cold, electric, fire, nether
|
||||
(56, "Any physical rend"), // slash, pierce, bludgeon
|
||||
(17344, "Any magical-element rend"), // acid, cold, electric, fire, nether
|
||||
(17404, "Any rend (with Armor Rending)"),
|
||||
(3, "Critical Strike or Crippling Blow"),
|
||||
(7168, "Any defense imbue"), // melee, missile, magic
|
||||
};
|
||||
|
||||
/// <summary>WeaponType (353): the weapon's mastery (ACE WeaponType), as VTank profiles test it ("353 = 9" is a crossbow).</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>ZcRare (51100): ACECustom's T11+ rares.</summary>
|
||||
public static readonly (int Id, string Name)[] ZcRares = { (1, "Pristine"), (2, "Ascendant") };
|
||||
|
||||
/// <summary>SummoningMastery (362): the pet school an essence needs (ACE SummoningMastery).</summary>
|
||||
public static readonly (int Id, string Name)[] SummoningMasteries =
|
||||
{
|
||||
|
|
@ -241,19 +297,24 @@ public static class LootRuleText
|
|||
158 => WieldRequirements,
|
||||
159 or 366 or 368 => Skills,
|
||||
166 => CreatureTypes,
|
||||
353 => ImbuedEffects,
|
||||
179 => ImbuedEffects,
|
||||
353 => WeaponTypes,
|
||||
263 => DamageTypes,
|
||||
51100 => ZcRares,
|
||||
362 => SummoningMasteries,
|
||||
T11.T11Keys.WeaponGrade => T11.T11Catalog.Grades,
|
||||
T11.T11Keys.GearGrade => T11.T11Catalog.Grades,
|
||||
T11.T11Keys.ItemKind => T11.T11Items.Kinds,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
/// <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, 263, 353, 362, 51100, 366, 368, 9054, 0x0D000020, 0x0D000021, T11.T11Keys.WeaponGrade, T11.T11Keys.GearGrade,
|
||||
T11.T11Keys.ItemKind };
|
||||
|
||||
/// <summary>
|
||||
/// True for the conditions whose value is picked by name when the key has a
|
||||
|
|
@ -261,7 +322,7 @@ public static class LootRuleText
|
|||
/// </summary>
|
||||
public static bool UsesValueNames(int nodeType) => nodeType is VTankNodeTypes.LongValKeyGE
|
||||
or VTankNodeTypes.LongValKeyLE or VTankNodeTypes.LongValKeyE or VTankNodeTypes.LongValKeyNE
|
||||
or VTankNodeTypes.BuffedLongValKeyGE;
|
||||
or VTankNodeTypes.BuffedLongValKeyGE or VTankNodeTypes.LongValKeyFlagExists; // "has Fire Rending" (2026-11-07)
|
||||
|
||||
/// <summary>
|
||||
/// A value line as a whole number: "45", " 45 " and "45.0" (a buffed-long value
|
||||
|
|
@ -299,11 +360,11 @@ public static class LootRuleText
|
|||
{
|
||||
string? name = ValueName(longKey, raw);
|
||||
if (name != null && TryParseValue(raw, out int v)) return PickerLabel(v, name);
|
||||
return "value " + (raw ?? string.Empty).Trim();
|
||||
return (raw ?? string.Empty).Trim();
|
||||
}
|
||||
|
||||
/// <summary>"Name (id)", the way the pickers list a named id.</summary>
|
||||
public static string PickerLabel(int id, string name) => name + " (" + id.ToString(CultureInfo.InvariantCulture) + ")";
|
||||
public static string PickerLabel(int id, string name) => name; // names only (2026-11-07); the id stays in the file
|
||||
|
||||
/// <summary>Object classes (Decal/VTank numbering, AcObjectClass).</summary>
|
||||
public static (int Id, string Name)[] ObjectClasses { get; } = BuildObjectClasses();
|
||||
|
|
@ -312,7 +373,7 @@ public static class LootRuleText
|
|||
{
|
||||
var list = new List<(int, string)>();
|
||||
foreach (AcObjectClass c in Enum.GetValues<AcObjectClass>())
|
||||
list.Add(((int)c, c.ToString()));
|
||||
list.Add(((int)c, ClassName(c)));
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
|
|
@ -410,6 +471,27 @@ public static class LootRuleText
|
|||
|
||||
// ── Summaries ────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>An object class in words: "Melee Weapon", "Wand / Staff / Orb" (the enum's own name split).</summary>
|
||||
public static string ClassName(AcObjectClass c) => c switch
|
||||
{
|
||||
AcObjectClass.WandStaffOrb => "Wand / Staff / Orb",
|
||||
_ => SplitWords(c.ToString()),
|
||||
};
|
||||
|
||||
/// <summary>"MeleeWeapon" as "Melee Weapon": a space before each capital that starts a word.</summary>
|
||||
public static string SplitWords(string name)
|
||||
{
|
||||
var sb = new StringBuilder(name.Length + 8);
|
||||
for (int i = 0; i < name.Length; i++)
|
||||
{
|
||||
char ch = name[i];
|
||||
if (i > 0 && char.IsUpper(ch) && (char.IsLower(name[i - 1]) || (i + 1 < name.Length && char.IsLower(name[i + 1]) && char.IsUpper(name[i - 1]))))
|
||||
sb.Append(' ');
|
||||
sb.Append(ch);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>A rule's conditions in words, joined with AND (DisabledRule nodes left out).</summary>
|
||||
public static string Summary(VTankLootRule rule, int maxLength = 160)
|
||||
{
|
||||
|
|
@ -448,39 +530,43 @@ public static class LootRuleText
|
|||
return G(0);
|
||||
}
|
||||
static string Trunc(string s, int n) => s.Length > n ? s.Substring(0, n) + "..." : s;
|
||||
// ">= 1" on a named key is the checklist's "any" (any slayer, any imbue), not "at least <the value named 1>"
|
||||
// (2026-11-08: "Slayer type at least Olthoi" for any slayer).
|
||||
bool AnyNamed() => G(0).Trim() == "1" && TryParseValue(G(1), out int k) && ValueTableFor(k) != null;
|
||||
|
||||
return c.NodeType switch
|
||||
{
|
||||
VTankNodeTypes.ObjectClass => $"Class is {Oc(0)}",
|
||||
VTankNodeTypes.LongValKeyGE => $"{Lk(1)} >= {Lv()}",
|
||||
VTankNodeTypes.LongValKeyLE => $"{Lk(1)} <= {Lv()}",
|
||||
VTankNodeTypes.LongValKeyE => $"{Lk(1)} = {Lv()}",
|
||||
VTankNodeTypes.LongValKeyNE => $"{Lk(1)} != {Lv()}",
|
||||
VTankNodeTypes.LongValKeyFlagExists => $"{Lk(1)} has flag {G(0)}",
|
||||
VTankNodeTypes.DoubleValKeyGE => $"{Dk(1)} >= {G(0)}",
|
||||
VTankNodeTypes.DoubleValKeyLE => $"{Dk(1)} <= {G(0)}",
|
||||
VTankNodeTypes.BuffedLongValKeyGE => $"buffed {Lk(1)} >= {Lv()}",
|
||||
VTankNodeTypes.BuffedDoubleValKeyGE => $"buffed {Dk(1)} >= {G(0)}",
|
||||
VTankNodeTypes.LongValKeyGE when AnyNamed() => $"any {Lk(1)}",
|
||||
VTankNodeTypes.LongValKeyGE => $"{Lk(1)} at least {Lv()}",
|
||||
VTankNodeTypes.LongValKeyLE => $"{Lk(1)} at most {Lv()}",
|
||||
VTankNodeTypes.LongValKeyE => $"{Lk(1)} is {Lv()}",
|
||||
VTankNodeTypes.LongValKeyNE => $"{Lk(1)} is not {Lv()}",
|
||||
VTankNodeTypes.LongValKeyFlagExists => $"{Lk(1)} has {Lv()}",
|
||||
VTankNodeTypes.DoubleValKeyGE => $"{Dk(1)} at least {G(0)}",
|
||||
VTankNodeTypes.DoubleValKeyLE => $"{Dk(1)} at most {G(0)}",
|
||||
VTankNodeTypes.BuffedLongValKeyGE => $"buffed {Lk(1)} at least {Lv()}",
|
||||
VTankNodeTypes.BuffedDoubleValKeyGE => $"buffed {Dk(1)} at least {G(0)}",
|
||||
VTankNodeTypes.StringValueMatch => $"{Sk(1)} matches \"{Trunc(G(0), 30)}\"",
|
||||
VTankNodeTypes.SpellNameMatch => $"spell matches \"{Trunc(G(0), 30)}\"",
|
||||
VTankNodeTypes.SpellCountGE => $"spell count >= {G(0)}",
|
||||
VTankNodeTypes.SpellMatch => $">= {G(2)} spells matching \"{Trunc(G(0), 20)}\"",
|
||||
VTankNodeTypes.MinDamageGE => $"min dmg >= {G(0)}",
|
||||
VTankNodeTypes.DamagePercentGE => $"dmg% >= {G(0)}",
|
||||
VTankNodeTypes.TotalRatingsGE => $"total ratings >= {G(0)}",
|
||||
VTankNodeTypes.BuffedMedianDamageGE => $"median dmg >= {G(0)}",
|
||||
VTankNodeTypes.BuffedMissileDamageGE => $"missile dmg >= {G(0)}",
|
||||
VTankNodeTypes.CalcdBuffedTinkedDamageGE => $"tinked dmg >= {G(0)}",
|
||||
VTankNodeTypes.CharacterLevelGE => $"char level >= {G(0)}",
|
||||
VTankNodeTypes.CharacterLevelLE => $"char level <= {G(0)}",
|
||||
VTankNodeTypes.CharacterMainPackEmptySlotsGE => $"pack slots >= {G(0)}",
|
||||
VTankNodeTypes.CharacterSkillGE => $"{Skl(1)} skill >= {G(0)}",
|
||||
VTankNodeTypes.CharacterBaseSkill => $"{Skl(0)} base in [{G(1)}, {G(2)}]",
|
||||
VTankNodeTypes.SlotExactPalette => $"palette slot {G(0)} = {G(1)}",
|
||||
VTankNodeTypes.SpellNameMatch => $"has a spell matching \"{Trunc(G(0), 30)}\"",
|
||||
VTankNodeTypes.SpellCountGE => $"at least {G(0)} spells",
|
||||
VTankNodeTypes.SpellMatch => $"at least {G(2)} spells matching \"{Trunc(G(0), 20)}\"",
|
||||
VTankNodeTypes.MinDamageGE => $"min damage at least {G(0)}",
|
||||
VTankNodeTypes.DamagePercentGE => $"damage % at least {G(0)}",
|
||||
VTankNodeTypes.TotalRatingsGE => $"total ratings at least {G(0)}",
|
||||
VTankNodeTypes.BuffedMedianDamageGE => $"buffed median damage at least {G(0)}",
|
||||
VTankNodeTypes.BuffedMissileDamageGE => $"buffed missile damage at least {G(0)}",
|
||||
VTankNodeTypes.CalcdBuffedTinkedDamageGE => $"buffed tinked damage at least {G(0)}",
|
||||
VTankNodeTypes.CharacterLevelGE => $"your level at least {G(0)}",
|
||||
VTankNodeTypes.CharacterLevelLE => $"your level at most {G(0)}",
|
||||
VTankNodeTypes.CharacterMainPackEmptySlotsGE => $"at least {G(0)} free pack slots",
|
||||
VTankNodeTypes.CharacterSkillGE => $"your buffed {Skl(1)} at least {G(0)}",
|
||||
VTankNodeTypes.CharacterBaseSkill => $"your base {Skl(0)} from {G(1)} to {G(2)}",
|
||||
VTankNodeTypes.SlotExactPalette => $"palette slot {G(0)} is {G(1)}",
|
||||
VTankNodeTypes.AnySimilarColor => "color (any similar)",
|
||||
VTankNodeTypes.SimilarColorArmorType => "color (armor type)",
|
||||
VTankNodeTypes.SlotSimilarColor => "color (slot)",
|
||||
VTankNodeTypes.CalcedBuffedTinkedTargetMeleeGE => "buffed tinked target melee",
|
||||
VTankNodeTypes.CalcedBuffedTinkedTargetMeleeGE => "tinked target melee",
|
||||
VTankNodeTypes.DisabledRule => "(rule disabled)",
|
||||
_ => $"node {c.NodeType}",
|
||||
};
|
||||
|
|
@ -488,9 +574,24 @@ public static class LootRuleText
|
|||
|
||||
// ── Vocabulary for the face ──────────────────────────────────────────
|
||||
|
||||
public static LootEditVocab BuildVocab()
|
||||
/// <summary>The vocabulary with the standard spell lists (<paramref name="spells"/>, from a spell table).</summary>
|
||||
public static LootEditVocab BuildVocab(LootSpellCatalog? spells, bool ilt = true)
|
||||
{
|
||||
var v = new LootEditVocab();
|
||||
LootEditVocab v = BuildVocab(ilt);
|
||||
if (spells == null) return v;
|
||||
foreach (LootSpellFamily f in spells.Families)
|
||||
v.SpellFamilies.Add(new LootEditSpellFamily { Name = f.Name, School = f.School, MinLevel = f.MinLevel, MaxLevel = f.MaxLevel });
|
||||
v.Cantrips.AddRange(spells.Cantrips);
|
||||
return v;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The pickers' vocabulary. Off Infinite Leaftide (<paramref name="ilt"/> false) the keys only
|
||||
/// ACECustom has (T11, cards, pets, Zc) aren't offered; a rule that uses one still shows its name.
|
||||
/// </summary>
|
||||
public static LootEditVocab BuildVocab(bool ilt = true)
|
||||
{
|
||||
var v = new LootEditVocab { Ilt = ilt };
|
||||
foreach (VTankLootAction a in Actions) v.Actions.Add(new LootEditName { Id = (int)a, Name = ActionName(a) });
|
||||
foreach (int t in VTankNodeTypes.All)
|
||||
{
|
||||
|
|
@ -503,16 +604,18 @@ public static class LootRuleText
|
|||
});
|
||||
}
|
||||
Fill(v.ObjectClasses, ObjectClasses);
|
||||
Fill(v.LongKeys, LongKeys);
|
||||
Fill(v.LongKeys, ilt ? LongKeys : Array.FindAll(LongKeys, k => !LootItemAttributes.IsCustomServerKey(k.Id)));
|
||||
Fill(v.DoubleKeys, DoubleKeys);
|
||||
Fill(v.StringKeys, StringKeys);
|
||||
Fill(v.Skills, Skills);
|
||||
foreach (int key in KeysWithValueTables)
|
||||
{
|
||||
if (!ilt && LootItemAttributes.IsCustomServerKey(key)) continue;
|
||||
var vt = new LootEditValueTable { Key = key, Flags = ValueTableIsFlags(key) };
|
||||
Fill(vt.Values, ValueTableFor(key)!);
|
||||
v.LongValueTables.Add(vt);
|
||||
}
|
||||
v.CantripTiers.AddRange(LootItemAttributes.CantripTiers);
|
||||
return v;
|
||||
|
||||
static void Fill(List<LootEditName> into, (int Id, string Name)[] from)
|
||||
|
|
|
|||
186
Shared/RynthCore.LootSdk/Editing/LootSpellCatalog.cs
Normal file
186
Shared/RynthCore.LootSdk/Editing/LootSpellCatalog.cs
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace RynthCore.Loot.Editing;
|
||||
|
||||
/// <summary>One spell table row as the catalog needs it: name, family (category) and power (difficulty).</summary>
|
||||
public readonly record struct LootSpellEntry(string Name, int Family, int Power);
|
||||
|
||||
/// <summary>
|
||||
/// One leveled spell family a checklist can add ("Strength", Creature): every spell of the
|
||||
/// family by level, I to VIII. Levels VII and VIII have their own names in the spell table
|
||||
/// ("Might of the Lugians", "Incantation of Strength Self"), so a rule lists the names.
|
||||
/// </summary>
|
||||
public sealed class LootSpellFamily
|
||||
{
|
||||
/// <summary>The family without " Self" / " Other" and without the level: "Strength", "Aura of Defender", "Impenetrability".</summary>
|
||||
public string Name { get; init; } = string.Empty;
|
||||
/// <summary><see cref="LootSpellCatalog.Creature"/>, <see cref="LootSpellCatalog.Life"/> or <see cref="LootSpellCatalog.Item"/>.</summary>
|
||||
public string School { get; init; } = string.Empty;
|
||||
/// <summary>The spells at each level (1-8).</summary>
|
||||
public SortedDictionary<int, List<string>> Levels { get; } = new();
|
||||
|
||||
public int MinLevel => Levels.Count == 0 ? 1 : FirstKey();
|
||||
public int MaxLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
int max = 1;
|
||||
foreach (int l in Levels.Keys) max = Math.Max(max, l);
|
||||
return max;
|
||||
}
|
||||
}
|
||||
|
||||
private int FirstKey()
|
||||
{
|
||||
foreach (int l in Levels.Keys) return l;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The spell condition's pattern: the family's spells at <paramref name="level"/> (exact), at it
|
||||
/// or above (or better), or at any level, each name exactly.
|
||||
/// </summary>
|
||||
public string Pattern(int level, LootItemAttributeOp op)
|
||||
{
|
||||
var names = new List<string>();
|
||||
foreach (KeyValuePair<int, List<string>> kv in Levels)
|
||||
{
|
||||
bool take = op switch
|
||||
{
|
||||
LootItemAttributeOp.SpellExact => kv.Key == level,
|
||||
LootItemAttributeOp.SpellAnyTier => true,
|
||||
_ => kv.Key >= level,
|
||||
};
|
||||
if (take) names.AddRange(kv.Value);
|
||||
}
|
||||
if (names.Count == 0) return LootItemAttributes.FamilyPattern(Name, level, op);
|
||||
var sb = new StringBuilder("^(");
|
||||
for (int i = 0; i < names.Count; i++)
|
||||
{
|
||||
if (i > 0) sb.Append('|');
|
||||
sb.Append(LootItemRules.EscapeText(names[i]));
|
||||
}
|
||||
return sb.Append(")$").ToString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The standard spell lists the Add to loot profile / Filter popups offer (2026-10-24): the
|
||||
/// leveled (I-VIII) creature, life and item enchantments, and the cantrips (Minor, Major, Epic,
|
||||
/// Legendary, Paragon), built from a spell table (RynthAi's and RynthInventory's
|
||||
/// SpellData.txt: name, family, power). Buffs only: debuffs, war and void projectiles and
|
||||
/// one-off spells are left out. "Self" and "Other" versions are one family.
|
||||
/// </summary>
|
||||
public sealed class LootSpellCatalog
|
||||
{
|
||||
public const string Creature = "Creature", Life = "Life", Item = "Item";
|
||||
public static readonly string[] Schools = { Creature, Life, Item };
|
||||
|
||||
public List<LootSpellFamily> Families { get; } = new();
|
||||
/// <summary>Cantrip names without their tier ("Coordination").</summary>
|
||||
public List<string> Cantrips { get; } = new();
|
||||
|
||||
public static readonly LootSpellCatalog Empty = new();
|
||||
|
||||
public LootSpellFamily? Find(string name) =>
|
||||
Families.Find(f => string.Equals(f.Name, name, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
// Debuffs and attacks: a family containing any of these words isn't offered.
|
||||
private static readonly string[] Excluded =
|
||||
{
|
||||
"Ineptitude", "Ignorance", "Vulnerability", "Weakness", "Clumsiness", "Slowness", "Bafflement", "Feeblemind",
|
||||
"Frailty", "Enfeeble", "Exhaustion", "Fester", "Harm", "Drain", "Depletion", "Imperil", "Defenselessness",
|
||||
"Unfamiliarity", "Benightedness", "Faithlessness", "Leaden", "Yield", "Lure", "Loather", "Brittlemail", "Hermetic Void",
|
||||
"Turn Blade", "Weaken", "Corrosion", "Corruption", "Curse", "Blight", "Hecatomb", "Expose", " Arc", "Blast", "Bolt",
|
||||
"Streak", "Volley", "Stream", "Wave", "Whirling", "Metamorphi", "Rare ", "Sigil", "Weave", "Martyr", "Paragon",
|
||||
"Answer of", "Call of", "Nuhmudira", "Virindi", "Arcanum", "Infuse", " to ",
|
||||
};
|
||||
|
||||
private static readonly string[] LifeFamilies =
|
||||
{ "Armor", "Regeneration", "Rejuvenation", "Mana Renewal", "Heal", "Revitalize", "Mana Boost" };
|
||||
|
||||
/// <summary>Spell level from power (difficulty): 1 I, 50 II ... 250 VI, 300 VII, 400 VIII; 0 for anything else.</summary>
|
||||
public static int LevelFromPower(int power) => power switch
|
||||
{
|
||||
1 => 1, 50 => 2, 100 => 3, 150 => 4, 200 => 5, 250 => 6, 300 => 7, 400 => 8, _ => 0,
|
||||
};
|
||||
|
||||
/// <summary>The catalog of <paramref name="spells"/>.</summary>
|
||||
public static LootSpellCatalog Build(IEnumerable<LootSpellEntry> spells)
|
||||
{
|
||||
var cat = new LootSpellCatalog();
|
||||
var cantrips = new SortedSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
// Per spell family (category): its base name (from a "<name> [Self|Other] I..VI" spell), Self seen, spells by level.
|
||||
var byFamily = new Dictionary<int, (string? Base, bool Self, List<(int Level, string Name)> Spells)>();
|
||||
foreach (LootSpellEntry e in spells)
|
||||
{
|
||||
string name = (e.Name ?? string.Empty).Trim();
|
||||
if (name.Length == 0) continue;
|
||||
if (LootItemAttributes.TryCantrip(name, out _, out string cantrip))
|
||||
{
|
||||
if (!LootItemAttributes.TryLevel(cantrip, out _, out _)) cantrips.Add(cantrip);
|
||||
continue;
|
||||
}
|
||||
int level = LevelFromPower(e.Power);
|
||||
if (level == 0 || e.Family <= 0) continue;
|
||||
if (!byFamily.TryGetValue(e.Family, out var fam)) fam = (null, false, new List<(int, string)>());
|
||||
if (LootItemAttributes.TryLevel(name, out int romanLevel, out string rest) && romanLevel <= 6)
|
||||
{
|
||||
string b = StripTarget(rest, out bool self);
|
||||
fam.Base ??= b;
|
||||
fam.Self |= self;
|
||||
}
|
||||
fam.Spells.Add((level, name));
|
||||
byFamily[e.Family] = fam;
|
||||
}
|
||||
var merged = new Dictionary<string, LootSpellFamily>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var (_, fam) in byFamily)
|
||||
{
|
||||
if (fam.Base == null) continue;
|
||||
string? school = SchoolOf(fam.Base, fam.Self);
|
||||
if (school == null) continue;
|
||||
if (!merged.TryGetValue(fam.Base, out LootSpellFamily? f))
|
||||
merged[fam.Base] = f = new LootSpellFamily { Name = fam.Base, School = school };
|
||||
foreach (var (level, name) in fam.Spells)
|
||||
{
|
||||
if (!f.Levels.TryGetValue(level, out List<string>? list)) f.Levels[level] = list = new List<string>();
|
||||
if (!list.Contains(name)) list.Add(name);
|
||||
}
|
||||
}
|
||||
cat.Families.AddRange(merged.Values);
|
||||
cat.Families.Sort((a, b) =>
|
||||
{
|
||||
int s = Array.IndexOf(Schools, a.School).CompareTo(Array.IndexOf(Schools, b.School));
|
||||
return s != 0 ? s : string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase);
|
||||
});
|
||||
cat.Cantrips.AddRange(cantrips);
|
||||
return cat;
|
||||
}
|
||||
|
||||
/// <summary>"Strength Self" -> "Strength" (self true); "Impenetrability" stays.</summary>
|
||||
public static string StripTarget(string rest, out bool self)
|
||||
{
|
||||
self = rest.EndsWith(" Self", StringComparison.OrdinalIgnoreCase);
|
||||
if (self) return rest.Substring(0, rest.Length - 5);
|
||||
if (rest.EndsWith(" Other", StringComparison.OrdinalIgnoreCase)) return rest.Substring(0, rest.Length - 6);
|
||||
return rest;
|
||||
}
|
||||
|
||||
private static string? SchoolOf(string family, bool hasSelf)
|
||||
{
|
||||
foreach (string w in Excluded)
|
||||
if (family.Contains(w, StringComparison.OrdinalIgnoreCase)) return null;
|
||||
if (family.StartsWith("Aura of ", StringComparison.OrdinalIgnoreCase)
|
||||
|| family.EndsWith(" Bane", StringComparison.OrdinalIgnoreCase)
|
||||
|| family.Equals("Impenetrability", StringComparison.OrdinalIgnoreCase)
|
||||
|| family.Equals("Strengthen Lock", StringComparison.OrdinalIgnoreCase))
|
||||
return Item;
|
||||
if (family.EndsWith(" Protection", StringComparison.OrdinalIgnoreCase)
|
||||
|| Array.Exists(LifeFamilies, x => x.Equals(family, StringComparison.OrdinalIgnoreCase)))
|
||||
return Life;
|
||||
// Attributes, skills and defenses: the ones a character can cast on itself.
|
||||
return hasSelf ? Creature : null;
|
||||
}
|
||||
}
|
||||
135
Shared/RynthCore.LootSdk/Editing/QuestLootProfiles.cs
Normal file
135
Shared/RynthCore.LootSdk/Editing/QuestLootProfiles.cs
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using RynthCore.Loot.VTank;
|
||||
|
||||
namespace RynthCore.Loot.Editing;
|
||||
|
||||
/// <summary>
|
||||
/// Quest loot profiles (2026-11-05): a loot profile per wiki quest, built from the player's template
|
||||
/// (LootProfiles\base-quest-dynamic.utl) and the quest's items (RynthOracle's quest guide: the
|
||||
/// {{Itemlink}} items its steps kill or loot for). Each is the template's rules with one Keep rule
|
||||
/// per quest item in front ("Quest: Shiny Red Stone", the exact name), so the quest's items are kept
|
||||
/// before anything the template does with them. Written to LootProfiles\Quests\<quest>.utl and
|
||||
/// built again each time (an edit to the template reaches every quest's profile). Host-free.
|
||||
/// </summary>
|
||||
public static class QuestLootProfiles
|
||||
{
|
||||
/// <summary>The template's file name, in the loot profile folder.</summary>
|
||||
public const string TemplateFileName = "base-quest-dynamic.utl";
|
||||
/// <summary>The quest profiles' folder, under the loot profile folder.</summary>
|
||||
public const string FolderName = "Quests";
|
||||
/// <summary>The start of a quest item's rule name (a template rule never gets one).</summary>
|
||||
public const string RulePrefix = "Quest: ";
|
||||
/// <summary>Items one profile takes at most.</summary>
|
||||
public const int MaxItems = 64;
|
||||
|
||||
/// <summary>The quest's profile file name: its title made safe for a file, ".utl".</summary>
|
||||
public static string FileNameFor(string questTitle)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
char[] bad = Path.GetInvalidFileNameChars();
|
||||
foreach (char ch in (questTitle ?? "").Trim())
|
||||
{
|
||||
if (ch < ' ' || Array.IndexOf(bad, ch) >= 0 || ch is '<' or '>' or ':' or '"' or '/' or '\\' or '|' or '?' or '*')
|
||||
sb.Append('_');
|
||||
else sb.Append(ch);
|
||||
}
|
||||
string name = sb.ToString().Trim().TrimEnd('.');
|
||||
if (name.Length == 0) name = "quest";
|
||||
if (name.Length > 120) name = name.Substring(0, 120).TrimEnd();
|
||||
return name + ".utl";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The item's name rule pattern: the exact name, any case. A wiki note in brackets at the end
|
||||
/// ("Shard of Harraag's Dagger (Quest Item)") may or may not be part of the name in the game, so
|
||||
/// the name matches with and without it.
|
||||
/// </summary>
|
||||
public static string PatternFor(string item)
|
||||
{
|
||||
string name = OneLine(item);
|
||||
int open = name.LastIndexOf(" (", StringComparison.Ordinal);
|
||||
if (open > 0 && name.EndsWith(")", StringComparison.Ordinal))
|
||||
{
|
||||
string head = name.Substring(0, open);
|
||||
string note = name.Substring(open);
|
||||
return "^" + LootItemRules.EscapeText(head) + "(" + LootItemRules.EscapeText(note) + ")?$";
|
||||
}
|
||||
return LootItemRules.ExactPattern(name);
|
||||
}
|
||||
|
||||
/// <summary>The template's rules with a Keep rule per item in front (the template is not changed).</summary>
|
||||
public static VTankLootProfile Build(VTankLootProfile? template, IEnumerable<string> items)
|
||||
{
|
||||
VTankLootProfile p = template != null
|
||||
? VTankLootParser.LoadFromText(VTankLootWriter.Serialize(template)) // a copy
|
||||
: new VTankLootProfile();
|
||||
p.FileVersion = Math.Max(1, p.FileVersion);
|
||||
p.Rules.RemoveAll(r => r.Name.StartsWith(RulePrefix, StringComparison.Ordinal)); // a template saved from a quest profile
|
||||
|
||||
var seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
var rules = new List<VTankLootRule>();
|
||||
foreach (string raw in items)
|
||||
{
|
||||
string item = OneLine(raw);
|
||||
if (item.Length == 0 || !seen.Add(item)) continue;
|
||||
if (rules.Count >= MaxItems) break;
|
||||
var rule = new VTankLootRule
|
||||
{
|
||||
Name = RulePrefix + item,
|
||||
CustomExpression = "",
|
||||
Priority = 0,
|
||||
Action = VTankLootAction.Keep,
|
||||
};
|
||||
rule.Conditions.Add(new VTankLootCondition(VTankNodeTypes.StringValueMatch, "0", new[] { PatternFor(item), "1" })); // key 1: the name
|
||||
rules.Add(rule);
|
||||
}
|
||||
p.Rules.InsertRange(0, rules);
|
||||
p.DeclaredRuleCount = p.Rules.Count;
|
||||
return p;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds the quest's profile and writes it to <paramref name="lootFolder"/>\Quests. The template is
|
||||
/// <paramref name="lootFolder"/>\base-quest-dynamic.utl (none: the quest's rules only, and
|
||||
/// <paramref name="note"/> says so). Returns the file written.
|
||||
/// </summary>
|
||||
public static string Write(string lootFolder, string questTitle, IReadOnlyList<string> items, out int rules, out string note)
|
||||
{
|
||||
note = "";
|
||||
VTankLootProfile? template = null;
|
||||
string templatePath = Path.Combine(lootFolder, TemplateFileName);
|
||||
if (File.Exists(templatePath)) template = VTankLootParser.Load(templatePath);
|
||||
else note = $"no {TemplateFileName} in the loot profile folder: the quest's items only";
|
||||
|
||||
VTankLootProfile p = Build(template, items);
|
||||
rules = 0;
|
||||
foreach (VTankLootRule r in p.Rules)
|
||||
if (r.Name.StartsWith(RulePrefix, StringComparison.Ordinal)) rules++;
|
||||
|
||||
string folder = Path.Combine(lootFolder, FolderName);
|
||||
Directory.CreateDirectory(folder);
|
||||
string path = Path.Combine(folder, FileNameFor(questTitle));
|
||||
string tmp = path + ".tmp";
|
||||
File.WriteAllText(tmp, VTankLootWriter.Serialize(p), new UTF8Encoding(false));
|
||||
File.Move(tmp, path, overwrite: true);
|
||||
return path;
|
||||
}
|
||||
|
||||
/// <summary>True when <paramref name="path"/> is a quest profile (in the Quests folder).</summary>
|
||||
public static bool IsQuestProfile(string? path, string lootFolder)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path)) return false;
|
||||
try
|
||||
{
|
||||
string dir = Path.GetFullPath(Path.GetDirectoryName(path.Trim().Trim('"')) ?? "");
|
||||
string quests = Path.GetFullPath(Path.Combine(lootFolder, FolderName));
|
||||
return string.Equals(dir.TrimEnd(Path.DirectorySeparatorChar), quests.TrimEnd(Path.DirectorySeparatorChar), StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
catch { return false; }
|
||||
}
|
||||
|
||||
private static string OneLine(string? s) => (s ?? "").Replace('\r', ' ').Replace('\n', ' ').Trim();
|
||||
}
|
||||
39
Shared/RynthCore.LootSdk/SlayerText.cs
Normal file
39
Shared/RynthCore.LootSdk/SlayerText.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace RynthCore.Loot;
|
||||
|
||||
/// <summary>
|
||||
/// A slayer weapon's damage bonus as its appraisal text says it (2026-11-15).
|
||||
/// <para>
|
||||
/// ACECustom never sends SlayerDamageBonus (float 138) in an appraisal: the property has no
|
||||
/// [AssessmentProperty] in ACE.Entity PropertyFloat, and AppraiseInfo writes the bonus only into the
|
||||
/// weapon's text as "- Shadow Slayer: 1.5x Damage". So a loot rule's "Slayer damage bonus at least
|
||||
/// 1.01" read 0 on every weapon and never matched (Silentkelpie: "is the any slayer rule working for
|
||||
/// looting"). The slayer type (int 166, "any slayer") is sent and always worked. The rule reader
|
||||
/// falls back to this text when float 138 reads nothing.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public static class SlayerText
|
||||
{
|
||||
/// <summary>SlayerDamageBonus (STypeFloat 138).</summary>
|
||||
public const int SlayerDamageBonusKey = 138;
|
||||
|
||||
private static readonly Regex Line = new(@"^\s*-?\s*(?<who>[^\r\n:]+?)\s+Slayer:\s*(?<x>\d+(?:\.\d+)?)x",
|
||||
RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.Multiline);
|
||||
|
||||
/// <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;
|
||||
}
|
||||
}
|
||||
|
|
@ -96,6 +96,19 @@ public sealed class T11ItemInfo
|
|||
public int PropertySlotCap { get; private set; }
|
||||
/// <summary>"Tainted: bags no longer work on this item".</summary>
|
||||
public bool Tainted { get; private set; }
|
||||
// ACECustom's weapon cards that reach the client only as "Property Details:" text (2026-11-07):
|
||||
// the rest (Biting Strike, Crushing Blow, Armor / Resistance Cleaving, Cleaving) are real properties.
|
||||
/// <summary>"- Spell Armor Rend: 35% Spell Armor Ignored" (casters; the float itself is server-only), 0 when absent.</summary>
|
||||
public int SpellArmorRendPercent { get; private set; }
|
||||
/// <summary>"- All Creatures Slayer: 2.1x Damage".</summary>
|
||||
public bool AllCreaturesSlayer { get; private set; }
|
||||
/// <summary>The best "- <creature> Slayer: 2.1x Damage" as a percent of damage (210), 0 when absent.</summary>
|
||||
public int SlayerDamagePercent { get; private set; }
|
||||
/// <summary>The best elemental rend "- Fire Rending: +213% Dmg" (213), 0 when absent.</summary>
|
||||
public int RendPowerPercent { get; private set; }
|
||||
/// <summary>"- Phantom: Ignores Magic Protections".</summary>
|
||||
public bool Phantom { get; private set; }
|
||||
|
||||
/// <summary>The server-sent properties this item was parsed with.</summary>
|
||||
public T11ServerProps Server { get; private set; } = T11ServerProps.None;
|
||||
/// <summary>The weapon's 0-1000 quality roll (WeaponAugScaleQuality), -1 when not sent.</summary>
|
||||
|
|
@ -238,6 +251,12 @@ public sealed class T11ItemInfo
|
|||
// Checked before GenericModifier, whose lazy name would stop at "Modifier" and read the key as the value.
|
||||
private static readonly Regex UnknownKeyName = new(@"^(?<name>Modifier (?<key>\d+))(?=\s|$)", RegexOptions.CultureInvariant);
|
||||
|
||||
// The weapon cards above. Numbers may carry a group separator ("1,234%").
|
||||
private static readonly Regex SpellArmorRendLine = new(@"^-\s*Spell Armor Rend:\s*(?<p>\d[\d,]*)%", Opt);
|
||||
private static readonly Regex SlayerLine = new(@"^-\s*(?<who>.+?)\s+Slayer:\s*(?<x>\d+(?:\.\d+)?)x", Opt);
|
||||
private static readonly Regex RendLine = new(@"^-\s*(?<t>[A-Za-z]+)\s+Rending:\s*\+(?<p>\d[\d,]*)%\s*Dmg", Opt);
|
||||
private static readonly Regex PhantomLine = new(@"^-\s*Phantom:", Opt);
|
||||
|
||||
private const string ModifiersHeader = "Modifiers:";
|
||||
private const string ZoneLockedText = "Zone Locked (Power Reduced)";
|
||||
|
||||
|
|
@ -334,6 +353,7 @@ public sealed class T11ItemInfo
|
|||
}
|
||||
|
||||
if (TryParseItemLine(line)) continue;
|
||||
if (TryParseCardLine(line)) continue;
|
||||
|
||||
Match m = GradeLine.Match(line);
|
||||
if (m.Success && GradeRank == 0)
|
||||
|
|
@ -359,6 +379,33 @@ public sealed class T11ItemInfo
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>A "Property Details:" weapon card only the text carries (Spell Armor Rend, slayer, rend power, Phantom).</summary>
|
||||
private bool TryParseCardLine(string line)
|
||||
{
|
||||
if (!line.StartsWith("-", StringComparison.Ordinal)) return false;
|
||||
Match m = SpellArmorRendLine.Match(line);
|
||||
if (m.Success)
|
||||
{
|
||||
SpellArmorRendPercent = Math.Max(SpellArmorRendPercent, DigitsOnly(m.Groups["p"].Value));
|
||||
return true;
|
||||
}
|
||||
m = SlayerLine.Match(line);
|
||||
if (m.Success && double.TryParse(m.Groups["x"].Value, NumberStyles.Float, CultureInfo.InvariantCulture, out double x))
|
||||
{
|
||||
if (m.Groups["who"].Value.Trim().Equals("All Creatures", StringComparison.OrdinalIgnoreCase)) AllCreaturesSlayer = true;
|
||||
SlayerDamagePercent = Math.Max(SlayerDamagePercent, (int)Math.Round(x * 100, MidpointRounding.AwayFromZero));
|
||||
return true;
|
||||
}
|
||||
m = RendLine.Match(line);
|
||||
if (m.Success)
|
||||
{
|
||||
RendPowerPercent = Math.Max(RendPowerPercent, DigitsOnly(m.Groups["p"].Value));
|
||||
return true;
|
||||
}
|
||||
if (PhantomLine.IsMatch(line)) { Phantom = true; return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>Reads "- ..." lines after a "Modifiers:" header; returns the index of the first line not consumed.</summary>
|
||||
private int ParseModifierBlock(string[] lines, int start)
|
||||
{
|
||||
|
|
|
|||
69
Shared/RynthCore.LootSdk/T11/T11Items.cs
Normal file
69
Shared/RynthCore.LootSdk/T11/T11Items.cs
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace RynthCore.Loot.T11;
|
||||
|
||||
/// <summary>
|
||||
/// ACECustom's newer T11-era loot items (2026-11-11, upstream to 8d2460ff2), for the "T11: Item" loot keys: what an item is
|
||||
/// (<see cref="T11Keys.ItemKind"/>), the tier it belongs to (<see cref="T11Keys.ItemTier"/>) and the coins a Charm Infusion
|
||||
/// Gem puts in (<see cref="T11Keys.InfusionCoins"/>). Known by WCID, an item bounty by its description (the server writes
|
||||
/// its terms there: "Kill 250 Banderlings in Tier 15. ... Use it on a ring or bracelet you have to start it").
|
||||
/// </summary>
|
||||
public static class T11Items
|
||||
{
|
||||
public const int None = 0, ItemBounty = 1, SchoolGem = 2, InfusionGem = 3, LevelledCharm = 4, BountyRewardToken = 5,
|
||||
EventLumToken = 6, UniversalQuiver = 7;
|
||||
|
||||
/// <summary>The kinds for the editor's picker ("is" a kind).</summary>
|
||||
public static readonly (int Id, string Name)[] Kinds =
|
||||
{
|
||||
(ItemBounty, "Item bounty"), (SchoolGem, "School gem"), (InfusionGem, "Charm Infusion Gem"),
|
||||
(LevelledCharm, "Levelled charm"), (BountyRewardToken, "Bounty Reward Token"), (EventLumToken, "Event Lum Token"),
|
||||
(UniversalQuiver, "Universal Quiver Charm"),
|
||||
};
|
||||
|
||||
/// <summary>PropertyInt EarnedGemTier on a school gem (the tier it was earned at).</summary>
|
||||
public const int PropEarnedGemTier = 50651;
|
||||
|
||||
/// <summary>Charm Infusion Gems (777700089-097) and the coins one gem puts into a levelled charm.</summary>
|
||||
public static readonly IReadOnlyDictionary<uint, int> InfusionGems = new Dictionary<uint, int>
|
||||
{
|
||||
[777700089] = 1, [777700090] = 5, [777700091] = 10, [777700092] = 25, [777700093] = 50,
|
||||
[777700094] = 100, [777700095] = 500, [777700096] = 1_000, [777700097] = 5_000,
|
||||
};
|
||||
|
||||
/// <summary>The school gems (+1 a school past the cap, T15-T25): Battlemage's Wrath, Nether Veil, Crashing Steel, True Shot.</summary>
|
||||
public static readonly uint[] SchoolGems = { 777700052, 777700057, 777700062, 777700067 };
|
||||
|
||||
/// <summary>What the item is (0 for none of these). <paramref name="longDesc"/> only matters for an item bounty.</summary>
|
||||
public static int KindOf(uint wcid, string? longDesc)
|
||||
{
|
||||
if (InfusionGems.ContainsKey(wcid)) return InfusionGem;
|
||||
if (Array.IndexOf(SchoolGems, wcid) >= 0) return SchoolGem;
|
||||
if (wcid is >= 777700035 and <= 777700040) return LevelledCharm;
|
||||
if (wcid is >= 777708001 and <= 777708010) return BountyRewardToken;
|
||||
if (wcid is 99980076 or 99980078 or 99980079) return EventLumToken;
|
||||
if (wcid == 78780032) return UniversalQuiver;
|
||||
if (!string.IsNullOrEmpty(longDesc) && longDesc.Contains("Use it on a ring or bracelet", StringComparison.OrdinalIgnoreCase)) return ItemBounty;
|
||||
return None;
|
||||
}
|
||||
|
||||
private static readonly Regex BountyTier = new(@"\bin Tier (\d+)\b", RegexOptions.CultureInvariant);
|
||||
|
||||
/// <summary>
|
||||
/// The tier the item belongs to: an item bounty's ("in Tier 15"; 0 for a region bounty, Valley of Death, Thaelaryn
|
||||
/// Island), a school gem's earned tier; 0 for anything else.
|
||||
/// </summary>
|
||||
public static int TierOf(int kind, string? longDesc, int earnedGemTier)
|
||||
{
|
||||
if (kind == SchoolGem) return Math.Max(0, earnedGemTier);
|
||||
if (kind != ItemBounty || string.IsNullOrEmpty(longDesc)) return 0;
|
||||
var m = BountyTier.Match(longDesc);
|
||||
return m.Success && int.TryParse(m.Groups[1].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out int t) ? t : 0;
|
||||
}
|
||||
|
||||
/// <summary>The coins one Charm Infusion Gem puts in; 0 for anything else.</summary>
|
||||
public static int CoinsOf(uint wcid) => InfusionGems.TryGetValue(wcid, out int c) ? c : 0;
|
||||
}
|
||||
|
|
@ -60,6 +60,26 @@ public static class T11Keys
|
|||
public const int Tainted = Base + 19;
|
||||
/// <summary>1 when the tier is the server's stamped value, 0 when it is estimated from the wield gates.</summary>
|
||||
public const int TierIsExact = Base + 20;
|
||||
/// <summary>ACECustom's Spell Armor Rend card on a caster, percent of Spell Armor ignored (35), 0 for none. Text only.</summary>
|
||||
public const int SpellArmorRend = Base + 21;
|
||||
/// <summary>1 when the weapon is an All Creatures slayer (no species, so Slayer Type reads 0). Text only.</summary>
|
||||
public const int AllCreaturesSlayer = Base + 22;
|
||||
/// <summary>The slayer card's damage as a percent (2.1x = 210), 0 for none. Text only.</summary>
|
||||
public const int SlayerDamage = Base + 23;
|
||||
/// <summary>The best elemental rend's bonus percent (+213% Dmg = 213), 0 for none. Text only.</summary>
|
||||
public const int RendPower = Base + 24;
|
||||
/// <summary>1 when the weapon is Phantom (ignores magic protections). Text only.</summary>
|
||||
public const int Phantom = Base + 25;
|
||||
/// <summary>
|
||||
/// ACECustom's newer loot items (2026-11-11, <see cref="T11Items"/>): 1 Item bounty, 2 School gem, 3 Charm Infusion Gem,
|
||||
/// 4 Levelled charm, 5 Bounty Reward Token, 6 Event Lum Token, 7 Universal Quiver Charm; 0 anything else. By WCID (an
|
||||
/// item bounty by its description). RynthAi answers it with the item's WCID; <see cref="TryGetValue"/> can't (no WCID).
|
||||
/// </summary>
|
||||
public const int ItemKind = Base + 26;
|
||||
/// <summary>The tier an item bounty counts in ("in Tier 15"; 0 for a region one) or a school gem was earned at.</summary>
|
||||
public const int ItemTier = Base + 27;
|
||||
/// <summary>The Prestige Coins one Charm Infusion Gem puts into a levelled charm (1 ... 5,000).</summary>
|
||||
public const int InfusionCoins = Base + 28;
|
||||
|
||||
/// <summary>
|
||||
/// Base of the per-modifier keys: <c>ModifierBase + catalog key</c> is that modifier's value
|
||||
|
|
@ -99,6 +119,14 @@ public static class T11Keys
|
|||
yield return (HasSlotSpecial, "T11: Has Slot Special");
|
||||
yield return (CastOnStrikeCount, "T11: Cast on Strike Count");
|
||||
yield return (ZoneLocked, "T11: Zone Locked");
|
||||
yield return (SpellArmorRend, "Card: Spell Armor Rend %");
|
||||
yield return (AllCreaturesSlayer, "Card: All Creatures Slayer");
|
||||
yield return (SlayerDamage, "Card: Slayer Damage %");
|
||||
yield return (RendPower, "Card: Rend Power %");
|
||||
yield return (Phantom, "Card: Phantom");
|
||||
yield return (ItemKind, "T11 Item: Kind");
|
||||
yield return (ItemTier, "T11 Item: Tier");
|
||||
yield return (InfusionCoins, "T11 Item: Infusion Coins");
|
||||
foreach (var def in T11Catalog.Modifiers)
|
||||
yield return (ForModifier(def.Key), "T11 Mod: " + def.Name);
|
||||
}
|
||||
|
|
@ -145,6 +173,11 @@ public static class T11Keys
|
|||
case HasSlotSpecial: value = item.HasSlotSpecial ? 1 : 0; return true;
|
||||
case CastOnStrikeCount: value = item.Procs.Count; return true;
|
||||
case ZoneLocked: value = item.ZoneLocked ? 1 : 0; return true;
|
||||
case SpellArmorRend: value = item.SpellArmorRendPercent; return true;
|
||||
case AllCreaturesSlayer: value = item.AllCreaturesSlayer ? 1 : 0; return true;
|
||||
case SlayerDamage: value = item.SlayerDamagePercent; return true;
|
||||
case RendPower: value = item.RendPowerPercent; return true;
|
||||
case Phantom: value = item.Phantom ? 1 : 0; return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue