feat(ui): port retail selected-item mana
Parse and route the complete 0x0264 guid/fraction/valid response, send exact 0x0263 item-mana queries, and reproduce retail meter visibility plus guid-zero cancellation for mana and health selection changes. Keep the behavior in Core state and the retained selected-object controller with wire/state/UI conformance coverage. Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
parent
df460f94c3
commit
fa1da02783
21 changed files with 402 additions and 38 deletions
33
tests/AcDream.Core.Tests/Items/ItemManaStateTests.cs
Normal file
33
tests/AcDream.Core.Tests/Items/ItemManaStateTests.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using AcDream.Core.Items;
|
||||
using Xunit;
|
||||
|
||||
namespace AcDream.Core.Tests.Items;
|
||||
|
||||
public sealed class ItemManaStateTests
|
||||
{
|
||||
[Fact]
|
||||
public void ValidResponseCachesAndRaisesEvent()
|
||||
{
|
||||
var state = new ItemManaState();
|
||||
(uint Guid, float Percent, bool Valid)? observed = null;
|
||||
state.ItemManaChanged += (guid, percent, valid) => observed = (guid, percent, valid);
|
||||
|
||||
state.OnQueryItemManaResponse(0x50000A01u, 0.75f, valid: true);
|
||||
|
||||
Assert.Equal((0x50000A01u, 0.75f, true), observed);
|
||||
Assert.True(state.HasMana(0x50000A01u));
|
||||
Assert.Equal(0.75f, state.GetManaPercent(0x50000A01u));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InvalidResponseClearsCachedValueAndRaisesEvent()
|
||||
{
|
||||
var state = new ItemManaState();
|
||||
state.OnQueryItemManaResponse(0x50000A01u, 0.75f, valid: true);
|
||||
|
||||
state.OnQueryItemManaResponse(0x50000A01u, 0f, valid: false);
|
||||
|
||||
Assert.False(state.HasMana(0x50000A01u));
|
||||
Assert.Equal(0f, state.GetManaPercent(0x50000A01u));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue