mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
feat(content): award yearly Orcas
This commit is contained in:
59
migrations/archive/2020/20200721_summer_splash_orcas.js
Normal file
59
migrations/archive/2020/20200721_summer_splash_orcas.js
Normal 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
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -18,7 +18,7 @@ function setUpServer () {
|
|||||||
setUpServer();
|
setUpServer();
|
||||||
|
|
||||||
// Replace this with your migration
|
// Replace this with your migration
|
||||||
const processUsers = require().default;
|
const processUsers = require('./archive/2020/20200721_summer_splash_orcas').default;
|
||||||
|
|
||||||
processUsers()
|
processUsers()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|||||||
@@ -16,6 +16,12 @@
|
|||||||
width: 282px;
|
width: 282px;
|
||||||
height: 147px;
|
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 {
|
.promo_sand_sculpture_potions {
|
||||||
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
|
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
|
||||||
background-position: -1019px -296px;
|
background-position: -1019px -296px;
|
||||||
@@ -84,13 +90,13 @@
|
|||||||
}
|
}
|
||||||
.scene_nakonana {
|
.scene_nakonana {
|
||||||
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
|
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
|
||||||
background-position: -1019px -722px;
|
background-position: -1019px -740px;
|
||||||
width: 141px;
|
width: 141px;
|
||||||
height: 169px;
|
height: 169px;
|
||||||
}
|
}
|
||||||
.scene_strength {
|
.scene_strength {
|
||||||
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
|
background-image: url('~@/assets/images/sprites/spritesmith-largeSprites-0.png');
|
||||||
background-position: -1019px -592px;
|
background-position: -1239px -592px;
|
||||||
width: 192px;
|
width: 192px;
|
||||||
height: 129px;
|
height: 129px;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 145 KiB |
BIN
website/raw_sprites/spritesmith_large/promo_orcas.png
Normal file
BIN
website/raw_sprites/spritesmith_large/promo_orcas.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -4,7 +4,7 @@ const api = {};
|
|||||||
|
|
||||||
// @TODO export this const, cannot export it from here because only routes are exported from
|
// @TODO export this const, cannot export it from here because only routes are exported from
|
||||||
// controllers
|
// controllers
|
||||||
const LAST_ANNOUNCEMENT_TITLE = 'BLOG POST: GOOD STARTER QUESTS!';
|
const LAST_ANNOUNCEMENT_TITLE = 'ORCAS FOR EVERYONE!';
|
||||||
const worldDmg = { // @TODO
|
const worldDmg = { // @TODO
|
||||||
bailey: false,
|
bailey: false,
|
||||||
};
|
};
|
||||||
@@ -31,22 +31,17 @@ api.getNews = {
|
|||||||
<div class="mr-3 ${baileyClass}"></div>
|
<div class="mr-3 ${baileyClass}"></div>
|
||||||
<div class="media-body">
|
<div class="media-body">
|
||||||
<h1 class="align-self-center">${res.t('newStuff')}</h1>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<div class="scene_basilist center-block"></div>
|
<div class="promo_orcas center-block"></div>
|
||||||
<p>
|
<p>
|
||||||
This month's <a
|
It looks like some friendly Orcas are swimming into Habiticans' stables! In honor of the
|
||||||
href='https://habitica.wordpress.com/2020/07/15/easy-starter-quests-for-beginners/'
|
Summer Splash event, everyone who didn't already have an Orca gets either the mount or
|
||||||
target='_blank'>featured Wiki article</a> is about Easy Starter Quests for Beginners! We
|
the pet. Enjoy!
|
||||||
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>.
|
|
||||||
</p>
|
</p>
|
||||||
<div class="small mb-3">by shanaqui and the Wiki Wizards</div>
|
<div class="small mb-3">by Beffymaroo and UncommonCriminal</div>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user