Merge branch 'release' into develop

This commit is contained in:
SabreCat 2023-05-23 09:16:50 -05:00
commit 8e5b66a73e
14 changed files with 207 additions and 10 deletions

@ -1 +1 @@
Subproject commit dac6a71d1fa2500bf8f3ec18bf917cbe91d82d64
Subproject commit 3cda1c1a27ef51e735ea0f6edd848f001321ec0f

View file

@ -0,0 +1,158 @@
/* eslint-disable no-console */
const MIGRATION_NAME = '20230522_pet_group_achievements';
import { model as User } from '../../../website/server/models/user';
const progressCount = 1000;
let count = 0;
async function updateUser (user) {
count++;
const set = {
migration: MIGRATION_NAME,
};
if (user && user.items && user.items.pets) {
const pets = user.items.pets;
if (pets['Parrot-Base']
&& pets['Parrot-CottonCandyBlue']
&& pets['Parrot-CottonCandyPink']
&& pets['Parrot-Desert']
&& pets['Parrot-Golden']
&& pets['Parrot-Red']
&& pets['Parrot-Shade']
&& pets['Parrot-Skeleton']
&& pets['Parrot-White']
&& pets['Parrot-Zombie']
&& pets['Rooster-Base']
&& pets['Rooster-CottonCandyBlue']
&& pets['Rooster-CottonCandyPink']
&& pets['Rooster-Desert']
&& pets['Rooster-Golden']
&& pets['Rooster-Red']
&& pets['Rooster-Shade']
&& pets['Rooster-Skeleton']
&& pets['Rooster-White']
&& pets['Rooster-Zombie']
&& pets['Triceratops-Base']
&& pets['Triceratops-CottonCandyBlue']
&& pets['Triceratops-CottonCandyPink']
&& pets['Triceratops-Desert']
&& pets['Triceratops-Golden']
&& pets['Triceratops-Red']
&& pets['Triceratops-Shade']
&& pets['Triceratops-Skeleton']
&& pets['Triceratops-White']
&& pets['Triceratops-Zombie']
&& pets['TRex-Base']
&& pets['TRex-CottonCandyBlue']
&& pets['TRex-CottonCandyPink']
&& pets['TRex-Desert']
&& pets['TRex-Golden']
&& pets['TRex-Red']
&& pets['TRex-Shade']
&& pets['TRex-Skeleton']
&& pets['TRex-White']
&& pets['TRex-Zombie']
&& pets['Pterodactyl-Base']
&& pets['Pterodactyl-CottonCandyBlue']
&& pets['Pterodactyl-CottonCandyPink']
&& pets['Pterodactyl-Desert']
&& pets['Pterodactyl-Golden']
&& pets['Pterodactyl-Red']
&& pets['Pterodactyl-Shade']
&& pets['Pterodactyl-Skeleton']
&& pets['Pterodactyl-White']
&& pets['Pterodactyl-Zombie']
&& pets['Owl-Base']
&& pets['Owl-CottonCandyBlue']
&& pets['Owl-CottonCandyPink']
&& pets['Owl-Desert']
&& pets['Owl-Golden']
&& pets['Owl-Red']
&& pets['Owl-Shade']
&& pets['Owl-Skeleton']
&& pets['Owl-White']
&& pets['Owl-Zombie']
&& pets['Velociraptor-Base']
&& pets['Velociraptor-CottonCandyBlue']
&& pets['Velociraptor-CottonCandyPink']
&& pets['Velociraptor-Desert']
&& pets['Velociraptor-Golden']
&& pets['Velociraptor-Red']
&& pets['Velociraptor-Shade']
&& pets['Velociraptor-Skeleton']
&& pets['Velociraptor-White']
&& pets['Velociraptor-Zombie']
&& pets['Penguin-Base']
&& pets['Penguin-CottonCandyBlue']
&& pets['Penguin-CottonCandyPink']
&& pets['Penguin-Desert']
&& pets['Penguin-Golden']
&& pets['Penguin-Red']
&& pets['Penguin-Shade']
&& pets['Penguin-Skeleton']
&& pets['Penguin-White']
&& pets['Penguin-Zombie']
&& pets['Falcon-Base']
&& pets['Falcon-CottonCandyBlue']
&& pets['Falcon-CottonCandyPink']
&& pets['Falcon-Desert']
&& pets['Falcon-Golden']
&& pets['Falcon-Red']
&& pets['Falcon-Shade']
&& pets['Falcon-Skeleton']
&& pets['Falcon-White']
&& pets['Falcon-Zombie']
&& pets['Peacock-Base']
&& pets['Peacock-CottonCandyBlue']
&& pets['Peacock-CottonCandyPink']
&& pets['Peacock-Desert']
&& pets['Peacock-Golden']
&& pets['Peacock-Red']
&& pets['Peacock-Shade']
&& pets['Peacock-Skeleton']
&& pets['Peacock-White']
&& pets['Peacock-Zombie']) {
set['achievements.dinosaurDynasty'] = true;
}
}
if (count % progressCount === 0) console.warn(`${count} ${user._id}`);
return await User.update({ _id: user._id }, { $set: set }).exec();
}
export default async function processUsers () {
let query = {
// migration: { $ne: MIGRATION_NAME },
'auth.timestamps.loggedin': { $gt: new Date('2023-04-15') },
};
const fields = {
_id: 1,
items: 1,
};
while (true) { // eslint-disable-line no-constant-condition
const users = await User // eslint-disable-line no-await-in-loop
.find(query)
.limit(250)
.sort({_id: 1})
.select(fields)
.lean()
.exec();
if (users.length === 0) {
console.warn('All appropriate users found and modified.');
console.warn(`\n${count} users processed\n`);
break;
} else {
query._id = {
$gt: users[users.length - 1]._id,
};
}
await Promise.all(users.map(updateUser)); // eslint-disable-line no-await-in-loop
}
};

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "habitica",
"version": "4.270.1",
"version": "4.271.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -1,7 +1,7 @@
{
"name": "habitica",
"description": "A habit tracker app which treats your goals like a Role Playing Game.",
"version": "4.270.1",
"version": "4.271.0",
"main": "./website/server/index.js",
"dependencies": {
"@babel/core": "^7.21.8",

View file

@ -138,6 +138,11 @@
width: 48px;
height: 52px;
}
.achievement-dinosaurDynasty2x {
background-image: url('https://habitica-assets.s3.amazonaws.com/mobileApp/images/achievement-dinosaurDynasty2x.png');
width: 68px;
height: 68px;
}
.achievement-domesticated2x {
background-image: url('https://habitica-assets.s3.amazonaws.com/mobileApp/images/achievement-domesticated2x.png');
width: 60px;

View file

@ -147,5 +147,8 @@
"achievementPolarProModalText": "You collected all the Polar Pets!",
"achievementPlantParent": "Plant Parent",
"achievementPlantParentText": "Has hatched all standard colors of Plant pets: Cactus and Treeling!",
"achievementPlantParentModalText": "You collected all the Plant Pets!"
"achievementPlantParentModalText": "You collected all the Plant Pets!",
"achievementDinosaurDynasty": "Dinosaur Dynasty",
"achievementDinosaurDynastyText": "Has hatched all standard colors of bird and dinosaur pets: Falcon, Owl, Parrot, Peacock, Penguin, Rooster, Pterodactyl, T-Rex, Triceratops, and Velociraptor!",
"achievementDinosaurDynastyModalText": "You collected all the bird and dinosaur pets!"
}

View file

@ -178,6 +178,11 @@ const animalSetAchievs = {
titleKey: 'achievementBirdsOfAFeather',
textKey: 'achievementBirdsOfAFeatherText',
},
dinosaurDynasty: {
icon: 'achievement-dinosaurDynasty',
titleKey: 'achievementDinosaurDynasty',
textKey: 'achievementDinosaurDynastyText',
},
domesticated: {
icon: 'achievement-domesticated',
titleKey: 'achievementDomesticated',

View file

@ -178,9 +178,9 @@ const bundles = {
'penguin',
'rooster',
],
event: EVENTS.bundle202109,
event: EVENTS.bundle202305,
canBuy () {
return moment().isBefore(EVENTS.bundle202109.end);
return moment().isBefore(EVENTS.bundle202305.end);
},
type: 'quests',
value: 7,

View file

@ -26,6 +26,23 @@ const ANIMAL_SET_ACHIEVEMENTS = {
achievementKey: 'birdsOfAFeather',
notificationType: 'ACHIEVEMENT_ANIMAL_SET',
},
dinosaurDynasty: {
type: 'pet',
species: [
'Falcon',
'Owl',
'Parrot',
'Peacock',
'Penguin',
'Rooster',
'Pterodactyl',
'TRex',
'Triceratops',
'Velociraptor',
],
achievementKey: 'dinosaurDynasty',
notificationType: 'ACHIEVEMENT_ANIMAL_SET',
},
domesticated: {
type: 'pet',
species: [

View file

@ -15,6 +15,10 @@ export const EVENTS = {
season: 'normal',
npcImageSuffix: '',
},
bundle202305: {
start:'2023-05-23T08:00-04:00',
end:'2023-05-31T23:59-04:00',
},
potions202305: {
start:'2023-05-16T08:00-04:00',
end:'2023-05-31T23:59-04:00',

View file

@ -45,19 +45,19 @@ const featuredItems = {
];
},
quests () { // start date is 3/28
if (moment().isBetween(EVENTS.bundle202303.start, EVENTS.bundle202303.end)) {
if (moment().isBetween(EVENTS.bundle202305.start, EVENTS.bundle202305.end)) {
return [
{
type: 'bundles',
path: 'bundles.jungleBuddies',
path: 'bundles.birdBuddies',
},
{
type: 'quests',
path: 'quests.kraken',
path: 'quests.harpy',
},
{
type: 'quests',
path: 'quests.nudibranch',
path: 'quests.owl',
},
];
}

View file

@ -222,6 +222,7 @@ function _getBasicAchievements (user, language) {
_addSimple(result, user, { path: 'boneToPick', language });
_addSimple(result, user, { path: 'polarPro', language });
_addSimple(result, user, { path: 'plantParent', language });
_addSimple(result, user, { path: 'dinosaurDynasty', language });
_addSimpleWithMasterCount(result, user, { path: 'beastMaster', language });
_addSimpleWithMasterCount(result, user, { path: 'mountMaster', language });

View file

@ -130,6 +130,7 @@ export async function update (req, res, { isV3 = false }) {
uuid: user._id,
hitType: 'event',
category: 'behavior',
headers: req.headers,
});
}
@ -187,6 +188,7 @@ export async function update (req, res, { isV3 = false }) {
uuid: user._id,
hitType: 'event',
category: 'behavior',
headers: req.headers,
});
} else if (key === 'tags') {
if (!Array.isArray(val)) throw new BadRequest('Tag list must be an array.');
@ -274,6 +276,7 @@ export async function reset (req, res, { isV3 = false }) {
uuid: user._id,
hitType: 'event',
category: 'behavior',
headers: req.headers,
});
res.respond(200, ...resetRes);

View file

@ -154,6 +154,7 @@ export default new Schema({
boneToPick: Boolean,
polarPro: Boolean,
plantParent: Boolean,
dinosaurDynasty: Boolean,
// Onboarding Guide
createdTask: Boolean,
completedTask: Boolean,