mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
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:
Submodule habitica-images updated: d66a5ea922...f9c1439cd9
108
migrations/archive/2022/20221213_pet_group_achievements.js
Normal file
108
migrations/archive/2022/20221213_pet_group_achievements.js
Normal 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
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -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;
|
||||||
|
|||||||
@@ -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!"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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',
|
||||||
|
|||||||
@@ -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: [
|
||||||
|
|||||||
@@ -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 });
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user