misc fixes - sep 17 (#9045)

* not locking pre-owned gear - pin removed gear on revive

* fix createAnimal (check for function) - hide pet-popover while dragging food

* fix dragging popover text color

* fix drop toasts

* selectMembersModal: load members on item change
This commit is contained in:
negue
2017-09-19 22:45:28 +02:00
committed by GitHub
parent b1652ddd97
commit 2cb9228a7c
9 changed files with 68 additions and 29 deletions

View File

@@ -102,6 +102,13 @@ shops.checkMarketGearLocked = function checkMarketGearLocked (user, items) {
if (gear.canOwn) {
gear.locked = !gear.canOwn(user);
}
let itemOwned = user.items.gear.owned[gear.key];
if (itemOwned === false) {
gear.locked = false;
}
}
};

View File

@@ -10,6 +10,19 @@ const officialPinnedItems = content.officialPinnedItems;
import updateStore from '../libs/updateStore';
function addPinnedGear (user, type, path) {
const foundIndex = user.pinnedItems.findIndex(pinnedItem => {
return pinnedItem.path === path;
});
if (foundIndex === -1) {
user.pinnedItems.push({
type,
path,
});
}
}
function addPinnedGearByClass (user) {
if (user.flags.classSelected) {
let newPinnedItems = updateStore(user);
@@ -17,16 +30,7 @@ function addPinnedGearByClass (user) {
for (let item of newPinnedItems) {
let itemInfo = getItemInfo(user, 'marketGear', item);
const foundIndex = user.pinnedItems.findIndex(pinnedItem => {
return pinnedItem.path === itemInfo.path;
});
if (foundIndex === -1) {
user.pinnedItems.push({
type: 'marketGear',
path: itemInfo.path,
});
}
addPinnedGear(user, itemInfo.pinType, itemInfo.path);
}
}
}
@@ -124,6 +128,7 @@ function togglePinnedItem (user, {item, type, path}, req = {}) {
module.exports = {
addPinnedGearByClass,
addPinnedGear,
removePinnedGearByClass,
removePinnedGearAddPossibleNewOnes,
togglePinnedItem,

View File

@@ -9,7 +9,8 @@ import {
import randomVal from '../libs/randomVal';
import predictableRandom from '../fns/predictableRandom';
import { removePinnedGearByClass, addPinnedGearByClass } from './pinnedGearUtils';
import { removePinnedGearByClass, addPinnedGearByClass, addPinnedGear } from './pinnedGearUtils';
import getItemInfo from '../libs/getItemInfo';
module.exports = function revive (user, req = {}, analytics) {
if (user.stats.hp > 0) {
@@ -89,6 +90,9 @@ module.exports = function revive (user, req = {}, analytics) {
addPinnedGearByClass(user);
let itemInfo = getItemInfo(user, 'marketGear', item);
addPinnedGear(user, itemInfo.pinType, itemInfo.path);
if (user.items.gear.equipped[item.type] === lostItem) {
user.items.gear.equipped[item.type] = `${item.type}_base_0`;
}