Difference between revisions of "GMCP"
From ThresholdRPG Wiki
(updating supported packages) |
|||
Line 87: | Line 87: | ||
"guild" : "Guild", | "guild" : "Guild", | ||
"guild_level" : "Guild level", | "guild_level" : "Guild level", | ||
+ | "hb" : "Heal bank", | ||
"level" : "Level", | "level" : "Level", | ||
"name" : "Name", | "name" : "Name", | ||
Line 92: | Line 93: | ||
"session_login" : "Logged in", | "session_login" : "Logged in", | ||
"tnl" : "To next level", | "tnl" : "To next level", | ||
+ | "tummy" : "Fullness", | ||
"xp" : "Experience" | "xp" : "Experience" | ||
} | } | ||
Line 110: | Line 112: | ||
"guild_level" : 11, | "guild_level" : 11, | ||
"level" : 11, | "level" : 11, | ||
+ | "hb" : 40, | ||
"name" : "Karahd", | "name" : "Karahd", | ||
"race" : "elf", | "race" : "elf", | ||
"session_login" : 1625955749, | "session_login" : 1625955749, | ||
"tnl" : 54, | "tnl" : 54, | ||
+ | "tummy" : 25, | ||
"xp" : 372225 | "xp" : 372225 | ||
} | } | ||
− | |||
</pre> | </pre> | ||
Line 135: | Line 138: | ||
"string" : "HP: 100/200 SP: 100/200 EP: 100/200" | "string" : "HP: 100/200 SP: 100/200 EP: 100/200" | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</pre> | </pre> | ||
Revision as of 15:46, 14 October 2021
Client
Core
Hello
- Sends information about the MUD client and its version.
- May only be sent before successful login.
Example:
Core.Hello { "client": "MyMUDClient", "version": "1.2.34" }
Ping
- Ensures server is listening and GMCP is enabled.
- Message body is a number which indicates average ping time from previous requests, if available.
- Causes server to reply with a Core.Ping message in response.
Example:
Core.Ping 120
Supports
Set
- Notifies the server about packages supported by the client.
- If another Core.Supports.* package has been received earlier, the list is deleted and replaced with the new one.
- Message body is an array of strings, each consisting of the module name and version, separated by space.
- Module version is a positive non-zero integer.
- Most client implementations will only need to send Set once and won't need Add/Remove; exceptions are module implementations provided by plug-ins.
Example:
Core.Supports.Set [ "Char 1", "Char.Skills 1", "Char.Items 1" ]
Add
- Similar to Core.Supports.Set, but appends the supported module list to the one sent earlier.
- If no list was sent yet, the behaviour is identical to Core.Supports.Set.
- If the list includes module names that were already included earlier, the new version number takes precedence over the previously sent one, even if the newly sent number is lower.
- Message body format is identical to that of Core.Supports.Set.
Example:
Core.Supports.Add [ "Char.Vitals 1", "Char.Status 1" ]
Remove
- Removes specified modules from the list of supported modules.
- Message body format is similar to Core.Supports.Set, except that module version numbers are optional and ignored if given.
Example:
Core.Supports.Remove [ "Char", "Char.Skills", "Char.Items" ]
Server
Core
Goodbye
- Sent by server immediately before terminating a connection.
- Message body is a string to be shown to the user - it can explain the reason for the disconnect.
Example:
Core.Goodbye "Farewell, cruel world!"
Ping
- Sent in reply to Core.Ping from the client.
- No message body.
Example:
Core.Ping
Char
StatusVars
- Sent by server after a successful login.
- Contains a list of names of character status variables (level, race, etc) and their display captions.
- Message body is an object with keys containing the names of the status variables and values containing the captions to be displayed to the user.
Example:
Char.StatusVars { "age" : "Age", "expertise" : "Expertise", "fullname" : "Full name", "guild" : "Guild", "guild_level" : "Guild level", "hb" : "Heal bank", "level" : "Level", "name" : "Name", "race" : "Race", "session_login" : "Logged in", "tnl" : "To next level", "tummy" : "Fullness", "xp" : "Experience" }
Status
- Sent by server immediately after the initial Char.StatusVars message and whenever the value of a variable changes.
- Contains the values of character status variables (level, race, etc).
- The full list of variables is only sent with the initial message, subsequent messages only contain changed variables.
- Message body is an object with keys containing the names of the variables, as defined by the Char.StatusVars message, and values containing the values of the variables.
Example:
Char.Status { "age" : 500, "expertise" : 258493, "fullname" : "Karahd the Magocrat", "guild" : "mage", "guild_level" : 11, "level" : 11, "hb" : 40, "name" : "Karahd", "race" : "elf", "session_login" : 1625955749, "tnl" : 54, "tummy" : 25, "xp" : 372225 }
Vitals
- Sent by server whenever a prompt is displayed to the player and whenever the character's vitals change.
- Contains basic information about character's vitality (hp, sp, ep).
- Message body is an object containing key-value pairs corresponding to character attributes.
- Each variable is also included in a string in the format name:cur/max.
Example:
Char.Vitals { "hp" : 100, "sp" : 100, "ep" : 100, "maxhp" : 200, "maxsp" : 200, "maxep" : 200, "string" : "HP: 100/200 SP: 100/200 EP: 100/200" }
Afflictions
Supported afflictions:
- blind
- deaf
- immobile
- mute
- stun
Add
- Sent by the server when a new affliction is added to the character.
- Message is a string that is the affliction which has been added.
Example:
Char.Afflictions.Add "blind"
Remove
- Sent by the server when a new affliction is removed from the character.
- Message is a string that is the affliction which has been removed.
Example:
Char.Afflictions.Remove "blind"