feat(content): award yearly Orcas

This commit is contained in:
Sabe Jones
2020-07-21 14:57:52 -05:00
parent 3db2cd49a4
commit c5e02292c4
6 changed files with 75 additions and 15 deletions

View File

@@ -0,0 +1,59 @@
/* eslint-disable no-console */
const MIGRATION_NAME = '20200721_summer_splash_orcas';
import { model as User } from '../../../website/server/models/user';
const progressCount = 1000;
let count = 0;
async function updateUser (user) {
count++;
let set;
if (user && user.items && user.items.pets && typeof user.items.pets['Orca-Base'] !== 'undefined') {
set = { migration: MIGRATION_NAME };
} else if (user && user.items && user.items.mounts && typeof user.items.mounts['Orca-Base'] !== 'undefined') {
set = { migration: MIGRATION_NAME, 'items.pets.Orca-Base': 5 };
} else {
set = { migration: MIGRATION_NAME, 'items.mounts.Orca-Base': 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('2020-06-21')},
};
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],
};
}
await Promise.all(users.map(updateUser)); // eslint-disable-line no-await-in-loop
}
};

View File

@@ -18,7 +18,7 @@ function setUpServer () {
setUpServer();
// Replace this with your migration
const processUsers = require().default;
const processUsers = require('./archive/2020/20200721_summer_splash_orcas').default;
processUsers()
.then(() => {

View File

@@ -16,6 +16,12 @@
width: 282px;
height: 147px;
}
.promo_orcas {
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
background-position: -1019px -592px;
width: 219px;
height: 147px;
}
.promo_sand_sculpture_potions {
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
background-position: -1019px -296px;
@@ -84,13 +90,13 @@
}
.scene_nakonana {
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
background-position: -1019px -722px;
background-position: -1019px -740px;
width: 141px;
height: 169px;
}
.scene_strength {
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
background-position: -1019px -592px;
background-position: -1239px -592px;
width: 192px;
height: 129px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 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 = 'BLOG POST: GOOD STARTER QUESTS!';
const LAST_ANNOUNCEMENT_TITLE = 'ORCAS FOR EVERYONE!';
const worldDmg = { // @TODO
bailey: false,
};
@@ -31,22 +31,17 @@ api.getNews = {
<div class="mr-3 ${baileyClass}"></div>
<div class="media-body">
<h1 class="align-self-center">${res.t('newStuff')}</h1>
<h2>7/16/2020 - ${LAST_ANNOUNCEMENT_TITLE}</h2>
<h2>7/21/2020 - ${LAST_ANNOUNCEMENT_TITLE}</h2>
</div>
</div>
<hr/>
<div class="scene_basilist center-block"></div>
<div class="promo_orcas center-block"></div>
<p>
This month's <a
href='https://habitica.wordpress.com/2020/07/15/easy-starter-quests-for-beginners/'
target='_blank'>featured Wiki article</a> is about Easy Starter Quests for Beginners! We
hope that it will help you as you take on Habitica's bosses and your tasks! 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>.
It looks like some friendly Orcas are swimming into Habiticans' stables! In honor of the
Summer Splash event, everyone who didn't already have an Orca gets either the mount or
the pet. Enjoy!
</p>
<div class="small mb-3">by shanaqui and the Wiki Wizards</div>
<div class="small mb-3">by Beffymaroo and UncommonCriminal</div>
</div>
`,
});