feat(D.5.2): ItemInstance.Effects + ItemRepository.UpdateIntProperty
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
52306d9268
commit
77f64d7925
3 changed files with 62 additions and 1 deletions
|
|
@ -139,4 +139,36 @@ public sealed class ItemRepositoryTests
|
|||
var repo = new ItemRepository();
|
||||
Assert.False(repo.EnrichItem(0x9999u, 0x06001234u, "x", ItemType.Misc));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EnrichItem_carriesEffects()
|
||||
{
|
||||
var repo = new ItemRepository();
|
||||
repo.AddOrUpdate(new ItemInstance { ObjectId = 0x500000AAu });
|
||||
bool ok = repo.EnrichItem(0x500000AAu, iconId: 0x06001234u, name: "Wand",
|
||||
type: ItemType.Caster, iconOverlayId: 0, iconUnderlayId: 0, effects: 0x1u);
|
||||
Assert.True(ok);
|
||||
Assert.Equal(0x1u, repo.GetItem(0x500000AAu)!.Effects);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UpdateIntProperty_uiEffects_setsEffectsAndFires()
|
||||
{
|
||||
var repo = new ItemRepository();
|
||||
repo.AddOrUpdate(new ItemInstance { ObjectId = 0x500000ABu });
|
||||
ItemInstance? fired = null;
|
||||
repo.ItemPropertiesUpdated += i => fired = i;
|
||||
bool ok = repo.UpdateIntProperty(0x500000ABu, 18u, value: 0x9); // 18 = UiEffects
|
||||
Assert.True(ok);
|
||||
Assert.Equal(0x9u, repo.GetItem(0x500000ABu)!.Effects);
|
||||
Assert.Equal(0x9, repo.GetItem(0x500000ABu)!.Properties.Ints[18u]);
|
||||
Assert.NotNull(fired);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UpdateIntProperty_unknownItem_returnsFalse()
|
||||
{
|
||||
var repo = new ItemRepository();
|
||||
Assert.False(repo.UpdateIntProperty(0xDEADBEEFu, 18u, 1));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue