Skip to content

GrantCoins

Referee: put coins straight into a member's purse.

Full documentation: GrantCoins. Wire type: grant_coins.

Legal session modes: battle, encounter, exploring, game_over, town, victory

JSON Schema

{
  "$defs": {
    "Coins": {
      "description": "A fixed pile of coins, like generated treasure, the contents of a chest, or a pile dropped on the floor.\n\nFrozen, unlike the `CoinPurse` a character carries.\n`generate_treasure` returns its coins in this\nform, and a dungeon feature contains its coins this way until someone picks them up. To\ngive the coins to a character, add each denomination to their purse.",
      "properties": {
        "pp": {
          "default": 0,
          "minimum": 0,
          "title": "Pp",
          "type": "integer",
          "description": "Platinum pieces, worth 5 gp each."
        },
        "gp": {
          "default": 0,
          "minimum": 0,
          "title": "Gp",
          "type": "integer",
          "description": "Gold pieces."
        },
        "ep": {
          "default": 0,
          "minimum": 0,
          "title": "Ep",
          "type": "integer",
          "description": "Electrum pieces, worth half a gold piece each."
        },
        "sp": {
          "default": 0,
          "minimum": 0,
          "title": "Sp",
          "type": "integer",
          "description": "Silver pieces, ten to the gold piece."
        },
        "cp": {
          "default": 0,
          "minimum": 0,
          "title": "Cp",
          "type": "integer",
          "description": "Copper pieces, a hundred to the gold piece."
        }
      },
      "title": "Coins",
      "type": "object"
    }
  },
  "description": "Referee: put coins straight into a member's purse.\n\nUse it to pay out a reward. This command is legal in every mode, `game_over` and\n`victory` included.\n\nModes:\n    `town`, `exploring`, `encounter`, `battle`, `game_over`, `victory`\n\nRejections:\n    - `session.command.unknown_member` - `character_id` matches no party member.\n\nEvents:\n    `ItemAcquiredEvent` with the coins' value\n    and `origin` `\"grant\"`, so you can tell a granted reward from treasure the\n    party took.",
  "properties": {
    "command_type": {
      "const": "grant_coins",
      "default": "grant_coins",
      "title": "Command Type",
      "type": "string",
      "description": "The name that identifies the command class in serialized data. Each command class fixes\nit to a distinct snake_case string, like `\"move_party\"` or `\"open_door\"`, and constructing\nthe class sets it, so you never pass it yourself.\n`parse_command` and the\n`AnyCommand` union use it to rebuild the right class\nfrom a serialized mapping. A class's value never changes between releases."
    },
    "source": {
      "anyOf": [
        {
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Source",
      "description": "Who or what issued the command on whose behalf: an authored trigger or quest id, or the\nname of one of your game's systems. The engine never reads it, so a command with a\n`source` does exactly what the same command without one does. The session logs and\nreplays it with the command, so the log alone shows why something happened. Leave it\n`None` when there's nothing to record. An empty string fails validation when the command\nis constructed."
    },
    "character_id": {
      "title": "Character Id",
      "type": "string",
      "description": "The member whose purse receives the coins, by\n`MemberView.id`. A command you issue yourself has a\nmember id here, and the session refuses any other value with `session.command.unknown_member`.\nA consequence or a reward in an adventure document has a party selector instead,\n`\"@party\"` for every living member or `\"@first\"` for the first living member, because the\nsession assigns member ids when it starts. The trigger and quest interpreter replaces the selector\nwith member ids before it issues the command."
    },
    "coins": {
      "$ref": "#/$defs/Coins",
      "description": "The coins to add to the member's purse, by denomination. The session doesn't check\nweight, so a large grant can overload the member. An overloaded member slows the whole\nparty, or stops it moving, and then the session refuses\n`MoveParty` with `exploration.move.cannot_move`."
    }
  },
  "required": [
    "character_id",
    "coins"
  ],
  "title": "GrantCoins",
  "type": "object"
}