diff --git a/migrations/archive/2019/20190131_habit_birthday.js b/migrations/archive/2019/20190131_habit_birthday.js new file mode 100644 index 0000000000..97a7134122 --- /dev/null +++ b/migrations/archive/2019/20190131_habit_birthday.js @@ -0,0 +1,88 @@ +/* eslint-disable no-console */ +const MIGRATION_NAME = '20190131_habit_birthday'; +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 inc = { + 'items.food.Cake_Skeleton': 1, + 'items.food.Cake_Base': 1, + 'items.food.Cake_CottonCandyBlue': 1, + 'items.food.Cake_CottonCandyPink': 1, + 'items.food.Cake_Shade': 1, + 'items.food.Cake_White': 1, + 'items.food.Cake_Golden': 1, + 'items.food.Cake_Zombie': 1, + 'items.food.Cake_Desert': 1, + 'items.food.Cake_Red': 1, + 'achievements.habitBirthdays': 1, + }; + const set = {}; + let push; + + set.migration = MIGRATION_NAME; + + if (typeof user.items.gear.owned.armor_special_birthday2018 !== 'undefined') { + set['items.gear.owned.armor_special_birthday2019'] = false; + push = {pinnedItems: {type: 'marketGear', path: 'gear.flat.armor_special_birthday2019', _id: uuid()}}; + } else if (typeof user.items.gear.owned.armor_special_birthday2017 !== 'undefined') { + set['items.gear.owned.armor_special_birthday2018'] = false; + push = {pinnedItems: {type: 'marketGear', path: 'gear.flat.armor_special_birthday2018', _id: uuid()}}; + } else if (typeof user.items.gear.owned.armor_special_birthday2016 !== 'undefined') { + set['items.gear.owned.armor_special_birthday2017'] = false; + push = {pinnedItems: {type: 'marketGear', path: 'gear.flat.armor_special_birthday2017', _id: uuid()}}; + } else if (typeof user.items.gear.owned.armor_special_birthday2015 !== 'undefined') { + set['items.gear.owned.armor_special_birthday2016'] = false; + push = {pinnedItems: {type: 'marketGear', path: 'gear.flat.armor_special_birthday2016', _id: uuid()}}; + } else if (typeof user.items.gear.owned.armor_special_birthday !== 'undefined') { + set['items.gear.owned.armor_special_birthday2015'] = false; + push = {pinnedItems: {type: 'marketGear', path: 'gear.flat.armor_special_birthday2015', _id: uuid()}}; + } else { + set['items.gear.owned.armor_special_birthday'] = false; + push = {pinnedItems: {type: 'marketGear', path: 'gear.flat.armor_special_birthday', _id: uuid()}}; + } + + if (count % progressCount === 0) console.warn(`${count} ${user._id}`); + + return await User.update({_id: user._id}, {$inc: inc, $set: set, $push: push}).exec(); +} + +module.exports = async function processUsers () { + let query = { + migration: {$ne: MIGRATION_NAME}, + 'auth.timestamps.loggedin': {$gt: new Date('2019-01-15')}, + }; + + 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/test/common/ops/buy/purchase.js b/test/common/ops/buy/purchase.js index fd1ab65b48..65368bcbaa 100644 --- a/test/common/ops/buy/purchase.js +++ b/test/common/ops/buy/purchase.js @@ -13,7 +13,7 @@ import forEach from 'lodash/forEach'; import moment from 'moment'; describe('shared.ops.purchase', () => { - const SEASONAL_FOOD = 'Meat'; + const SEASONAL_FOOD = 'Cake_Base'; let user; let goldPoints = 40; let analytics = {track () {}}; diff --git a/website/client/assets/scss/variables.scss b/website/client/assets/scss/variables.scss index 2a0f49aff9..bc3827916d 100644 --- a/website/client/assets/scss/variables.scss +++ b/website/client/assets/scss/variables.scss @@ -2,8 +2,8 @@ // possible values are: normal, fall, habitoween, thanksgiving, winter, nye, birthday, valentines, spring, summer // more to be added on future seasons -$npc_market_flavor: 'winter'; -$npc_quests_flavor: 'winter'; -$npc_seasonal_flavor: 'winter'; -$npc_timetravelers_flavor: 'winter'; -$npc_tavern_flavor: 'winter'; +$npc_market_flavor: 'birthday'; +$npc_quests_flavor: 'birthday'; +$npc_seasonal_flavor: 'birthday'; +$npc_timetravelers_flavor: 'birthday'; +$npc_tavern_flavor: 'birthday'; diff --git a/website/common/locales/en/gear.json b/website/common/locales/en/gear.json index 26c13378aa..8a0196db5e 100644 --- a/website/common/locales/en/gear.json +++ b/website/common/locales/en/gear.json @@ -511,6 +511,8 @@ "armorSpecialBirthday2017Notes": "Happy Birthday, Habitica! Wear these Whimsical Party Robes to celebrate this wonderful day. Confers no benefit.", "armorSpecialBirthday2018Text": "Fanciful Party Robes", "armorSpecialBirthday2018Notes": "Happy Birthday, Habitica! Wear these Fanciful Party Robes to celebrate this wonderful day. Confers no benefit.", + "armorSpecialBirthday2019Text": "Outlandish Party Robes", + "armorSpecialBirthday2019Notes": "Happy Birthday, Habitica! Wear these Outlandish Party Robes to celebrate this wonderful day. Confers no benefit.", "armorSpecialGaymerxText": "Rainbow Warrior Armor", "armorSpecialGaymerxNotes": "In celebration of the GaymerX Conference, this special armor is decorated with a radiant, colorful rainbow pattern! GaymerX is a game convention celebrating LGTBQ and gaming and is open to everyone.", diff --git a/website/common/script/content/gear/sets/special/index.js b/website/common/script/content/gear/sets/special/index.js index 27c2232d1e..dc8cc9e8c7 100644 --- a/website/common/script/content/gear/sets/special/index.js +++ b/website/common/script/content/gear/sets/special/index.js @@ -1107,6 +1107,12 @@ let armor = { value: 90, con: 15, }, + birthday2019: { + text: t('armorSpecialBirthday2019Text'), + notes: t('armorSpecialBirthday2019Notes'), + value: 0, + canOwn: ownsItem('armor_special_birthday2019'), + }, }; let back = { diff --git a/website/common/script/content/index.js b/website/common/script/content/index.js index 4d131a0a0e..b19696735c 100644 --- a/website/common/script/content/index.js +++ b/website/common/script/content/index.js @@ -356,12 +356,12 @@ api.specialMounts = stable.specialMounts; api.mountInfo = stable.mountInfo; // For seasonal events, change these booleans: -let canBuyNormalFood = true; -let canDropNormalFood = true; +let canBuyNormalFood = false; +let canDropNormalFood = false; let canBuyCandyFood = false; let canDropCandyFood = false; -let canBuyCakeFood = false; -let canDropCakeFood = false; +let canBuyCakeFood = true; +let canDropCakeFood = true; api.food = { Meat: { diff --git a/website/raw_sprites/spritesmith/gear/events/birthday/broad_armor_special_birthday2019.png b/website/raw_sprites/spritesmith/gear/events/birthday/broad_armor_special_birthday2019.png new file mode 100644 index 0000000000..9c45413daa Binary files /dev/null and b/website/raw_sprites/spritesmith/gear/events/birthday/broad_armor_special_birthday2019.png differ diff --git a/website/raw_sprites/spritesmith/gear/events/birthday/shop_armor_special_birthday2019.png b/website/raw_sprites/spritesmith/gear/events/birthday/shop_armor_special_birthday2019.png new file mode 100644 index 0000000000..b0851a198c Binary files /dev/null and b/website/raw_sprites/spritesmith/gear/events/birthday/shop_armor_special_birthday2019.png differ diff --git a/website/raw_sprites/spritesmith/gear/events/birthday/slim_armor_special_birthday2019.png b/website/raw_sprites/spritesmith/gear/events/birthday/slim_armor_special_birthday2019.png new file mode 100644 index 0000000000..bb97f37e5e Binary files /dev/null and b/website/raw_sprites/spritesmith/gear/events/birthday/slim_armor_special_birthday2019.png differ diff --git a/website/raw_sprites/spritesmith/npcs/npc_bailey.png b/website/raw_sprites/spritesmith/npcs/npc_bailey.png index db86596503..77347e3749 100644 Binary files a/website/raw_sprites/spritesmith/npcs/npc_bailey.png and b/website/raw_sprites/spritesmith/npcs/npc_bailey.png differ diff --git a/website/raw_sprites/spritesmith/npcs/npc_justin.png b/website/raw_sprites/spritesmith/npcs/npc_justin.png index bf42f04508..08ad42e374 100644 Binary files a/website/raw_sprites/spritesmith/npcs/npc_justin.png and b/website/raw_sprites/spritesmith/npcs/npc_justin.png differ diff --git a/website/raw_sprites/spritesmith/npcs/npc_matt.png b/website/raw_sprites/spritesmith/npcs/npc_matt.png index ed0e3bab59..056b638cdc 100644 Binary files a/website/raw_sprites/spritesmith/npcs/npc_matt.png and b/website/raw_sprites/spritesmith/npcs/npc_matt.png differ diff --git a/website/raw_sprites/spritesmith_large/promo_birthday_2019.png b/website/raw_sprites/spritesmith_large/promo_birthday_2019.png new file mode 100644 index 0000000000..8ddd615ef9 Binary files /dev/null and b/website/raw_sprites/spritesmith_large/promo_birthday_2019.png differ diff --git a/website/server/controllers/api-v3/news.js b/website/server/controllers/api-v3/news.js index f0f2410a72..f5488daf27 100644 --- a/website/server/controllers/api-v3/news.js +++ b/website/server/controllers/api-v3/news.js @@ -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 = 'JANUARY SUBSCRIBER ITEMS REVEALED!'; +const LAST_ANNOUNCEMENT_TITLE = 'HABITICA BIRTHDAY PARTY!'; const worldDmg = { // @TODO bailey: false, }; @@ -30,14 +30,29 @@ api.getNews = {
January 31st is Habitica's Birthday! Thank you so much for being a part of our community - it means a lot.
+Now come join us and the NPCs as we celebrate!
+In honor of the festivities, everyone has been awarded an assortment of yummy cake to feed to your pets! Plus, for the next two days Alexander the Merchant is selling cake in his shop, and cake will sometimes drop when you complete your tasks. Cake works just like normal pet food, but if you want to know what type of pet likes each slice, the wiki has spoilers.
+There are Party Robes available for free in the Rewards column! What color you receive is based on how many Habitica Birthdays you've celebrated. Don them with pride!
+In honor of Habitica's birthday, everyone has been awarded the Habitica Birthday Bash achievement! This achievement stacks for each Birthday Bash you celebrate with us.
-The January Subscriber Items have been revealed: the Polaris Item Set! You only have until Jan 31 to receive the item set when you subscribe. If you're already an active subscriber, reload the site and then head to Inventory > Items to claim your gear!
-Subscribers also receive the ability to buy Gems for Gold -- the longer you subscribe, the more Gems you can buy per month! There are other perks as well, such as longer access to uncompressed data and a cute Jackalope pet. Best of all, subscriptions let us keep Habitica running. Thank you very much for your support -- it means a lot to us.
+Reminder: tomorrow is the final day to subscribe and receive the Polaris Armor Set! Subscribing also lets you buy Gems for Gold. The longer your subscription, the more Gems you get!
+Thanks so much for your support! You help keep Habitica running.
Reminder: tomorrow is the final day to buy Starry Night, Peppermint, and Icy Snow Hatching Potions! If they come back, it won't be until next year at the earliest, so don't delay!
+