Skip to content

MemberAddedEvent

A new member joined the party during play.

Full documentation: MemberAddedEvent. Wire type: member_added.

Default visibility: player

Message codes: session.member.added

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": "A new member joined the party during play.\n\nEmitted by `AddMember`. The member is already in the\nparty, at the back of the marching order, so add them to the party on screen. Their full\nsheet is in the views, under `character_id`. The event doesn't say why they joined. The\ncommand does: read the `source` of the `AddMember`, either the one you executed or its\nentry in `GameSession.command_log`.",
  "properties": {
    "code": {
      "default": "session.member.added",
      "title": "Code",
      "type": "string",
      "description": "The message code, always `session.member.added`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player",
      "description": "Player visibility: the players see who joins them."
    },
    "event_type": {
      "const": "member_added",
      "default": "member_added",
      "title": "Event Type",
      "type": "string",
      "description": "The event type, `member_added`, which identifies this class in serialized form."
    },
    "character_id": {
      "title": "Character Id",
      "type": "string",
      "description": "The id the session gave the new member, like `\"character-0005\"`. Later commands and\nevents refer to the member by this id."
    },
    "name": {
      "title": "Name",
      "type": "string",
      "description": "The new member's name, so you can show the event without looking up the party."
    },
    "class_id": {
      "title": "Class Id",
      "type": "string",
      "description": "The new member's class id, like `\"fighter\"`."
    },
    "level": {
      "title": "Level",
      "type": "integer",
      "description": "The new member's experience level when they joined."
    }
  },
  "required": [
    "character_id",
    "name",
    "class_id",
    "level"
  ],
  "title": "MemberAddedEvent",
  "type": "object"
}