feat(chat): port retail's @pklite client command (EnterPkLite 0x028F)

acdream never implemented @pklite. It is a CLIENT command in retail, not a
server one — ACE has no pklite text-command handler — so typing it forwarded as
inert chat text that the server ignored.

Retail: ClientCommunicationSystem::DoPKLite @0x0057A490 rejects with
WeenieError 0x507 when ACCWeenieObject::IsPlayerKiller @0x0058C910 is true
(that returns true when EITHER the PK bit 0x20 OR the PKLite bit 0x2000000 is
set), prints "Please see @help pklite for more..." and sends nothing if given
any argument text, and otherwise calls CM_Character::Event_EnterPKLite
@0x006A13F0 — a bare 12-byte parameterless game action, opcode 0x28F, the same
shape as Event_LoginCompleteNotification beside it. Verb string at 0x007E16B0,
help text at 0x007DF0C8, failure string at 0x007D31E8; one verb, no alias.

HasPlayerFlag is a tri-state (null = the local PublicWeenieDesc has not
arrived). The existing arena gates compare `== false` because they reject on a
known-FALSE flag; retail's DoPKLite gates the other way, rejecting on
known-TRUE. So this case compares `== true` on either bit: an indeterminate
description sends rather than blocks, which matches retail trusting the server
instead of inventing a client-side suppression rule.

Landed as its own commit because it is retail-faithful on its own merits, but
the motivation is C4 route 2: ACE advances SequenceType.ObjectForcePosition in
exactly two places, and the only reachable one is Player.HandleActionEnterPkLite's
entry-collision bump (allow_pkl_bump, default on). Every admin teleport advances
ObjectTeleport instead, so @teleto-style displacement exercises route 3, not
route 2. Without this command route 2 has no connected acceptance gate at all.

Gates: complete Release solution 10,867 passed / 4 skipped / 0 failed
(9966b531 baseline 10,858/4/0; +9 = the 9 tests added). Coverage includes both
known-true rejections, the known-false success case, the tri-state unknown
case, the 12-byte wire envelope, and @pklite resolving as ClientHandled rather
than falling through to the server-text path.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-03 18:57:17 +02:00
parent 9966b53174
commit 69ba9486b6
13 changed files with 146 additions and 8 deletions

View file

@ -374,5 +374,6 @@ public sealed class LiveSessionCommandRouterTests
LastTeller: () => null,
ClearDesiredComponents: () => { },
HasOpenVendor: () => false,
FillComponentBuyList: (_, _) => { });
FillComponentBuyList: (_, _) => { },
EnterPkLite: () => { });
}

View file

@ -58,6 +58,68 @@ public sealed class ClientCommandControllerTests
Assert.Equal([0x0560u], errors);
}
[Fact]
public void EnterPkLite_NonPk_SendsTheRetailGameAction()
{
var calls = new List<string>();
var errors = new List<uint>();
var controller = NewController(calls, errors, playerBitfield: 0x8u);
controller.Execute(new ExecuteClientCommandCmd(
ClientCommandId.EnterPkLite, string.Empty));
Assert.Equal(["pklite"], calls);
Assert.Empty(errors);
}
[Fact]
public void EnterPkLite_AlreadyPk_ShowsRetailFailureWithoutSending()
{
var calls = new List<string>();
var errors = new List<uint>();
// 0x20 = ACCWeenieObject::IsPK bit only.
var controller = NewController(calls, errors, playerBitfield: 0x20u);
controller.Execute(new ExecuteClientCommandCmd(
ClientCommandId.EnterPkLite, string.Empty));
Assert.Empty(calls);
Assert.Equal([0x0507u], errors);
}
[Fact]
public void EnterPkLite_AlreadyPkLite_ShowsRetailFailureWithoutSending()
{
var calls = new List<string>();
var errors = new List<uint>();
// 0x2000000 = ACCWeenieObject::IsPKLite bit only.
var controller = NewController(calls, errors, playerBitfield: 0x2000000u);
controller.Execute(new ExecuteClientCommandCmd(
ClientCommandId.EnterPkLite, string.Empty));
Assert.Empty(calls);
Assert.Equal([0x0507u], errors);
}
[Fact]
public void EnterPkLite_UnknownPlayerDescription_SendsRatherThanRejects()
{
// Tri-state decision: retail's DoPKLite only rejects when
// IsPlayerKiller() is TRUE. An indeterminate PublicWeenieDesc (not
// yet arrived) must send, not reject -- the opposite direction from
// the arena recalls, which gate on the flag being known-true.
var calls = new List<string>();
var errors = new List<uint>();
var controller = NewController(calls, errors, playerBitfield: null);
controller.Execute(new ExecuteClientCommandCmd(
ClientCommandId.EnterPkLite, string.Empty));
Assert.Equal(["pklite"], calls);
Assert.Empty(errors);
}
[Fact]
public void MissingPlayerDescription_DoesNotInventAClientRejection()
{
@ -314,6 +376,7 @@ public sealed class ClientCommandControllerTests
() => lastTeller,
() => calls.Add("clearcomps"),
() => vendorOpen,
(category, price) => calls.Add($"fillcomps:{category}:{price}")));
(category, price) => calls.Add($"fillcomps:{category}:{price}"),
() => calls.Add("pklite")));
}
}

