Enable auto-submission to ladder for Wakka Maul

This commit is contained in:
Nick Winter 2015-11-24 13:35:08 -08:00
parent 01c7efb78a
commit 9f0a843593
3 changed files with 10 additions and 4 deletions
app
lib
templates/play/level/tome
views/play/level/tome

View file

@ -123,6 +123,7 @@ module.exports = class LevelBus extends Bus
onWinnabilityUpdated: (e) ->
return unless @onPoint() and e.winnable
return unless e.level.get('slug') in ['ace-of-coders'] # Mirror matches don't otherwise show victory, so we win here.
return if @session.get('state')?.complete
@onVictory()
onNewWorldCreated: (e) ->

View file

@ -11,3 +11,7 @@ if !observing
button.btn.btn-lg.btn-illustrated.btn-success.done-button.secret
span(data-i18n="play_level.done") Done
if view.autoSubmitsToLadder
.hidden
.ladder-submission-view

View file

@ -31,6 +31,7 @@ module.exports = class CastButtonView extends CocoView
@updateReplayabilityInterval = setInterval @updateReplayability, 1000
@observing = options.session.get('creator') isnt me.id
@loadMirrorSession() if @options.level.get('slug') in ['ace-of-coders']
@autoSubmitsToLadder = @options.level.get('slug') in ['wakka-maul']
destroy: ->
clearInterval @updateReplayabilityInterval
@ -101,10 +102,10 @@ module.exports = class CastButtonView extends CocoView
@casting = false
if @hasCastOnce # Don't play this sound the first time
@playSound 'cast-end', 0.5
# Worked great for live Ace of Coders tournament, but probably annoying for asynchronous tournament mode.
#myHeroID = if me.team is 'ogres' then 'Hero Placeholder 1' else 'Hero Placeholder'
#if @ladderSubmissionView and not e.world.thangMap[myHeroID]?.errorsOut
# _.delay (=> @ladderSubmissionView?.rankSession()), 1000 if @ladderSubmissionView
# Worked great for live beginner tournaments, but probably annoying for asynchronous tournament mode.
myHeroID = if me.team is 'ogres' then 'Hero Placeholder 1' else 'Hero Placeholder'
if @autoSubmitsToLadder and not e.world.thangMap[myHeroID]?.errorsOut
_.delay (=> @ladderSubmissionView?.rankSession()), 1000 if @ladderSubmissionView
@hasCastOnce = true
@updateCastButton()
@world = e.world