diff --git a/app/models/CocoModel.coffee b/app/models/CocoModel.coffee index e9a687882..521c9e148 100644 --- a/app/models/CocoModel.coffee +++ b/app/models/CocoModel.coffee @@ -153,7 +153,7 @@ class CocoModel extends Backbone.Model console.warn errorMessage, res.responseJSON unless webkit?.messageHandlers # Don't show these notys on iPad try - noty text: "#{errorMessage}: #{res.status} #{res.statusText}", layout: 'topCenter', type: 'error', killer: false, timeout: 10000 + noty text: "#{errorMessage}: #{res.status} #{res.statusText}\n#{res.responseText}", layout: 'topCenter', type: 'error', killer: false, timeout: 10000 catch notyError console.warn "Couldn't even show noty error for", error, "because", notyError options.success = options.error = null # So the callbacks can be garbage-collected. diff --git a/app/models/ThangType.coffee b/app/models/ThangType.coffee index ed61bdf5f..a0f969b3a 100644 --- a/app/models/ThangType.coffee +++ b/app/models/ThangType.coffee @@ -282,8 +282,8 @@ module.exports = class ThangType extends CocoModel sprite = vectorParser.buildContainerFromStore(portrait.container) pt = portrait.positions?.registration - sprite.regX = pt?.x or 0 - sprite.regY = pt?.y or 0 + sprite.regX = pt?.x / scale or 0 + sprite.regY = pt?.y / scale or 0 sprite.scaleX = sprite.scaleY = scale * size / 100 stage.addChild(sprite) stage.update() diff --git a/app/templates/play/level/modal/hero-victory-modal.jade b/app/templates/play/level/modal/hero-victory-modal.jade index a42559f48..22fe126a1 100644 --- a/app/templates/play/level/modal/hero-victory-modal.jade +++ b/app/templates/play/level/modal/hero-victory-modal.jade @@ -17,18 +17,19 @@ block modal-body-content div.achievement-description= achievement.get('description') div.achievement-rewards - - var worth = achievement.get('worth', true); + - var worth = achievement.worth; + - var gems = achievement.gems; if worth .reward-panel.numerical.xp(data-number=worth, data-number-unit='xp') .reward-image-container(class=animate ? 'pending-reward-image' : 'show') img(src="/images/pages/play/level/modal/reward_icon_xp.png") .reward-text= animate ? '+0' : '+'+worth - if rewards.gems - .reward-panel.numerical.gems(data-number=rewards.gems, data-number-unit='gem') + if gems + .reward-panel.numerical.gems(data-number=gems, data-number-unit='gem') .reward-image-container(class=animate ? 'pending-reward-image' : 'show') img(src="/images/pages/play/level/modal/reward_icon_gems.png") - .reward-text= animate ? '+0' : '+'+rewards.gems + .reward-text= animate ? '+0' : '+'+gems if rewards.heroes for hero in rewards.heroes diff --git a/app/views/editor/thang/VectorIconSetupModal.coffee b/app/views/editor/thang/VectorIconSetupModal.coffee index b2d4df3f5..d5000b924 100644 --- a/app/views/editor/thang/VectorIconSetupModal.coffee +++ b/app/views/editor/thang/VectorIconSetupModal.coffee @@ -76,8 +76,8 @@ module.exports = class VectorIconSetupModal extends ModalView updateSpriteProperties: -> @sprite.scaleX = @sprite.scaleY = @scale * @demoSize / 100 - @sprite.regX = @regX - @sprite.regY = @regY + @sprite.regX = @regX / @scale + @sprite.regY = @regY / @scale console.log 'set to', @scale, @regX, @regY onClickCenter: -> @@ -91,6 +91,8 @@ module.exports = class VectorIconSetupModal extends ModalView @regY += (b[3] - b[2]) / 2 else @regX += (b[2] - b[3]) / 2 + @regX *= @scale + @regY *= @scale @updateSpriteProperties() @stage.update() diff --git a/app/views/i18n/I18NEditModelView.coffee b/app/views/i18n/I18NEditModelView.coffee index 38c620357..112f74350 100644 --- a/app/views/i18n/I18NEditModelView.coffee +++ b/app/views/i18n/I18NEditModelView.coffee @@ -162,5 +162,6 @@ module.exports = class I18NEditModelView extends RootView return button.text('Failed to Submit Changes') if errors res = modelToSave.save(null, {type: 'POST'}) # Override PUT so we can trigger postNewVersion logic return button.text('Failed to Submit Changes') unless res + button.text('Submitting...') res.error => button.text('Error Submitting Changes') res.success => button.text('Submit Changes') diff --git a/app/views/play/level/modal/HeroVictoryModal.coffee b/app/views/play/level/modal/HeroVictoryModal.coffee index f473370a1..ce108179d 100644 --- a/app/views/play/level/modal/HeroVictoryModal.coffee +++ b/app/views/play/level/modal/HeroVictoryModal.coffee @@ -84,7 +84,7 @@ module.exports = class HeroVictoryModal extends ModalView @listenToOnce me, 'sync', -> @readyToContinue = true @updateSavingProgressStatus() - me.fetch cache:false unless me.loading + me.fetch cache: false unless me.loading @readyToContinue = true if not @achievements.models.length @@ -96,7 +96,17 @@ module.exports = class HeroVictoryModal extends ModalView earnedAchievement = earnedAchievementMap[achievement.id] if earnedAchievement achievement.completedAWhileAgo = new Date() - Date.parse(earnedAchievement.get('created')) > 30 * 1000 - c.achievements = @achievements.models + achievement.worth = achievement.get 'worth', true + achievement.gems = achievement.get('rewards')?.gems + c.achievements = @achievements.models.slice() + for achievement in c.achievements + continue unless @supermodel.finished() and proportionalTo = achievement.get 'proportionalTo' + # For repeatable achievements, we modify their base worth/gems by their repeatable growth functions. + achievedAmount = utils.getByPath @session.attributes, proportionalTo + func = achievement.getExpFunction() + achievement.worth = (achievement.get('worth') ? 0) * func achievedAmount + rewards = achievement.get 'rewards' + achievement.gems = rewards?.gems * func achievedAmount if rewards?.gems # for testing the three states #if c.achievements.length @@ -110,8 +120,6 @@ module.exports = class HeroVictoryModal extends ModalView # rewards = achievement.get('rewards') or {} # rewards.gems *= (index + 1) - # TODO: use earned achievement worths or somehow pull in recalculated exp/gems - c.thangTypes = @thangTypes c.me = me c.readyToRank = @level.get('type', true) is 'hero-ladder' and @session.readyToRank()