mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-29 02:25:37 -05:00
Merge branch 'master' into production
This commit is contained in:
commit
a806351a2a
6 changed files with 25 additions and 13 deletions
|
@ -153,7 +153,7 @@ class CocoModel extends Backbone.Model
|
||||||
console.warn errorMessage, res.responseJSON
|
console.warn errorMessage, res.responseJSON
|
||||||
unless webkit?.messageHandlers # Don't show these notys on iPad
|
unless webkit?.messageHandlers # Don't show these notys on iPad
|
||||||
try
|
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
|
catch notyError
|
||||||
console.warn "Couldn't even show noty error for", error, "because", 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.
|
options.success = options.error = null # So the callbacks can be garbage-collected.
|
||||||
|
|
|
@ -282,8 +282,8 @@ module.exports = class ThangType extends CocoModel
|
||||||
sprite = vectorParser.buildContainerFromStore(portrait.container)
|
sprite = vectorParser.buildContainerFromStore(portrait.container)
|
||||||
|
|
||||||
pt = portrait.positions?.registration
|
pt = portrait.positions?.registration
|
||||||
sprite.regX = pt?.x or 0
|
sprite.regX = pt?.x / scale or 0
|
||||||
sprite.regY = pt?.y or 0
|
sprite.regY = pt?.y / scale or 0
|
||||||
sprite.scaleX = sprite.scaleY = scale * size / 100
|
sprite.scaleX = sprite.scaleY = scale * size / 100
|
||||||
stage.addChild(sprite)
|
stage.addChild(sprite)
|
||||||
stage.update()
|
stage.update()
|
||||||
|
|
|
@ -17,18 +17,19 @@ block modal-body-content
|
||||||
div.achievement-description= achievement.get('description')
|
div.achievement-description= achievement.get('description')
|
||||||
|
|
||||||
div.achievement-rewards
|
div.achievement-rewards
|
||||||
- var worth = achievement.get('worth', true);
|
- var worth = achievement.worth;
|
||||||
|
- var gems = achievement.gems;
|
||||||
if worth
|
if worth
|
||||||
.reward-panel.numerical.xp(data-number=worth, data-number-unit='xp')
|
.reward-panel.numerical.xp(data-number=worth, data-number-unit='xp')
|
||||||
.reward-image-container(class=animate ? 'pending-reward-image' : 'show')
|
.reward-image-container(class=animate ? 'pending-reward-image' : 'show')
|
||||||
img(src="/images/pages/play/level/modal/reward_icon_xp.png")
|
img(src="/images/pages/play/level/modal/reward_icon_xp.png")
|
||||||
.reward-text= animate ? '+0' : '+'+worth
|
.reward-text= animate ? '+0' : '+'+worth
|
||||||
|
|
||||||
if rewards.gems
|
if gems
|
||||||
.reward-panel.numerical.gems(data-number=rewards.gems, data-number-unit='gem')
|
.reward-panel.numerical.gems(data-number=gems, data-number-unit='gem')
|
||||||
.reward-image-container(class=animate ? 'pending-reward-image' : 'show')
|
.reward-image-container(class=animate ? 'pending-reward-image' : 'show')
|
||||||
img(src="/images/pages/play/level/modal/reward_icon_gems.png")
|
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
|
if rewards.heroes
|
||||||
for hero in rewards.heroes
|
for hero in rewards.heroes
|
||||||
|
|
|
@ -76,8 +76,8 @@ module.exports = class VectorIconSetupModal extends ModalView
|
||||||
|
|
||||||
updateSpriteProperties: ->
|
updateSpriteProperties: ->
|
||||||
@sprite.scaleX = @sprite.scaleY = @scale * @demoSize / 100
|
@sprite.scaleX = @sprite.scaleY = @scale * @demoSize / 100
|
||||||
@sprite.regX = @regX
|
@sprite.regX = @regX / @scale
|
||||||
@sprite.regY = @regY
|
@sprite.regY = @regY / @scale
|
||||||
console.log 'set to', @scale, @regX, @regY
|
console.log 'set to', @scale, @regX, @regY
|
||||||
|
|
||||||
onClickCenter: ->
|
onClickCenter: ->
|
||||||
|
@ -91,6 +91,8 @@ module.exports = class VectorIconSetupModal extends ModalView
|
||||||
@regY += (b[3] - b[2]) / 2
|
@regY += (b[3] - b[2]) / 2
|
||||||
else
|
else
|
||||||
@regX += (b[2] - b[3]) / 2
|
@regX += (b[2] - b[3]) / 2
|
||||||
|
@regX *= @scale
|
||||||
|
@regY *= @scale
|
||||||
@updateSpriteProperties()
|
@updateSpriteProperties()
|
||||||
@stage.update()
|
@stage.update()
|
||||||
|
|
||||||
|
|
|
@ -162,5 +162,6 @@ module.exports = class I18NEditModelView extends RootView
|
||||||
return button.text('Failed to Submit Changes') if errors
|
return button.text('Failed to Submit Changes') if errors
|
||||||
res = modelToSave.save(null, {type: 'POST'}) # Override PUT so we can trigger postNewVersion logic
|
res = modelToSave.save(null, {type: 'POST'}) # Override PUT so we can trigger postNewVersion logic
|
||||||
return button.text('Failed to Submit Changes') unless res
|
return button.text('Failed to Submit Changes') unless res
|
||||||
|
button.text('Submitting...')
|
||||||
res.error => button.text('Error Submitting Changes')
|
res.error => button.text('Error Submitting Changes')
|
||||||
res.success => button.text('Submit Changes')
|
res.success => button.text('Submit Changes')
|
||||||
|
|
|
@ -84,7 +84,7 @@ module.exports = class HeroVictoryModal extends ModalView
|
||||||
@listenToOnce me, 'sync', ->
|
@listenToOnce me, 'sync', ->
|
||||||
@readyToContinue = true
|
@readyToContinue = true
|
||||||
@updateSavingProgressStatus()
|
@updateSavingProgressStatus()
|
||||||
me.fetch cache:false unless me.loading
|
me.fetch cache: false unless me.loading
|
||||||
|
|
||||||
@readyToContinue = true if not @achievements.models.length
|
@readyToContinue = true if not @achievements.models.length
|
||||||
|
|
||||||
|
@ -96,7 +96,17 @@ module.exports = class HeroVictoryModal extends ModalView
|
||||||
earnedAchievement = earnedAchievementMap[achievement.id]
|
earnedAchievement = earnedAchievementMap[achievement.id]
|
||||||
if earnedAchievement
|
if earnedAchievement
|
||||||
achievement.completedAWhileAgo = new Date() - Date.parse(earnedAchievement.get('created')) > 30 * 1000
|
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
|
# for testing the three states
|
||||||
#if c.achievements.length
|
#if c.achievements.length
|
||||||
|
@ -110,8 +120,6 @@ module.exports = class HeroVictoryModal extends ModalView
|
||||||
# rewards = achievement.get('rewards') or {}
|
# rewards = achievement.get('rewards') or {}
|
||||||
# rewards.gems *= (index + 1)
|
# rewards.gems *= (index + 1)
|
||||||
|
|
||||||
# TODO: use earned achievement worths or somehow pull in recalculated exp/gems
|
|
||||||
|
|
||||||
c.thangTypes = @thangTypes
|
c.thangTypes = @thangTypes
|
||||||
c.me = me
|
c.me = me
|
||||||
c.readyToRank = @level.get('type', true) is 'hero-ladder' and @session.readyToRank()
|
c.readyToRank = @level.get('type', true) is 'hero-ladder' and @session.readyToRank()
|
||||||
|
|
Loading…
Reference in a new issue