mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Merge branch 'develop' into sabrecat/party-page
This commit is contained in:
@@ -1452,10 +1452,10 @@ api.wrap = (user, main=true) ->
|
||||
returns random property (the value)
|
||||
###
|
||||
randomVal: (obj, options) ->
|
||||
array = if options?.key then _.keys(obj) else _.values(obj)
|
||||
rand = user.fns.predictableRandom(options?.seed)
|
||||
array.sort()
|
||||
array[Math.floor(rand * array.length)]
|
||||
array = if options?.key then _.keys(obj) else _.values(obj)
|
||||
rand = user.fns.predictableRandom(options?.seed)
|
||||
array.sort()
|
||||
array[Math.floor(rand * array.length)]
|
||||
|
||||
###
|
||||
This allows you to set object properties by dot-path. Eg, you can run pathSet('stats.hp',50,user) which is the same as
|
||||
|
||||
Reference in New Issue
Block a user