Fixed some bugs with LevelSetupManager and inventory. Moved hard-coding of level-specific options to a new LevelOptions config file. Fixed a couple minor bugs.

This commit is contained in:
Nick Winter 2014-11-10 12:47:24 -08:00
parent e253795665
commit d8dfc0a2b3
9 changed files with 87 additions and 137 deletions

View file

@ -8,16 +8,34 @@ module.exports = class LevelSetupManager extends CocoClass
constructor: (@options) ->
super()
@supermodel = new SuperModel()
@supermodel = @options.supermodel ? new SuperModel()
@session = @options.session
if @session
@fillSessionWithDefaults()
else
@loadSession(@supermodel)
@loadSession()
@loadModals()
loadSession: ->
url = "/db/level/#{@options.levelID}/session"
#url += "?team=#{@team}" if @options.team # TODO: figure out how to get the teams for multiplayer PVP hero style
@session = new LevelSession().setURL url
onSessionSync = ->
@session.url = -> '/db/level.session/' + @id
@fillSessionWithDefaults()
@listenToOnce @session, 'sync', onSessionSync
@session = @supermodel.loadModel(@session, 'level_session').model
if @session.loaded
onSessionSync.call @
fillSessionWithDefaults: ->
heroConfig = _.merge {}, me.get('heroConfig'), @session.get('heroConfig')
@session.set('heroConfig', heroConfig)
loadModals: ->
# build modals and prevent them from disappearing.
@heroesModal = new PlayHeroesModal({supermodel: @supermodel, session: @session, confirmButtonI18N: 'play.next', levelID: options.levelID, hadEverChosenHero: @options.hadEverChosenHero})
@inventoryModal = new InventoryModal({supermodel: @supermodel, session: @session, levelID: options.levelID})
@heroesModal = new PlayHeroesModal({supermodel: @supermodel, session: @session, confirmButtonI18N: 'play.next', levelID: @options.levelID, hadEverChosenHero: @options.hadEverChosenHero})
@inventoryModal = new InventoryModal({supermodel: @supermodel, session: @session, levelID: @options.levelID})
@heroesModalDestroy = @heroesModal.destroy
@inventoryModalDestroy = @inventoryModal.destroy
@heroesModal.destroy = @inventoryModal.destroy = _.noop
@ -26,19 +44,6 @@ module.exports = class LevelSetupManager extends CocoClass
@listenTo @inventoryModal, 'choose-hero-click', @onChooseHeroClicked
@listenTo @inventoryModal, 'play-click', @onInventoryModalPlayClicked
loadSession: (supermodel) ->
url = "/db/level/#{@options.levelID}/session"
#url += "?team=#{@team}" if @options.team # TODO: figure out how to get the teams for multiplayer PVP hero style
@session = new LevelSession().setURL url
@listenToOnce @session, 'sync', ->
@session.url = -> '/db/level.session/' + @id
@fillSessionWithDefaults()
supermodel.loadModel(@session, 'level_session').model
fillSessionWithDefaults: ->
heroConfig = _.merge {}, me.get('heroConfig'), @session.get('heroConfig')
@session.set('heroConfig', heroConfig)
open: ->
firstModal = if @options.hadEverChosenHero then @inventoryModal else @heroesModal
@options.parent.openModalView(firstModal)

View file

@ -5,6 +5,7 @@ ThangType = require 'models/ThangType'
CocoCollection = require 'collections/CocoCollection'
ItemView = require './ItemView'
SpriteBuilder = require 'lib/sprites/SpriteBuilder'
LevelOptions = require 'lib/LevelOptions'
hasGoneFullScreenOnce = false
@ -32,11 +33,9 @@ module.exports = class InventoryModal extends ModalView
initialize: (options) ->
super(arguments...)
@items = new CocoCollection([], {model: ThangType})
@equipment = options.equipment or @options.session?.get('heroConfig')?.inventory or me.get('heroConfig')?.inventory or {}
@equipment = $.extend true, {}, @equipment
@requireLevelEquipment()
@items.url = '/db/thang.type?view=items&project=name,slug,components,original,rasterIcon,gems,description,heroClass'
@supermodel.loadCollection(@items, 'items')
@equipment = {} # Assign for real when we have loaded the session
destroy: ->
@stage?.removeAllChildren()
@ -44,6 +43,9 @@ module.exports = class InventoryModal extends ModalView
onLoaded: ->
item.notInLevel = true for item in @items.models
@equipment = @options.equipment or @options.session?.get('heroConfig')?.inventory or me.get('heroConfig')?.inventory or {}
@equipment = $.extend true, {}, @equipment
@requireLevelEquipment()
super()
getRenderData: (context={}) ->
@ -54,12 +56,12 @@ module.exports = class InventoryModal extends ModalView
for item in @items.models
item.classes = item.getAllowedSlots()
item.classes.push 'equipped' if item.get('original') in context.equipped
locked = @allowedItems and not (item.get('original') in @allowedItems)
locked = not (item.get('original') in me.items())
item.classes.push 'locked' if locked and item.get('slug') isnt 'simple-boots'
for heroClass in item.getAllowedHeroClasses()
item.classes.push heroClass
item.classes.push 'silhouette' if item.isSilhouettedItem()
item.classes.push 'restricted' if item.get('slug') in _.values(restrictedGearByLevel[@options.levelID] ? {})
item.classes.push 'restricted' if item.get('slug') in _.values(LevelOptions[@options.levelID]?.restrictedGear ? {})
@items.models.sort (a, b) ->
lockScore = 90019001 * (('locked' in a.classes) - ('locked' in b.classes))
@ -114,7 +116,7 @@ module.exports = class InventoryModal extends ModalView
revertDuration: 200
distance: 10
scroll: false
zIndex: 100
zIndex: 10000
itemView.$el.on 'dragstart', =>
@onAvailableItemClick target: itemView.$el.parent() unless itemView.$el.parent().hasClass 'active'
@ -164,7 +166,7 @@ module.exports = class InventoryModal extends ModalView
revertDuration: 200
distance: 10
scroll: false
zIndex: 100
zIndex: 10000
clearSelection: ->
@$el.find('.item-slot.selected').removeClass 'selected'
@ -344,8 +346,8 @@ module.exports = class InventoryModal extends ModalView
requireLevelEquipment: ->
# This is temporary, until we have a more general way of awarding items and configuring required/restricted items per level.
return unless necessaryGear = requiredGearByLevel[@options.levelID]
restrictedGear = restrictedGearByLevel[@options.levelID] ? {}
requiredGear = LevelOptions[@options.levelID]?.requiredGear ? {}
restrictedGear = LevelOptions[@options.levelID]?.restrictedGear ? {}
if @inserted
if @supermodel.finished()
equipment = @getCurrentEquipmentConfig() # Make sure @equipment is updated
@ -360,10 +362,15 @@ module.exports = class InventoryModal extends ModalView
if equipped and equipped is gear[restrictedGear[slot]]
console.log 'Unequipping restricted item', restrictedGear[slot], 'for', slot, 'before level', @options.levelID
@unequipItemFromSlot @$el.find(".item-slot[data-slot='#{slot}']")
for slot, item of necessaryGear
continue if item is 'leather-tunic' and inWorldMap and @options.levelID is 'the-raised-sword' # Don't tell them they need it until they need it in the level
for slot, item of requiredGear
#continue if item is 'leather-tunic' and inWorldMap and @options.levelID is 'the-raised-sword' # Don't tell them they need it until they need it in the level # ... when we make it so that you can buy it
equipped = equipment[slot]
continue if equipped and not ((item is 'builders-hammer' and equipped is gear['simple-sword']) or (item is 'leather-boots' and equipped is gear['simple-boots']))
continue if equipped and not (
(item is 'builders-hammer' and equipped in [gear['simple-sword'], gear['long-sword']]) or
(item in ['simple-sword', 'long-sword'] and equipped is gear['builders-hammer']) or
(item is 'leather-boots' and equipped is gear['simple-boots']) or
(item is 'simple-boots' and equipped is gear['leather-boots'])
)
availableSlotSelector = "#available-equipment li[data-item-id='#{gear[item]}']"
@highlightElement availableSlotSelector, delay: 500, sides: ['right'], rotation: Math.PI / 2
@$el.find(availableSlotSelector).addClass 'should-equip'
@ -371,18 +378,9 @@ module.exports = class InventoryModal extends ModalView
@remainingRequiredEquipment.push slot: slot, item: gear[item]
if hadRequired and not @remainingRequiredEquipment.length
@endHighlight()
@highlightElement (if inWorldMap then '#play-level-button' else '.overlaid-close-button'), duration: 5000
@highlightElement '#play-level-button', duration: 5000
$('#play-level-button').prop('disabled', @remainingRequiredEquipment.length > 0)
# Restrict available items to those that would be available by this level.
@allowedItems = []
for level, items of requiredGearByLevel
for slot, item of items
@allowedItems.push gear[item] unless gear[item] in @allowedItems
break if level is @options.levelID
for item in me.items() when not (item in @allowedItems)
@allowedItems.push item
setHero: (@selectedHero) ->
@loadHero()
@$el.removeClass('Warrior Ranger Wizard').addClass(@selectedHero.get('heroClass'))
@ -487,71 +485,3 @@ gear =
'bronze-shield': '544c310ae0017993fce214bf'
'wooden-glasses': '53e2167653457600003e3eb3'
'basic-flags': '545bacb41e649a4495f887da'
requiredGearByLevel =
'dungeons-of-kithgard': {feet: 'simple-boots'}
'gems-in-the-deep': {feet: 'simple-boots'}
'shadow-guard': {feet: 'simple-boots'}
'kounter-kithwise': {feet: 'simple-boots'}
'crawlways-of-kithgard': {feet: 'simple-boots'}
'forgetful-gemsmith': {feet: 'simple-boots'}
'true-names': {feet: 'simple-boots', 'right-hand': 'simple-sword', waist: 'leather-belt'}
'favorable-odds': {feet: 'simple-boots', 'right-hand': 'simple-sword'}
'the-raised-sword': {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic'}
'the-first-kithmaze': {feet: 'simple-boots', 'programming-book': 'programmaticon-i'}
'haunted-kithmaze': {feet: 'simple-boots', 'programming-book': 'programmaticon-i'}
'descending-further': {feet: 'simple-boots', 'programming-book': 'programmaticon-i'}
'the-second-kithmaze': {feet: 'simple-boots', 'programming-book': 'programmaticon-i'}
'dread-door': {'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i'}
'known-enemy': {'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i', torso: 'leather-tunic'}
'master-of-names': {feet: 'simple-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses', torso: 'leather-tunic'}
'lowly-kithmen': {feet: 'simple-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses', torso: 'leather-tunic'}
'closing-the-distance': {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', eyes: 'crude-glasses'}
'tactical-strike': {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', eyes: 'crude-glasses'}
'the-final-kithmaze': {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
'the-gauntlet': {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
'kithgard-gates': {feet: 'simple-boots', 'right-hand': 'builders-hammer', torso: 'leather-tunic'}
'defense-of-plainswood': {feet: 'simple-boots', 'right-hand': 'builders-hammer'}
'winding-trail': {feet: 'leather-boots', 'right-hand': 'builders-hammer'}
'thornbush-farm': {feet: 'leather-boots', 'right-hand': 'builders-hammer', eyes: 'crude-glasses'}
'a-fiery-trap': {feet: 'leather-boots', torso: 'leather-tunic', waist: 'leather-belt', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses', 'right-hand': 'simple-sword', 'left-hand': 'wooden-shield'}
'ogre-encampment': {torso: 'leather-tunic', waist: 'leather-belt', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses', 'right-hand': 'simple-sword', 'left-hand': 'wooden-shield'}
'woodland-cleaver': {torso: 'leather-tunic', waist: 'leather-belt', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses', 'right-hand': 'long-sword', 'left-hand': 'wooden-shield', wrists: 'sundial-wristwatch', feet: 'leather-boots'}
'shield-rush': {torso: 'leather-tunic', waist: 'leather-belt', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses', 'right-hand': 'long-sword', 'left-hand': 'bronze-shield', wrists: 'sundial-wristwatch'}
'peasant-protection': {torso: 'leather-tunic', waist: 'leather-belt', 'programming-book': 'programmaticon-i', eyes: 'wooden-glasses', 'right-hand': 'long-sword', 'left-hand': 'bronze-shield', wrists: 'sundial-wristwatch'}
'munchkin-swarm': {torso: 'leather-tunic', waist: 'leather-belt', 'programming-book': 'programmaticon-i', eyes: 'wooden-glasses', 'right-hand': 'long-sword', 'left-hand': 'bronze-shield', wrists: 'sundial-wristwatch'}
'coinucopia': {'programming-book': 'programmaticon-i', feet: 'leather-boots', flag: 'basic-flags'}
'copper-meadows': {'programming-book': 'programmaticon-i', feet: 'leather-boots', flag: 'basic-flags', eyes: 'wooden-glasses'}
'drop-the-flag': {'programming-book': 'programmaticon-i', feet: 'leather-boots', flag: 'basic-flags', eyes: 'wooden-glasses', 'right-hand': 'builders-hammer'}
'rich-forager': {'programming-book': 'programmaticon-i', feet: 'leather-boots', flag: 'basic-flags', eyes: 'wooden-glasses', torso: 'leather-tunic', 'right-hand': 'longsword', 'left-hand': 'bronze-shield'}
'deadly-pursuit': {'programming-book': 'programmaticon-i', feet: 'leather-boots', flag: 'basic-flags', eyes: 'wooden-glasses', 'right-hand': 'builders-hammer'}
'multiplayer-treasure-grove': {'programming-book': 'programmaticon-i', feet: 'leather-boots', flag: 'basic-flags', eyes: 'wooden-glasses', torso: 'leather-tunic'}
restrictedGearByLevel =
'dungeons-of-kithgard': {feet: 'leather-boots'}
'gems-in-the-deep': {feet: 'leather-boots'}
'shadow-guard': {feet: 'leather-boots', 'right-hand': 'simple-sword'}
'kounter-kithwise': {feet: 'leather-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i'}
'crawlways-of-kithgard': {feet: 'leather-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i'}
'forgetful-gemsmith': {feet: 'leather-boots', 'programming-book': 'programmaticon-i'}
'true-names': {feet: 'leather-boots', 'programming-book': 'programmaticon-i'}
'favorable-odds': {feet: 'leather-boots', 'programming-book': 'programmaticon-i'}
'the-raised-sword': {feet: 'leather-boots', 'programming-book': 'programmaticon-i'}
'the-first-kithmaze': {feet: 'leather-boots'}
'haunted-kithmaze': {feet: 'leather-boots'}
'descending-further': {feet: 'leather-boots'}
'the-second-kithmaze': {feet: 'leather-boots'}
'the-final-kithmaze': {feet: 'leather-boots'}
'the-gauntlet': {feet: 'leather-boots'}
'kithgard-gates': {'right-hand': 'simple-sword'}
'defense-of-plainswood': {'right-hand': 'simple-sword'}
'winding-trail': {feet: 'simple-boots', 'right-hand': 'simple-sword'}
'thornbush-farm': {feet: 'simple-boots', 'right-hand': 'simple-sword'}
'a-fiery-trap': {feet: 'simple-boots', 'right-hand': 'builders-hammer'}
'ogre-encampment': {feet: 'simple-boots', 'right-hand': 'builders-hammer'}
'woodland-cleaver': {feet: 'simple-boots', 'right-hand': 'simple-sword'}
'shield-rush': {'left-hand': 'wooden-shield'}
'peasant-protection': {eyes: 'crude-glasses'}
'drop-the-flag': {'right-hand': 'longsword'}
'rich-forager': {'right-hand': 'builders-hammer'}
'deadly-pursuit': {'right-hand': 'longsword'}

View file

@ -55,10 +55,10 @@ module.exports = class ControlBarView extends CocoView
else if @level.get('type', true) in ['hero', 'hero-coop']
@homeLink = c.homeLink = '/play'
@homeViewClass = require 'views/play/WorldMapView'
# TODO: dynamically figure out which world map to return to
if @level.get('slug') in ['defense-of-plainswood', 'winding-trail', 'thornbush-farm', 'a-fiery-trap']
@homeLink += '/forest'
@homeViewArgs.push 'forest'
campaign = @getCampaignForSlug @level.get 'slug'
if campaign isnt 'dungeon'
@homeLink += '/' + campaign
@homeViewArgs.push campaign
else
@homeLink = c.homeLink = '/'
@homeViewClass = require 'views/HomeView'
@ -86,6 +86,11 @@ module.exports = class ControlBarView extends CocoView
@controlsEnabled = enabled
@$el.toggleClass 'controls-disabled', not enabled
getCampaignForSlug: (slug) ->
for campaign in require('views/play/WorldMapView').campaigns
for level in campaign.levels
return campaign.id if level.id is slug
destroy: ->
@setupManager?.destroy()
super()

View file

@ -1,6 +1,7 @@
CocoView = require 'views/kinds/CocoView'
template = require 'templates/play/level/hud'
prop_template = require 'templates/play/level/hud_prop'
LevelOptions = require 'lib/LevelOptions'
module.exports = class LevelHUDView extends CocoView
id: 'thang-hud'
@ -21,7 +22,7 @@ module.exports = class LevelHUDView extends CocoView
afterRender: ->
super()
@$el.addClass 'no-selection'
if @options.level.get('slug') in ['dungeons-of-kithgard', 'gems-in-the-deep', 'forgetful-gemsmith', 'shadow-guard', 'kounter-kithwise', 'crawlways-of-kithgard', 'true-names', 'favorable-odds', 'the-raised-sword', 'the-first-kithmaze', 'haunted-kithmaze', 'descending-further', 'the-second-kithmaze', 'dread-door', 'known-enemy', 'master-of-names', 'lowly-kithmen', 'closing-the-distance', 'tactical-strike', 'the-final-kithmaze', 'the-gauntlet']
if LevelOptions[@options.level.get('slug')]?.hidesHUD
@hidesHUD = true
@$el.addClass 'hide-hud-properties'

View file

@ -1,6 +1,7 @@
CocoView = require 'views/kinds/CocoView'
template = require 'templates/play/level/playback'
{me} = require 'lib/auth'
LevelOptions = require 'lib/LevelOptions'
module.exports = class LevelPlaybackView extends CocoView
id: 'playback-view'
@ -66,7 +67,7 @@ module.exports = class LevelPlaybackView extends CocoView
@goto = t 'play_level.time_goto'
@current = t 'play_level.time_current'
@total = t 'play_level.time_total'
@$el.find('#play-button').css('visibility', 'hidden') if @options.levelID in ['dungeons-of-kithgard', 'gems-in-the-deep', 'shadow-guard', 'true-names'] # Don't show for first few levels, confuses new players.
@$el.find('#play-button').css('visibility', 'hidden') if LevelOptions[@options.levelID]?.hidesPlayButton # Don't show for first few levels, confuses new players.
updatePopupContent: ->
@timePopup?.updateContent "<h2>#{@timeToString @newTime}</h2>#{@formatTime(@current, @currentTime)}<br/>#{@formatTime(@total, @totalTime)}"

View file

@ -259,30 +259,36 @@ module.exports = class HeroVictoryModal extends ModalView
else
AudioPlayer.playSound name, 1
# Branching group testing
getNextLevel: (type) ->
getLevelInfoForSlug: (slug) ->
for campaign in require('views/play/WorldMapView').campaigns
break if levelInfo
for level in campaign.levels
if level.id is @level.get 'slug'
levelInfo = level
break
levelInfo?.nextLevels?[type] # 'more_practice', 'skip_ahead', 'continue'
return level if level.id is slug
getNextLevelMap: ->
# TODO: dynamically figure out which world map to return to
if @level.get('slug') in ['kithgard-gates', 'defense-of-plainswood', 'winding-trail', 'thornbush-farm', 'a-fiery-trap', 'ogre-encampment', 'woodland-cleaver', 'shield-rush', 'peasant-protection', 'munchkin-swarm', 'coinucopia', 'copper-meadows', 'drop-the-flag', 'rich-forager', 'deadly-pursuit', 'multiplayer-treasure-grove']
return 'forest'
return 'dungeon'
getCampaignForSlug: (slug) ->
for campaign in require('views/play/WorldMapView').campaigns
for level in campaign.levels
return campaign.id if level.id is slug
getNextLevelCampaign: ->
# Wouldn't handle skipping/more practice across campaign boundaries, but we don't do that.
campaign = @getCampaignForSlug @level.get 'slug'
if nextLevelSlug = @getNextLevel 'continue'
campaign = @getCampaignForSlug nextLevelSlug
campaign or 'dungeon'
getNextLevelLink: (type) ->
link = '/play'
nextMap = @getNextLevelMap()
link += '/' + nextMap unless nextMap is 'dungeon'
nextCampaign = @getNextLevelCampaign()
link += '/' + nextCampaign unless nextCampaign is 'dungeon'
return link unless nextLevel = @getNextLevel type
"#{link}?next=#{nextLevel}"
# Branching group testing
getNextLevel: (type) ->
levelInfo = @getLevelInfoForSlug @level.get 'slug'
levelInfo?.nextLevels?[type] # 'more_practice', 'skip_ahead', 'continue'
onClickContinue: (e) ->
nextLevelLink = @continueLevelLink
if me.getBranchingGroup() is 'all-practice' and @morePracticeLevelLink
@ -291,7 +297,7 @@ module.exports = class HeroVictoryModal extends ModalView
skipPrompt ||= not (@skipAheadLevelLink or @morePractiveLevelLink) and me.getBranchingGroup() is 'choice-explicit'
if skipPrompt
# Preserve the supermodel as we navigate back to the world map.
Backbone.Mediator.publish 'router:navigate', route: nextLevelLink, viewClass: require('views/play/WorldMapView'), viewArgs: [{supermodel: @supermodel}, @getNextLevelMap()]
Backbone.Mediator.publish 'router:navigate', route: nextLevelLink, viewClass: require('views/play/WorldMapView'), viewArgs: [{supermodel: @supermodel}, @getNextLevelCampaign()]
else
# Hide everything except the buttons prompting them for which kind of next level to do
@$el.find('.modal-footer, .modal-body > *').hide()
@ -299,11 +305,10 @@ module.exports = class HeroVictoryModal extends ModalView
onClickNextLevelBranch: (e) ->
e.preventDefault()
route = $(e.target).data('href') or "/play/#{@getNextLevelMap()}"
route = $(e.target).data('href') or "/play/#{@getNextLevelCampaign()}"
application.tracker?.trackEvent 'Branch Selected', level: @level.get('slug'), label: @level.get('slug'), branch: $(e.target).data('branch-key'), branchingGroup: me.getBranchingGroup(), route: route
# Preserve the supermodel as we navigate back to world map.
console.log 'would navigate to', route
Backbone.Mediator.publish 'router:navigate', route: route, viewClass: require('views/play/WorldMapView'), viewArgs: [{supermodel: @supermodel}, @getNextLevelMap()]
Backbone.Mediator.publish 'router:navigate', route: route, viewClass: require('views/play/WorldMapView'), viewArgs: [{supermodel: @supermodel}, @getNextLevelCampaign()]
onClickReturnToLadder: (e) ->
e.preventDefault()

View file

@ -1,6 +1,7 @@
CocoView = require 'views/kinds/CocoView'
template = require 'templates/play/level/tome/cast_button'
{me} = require 'lib/auth'
LevelOptions = require 'lib/LevelOptions'
module.exports = class CastButtonView extends CocoView
id: 'cast-button-view'
@ -46,7 +47,7 @@ module.exports = class CastButtonView extends CocoView
#delay = me.get('autocastDelay') # No more autocast
delay = 90019001
@setAutocastDelay delay
@$el.find('.submit-button').hide() if @options.levelID in ['dungeons-of-kithgard', 'gems-in-the-deep', 'shadow-guard', 'true-names']
@$el.find('.submit-button').hide() if LevelOptions[@options.levelID]?.hidesSubmitUntilRun # Hide Submit for the first few until they run it once.
attachTo: (spellView) ->
@$el.detach().prependTo(spellView.toolbarView.$el).show()
@ -112,7 +113,7 @@ module.exports = class CastButtonView extends CocoView
castText = $.i18n.t('play_level.tome_cast_button_running')
else if castable or true
castText = $.i18n.t('play_level.tome_cast_button_run')
unless @options.levelID in ['dungeons-of-kithgard', 'gems-in-the-deep', 'shadow-guard', 'forgetful-gemsmith', 'kounter-kithwise', 'true-names', 'the-raised-sword', 'favorable-odds', 'the-first-kithmaze', 'haunted-kithmaze'] # Hide for first few.
unless LevelOptions[@options.levelID]?.hidesRunShortcut # Hide for first few.
castText += ' ' + @castShortcut
else
castText = $.i18n.t('play_level.tome_cast_button_ran')

View file

@ -5,6 +5,7 @@ filters = require 'lib/image_filter'
SpellPaletteEntryView = require './SpellPaletteEntryView'
LevelComponent = require 'models/LevelComponent'
ThangType = require 'models/ThangType'
LevelOptions = require 'lib/LevelOptions'
N_ROWS = 4
@ -198,7 +199,7 @@ module.exports = class SpellPaletteView extends CocoView
# Assign any unassigned properties to the hero itself.
for owner, storage of propStorage
for prop in _.reject(@thang[storage] ? [], (prop) -> itemsByProp[prop] or prop[0] is '_') # no private properties
if prop is 'say' and @options.level.get('slug') in ['dungeons-of-kithgard', 'gems-in-the-deep', 'forgetful-gemsmith', 'shadow-guard', 'kounter-kithwise', 'crawlways-of-kithgard', 'true-names', 'favorable-odds', 'the-raised-sword', 'the-first-kithmaze', 'haunted-kithmaze', 'descending-further', 'the-second-kithmaze', 'dread-door', 'known-enemy', 'master-of-names', 'lowly-kithmen', 'closing-the-distance', 'tactical-strike', 'the-final-kithmaze', 'the-gauntlet', 'kithgard-gates']
if prop is 'say' and LevelOptions[@options.level.get('slug')]?.hidesSay # Hide for Dungeon Campaign
continue
propsByItem['Hero'] ?= []
propsByItem['Hero'].push owner: owner, prop: prop, item: itemThangTypes[@thang.spriteName]

View file

@ -9,6 +9,7 @@ SpellDebugView = require './SpellDebugView'
SpellToolbarView = require './SpellToolbarView'
LevelComponent = require 'models/LevelComponent'
UserCodeProblem = require 'models/UserCodeProblem'
LevelOptions = require 'lib/LevelOptions'
module.exports = class SpellView extends CocoView
id: 'spell-view'
@ -312,7 +313,7 @@ module.exports = class SpellView extends CocoView
@createToolbarView()
createDebugView: ->
return if @options.level.get('type', true) is 'hero' # We'll turn this on later, maybe, but not yet.
return if @options.level.get('type', true) in ['hero', 'hero-ladder', 'hero-coop'] # We'll turn this on later, maybe, but not yet.
@debugView = new SpellDebugView ace: @ace, thang: @thang, spell:@spell
@$el.append @debugView.render().$el.hide()
@ -742,7 +743,7 @@ module.exports = class SpellView extends CocoView
@aceSession.removeGutterDecoration row, 'executed'
@decoratedGutter[row] = ''
lastExecuted = _.last executed
showToolbarView = executed.length and @spellThang.castAether.metrics.statementsExecuted > 3 and not (@options.level.get('slug') in ['dungeons-of-kithgard', 'gems-in-the-deep', 'forgetful-gemsmith', 'shadow-guard', 'kounter-kithwise', 'crawlways-of-kithgard', 'true-names', 'favorable-odds', 'the-raised-sword', 'the-first-kithmaze', 'haunted-kithmaze', 'descending-further', 'the-second-kithmaze', 'dread-door', 'known-enemy', 'master-of-names', 'lowly-kithmen', 'closing-the-distance', 'tactical-strike', 'the-final-kithmaze', 'the-gauntlet', 'kithgard-gates'])
showToolbarView = executed.length and @spellThang.castAether.metrics.statementsExecuted > 3 and not LevelOptions[@options.level.get('slug')]?.hidesCodeToolbar # Hide for a while
if showToolbarView
statementIndex = Math.max 0, lastExecuted.length - 1