From fe697898ee4347062c2e0ad33a9db571818dc6bd Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Wed, 15 May 2024 12:05:30 +0200 Subject: [PATCH] Fix featured items --- website/common/locales/en/gear.json | 2 +- website/common/locales/en_GB/gear.json | 2 +- website/common/locales/es/gear.json | 2 +- website/common/locales/es_419/gear.json | 2 +- .../common/script/content/shop-featuredItems.js | 14 +++++++++++++- .../common/script/libs/shops-seasonal.config.js | 9 ++++++++- website/common/script/libs/shops.js | 12 ++---------- 7 files changed, 27 insertions(+), 16 deletions(-) diff --git a/website/common/locales/en/gear.json b/website/common/locales/en/gear.json index 41aad2b305..c5d449d873 100644 --- a/website/common/locales/en/gear.json +++ b/website/common/locales/en/gear.json @@ -5,7 +5,7 @@ "groupBy": "Group By <%= type %>", "classBonus": "(This item matches your class, so it gets an additional 1.5 Stat multiplier.)", "classArmor": "Class Armor", - "featuredset": "Featured Set <%= name %>", + "featuredset": "Featured Set: <%= name %>", "mysterySets": "Mystery Sets", "gearNotOwned": "You do not own this item.", "noGearItemsOfType": "You don't own any of these.", diff --git a/website/common/locales/en_GB/gear.json b/website/common/locales/en_GB/gear.json index d1626fd63e..4a2f9352ac 100644 --- a/website/common/locales/en_GB/gear.json +++ b/website/common/locales/en_GB/gear.json @@ -5,7 +5,7 @@ "groupBy": "Group By <%= type %>", "classBonus": "(This item matches your class, so it gets an additional 1.5 Stat multiplier.)", "classArmor": "Class Armour", - "featuredset": "Featured Set <%= name %>", + "featuredset": "Featured Set: <%= name %>", "mysterySets": "Mystery Sets", "gearNotOwned": "You do not own this item.", "noGearItemsOfType": "You don't own any of these.", diff --git a/website/common/locales/es/gear.json b/website/common/locales/es/gear.json index d2d628a22e..b1cdcfda01 100644 --- a/website/common/locales/es/gear.json +++ b/website/common/locales/es/gear.json @@ -5,7 +5,7 @@ "groupBy": "Agrupar por <%= type %>", "classBonus": "(Este equipamiento es de tu clase por lo que gana un multiplicador de 1,5 a sus atributos)", "classArmor": "Armadura de clase", - "featuredset": "Conjunto destacado <%= name %>", + "featuredset": "Conjunto destacado: <%= name %>", "mysterySets": "Conjuntos misteriosos", "gearNotOwned": "No tienes este objeto.", "noGearItemsOfType": "No tienes ninguno de estos.", diff --git a/website/common/locales/es_419/gear.json b/website/common/locales/es_419/gear.json index 70ecc0d0e3..3f8662ccbc 100644 --- a/website/common/locales/es_419/gear.json +++ b/website/common/locales/es_419/gear.json @@ -5,7 +5,7 @@ "groupBy": "Agrupar Por <%= type %>", "classBonus": "(Este artículo coincide con tu clase, por lo que gana un multiplicador de Atributos de 1.5)", "classArmor": "Armadura de Clase", - "featuredset": "Conjunto Destacado <%= name %>", + "featuredset": "Conjunto Destacado: <%= name %>", "mysterySets": "Conjuntos Misteriosos", "gearNotOwned": "No posees este artículo.", "noGearItemsOfType": "No posees ninguno de estos.", diff --git a/website/common/script/content/shop-featuredItems.js b/website/common/script/content/shop-featuredItems.js index 74ffb6a5f5..d898df5827 100644 --- a/website/common/script/content/shop-featuredItems.js +++ b/website/common/script/content/shop-featuredItems.js @@ -41,7 +41,19 @@ const featuredItems = { }); return featured; }, - seasonal: 'spring2019CloudRogueSet', + seasonal () { + const featured = []; + const itemKeys = getScheduleMatchingGroup('premiumHatchingPotions').items; + itemKeys.forEach(itemKey => { + if (featured.length < 4) { + featured.push({ + type: 'premiumHatchingPotion', + path: `premiumHatchingPotions.${itemKey}`, + }); + } + }); + return featured; + }, timeTravelers: [ // TODO ], diff --git a/website/common/script/libs/shops-seasonal.config.js b/website/common/script/libs/shops-seasonal.config.js index cdce3530c5..9216c713d7 100644 --- a/website/common/script/libs/shops-seasonal.config.js +++ b/website/common/script/libs/shops-seasonal.config.js @@ -18,8 +18,15 @@ function getCurrentSeasonalSets (currentEvent) { export default () => { const currentEvent = getCurrentGalaKey(); + const pinnedSets = getCurrentSeasonalSets(currentEvent) return { currentSeason: currentEvent ? upperFirst(currentEvent) : 'Closed', - pinnedSets: getCurrentSeasonalSets(currentEvent), + pinnedSets, + featuredSet: user => { + if (user.stats.class) { + return pinnedSets[user.stats.class]; + } + return null; + }, }; }; diff --git a/website/common/script/libs/shops.js b/website/common/script/libs/shops.js index 7c45e6251e..01bba11c9c 100644 --- a/website/common/script/libs/shops.js +++ b/website/common/script/libs/shops.js @@ -458,8 +458,6 @@ 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'), @@ -468,14 +466,8 @@ shops.getSeasonalShop = function getSeasonalShop (user, language) { opened: true, categories: this.getSeasonalShopCategories(user, language, shopConfig), featured: { - text: i18n.t(shopConfig.featuredSet), - items: shops.getSeasonalGearBySet( - user, - shopConfig.featuredSet, - officialPinnedItems, - language, - true, - ), + text: i18n.t(shopConfig.featuredSet(user)), + items: officialPinnedItems.map(i => getItemInfo(user, i.type, get(content, i.path))), }, };