feat(inventory): port retail weapon switching
Sequence primary weapon replacement through the server-confirmed AutoWield transaction: return the occupied weapon to the player pack, wait for its move event, then wield the requested item. Route authoritative CombatMode property updates so peace stays peace and war adopts the new weapon stance without client-synthesized animation. Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
parent
8e9c538519
commit
17b5712d53
14 changed files with 736 additions and 155 deletions
|
|
@ -693,6 +693,40 @@ public sealed class ClientObjectTableTests
|
|||
public void WieldItemOptimistic_unknownItem_false()
|
||||
=> Assert.False(new ClientObjectTable().WieldItemOptimistic(0xDEADu, 0x1u, EquipMask.HeadWear));
|
||||
|
||||
[Fact]
|
||||
public void RejectMove_withoutOptimisticMutation_stillPublishesServerFailure()
|
||||
{
|
||||
var table = new ClientObjectTable();
|
||||
MoveRequestFailure? seen = null;
|
||||
table.MoveRequestFailed += failure => seen = failure;
|
||||
|
||||
Assert.False(table.RejectMove(0xDEADu, 0x04FFu));
|
||||
|
||||
Assert.Equal(
|
||||
new MoveRequestFailure(0xDEADu, 0x04FFu, RolledBack: false),
|
||||
seen);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RejectMove_withOptimisticMutation_rollsBackAndPublishesFailure()
|
||||
{
|
||||
var table = new ClientObjectTable();
|
||||
const uint item = 0x943u, player = 0x50000001u, pack = 0x40000005u;
|
||||
table.AddOrUpdate(new ClientObject { ObjectId = item });
|
||||
table.MoveItem(item, pack, 2);
|
||||
table.WieldItemOptimistic(item, player, EquipMask.MeleeWeapon);
|
||||
MoveRequestFailure? seen = null;
|
||||
table.MoveRequestFailed += failure => seen = failure;
|
||||
|
||||
Assert.True(table.RejectMove(item, 0x04FFu));
|
||||
|
||||
Assert.Equal(pack, table.Get(item)!.ContainerId);
|
||||
Assert.Equal(EquipMask.None, table.Get(item)!.CurrentlyEquippedLocation);
|
||||
Assert.Equal(
|
||||
new MoveRequestFailure(item, 0x04FFu, RolledBack: true),
|
||||
seen);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WieldThenMove_oneConfirm_rollsBackToPreWield() // outstanding-count across wield+move (shared RecordPending)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue