Difference between revisions of "GMCP"

From ThresholdRPG Wiki
(→‎Vitals: fixing values for Char.Vitals)
(moving TOC to right right)
 
Line 1: Line 1:
== Client ==
+
{{TOC right}}
 +
==Client==
  
=== Char ===
+
===Char===
  
==== Buffs ====
+
====Buffs====
  
===== List =====
+
===== List=====
  
* Requests a list of buffs currently applied to a character
+
*Requests a list of buffs currently applied to a character
* No accompanying message payload
+
*No accompanying message payload
  
 
Example:<pre>
 
Example:<pre>
Line 14: Line 15:
 
</pre>
 
</pre>
  
==== Debuffs ====
+
====Debuffs====
  
===== List =====
+
===== List=====
  
* Requests a list of debuffs currently applied to a character
+
*Requests a list of debuffs currently applied to a character
* No accompanying message payload
+
*No accompanying message payload
  
 
Example:<pre>
 
Example:<pre>
Line 25: Line 26:
 
</pre>
 
</pre>
  
=== Core ===
+
===Core===
  
 
==== Hello ====
 
==== Hello ====
  
* Sends information about the MUD client and its version.
+
*Sends information about the MUD client and its version.
* May only be sent before successful login.
+
*May only be sent before successful login.
  
 
Example:
 
Example:
Line 37: Line 38:
 
</pre>
 
</pre>
  
==== Ping ====
+
====Ping====
* Ensures server is listening and GMCP is enabled.
+
*Ensures server is listening and GMCP is enabled.
* Message body is a number which indicates average ping time from previous requests, if available.
+
*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.
 
* Causes server to reply with a Core.Ping message in response.
 
Example:
 
Example:
Line 46: Line 47:
 
</pre>
 
</pre>
  
==== Supports ====
+
====Supports====
===== Set =====
+
=====Set=====
* Notifies the server about packages supported by the client.
+
*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.
+
*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.
+
*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.
+
*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.
+
*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:
 
Example:
 
<pre>
 
<pre>
 
Core.Supports.Set [ "Char 1", "Char.Skills 1", "Char.Items 1" ]
 
Core.Supports.Set [ "Char 1", "Char.Skills 1", "Char.Items 1" ]
 
</pre>
 
</pre>
===== Add =====
+
=====Add=====
* Similar to Core.Supports.Set, but appends the supported module list to the one sent earlier.
+
*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 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.
+
*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.
+
*Message body format is identical to that of Core.Supports.Set.
 
Example:
 
Example:
 
<pre>
 
<pre>
Line 67: Line 68:
 
</pre>
 
</pre>
  
===== Remove =====
+
=====Remove=====
* Removes specified modules from the list of supported modules.
+
*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.
+
*Message body format is similar to Core.Supports.Set, except that module version numbers are optional and ignored if given.
 
Example:
 
Example:
 
<pre>
 
<pre>
Line 75: Line 76:
 
</pre>
 
</pre>
  
== Server ==
+
==Server==
  
=== Core ===
+
===Core===
  
==== Goodbye ====
+
====Goodbye====
  
* Sent by server immediately before terminating a connection.
+
*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.
+
*Message body is a string to be shown to the user - it can explain the reason for the disconnect.
*  
+
*
 
Example:
 
Example:
 
<pre>
 
<pre>
Line 89: Line 90:
 
</pre>
 
</pre>
  
==== Ping ====
+
====Ping====
 
* Sent in reply to Core.Ping from the client.
 
* Sent in reply to Core.Ping from the client.
* No message body.
+
*No message body.
 
Example:
 
Example:
 
<pre>
 
<pre>
Line 97: Line 98:
 
</pre>
 
</pre>
  
=== Char ===
+
===Char===
  
==== Afflictions====
+
====Afflictions====
 
Supported afflictions:
 
Supported afflictions:
 
*blind
 
*blind
Line 106: Line 107:
 
*mute
 
*mute
 
* stun
 
* stun
=====Add =====
+
=====Add=====
 
*Sent by the server when a new affliction is added to the character.
 
*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.
 
*Message is a string that is the affliction which has been added.
Line 124: Line 125:
 
===Buffs===
 
===Buffs===
  
====Add====
+
==== Add====
  
 
*Sent by the server when a new temporary buff is applied to the character
 
*Sent by the server when a new temporary buff is applied to the character
Line 138: Line 139:
 
</pre>
 
</pre>
  
==== Remove====
+
====Remove====
  
 
*Sent by the server when a temporary buff is removed from the character
 
*Sent by the server when a temporary buff is removed from the character
Line 168: Line 169:
 
===Debuffs===
 
===Debuffs===
  
====Add====
+
==== Add====
  
 
*Sent by the server when a new temporary debuff is applied to the character
 
*Sent by the server when a new temporary debuff is applied to the character
Line 182: Line 183:
 
</pre>
 
</pre>
  
==== Remove====
+
====Remove====
  
 
*Sent by the server when a temporary debuff is removed from the character
 
*Sent by the server when a temporary debuff is removed from the character
Line 207: Line 208:
 
</pre>
 
</pre>
  
====StatusVars====
+
====StatusVars ====
*Sent by server after a successful login.
+
* Sent by server after a successful login.
 
*Contains a list of names of character status variables (level, race, etc) and their display captions.
 
*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.
 
*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.
Line 249: Line 250:
 
</pre>
 
</pre>
  
====Status ====
+
====Status====
* Sent by server immediately after the initial Char.StatusVars message and once every [[heartbeat]] thereafter.
+
*Sent by server immediately after the initial Char.StatusVars message and once every [[heartbeat]] thereafter.
 
*Contains the values of character status variables (level, race, etc).
 
*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.
 
*The full list of variables is only sent with the initial message, subsequent messages only contain changed variables.
Line 291: Line 292:
 
}</pre>
 
}</pre>
  
====Vitals====
+
====Vitals ====
*Sent by server whenever a prompt is displayed to the player and whenever the character's vitals change.
+
* 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).
+
* Contains basic information about character's vitality (hp, sp, ep).
 
*Message body is an object containing key-value pairs corresponding to character attributes.
 
*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.
 
*Each variable is also included in a string in the format name: cur/max.

Latest revision as of 00:14, 19 February 2024

Client

Char

Buffs

List
  • Requests a list of buffs currently applied to a character
  • No accompanying message payload

Example:

Char.Buffs.List

Debuffs

List
  • Requests a list of debuffs currently applied to a character
  • No accompanying message payload

Example:

Char.Debuffs.List

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

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"

Buffs

Add

  • Sent by the server when a new temporary buff is applied to the character
  • Message is an object that contains the unique buff id, the buff name, and the buff expiration timestamp

Example:

Char.Buffs.Add {
    "buff_id" : "buff_1672791803550808142",
    "expires" : "1672792523",
    "name" : "Mystic Blink"
  }

Remove

  • Sent by the server when a temporary buff is removed from the character
  • Message is a string corresponding with the unique buff id of the buff that is being removed

Example:

Char.Buffs.Remove "buff_1672791803550808142"

List

  • Sent by the server in response to a client message of Char.Buffs.List
  • Message is an object of objects containing the expiration time and the name for each unique buff id

Example:

Char.Buffs.List {
    "buff_1672791803550808142" : {
      "expires" : "1672792523",
      "name" : "Mystic Blink"
    },
    "buff_1672791928616589234" : {
      "expires" : "1672792828",
      "name" : "Plucky Lucky"
    }
}

Debuffs

Add

  • Sent by the server when a new temporary debuff is applied to the character
  • Message is an object that contains the unique debuff id, the buff name, and the debuff expiration timestamp

Example:

Char.Debuffs.Add {
    "debuff_id" : "debuff_1672791803550889442",
    "expires" : "1672792643",
    "name" : "Astral Sickness"
  }

Remove

  • Sent by the server when a temporary debuff is removed from the character
  • Message is a string corresponding with the unique debuff id of the debuff that is being removed

Example:

Char.Buffs.Remove "debuff_1672791803550889442"

List

  • Sent by the server in response to a client message of Char.Debuffs.List
  • Message is an object of objects containing the expiration time and the name for each unique debuff id

Example:

Char.Debuffs.List {
      "debuff_1672791803550889442" : {
      "expires" : "1672792643",
      "name" : "Astral Sickness"
    }
}

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",
  "bank": "Bank balance",
  "capacity": "Capacity",
  "dead": "Dead",
  "expertise": "Expertise",
  "foe_foe_name": "Foe's target",
  "foe_health": "Foe health",
  "foe_max_health": "Foe max health",
  "foe_name": "Current foe",
  "fullname": "Full name",
  "gender": "Gender",
  "guild": "Guild",
  "guild_level": "Guild level",
  "harmonic": "Harmonic",
  "hb": "Heal bank",
  "heritage": "Heritage",
  "hlevel": "Heritage level",
  "inactive": "Inactive",
  "inactive_type": "Inactive type",
  "invis": "Invisible",
  "level": "Level",
  "lodge": "Lodge",
  "lodge_level": "Lodge level",
  "max_capacity": "Max capacity",
  "morality": "Morality",
  "name": "Name",
  "primary_axis": "Primary axis",
  "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 once every heartbeat thereafter.
  • 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": "510",
  "bank": "314660",
  "capacity": "4792",
  "dead": "0",
  "expertise": "152287",
  "foe_foe_name": "none",
  "foe_health": "0",
  "foe_max_health": "100",
  "foe_name": "none",
  "fullname": "Karahd the Magocrat",
  "gender": "female",
  "guild": "mage",
  "guild_level": "12",
  "harmonic": "chaos",
  "hb": "0",
  "heritage": "scholar",
  "hlevel": "0",
  "inactive": "0",
  "inactive_type": "none",
  "invis": "0",
  "level": "12",
  "lodge": "otter",
  "lodge_level": "11",
  "max_capacity": "5000",
  "morality": "good",
  "name": "Karahd",
  "primary_axis": "harmonic",
  "race": "elf",
  "session_login": "1651011752",
  "tnl": "100",
  "tummy": "0",
  "xp": "10056981"
}

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"
}