diff --git a/migrations/archive/2019/20191127_harvest_feast.js b/migrations/archive/2019/20191127_harvest_feast.js new file mode 100644 index 0000000000..9ee1938b10 --- /dev/null +++ b/migrations/archive/2019/20191127_harvest_feast.js @@ -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 + } +}; diff --git a/website/raw_sprites/spritesmith_large/promo_harvest_feast.png b/website/raw_sprites/spritesmith_large/promo_harvest_feast.png new file mode 100644 index 0000000000..2d5c520be2 Binary files /dev/null and b/website/raw_sprites/spritesmith_large/promo_harvest_feast.png differ diff --git a/website/server/controllers/api-v3/news.js b/website/server/controllers/api-v3/news.js index 48057ca16c..c9d6119380 100644 --- a/website/server/controllers/api-v3/news.js +++ b/website/server/controllers/api-v3/news.js @@ -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 QUEST FOR AMBER MAGIC HATCHING POTIONS!'; +const LAST_ANNOUNCEMENT_TITLE = 'HABITICA HARVEST FEAST! AND LAST CHANCE FOR NOVEMBER LIMITED TIME ITEMS'; const worldDmg = { // @TODO bailey: false, }; @@ -31,18 +31,62 @@ api.getNews = {
- Won't you stay a while--a few epochs, perhaps, preserved perfectly and beautifully? - Get the latest Magic Hatching Potion quest, "The Amber Alliance," and defeat the Trerezin - to earn Amber Magic Hatching Potions by completing your real-life tasks! + It's time for Habitica's Harvest Feast! On this day Habiticans celebrate by spending + time with loved ones, giving thanks, enjoying their favorite foods, and riding their + glorious turkeys into the magnificent sunset. Some of the NPCs are celebrating the + occasion!
-+ 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! +
+Thank you for using Habitica - we really love you all <3
++ Reminder: the end of November is the last chance to receive the Crystal Charmer Set when + you sign up for a Habitica subscription! + Subscribing also lets you buy Gems for Gold. The longer your subscription, the more Gems + you can get! +
+
Thanks so much for your support! You help keep Habitica running.
++ Reminder: time is running out to buy Thunderstorm and Ember + Hatching Potions! If they come back, it won't be until next year at the earliest, so + don't delay! +
++ 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 Quest Shop before this deal goes + extinct! +
+