- Rewrite exports of debuffPotion functions
- Force clear debuffPotions in setDebuffPotionItems to make the same behavior as in develop branch
- Change class of debuffPotion items to shop_{key}
- Resolve lint warnings
This commit is contained in:
Xaz16
2019-10-29 00:27:41 +03:00
parent 60a12e8090
commit aedabd2266
8 changed files with 30 additions and 29 deletions

View File

@@ -1,7 +1,13 @@
import getDebuffPotionItems from './getDebuffPotionItems';
function clearDebuffPotion (user) {
return user.pinnedItems.filter(item => item.type !== 'debuffPotion');
}
export default function setDebuffPotionItems (user) {
user.pinnedItems = clearDebuffPotion(user);
module.exports = function setDebuffPotionItems (user) {
const debuffPotionItems = getDebuffPotionItems(user);
if (debuffPotionItems.length) {
@@ -18,13 +24,7 @@ module.exports = function setDebuffPotionItems (user) {
if (!isUserHaveDebuffInPinnedItems) {
user.pinnedItems.push(...debuffPotionItems);
}
} else {
user.pinnedItems = user.pinnedItems.filter(item => {
return item.type !== 'debuffPotion';
});
}
return user;
};
}