RynthSuite as of 2026-10-04 (internal c94715f): RynthOracle (based on Oracle of Dereth by Advis Eveldan) and RynthInventory, RynthAi patrol doorways and rooms, healing priority, strict monster priority, finish the wounded target, slayer weapons, arcs when clear, blasts like rings, learn unknown spells, looting fixes, release 2026.10.4.6

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Tom Bohar 2026-10-04 18:34:29 -04:00
commit 12ca25f911
426 changed files with 108239 additions and 7521 deletions

View file

@ -0,0 +1,156 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Layout;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using RynthCore.Loot.Editing;
namespace RynthCore.LootEditor;
/// <summary>
/// The value cell of a long-key condition (value on line 0, key on line 1). When
/// the key has named values (LootRuleText.ValueTableFor: WieldSkilltype's skills,
/// MaterialType's materials...) it is a picker showing "Light Weapons (45)" plus a
/// number box for any value; a value not in the list shows as "value N". Other
/// keys get the plain number box. Follows the key: picking another key swaps the
/// cell. The line still holds the plain number, so the .utl format is unchanged.
/// </summary>
internal sealed class LongValuePicker : ContentControl
{
private readonly VTankConditionVm _vm;
private readonly Action _onChange;
private readonly bool _integer;
private string? _builtForKey;
private ComboBox? _combo;
private TextBox? _box;
private (int Id, string Name)[]? _table;
private bool _syncing;
private sealed record Opt(int? Id, string Display);
/// <summary>The value cell for <paramref name="vm"/>; <paramref name="integer"/> false keeps decimals (buffed long).</summary>
public static Control For(VTankConditionVm vm, Action onChange, bool integer) => new LongValuePicker(vm, onChange, integer);
private LongValuePicker(VTankConditionVm vm, Action onChange, bool integer)
{
_vm = vm;
_onChange = onChange;
_integer = integer;
var d = _vm.Data.DataLines;
while (d.Count < 2) d.Add("0");
Rebuild();
}
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
{
base.OnAttachedToVisualTree(e);
_vm.PropertyChanged += OnVmChanged;
if (_builtForKey != KeyLine) Rebuild();
}
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
{
_vm.PropertyChanged -= OnVmChanged; // the condition vm outlives this cell
base.OnDetachedFromVisualTree(e);
}
private string KeyLine => _vm.Data.DataLines.Count > 1 ? _vm.Data.DataLines[1] : string.Empty;
private string ValueLine => _vm.Data.DataLines.Count > 0 ? _vm.Data.DataLines[0] : string.Empty;
private void OnVmChanged(object? sender, PropertyChangedEventArgs e)
{
if (_builtForKey != KeyLine) Rebuild(); // the key combo picked another key
}
private void Rebuild()
{
_builtForKey = KeyLine;
_table = LootRuleText.TryParseValue(KeyLine, out int key) ? LootRuleText.ValueTableFor(key) : null;
_box = new TextBox { Text = ValueLine, Watermark = "number" };
_box.LostFocus += (_, _) => CommitBox();
if (_table == null)
{
_combo = null;
Content = _box;
return;
}
_box.Width = 80;
_box.Margin = new Thickness(4, 0, 0, 0);
ToolTip.SetTip(_box, "Any number, named or not");
_combo = new ComboBox { HorizontalAlignment = HorizontalAlignment.Stretch, MinWidth = 160 };
_combo.DisplayMemberBinding = new Avalonia.Data.Binding(nameof(Opt.Display));
if (LootRuleText.ValueTableIsFlags(key))
ToolTip.SetTip(_combo, "Flags: other combinations are typed as a number in the box");
_combo.SelectionChanged += (_, _) =>
{
if (_syncing || _combo.SelectedItem is not Opt { Id: int id }) return;
Write(id.ToString(CultureInfo.InvariantCulture), syncCombo: false); // no list reset inside its own event
};
SyncCombo();
var grid = new Grid { ColumnDefinitions = ColumnDefinitions.Parse("*,Auto") };
Grid.SetColumn(_combo, 0);
Grid.SetColumn(_box, 1);
grid.Children.Add(_combo);
grid.Children.Add(_box);
Content = grid;
}
/// <summary>Fills the picker and selects the current value; one not in the list gets a "value N" entry on top.</summary>
private void SyncCombo()
{
if (_combo == null || _table == null) return;
var items = new List<Opt>(_table.Length + 1);
Opt? selected = null;
bool isNumber = LootRuleText.TryParseValue(ValueLine, out int current);
foreach (var (id, name) in _table)
{
var o = new Opt(id, LootRuleText.PickerLabel(id, name));
if (isNumber && id == current && selected == null) selected = o;
items.Add(o);
}
if (selected == null)
{
selected = new Opt(null, "value " + ValueLine.Trim());
items.Insert(0, selected);
}
_syncing = true;
try
{
_combo.ItemsSource = items;
_combo.SelectedItem = selected;
}
finally { _syncing = false; }
}
private void CommitBox()
{
if (_box == null) return;
string text = (_box.Text ?? string.Empty).Trim();
if (_integer && int.TryParse(text, NumberStyles.Integer, CultureInfo.InvariantCulture, out int v))
text = v.ToString(CultureInfo.InvariantCulture);
else if (!_integer && double.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out double dv))
text = dv.ToString(CultureInfo.InvariantCulture);
else
{
_box.Text = ValueLine; // not a number: put the old value back
return;
}
Write(text, syncCombo: true);
}
private void Write(string text, bool syncCombo)
{
var d = _vm.Data.DataLines;
if (_box != null && _box.Text != text) _box.Text = text;
if (d[0] == text) return;
d[0] = text;
if (syncCombo) SyncCombo();
_vm.NotifyDataChanged();
_onChange();
}
}

View file

@ -18,20 +18,10 @@ internal static class TypedEditors
// ── ObjectClass ──────────────────────────────────────────────────────────
// Decal/VTank numbering (AcObjectClass), the same table the evaluator and the
// in-game ImGui editor use. The old hand-written list drifted from id 11 on.
public static readonly (int Id, string Name)[] ObjectClasses =
{
(0, "Unknown"), (1, "MeleeWeapon"), (2, "Armor"), (3, "Clothing"),
(4, "Jewelry"), (5, "Monster"), (6, "Food"), (7, "Money"),
(8, "Misc"), (9, "MissileWeapon"), (10, "Container"), (11, "Useless"),
(12, "Gem"), (13, "SpellComp"), (14, "Key"), (15, "WandStaffOrb"),
(16, "Portal"), (17, "TradeNote"), (18, "ManaStone"), (19, "Plant"),
(20, "BaseAlchemy"), (21, "BaseCooking"), (22, "BaseFletching"), (23, "Player"),
(24, "Vendor"), (25, "Door"), (26, "Corpse"), (27, "Lifestone"),
(28, "Foci"), (29, "Salvage"), (30, "Ust"), (31, "Bundle"),
(32, "Book"), (33, "Journal"), (34, "Sign"), (35, "Housing"),
(36, "Pack"), (37, "Scroll"), (38, "BaseArmorTinker"), (39, "BaseWeaponTinker"),
(40, "BaseMagicTinker"), (41, "BaseItemTinker"), (50, "Salvage (legacy)"),
};
RynthCore.Loot.Editing.LootRuleText.ObjectClasses;
public static (int Id, string Name)[] ObjectClassesAccess() => ObjectClasses;
@ -54,7 +44,7 @@ internal static class TypedEditors
AddCell(grid, KeyCombo(LongKeys, vm.Data.DataLines, 1, onChange, vm), col: 1);
AddCell(grid, Label(op), col: 2);
AddCell(grid, Label("Value"), col: 3);
AddCell(grid, IntBox(vm.Data.DataLines, 0, onChange, vm), col: 4);
AddCell(grid, LongValuePicker.For(vm, onChange, integer: true), col: 4);
return grid;
}
@ -100,7 +90,7 @@ internal static class TypedEditors
AddCell(grid, KeyCombo(LongKeys, vm.Data.DataLines, 1, onChange, vm), col: 1);
AddCell(grid, Label(op), col: 2);
AddCell(grid, Label("Value"), col: 3);
AddCell(grid, DoubleBox(vm.Data.DataLines, 0, onChange, vm), col: 4);
AddCell(grid, LongValuePicker.For(vm, onChange, integer: false), col: 4);
return grid;
}
@ -371,32 +361,9 @@ internal static class TypedEditors
// ── Reference key tables (subset of AC enums; covers what people usually edit) ──
// The LootSdk tables the in-game editor uses (adds 45 DamageType, 48 WeaponSkill).
public static readonly (int Id, string Name)[] LongKeys =
{
(5, "EncumbVal"),
(19, "Value"),
(25, "Level"),
(28, "ArmorLevel"),
(54, "MaxDamage"),
(87, "MaxStructure"),
(88, "Structure"),
(105, "ItemWorkmanship"),
(107, "ItemMaxMana"),
(131, "MaterialType"),
(158, "WieldRequirements"),
(159, "WieldSkilltype"),
(160, "WieldDifficulty"),
(218, "EquippedSlots"),
(353, "ImbuedEffect"),
(370, "DamageRating"),
(371, "DamageResistRating"),
(372, "CritRating"),
(373, "CritResistRating"),
(374, "CritDamageRating"),
(375, "CritDamageResistRating"),
(376, "HealBoostRating"),
(379, "VitalityRating"),
};
RynthCore.Loot.Editing.LootRuleText.LongKeys;
public static readonly (int Id, string Name)[] DoubleKeys =
{
@ -416,20 +383,8 @@ internal static class TypedEditors
(7, "Title"),
};
// Retail/ACE skill ids from the LootSdk; the old list here was off from id 19 up
// (Light Weapons at 47 is Missile Weapons).
public static readonly (int Id, string Name)[] Skills =
{
(1, "Axe"), (2, "Bow"), (3, "Crossbow"), (4, "Dagger"),
(5, "Mace"), (6, "MeleeDefense"),(7, "MissileDef."), (8, "Sling"),
(9, "Spear"), (10, "Staff"), (11, "Sword"), (12, "ThrownWpn"),
(13, "Unarmed"), (14, "ArcaneLore"), (15, "MagicDefense"),(16, "ManaConv."),
(18, "Item Tinkering"), (19, "Healing"), (20, "Deception"), (21, "Leadership"),
(22, "Lockpick"), (23, "Fletching"), (24, "Alchemy"), (25, "Cooking"),
(26, "Salvaging"), (31, "Creature Ench."), (32, "Item Ench."), (33, "Life Magic"),
(34, "War Magic"), (35, "Loyalty"), (36, "Jump"), (37, "Run"),
(38, "Assess"), (39, "Weapon Tinkering"), (40, "Armor Tinkering"),
(41, "Magic Item Tinkering"), (43, "Two Handed"), (44, "Gearcraft"),
(45, "Void Magic"), (46, "Heavy Weapons"), (47, "Light Weapons"),
(48, "Finesse Weapons"), (49, "Missile Weapons"), (50, "Shield"),
(54, "Dual Wield"), (55, "Recklessness"), (56, "Sneak Attack"),
};
RynthCore.Loot.Editing.LootRuleText.Skills;
}