fix(headless): route wire-only chat commands

This commit is contained in:
Erik 2026-08-14 20:47:06 +02:00
parent 41b15efd4d
commit 259f0e5ac3
3 changed files with 219 additions and 0 deletions

View file

@ -929,6 +929,24 @@ internal sealed class HeadlessSessionHost : IDisposable
case ClientCommandId.ClearChat:
runtime.CommunicationOwner.Chat.Clear();
return;
case ClientCommandId.ChatToggle:
// Retail DoChatToggle: "off" adds the global Speech
// squelch; "on" removes it.
session.SendModifyGlobalSquelch(
command.Arguments.Equals(
"off",
StringComparison.OrdinalIgnoreCase),
2u);
return;
case ClientCommandId.NoTellToggle:
// Retail DoNoTell: "on" adds the global Tell squelch;
// "off" removes it.
session.SendModifyGlobalSquelch(
command.Arguments.Equals(
"on",
StringComparison.OrdinalIgnoreCase),
3u);
return;
case ClientCommandId.IndexChannels:
session.SendIndexChannels();
return;
@ -953,6 +971,9 @@ internal sealed class HeadlessSessionHost : IDisposable
case ClientCommandId.AllegianceInfo:
session.SendAllegianceInfoRequest(command.Arguments.Trim());
return;
case ClientCommandId.Permit:
ExecutePermit(session, command.Arguments);
return;
case ClientCommandId.HouseAvailableList
when RetailClientCommandCatalog.TryResolveHouseType(
command.Arguments,
@ -996,6 +1017,29 @@ internal sealed class HeadlessSessionHost : IDisposable
}
send(channelId);
}
static void ExecutePermit(
AcDream.Core.Net.WorldSession activeSession,
string arguments)
{
// The catalog has already required add/remove plus a name.
// Match ClientCommandController's JoinArgsAsName behavior so
// multi-word character names remain one exact wire argument.
string[] parts = arguments.Split(
(char[]?)null,
StringSplitOptions.RemoveEmptyEntries);
string name = string.Join(' ', parts, 1, parts.Length - 1);
if (parts[0].Equals(
"add",
StringComparison.OrdinalIgnoreCase))
{
activeSession.SendAddPlayerPermission(name);
}
else
{
activeSession.SendRemovePlayerPermission(name);
}
}
}
private ILiveSessionEventRouting CreateEventRoute(