Fix: Antidotes to Avatar Transformation Items should be added to Rewards by API (#11353)

* Fix: moved debuffPotions from vue component

- Move logic of choosing proper debuf potion from vue component to website commons
- introduce new function to get debuffSpellItems

* Fix: move debuffPotions to server

* Refactoring: move setting of debuff potion to func

* Fix: sanity

* Refactoring & Tests:

- Create test case for get and set DebuffPotionItems functions
- Fix setDebuffPotionItems function to not create duplicated debuff items
- Make debuff potion type of items unpinnable
- Move list of debuffs to constant to reuse it in tests and functions

* Fix: typo in test describe

* Fix: translation of unpin

* Fix: setDebuffPotionItems on cron buffs reset

* Fix: use full path for debuff potions
This commit is contained in:
Aleksey
2019-10-06 19:41:39 +03:00
committed by Matteo Pagliazzi
parent 85eab76a71
commit 5b57d91a9b
14 changed files with 214 additions and 35 deletions

View File

@@ -273,7 +273,6 @@ import BuyQuestModal from 'client/components/shops/quests/buyQuestModal.vue';
import notifications from 'client/mixins/notifications';
import { shouldDo } from 'common/script/cron';
import inAppRewards from 'common/script/libs/inAppRewards';
import spells from 'common/script/content/spells';
import taskDefaults from 'common/script/libs/taskDefaults';
import {
@@ -383,26 +382,6 @@ export default {
let watchRefresh = this.forceRefresh; // eslint-disable-line
let rewards = inAppRewards(this.user);
// Add season rewards if user is affected
// @TODO: Add buff conditional
const seasonalSkills = {
snowball: 'salt',
spookySparkles: 'opaquePotion',
shinySeed: 'petalFreePotion',
seafoam: 'sand',
};
for (let key in seasonalSkills) {
if (this.getUserBuffs(key)) {
let debuff = seasonalSkills[key];
let item = Object.assign({}, spells.special[debuff]);
item.text = item.text();
item.notes = item.notes();
item.class = `shop_${key}`;
rewards.push(item);
}
}
return rewards;
},
hasRewardsList () {