fix(ui): restore radar, retail wield switching, and protection meshes

Late-bind radar snapshots to the canonical LiveEntityRuntime maps so the retained radar survives bootstrap and session replacement instead of capturing empty sentinels.

Route paperdoll drops through the retail AutoWield blocker transaction. Move conflicting held weapons, shields, explicit jewelry destinations, and mismatched ammo to the backpack one authoritative confirmation at a time; preserve compatible arrows when switching to melee.

Render mode-1 and no-degrade particle GfxObjs as their authored modern-pipeline meshes, retain Always2D billboards, interleave both paths back-to-front, balance emitter mesh ownership, and fail safely on corrupt DAT material metadata. This restores the closed apex on Armor Self/protection effects.

Retain Studio fixture controller lifetimes, add installed-DAT and adversarial regression coverage, synchronize retail research/divergence bookkeeping, and pass all three review tracks plus the full Release suite.

Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
Erik 2026-07-14 20:52:45 +02:00
parent 8d63e5c28a
commit b26f84cc69
26 changed files with 1361 additions and 141 deletions

View file

@ -44,13 +44,28 @@ public class PaperdollControllerTests
private static PaperdollController Bind(ImportedLayout layout, ClientObjectTable objects,
List<(uint item, uint mask)>? wields = null, uint emptySlot = 0u,
SelectionState? selection = null,
IReadOnlyDictionary<uint, uint>? emptySlotSprites = null)
=> PaperdollController.Bind(layout, objects, () => Player,
iconIds: (_, _, _, _, _) => 0x1234u,
IReadOnlyDictionary<uint, uint>? emptySlotSprites = null,
List<(uint item, uint container, int placement)>? puts = null,
List<string>? systemMessages = null)
{
var itemInteraction = new ItemInteractionController(
objects,
() => Player,
sendUse: null,
sendUseWithTarget: null,
sendWield: wields is null ? null : (i, m) => wields.Add((i, m)),
sendDrop: null,
sendPutItemInContainer: puts is null
? null
: (item, container, placement) => puts.Add((item, container, placement)),
systemMessage: systemMessages is null ? null : systemMessages.Add);
return PaperdollController.Bind(layout, objects, () => Player,
iconIds: (_, _, _, _, _) => 0x1234u,
itemInteraction: itemInteraction,
emptySlotSprite: emptySlot,
selection: selection ?? new SelectionState(),
emptySlotSprites: emptySlotSprites);
}
private static void SeedEquipped(ClientObjectTable t, uint guid, EquipMask loc)
{
@ -225,6 +240,46 @@ public class PaperdollControllerTests
Assert.Equal((0xD01u, (uint)EquipMask.HeadWear), wields[0]); // GetAndWieldItem wire
}
[Fact]
public void HandleDropRelease_weaponSlot_delegatesToConfirmedAutoWieldTransaction()
{
var (layout, lists) = BuildLayout();
var objects = new ClientObjectTable();
const uint bow = 0xD11u;
const uint sword = 0xD12u;
SeedEquipped(objects, bow, EquipMask.MissileWeapon);
objects.Get(bow)!.Name = "Shortbow";
SeedPackItem(objects, sword, EquipMask.MeleeWeapon);
objects.Get(sword)!.Name = "Katar";
var wields = new List<(uint item, uint mask)>();
var puts = new List<(uint item, uint container, int placement)>();
var messages = new List<string>();
var ctrl = Bind(
layout,
objects,
wields,
puts: puts,
systemMessages: messages);
var payload = new ItemDragPayload(
sword,
ItemDragSource.Inventory,
0,
lists[WeaponSlot].Cell);
ctrl.HandleDropRelease(lists[WeaponSlot], lists[WeaponSlot].Cell, payload);
Assert.Equal(new[] { (bow, Player, 0) }, puts);
Assert.Empty(wields);
Assert.Equal(EquipMask.None, objects.Get(sword)!.CurrentlyEquippedLocation);
Assert.Equal(new[] { "Moving Shortbow to your backpack" }, messages);
objects.MoveItem(bow, Player, 0, EquipMask.None);
Assert.Equal(new[] { (sword, (uint)EquipMask.MeleeWeapon) }, wields);
Assert.Equal(EquipMask.MeleeWeapon,
objects.Get(sword)!.CurrentlyEquippedLocation);
}
[Fact]
public void HandleDropRelease_resolves_the_finger_bit_for_a_dual_finger_ring()
{

View file

@ -1,4 +1,5 @@
using System.Numerics;
using AcDream.App.UI;
using AcDream.App.UI.Layout;
using AcDream.Core.Items;
using AcDream.Core.Net;
@ -35,7 +36,7 @@ public sealed class RadarSnapshotProviderTests
uint? selected = monster;
var provider = new RadarSnapshotProvider(
objects, entities, spawns,
objects, () => entities, () => spawns,
playerGuid: () => player,
playerYawRadians: () => MathF.PI / 2f, // retail heading 0 degrees
playerCellId: () => 0xA9B40001u,
@ -81,7 +82,7 @@ public sealed class RadarSnapshotProviderTests
[hidden] = Spawn(hidden),
};
var provider = new RadarSnapshotProvider(
objects, entities, spawns,
objects, () => entities, () => spawns,
playerGuid: () => player,
playerYawRadians: () => 0f,
playerCellId: () => 0xA9B40100u, // EnvCell: no landscape coordinate
@ -120,15 +121,15 @@ public sealed class RadarSnapshotProviderTests
};
var provider = new RadarSnapshotProvider(
objects,
interactionVisible,
spawns,
() => interactionVisible,
() => spawns,
playerGuid: () => player,
playerYawRadians: () => 0f,
playerCellId: () => 0xA9B40001u,
selectedGuid: () => hiddenTarget,
coordinatesOnRadar: () => true,
uiLocked: () => false,
playerEntities: canonical);
playerEntities: () => canonical);
var snapshot = provider.BuildSnapshot();
@ -136,6 +137,56 @@ public sealed class RadarSnapshotProviderTests
Assert.Empty(snapshot.Blips);
}
[Fact]
public void BuildSnapshot_ResolvesLiveViewsAfterRuntimeBootstraps()
{
const uint player = 30u;
const uint monster = 31u;
var objects = new ClientObjectTable();
objects.Ingest(Weenie(player, "Player", ItemType.Creature));
objects.Ingest(Weenie(monster, "Drudge", ItemType.Creature) with
{
RadarBehavior = (byte)RadarBehavior.ShowAlways,
});
IReadOnlyDictionary<uint, WorldEntity> visible =
new Dictionary<uint, WorldEntity>();
IReadOnlyDictionary<uint, WorldEntity> canonical =
new Dictionary<uint, WorldEntity>();
IReadOnlyDictionary<uint, WorldSession.EntitySpawn> spawns =
new Dictionary<uint, WorldSession.EntitySpawn>();
var provider = new RadarSnapshotProvider(
objects,
() => visible,
() => spawns,
playerGuid: () => player,
playerYawRadians: () => MathF.PI / 2f,
playerCellId: () => 0xA9B40001u,
selectedGuid: () => null,
coordinatesOnRadar: () => true,
uiLocked: () => false,
playerEntities: () => canonical);
Assert.Null(provider.BuildSnapshot().CoordinatesText);
visible = new Dictionary<uint, WorldEntity>
{
[player] = Entity(player, Vector3.Zero, Quaternion.Identity),
[monster] = Entity(monster, new Vector3(0f, 15f, 0f), Quaternion.Identity),
};
canonical = visible;
spawns = new Dictionary<uint, WorldSession.EntitySpawn>
{
[player] = Spawn(player),
[monster] = Spawn(monster) with { ObjectDescriptionFlags = 0x00000010u },
};
UiRadarSnapshot snapshot = provider.BuildSnapshot();
Assert.NotNull(snapshot.CoordinatesText);
Assert.Equal(monster, Assert.Single(snapshot.Blips).ObjectId);
}
private static WorldEntity Entity(uint guid, Vector3 position, Quaternion rotation) => new()
{
Id = guid,