diff --git a/website/common/locales/bg/limited.json b/website/common/locales/bg/limited.json index 81f2be97f2..e8ec8e5163 100644 --- a/website/common/locales/bg/limited.json +++ b/website/common/locales/bg/limited.json @@ -158,5 +158,5 @@ "spring2019RobinHealerSet": "Червеношийка (лечител)", "spring2019AmberMageSet": "Кехлибар (Магьосник)", "spring2019OrchidWarriorSet": "Орхидея (воин)", - "june2018": "Юни 2018", + "june2018": "Юни 2018" } diff --git a/website/common/locales/nl/limited.json b/website/common/locales/nl/limited.json index b12626bbfa..241939b3a6 100644 --- a/website/common/locales/nl/limited.json +++ b/website/common/locales/nl/limited.json @@ -199,5 +199,5 @@ "spring2022MagpieRogueSet": "Ekster (Dief)", "spring2022RainstormWarriorSet": "Regenstorm (Krijger)", "spring2022ForsythiaMageSet": "Forsythia (Magiër)", - "spring2022PeridotHealerSet": "Peridoot (Genezer)", + "spring2022PeridotHealerSet": "Peridoot (Genezer)" } diff --git a/website/common/locales/tr/limited.json b/website/common/locales/tr/limited.json index d80e2e7821..495e8faa24 100644 --- a/website/common/locales/tr/limited.json +++ b/website/common/locales/tr/limited.json @@ -140,5 +140,5 @@ "summer2019WaterLilyMageSet": "Nilüfer (Büyücü)", "summer2019SeaTurtleWarriorSet": "Deniz Kaplumbağası (Savaşçı)", "spring2019AmberMageSet": "Kehribar (Sihirbaz)", - "royalPurpleJackolantern": "Soylu Mor Balkabağı Feneri", - } + "royalPurpleJackolantern": "Soylu Mor Balkabağı Feneri" +} diff --git a/website/common/script/libs/getOfficialPinnedItems.js b/website/common/script/libs/getOfficialPinnedItems.js index 72f27b0534..c480b0085c 100644 --- a/website/common/script/libs/getOfficialPinnedItems.js +++ b/website/common/script/libs/getOfficialPinnedItems.js @@ -1,6 +1,6 @@ import toArray from 'lodash/toArray'; import content from '../content/index'; -import SeasonalShopConfig from './shops-seasonal.config'; +import seasonalShopConfig from './shops-seasonal.config'; const { officialPinnedItems } = content; @@ -8,9 +8,9 @@ const flatGearArray = toArray(content.gear.flat); export default function getOfficialPinnedItems (user) { const officialItemsArray = [...officialPinnedItems]; - - if (SeasonalShopConfig.pinnedSets && Boolean(user) && user.stats.class) { - const setToAdd = SeasonalShopConfig.pinnedSets[user.stats.class]; + const { pinnedSets } = seasonalShopConfig(); + if (pinnedSets && Boolean(user) && user.stats.class) { + const setToAdd = pinnedSets[user.stats.class]; // pinnedSets == current seasonal class set are always gold purchaseable diff --git a/website/common/script/libs/shops-seasonal.config.js b/website/common/script/libs/shops-seasonal.config.js index d625dc601f..cdce3530c5 100644 --- a/website/common/script/libs/shops-seasonal.config.js +++ b/website/common/script/libs/shops-seasonal.config.js @@ -6,20 +6,20 @@ import { armor, } from '../content/gear/sets/special'; -const CURRENT_EVENT_KEY = getCurrentGalaKey(); - -function getCurrentSeasonalSets () { +function getCurrentSeasonalSets (currentEvent) { const year = new Date().getFullYear(); return { - rogue: armor[`${CURRENT_EVENT_KEY}${year}Rogue`].set, - warrior: armor[`${CURRENT_EVENT_KEY}${year}Warrior`].set, - wizard: armor[`${CURRENT_EVENT_KEY}${year}Mage`].set, - healer: armor[`${CURRENT_EVENT_KEY}${year}Healer`].set, + rogue: armor[`${currentEvent}${year}Rogue`].set, + warrior: armor[`${currentEvent}${year}Warrior`].set, + wizard: armor[`${currentEvent}${year}Mage`].set, + healer: armor[`${currentEvent}${year}Healer`].set, }; } -export default { - currentSeason: CURRENT_EVENT_KEY ? upperFirst(CURRENT_EVENT_KEY) : 'Closed', - pinnedSets: getCurrentSeasonalSets(), - featuredSet: 'winter2019PoinsettiaSet', +export default () => { + const currentEvent = getCurrentGalaKey(); + return { + currentSeason: currentEvent ? upperFirst(currentEvent) : 'Closed', + pinnedSets: getCurrentSeasonalSets(currentEvent), + }; }; diff --git a/website/common/script/libs/shops.js b/website/common/script/libs/shops.js index 41a59a2b0f..7c45e6251e 100644 --- a/website/common/script/libs/shops.js +++ b/website/common/script/libs/shops.js @@ -102,6 +102,7 @@ shops.checkMarketGearLocked = function checkMarketGearLocked (user, items) { const result = filter(items, ['pinType', 'marketGear']); const officialPinnedItems = getOfficialPinnedItems(user); const availableGear = map(updateStore(user), item => getItemInfo(user, 'marketGear', item, officialPinnedItems).path); + const { pinnedSets } = seasonalShopConfig(); for (const gear of result) { if (gear.klass !== user.stats.class) { gear.locked = true; @@ -122,7 +123,7 @@ shops.checkMarketGearLocked = function checkMarketGearLocked (user, items) { } if (Boolean(gear.specialClass) && Boolean(gear.set)) { - const currentSet = gear.set === seasonalShopConfig.pinnedSets[gear.specialClass]; + const currentSet = gear.set === pinnedSets[gear.specialClass]; gear.locked = currentSet && user.stats.class !== gear.specialClass; } @@ -140,6 +141,7 @@ shops.checkMarketGearLocked = function checkMarketGearLocked (user, items) { shops.getMarketGearCategories = function getMarketGear (user, language) { const categories = []; const officialPinnedItems = getOfficialPinnedItems(user); + const { pinnedSets } = seasonalShopConfig(); for (const classType of content.classes) { const category = { @@ -159,7 +161,7 @@ shops.getMarketGearCategories = function getMarketGear (user, language) { if ( gearItem.specialClass === classType && user.items.gear.owned[gearItem.key] !== false - && gearItem.set === seasonalShopConfig.pinnedSets[gearItem.specialClass] + && gearItem.set === pinnedSets[gearItem.specialClass] ) return gearItem.canOwn(classShift); return false; }); @@ -425,6 +427,7 @@ const flatGearArray = toArray(content.gear.flat); shops.getSeasonalGearBySet = function getSeasonalGearBySet ( user, + shopConfig, set, officialPinnedItems, language, @@ -436,7 +439,7 @@ shops.getSeasonalGearBySet = function getSeasonalGearBySet ( return gear.set === set; }).map(gear => { - const currentSet = gear.set === seasonalShopConfig.pinnedSets[gear.specialClass]; + const currentSet = gear.set === shopConfig.pinnedSets[gear.specialClass]; // only the current season set can be purchased by gold const itemInfo = getItemInfo(null, currentSet ? 'marketGear' : 'gear', gear, officialPinnedItems, language, gearMatcher); @@ -452,20 +455,23 @@ shops.getSeasonalGearBySet = function getSeasonalGearBySet ( }; shops.getSeasonalShop = function getSeasonalShop (user, language) { + const shopConfig = seasonalShopConfig(); const officialPinnedItems = getOfficialPinnedItems(user); + console.log('shopConfig', shopConfig); + const resObject = { identifier: 'seasonalShop', text: i18n.t('seasonalShop'), - notes: i18n.t(`seasonalShop${seasonalShopConfig.currentSeason}Text`), + notes: i18n.t(`seasonalShop${shopConfig.currentSeason}Text`), imageName: 'seasonalshop_open', opened: true, - categories: this.getSeasonalShopCategories(user, language), + categories: this.getSeasonalShopCategories(user, language, shopConfig), featured: { - text: i18n.t(seasonalShopConfig.featuredSet), + text: i18n.t(shopConfig.featuredSet), items: shops.getSeasonalGearBySet( user, - seasonalShopConfig.featuredSet, + shopConfig.featuredSet, officialPinnedItems, language, true, @@ -476,7 +482,7 @@ shops.getSeasonalShop = function getSeasonalShop (user, language) { return resObject; }; -shops.getSeasonalShopCategories = function getSeasonalShopCategories (user, language) { +shops.getSeasonalShopCategories = function getSeasonalShopCategories (user, language, shopConfig) { const officialPinnedItems = getOfficialPinnedItems(user); const spellMatcher = getScheduleMatchingGroup('seasonalSpells'); @@ -525,6 +531,7 @@ shops.getSeasonalShopCategories = function getSeasonalShopCategories (user, lang category.items = shops.getSeasonalGearBySet( user, + shopConfig, set, officialPinnedItems, language,