Fixed awardable items showing up in inventory/store items list when not earnned, and showing up at the end when earned.

This commit is contained in:
Nick Winter 2014-11-17 08:25:27 -08:00
parent b6570236d8
commit 0d68ad250d
2 changed files with 3 additions and 2 deletions

View file

@ -67,7 +67,7 @@ module.exports = class InventoryModal extends ModalView
@itemGroups.availableItems = new Backbone.Collection() @itemGroups.availableItems = new Backbone.Collection()
@itemGroups.restrictedItems = new Backbone.Collection() @itemGroups.restrictedItems = new Backbone.Collection()
@itemGroups.lockedItems = new Backbone.Collection() @itemGroups.lockedItems = new Backbone.Collection()
itemGroup.comparator = 'gems' for itemGroup in _.values @itemGroups itemGroup.comparator = ((m) -> m.get('gems') ? m.get('tier')) for itemGroup in _.values @itemGroups
equipped = _.values(@equipment) equipped = _.values(@equipment)
@sortItem(item, equipped) for item in @items.models @sortItem(item, equipped) for item in @items.models
@ -89,6 +89,7 @@ module.exports = class InventoryModal extends ModalView
@itemGroups.lockedItems.add(item) @itemGroups.lockedItems.add(item)
item.classes.push 'locked' item.classes.push 'locked'
item.classes.push 'silhouette' if item.isSilhouettedItem() item.classes.push 'silhouette' if item.isSilhouettedItem()
item.classes.push 'hidden' unless item.get('gems')
else if item.get('slug') in _.values(LevelOptions[@options.levelID]?.restrictedGear ? {}) else if item.get('slug') in _.values(LevelOptions[@options.levelID]?.restrictedGear ? {})
@itemGroups.restrictedItems.add(item) @itemGroups.restrictedItems.add(item)
item.classes.push 'restricted' item.classes.push 'restricted'

View file

@ -83,7 +83,7 @@ module.exports = class PlayItemsModal extends ModalView
category = slotToCategory[model.getAllowedSlots()[0]] or 'misc' category = slotToCategory[model.getAllowedSlots()[0]] or 'misc'
@itemCategoryCollections[category] ?= new Backbone.Collection() @itemCategoryCollections[category] ?= new Backbone.Collection()
collection = @itemCategoryCollections[category] collection = @itemCategoryCollections[category]
collection.comparator = 'gems' collection.comparator = (m) -> m.get('gems') ? m.get('tier')
collection.add(model) collection.add(model)
model.name = utils.i18n model.attributes, 'name' model.name = utils.i18n model.attributes, 'name'
model.affordable = cost <= gemsOwned model.affordable = cost <= gemsOwned