mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 14:17:22 +01:00
fix seasonal gear
This commit is contained in:
@@ -158,5 +158,5 @@
|
|||||||
"spring2019RobinHealerSet": "Червеношийка (лечител)",
|
"spring2019RobinHealerSet": "Червеношийка (лечител)",
|
||||||
"spring2019AmberMageSet": "Кехлибар (Магьосник)",
|
"spring2019AmberMageSet": "Кехлибар (Магьосник)",
|
||||||
"spring2019OrchidWarriorSet": "Орхидея (воин)",
|
"spring2019OrchidWarriorSet": "Орхидея (воин)",
|
||||||
"june2018": "Юни 2018",
|
"june2018": "Юни 2018"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,5 +199,5 @@
|
|||||||
"spring2022MagpieRogueSet": "Ekster (Dief)",
|
"spring2022MagpieRogueSet": "Ekster (Dief)",
|
||||||
"spring2022RainstormWarriorSet": "Regenstorm (Krijger)",
|
"spring2022RainstormWarriorSet": "Regenstorm (Krijger)",
|
||||||
"spring2022ForsythiaMageSet": "Forsythia (Magiër)",
|
"spring2022ForsythiaMageSet": "Forsythia (Magiër)",
|
||||||
"spring2022PeridotHealerSet": "Peridoot (Genezer)",
|
"spring2022PeridotHealerSet": "Peridoot (Genezer)"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,5 +140,5 @@
|
|||||||
"summer2019WaterLilyMageSet": "Nilüfer (Büyücü)",
|
"summer2019WaterLilyMageSet": "Nilüfer (Büyücü)",
|
||||||
"summer2019SeaTurtleWarriorSet": "Deniz Kaplumbağası (Savaşçı)",
|
"summer2019SeaTurtleWarriorSet": "Deniz Kaplumbağası (Savaşçı)",
|
||||||
"spring2019AmberMageSet": "Kehribar (Sihirbaz)",
|
"spring2019AmberMageSet": "Kehribar (Sihirbaz)",
|
||||||
"royalPurpleJackolantern": "Soylu Mor Balkabağı Feneri",
|
"royalPurpleJackolantern": "Soylu Mor Balkabağı Feneri"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import toArray from 'lodash/toArray';
|
import toArray from 'lodash/toArray';
|
||||||
import content from '../content/index';
|
import content from '../content/index';
|
||||||
import SeasonalShopConfig from './shops-seasonal.config';
|
import seasonalShopConfig from './shops-seasonal.config';
|
||||||
|
|
||||||
const { officialPinnedItems } = content;
|
const { officialPinnedItems } = content;
|
||||||
|
|
||||||
@@ -8,9 +8,9 @@ const flatGearArray = toArray(content.gear.flat);
|
|||||||
|
|
||||||
export default function getOfficialPinnedItems (user) {
|
export default function getOfficialPinnedItems (user) {
|
||||||
const officialItemsArray = [...officialPinnedItems];
|
const officialItemsArray = [...officialPinnedItems];
|
||||||
|
const { pinnedSets } = seasonalShopConfig();
|
||||||
if (SeasonalShopConfig.pinnedSets && Boolean(user) && user.stats.class) {
|
if (pinnedSets && Boolean(user) && user.stats.class) {
|
||||||
const setToAdd = SeasonalShopConfig.pinnedSets[user.stats.class];
|
const setToAdd = pinnedSets[user.stats.class];
|
||||||
|
|
||||||
// pinnedSets == current seasonal class set are always gold purchaseable
|
// pinnedSets == current seasonal class set are always gold purchaseable
|
||||||
|
|
||||||
|
|||||||
@@ -6,20 +6,20 @@ import {
|
|||||||
armor,
|
armor,
|
||||||
} from '../content/gear/sets/special';
|
} from '../content/gear/sets/special';
|
||||||
|
|
||||||
const CURRENT_EVENT_KEY = getCurrentGalaKey();
|
function getCurrentSeasonalSets (currentEvent) {
|
||||||
|
|
||||||
function getCurrentSeasonalSets () {
|
|
||||||
const year = new Date().getFullYear();
|
const year = new Date().getFullYear();
|
||||||
return {
|
return {
|
||||||
rogue: armor[`${CURRENT_EVENT_KEY}${year}Rogue`].set,
|
rogue: armor[`${currentEvent}${year}Rogue`].set,
|
||||||
warrior: armor[`${CURRENT_EVENT_KEY}${year}Warrior`].set,
|
warrior: armor[`${currentEvent}${year}Warrior`].set,
|
||||||
wizard: armor[`${CURRENT_EVENT_KEY}${year}Mage`].set,
|
wizard: armor[`${currentEvent}${year}Mage`].set,
|
||||||
healer: armor[`${CURRENT_EVENT_KEY}${year}Healer`].set,
|
healer: armor[`${currentEvent}${year}Healer`].set,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default () => {
|
||||||
currentSeason: CURRENT_EVENT_KEY ? upperFirst(CURRENT_EVENT_KEY) : 'Closed',
|
const currentEvent = getCurrentGalaKey();
|
||||||
pinnedSets: getCurrentSeasonalSets(),
|
return {
|
||||||
featuredSet: 'winter2019PoinsettiaSet',
|
currentSeason: currentEvent ? upperFirst(currentEvent) : 'Closed',
|
||||||
|
pinnedSets: getCurrentSeasonalSets(currentEvent),
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ shops.checkMarketGearLocked = function checkMarketGearLocked (user, items) {
|
|||||||
const result = filter(items, ['pinType', 'marketGear']);
|
const result = filter(items, ['pinType', 'marketGear']);
|
||||||
const officialPinnedItems = getOfficialPinnedItems(user);
|
const officialPinnedItems = getOfficialPinnedItems(user);
|
||||||
const availableGear = map(updateStore(user), item => getItemInfo(user, 'marketGear', item, officialPinnedItems).path);
|
const availableGear = map(updateStore(user), item => getItemInfo(user, 'marketGear', item, officialPinnedItems).path);
|
||||||
|
const { pinnedSets } = seasonalShopConfig();
|
||||||
for (const gear of result) {
|
for (const gear of result) {
|
||||||
if (gear.klass !== user.stats.class) {
|
if (gear.klass !== user.stats.class) {
|
||||||
gear.locked = true;
|
gear.locked = true;
|
||||||
@@ -122,7 +123,7 @@ shops.checkMarketGearLocked = function checkMarketGearLocked (user, items) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Boolean(gear.specialClass) && Boolean(gear.set)) {
|
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;
|
gear.locked = currentSet && user.stats.class !== gear.specialClass;
|
||||||
}
|
}
|
||||||
@@ -140,6 +141,7 @@ shops.checkMarketGearLocked = function checkMarketGearLocked (user, items) {
|
|||||||
shops.getMarketGearCategories = function getMarketGear (user, language) {
|
shops.getMarketGearCategories = function getMarketGear (user, language) {
|
||||||
const categories = [];
|
const categories = [];
|
||||||
const officialPinnedItems = getOfficialPinnedItems(user);
|
const officialPinnedItems = getOfficialPinnedItems(user);
|
||||||
|
const { pinnedSets } = seasonalShopConfig();
|
||||||
|
|
||||||
for (const classType of content.classes) {
|
for (const classType of content.classes) {
|
||||||
const category = {
|
const category = {
|
||||||
@@ -159,7 +161,7 @@ shops.getMarketGearCategories = function getMarketGear (user, language) {
|
|||||||
if (
|
if (
|
||||||
gearItem.specialClass === classType
|
gearItem.specialClass === classType
|
||||||
&& user.items.gear.owned[gearItem.key] !== false
|
&& user.items.gear.owned[gearItem.key] !== false
|
||||||
&& gearItem.set === seasonalShopConfig.pinnedSets[gearItem.specialClass]
|
&& gearItem.set === pinnedSets[gearItem.specialClass]
|
||||||
) return gearItem.canOwn(classShift);
|
) return gearItem.canOwn(classShift);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@@ -425,6 +427,7 @@ const flatGearArray = toArray(content.gear.flat);
|
|||||||
|
|
||||||
shops.getSeasonalGearBySet = function getSeasonalGearBySet (
|
shops.getSeasonalGearBySet = function getSeasonalGearBySet (
|
||||||
user,
|
user,
|
||||||
|
shopConfig,
|
||||||
set,
|
set,
|
||||||
officialPinnedItems,
|
officialPinnedItems,
|
||||||
language,
|
language,
|
||||||
@@ -436,7 +439,7 @@ shops.getSeasonalGearBySet = function getSeasonalGearBySet (
|
|||||||
|
|
||||||
return gear.set === set;
|
return gear.set === set;
|
||||||
}).map(gear => {
|
}).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
|
// only the current season set can be purchased by gold
|
||||||
const itemInfo = getItemInfo(null, currentSet ? 'marketGear' : 'gear', gear, officialPinnedItems, language, gearMatcher);
|
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) {
|
shops.getSeasonalShop = function getSeasonalShop (user, language) {
|
||||||
|
const shopConfig = seasonalShopConfig();
|
||||||
const officialPinnedItems = getOfficialPinnedItems(user);
|
const officialPinnedItems = getOfficialPinnedItems(user);
|
||||||
|
|
||||||
|
console.log('shopConfig', shopConfig);
|
||||||
|
|
||||||
const resObject = {
|
const resObject = {
|
||||||
identifier: 'seasonalShop',
|
identifier: 'seasonalShop',
|
||||||
text: i18n.t('seasonalShop'),
|
text: i18n.t('seasonalShop'),
|
||||||
notes: i18n.t(`seasonalShop${seasonalShopConfig.currentSeason}Text`),
|
notes: i18n.t(`seasonalShop${shopConfig.currentSeason}Text`),
|
||||||
imageName: 'seasonalshop_open',
|
imageName: 'seasonalshop_open',
|
||||||
opened: true,
|
opened: true,
|
||||||
categories: this.getSeasonalShopCategories(user, language),
|
categories: this.getSeasonalShopCategories(user, language, shopConfig),
|
||||||
featured: {
|
featured: {
|
||||||
text: i18n.t(seasonalShopConfig.featuredSet),
|
text: i18n.t(shopConfig.featuredSet),
|
||||||
items: shops.getSeasonalGearBySet(
|
items: shops.getSeasonalGearBySet(
|
||||||
user,
|
user,
|
||||||
seasonalShopConfig.featuredSet,
|
shopConfig.featuredSet,
|
||||||
officialPinnedItems,
|
officialPinnedItems,
|
||||||
language,
|
language,
|
||||||
true,
|
true,
|
||||||
@@ -476,7 +482,7 @@ shops.getSeasonalShop = function getSeasonalShop (user, language) {
|
|||||||
return resObject;
|
return resObject;
|
||||||
};
|
};
|
||||||
|
|
||||||
shops.getSeasonalShopCategories = function getSeasonalShopCategories (user, language) {
|
shops.getSeasonalShopCategories = function getSeasonalShopCategories (user, language, shopConfig) {
|
||||||
const officialPinnedItems = getOfficialPinnedItems(user);
|
const officialPinnedItems = getOfficialPinnedItems(user);
|
||||||
|
|
||||||
const spellMatcher = getScheduleMatchingGroup('seasonalSpells');
|
const spellMatcher = getScheduleMatchingGroup('seasonalSpells');
|
||||||
@@ -525,6 +531,7 @@ shops.getSeasonalShopCategories = function getSeasonalShopCategories (user, lang
|
|||||||
|
|
||||||
category.items = shops.getSeasonalGearBySet(
|
category.items = shops.getSeasonalGearBySet(
|
||||||
user,
|
user,
|
||||||
|
shopConfig,
|
||||||
set,
|
set,
|
||||||
officialPinnedItems,
|
officialPinnedItems,
|
||||||
language,
|
language,
|
||||||
|
|||||||
Reference in New Issue
Block a user