Skip to content

ItemConsumedEvent

An item a member carried was used up, like a key a gate takes or an iron spike.

Full documentation: ItemConsumedEvent. Wire type: item_consumed.

Default visibility: player

Message codes: exploration.item.consumed

JSON Schema

{
  "$defs": {
    "Visibility": {
      "description": "Who may see an event: the players, or only the referee.\n\nEvery event has one of these values, because in B/X the referee makes some rolls behind a screen. Filter\na log on it before you show anything to a player, or call\n`GameSession.view`, which builds the players' view and the referee's\nview for you. A narrator that plays the referee reads every event.\n\nA serialized event contains the lowercase value. The values stay fixed within a `schema_version`, the version\nstamp of the saved format.\n\nExamples:\n    ```python\n    from osrlib.core.events import DamageDealtEvent, HitPointsReportedEvent, Visibility\n\n    log = [\n        DamageDealtEvent(target_id=\"monster-0001\", amount=5),\n        HitPointsReportedEvent(target_id=\"monster-0001\", current_hp=2, max_hp=7),\n    ]\n    shown = [event.code for event in log if event.visibility is Visibility.PLAYER]\n    assert shown == [\"combat.damage.dealt\"]  # the goblin's remaining hit points stay hidden\n    ```",
      "enum": [
        "player",
        "referee"
      ],
      "title": "Visibility",
      "type": "string"
    }
  },
  "description": "An item a member carried was used up, like a key a gate takes or an iron spike.\n\nEmitted when the party passes a gate that requires an item and takes it, which can happen\non `OpenDoor`,\n`ForceDoor`,\n`UseStairs`, and a\n`MoveParty` through a passage. A gate is a condition\nthe adventure's author puts on a door or a transition. Also emitted by\n`WedgeDoor` for the iron spike it drives.\n\nIt reports that the item is gone. A potion drunk or a scroll read is an\n`ItemUsedEvent` instead.",
  "properties": {
    "code": {
      "default": "exploration.item.consumed",
      "title": "Code",
      "type": "string",
      "description": "The message code, always `exploration.item.consumed`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player",
      "description": "Player visibility: the party sees what it spent."
    },
    "event_type": {
      "const": "item_consumed",
      "default": "item_consumed",
      "title": "Event Type",
      "type": "string",
      "description": "The event type, `item_consumed`, which identifies this class in serialized form."
    },
    "character_id": {
      "title": "Character Id",
      "type": "string",
      "description": "The member whose pack the item came out of."
    },
    "item_id": {
      "title": "Item Id",
      "type": "string",
      "description": "What was consumed: the catalog id for mundane gear, and the session-scoped instance id for\na magic item, never its template id, so an unidentified item's identity never reaches a\nplayer-visible event."
    }
  },
  "required": [
    "character_id",
    "item_id"
  ],
  "title": "ItemConsumedEvent",
  "type": "object"
}