feat(chat): Phase J - welcome message + own-echo dedup + long-form slash aliases + WeenieError templates
Six fixes from the 2026-04-25 live verify session. 1. ServerMessage (0xF7E0) wired to ChatLog. ACE's GameMessageSystemChat - used for the login banner "Welcome to Asheron's Call ... powered by ACEmulator ... type @acehelp" plus any future server broadcast - rides opcode 0xF7E0. The parser shipped in I.5 but the WorldSession.ServerMessageReceived event was never subscribed by GameWindow, so the welcome line was silently dropped. Subscribed now; same wave wires the missing EmoteHeard / SoulEmoteHeard / PlayerKilledReceived events that I.5 also left orphan. 2. Drop optimistic /say echo + plumb local-player-guid into ChatLog. ACE's HandleActionTalk broadcasts a HearSpeech back to the sender too, so we were double-printing every /say (own optimistic + server echo). New ChatLog.SetLocalPlayerGuid() pushes the chosen character guid in (mirrors VitalsVM pattern); OnLocalSpeech detects own-guid match and substitutes Sender="" so the formatter 's IsOwnSpeaker path renders "You say, ..." instead of "+Acdream says, ...". Single line per /say. 3. IsOwnSpeaker check now applies to ChatKind.Channel too. Empty/ "You" sender -> "[Allegiance] You say, \"text\"" instead of the "[Allegiance] says, \"text\"" double-space hole that Phase I.6's OnSelfSent left when echoing legacy ChatChannel sends. 4. Long-form slash aliases: /general /allegiance /patron /vassals /monarch /covassals /fellowship /fellow /lookingforgroup /roleplay /rp /tr /gen, plus /s as alias for /say. Retail muscle memory expected these; the prior parser only recognized /g /a /p /v /m /cv /lfg /role and friends, so "/patron hello" fell through as /say with the literal "/patron" prefix. 5. WeenieError templates filled in for the codes the user hit: - 0x0414 YouAreNotInAllegiance -> "You are not in an allegiance!" - 0x050F YouDoNotBelongToAFellowship -> "You do not belong to a Fellowship." Replaces the cryptic "WeenieError 0x0414" / "0x050F" lines. 6. @ command pass-through: ACE handles @help / @acehelp / @tele etc. server-side by intercepting Talk text with @ prefix; the user's message isn't broadcast and ACE replies via SystemChat. Drop the optimistic /say echo so the chat shows only the server's response (the SystemChat wiring from #1 surfaces it as [System] {help}). Tests: - 11 long-form-alias Theory cases on ChatInputParser. - 3 own-guid-substitution cases on ChatLog (own match, different guid, pre-login fallback). - Existing PrefixSubstring test refactored to "/genio" since the previous "/general" stub is now a real verb. Solution total: 1021 green (243 Core.Net + 125 UI + 653 Core), 0 warnings, 0 errors. +14 tests. Acceptance: at login, [System] Welcome to Asheron's Call appears. Single "You say, \"hi\"" per /say. /allegiance with no allegiance shows [Allegiance] You say, ... + [System] You are not in an allegiance!. /patron / /vassals / /monarch route correctly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3f7821c18d
commit
7726f62528
7 changed files with 177 additions and 20 deletions
|
|
@ -39,26 +39,43 @@ public static class ChatInputParser
|
|||
|
||||
// Alias tables. Order matters only for error messages — verb
|
||||
// matching is exact-token, not prefix.
|
||||
private static readonly string[] SayAliases = { "/say" };
|
||||
private static readonly string[] SayAliases = { "/say", "/s" };
|
||||
private static readonly string[] TellAliases = { "/tell", "/t" };
|
||||
private static readonly string[] ReplyAliases = { "/reply", "/r" };
|
||||
|
||||
// Channel aliases. Each maps a single verb token to a channel kind.
|
||||
// The same list drives both the verb test and the prefix-strip.
|
||||
// Long-form aliases mirror retail muscle memory (e.g. "/allegiance"
|
||||
// for "/a", "/patron" for "/p"). Phase J added the long forms after
|
||||
// a 2026-04-25 live session showed "/patron hello" falling through
|
||||
// as plain Say with the literal "/patron " prefix.
|
||||
private static readonly (string Verb, ChatChannelKind Channel)[] ChannelVerbs =
|
||||
{
|
||||
("/g", ChatChannelKind.General),
|
||||
("/f", ChatChannelKind.Fellowship),
|
||||
("/a", ChatChannelKind.Allegiance),
|
||||
("/m", ChatChannelKind.Monarch),
|
||||
("/p", ChatChannelKind.Patron),
|
||||
("/v", ChatChannelKind.Vassals),
|
||||
("/cv", ChatChannelKind.CoVassals),
|
||||
("/lfg", ChatChannelKind.Lfg),
|
||||
("/trade", ChatChannelKind.Trade),
|
||||
("/role", ChatChannelKind.Roleplay),
|
||||
("/society", ChatChannelKind.Society),
|
||||
("/olthoi", ChatChannelKind.Olthoi),
|
||||
("/g", ChatChannelKind.General),
|
||||
("/general", ChatChannelKind.General),
|
||||
("/gen", ChatChannelKind.General),
|
||||
("/f", ChatChannelKind.Fellowship),
|
||||
("/fellow", ChatChannelKind.Fellowship),
|
||||
("/fellowship", ChatChannelKind.Fellowship),
|
||||
("/a", ChatChannelKind.Allegiance),
|
||||
("/allegiance", ChatChannelKind.Allegiance),
|
||||
("/m", ChatChannelKind.Monarch),
|
||||
("/monarch", ChatChannelKind.Monarch),
|
||||
("/p", ChatChannelKind.Patron),
|
||||
("/patron", ChatChannelKind.Patron),
|
||||
("/v", ChatChannelKind.Vassals),
|
||||
("/vassals", ChatChannelKind.Vassals),
|
||||
("/cv", ChatChannelKind.CoVassals),
|
||||
("/covassals", ChatChannelKind.CoVassals),
|
||||
("/lfg", ChatChannelKind.Lfg),
|
||||
("/lookingforgroup", ChatChannelKind.Lfg),
|
||||
("/trade", ChatChannelKind.Trade),
|
||||
("/tr", ChatChannelKind.Trade),
|
||||
("/role", ChatChannelKind.Roleplay),
|
||||
("/rp", ChatChannelKind.Roleplay),
|
||||
("/roleplay", ChatChannelKind.Roleplay),
|
||||
("/society", ChatChannelKind.Society),
|
||||
("/olthoi", ChatChannelKind.Olthoi),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -114,7 +114,14 @@ public sealed class ChatVM
|
|||
// is populated by callers that know the friendly name (the
|
||||
// TurbineChat inbound dispatch and OnSelfSent for Channel
|
||||
// kinds); falls back to "ch {ChannelId}" if not set.
|
||||
ChatKind.Channel => $"[{ChannelLabel(entry)}] {entry.Sender} says, \"{entry.Text}\"",
|
||||
// Empty/"You" sender → "[Channel] You say, ..." for our own
|
||||
// optimistic echo on legacy ChatChannel and self-broadcast on
|
||||
// turbine channels (server's EventSendToRoom carries the
|
||||
// sender name; OnSelfSent for legacy channels leaves it
|
||||
// empty so the formatter substitutes here).
|
||||
ChatKind.Channel => IsOwnSpeaker(entry.Sender)
|
||||
? $"[{ChannelLabel(entry)}] You say, \"{entry.Text}\""
|
||||
: $"[{ChannelLabel(entry)}] {entry.Sender} says, \"{entry.Text}\"",
|
||||
// Tell: SenderGuid != 0 means an incoming whisper; == 0 is the
|
||||
// OnSelfSent echo where Sender carries the target name. Retail
|
||||
// wording: "You tell Caith, \"hi\"" / "Caith tells you, \"hi\"".
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue