2014-04-12 10:51:02 -07:00
c = require ' ./../schemas '
2014-04-12 14:05:56 +05:30
LevelSessionPlayerSchema = c . object
id: c . objectId
links: [
{
rel: ' extra '
2014-07-01 10:16:26 +08:00
href: ' /db/user/{($)} '
2014-04-12 14:05:56 +05:30
}
]
time:
type: ' Number '
changes:
type: ' Number '
2014-07-17 16:30:56 -07:00
LevelSessionLevelSchema = c . object { required: [ ' original ' , ' majorVersion ' ] , links: [ { rel: ' db ' , href: ' /db/level/{(original)}/version/{(majorVersion)} ' } ] } ,
2014-04-12 14:05:56 +05:30
original: c . objectId ( { } )
majorVersion:
type: ' integer '
minimum: 0
LevelSessionSchema = c . object
2014-07-01 10:16:26 +08:00
title: ' Session '
description: ' A single session for a given level. '
2014-08-23 16:06:41 -07:00
default:
codeLanguage: ' javascript '
submittedCodeLanguage: ' javascript '
playtime: 0
2014-04-12 14:05:56 +05:30
_ . extend LevelSessionSchema . properties ,
# denormalization
creatorName:
type: ' string '
levelName:
type: ' string '
levelID:
type: ' string '
multiplayer:
type: ' boolean '
creator: c . objectId
links:
[
{
rel: ' extra '
2014-07-01 10:16:26 +08:00
href: ' /db/user/{($)} '
2014-04-12 14:05:56 +05:30
}
]
created: c . date
title: ' Created '
readOnly: true
changed: c . date
title: ' Changed '
readOnly: true
team: c . shortString ( )
level: LevelSessionLevelSchema
screenshot:
type: ' string '
2014-08-14 15:09:10 -07:00
heroConfig: c . object { description: ' Which hero the player is using, equipped with what inventory. ' } ,
inventory:
type: ' object '
description: ' The inventory of the hero: slots to item ThangTypes. '
additionalProperties: c . objectId ( description: ' An item ThangType. ' )
thangType: c . objectId ( links: [ { rel: ' db ' , href: ' /db/thang.type/{($)}/version ' } ] , title: ' Thang Type ' , description: ' The ThangType of the hero. ' , format: ' thang-type ' )
2014-04-12 14:05:56 +05:30
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:
type: ' object '
additionalProperties:
title: ' Thang '
type: ' object '
properties:
methods:
type: ' object '
additionalProperties:
title: ' Thang Method '
type: ' object '
properties:
metrics:
type: ' object '
source:
type: ' string '
2014-08-08 13:08:13 +02:00
goalStates:
type: ' object '
description: ' Maps Goal ID on a goal state object '
additionalProperties:
title: ' Goal State '
type: ' object '
properties:
status: enum: [ ' failure ' , ' incomplete ' , ' success ' ]
2014-04-12 14:05:56 +05:30
code:
type: ' object '
2014-04-15 15:01:54 -07:00
additionalProperties:
type: ' object '
additionalProperties:
type: ' string '
format: ' javascript '
2014-07-01 10:16:26 +08:00
2014-05-14 16:41:01 -07:00
codeLanguage:
type: ' string '
2014-07-01 10:16:26 +08:00
2014-05-16 14:13:59 -07:00
playtime:
type: ' number '
title: ' Playtime '
description: ' The total playtime on this session '
2014-07-01 10:16:26 +08:00
2014-04-12 14:05:56 +05:30
teamSpells:
type: ' object '
additionalProperties:
type: ' array '
players:
type: ' object '
chat:
type: ' array '
meanStrength:
type: ' number '
standardDeviation:
2014-07-01 10:16:26 +08:00
type: ' number '
2014-04-12 14:05:56 +05:30
minimum: 0
totalScore:
type: ' number '
submitted:
type: ' boolean '
submitDate: c . date
title: ' Submitted '
submittedCode:
type: ' object '
2014-04-15 15:01:54 -07:00
additionalProperties:
type: ' object '
additionalProperties:
type: ' string '
2014-05-13 10:49:02 -07:00
submittedCodeLanguage:
type: ' string '
2014-07-01 10:16:26 +08:00
2014-05-13 10:49:02 -07:00
transpiledCode:
type: ' object '
additionalProperties:
type: ' object '
additionalProperties:
type: ' string '
2014-04-12 14:05:56 +05:30
isRanking:
type: ' boolean '
description: ' Whether this session is still in the first ranking chain after being submitted. '
unsubscribed:
type: ' boolean '
description: ' Whether the player has opted out of receiving email updates about ladder rankings for this session. '
numberOfWinsAndTies:
type: ' number '
numberOfLosses:
type: ' number '
scoreHistory:
type: ' array '
title: ' Score History '
description: ' A list of objects representing the score history of a session '
items:
title: ' Score History Point '
description: ' An array with the format [unix timestamp, totalScore] '
type: ' array '
items:
type: ' number '
matches:
type: ' array '
title: ' Matches '
description: ' All of the matches a submitted session has played in its current state. '
items:
type: ' object '
properties:
date: c . date
title: ' Date computed '
description: ' The date a match was computed. '
2014-05-16 14:13:59 -07:00
playtime:
title: ' Playtime so far '
description: ' The total seconds of playtime on this session when the match was computed. '
type: ' number '
2014-04-12 14:05:56 +05:30
metrics:
type: ' object '
title: ' Metrics '
description: ' Various information about the outcome of a match. '
properties:
rank:
title: ' Rank '
description: ' A 0-indexed ranking representing the player \' s standing in the outcome of a match '
type: ' number '
opponents:
type: ' array '
title: ' Opponents '
description: ' An array containing information about the opponents \' sessions in a given match. '
items:
type: ' object '
properties:
sessionID:
title: ' Opponent Session ID '
description: ' The session ID of an opponent. '
2014-07-01 10:16:26 +08:00
type: [ ' object ' , ' string ' , ' null ' ]
2014-04-12 14:05:56 +05:30
userID:
title: ' Opponent User ID '
description: ' The user ID of an opponent '
2014-07-01 10:16:26 +08:00
type: [ ' object ' , ' string ' , ' null ' ]
2014-05-16 14:13:59 -07:00
name:
title: ' Opponent name '
description: ' The name of the opponent '
2014-07-01 10:16:26 +08:00
type: [ ' string ' , ' null ' ]
2014-05-16 14:13:59 -07:00
totalScore:
title: ' Opponent total score '
description: ' The totalScore of a user when the match was computed '
2014-07-01 10:16:26 +08:00
type: [ ' number ' , ' string ' , ' null ' ]
2014-04-12 14:05:56 +05:30
metrics:
type: ' object '
properties:
rank:
title: ' Opponent Rank '
description: ' The opponent \' s ranking in a given match '
type: ' number '
2014-07-13 20:19:51 -07:00
codeLanguage:
type: ' string '
description: ' What submittedCodeLanguage the opponent used during the match '
2014-04-12 14:05:56 +05:30
c . extendBasicProperties LevelSessionSchema , ' level.session '
c . extendPermissionsProperties LevelSessionSchema , ' level.session '
module.exports = LevelSessionSchema