2017-03-01 16:10:48 +00:00
|
|
|
import each from 'lodash/each';
|
|
|
|
|
import filter from 'lodash/filter';
|
|
|
|
|
import keys from 'lodash/keys';
|
|
|
|
|
import size from 'lodash/size';
|
2015-11-15 14:16:55 +00:00
|
|
|
import content from './content/index';
|
2015-07-21 13:13:50 +00:00
|
|
|
|
2015-12-29 14:03:19 +00:00
|
|
|
const DROP_ANIMALS = keys(content.pets);
|
2015-07-21 13:13:50 +00:00
|
|
|
|
2019-10-01 15:53:48 +00:00
|
|
|
export function beastMasterProgress (pets = {}) {
|
2015-11-15 14:16:55 +00:00
|
|
|
let count = 0;
|
2015-07-21 13:13:50 +00:00
|
|
|
|
2019-10-08 14:57:10 +00:00
|
|
|
each(DROP_ANIMALS, animal => {
|
2019-10-09 14:51:17 +00:00
|
|
|
if (pets[animal] > 0 || pets[animal] === -1) count += 1;
|
2015-12-29 14:03:19 +00:00
|
|
|
});
|
2015-07-21 13:13:50 +00:00
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-01 15:53:48 +00:00
|
|
|
export function beastCount (pets = {}) {
|
2018-03-02 21:30:11 +00:00
|
|
|
let count = 0;
|
|
|
|
|
|
2019-10-08 14:57:10 +00:00
|
|
|
each(DROP_ANIMALS, animal => {
|
2019-10-09 14:51:17 +00:00
|
|
|
if (pets[animal] > 0) count += 1;
|
2018-03-02 21:30:11 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-01 15:53:48 +00:00
|
|
|
export function dropPetsCurrentlyOwned (pets = {}) {
|
2015-11-15 14:16:55 +00:00
|
|
|
let count = 0;
|
2015-07-22 01:14:15 +00:00
|
|
|
|
2019-10-08 14:57:10 +00:00
|
|
|
each(DROP_ANIMALS, animal => {
|
2019-10-09 14:51:17 +00:00
|
|
|
if (pets[animal] > 0) count += 1;
|
2015-12-29 14:03:19 +00:00
|
|
|
});
|
2015-07-22 01:14:15 +00:00
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-01 15:53:48 +00:00
|
|
|
export function mountMasterProgress (mounts = {}) {
|
2015-11-15 14:16:55 +00:00
|
|
|
let count = 0;
|
|
|
|
|
|
2019-10-08 14:57:10 +00:00
|
|
|
each(DROP_ANIMALS, animal => {
|
2019-10-09 14:51:17 +00:00
|
|
|
if (mounts[animal]) count += 1;
|
2015-12-29 14:03:19 +00:00
|
|
|
});
|
2015-07-21 13:13:50 +00:00
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-01 15:53:48 +00:00
|
|
|
export function remainingGearInSet (userGear = {}, set) {
|
2019-10-08 14:57:10 +00:00
|
|
|
const gear = filter(content.gear.flat, item => {
|
|
|
|
|
const setMatches = item.klass === set;
|
|
|
|
|
const hasItem = userGear[item.key];
|
2015-07-21 23:04:48 +00:00
|
|
|
|
|
|
|
|
return setMatches && !hasItem;
|
|
|
|
|
});
|
|
|
|
|
|
2019-10-08 14:57:10 +00:00
|
|
|
const count = size(gear);
|
2015-07-21 23:04:48 +00:00
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-01 15:53:48 +00:00
|
|
|
export function questsOfCategory (userQuests = {}, category) {
|
2019-10-08 14:57:10 +00:00
|
|
|
const quests = filter(content.quests, quest => {
|
|
|
|
|
const categoryMatches = quest.category === category;
|
|
|
|
|
const hasQuest = userQuests[quest.key];
|
2015-08-10 18:42:36 +00:00
|
|
|
|
|
|
|
|
return categoryMatches && hasQuest;
|
|
|
|
|
});
|
|
|
|
|
|
2019-10-08 14:57:10 +00:00
|
|
|
const count = size(quests);
|
2015-08-10 18:42:36 +00:00
|
|
|
|
|
|
|
|
return count;
|
2019-10-08 14:57:10 +00:00
|
|
|
}
|