View file

@ -10,6 +10,7 @@ public sealed class ClientCommandRequestsTests
{ ClientCommandRequests.BuildMarketplace, ClientCommandRequests.MarketplaceOpcode },
{ ClientCommandRequests.BuildPkArena, ClientCommandRequests.PkArenaOpcode },
{ ClientCommandRequests.BuildPkLiteArena, ClientCommandRequests.PkLiteArenaOpcode },
{ ClientCommandRequests.BuildEnterPkLite, ClientCommandRequests.EnterPkLiteOpcode },
{ ClientCommandRequests.BuildHouseRecall, ClientCommandRequests.HouseRecallOpcode },
{ ClientCommandRequests.BuildMansionRecall, ClientCommandRequests.MansionRecallOpcode },
{ ClientCommandRequests.BuildSuicide, ClientCommandRequests.SuicideOpcode },

View file

@ -89,4 +89,17 @@ public sealed class WorldSessionChatTests
Assert.NotNull(captured);
Assert.Equal(InteractRequests.BuildTeleToLifestone(1), captured);
}
[Fact]
public void SendEnterPkLite_EmitsRetailGameAction()
{
using var session = NewSession();
byte[]? captured = null;
session.GameActionCapture = body => captured = body;
session.SendEnterPkLite();
Assert.NotNull(captured);
Assert.Equal(ClientCommandRequests.BuildEnterPkLite(1), captured);
}
}

View file

@ -87,6 +87,18 @@ public class ChatCommandRouterTests
Assert.Contains(log.Snapshot(), entry => entry.Text == "Usage: /lifestone");
}
[Fact]
public void PkLiteAlias_ResolvesAsClientHandled_NotTheServerTextPath()
{
var (vm, _, bus) = Fixture();
var outcome = ChatCommandRouter.Submit("@pklite", vm, bus, ChatChannelKind.Say);
Assert.Equal(SubmitOutcome.ClientHandled, outcome);
var command = Assert.IsType<ExecuteClientCommandCmd>(Assert.Single(bus.Published));
Assert.Equal(ClientCommandId.EnterPkLite, command.Command);
}
[Fact]
public void UnknownSlashVerb_RoutesThroughExplicitServerCommand()
{

View file

@ -28,6 +28,8 @@ public sealed class RetailClientCommandCatalogTests
[InlineData("/pka", ClientCommandId.PkArenaRecall)]
[InlineData("/pklarena", ClientCommandId.PkLiteArenaRecall)]
[InlineData("/pla", ClientCommandId.PkLiteArenaRecall)]
[InlineData("/pklite", ClientCommandId.EnterPkLite)]
[InlineData("@pklite", ClientCommandId.EnterPkLite)]
[InlineData("/hor", ClientCommandId.HouseRecall)]
[InlineData("/hr", ClientCommandId.HouseRecall)]
[InlineData("/hom", ClientCommandId.MansionRecall)]