chore(content): add Polar Pro achievement (#14399)

* chore(content): add Polar Pro achievement

* chore(script): add migration script

* fix(typo): rogue backticks

* fix(capitalization): revert css blurp

* fix(migration): no babby wuff

Co-authored-by: Sabe Jones <sabrecat@gmail.com>
Co-authored-by: SabreCat <sabe@habitica.com>
This commit is contained in:
Natalie L
2022-12-13 15:50:53 -05:00
committed by GitHub
parent 51b3b0c4c7
commit 573c932565
8 changed files with 137 additions and 2 deletions

View File

@@ -0,0 +1,108 @@
/* eslint-disable no-console */
const MIGRATION_NAME = '20221213_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['BearCub-Base']
&& pets['BearCub-CottonCandyBlue']
&& pets['BearCub-CottonCandyPink']
&& pets['BearCub-Desert']
&& pets['BearCub-Golden']
&& pets['BearCub-Red']
&& pets['BearCub-Shade']
&& pets['BearCub-Skeleton']
&& pets['BearCub-White']
&& pets['BearCub-Zombie']
&& pets['Fox-Base']
&& pets['Fox-CottonCandyBlue']
&& pets['Fox-CottonCandyPink']
&& pets['Fox-Desert']
&& pets['Fox-Golden']
&& pets['Fox-Red']
&& pets['Fox-Shade']
&& pets['Fox-Skeleton']
&& pets['Fox-White']
&& pets['Fox-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['Whale-Base']
&& pets['Whale-CottonCandyBlue']
&& pets['Whale-CottonCandyPink']
&& pets['Whale-Desert']
&& pets['Whale-Golden']
&& pets['Whale-Red']
&& pets['Whale-Shade']
&& pets['Whale-Skeleton']
&& pets['Whale-White']
&& pets['Whale-Zombie']
&& pets['Wolf-Base']
&& pets['Wolf-CottonCandyBlue']
&& pets['Wolf-CottonCandyPink']
&& pets['Wolf-Desert']
&& pets['Wolf-Golden']
&& pets['Wolf-Red']
&& pets['Wolf-Shade']
&& pets['Wolf-Skeleton']
&& pets['Wolf-White']
&& pets['Wolf-Zombie'] {
set['achievements.polarPro'] = 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('2022-11-01') },
};
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
}
};

View File

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

View File

@@ -141,5 +141,8 @@
"achievementWoodlandWizardModalText": "You collected all the forest pets!", "achievementWoodlandWizardModalText": "You collected all the forest pets!",
"achievementBoneToPick": "Bone to Pick", "achievementBoneToPick": "Bone to Pick",
"achievementBoneToPickText": "Has hatched all the Classic and Quest Skeleton Pets!", "achievementBoneToPickText": "Has hatched all the Classic and Quest Skeleton Pets!",
"achievementBoneToPickModalText": "You collected all the Classic and Quest Skeleton Pets!" "achievementBoneToPickModalText": "You collected all the Classic and Quest Skeleton Pets!",
"achievementPolarPro": "Polar Pro",
"achievementPolarProText": "Has hatched all Polar pets: Bear, Fox, Penguin, Whale, and Wolf!",
"achievementPolarProModalText": "You collected all the Polar Pets!"
} }

View File

@@ -183,6 +183,11 @@ const animalSetAchievs = {
titleKey: 'achievementDomesticated', titleKey: 'achievementDomesticated',
textKey: 'achievementDomesticatedText', textKey: 'achievementDomesticatedText',
}, },
polarPro: {
icon: 'achievement-polarPro',
titleKey: 'achievementPolarPro',
textKey: 'achievementPolarProText',
},
reptacularRumble: { reptacularRumble: {
icon: 'achievement-reptacularRumble', icon: 'achievement-reptacularRumble',
titleKey: 'achievementReptacularRumble', titleKey: 'achievementReptacularRumble',

View File

@@ -41,6 +41,18 @@ const ANIMAL_SET_ACHIEVEMENTS = {
achievementKey: 'domesticated', achievementKey: 'domesticated',
notificationType: 'ACHIEVEMENT_ANIMAL_SET', notificationType: 'ACHIEVEMENT_ANIMAL_SET',
}, },
polarPro: {
type: 'pet',
species: [
'BearCub',
'Fox',
'Penguin',
'Whale',
'Wolf',
],
achievementKey: 'polarPro',
notificationType: 'ACHIEVEMENT_ANIMAL_SET',
},
reptacularRumble: { reptacularRumble: {
type: 'pet', type: 'pet',
species: [ species: [

View File

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

View File

@@ -152,6 +152,7 @@ export default new Schema({
reptacularRumble: Boolean, reptacularRumble: Boolean,
woodlandWizard: Boolean, woodlandWizard: Boolean,
boneToPick: Boolean, boneToPick: Boolean,
polarPro: Boolean,
// Onboarding Guide // Onboarding Guide
createdTask: Boolean, createdTask: Boolean,
completedTask: Boolean, completedTask: Boolean,