GamesBlueprintUnlockedPayload games.blueprint.unlocked@1

Generated at from openvibe-contracts v0.34.2 and openvibe-sdk v0.5.0.

Version
1.0.0
Owner
games
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/events/payloads/games.blueprint.unlocked.v1.json

games.blueprint.unlocked v1 (OpenVibe.Games apps/server/src/platform/gameEvents.ts progressEvents, via GameEventRecorder.recordPlayersSaved from game/gameServer.ts flush and savePlayer). A blueprint recipe unlock (learned by consuming a blueprint item) was persisted: derived from the saved unlock set compared with the last committed save of that character, in the same transaction, one event per new recipe. Only for characters that joined while events were on. Envelope: subject { type: player, id: <player.id> }, visibility subject when the player has a Network subject and internal otherwise, priority low, actor user:<usr_...> or guest:<gst_...> from player.subject, else service:games. No consumer yet.

Fields

FieldTypeRequiredDescriptionConstraints
playerone ofyesThe character. account network: a signed-in openvibe.network account, keyed by its canonical subject (user usr_..., or guest gst_... for a Network guest session). account guest: a local guest (browser token), or a Network sign-in whose token predates subject ids; no subject then.
worldstringyesWorld id (the loaded content world, e.g. openvibeville_v2). Also the envelope subject id of games.world.saved.
recipestringyesContent recipe id of the blueprint recipe (e.g. craft_scrap_pistol).
  • pattern ^[a-z0-9_]+$

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: guest
{
  "player": {
    "id": "01kz4a7r2p9b6g3e8v0z",
    "slot": 0,
    "name": "Guest 42",
    "account": "guest"
  },
  "world": "openvibeville_v2",
  "recipe": "craft_still"
}
Valid: network
{
  "player": {
    "id": "01kz3m8q4d7xw2ht5n9c",
    "slot": 1,
    "name": "Rustbucket",
    "account": "network",
    "subject": {
      "type": "user",
      "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
    }
  },
  "world": "openvibeville_v2",
  "recipe": "craft_scrap_pistol"
}
Rejected: bad-subject-type
{
  "player": {
    "id": "01kz3m8q4d7xw2ht5n9c",
    "slot": 1,
    "name": "Rustbucket",
    "account": "network",
    "subject": {
      "type": "service",
      "id": "games"
    }
  },
  "world": "openvibeville_v2",
  "recipe": "craft_still"
}
Rejected: extra-property
{
  "player": {
    "id": "01kz3m8q4d7xw2ht5n9c",
    "slot": 1,
    "name": "Rustbucket",
    "account": "network",
    "subject": {
      "type": "user",
      "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
    }
  },
  "world": "openvibeville_v2",
  "recipe": "craft_still",
  "item": "blueprint_still"
}
Rejected: missing-recipe
{
  "player": {
    "id": "01kz3m8q4d7xw2ht5n9c",
    "slot": 1,
    "name": "Rustbucket",
    "account": "network",
    "subject": {
      "type": "user",
      "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
    }
  },
  "world": "openvibeville_v2"
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('games.blueprint.unlocked@1', value);   // { valid, errors: [{ path, message }] }