mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 13:47:33 +01:00
refactor: Move user argument to options in randomVal function
This commit is contained in:
@@ -58,7 +58,7 @@ module.exports = function randomDrop (user, options, req = {}) {
|
||||
rarity = predictableRandom(user, user.stats.gp);
|
||||
|
||||
if (rarity > 0.6) { // food 40% chance
|
||||
drop = cloneDropItem(randomVal(user, _.where(content.food, {
|
||||
drop = cloneDropItem(randomVal(_.where(content.food, {
|
||||
canDrop: true,
|
||||
})));
|
||||
|
||||
@@ -73,7 +73,7 @@ module.exports = function randomDrop (user, options, req = {}) {
|
||||
dropNotes: drop.notes(req.language),
|
||||
}, req.language);
|
||||
} else if (rarity > 0.3) { // eggs 30% chance
|
||||
drop = cloneDropItem(randomVal(user, content.dropEggs));
|
||||
drop = cloneDropItem(randomVal(content.dropEggs));
|
||||
if (!user.items.eggs[drop.key]) {
|
||||
user.items.eggs[drop.key] = 0;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ module.exports = function randomDrop (user, options, req = {}) {
|
||||
} else { // common, 40% of 30%
|
||||
acceptableDrops = ['Base', 'White', 'Desert'];
|
||||
}
|
||||
drop = cloneDropItem(randomVal(user, _.pick(content.hatchingPotions, (v, k) => {
|
||||
drop = cloneDropItem(randomVal(_.pick(content.hatchingPotions, (v, k) => {
|
||||
return acceptableDrops.indexOf(k) >= 0;
|
||||
})));
|
||||
if (!user.items.hatchingPotions[drop.key]) {
|
||||
|
||||
Reference in New Issue
Block a user