Skip to content

XpAwardedEvent

One character was awarded experience.

Full documentation: XpAwardedEvent. Wire type: xp_awarded.

Default visibility: player

Message codes: session.xp.awarded

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": "One character was awarded experience.\n\nEmitted wherever an award is made: after the\n`AdventureXpAwardEvent` on\n`TravelToTown`, and by the referee's\n`AwardXP`. When the ruleset is set to award experience\nimmediately, it's also emitted at the end of an encounter in which monsters were\ndefeated, and by a `TakeTreasure` that takes\ncoins, gems, or jewellery. When the award crosses a threshold, a\n`CharacterLeveledUpEvent` for the same\nmember follows it at once.",
  "properties": {
    "code": {
      "default": "session.xp.awarded",
      "title": "Code",
      "type": "string",
      "description": "The message code, always `session.xp.awarded`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player",
      "description": "Player visibility: it goes on the character's sheet."
    },
    "event_type": {
      "const": "xp_awarded",
      "default": "xp_awarded",
      "title": "Event Type",
      "type": "string",
      "description": "The event type, `xp_awarded`, which identifies this class in serialized form."
    },
    "character_id": {
      "title": "Character Id",
      "type": "string",
      "description": "The member who received it."
    },
    "award": {
      "title": "Award",
      "type": "integer",
      "description": "The award as the session handed it over, before the character's adjustment."
    },
    "modified_award": {
      "title": "Modified Award",
      "type": "integer",
      "description": "The award after the class's prime-requisite adjustment, rounded down. The character gains\nthis much, except when it would raise them two levels: one award raises a character at most one\nlevel, so their total stops one point short of the level after next and the rest is lost."
    },
    "level_after": {
      "title": "Level After",
      "type": "integer",
      "description": "The member's level once the award was applied."
    }
  },
  "required": [
    "character_id",
    "award",
    "modified_award",
    "level_after"
  ],
  "title": "XpAwardedEvent",
  "type": "object"
}