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:
parent
17b5712d53
commit
815ce0dec4
14 changed files with 206 additions and 16 deletions
|
|
@ -188,6 +188,22 @@ public sealed class CreateObjectTests
|
|||
Assert.Equal((byte)2, parsed.Value.CombatUse);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TryParse_AmmoTypeFlag_CapturesValue()
|
||||
{
|
||||
byte[] body = BuildMinimalCreateObjectWithWeenieHeader(
|
||||
guid: 0x5000000Eu,
|
||||
name: "Bow",
|
||||
itemType: (uint)ItemType.MissileWeapon,
|
||||
weenieFlags: 0x00000100u,
|
||||
ammoType: 1);
|
||||
|
||||
var parsed = CreateObject.TryParse(body);
|
||||
|
||||
Assert.NotNull(parsed);
|
||||
Assert.Equal((ushort)1, parsed.Value.AmmoType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TryParse_ParentedChild_CapturesPlacementParentAndPositionSequence()
|
||||
{
|
||||
|
|
@ -647,6 +663,7 @@ public sealed class CreateObjectTests
|
|||
byte? radarBlipColor = null,
|
||||
byte? radarBehavior = null,
|
||||
byte? combatUse = null,
|
||||
ushort? ammoType = null,
|
||||
ushort movementSeq = 0,
|
||||
uint? placementId = null,
|
||||
uint? parentGuid = null,
|
||||
|
|
@ -712,7 +729,7 @@ public sealed class CreateObjectTests
|
|||
if ((weenieFlags & 0x00000001u) != 0) WriteString16L(bytes, pluralName ?? "");
|
||||
if ((weenieFlags & 0x00000002u) != 0) bytes.Add(itemsCapacity ?? 0); // ItemsCapacity u8
|
||||
if ((weenieFlags & 0x00000004u) != 0) bytes.Add(containersCapacity ?? 0); // ContainersCapacity u8
|
||||
if ((weenieFlags & 0x00000100u) != 0) WriteU16(bytes, 0); // AmmoType u16
|
||||
if ((weenieFlags & 0x00000100u) != 0) WriteU16(bytes, ammoType ?? 0); // AmmoType u16
|
||||
if ((weenieFlags & 0x00000008u) != 0) WriteU32(bytes, value ?? 0u); // Value u32
|
||||
if ((weenieFlags & 0x00000010u) != 0) WriteU32(bytes, useability ?? 0u); // Usable u32
|
||||
if ((weenieFlags & 0x00000020u) != 0) // UseRadius f32
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ public sealed class ObjectTableWiringTests
|
|||
RadarBehavior = 3,
|
||||
ObjectDescriptionFlags = 0x20800200u,
|
||||
CombatUse = 2,
|
||||
AmmoType = 1,
|
||||
PluralName = "Iron Swords",
|
||||
PetOwnerId = 0x50000001u,
|
||||
};
|
||||
|
|
@ -110,6 +111,7 @@ public sealed class ObjectTableWiringTests
|
|||
Assert.Equal((byte)3, d.RadarBehavior);
|
||||
Assert.Equal(0x20800200u, d.PublicWeenieBitfield);
|
||||
Assert.Equal((byte)2, d.CombatUse);
|
||||
Assert.Equal((ushort)1, d.AmmoType);
|
||||
Assert.Equal("Iron Swords", d.PluralName);
|
||||
Assert.Equal(0x50000001u, d.PetOwnerId);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue