feat(content): Zombie color bingo achievements

This commit is contained in:
Sabe Jones 2019-10-22 10:19:02 -05:00
parent c0eb147e1a
commit 0dd8cab2a0
12 changed files with 127 additions and 11 deletions

View file

@ -0,0 +1,82 @@
/* eslint-disable no-console */
const MIGRATION_NAME = '20191022_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-Zombie'] > 0
&& pets['TigerCub-Zombie'] > 0
&& pets['PandaCub-Zombie'] > 0
&& pets['LionCub-Zombie'] > 0
&& pets['Fox-Zombie'] > 0
&& pets['FlyingPig-Zombie'] > 0
&& pets['Dragon-Zombie'] > 0
&& pets['Cactus-Zombie'] > 0
&& pets['BearCub-Zombie'] > 0) {
set['achievements.monsterMagus'] = true;
}
}
if (user && user.items && user.items.mounts) {
const mounts = user.items.mounts;
if (mounts['Wolf-Zombie']
&& mounts['TigerCub-Zombie']
&& mounts['PandaCub-Zombie']
&& mounts['LionCub-Zombie']
&& mounts['Fox-Zombie']
&& mounts['FlyingPig-Zombie']
&& mounts['Dragon-Zombie']
&& mounts['Cactus-Zombie']
&& mounts['BearCub-Zombie'] ) {
set['achievements.undeadUndertaker'] = 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-10-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

@ -175,6 +175,16 @@ const NOTIFICATIONS = {
label: ($t) => `${$t('achievement')}: ${$t('achievementAridAuthority')}`,
modalId: 'generic-achievement',
},
ACHIEVEMENT_MONSTER_MAGUS: {
achievement: true,
label: ($t) => `${$t('achievement')}: ${$t('achievementMonsterMagus')}`,
modalId: 'generic-achievement',
},
ACHIEVEMENT_UNDEAD_UNDERTAKER: {
achievement: true,
label: ($t) => `${$t('achievement')}: ${$t('achievementUndeadUndertaker')}`,
modalId: 'generic-achievement',
},
};
export default {
@ -230,7 +240,9 @@ export default {
'ULTIMATE_GEAR_ACHIEVEMENT', 'REBIRTH_ACHIEVEMENT', 'GUILD_JOINED_ACHIEVEMENT',
'CHALLENGE_JOINED_ACHIEVEMENT', 'INVITED_FRIEND_ACHIEVEMENT', 'NEW_CONTRIBUTOR_LEVEL',
'CRON', 'SCORED_TASK', 'LOGIN_INCENTIVE', 'ACHIEVEMENT_ALL_YOUR_BASE', 'ACHIEVEMENT_BACK_TO_BASICS',
'ACHIEVEMENT_DUST_DEVIL', 'ACHIEVEMENT_ARID_AUTHORITY', 'GENERIC_ACHIEVEMENT',
'ACHIEVEMENT_DUST_DEVIL', 'ACHIEVEMENT_ARID_AUTHORITY',
'ACHIEVEMENT_MONSTER_MAGUS', 'ACHIEVEMENT_UNDEAD_UNDERTAKER',
'GENERIC_ACHIEVEMENT',
].forEach(type => {
handledNotifications[type] = true;
});
@ -607,6 +619,8 @@ export default {
case 'ACHIEVEMENT_BACK_TO_BASICS':
case 'ACHIEVEMENT_DUST_DEVIL':
case 'ACHIEVEMENT_ARID_AUTHORITY':
case 'ACHIEVEMENT_MONSTER_MAGUS':
case 'ACHIEVEMENT_UNDEAD_UNDERTAKER':
case 'GENERIC_ACHIEVEMENT':
this.showNotificationWithModal(notification);
break;

View file

@ -26,5 +26,11 @@
"achievementAridAuthorityText": "Has tamed all Desert Mounts.",
"achievementAridAuthorityModalText": "You tamed all the Desert Mounts!",
"achievementKickstarter2019": "Pin Kickstarter Backer",
"achievementKickstarter2019Text": "Backed the 2019 Pin Kickstarter Project"
"achievementKickstarter2019Text": "Backed the 2019 Pin Kickstarter Project",
"achievementMonsterMagus": "Monster Magus",
"achievementMonsterMagusText": "Has collected all Zombie Pets.",
"achievementMonsterMagusModalText": "You collected all the Zombie Pets!",
"achievementUndeadUndertaker": "Undead Undertaker",
"achievementUndeadUndertakerText": "Has tamed all Zombie Mounts.",
"achievementUndeadUndertakerModalText": "You tamed all the Zombie Mounts!"
}

View file

@ -157,6 +157,16 @@ let basicAchievs = {
titleKey: 'achievementAridAuthority',
textKey: 'achievementAridAuthorityText',
},
monsterMagus: {
icon: 'achievement-monsterMagus',
titleKey: 'achievementMonsterMagus',
textKey: 'achievementMonsterMagusText',
},
undeadUndertaker: {
icon: 'achievement-undeadUndertaker',
titleKey: 'achievementUndeadUndertaker',
textKey: 'achievementUndeadUndertakerText',
},
};
Object.assign(achievementsData, basicAchievs);

View file

@ -266,4 +266,5 @@ export const QUEST_SERIES_ACHIEVEMENTS = {
export const ANIMAL_COLOR_ACHIEVEMENTS = [
{color: 'Base', petAchievement: 'backToBasics', petNotificationType: 'ACHIEVEMENT_BACK_TO_BASICS', mountAchievement: 'allYourBase', mountNotificationType: 'ACHIEVEMENT_ALL_YOUR_BASE'},
{color: 'Desert', petAchievement: 'dustDevil', petNotificationType: 'ACHIEVEMENT_DUST_DEVIL', mountAchievement: 'aridAuthority', mountNotificationType: 'ACHIEVEMENT_ARID_AUTHORITY'},
{color: 'Zombie', petAchievement: 'monsterMagus', petNotificationType: 'ACHIEVEMENT_MONSTER_MAGUS', mountAchievement: 'undeadUndertaker', mountNotificationType: 'ACHIEVEMENT_UNDEAD_UNDERTAKER'},
];

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -3,7 +3,7 @@ import { authWithHeaders } from '../../middlewares/auth';
let api = {};
// @TODO export this const, cannot export it from here because only routes are exported from controllers
const LAST_ANNOUNCEMENT_TITLE = 'HABITICA HIRING ANDROID DEVELOPER! AND BLOG POST ON THE QUEST SHOP';
const LAST_ANNOUNCEMENT_TITLE = 'NEW PET COLLECTION BADGES!';
const worldDmg = { // @TODO
bailey: false,
};
@ -30,17 +30,14 @@ api.getNews = {
<div class="mr-3 ${baileyClass}"></div>
<div class="media-body">
<h1 class="align-self-center">${res.t('newStuff')}</h1>
<h2>10/17/2019 - ${LAST_ANNOUNCEMENT_TITLE}</h2>
<h2>10/22/2019 - ${LAST_ANNOUNCEMENT_TITLE}</h2>
</div>
</div>
<hr/>
<h3>Habitica is Hiring! Android Developer Position</h3>
<p>Want to join the Habitica team? Were looking to hire a new developer to help with our Android app! Our ideal candidate is a mobile developer with experience in Kotlin who is capable of supporting existing legacy code and working with our team to continue improving the user experience. You'll make major contributions that help serve and grow an audience of millions of users!</p>
<p>If this sounds like a job you'll love, check out the <a href='https://forms.gle/rdyDPTRD8ZjE2qLG8' target='_blank'>full job posting</a> for more information and to fill out an application. </p>
<div class="scene_quest_shop center-block"></div>
<h3>Blog Post: Quest Shop</h3>
<p>This month's <a href='https://habitica.wordpress.com/2019/10/16/quest-shop/' target='_blank'>featured Wiki article</a> is about the Quest Shop! We hope that it will help you as you look for additional ways to keep your Habitica adventure fun and motivating. Be sure to check it out, and let us know what you think by reaching out on <a href='https://twitter.com/habitica' target='_blank'>Twitter</a>, <a href='http://blog.habitrpg.com' target='_blank'>Tumblr</a>, and <a href='https://facebook.com/habitica' target='_blank'>Facebook</a>.</p>
<div class="small mb-3">by shanaqui and the Wiki Wizards</div>
<div class="promo_zombie_achievements center-block"></div>
<p>We're releasing a new achievement so you can celebrate your successes in the world of Habitican pet collecting! Earn the Monster Magus and Undead Undertaker achievements by collecting Zombie pets and mounts and you'll earn a nifty badge for your profile.</p>
<p>If you already have all the Zombie 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 OuttaMyMind and SabreCat</div>
</div>
`,
});

View file

@ -128,6 +128,8 @@ let schema = new Schema({
dustDevil: Boolean,
aridAuthority: Boolean,
kickstarter2019: Boolean,
monsterMagus: Boolean,
undeadUndertaker: Boolean,
},
backer: {

View file

@ -40,6 +40,8 @@ const NOTIFICATION_TYPES = [
'ACHIEVEMENT_MIND_OVER_MATTER',
'ACHIEVEMENT_DUST_DEVIL',
'ACHIEVEMENT_ARID_AUTHORITY',
'ACHIEVEMENT_MONSTER_MAGUS',
'ACHIEVEMENT_UNDEAD_UNDERTAKER',
];
const Schema = mongoose.Schema;