Now able to suggest required items for purchase before level start.

This commit is contained in:
Nick Winter 2014-12-24 11:01:39 -08:00
parent 2e9e9ee85c
commit 1c1f2008a5
5 changed files with 38 additions and 24 deletions

View file

@ -327,41 +327,41 @@ module.exports = LevelOptions =
requiredGear: {}
restrictedGear: {}
'the-mighty-sand-yak':
#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.
requiredGear: {neck: 'rough-sense-stone'}
restrictedGear: {flag: 'basic-flags'}
'oasis':
requiredGear: {}
requiredGear: {neck: 'rough-sense-stone'}
restrictedGear: {flag: 'basic-flags'}
'sarven-road':
requiredGear: {}
requiredGear: {neck: 'rough-sense-stone'}
restrictedGear: {flag: 'basic-flags'}
'sarven-gaps':
requiredGear: {'right-hand': 'crude-builders-hammer'}
requiredGear: {'right-hand': 'crude-builders-hammer', neck: 'rough-sense-stone'}
restrictedGear: {flag: 'basic-flags'}
'thunderhooves':
requiredGear: {'right-hand': 'crude-builders-hammer'}
requiredGear: {'right-hand': 'crude-builders-hammer', neck: 'rough-sense-stone'}
restrictedGear: {flag: 'basic-flags'}
'medical-attention':
requiredGear: {'right-hand': 'long-sword'}, #neck: 'polished-sense-stone'} # We don't have a way to require players to buy it yet.
restrictedGear: {'right-hand': 'crude-builders-hammer', flag: 'basic-flags'}
requiredGear: {'right-hand': 'long-sword', neck: 'polished-sense-stone'}
restrictedGear: {'right-hand': 'crude-builders-hammer', flag: 'basic-flags', neck: 'rough-sense-stone'}
'minesweeper':
requiredGear: {}
restrictedGear: {flag: 'basic-flags'}
requiredGear: {neck: 'polished-sense-stone'}
restrictedGear: {flag: 'basic-flags', neck: 'rough-sense-stone'}
'sarven-sentry':
requiredGear: {'right-hand': 'crude-builders-hammer', flag: 'basic-flags'}
requiredGear: {'right-hand': 'crude-builders-hammer', flag: 'basic-flags', neck: 'polished-sense-stone'}
restrictedGear: {}
'keeping-time':
requiredGear: {} # watch
restrictedGear: {}
requiredGear: {wrists: 'simple-wristwatch'}
restrictedGear: {wrists: 'sundial-wristwatch'}
'hoarding-gold':
requiredGear: {}
restrictedGear: {}
requiredGear: {neck: 'quartz-sense-stone'}
restrictedGear: {neck: 'polished-sense-stone'}
'decoy-drill':
requiredGear: {} # new builder's hammer
restrictedGear: {}
requiredGear: {'right-hand': 'wooden-builders-hammer', neck: 'quartz-sense-stone'}
restrictedGear: {neck: 'polished-sense-stone'}
'yakstraction':
requiredGear: {} # new builder's hammer
restrictedGear: {}
requiredGear: {'right-hand': 'wooden-builders-hammer', flag: 'basic-flags'}
restrictedGear: {'right-hand': 'crude-builders-hammer'}
'sarven-brawl':
requiredGear: {}
restrictedGear: {}

View file

@ -329,6 +329,7 @@
inventory:
choose_inventory: "Equip Items"
equipped_item: "Equipped"
required_purchase_title: "Required"
available_item: "Available"
restricted_title: "Restricted"
should_equip: "(double-click to equip)"

View file

@ -28,6 +28,14 @@
.nano
.nano-content
if itemGroups
if itemGroups.requiredPurchaseItems.models.length
h4#required-purchase-description(data-i18n="inventory.required_purchase_title")
for item in itemGroups.requiredPurchaseItems.models
if selectedHeroClass && item.classes.indexOf(selectedHeroClass) > -1
.item(class=item.classes, data-item-id=item.id)
img(draggable="false")
.clearfix
if itemGroups.availableItems.models.length
h4#available-description(data-i18n="inventory.available_item")
for item in itemGroups.availableItems.models

