2014-01-22 17:57:41 -05:00
|
|
|
c = require '../../commons/schemas'
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-02-14 17:55:30 -05:00
|
|
|
LevelSessionPlayerSchema = c.object
|
|
|
|
id: c.objectId
|
|
|
|
links: [
|
|
|
|
{
|
|
|
|
rel: 'extra'
|
|
|
|
href: "/db/user/{($)}"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
time:
|
|
|
|
type: 'Number'
|
|
|
|
changes:
|
|
|
|
type: 'Number'
|
|
|
|
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-02-14 17:55:30 -05:00
|
|
|
LevelSessionLevelSchema = c.object {required: ['original', 'majorVersion']},
|
2014-01-03 13:32:13 -05:00
|
|
|
original: c.objectId({})
|
2014-02-14 17:55:30 -05:00
|
|
|
majorVersion:
|
|
|
|
type: 'integer'
|
|
|
|
minimum: 0
|
|
|
|
default: 0
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-02-14 17:55:30 -05:00
|
|
|
|
|
|
|
LevelSessionSchema = c.object
|
2014-01-03 13:32:13 -05:00
|
|
|
title: "Session"
|
|
|
|
description: "A single session for a given level."
|
2014-02-14 17:55:30 -05:00
|
|
|
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
_.extend LevelSessionSchema.properties,
|
|
|
|
# denormalization
|
2014-02-14 17:55:30 -05:00
|
|
|
creatorName:
|
|
|
|
type: 'string'
|
|
|
|
levelName:
|
|
|
|
type: 'string'
|
|
|
|
levelID:
|
|
|
|
type: 'string'
|
|
|
|
multiplayer:
|
|
|
|
type: 'boolean'
|
|
|
|
creator: c.objectId
|
|
|
|
links:
|
|
|
|
[
|
|
|
|
{
|
|
|
|
rel: 'extra'
|
|
|
|
href: "/db/user/{($)}"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
created: c.date
|
|
|
|
title: 'Created'
|
|
|
|
readOnly: true
|
|
|
|
|
|
|
|
changed: c.date
|
|
|
|
title: 'Changed'
|
|
|
|
readOnly: true
|
|
|
|
|
2014-02-07 14:49:37 -05:00
|
|
|
team: c.shortString()
|
2014-01-03 13:32:13 -05:00
|
|
|
level: LevelSessionLevelSchema
|
2014-02-14 17:55:30 -05:00
|
|
|
|
|
|
|
screenshot:
|
|
|
|
type: 'string'
|
|
|
|
|
|
|
|
state: c.object {},
|
|
|
|
complete:
|
|
|
|
type: 'boolean'
|
|
|
|
scripts: c.object {},
|
|
|
|
ended:
|
|
|
|
type: 'object'
|
|
|
|
additionalProperties:
|
|
|
|
type: 'number'
|
|
|
|
currentScript:
|
|
|
|
type: [
|
|
|
|
'null'
|
|
|
|
'string'
|
|
|
|
]
|
|
|
|
currentScriptOffset:
|
|
|
|
type: 'number'
|
|
|
|
|
|
|
|
selected:
|
|
|
|
type: [
|
|
|
|
'null'
|
|
|
|
'string'
|
|
|
|
]
|
|
|
|
playing:
|
|
|
|
type: 'boolean'
|
|
|
|
frame:
|
|
|
|
type: 'number'
|
|
|
|
thangs:
|
2014-01-03 13:32:13 -05:00
|
|
|
type: 'object'
|
2014-02-14 17:55:30 -05:00
|
|
|
additionalProperties:
|
|
|
|
title: 'Thang'
|
|
|
|
type: 'object'
|
|
|
|
properties:
|
|
|
|
methods:
|
|
|
|
type: 'object'
|
|
|
|
additionalProperties:
|
|
|
|
title: 'Thang Method'
|
|
|
|
type: 'object'
|
|
|
|
properties:
|
|
|
|
metrics:
|
|
|
|
type: 'object'
|
|
|
|
source:
|
|
|
|
type: 'string'
|
2014-02-17 11:51:07 -05:00
|
|
|
|
|
|
|
# TODO: specify this more
|
2014-02-14 17:55:30 -05:00
|
|
|
code:
|
|
|
|
type: 'object'
|
|
|
|
|
2014-02-10 16:18:39 -05:00
|
|
|
teamSpells:
|
|
|
|
type: 'object'
|
|
|
|
additionalProperties:
|
|
|
|
type: 'array'
|
|
|
|
|
2014-02-14 17:55:30 -05:00
|
|
|
players:
|
|
|
|
type: 'object'
|
|
|
|
|
|
|
|
chat:
|
|
|
|
type: 'array'
|
|
|
|
|
|
|
|
meanStrength:
|
|
|
|
type: 'number'
|
|
|
|
|
|
|
|
standardDeviation:
|
|
|
|
type:'number'
|
|
|
|
minimum: 0
|
2014-02-10 16:18:39 -05:00
|
|
|
|
2014-02-14 17:55:30 -05:00
|
|
|
totalScore:
|
|
|
|
type: 'number'
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-02-14 17:55:30 -05:00
|
|
|
submitted:
|
|
|
|
type: 'boolean'
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-02-19 11:18:40 -05:00
|
|
|
submitDate: c.date
|
|
|
|
title: 'Submitted'
|
2014-02-17 12:23:49 -05:00
|
|
|
|
|
|
|
submittedCode:
|
|
|
|
type: 'object'
|
2014-03-10 16:20:00 -04:00
|
|
|
|
2014-03-11 19:31:39 -04:00
|
|
|
isRanking:
|
|
|
|
type: 'boolean'
|
|
|
|
description: 'Whether this session is still in the first ranking chain after being submitted.'
|
|
|
|
|
2014-03-10 16:20:00 -04:00
|
|
|
unsubscribed:
|
|
|
|
type: 'boolean'
|
|
|
|
description: 'Whether the player has opted out of receiving email updates about ladder rankings for this session.'
|
|
|
|
|
2014-02-26 20:30:56 -05:00
|
|
|
numberOfWinsAndTies:
|
|
|
|
type: 'number'
|
2014-03-11 19:31:39 -04:00
|
|
|
|
2014-02-26 20:30:56 -05:00
|
|
|
numberOfLosses:
|
|
|
|
type: 'number'
|
2014-03-10 16:20:00 -04:00
|
|
|
|
2014-03-10 11:14:28 -04:00
|
|
|
scoreHistory:
|
|
|
|
type: 'array'
|
|
|
|
title: 'Score History'
|
|
|
|
description: 'A list of objects representing the score history of a session'
|
2014-03-10 16:20:00 -04:00
|
|
|
items:
|
2014-03-10 11:14:28 -04:00
|
|
|
title: 'Score History Point'
|
|
|
|
description: 'An array with the format [unix timestamp, totalScore]'
|
|
|
|
type: 'array'
|
|
|
|
items:
|
|
|
|
type: 'number'
|
2014-03-10 16:20:00 -04:00
|
|
|
|
2014-02-17 11:51:07 -05:00
|
|
|
matches:
|
|
|
|
type: 'array'
|
2014-02-17 15:28:13 -05:00
|
|
|
title: 'Matches'
|
|
|
|
description: 'All of the matches a submitted session has played in its current state.'
|
2014-02-17 11:51:07 -05:00
|
|
|
items:
|
|
|
|
type: 'object'
|
|
|
|
properties:
|
|
|
|
date: c.date
|
2014-02-17 15:28:13 -05:00
|
|
|
title: 'Date computed'
|
|
|
|
description: 'The date a match was computed.'
|
2014-02-17 11:51:07 -05:00
|
|
|
metrics:
|
|
|
|
type: 'object'
|
2014-02-17 15:28:13 -05:00
|
|
|
title: 'Metrics'
|
|
|
|
description: 'Various information about the outcome of a match.'
|
2014-02-17 11:51:07 -05:00
|
|
|
properties:
|
|
|
|
rank:
|
2014-02-17 15:28:13 -05:00
|
|
|
title: 'Rank'
|
|
|
|
description: 'A 0-indexed ranking representing the player\'s standing in the outcome of a match'
|
2014-02-17 11:51:07 -05:00
|
|
|
type: 'number'
|
|
|
|
opponents:
|
|
|
|
type: 'array'
|
2014-02-17 15:28:13 -05:00
|
|
|
title: 'Opponents'
|
|
|
|
description: 'An array containing information about the opponents\' sessions in a given match.'
|
2014-02-17 11:51:07 -05:00
|
|
|
items:
|
|
|
|
type: 'object'
|
|
|
|
properties:
|
2014-02-17 15:43:54 -05:00
|
|
|
sessionID:
|
2014-02-17 15:28:13 -05:00
|
|
|
title: 'Opponent Session ID'
|
|
|
|
description: 'The session ID of an opponent.'
|
2014-02-17 11:51:07 -05:00
|
|
|
type: ['object', 'string']
|
2014-02-17 15:43:54 -05:00
|
|
|
userID:
|
|
|
|
title: 'Opponent User ID'
|
|
|
|
description: 'The user ID of an opponent'
|
|
|
|
type: ['object','string']
|
2014-02-17 11:51:07 -05:00
|
|
|
metrics:
|
|
|
|
type: 'object'
|
|
|
|
properties:
|
|
|
|
rank:
|
2014-02-17 15:28:13 -05:00
|
|
|
title: 'Opponent Rank'
|
|
|
|
description: 'The opponent\'s ranking in a given match'
|
2014-02-17 11:51:07 -05:00
|
|
|
type: 'number'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-03 13:32:13 -05:00
|
|
|
c.extendBasicProperties LevelSessionSchema, 'level.session'
|
|
|
|
c.extendPermissionsProperties LevelSessionSchema, 'level.session'
|
|
|
|
|
|
|
|
module.exports = LevelSessionSchema
|