2014-12-11 14:26:28 -05:00
c = require ' ./../schemas '
2015-11-12 13:25:05 -05:00
CampaignSchema = c . object
default:
type: ' hero '
2014-12-11 14:26:28 -05:00
c . extendNamedProperties CampaignSchema # name first
2014-12-16 20:46:24 -05:00
_ . extend CampaignSchema . properties , {
2015-03-18 19:20:30 -04:00
i18n: { type: ' object ' , title: ' i18n ' , format: ' i18n ' , props: [ ' name ' , ' fullName ' , ' description ' ] }
2015-01-29 12:07:25 -05:00
fullName: { type: ' string ' , title: ' Full Name ' , description: ' Ex.: " Kithgard Dungeon " ' }
2015-03-18 19:20:30 -04:00
description: { type: ' string ' , format: ' string ' , description: ' How long it takes and what players learn. ' }
2015-11-12 13:25:05 -05:00
type: c . shortString ( title: ' Type ' , description: ' What kind of campaign this is. ' , ' enum ' : [ ' hero ' , ' course ' ] )
2014-12-28 16:25:20 -05:00
2014-12-11 14:26:28 -05:00
ambientSound: c . object { } ,
mp3: { type: ' string ' , format: ' sound-file ' }
ogg: { type: ' string ' , format: ' sound-file ' }
2014-12-28 16:25:20 -05:00
2014-12-11 14:26:28 -05:00
backgroundImage: c . array { } , {
2014-12-16 20:46:24 -05:00
type: ' object '
additionalProperties: false
properties: {
image: { type: ' string ' , format: ' image-file ' }
width: { type: ' number ' }
}
2014-12-11 14:26:28 -05:00
}
backgroundColor: { type: ' string ' }
backgroundColorTransparent: { type: ' string ' }
2014-12-28 16:25:20 -05:00
2014-12-19 16:46:01 -05:00
adjacentCampaigns: { type: ' object ' , format: ' campaigns ' , additionalProperties: {
2014-12-11 14:26:28 -05:00
title: ' Campaign '
type: ' object '
2014-12-19 16:46:01 -05:00
format: ' campaign '
2014-12-11 14:26:28 -05:00
properties: {
#- denormalized from other Campaigns, either updated automatically or fetched dynamically
2014-12-22 10:29:29 -05:00
id: { type: ' string ' , format: ' hidden ' }
2014-12-19 16:46:01 -05:00
name: { type: ' string ' , format: ' hidden ' }
description: { type: ' string ' , format: ' hidden ' }
i18n: { type: ' object ' , format: ' hidden ' }
slug: { type: ' string ' , format: ' hidden ' }
2014-12-28 16:25:20 -05:00
2014-12-11 14:26:28 -05:00
#- normal properties
position: c . point2d ( )
rotation: { type: ' number ' , format: ' degrees ' }
color: { type: ' string ' }
2014-12-19 16:46:01 -05:00
showIfUnlocked: { type: ' string ' , links: [ { rel: ' db ' , href: ' /db/level/{($)}/version ' } ] , format: ' latest-version-original-reference ' }
2014-12-11 14:26:28 -05:00
}
} }
2014-12-28 16:25:20 -05:00
2014-12-16 20:46:24 -05:00
levels: { type: ' object ' , format: ' levels ' , additionalProperties: {
2014-12-11 14:26:28 -05:00
title: ' Level '
type: ' object '
2014-12-16 20:46:24 -05:00
format: ' level '
additionalProperties: false
2014-12-28 16:25:20 -05:00
2014-12-16 20:46:24 -05:00
# key is the original property
2014-12-11 14:26:28 -05:00
properties: {
#- denormalized from Level
2014-12-16 20:46:24 -05:00
name: { type: ' string ' , format: ' hidden ' }
description: { type: ' string ' , format: ' hidden ' }
2015-01-22 14:22:35 -05:00
i18n: { type: ' object ' , format: ' hidden ' }
2014-12-11 14:26:28 -05:00
requiresSubscription: { type: ' boolean ' }
2015-04-13 20:07:13 -04:00
replayable: { type: ' boolean ' }
2015-07-24 20:37:42 -04:00
type: { ' enum ' : [ ' ladder ' , ' ladder-tutorial ' , ' hero ' , ' hero-ladder ' , ' hero-coop ' , ' course ' , ' course-ladder ' ] }
2014-12-16 20:46:24 -05:00
slug: { type: ' string ' , format: ' hidden ' }
original: { type: ' string ' , format: ' hidden ' }
2014-12-11 14:26:28 -05:00
adventurer: { type: ' boolean ' }
practice: { type: ' boolean ' }
2014-12-28 16:25:20 -05:00
adminOnly: { type: ' boolean ' }
2015-02-27 12:16:16 -05:00
disableSpaces: { type: [ ' boolean ' , ' number ' ] }
2014-12-11 14:26:28 -05:00
hidesSubmitUntilRun: { type: ' boolean ' }
hidesPlayButton: { type: ' boolean ' }
hidesRunShortcut: { type: ' boolean ' }
hidesHUD: { type: ' boolean ' }
hidesSay: { type: ' boolean ' }
hidesCodeToolbar: { type: ' boolean ' }
hidesRealTimePlayback: { type: ' boolean ' }
backspaceThrottle: { type: ' boolean ' }
2015-02-27 12:16:16 -05:00
lockDefaultCode: { type: [ ' boolean ' , ' number ' ] }
2014-12-11 14:26:28 -05:00
moveRightLoopSnippet: { type: ' boolean ' }
realTimeSpeedFactor: { type: ' number ' }
autocompleteFontSizePx: { type: ' number ' }
2014-12-28 16:25:20 -05:00
requiredCode: c . array { } , {
type: ' string '
2014-12-11 14:26:28 -05:00
}
suspectCode: c . array { } , {
type: ' object '
properties: {
name: { type: ' string ' }
pattern: { type: ' string ' }
}
}
2014-12-28 16:25:20 -05:00
2014-12-11 14:26:28 -05:00
requiredGear: { type: ' object ' , additionalProperties: {
2014-12-18 01:53:04 -05:00
type: ' array '
items: { type: ' string ' , links: [ { rel: ' db ' , href: ' /db/thang.type/{($)}/version ' } ] , format: ' latest-version-original-reference ' }
2014-12-11 14:26:28 -05:00
} }
restrictedGear: { type: ' object ' , additionalProperties: {
2014-12-28 16:25:20 -05:00
type: ' array '
2014-12-18 01:53:04 -05:00
items: { type: ' string ' , links: [ { rel: ' db ' , href: ' /db/thang.type/{($)}/version ' } ] , format: ' latest-version-original-reference ' }
2014-12-11 14:26:28 -05:00
} }
2014-12-28 16:25:20 -05:00
allowedHeroes: { type: ' array ' , items: {
type: ' string ' , links: [ { rel: ' db ' , href: ' /db/thang.type/{($)}/version ' } ] , format: ' latest-version-original-reference '
2014-12-11 14:26:28 -05:00
} }
2014-12-16 20:46:24 -05:00
#- denormalized from Achievements
2014-12-18 01:53:04 -05:00
rewards: { type: ' array ' , items: {
2014-12-16 20:46:24 -05:00
type: ' object '
2014-12-18 01:53:04 -05:00
additionalProperties: false
2014-12-16 20:46:24 -05:00
properties:
2014-12-18 01:53:04 -05:00
achievement: { type: ' string ' , links: [ { rel: ' db ' , href: ' /db/achievement/{{$}} ' } ] , format: ' achievement ' }
item: { type: ' string ' , links: [ { rel: ' db ' , href: ' /db/thang.type/{($)}/version ' } ] , format: ' latest-version-original-reference ' }
hero: { type: ' string ' , links: [ { rel: ' db ' , href: ' /db/thang.type/{($)}/version ' } ] , format: ' latest-version-original-reference ' }
level: { type: ' string ' , links: [ { rel: ' db ' , href: ' /db/level/{($)}/version ' } ] , format: ' latest-version-original-reference ' }
type: { enum: [ ' heroes ' , ' items ' , ' levels ' ] }
2014-12-16 20:46:24 -05:00
} }
2014-12-29 15:46:14 -05:00
2014-12-28 16:25:20 -05:00
campaign: c . shortString title: ' Campaign ' , description: ' Which campaign this level is part of (like " desert " ). ' , format: ' hidden ' # Automatically set by campaign editor.
2015-11-24 11:56:28 -05:00
campaignIndex: c . int title: ' Campaign Index ' , description: ' The 0-based index of this level in its campaign. ' , format: ' hidden ' # Automatically set by campaign editor.
2014-12-11 14:26:28 -05:00
2016-01-22 14:27:38 -05:00
scoreTypes: c . array { title: ' Score Types ' , description: ' What metric to show leaderboards for. ' , uniqueItems: true } ,
c . shortString ( title: ' Score Type ' , ' enum ' : [ ' time ' , ' damage-taken ' , ' damage-dealt ' , ' gold-collected ' , ' difficulty ' ] ) # TODO: good version of LoC; total gear value.
2014-12-29 15:46:14 -05:00
tasks: c . array { title: ' Tasks ' , description: ' Tasks to be completed for this level. ' } , c . task
2015-06-30 14:27:58 -04:00
concepts: c . array { title: ' Programming Concepts ' , description: ' Which programming concepts this level covers. ' } , c . concept
2016-02-10 17:16:54 -05:00
picoCTFProblem: { type: ' string ' , description: ' Associated picoCTF problem ID, if this is a picoCTF level ' }
2014-12-29 15:46:14 -05:00
2014-12-11 14:26:28 -05:00
#- normal properties
position: c . point2d ( )
}
2014-12-16 20:46:24 -05:00
} }
2014-12-11 14:26:28 -05:00
}
2014-12-16 20:46:24 -05:00
2014-12-11 14:26:28 -05:00
c . extendBasicProperties CampaignSchema , ' campaign '
c . extendTranslationCoverageProperties CampaignSchema
2015-02-05 15:01:19 -05:00
c . extendPatchableProperties CampaignSchema
2014-12-11 14:26:28 -05:00
module.exports = CampaignSchema