Skip to content

ItemAcquiredEvent

Items or coins landed in a character's inventory.

Full documentation: ItemAcquiredEvent. Wire type: item_acquired.

Default visibility: player

Message codes: exploration.item.acquired

JSON Schema

{
  "$defs": {
    "Visibility": {
      "description": "Who is allowed to see an event.\n\nEvery event has one of these two values, and the split exists because B/X keeps some rolls behind the\nreferee's screen. Filter a log on it before you show anything to a player, or call\n`GameSession.view`, which builds the player's and the referee's\nviews for you. A narrator playing referee reads both.\n\nThe values are the lowercase strings and they serialize into every event, so a renamed value is a\n`schema_version` bump.\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": "Items or coins landed in a character's inventory.\n\nEmitted by `TakeTreasure` once per carrier\nwho took a share, by\n`PurchaseEquipment` in town, and by\nthe referee's `GrantItem` and\n`GrantCoins`.\n\nIt reports what changed hands, not what the character now carries. Read the\ninventory itself from `GameSession.view`\nwhen you need the full sheet.",
  "properties": {
    "code": {
      "default": "exploration.item.acquired",
      "title": "Code",
      "type": "string",
      "description": "The message code, always `exploration.item.acquired`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player",
      "description": "Player visibility: the party knows what it picked up."
    },
    "event_type": {
      "const": "item_acquired",
      "default": "item_acquired",
      "title": "Event Type",
      "type": "string",
      "description": "The wire discriminator, `item_acquired`."
    },
    "character_id": {
      "title": "Character Id",
      "type": "string",
      "description": "The member whose pack the goods went into."
    },
    "item_ids": {
      "default": [],
      "items": {
        "type": "string"
      },
      "title": "Item Ids",
      "type": "array",
      "description": "What was acquired, one entry per item: a catalog id for mundane gear, repeated when several\nof the same thing arrived, and a session-scoped instance id for a valuable or a magic item, so\nan unidentified item's true nature stays hidden."
    },
    "coins_gp_value": {
      "default": 0,
      "title": "Coins Gp Value",
      "type": "integer",
      "description": "The coins acquired, converted to their value in gold pieces, and zero when only items\nchanged hands."
    },
    "origin": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Origin",
      "description": "Where the goods came from: `\"treasure\"` for a share of a haul taken with\n`TakeTreasure`, `\"purchase\"` for gear bought with\n`PurchaseEquipment`, and `\"grant\"` for a referee's\n`GrantItem` or `GrantCoins`.\nEvery command that emits this event fills it, so it is `None` only on an event loaded from a save\nwritten before the field existed."
    }
  },
  "required": [
    "character_id"
  ],
  "title": "ItemAcquiredEvent",
  "type": "object"
}