From 5a2af61508f2159a8dd622ccfe9ae3af056303d9 Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 17 Jun 2026 18:26:28 +0200 Subject: [PATCH] refactor(D.5.2): hoist UiEffectsPropertyId to fields + use it in tests (review polish) Co-Authored-By: Claude Opus 4.8 (1M context) --- src/AcDream.Core/Items/ItemRepository.cs | 8 +++++--- tests/AcDream.Core.Tests/Items/ItemRepositoryTests.cs | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/AcDream.Core/Items/ItemRepository.cs b/src/AcDream.Core/Items/ItemRepository.cs index 6ffcc85c..5543c958 100644 --- a/src/AcDream.Core/Items/ItemRepository.cs +++ b/src/AcDream.Core/Items/ItemRepository.cs @@ -61,6 +61,11 @@ public sealed class ItemRepository /// Fires when an item's properties are updated (typically after Appraise). public event Action? ItemPropertiesUpdated; + /// PropertyInt.UiEffects (ACE enum value 18) — the icon effect bitfield; + /// the typed mirror maintains on + /// . + 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; } - /// PropertyInt.UiEffects (ACE enum value 18) — the icon effect bitfield. - public const uint UiEffectsPropertyId = 18u; - /// /// 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 diff --git a/tests/AcDream.Core.Tests/Items/ItemRepositoryTests.cs b/tests/AcDream.Core.Tests/Items/ItemRepositoryTests.cs index 5b39b932..0ee2631d 100644 --- a/tests/AcDream.Core.Tests/Items/ItemRepositoryTests.cs +++ b/tests/AcDream.Core.Tests/Items/ItemRepositoryTests.cs @@ -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); }