Merge branch 'release' into sabrecat/veggie-potions
This commit is contained in:
@@ -4,6 +4,7 @@ import getOfficialPinnedItems from './getOfficialPinnedItems';
|
||||
import compactArray from 'lodash/compact';
|
||||
|
||||
import getItemByPathAndType from './getItemByPathAndType';
|
||||
import {checkPinnedAreasForNullEntries} from '../ops/pinnedGearUtils';
|
||||
|
||||
/**
|
||||
* Orders the pinned items so we always get our inAppRewards in the order
|
||||
@@ -32,6 +33,8 @@ function sortInAppRewards (user, items) {
|
||||
}
|
||||
|
||||
module.exports = function getPinnedItems (user) {
|
||||
checkPinnedAreasForNullEntries(user);
|
||||
|
||||
let officialPinnedItems = getOfficialPinnedItems(user);
|
||||
|
||||
const officialPinnedItemsNotUnpinned = officialPinnedItems.filter(officialPin => {
|
||||
@@ -41,11 +44,12 @@ module.exports = function getPinnedItems (user) {
|
||||
|
||||
const pinnedItems = officialPinnedItemsNotUnpinned.concat(user.pinnedItems);
|
||||
|
||||
let items = pinnedItems.map(({type, path}) => {
|
||||
let item = getItemByPathAndType(type, path);
|
||||
let items = pinnedItems
|
||||
.map(({type, path}) => {
|
||||
let item = getItemByPathAndType(type, path);
|
||||
|
||||
return getItemInfo(user, type, item, officialPinnedItems);
|
||||
});
|
||||
return getItemInfo(user, type, item, officialPinnedItems);
|
||||
});
|
||||
|
||||
shops.checkMarketGearLocked(user, items);
|
||||
|
||||
|
||||
@@ -107,7 +107,8 @@ function getClassName (classType, language) {
|
||||
// TODO Refactor the `.locked` logic
|
||||
shops.checkMarketGearLocked = function checkMarketGearLocked (user, items) {
|
||||
let result = filter(items, ['pinType', 'marketGear']);
|
||||
let availableGear = map(updateStore(user), (item) => getItemInfo(user, 'marketGear', item).path);
|
||||
const officialPinnedItems = getOfficialPinnedItems(user);
|
||||
let availableGear = map(updateStore(user), (item) => getItemInfo(user, 'marketGear', item, officialPinnedItems).path);
|
||||
for (let gear of result) {
|
||||
if (gear.klass !== user.stats.class) {
|
||||
gear.locked = true;
|
||||
|
||||
@@ -10,7 +10,7 @@ function equipmentStatBonusComputed (stat, user) {
|
||||
let classBonus = 0;
|
||||
|
||||
// toObject is required here due to lodash values not working well with mongoose doc objects.
|
||||
// if toObject doesn't exist, we're on the client side and can assume the object is already plain JSON
|
||||
// if toObject doesn't exist, we can assume the object is already plain JSON
|
||||
// see http://stackoverflow.com/questions/25767334/underscore-js-keys-and-omit-not-working-as-expected
|
||||
let equipped = user.items.gear.equipped;
|
||||
let equippedKeys = values(!equipped.toObject ? equipped : equipped.toObject());
|
||||
|
||||
Reference in New Issue
Block a user