mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-24 19:59:53 -04:00
Ditched dependency on index 0 as first unlocked level, instead explicitly granting Dungeons of Kithgard.
This commit is contained in:
parent
774d366d96
commit
9f0ae9ff09
3 changed files with 13 additions and 8 deletions
|
@ -6,6 +6,9 @@ ThangType = require './ThangType'
|
||||||
module.exports = class Level extends CocoModel
|
module.exports = class Level extends CocoModel
|
||||||
@className: 'Level'
|
@className: 'Level'
|
||||||
@schema: require 'schemas/models/level'
|
@schema: require 'schemas/models/level'
|
||||||
|
@levels:
|
||||||
|
'dungeons-of-kithgard': '5411cb3769152f1707be029c'
|
||||||
|
'defense-of-plainswood': '541b67f71ccc8eaae19f3c62'
|
||||||
urlRoot: '/db/level'
|
urlRoot: '/db/level'
|
||||||
|
|
||||||
serialize: (supermodel, session, otherSession, cached=false) ->
|
serialize: (supermodel, session, otherSession, cached=false) ->
|
||||||
|
|
|
@ -3,6 +3,7 @@ cache = {}
|
||||||
CocoModel = require './CocoModel'
|
CocoModel = require './CocoModel'
|
||||||
util = require 'core/utils'
|
util = require 'core/utils'
|
||||||
ThangType = require './ThangType'
|
ThangType = require './ThangType'
|
||||||
|
Level = require './Level'
|
||||||
|
|
||||||
module.exports = class User extends CocoModel
|
module.exports = class User extends CocoModel
|
||||||
@className: 'User'
|
@className: 'User'
|
||||||
|
@ -90,7 +91,7 @@ module.exports = class User extends CocoModel
|
||||||
#heroes = _.values ThangType.heroes if me.isAdmin()
|
#heroes = _.values ThangType.heroes if me.isAdmin()
|
||||||
heroes
|
heroes
|
||||||
items: -> (me.get('earned')?.items ? []).concat(me.get('purchased')?.items ? []).concat([ThangType.items['simple-boots']])
|
items: -> (me.get('earned')?.items ? []).concat(me.get('purchased')?.items ? []).concat([ThangType.items['simple-boots']])
|
||||||
levels: -> (me.get('earned')?.levels ? []).concat(me.get('purchased')?.levels ? [])
|
levels: -> (me.get('earned')?.levels ? []).concat(me.get('purchased')?.levels ? []).concat(Level.levels['dungeons-of-kithgard'])
|
||||||
ownsHero: (heroOriginal) -> heroOriginal in @heroes()
|
ownsHero: (heroOriginal) -> heroOriginal in @heroes()
|
||||||
ownsItem: (itemOriginal) -> itemOriginal in @items()
|
ownsItem: (itemOriginal) -> itemOriginal in @items()
|
||||||
ownsLevel: (levelOriginal) -> levelOriginal in @levels()
|
ownsLevel: (levelOriginal) -> levelOriginal in @levels()
|
||||||
|
|
|
@ -10,6 +10,7 @@ MusicPlayer = require 'lib/surface/MusicPlayer'
|
||||||
storage = require 'core/storage'
|
storage = require 'core/storage'
|
||||||
AuthModal = require 'views/core/AuthModal'
|
AuthModal = require 'views/core/AuthModal'
|
||||||
SubscribeModal = require 'views/play/modal/SubscribeModal'
|
SubscribeModal = require 'views/play/modal/SubscribeModal'
|
||||||
|
Level = require 'models/Level'
|
||||||
|
|
||||||
trackedHourOfCode = false
|
trackedHourOfCode = false
|
||||||
|
|
||||||
|
@ -126,10 +127,10 @@ module.exports = class WorldMapView extends RootView
|
||||||
getRenderData: (context={}) ->
|
getRenderData: (context={}) ->
|
||||||
context = super(context)
|
context = super(context)
|
||||||
context.campaign = _.find campaigns, { id: @terrain }
|
context.campaign = _.find campaigns, { id: @terrain }
|
||||||
for level, index in context.campaign.levels
|
for level in context.campaign.levels
|
||||||
level.x ?= 10 + 80 * Math.random()
|
level.x ?= 10 + 80 * Math.random()
|
||||||
level.y ?= 10 + 80 * Math.random()
|
level.y ?= 10 + 80 * Math.random()
|
||||||
level.locked = index > 0 and not me.ownsLevel level.original
|
level.locked = not me.ownsLevel level.original
|
||||||
window.levelUnlocksNotWorking = true if level.locked and level.id is @nextLevel # Temporary
|
window.levelUnlocksNotWorking = true if level.locked and level.id is @nextLevel # Temporary
|
||||||
level.locked = false if window.levelUnlocksNotWorking # Temporary; also possible in HeroVictoryModal
|
level.locked = false if window.levelUnlocksNotWorking # Temporary; also possible in HeroVictoryModal
|
||||||
level.locked = false if @levelStatusMap[level.id] in ['started', 'complete']
|
level.locked = false if @levelStatusMap[level.id] in ['started', 'complete']
|
||||||
|
@ -139,16 +140,16 @@ module.exports = class WorldMapView extends RootView
|
||||||
if level.requiresSubscription
|
if level.requiresSubscription
|
||||||
level.color = 'rgb(80, 130, 200)'
|
level.color = 'rgb(80, 130, 200)'
|
||||||
level.hidden = level.locked or level.disabled
|
level.hidden = level.locked or level.disabled
|
||||||
|
|
||||||
# put lower levels in last, so in the world map they layer over one another properly.
|
# put lower levels in last, so in the world map they layer over one another properly.
|
||||||
context.campaign.levels = (_.sortBy context.campaign.levels, 'y').reverse()
|
context.campaign.levels = (_.sortBy context.campaign.levels, 'y').reverse()
|
||||||
|
|
||||||
context.levelStatusMap = @levelStatusMap
|
context.levelStatusMap = @levelStatusMap
|
||||||
context.levelPlayCountMap = @levelPlayCountMap
|
context.levelPlayCountMap = @levelPlayCountMap
|
||||||
context.isIPadApp = application.isIPadApp
|
context.isIPadApp = application.isIPadApp
|
||||||
context.mapType = _.string.slugify @terrain
|
context.mapType = _.string.slugify @terrain
|
||||||
context.nextLevel = @nextLevel
|
context.nextLevel = @nextLevel
|
||||||
context.forestIsAvailable = @startedForestLevel or '541b67f71ccc8eaae19f3c62' in (me.get('earned')?.levels or [])
|
context.forestIsAvailable = @startedForestLevel or (Level.levels['defense-of-plainswood'] in (me.get('earned')?.levels or []))
|
||||||
context.requiresSubscription = @requiresSubscription
|
context.requiresSubscription = @requiresSubscription
|
||||||
context
|
context
|
||||||
|
|
||||||
|
@ -350,7 +351,7 @@ dungeon = [
|
||||||
name: 'Dungeons of Kithgard'
|
name: 'Dungeons of Kithgard'
|
||||||
type: 'hero'
|
type: 'hero'
|
||||||
id: 'dungeons-of-kithgard'
|
id: 'dungeons-of-kithgard'
|
||||||
original: '528110f30268d018e3000001'
|
original: '5411cb3769152f1707be029c'
|
||||||
description: 'Grab the gem, but touch nothing else. Start here.'
|
description: 'Grab the gem, but touch nothing else. Start here.'
|
||||||
x: 14
|
x: 14
|
||||||
y: 15.5
|
y: 15.5
|
||||||
|
|
Loading…
Add table
Reference in a new issue