mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-02 04:00:36 +00:00
algos bug fixes
This commit is contained in:
parent
abb1c7947b
commit
93b629c901
1 changed files with 8 additions and 3 deletions
|
|
@ -1,11 +1,15 @@
|
|||
moment = require('moment')
|
||||
_ = require('lodash')
|
||||
|
||||
helpers = require('./helpers')
|
||||
items = require('./items')
|
||||
{pets, hatchingPotions} = items.items
|
||||
|
||||
XP = 15
|
||||
HP = 2
|
||||
obj = module.exports = {}
|
||||
|
||||
|
||||
obj.priorityValue = (priority = '!') ->
|
||||
switch priority
|
||||
when '!' then 1
|
||||
|
|
@ -108,7 +112,7 @@ randomDrop = (user, delta, priority, streak = 0, paths) ->
|
|||
|
||||
# Egg, 40% chance
|
||||
if rarity > .6
|
||||
drop = randomVal(pets)
|
||||
drop = helpers.randomVal(pets)
|
||||
(user.items.eggs ?= []).push drop; paths['items.eggs'] = true
|
||||
drop.type = 'Egg'
|
||||
drop.dialog = "You've found a #{drop.text} Egg! #{drop.notes}"
|
||||
|
|
@ -141,13 +145,14 @@ randomDrop = (user, delta, priority, streak = 0, paths) ->
|
|||
|
||||
acceptableDrops = hatchingPotions.filter (hatchingPotion) ->
|
||||
hatchingPotion.name in acceptableDrops
|
||||
drop = randomVal acceptableDrops
|
||||
drop = helpers.randomVal acceptableDrops
|
||||
(user.items.hatchingPotions ?= []).push drop.name; paths['items.hatchingPotions'] = true
|
||||
drop.type = 'HatchingPotion'
|
||||
drop.dialog = "You've found a #{drop.text} Hatching Potion! #{drop.notes}"
|
||||
|
||||
# if they've dropped something, we want the consuming client to know so they can notify the user. See how the Derby
|
||||
# app handles it for example. Would this be better handled as an emit() ?
|
||||
(user._tmp?={}).drop = drop
|
||||
#FIXME $('#item-dropped-modal').modal 'show'
|
||||
|
||||
user.items.lastDrop.date = +new Date
|
||||
user.items.lastDrop.count++
|
||||
|
|
|
|||
Loading…
Reference in a new issue