feat(content): Harvest Feast 2019

This commit is contained in:
Sabe Jones
2019-11-27 15:45:37 -06:00
parent 42de623fc6
commit e597906f35
4 changed files with 180 additions and 8 deletions

View File

@@ -0,0 +1,126 @@
/* eslint-disable no-console */
const MIGRATION_NAME = '20191127_harvest_feast';
import { v4 as uuid } from 'uuid';
import { model as User } from '../../../website/server/models/user';
const progressCount = 1000;
let count = 0;
async function updateUser (user) {
count++;
const set = {};
let inc;
let push;
set.migration = MIGRATION_NAME;
if (typeof user.items.gear.owned.head_special_turkeyHelmGilded !== 'undefined') {
inc = {
'items.food.Pie_Base': 1,
'items.food.Pie_CottonCandyBlue': 1,
'items.food.Pie_CottonCandyPink': 1,
'items.food.Pie_Desert': 1,
'items.food.Pie_Golden': 1,
'items.food.Pie_Red': 1,
'items.food.Pie_Shade': 1,
'items.food.Pie_Skeleton': 1,
'items.food.Pie_Zombie': 1,
'items.food.Pie_White': 1,
}
} else if (typeof user.items.gear.owned.armor_special_turkeyArmorBase !== 'undefined') {
set['items.gear.owned.head_special_turkeyHelmGilded'] = false;
set['items.gear.owned.armor_special_turkeyArmorGilded'] = false;
set['items.gear.owned.back_special_turkeyTailGilded'] = false;
push = [
{
type: 'marketGear',
path: 'gear.flat.head_special_turkeyHelmGilded',
_id: uuid(),
},
{
type: 'marketGear',
path: 'gear.flat.armor_special_turkeyArmorGilded',
_id: uuid(),
},
{
type: 'marketGear',
path: 'gear.flat.back_special_turkeyTailGilded',
_id: uuid(),
},
];
} else if (user.items && user.items.mounts && user.items.mounts['Turkey-Gilded']) {
set['items.gear.owned.head_special_turkeyHelmBase'] = false;
set['items.gear.owned.armor_special_turkeyArmorBase'] = false;
set['items.gear.owned.back_special_turkeyTailBase'] = false;
push = [
{
type: 'marketGear',
path: 'gear.flat.head_special_turkeyHelmBase',
_id: uuid(),
},
{
type: 'marketGear',
path: 'gear.flat.armor_special_turkeyArmorBase',
_id: uuid(),
},
{
type: 'marketGear',
path: 'gear.flat.back_special_turkeyTailBase',
_id: uuid(),
},
];
} else if (user.items && user.items.pets && user.items.pets['Turkey-Gilded']) {
set['items.mounts.Turkey-Gilded'] = true;
} else if (user.items && user.items.mounts && user.items.mounts['Turkey-Base']) {
set['items.pets.Turkey-Gilded'] = 5;
} else if (user.items && user.items.pets && user.items.pets['Turkey-Base']) {
set['items.mounts.Turkey-Base'] = true;
} else {
set['items.pets.Turkey-Base'] = 5;
}
if (count % progressCount === 0) console.warn(`${count} ${user._id}`);
if (inc) {
return await User.update({_id: user._id}, {$inc: inc, $set: set}).exec();
} else if (push) {
return await User.update({_id: user._id}, {$set: set, $push: {pinnedItems: {$each: push}}}).exec();
} else {
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-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],
};
}
await Promise.all(users.map(updateUser)); // eslint-disable-line no-await-in-loop
}
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -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 = 'NEW QUEST FOR AMBER MAGIC HATCHING POTIONS!'; const LAST_ANNOUNCEMENT_TITLE = 'HABITICA HARVEST FEAST! AND LAST CHANCE FOR NOVEMBER LIMITED TIME ITEMS';
const worldDmg = { // @TODO const worldDmg = { // @TODO
bailey: false, bailey: false,
}; };
@@ -31,18 +31,62 @@ 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>11/26/2019 - ${LAST_ANNOUNCEMENT_TITLE}</h2> <h2>11/27/2019 - ${LAST_ANNOUNCEMENT_TITLE}</h2>
</div> </div>
</div> </div>
<hr/> <hr/>
<div class="quest_amber center-block"></div> <div class="promo_harvest_feast center-block"></div>
<h3>Happy Harvest!</h3>
<p> <p>
Won't you stay a while--a few epochs, perhaps, preserved perfectly and beautifully? It's time for Habitica's Harvest Feast! On this day Habiticans celebrate by spending
Get the latest Magic Hatching Potion quest, "The Amber Alliance," and defeat the Trerezin time with loved ones, giving thanks, enjoying their favorite foods, and riding their
to earn Amber Magic Hatching Potions by completing your real-life tasks! glorious turkeys into the magnificent sunset. Some of the NPCs are celebrating the
occasion!
</p> </p>
<div class="small">Art by Vikte, -Tyr-, and beffymaroo</div> <h3>Turkey Pet, Mount, Costumes... and Pie!</h3>
<div class="small mb-3">Writing by Rain</div> <p>
Those of you who weren't around for all of our previous Harvest Feasts have received an
adorable Turkey! What kind of Turkey? It all depends on how many harvests you've
celebrated with us. If you've completed your Turkey collection, you'll receive a feast
of delicious pie for your pets!
</p>
<p>Thank you for using Habitica - we really love you all <3</p>
<div class="small mb-3">by Lemoness and Beffymaroo</div>
<div class="promo_mystery_201911 center-block"></div>
<h3>Last Chance for Crystal Charmer Subscriber Set</h3>
<p>
Reminder: the end of November is the last chance to receive the Crystal Charmer Set when
you <a href='/user/settings/subscription'>sign up for a Habitica subscription!</a>
Subscribing also lets you buy Gems for Gold. The longer your subscription, the more Gems
you can get!
<p>
<p>Thanks so much for your support! You help keep Habitica running.</p>
<div class="small mb-3">by Beffymaroo</div>
<div class="promo_ember_thunderstorm_potions center-block"></div>
<h3>Last Chance for Ember and Thunderstorm Potions</h3>
<p>
Reminder: time is running out to <a href='/shops/market'>buy Thunderstorm and Ember
Hatching Potions!</a> If they come back, it won't be until next year at the earliest, so
don't delay!
</p>
<div class="small mb-3">by Balduranne and SabreCat</div>
<div class="promo_delightful_dinos center-block"></div>
<h3>Last Chance for Delightful Dinos Pet Quest Bundle</h3>
<p>
There's also only a few days left to buy the discounted Delightful Dinos Pet Quest
Bundle, featuring the Pterodactyl, Triceratops, and T-Rex quests all for seven Gems! Be
sure to get yours from the <a href='/shops/quests'>Quest Shop</a> before this deal goes
extinct!
</p>
<div class="small">By SabreCat and Beffymaroo</div>
<div class="small">
Art by Baconsaur, Eevachu, UncommonCriminal, Kiwibot, McCoyly, plumilla, Seraphina,
PainterProphet, Stefalupagus, Katy133, Edge, Willow The Witty, Lilith of Alfheim,
Procyon, GeraldThePixel, and Archeia
</div>
<div class="small mb-3">
Writing by Lemoness, Daniel the Bard, Lilith of Alfheim, and Ali Stewart
</div>
</div> </div>
`, `,
}); });

View File

@@ -129,6 +129,8 @@ function _setUpNewUser (user) {
user.items.quests.dustbunnies = 1; user.items.quests.dustbunnies = 1;
user.purchased.background.violet = true; user.purchased.background.violet = true;
user.preferences.background = 'violet'; user.preferences.background = 'violet';
user.items.pets['Turkey-Base'] = 5;
user.items.currentPet = 'Turkey-Base';
user.markModified('items'); user.markModified('items');