Merge pull request #5775 from HabitRPG/item_store_fix

Split out potion and armoire out of the itemStore object
This commit is contained in:
Blade Barringer
2015-08-12 22:35:54 -05:00
4 changed files with 32 additions and 18 deletions
-3
View File
@@ -190,7 +190,6 @@ preenHistory = (history) ->
Update the in-browser store with new gear. FIXME this was in user.fns, but it was causing strange issues there
###
sortOrder = _.reduce content.gearTypes,((m,v,k)->m[v]=k;m), {}
#sortOrder.potion = _.size(sortOrder) #potion goes last #actually, _.sortBy puts anything else last, so this is unecessary
api.updateStore = (user) ->
return unless user
changes= []
@@ -202,8 +201,6 @@ api.updateStore = (user) ->
# Add special items (contrib gear, backer gear, etc)
changes = changes.concat _.filter content.gear.flat, (v) ->
v.klass in ['special','mystery','armoire'] and !user.items.gear.owned[v.key] and v.canOwn?(user)
changes.push content.potion
if user.flags.armoireEnabled then changes.push content.armoire
# Return sorted store (array)
_.sortBy changes, (c)->sortOrder[c.type]