mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05: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
|
||||
@className: 'Level'
|
||||
@schema: require 'schemas/models/level'
|
||||
@levels:
|
||||
'dungeons-of-kithgard': '5411cb3769152f1707be029c'
|
||||
'defense-of-plainswood': '541b67f71ccc8eaae19f3c62'
|
||||
urlRoot: '/db/level'
|
||||
|
||||
serialize: (supermodel, session, otherSession, cached=false) ->
|
||||
|
|
|
@ -3,6 +3,7 @@ cache = {}
|
|||
CocoModel = require './CocoModel'
|
||||
util = require 'core/utils'
|
||||
ThangType = require './ThangType'
|
||||
Level = require './Level'
|
||||
|
||||
module.exports = class User extends CocoModel
|
||||
@className: 'User'
|
||||
|
@ -90,7 +91,7 @@ module.exports = class User extends CocoModel
|
|||
#heroes = _.values ThangType.heroes if me.isAdmin()
|
||||
heroes
|
||||
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()
|
||||
ownsItem: (itemOriginal) -> itemOriginal in @items()
|
||||
ownsLevel: (levelOriginal) -> levelOriginal in @levels()
|
||||
|
|
|
@ -10,6 +10,7 @@ MusicPlayer = require 'lib/surface/MusicPlayer'
|
|||
storage = require 'core/storage'
|
||||
AuthModal = require 'views/core/AuthModal'
|
||||
SubscribeModal = require 'views/play/modal/SubscribeModal'
|
||||
Level = require 'models/Level'
|
||||
|
||||
trackedHourOfCode = false
|
||||
|
||||
|
@ -126,10 +127,10 @@ module.exports = class WorldMapView extends RootView
|
|||
getRenderData: (context={}) ->
|
||||
context = super(context)
|
||||
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.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
|
||||
level.locked = false if window.levelUnlocksNotWorking # Temporary; also possible in HeroVictoryModal
|
||||
level.locked = false if @levelStatusMap[level.id] in ['started', 'complete']
|
||||
|
@ -139,16 +140,16 @@ module.exports = class WorldMapView extends RootView
|
|||
if level.requiresSubscription
|
||||
level.color = 'rgb(80, 130, 200)'
|
||||
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.levelStatusMap = @levelStatusMap
|
||||
context.levelPlayCountMap = @levelPlayCountMap
|
||||
context.isIPadApp = application.isIPadApp
|
||||
context.mapType = _.string.slugify @terrain
|
||||
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
|
||||
|
||||
|
@ -350,7 +351,7 @@ dungeon = [
|
|||
name: 'Dungeons of Kithgard'
|
||||
type: 'hero'
|
||||
id: 'dungeons-of-kithgard'
|
||||
original: '528110f30268d018e3000001'
|
||||
original: '5411cb3769152f1707be029c'
|
||||
description: 'Grab the gem, but touch nothing else. Start here.'
|
||||
x: 14
|
||||
y: 15.5
|
||||
|
|
Loading…
Reference in a new issue