mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 16:17:57 -05:00
Merge branch 'master' into production
This commit is contained in:
commit
3c96569e87
4 changed files with 27 additions and 24 deletions
|
@ -306,7 +306,7 @@ module.exports = LevelOptions =
|
||||||
requiredGear: {}
|
requiredGear: {}
|
||||||
restrictedGear: {}
|
restrictedGear: {}
|
||||||
'the-mighty-sand-yak':
|
'the-mighty-sand-yak':
|
||||||
requiredGear: {}
|
#requiredGear: {neck: 'rough-sense-stone'} # Too many players probably won't have this, and we don't have a way to require players to buy it yet.
|
||||||
restrictedGear: {}
|
restrictedGear: {}
|
||||||
'oasis':
|
'oasis':
|
||||||
requiredGear: {}
|
requiredGear: {}
|
||||||
|
@ -321,7 +321,7 @@ module.exports = LevelOptions =
|
||||||
requiredGear: {}
|
requiredGear: {}
|
||||||
restrictedGear: {}
|
restrictedGear: {}
|
||||||
'medical-attention':
|
'medical-attention':
|
||||||
requiredGear: {} # sense stone
|
#requiredGear: {neck: 'polished-sense-stone'} # We don't have a way to require players to buy it yet.
|
||||||
restrictedGear: {}
|
restrictedGear: {}
|
||||||
'minesweeper':
|
'minesweeper':
|
||||||
requiredGear: {}
|
requiredGear: {}
|
||||||
|
|
|
@ -379,26 +379,27 @@ module.exports = class InventoryModal extends ModalView
|
||||||
console.log 'Unequipping restricted item', restrictedGear[slot], 'for', slot, 'before level', @options.levelID
|
console.log 'Unequipping restricted item', restrictedGear[slot], 'for', slot, 'before level', @options.levelID
|
||||||
@unequipItemFromSlot @$el.find(".item-slot[data-slot='#{slot}']")
|
@unequipItemFromSlot @$el.find(".item-slot[data-slot='#{slot}']")
|
||||||
delete equipment[slot]
|
delete equipment[slot]
|
||||||
if (heroClass is 'Warrior' or
|
for slot, item of requiredGear
|
||||||
(heroClass is 'Ranger' and @options.levelID in ['swift-dagger', 'shrapnel']) or
|
if (slot in ['right-hand', 'left-hand', 'head', 'torso']) and not (heroClass is 'Warrior' or
|
||||||
(heroClass is 'Wizard' and @options.levelID in ['touch-of-death', 'bonemender']))
|
(heroClass is 'Ranger' and @options.levelID in ['swift-dagger', 'shrapnel']) or
|
||||||
# After they switch to a ranger or wizard, we stop being so finicky about gear.
|
(heroClass is 'Wizard' and @options.levelID in ['touch-of-death', 'bonemender']))
|
||||||
for slot, item of requiredGear
|
# After they switch to a ranger or wizard, we stop being so finicky about class-specific gear.
|
||||||
continue if item is 'tarnished-bronze-breastplate' and inWorldMap and @options.levelID is 'the-raised-sword' # Don't tell them they need it until they need it in the level
|
continue
|
||||||
equipped = equipment[slot]
|
continue if item is 'tarnished-bronze-breastplate' and inWorldMap and @options.levelID is 'the-raised-sword' # Don't tell them they need it until they need it in the level
|
||||||
continue if equipped and not (
|
equipped = equipment[slot]
|
||||||
(item is 'crude-builders-hammer' and equipped in [gear['simple-sword'], gear['long-sword'], gear['sharpened-sword'], gear['roughedge']]) or
|
continue if equipped and not (
|
||||||
(item in ['simple-sword', 'long-sword', 'roughedge', 'sharpened-sword'] and equipped is gear['crude-builders-hammer']) or
|
(item is 'crude-builders-hammer' and equipped in [gear['simple-sword'], gear['long-sword'], gear['sharpened-sword'], gear['roughedge']]) or
|
||||||
(item is 'leather-boots' and equipped is gear['simple-boots']) or
|
(item in ['simple-sword', 'long-sword', 'roughedge', 'sharpened-sword'] and equipped is gear['crude-builders-hammer']) or
|
||||||
(item is 'simple-boots' and equipped is gear['leather-boots'])
|
(item is 'leather-boots' and equipped is gear['simple-boots']) or
|
||||||
)
|
(item is 'simple-boots' and equipped is gear['leather-boots'])
|
||||||
itemModel = @items.findWhere {slug: item}
|
)
|
||||||
continue unless itemModel
|
itemModel = @items.findWhere {slug: item}
|
||||||
availableSlotSelector = "#unequipped .item[data-item-id='#{itemModel.id}']"
|
continue unless itemModel
|
||||||
@highlightElement availableSlotSelector, delay: 500, sides: ['right'], rotation: Math.PI / 2
|
availableSlotSelector = "#unequipped .item[data-item-id='#{itemModel.id}']"
|
||||||
@$el.find(availableSlotSelector).addClass 'should-equip'
|
@highlightElement availableSlotSelector, delay: 500, sides: ['right'], rotation: Math.PI / 2
|
||||||
@$el.find("#equipped div[data-slot='#{slot}']").addClass 'should-equip'
|
@$el.find(availableSlotSelector).addClass 'should-equip'
|
||||||
@remainingRequiredEquipment.push slot: slot, item: gear[item]
|
@$el.find("#equipped div[data-slot='#{slot}']").addClass 'should-equip'
|
||||||
|
@remainingRequiredEquipment.push slot: slot, item: gear[item]
|
||||||
if hadRequired and not @remainingRequiredEquipment.length
|
if hadRequired and not @remainingRequiredEquipment.length
|
||||||
@endHighlight()
|
@endHighlight()
|
||||||
@highlightElement '#play-level-button', duration: 5000
|
@highlightElement '#play-level-button', duration: 5000
|
||||||
|
@ -626,3 +627,5 @@ gear =
|
||||||
'enchanted-stick': '544d87188494308424f564f1'
|
'enchanted-stick': '544d87188494308424f564f1'
|
||||||
'unholy-tome-i': '546374bc3839c6e02811d308'
|
'unholy-tome-i': '546374bc3839c6e02811d308'
|
||||||
'book-of-life-i': '546375653839c6e02811d30b'
|
'book-of-life-i': '546375653839c6e02811d30b'
|
||||||
|
'rough-sense-stone': '54693140a2b1f53ce79443bc'
|
||||||
|
'polished-sense-stone': '53e215a253457600003e3eaf'
|
||||||
|
|
|
@ -10,7 +10,7 @@ class AnalyticsLogEventHandler extends Handler
|
||||||
]
|
]
|
||||||
|
|
||||||
hasAccess: (req) ->
|
hasAccess: (req) ->
|
||||||
req.method in ['PUT', 'POST'] or req.user?.isAdmin()
|
req.method in ['POST'] or req.user?.isAdmin()
|
||||||
|
|
||||||
makeNewInstance: (req) ->
|
makeNewInstance: (req) ->
|
||||||
instance = super(req)
|
instance = super(req)
|
||||||
|
|
|
@ -106,7 +106,7 @@ module.exports = class Handler
|
||||||
|
|
||||||
# generic handlers
|
# generic handlers
|
||||||
get: (req, res) ->
|
get: (req, res) ->
|
||||||
@sendForbiddenError(res) if not @hasAccess(req)
|
return @sendForbiddenError(res) if not @hasAccess(req)
|
||||||
|
|
||||||
specialParameters = ['term', 'project', 'conditions']
|
specialParameters = ['term', 'project', 'conditions']
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue