Class ChatCommandHelpListing
- Namespace
- FishMMO.Server.Implementation.World.SceneServer
- Assembly
- FishMMO.Server.dll
The text /help answers with, built from the command registry and the caller's access level.
public static class ChatCommandHelpListing
- Inheritance
-
ChatCommandHelpListing
- Inherited Members
Remarks
Visibility is the gate's own rule. A command is listed only when
TryParseCommand(string, IPlayerCharacter, ChatBroadcast) would run it for this caller: above
Banned and at or above the command's registered level. The level is
the caller's server-loaded AccessLevel; nothing the
client sends reaches this. A player therefore never sees /gm or /admin, and a
game master never sees /admin.
Sub-commands are not listed here. /gm and /admin are one entry each whose
summary points at their own help, which is derived from their tables and is itself
behind their access gate. Nothing in this listing could leak a sub-command name.
No oracle. /help <command> answers a command the caller may not use with
exactly the line it answers a command that does not exist, and echoes nothing typed.
Pure: nothing here touches server state, so the rules can be tested against any registry.
Fields
ChatCategory
The category listed first; the rest follow by access level, then name.
public const string ChatCategory = "Chat"
Field Value
Header
The first line of the full listing.
public const string Header = "Commands you can use (/help <command> describes one):"
Field Value
LineLength
Longest line composed, below MaxTextLength; the client discards a longer line outright.
public const int LineLength = 120
Field Value
MaxCategoryLength
Longest category name shown before a listing line.
public const int MaxCategoryLength = 24
Field Value
UndescribedCategory
Category for registered commands nobody described.
public const string UndescribedCategory = "Other"
Field Value
UnknownCommand
The answer to a topic the caller cannot use, whether or not it exists.
public const string UnknownCommand = "Unknown command. /help lists the commands you can use."
Field Value
Methods
Build(AccessLevel, string)
Builds the /help reply from the live ChatHelper registry.
public static IReadOnlyList<string> Build(AccessLevel caller, string topic)
Parameters
callerAccessLevelThe caller's server-loaded access level.
topicstringThe text after
/help; empty for the full listing.
Returns
Build(AccessLevel, string, IReadOnlyDictionary<string, ChatCommandRegistration>, IReadOnlyDictionary<string, ChatCommandHelp>, IReadOnlyDictionary<ChatChannel, List<string>>, IReadOnlyDictionary<ChatChannel, ChatCommandHelp>)
Builds the /help reply from the registry given.
public static IReadOnlyList<string> Build(AccessLevel caller, string topic, IReadOnlyDictionary<string, ChatCommandRegistration> commands, IReadOnlyDictionary<string, ChatCommandHelp> help, IReadOnlyDictionary<ChatChannel, List<string>> channelWords, IReadOnlyDictionary<ChatChannel, ChatCommandHelp> channelHelp)
Parameters
callerAccessLevelThe caller's server-loaded access level.
topicstringThe text after
/help; empty for the full listing.commandsIReadOnlyDictionary<string, ChatCommandRegistration>Registered slash commands and their levels.
helpIReadOnlyDictionary<string, ChatCommandHelp>Help text for slash commands, keyed by main word.
channelWordsIReadOnlyDictionary<ChatChannel, List<string>>Channel commands and the words that select each.
channelHelpIReadOnlyDictionary<ChatChannel, ChatCommandHelp>Help text for channel commands.
Returns
- IReadOnlyList<string>
Lines, each no longer than LineLength.
CanUse(AccessLevel, AccessLevel)
True when a caller at caller may run a command registered at required.
public static bool CanUse(AccessLevel caller, AccessLevel required)
Parameters
callerAccessLevelrequiredAccessLevel
Returns
Remarks
The same test as TryParseCommand(string, IPlayerCharacter, ChatBroadcast): nothing is usable from Banned.
VisibleEntries(AccessLevel, IReadOnlyDictionary<string, ChatCommandRegistration>, IReadOnlyDictionary<string, ChatCommandHelp>, IReadOnlyDictionary<ChatChannel, List<string>>, IReadOnlyDictionary<ChatChannel, ChatCommandHelp>)
Every command the caller may run: channel commands first, then described slash commands, then any registered word nobody described.
public static List<ChatCommandHelpListing.Entry> VisibleEntries(AccessLevel caller, IReadOnlyDictionary<string, ChatCommandRegistration> commands, IReadOnlyDictionary<string, ChatCommandHelp> help, IReadOnlyDictionary<ChatChannel, List<string>> channelWords, IReadOnlyDictionary<ChatChannel, ChatCommandHelp> channelHelp)
Parameters
callerAccessLevelcommandsIReadOnlyDictionary<string, ChatCommandRegistration>helpIReadOnlyDictionary<string, ChatCommandHelp>channelWordsIReadOnlyDictionary<ChatChannel, List<string>>channelHelpIReadOnlyDictionary<ChatChannel, ChatCommandHelp>