2014-12-11 14:26:28 -05:00
c = require ' ./../schemas '
CampaignSchema = c . object ( )
c . extendNamedProperties CampaignSchema # name first
2014-12-16 20:46:24 -05:00
_ . extend CampaignSchema . properties , {
2015-01-29 12:07:25 -05:00
i18n: { type: ' object ' , title: ' i18n ' , format: ' i18n ' , props: [ ' name ' , ' fullName ' ] }
fullName: { type: ' string ' , title: ' Full Name ' , description: ' Ex.: " Kithgard Dungeon " ' }
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 ' }
type: { ' enum ' : [ ' campaign ' , ' ladder ' , ' ladder-tutorial ' , ' hero ' , ' hero-ladder ' , ' hero-coop ' ] }
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 ' }
2014-12-11 14:26:28 -05:00
disableSpaces: { type: ' boolean ' }
hidesSubmitUntilRun: { type: ' boolean ' }
hidesPlayButton: { type: ' boolean ' }
hidesRunShortcut: { type: ' boolean ' }
hidesHUD: { type: ' boolean ' }
hidesSay: { type: ' boolean ' }
hidesCodeToolbar: { type: ' boolean ' }
hidesRealTimePlayback: { type: ' boolean ' }
backspaceThrottle: { type: ' boolean ' }
lockDefaultCode: { type: ' boolean ' }
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.
2014-12-11 14:26:28 -05:00
2014-12-29 15:46:14 -05:00
tasks: c . array { title: ' Tasks ' , description: ' Tasks to be completed for this level. ' } , c . task
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