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:
Erik 2026-07-12 23:06:31 +02:00
parent 8e9c538519
commit 17b5712d53
14 changed files with 736 additions and 155 deletions

View file

@ -0,0 +1,42 @@
using AcDream.Core.Combat;
namespace AcDream.Core.Net.Tests;
/// <summary>
/// Conformance pins for retail ClientCombatSystem::OnQualityChanged
/// (0x0056C1B0): player PropertyInt 40 is the authoritative combat mode.
/// </summary>
public sealed class CombatStateWiringTests
{
[Theory]
[InlineData((int)CombatMode.NonCombat)]
[InlineData((int)CombatMode.Melee)]
[InlineData((int)CombatMode.Missile)]
[InlineData((int)CombatMode.Magic)]
public void CombatModeProperty_appliesConcreteRetailMode(int value)
{
var combat = new CombatState();
Assert.True(CombatStateWiring.ApplyPlayerIntProperty(
combat,
CombatStateWiring.CombatModePropertyId,
value));
Assert.Equal((CombatMode)value, combat.CurrentMode);
}
[Theory]
[InlineData(39u, (int)CombatMode.Missile)]
[InlineData(40u, (int)CombatMode.Undef)]
[InlineData(40u, (int)CombatMode.ValidCombat)]
[InlineData(40u, 0x10)]
public void NonCombatQualityOrInvalidValue_isIgnored(uint property, int value)
{
var combat = new CombatState();
Assert.False(CombatStateWiring.ApplyPlayerIntProperty(
combat, property, value));
Assert.Equal(CombatMode.NonCombat, combat.CurrentMode);
}
}