feat(content): FFFFFF Achievements

This commit is contained in:
Sabe Jones
2019-12-10 14:41:39 -06:00
parent 1cd1d45410
commit 40ba81a5d9
14 changed files with 131 additions and 12 deletions

View File

@@ -0,0 +1,82 @@
/* eslint-disable no-console */
const MIGRATION_NAME = '20191210_pet_color_achievements';
import { model as User } from '../../../website/server/models/user';
const progressCount = 1000;
let count = 0;
async function updateUser (user) {
count++;
let set = {
migration: MIGRATION_NAME,
};
if (user && user.items && user.items.pets) {
const pets = user.items.pets;
if (pets['Wolf-White'] > 0
&& pets['TigerCub-White'] > 0
&& pets['PandaCub-White'] > 0
&& pets['LionCub-White'] > 0
&& pets['Fox-White'] > 0
&& pets['FlyingPig-White'] > 0
&& pets['Dragon-White'] > 0
&& pets['Cactus-White'] > 0
&& pets['BearCub-White'] > 0) {
set['achievements.primedForPainting'] = true;
}
}
if (user && user.items && user.items.mounts) {
const mounts = user.items.mounts;
if (mounts['Wolf-White']
&& mounts['TigerCub-White']
&& mounts['PandaCub-White']
&& mounts['LionCub-White']
&& mounts['Fox-White']
&& mounts['FlyingPig-White']
&& mounts['Dragon-White']
&& mounts['Cactus-White']
&& mounts['BearCub-White'] ) {
set['achievements.pearlyPro'] = true;
}
}
if (count % progressCount === 0) console.warn(`${count} ${user._id}`);
return await User.update({ _id: user._id }, { $set: set }).exec();
}
module.exports = async function processUsers () {
let query = {
migration: { $ne: MIGRATION_NAME },
'auth.timestamps.loggedin': { $gt: new Date('2019-12-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

@@ -235,6 +235,16 @@ const NOTIFICATIONS = {
label: $t => `${$t('achievement')}: ${$t('achievementUndeadUndertaker')}`,
modalId: 'generic-achievement',
},
ACHIEVEMENT_PRIMED_FOR_PAINTING: {
achievement: true,
label: $t => `${$t('achievement')}: ${$t('achievementPrimedForPainting')}`,
modalId: 'generic-achievement',
},
ACHIEVEMENT_PEARLY_PRO: {
achievement: true,
label: $t => `${$t('achievement')}: ${$t('achievementPearlyPro')}`,
modalId: 'generic-achievement',
},
};
export default {
@@ -291,7 +301,8 @@ export default {
'CRON', 'SCORED_TASK', 'LOGIN_INCENTIVE', 'ACHIEVEMENT_ALL_YOUR_BASE', 'ACHIEVEMENT_BACK_TO_BASICS',
'GENERIC_ACHIEVEMENT', 'ACHIEVEMENT_PARTY_UP', 'ACHIEVEMENT_PARTY_ON', 'ACHIEVEMENT_BEAST_MASTER',
'ACHIEVEMENT_MOUNT_MASTER', 'ACHIEVEMENT_TRIAD_BINGO', 'ACHIEVEMENT_DUST_DEVIL', 'ACHIEVEMENT_ARID_AUTHORITY',
'ACHIEVEMENT_MONSTER_MAGUS', 'ACHIEVEMENT_UNDEAD_UNDERTAKER', 'GENERIC_ACHIEVEMENT',
'ACHIEVEMENT_MONSTER_MAGUS', 'ACHIEVEMENT_UNDEAD_UNDERTAKER', 'ACHIEVEMENT_PRIMED_FOR_PAINTING',
'ACHIEVEMENT_PEARLY_PRO', 'GENERIC_ACHIEVEMENT',
].forEach(type => {
handledNotifications[type] = true;
});
@@ -697,6 +708,8 @@ export default {
case 'ACHIEVEMENT_TRIAD_BINGO':
case 'ACHIEVEMENT_MONSTER_MAGUS':
case 'ACHIEVEMENT_UNDEAD_UNDERTAKER':
case 'ACHIEVEMENT_PRIMED_FOR_PAINTING':
case 'ACHIEVEMENT_PEARLY_PRO':
case 'GENERIC_ACHIEVEMENT':
this.showNotificationWithModal(notification);
break;

View File

@@ -34,5 +34,11 @@
"achievementMonsterMagusModalText": "You collected all the Zombie Pets!",
"achievementUndeadUndertaker": "Undead Undertaker",
"achievementUndeadUndertakerText": "Has tamed all Zombie Mounts.",
"achievementUndeadUndertakerModalText": "You tamed all the Zombie Mounts!"
"achievementUndeadUndertakerModalText": "You tamed all the Zombie Mounts!",
"achievementPrimedForPainting": "Primed for Painting",
"achievementPrimedForPaintingText": "Has collected all White Pets.",
"achievementPrimedForPaintingModalText": "You collected all the White Pets!",
"achievementPearlyPro": "Pearly Pro",
"achievementPearlyProText": "Has tamed all White Mounts.",
"achievementPearlyProModalText": "You tamed all the White Mounts!"
}

View File

@@ -167,6 +167,16 @@ const basicAchievs = {
titleKey: 'achievementUndeadUndertaker',
textKey: 'achievementUndeadUndertakerText',
},
primedForPainting: {
icon: 'achievement-primedForPainting',
titleKey: 'achievementPrimedForPainting',
textKey: 'achievementPrimedForPaintingText',
},
pearlyPro: {
icon: 'achievement-pearlyPro',
titleKey: 'achievementPearlyPro',
textKey: 'achievementPearlyProText',
},
};
Object.assign(achievementsData, basicAchievs);

View File

@@ -273,4 +273,7 @@ export const ANIMAL_COLOR_ACHIEVEMENTS = [
{
color: 'Zombie', petAchievement: 'monsterMagus', petNotificationType: 'ACHIEVEMENT_MONSTER_MAGUS', mountAchievement: 'undeadUndertaker', mountNotificationType: 'ACHIEVEMENT_UNDEAD_UNDERTAKER',
},
{
color: 'White', petAchievement: 'primedForPainting', petNotificationType: 'ACHIEVEMENT_PRIMED_FOR_PAINTING', mountAchievement: 'pearlyPro', mountNotificationType: 'ACHIEVEMENT_PEARLY_PRO',
},
];

View File

@@ -195,6 +195,8 @@ function _getBasicAchievements (user, language) {
_addSimple(result, user, { path: 'aridAuthority', language });
_addSimple(result, user, { path: 'monsterMagus', language });
_addSimple(result, user, { path: 'undeadUndertaker', language });
_addSimple(result, user, { path: 'primedForPainting', language });
_addSimple(result, user, { path: 'pearlyPro', language });
_addSimpleWithMasterCount(result, user, { path: 'beastMaster', language });
_addSimpleWithMasterCount(result, user, { path: 'mountMaster', language });

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -4,7 +4,7 @@ const api = {};
// @TODO export this const, cannot export it from here because only routes are exported from
// controllers
const LAST_ANNOUNCEMENT_TITLE = 'NEW BACKGROUNDS AND ARMOIRE ITEMS!';
const LAST_ANNOUNCEMENT_TITLE = 'NEW PET COLLECTION BADGES!';
const worldDmg = { // @TODO
bailey: false,
};
@@ -31,23 +31,22 @@ api.getNews = {
<div class="mr-3 ${baileyClass}"></div>
<div class="media-body">
<h1 class="align-self-center">${res.t('newStuff')}</h1>
<h2>12/3/2019 - ${LAST_ANNOUNCEMENT_TITLE}</h2>
<h2>12/10/2019 - ${LAST_ANNOUNCEMENT_TITLE}</h2>
</div>
</div>
<hr/>
<div class="promo_armoire_backgrounds_201912 center-block"></div>
<div class="promo_achievement_white center-block"></div>
<p>
Weve added three new backgrounds to the Background Shop! Now your avatar can shop a
cheerful Holiday Market, enjoy the scent of a Holiday Wreath and bask in the starlight
of a Winter Nocturne. Check them out under User Icon > Backgrounds!
We're releasing a new achievement so you can celebrate your successes in the world of
Habitican pet collecting! Earn the Primed for Painting and Pearly Pro achievements by
collecting White pets and mounts and you'll earn a nifty badge for your profile.
</p>
<p>
Plus, theres new Gold-purchasable equipment in the Enchanted Armoire, including the
Duffle Coat and Ear-Flap Hat. Better work hard on your real-life tasks to earn all
the pieces! Enjoy :)
If you already have all the White pets and/or mounts in your stable, you'll receive the
badge automatically! Check your profile and celebrate your new achievement with pride.
</p>
<div class="small mb-3">
by Katy133, gawrone, Vikte, Maans, GeraldThePixel, QuartzFox, KatieSlug, and SabreCat
by Piyowo and SabreCat
</div>
</div>
`,

View File

@@ -132,6 +132,8 @@ export default new Schema({
kickstarter2019: Boolean,
monsterMagus: Boolean,
undeadUndertaker: Boolean,
primedForPainting: Boolean,
pearlyPro: Boolean,
},
backer: {

View File

@@ -47,6 +47,8 @@ const NOTIFICATION_TYPES = [
'ACHIEVEMENT_TRIAD_BINGO',
'ACHIEVEMENT_MONSTER_MAGUS',
'ACHIEVEMENT_UNDEAD_UNDERTAKER',
'ACHIEVEMENT_PRIMED_FOR_PAINTING',
'ACHIEVEMENT_PEARLY_PRO',
];
const { Schema } = mongoose;