mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-03 12:40:00 +00:00
add potion & reroll to itemstore, add taskDefaults helper
This commit is contained in:
parent
bff1b50e42
commit
6a3b2fc1a1
4 changed files with 2178 additions and 2086 deletions
File diff suppressed because one or more lines are too long
4205
browser/browser.js
4205
browser/browser.js
File diff suppressed because it is too large
Load diff
|
|
@ -55,6 +55,22 @@ module.exports =
|
|||
|
||||
uuid: uuid
|
||||
|
||||
taskDefaults: (task, filters={}) ->
|
||||
self = @
|
||||
defaults =
|
||||
id: self.uuid()
|
||||
text: ''
|
||||
up: true
|
||||
down: true
|
||||
type: 'habit'
|
||||
completed: false
|
||||
repeat: {su:true,m:true,t:true,w:true,th:true,f:true,s:true}
|
||||
notes: ''
|
||||
tags: _.transform(filters, (m,v,k) -> m[k]=v if v)
|
||||
_.defaults task, defaults
|
||||
task.value ?= if task.type is 'reward' then 10 else 0
|
||||
task
|
||||
|
||||
newUser: (isDerby=false) ->
|
||||
userSchema =
|
||||
# _id / id handled by Racer
|
||||
|
|
|
|||
|
|
@ -109,7 +109,9 @@ module.exports.updateStore = (user) ->
|
|||
else if i is items[type].length
|
||||
showNext = false
|
||||
changes[type] = if showNext then items[type][i] else {hide:true}
|
||||
return changes
|
||||
changes.potion = items.potion
|
||||
changes.reroll = items.reroll
|
||||
changes
|
||||
|
||||
###
|
||||
Gets an itme, and caps max to the last item in its array
|
||||
|
|
|
|||
Loading…
Reference in a new issue