View file

@ -998,7 +998,6 @@ desert = [
continue: 'sarven-gaps'
x: 28.36
y: 24.59
adventurer: true
requiresSubscription: false
}
{
@ -1011,7 +1010,6 @@ desert = [
continue: 'thunderhooves'
x: 21.13
y: 9.29
adventurer: true
requiresSubscription: true
}
{
@ -1024,7 +1022,6 @@ desert = [
continue: 'medical-attention'
x: 35.08
y: 20.48
adventurer: true
requiresSubscription: false
}
{
@ -1037,7 +1034,6 @@ desert = [
continue: 'minesweeper'
x: 42.84
y: 21.82
adventurer: true
requiresSubscription: false
}
{
@ -1050,7 +1046,6 @@ desert = [
continue: 'sarven-sentry'
x: 47.64
y: 12.40
adventurer: true
requiresSubscription: true
}
{

View file

@ -72,6 +72,7 @@ module.exports = class InventoryModal extends ModalView
@equipment = $.extend true, {}, @equipment
@requireLevelEquipment()
@itemGroups = {}
@itemGroups.requiredPurchaseItems = new Backbone.Collection()
@itemGroups.availableItems = new Backbone.Collection()
@itemGroups.restrictedItems = new Backbone.Collection()
@itemGroups.lockedItems = new Backbone.Collection()
@ -95,6 +96,9 @@ module.exports = class InventoryModal extends ModalView
if not item.getFrontFacingStats().props.length and not _.size(item.getFrontFacingStats().stats) and locked # Temp: while there are placeholder items
null # Don't put into a collection
if locked and item.get('slug') in _.values(LevelOptions[@options.levelID]?.requiredGear ? {})
item.classes.push 'locked'
@itemGroups.requiredPurchaseItems.add item
else if locked and item.get('slug') isnt 'simple-boots'
item.classes.push 'locked'
if item.isSilhouettedItem() or not item.get('gems')
@ -309,6 +313,8 @@ module.exports = class InventoryModal extends ModalView
itemIDToUnequip = itemEl.data('item-id')
return unless itemIDToUnequip
itemEl.remove()
item = @items.get itemIDToUnequip
item.classes = _.without item.classes, 'equipped'
@$el.find("#unequipped .item[data-item-id=#{itemIDToUnequip}]").removeClass('equipped')
deselectAllSlots: ->
@ -382,7 +388,7 @@ module.exports = class InventoryModal extends ModalView
for slot, item of requiredGear
if (slot in ['right-hand', 'left-hand', 'head', 'torso']) and not (heroClass is 'Warrior' or
(heroClass is 'Ranger' and @options.levelID in ['swift-dagger', 'shrapnel']) or
(heroClass is 'Wizard' and @options.levelID in ['touch-of-death', 'bonemender'])) and item isnt 'crude-builders-hammer'
(heroClass is 'Wizard' and @options.levelID in ['touch-of-death', 'bonemender'])) and not (item in ['crude-builders-hammer', 'wooden-builders-hammer'])
# After they switch to a ranger or wizard, we stop being so finicky about class-specific gear.
continue
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
@ -488,6 +494,7 @@ module.exports = class InventoryModal extends ModalView
#- ...then rerender key bits
@itemGroups.lockedItems.remove(item)
@itemGroups.requiredPurchaseItems.remove(item)
# Redo all item sorting to make sure that we don't clobber state changes since last render.
equipped = _.values @getCurrentEquipmentConfig()
@sortItem(otherItem, equipped) for otherItem in @items.models
@ -629,3 +636,6 @@ gear =
'book-of-life-i': '546375653839c6e02811d30b'
'rough-sense-stone': '54693140a2b1f53ce79443bc'
'polished-sense-stone': '53e215a253457600003e3eaf'
'quartz-sense-stone': '54693240a2b1f53ce79443c5'
'wooden-builders-hammer': '54694ba3a2b1f53ce794444d'
'simple-wristwatch': '54693797a2b1f53ce79443e9'