fix(inventory): sequence secondary wield blockers

Preserve retail AmmoType from CreateObject and port BlocksUseOfShield so bow, caster, and two-handed switches remove incompatible shields, while mismatched missile ammo is also returned to the pack. Each blocker remains server-confirmed before AutoWield re-enters.

Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-12 23:12:07 +02:00
parent 17b5712d53
commit 815ce0dec4
14 changed files with 206 additions and 16 deletions

View file

@ -205,7 +205,10 @@ public static class CreateObject
// ACCWeenieObject::GetObjectName(NAME_APPROPRIATE) selects this for stacks.
string? PluralName = null,
// PublicWeenieDesc._pet_owner, gated by second-header flag 0x8.
uint? PetOwnerId = null);
uint? PetOwnerId = null,
// PublicWeenieDesc._ammoType, gated by WeenieHeader flag 0x100.
// AMMO_NONE is the explicit wire value zero; null means absent.
ushort? AmmoType = null);
/// <summary>
/// The relevant subset of the server-sent <c>MovementData</c> /
@ -772,6 +775,7 @@ public static class CreateObject
byte? radarBlipColor = null;
byte? radarBehavior = null;
byte? combatUse = null;
ushort? ammoType = null;
uint iconOverlayId = 0;
uint iconUnderlayId = 0;
uint uiEffects = 0;
@ -810,6 +814,7 @@ public static class CreateObject
if ((weenieFlags & 0x00000100u) != 0) // AmmoType u16
{
if (body.Length - pos < 2) throw new FormatException("trunc AmmoType");
ammoType = BinaryPrimitives.ReadUInt16LittleEndian(body.Slice(pos));
pos += 2;
}
if ((weenieFlags & 0x00000008u) != 0) // Value u32
@ -1020,7 +1025,8 @@ public static class CreateObject
RadarBlipColor: radarBlipColor, RadarBehavior: radarBehavior,
CombatUse: combatUse,
PluralName: pluralName,
PetOwnerId: petOwnerId);
PetOwnerId: petOwnerId,
AmmoType: ammoType);
// Local helper: if we ran out of fields past PhysicsData, still
// return the useful prefix (guid/position/setup/animParts/textures/palettes/scale/motion).