GamesSkillLeveledPayload games.skill.leveled@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.skill.leveled.v1.json

games.skill.leveled v1 (OpenVibe.Games apps/server/src/platform/gameEvents.ts progressEvents, via GameEventRecorder.recordPlayersSaved from game/gameServer.ts flush and savePlayer). A persisted skill level went up: derived from what a save actually wrote, compared with the last committed save of that character (for a restored character first the database state at join, for a new one level 1), in the same transaction. One event per raised skill per save, so level can be more than previous_level + 1; never emitted for a decrease, and not re-emitted once the baseline advances on commit. Only for characters that joined while events were on. XP totals are left out. 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.
skillstringyesContent skill id (e.g. mining, woodcutting).
  • pattern ^[a-z0-9_]+$
levelintegeryesLevel now persisted; always greater than previous_level.
  • minimum 2
previous_levelintegeryesLevel at the previous baseline (1 when the skill had none).
  • minimum 1

Examples

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

Valid: first-save-guest
{
  "player": {
    "id": "01kz4a7r2p9b6g3e8v0z",
    "slot": 0,
    "name": "Guest 42",
    "account": "guest"
  },
  "world": "openvibeville_v2",
  "skill": "woodcutting",
  "level": 3,
  "previous_level": 1
}
Valid: one-level
{
  "player": {
    "id": "01kz3m8q4d7xw2ht5n9c",
    "slot": 1,
    "name": "Rustbucket",
    "account": "network",
    "subject": {
      "type": "user",
      "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
    }
  },
  "world": "openvibeville_v2",
  "skill": "mining",
  "level": 5,
  "previous_level": 4
}
Rejected: bad-skill-id
{
  "player": {
    "id": "01kz3m8q4d7xw2ht5n9c",
    "slot": 1,
    "name": "Rustbucket",
    "account": "network",
    "subject": {
      "type": "user",
      "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
    }
  },
  "world": "openvibeville_v2",
  "skill": "Mining Skill",
  "level": 2,
  "previous_level": 1
}
Rejected: level-one
{
  "player": {
    "id": "01kz3m8q4d7xw2ht5n9c",
    "slot": 1,
    "name": "Rustbucket",
    "account": "network",
    "subject": {
      "type": "user",
      "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
    }
  },
  "world": "openvibeville_v2",
  "skill": "mining",
  "level": 1,
  "previous_level": 1
}
Rejected: missing-previous-level
{
  "player": {
    "id": "01kz3m8q4d7xw2ht5n9c",
    "slot": 1,
    "name": "Rustbucket",
    "account": "network",
    "subject": {
      "type": "user",
      "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
    }
  },
  "world": "openvibeville_v2",
  "skill": "mining",
  "level": 5
}

Validate

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