mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-04 17:19:47 -04:00
Hiding items with no stats or properties in the item shop for non-admins. Simple Boots show as owned. Enabled item shop for non-admins.
This commit is contained in:
parent
e7e2acf4db
commit
ff1f9d488c
7 changed files with 16 additions and 5 deletions
app
models
templates/play
views
|
@ -19,6 +19,8 @@ module.exports = class ThangType extends CocoModel
|
|||
'robot-walker': '5301696ad82649ec2c0c9b0d'
|
||||
'michael-heasell': '53e126a4e06b897606d38bef'
|
||||
'ian-elliott': '53e12be0d042f23505c3023b'
|
||||
@items:
|
||||
'simple-boots': '53e237bf53457600003e3f05'
|
||||
urlRoot: '/db/thang.type'
|
||||
building: {}
|
||||
|
||||
|
@ -339,7 +341,7 @@ module.exports = class ThangType extends CocoModel
|
|||
shieldDefenseFactor: 'blocks'
|
||||
visualRange: 'range'
|
||||
}[name]
|
||||
|
||||
|
||||
if i18nKey
|
||||
name = $.i18n.t 'choose_hero.' + i18nKey
|
||||
else
|
||||
|
|
|
@ -2,6 +2,7 @@ GRAVATAR_URL = 'https://www.gravatar.com/'
|
|||
cache = {}
|
||||
CocoModel = require './CocoModel'
|
||||
util = require 'lib/utils'
|
||||
ThangType = require './ThangType'
|
||||
|
||||
module.exports = class User extends CocoModel
|
||||
@className: 'User'
|
||||
|
@ -72,7 +73,7 @@ module.exports = class User extends CocoModel
|
|||
gemsEarned + gemsPurchased - gemsSpent
|
||||
|
||||
heroes: -> (me.get('earned')?.heroes ? []).concat(me.get('purchased')?.heroes ? [])
|
||||
items: -> (me.get('earned')?.items ? []).concat(me.get('purchased')?.items ? [])
|
||||
items: -> (me.get('earned')?.items ? []).concat(me.get('purchased')?.items ? []).concat([ThangType.items['simple-boots']])
|
||||
levels: -> (me.get('earned')?.levels ? []).concat(me.get('purchased')?.levels ? [])
|
||||
ownsHero: (heroOriginal) -> heroOriginal in @heroes()
|
||||
ownsItem: (itemOriginal) -> itemOriginal in @items()
|
||||
|
|
|
@ -25,5 +25,10 @@
|
|||
span.spr :
|
||||
span!= prop.description
|
||||
|
||||
if item.comingSoon
|
||||
.text-center
|
||||
h3 This item has no stats.
|
||||
p Only admins will see it for now.
|
||||
|
||||
if item && !item.owned
|
||||
button#selected-item-unlock-button.btn.big-font.unlock-button(disabled=!item.affordable, data-item-id=item.id, data-i18n="play.unlock") Unlock
|
|
@ -24,7 +24,8 @@
|
|||
.nano
|
||||
.nano-content
|
||||
for item in itemCategoryCollections[category].models
|
||||
.item(data-item-id=item.id)
|
||||
- var hidden = item.comingSoon && !me.isAdmin()
|
||||
div(class="item" + (hidden ? " hide" : ""), data-item-id=item.id)
|
||||
if item.silhouetted && !item.owned
|
||||
span.glyphicon.glyphicon-lock.bolder
|
||||
span.glyphicon.glyphicon-lock
|
||||
|
|
|
@ -33,8 +33,8 @@
|
|||
button.btn.btn-success.btn-lg.start-level(data-i18n="common.play") Play
|
||||
|
||||
.game-controls.header-font
|
||||
button.btn.items(data-toggle='coco-modal', data-target='play/modal/PlayItemsModal', data-i18n="[title]play.items")
|
||||
if me.isAdmin()
|
||||
button.btn.items(data-toggle='coco-modal', data-target='play/modal/PlayItemsModal', data-i18n="[title]play.items")
|
||||
button.btn.heroes(data-toggle='coco-modal', data-target='play/modal/PlayHeroesModal', data-i18n="[title]play.heroes")
|
||||
button.btn.achievements(data-toggle='coco-modal', data-target='play/modal/PlayAchievementsModal', data-i18n="[title]play.achievements")
|
||||
if me.isAdmin()
|
||||
|
|
|
@ -398,7 +398,7 @@ module.exports = class InventoryView extends CocoView
|
|||
for slot, item of items
|
||||
@allowedItems.push gear[item] unless gear[item] in @allowedItems
|
||||
break if level is @options.levelID
|
||||
for item in me.get('earned')?.items ? [] when not (item in @allowedItems)
|
||||
for item in me.items() when not (item in @allowedItems)
|
||||
@allowedItems.push item
|
||||
|
||||
onHeroSelectionUpdated: (e) ->
|
||||
|
|
|
@ -90,6 +90,8 @@ module.exports = class PlayItemsModal extends ModalView
|
|||
model.owned = me.ownsItem model.get('original')
|
||||
model.silhouetted = model.isSilhouettedItem()
|
||||
model.equippable = 'Warrior' in model.getAllowedHeroClasses() # Temp: while there are no wizards/rangers
|
||||
model.comingSoon = not model.getFrontFacingStats().props.length and not _.size model.getFrontFacingStats().stats # Temp: while there are placeholder items
|
||||
console.log model.name, 'is comingSoon?', model.comingSoon, model.getFrontFacingStats()
|
||||
@idToItem[model.id] = model
|
||||
|
||||
if needMore
|
||||
|
|
Loading…
Add table
Reference in a new issue