refactor(D.5.2): hoist UiEffectsPropertyId to fields + use it in tests (review polish)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-17 18:26:28 +02:00
parent 77f64d7925
commit 5a2af61508
2 changed files with 7 additions and 5 deletions

View file

@ -61,6 +61,11 @@ public sealed class ItemRepository
/// <summary>Fires when an item's properties are updated (typically after Appraise).</summary>
public event Action<ItemInstance>? ItemPropertiesUpdated;
/// <summary>PropertyInt.UiEffects (ACE enum value 18) — the icon effect bitfield;
/// the typed mirror <see cref="UpdateIntProperty"/> maintains on
/// <see cref="ItemInstance.Effects"/>.</summary>
public const uint UiEffectsPropertyId = 18u;
public int ItemCount => _items.Count;
public int ContainerCount => _containers.Count;
@ -187,9 +192,6 @@ public sealed class ItemRepository
return true;
}
/// <summary>PropertyInt.UiEffects (ACE enum value 18) — the icon effect bitfield.</summary>
public const uint UiEffectsPropertyId = 18u;
/// <summary>
/// Apply a single PropertyInt update (from PublicUpdatePropertyInt 0x02CE) to an
/// item: store it in the bundle and, for known typed ints, mirror to the typed

View file

@ -158,10 +158,10 @@ public sealed class ItemRepositoryTests
repo.AddOrUpdate(new ItemInstance { ObjectId = 0x500000ABu });
ItemInstance? fired = null;
repo.ItemPropertiesUpdated += i => fired = i;
bool ok = repo.UpdateIntProperty(0x500000ABu, 18u, value: 0x9); // 18 = UiEffects
bool ok = repo.UpdateIntProperty(0x500000ABu, ItemRepository.UiEffectsPropertyId, value: 0x9);
Assert.True(ok);
Assert.Equal(0x9u, repo.GetItem(0x500000ABu)!.Effects);
Assert.Equal(0x9, repo.GetItem(0x500000ABu)!.Properties.Ints[18u]);
Assert.Equal(0x9, repo.GetItem(0x500000ABu)!.Properties.Ints[ItemRepository.UiEffectsPropertyId]);
Assert.NotNull(fired);
}