mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 05:53:39 -04:00
Fix for earned achievement default null worths. Misc other fixes.
This commit is contained in:
parent
786820e056
commit
1b4e75e7e8
5 changed files with 23 additions and 17 deletions
app
lib
views
server/plugins
|
@ -89,6 +89,8 @@ module.exports = class LevelLoader extends CocoClass
|
|||
@listenToOnce @opponentSession, 'sync', @loadDependenciesForSession
|
||||
|
||||
loadDependenciesForSession: (session) ->
|
||||
if session is @session
|
||||
Backbone.Mediator.publish 'level:session-loaded', level: @level, session: @session
|
||||
return unless @level.get('type', true) is 'hero'
|
||||
heroConfig = session.get('heroConfig')
|
||||
heroConfig ?= me.get('heroConfig')
|
||||
|
@ -101,8 +103,6 @@ module.exports = class LevelLoader extends CocoClass
|
|||
url = "/db/thang.type/#{itemThangType}/version?project=name,components,original"
|
||||
@worldNecessities.push @maybeLoadURL(url, ThangType, 'thang')
|
||||
|
||||
if session is @session
|
||||
Backbone.Mediator.publish 'level:session-loaded', level: @level, session: @session
|
||||
|
||||
# Grabbing the rest of the required data for the level
|
||||
|
||||
|
|
|
@ -53,10 +53,12 @@ module.exports = class GameMenuModal extends ModalView
|
|||
updateConfig: ->
|
||||
sessionHeroConfig = $.extend {}, true, (@options.session.get('heroConfig') ? {})
|
||||
lastHeroConfig = me.get('heroConfig') ? {}
|
||||
thangType = @subviews.choose_hero_view.selectedHero.get 'original'
|
||||
thangType = @subviews.choose_hero_view.selectedHero?.get 'original'
|
||||
inventory = @subviews.inventory_view.getCurrentEquipmentConfig()
|
||||
patchSession = patchMe = false
|
||||
props = thangType: thangType, inventory: inventory
|
||||
props = {}
|
||||
props.thangType = thangType if thangType
|
||||
props.inventory = inventory if _.size inventory
|
||||
for key, val of props when val
|
||||
patchSession ||= not _.isEqual val, sessionHeroConfig[key]
|
||||
patchMe ||= not _.isEqual val, lastHeroConfig[key]
|
||||
|
@ -69,6 +71,7 @@ module.exports = class GameMenuModal extends ModalView
|
|||
aceConfig = me.get('aceConfig', true) ? {}
|
||||
aceConfig.language = codeLanguage
|
||||
me.set 'aceConfig', aceConfig
|
||||
console.log 'update config from game menu modal; props:', props, 'patch session?', patchSession, 'patch me?', patchMe
|
||||
if patchSession
|
||||
@options.session.set 'heroConfig', sessionHeroConfig
|
||||
success = ->
|
||||
|
|
|
@ -295,7 +295,7 @@ module.exports = class InventoryView extends CocoView
|
|||
'simple-boots': '53e237bf53457600003e3f05'
|
||||
'longsword': '53e218d853457600003e3ebe'
|
||||
'leather-tunic': '53e22eac53457600003e3efc'
|
||||
'leather-boots': '53e2384453457600003e3f07'
|
||||
#'leather-boots': '53e2384453457600003e3f07'
|
||||
'programmaticon-i': '53e4108204c00d4607a89f78'
|
||||
'crude-glasses': '53e238df53457600003e3f0b'
|
||||
'builders-hammer': '53f4e6e3d822c23505b74f42'
|
||||
|
@ -305,14 +305,14 @@ module.exports = class InventoryView extends CocoView
|
|||
'shadow-guard': {feet: 'simple-boots'}
|
||||
'true-names': {feet: 'simple-boots', 'right-hand': 'longsword'}
|
||||
'the-raised-sword': {feet: 'simple-boots', 'right-hand': 'longsword', torso: 'leather-tunic'}
|
||||
'the-first-kithmaze': {feet: 'leather-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i'}
|
||||
'the-second-kithmaze': {feet: 'leather-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i'}
|
||||
'new-sight': {feet: 'leather-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i'}
|
||||
'lowly-kithmen': {feet: 'leather-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
|
||||
'a-bolt-in-the-dark': {feet: 'leather-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
|
||||
'the-final-kithmaze': {feet: 'leather-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
|
||||
'kithgard-gates': {feet: 'leather-boots', 'right-hand': 'builders-hammer', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
|
||||
'defence-of-plainswood': {feet: 'leather-boots', 'right-hand': 'builders-hammer', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
|
||||
'the-first-kithmaze': {feet: 'simple-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i'}
|
||||
'the-second-kithmaze': {feet: 'simple-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i'}
|
||||
'new-sight': {feet: 'simple-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i'}
|
||||
'lowly-kithmen': {feet: 'simple-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
|
||||
'a-bolt-in-the-dark': {feet: 'simple-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
|
||||
'the-final-kithmaze': {feet: 'simple-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
|
||||
'kithgard-gates': {feet: 'simple-boots', 'right-hand': 'builders-hammer', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
|
||||
'defence-of-plainswood': {feet: 'simple-boots', 'right-hand': 'builders-hammer', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
|
||||
necessaryGear = gearByLevel[@options.levelID]
|
||||
for slot, item of necessaryGear ? {}
|
||||
@equipment[slot] ?= gear[item]
|
||||
|
|
|
@ -362,7 +362,8 @@ module.exports = class PlayLevelView extends RootView
|
|||
AudioPlayer.preloadSound src
|
||||
Backbone.Mediator.subscribeOnce 'audio-player:loaded', @playAmbientSound, @
|
||||
return
|
||||
@ambientSound = createjs.Sound.play src, loop: -1
|
||||
@ambientSound = createjs.Sound.play src, loop: -1, volume: 0.1
|
||||
createjs.Tween.get(@ambientSound).to({volume: 1.0}, 10000)
|
||||
|
||||
restoreSessionState: ->
|
||||
return if @alreadyLoadedState
|
||||
|
@ -618,7 +619,7 @@ module.exports = class PlayLevelView extends RootView
|
|||
|
||||
onSubmissionComplete: =>
|
||||
return if @destroyed
|
||||
@showVictory() if @goalManager.checkOverallStatus() is 'success'
|
||||
Backbone.Mediator.publish 'level:show-victory', showModal: true if @goalManager.checkOverallStatus() is 'success'
|
||||
|
||||
destroy: ->
|
||||
@levelLoader?.destroy()
|
||||
|
@ -626,7 +627,9 @@ module.exports = class PlayLevelView extends RootView
|
|||
@god?.destroy()
|
||||
@goalManager?.destroy()
|
||||
@scriptManager?.destroy()
|
||||
@ambientSound?.stop()
|
||||
if ambientSound = @ambientSound
|
||||
# Doesn't seem to work; stops immediately.
|
||||
createjs.Tween.get(ambientSound).to({volume: 0.0}, 1500).call -> ambientSound.stop()
|
||||
$(window).off 'resize', @onWindowResize
|
||||
delete window.world # not sure where this is set, but this is one way to clean it up
|
||||
clearInterval(@pointerInterval)
|
||||
|
|
|
@ -51,7 +51,7 @@ AchievablePlugin = (schema, options) ->
|
|||
achievement: achievement._id.toHexString()
|
||||
achievementName: achievement.get 'name'
|
||||
|
||||
worth = achievement.get('worth')
|
||||
worth = achievement.get('worth') ? 10
|
||||
earnedPoints = 0
|
||||
wrapUp = ->
|
||||
# Update user's experience points
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue