feat(core): D.2b-B — ClientObjectTable.SumCarriedBurden (carried-Burden fallback)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-21 08:55:35 +02:00
parent 5875ac857d
commit fb050aed4d
2 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,32 @@
using AcDream.Core.Items;
using Xunit;
namespace AcDream.Core.Tests.Items;
public class ClientObjectTableBurdenTests
{
private const uint Player = 0x50000001u;
[Fact]
public void SumCarriedBurden_sums_pack_sidebag_and_wielded_but_not_unrelated()
{
var t = new ClientObjectTable();
// loose pack item
t.AddOrUpdate(new ClientObject { ObjectId = 0xA, ContainerId = Player, Burden = 100 });
// side bag in pack
t.AddOrUpdate(new ClientObject { ObjectId = 0xB, ContainerId = Player, Burden = 50,
Type = ItemType.Container });
// item inside the side bag (2-deep)
t.AddOrUpdate(new ClientObject { ObjectId = 0xC, ContainerId = 0xB, Burden = 30 });
// wielded (ContainerId 0, WielderId = player)
t.AddOrUpdate(new ClientObject { ObjectId = 0xD, WielderId = Player, Burden = 200 });
// unrelated object in the world
t.AddOrUpdate(new ClientObject { ObjectId = 0xE, ContainerId = 0, Burden = 999 });
Assert.Equal(380, t.SumCarriedBurden(Player)); // 100+50+30+200
}
[Fact]
public void SumCarriedBurden_unknown_owner_is_zero()
=> Assert.Equal(0, new ClientObjectTable().SumCarriedBurden(Player));
}