ItemUsedEvent
A magic item was used: a potion drunk, a scroll read, a device fired.
Full documentation: ItemUsedEvent. Wire type: item_used.
Default visibility: player
Message codes: items.device.activated, items.potion.drunk, items.potion.mixed, items.scroll.cursed, items.scroll.read
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": "A magic item was used: a potion drunk, a scroll read, a device fired.\n\nEmitted by `UseItem` out of combat and by\n`ResolveBattleRound` for an item used\nin a fight. Whatever the item does follows in the same result as kernel events.\n\nUsing an item for the first time is what identifies it, so an\n`ItemIdentifiedEvent` and possibly a\n`CurseRevealedEvent` come just before\nthis one. Firing a device that has nothing left in it is a rejection\n(`items.device.inert`) rather than an event, because it costs the party nothing.\nCharges never appear on any event: how many uses an item has left is the\nreferee's to know.",
"properties": {
"code": {
"title": "Code",
"type": "string",
"description": "What happened, as two or more lowercase segments separated by dots and namespaced by subsystem, like\n`combat.attack.hit`. This is what you branch on and what\n`format_message` looks up. Anything else raises a validation error."
},
"visibility": {
"$ref": "#/$defs/Visibility",
"default": "player",
"description": "Player visibility: the party watched it happen."
},
"event_type": {
"const": "item_used",
"default": "item_used",
"title": "Event Type",
"type": "string",
"description": "The wire discriminator, `item_used`."
},
"character_id": {
"title": "Character Id",
"type": "string",
"description": "The member who used the item."
},
"instance_id": {
"title": "Instance Id",
"type": "string",
"description": "The session-scoped id of the item used, never its template id, so an item the party hasn't\nidentified keeps its secret."
},
"manual": {
"default": [],
"items": {
"type": "string"
},
"title": "Manual",
"type": "array",
"description": "The item's printed text, for the items whose effect the engine doesn't resolve, like a\ntreasure map or a curse the game narrates. Empty when the engine resolved the effect itself.\nShow these lines to the table and adjudicate them yourself."
}
},
"required": [
"code",
"character_id",
"instance_id"
],
"title": "ItemUsedEvent",
"type": "object"
}