feat(chat): port retail client command families

Expand the typed client-command boundary across travel, character queries, local UI and layout controls, AFK and consent, emotes, friends, squelch and filters, and fill-components. Preserve retail packet layouts and queue ownership, import the confirmation dialog, and keep authoritative social state in Core.

Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-13 14:50:15 +02:00
parent 5a45a7ac7f
commit 9ea579bdd0
47 changed files with 6659 additions and 99 deletions

View file

@ -101,6 +101,12 @@ public static class FixtureLoader
public static ElementInfo LoadPowerbarInfos()
=> LoadInfos("powerbar_21000072.json");
public static ImportedLayout LoadConfirmationDialog()
=> LayoutImporter.Build(LoadConfirmationDialogInfos(), _ => (0u, 0, 0), null);
public static ElementInfo LoadConfirmationDialogInfos()
=> LoadInfos("dialogs_2100003C.json");
// ── Shared loader ────────────────────────────────────────────────────────
private static AcDream.App.UI.Layout.ElementInfo LoadInfos(string fileName)

View file

@ -0,0 +1,67 @@
using AcDream.App.UI;
using AcDream.App.UI.Layout;
namespace AcDream.App.Tests.UI.Layout;
public sealed class RetailConfirmationDialogServiceTests
{
[Fact]
public void FixtureBuildsProductionConfirmationWidgets()
{
var layout = FixtureLoader.LoadConfirmationDialog();
Assert.IsType<UiDialogRoot>(layout.Root);
Assert.IsType<UiText>(layout.FindElement(RetailConfirmationDialogService.MessageElementId));
Assert.IsType<UiButton>(layout.FindElement(RetailConfirmationDialogService.AcceptButtonId));
Assert.IsType<UiButton>(layout.FindElement(RetailConfirmationDialogService.RejectButtonId));
}
[Fact]
public void ShowCentersModalAndAcceptCompletesIt()
{
var root = new UiRoot { Width = 1024f, Height = 768f };
var layout = FixtureLoader.LoadConfirmationDialog();
var service = new RetailConfirmationDialogService(root, layout);
bool? result = null;
service.Show("Do you really want to kill your character?", accepted => result = accepted);
Assert.Same(layout.Root, root.Modal);
var popup = Assert.IsAssignableFrom<UiElement>(
layout.FindElement(RetailConfirmationDialogService.PopupElementId));
Assert.Equal(MathF.Round((1024f - popup.Width) * 0.5f), popup.Left);
Assert.Equal(MathF.Round((768f - popup.Height) * 0.5f), popup.Top);
var accept = Assert.IsType<UiButton>(
layout.FindElement(RetailConfirmationDialogService.AcceptButtonId));
accept.OnClick!();
Assert.True(result);
Assert.Null(root.Modal);
Assert.False(service.IsOpen);
}
[Fact]
public void RequestsArePresentedInFifoOrder()
{
var root = new UiRoot { Width = 800f, Height = 600f };
var layout = FixtureLoader.LoadConfirmationDialog();
var service = new RetailConfirmationDialogService(root, layout);
var results = new List<string>();
service.Show("first", accepted => results.Add($"first:{accepted}"));
service.Show("second", accepted => results.Add($"second:{accepted}"));
Assert.Equal(1, service.PendingCount);
Assert.IsType<UiButton>(layout.FindElement(
RetailConfirmationDialogService.RejectButtonId)).OnClick!();
Assert.Equal(["first:False"], results);
Assert.True(service.IsOpen);
Assert.Equal(0, service.PendingCount);
Assert.IsType<UiButton>(layout.FindElement(
RetailConfirmationDialogService.AcceptButtonId)).OnClick!();
Assert.Equal(["first:False", "second:True"], results);
Assert.False(service.IsOpen);
}
}

View file

@ -3,6 +3,7 @@ using System.Text.Json;
using AcDream.App.UI.Layout;
using DatReaderWriter;
using DatReaderWriter.Options;
using EnumIDMap = DatReaderWriter.DBObjs.EnumIDMap;
namespace AcDream.App.Tests.UI.Layout;
@ -44,6 +45,25 @@ public sealed class RetailLayoutFixtureGenerator
"Asheron's Call");
using var dats = new DatCollection(datDir, DatAccessType.Read);
uint masterDid = (uint)dats.Portal.Header.MasterMapId;
Assert.True(dats.Portal.TryGet<EnumIDMap>(masterDid, out var master));
Assert.True(master!.ClientEnumToID.TryGetValue(5u, out uint uiMapDid));
Assert.True(dats.Portal.TryGet<EnumIDMap>(uiMapDid, out var uiMap));
Assert.True(uiMap!.ClientEnumToID.TryGetValue(2u, out uint dialogsLayoutDid));
var dialogs = LayoutImporter.ImportInfos(
dats,
dialogsLayoutDid,
RetailConfirmationDialogService.RootElementId);
Assert.NotNull(dialogs);
var dialogsJson = JsonSerializer.Serialize(dialogs, new JsonSerializerOptions
{
IncludeFields = true,
WriteIndented = true,
});
File.WriteAllText(
Path.Combine(FixtureDirectory(), $"dialogs_{dialogsLayoutDid:X8}.json"),
dialogsJson);
foreach (var (layoutId, fileName) in Layouts)
{
var info = LayoutImporter.ImportInfos(dats, layoutId);
@ -67,6 +87,7 @@ public sealed class RetailLayoutFixtureGenerator
});
File.WriteAllText(Path.Combine(FixtureDirectory(), fileName), json);
}
}
private static string FixtureDirectory([CallerFilePath] string thisFile = "")

File diff suppressed because it is too large Load diff