CharacterLeveledUpEvent
A character crossed a threshold and gained a level.
Full documentation: CharacterLeveledUpEvent. Wire type: leveled_up.
Default visibility: player
Message codes: session.level.gained
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 character crossed a threshold and gained a level.\n\nEmitted immediately after that member's own\n`XpAwardedEvent`, whichever award crossed\nthe threshold. A character gains at most one level per award.",
"properties": {
"code": {
"default": "session.level.gained",
"title": "Code",
"type": "string",
"description": "The message code, always `session.level.gained`."
},
"visibility": {
"$ref": "#/$defs/Visibility",
"default": "player",
"description": "Player visibility: the table has been waiting for this one."
},
"event_type": {
"const": "leveled_up",
"default": "leveled_up",
"title": "Event Type",
"type": "string",
"description": "The wire discriminator, `leveled_up`."
},
"character_id": {
"title": "Character Id",
"type": "string",
"description": "The member who levelled."
},
"level_before": {
"title": "Level Before",
"type": "integer",
"description": "The level held before the award."
},
"level_after": {
"title": "Level After",
"type": "integer",
"description": "The level held after it, one higher."
},
"hp_gained": {
"title": "Hp Gained",
"type": "integer",
"description": "How many hit points were added, the die and the constitution adjustment together, or the\nflat bonus past the class's last Hit Die."
},
"hp_roll": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Hp Roll",
"description": "The hit die that was rolled, or `None` past the class's last Hit Die, where levels bring a\nflat bonus and no die."
},
"con_applied": {
"title": "Con Applied",
"type": "boolean",
"description": "Whether the constitution adjustment was applied, which happens only when a die was rolled."
},
"title": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Title",
"description": "The class's title for the new level, or `None` past the printed list of titles."
}
},
"required": [
"character_id",
"level_before",
"level_after",
"hp_gained",
"hp_roll",
"con_applied",
"title"
],
"title": "CharacterLeveledUpEvent",
"type": "object"
}