2023 November Content Prebuild (#14954)

* feat(content): October sub items

* feat(content): October bgs and armoire

* feat(content): add Dune Buddy achievement

* feat(releases): timed Backgrounds and Armoire

* feat(content): timed release achievement

* feat(content): November subscriber items

* feat(content): November pet quest bundle

* feat(content): November magic hatching potions

* feat(content): November backgrounds and armoire

* feat(content): new achievement code -- needs work

* update package.lock on local/origin repos

* fix(content): added October headgear info and November set name

* fix(typo): spelling is important

* feat(content): added logic to allow for pets & mounts to be in one achievement and fixed issues with image

* fix(armoire): correct month

* fix(armoire): deprecate armoireEmpty flag

---------

Co-authored-by: SabreCat <sabe@habitica.com>
Co-authored-by: Sabe Jones <sabrecat@gmail.com>
This commit is contained in:
Natalie
2023-11-07 09:55:50 -05:00
committed by GitHub
parent 1892d6288a
commit a80ef78be0
24 changed files with 354 additions and 143 deletions
+3 -6
View File
@@ -2,7 +2,6 @@ import filter from 'lodash/filter';
import isEmpty from 'lodash/isEmpty';
import pick from 'lodash/pick';
import content from '../../content/index';
import * as count from '../../count';
import splitWhitespace from '../../libs/splitWhitespace';
import {
NotAuthorized,
@@ -33,7 +32,7 @@ export class BuyArmoireOperation extends AbstractGoldItemOperation { // eslint-d
let result = {};
const armoireResult = randomValFns.trueRandom();
const eligibleEquipment = filter(content.gear.flat, eligible => eligible.klass === 'armoire' && !user.items.gear.owned[eligible.key]);
const eligibleEquipment = filter(content.gear.flat, eligible => eligible.klass === 'armoire' && eligible.released && !user.items.gear.owned[eligible.key]);
const armoireHasEquipment = !isEmpty(eligibleEquipment);
if (
@@ -83,6 +82,7 @@ export class BuyArmoireOperation extends AbstractGoldItemOperation { // eslint-d
}
_gearResult (user, eligibleEquipment) {
const emptied = eligibleEquipment.length === 1;
eligibleEquipment.sort();
const drop = randomVal(eligibleEquipment);
@@ -102,10 +102,6 @@ export class BuyArmoireOperation extends AbstractGoldItemOperation { // eslint-d
dropText: drop.text(this.req.language),
});
if (count.remainingGearInSet(user.items.gear.owned, 'armoire') === 0) {
user.flags.armoireEmpty = true;
}
removeItemByPath(user, `gear.flat.${drop.key}`);
if (this.analytics) {
@@ -116,6 +112,7 @@ export class BuyArmoireOperation extends AbstractGoldItemOperation { // eslint-d
type: 'gear',
dropKey: drop.key,
dropText: drop.text(this.req.language),
emptied,
};
return {
+12 -2
View File
@@ -86,16 +86,26 @@ export default function hatch (user, req = {}, analytics) {
if (content.dropHatchingPotions[hatchingPotion]) {
forEach(content.animalSetAchievements, achievement => {
if (!user.achievements[achievement.achievementKey]) {
if (achievement.type === 'pet') {
if (achievement.type === 'pet' || achievement.type === 'petMount') {
let achieved = true;
forEach(achievement.species, species => {
if (!achieved) return;
const petIndex = findIndex(
keys(content.dropHatchingPotions),
color => !user.items.pets[`${species}-${color}`],
color => !user.items.pets[`${species}-${color}`] || user.items.pets[`${species}-${color}`] === -1,
);
if (petIndex !== -1) achieved = false;
});
if (achievement.type === 'petMount') {
forEach(achievement.species, species => {
if (!achieved) return;
const mountIndex = findIndex(
keys(content.dropHatchingPotions),
color => !user.items.mounts[`${species}-${color}`],
);
if (mountIndex !== -1) achieved = false;
});
}
if (achieved) {
user.achievements[achievement.achievementKey] = true;
if (user.addNotification) {