diff --git a/migrations/20170131_habit_birthday.js b/migrations/20170131_habit_birthday.js new file mode 100644 index 0000000000..a038066508 --- /dev/null +++ b/migrations/20170131_habit_birthday.js @@ -0,0 +1,109 @@ +var migrationName = '20170131_habit_birthday.js'; +var authorName = 'Sabe'; // in case script author needs to know when their ... +var authorUuid = '7f14ed62-5408-4e1b-be83-ada62d504931'; //... own data is done + +/* + * Award 2017 party robes if user has 2016 robes, 2016 robes if they have the 2015 robes, + * 2015 robes if they have the 2014 robes, and 2014 robes otherwise. Also cake! + */ + +var monk = require('monk'); +var connectionString = 'mongodb://localhost:27017/habitrpg?auto_reconnect=true'; // FOR TEST DATABASE +var dbUsers = monk(connectionString).get('users', { castIds: false }); + +function processUsers(lastId) { + // specify a query to limit the affected users (empty for all users): + var query = { + 'migration':{$ne:migrationName}, +// 'auth.timestamps.loggedin':{$gt:new Date('2017-01-24')}, // remove after first run to cover remaining users + }; + + if (lastId) { + query._id = { + $gt: lastId + } + } + + dbUsers.find(query, { + sort: {_id: 1}, + limit: 250, + fields: [ // specify fields we are interested in to limit retrieved data (empty if we're not reading data) + 'items.gear.owned' + ], + }) + .then(updateUsers) + .catch(function (err) { + console.log(err); + return exiting(1, 'ERROR! ' + err); + }); +} + +var progressCount = 1000; +var count = 0; + +function updateUsers (users) { + if (!users || users.length === 0) { + console.warn('All appropriate users found and modified.'); + displayData(); + return; + } + + var userPromises = users.map(updateUser); + var lastUser = users[users.length - 1]; + + return Promise.all(userPromises) + .then(function () { + processUsers(lastUser._id); + }); +} + +function updateUser (user) { + count++; + + var set = {'migration':migrationName}; + if (user.items && user.items.gear && user.items.gear.owned && user.items.gear.owned.hasOwnProperty('armor_special_birthday2016')) { + set['items.gear.owned.armor_special_birthday2017'] = false; + } else if (user.items && user.items.gear && user.items.gear.owned && user.items.gear.owned.hasOwnProperty('armor_special_birthday2015')) { + set['items.gear.owned.armor_special_birthday2016'] = false; + } else if (user.items && user.items.gear && user.items.gear.owned && user.items.gear.owned.hasOwnProperty('armor_special_birthday')) { + set['items.gear.owned.armor_special_birthday2015'] = false; + } else { + set['items.gear.owned.armor_special_birthday'] = false; + } + + var 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 + }; + + dbUsers.update({_id: user._id}, {$set:set, $inc:inc}); + + if (count % progressCount == 0) console.warn(count + ' ' + user._id); + if (user._id == authorUuid) console.warn(authorName + ' processed'); +} + +function displayData() { + console.warn('\n' + count + ' users processed\n'); + return exiting(0); +} + +function exiting(code, msg) { + code = code || 0; // 0 = success + if (code && !msg) { msg = 'ERROR!'; } + if (msg) { + if (code) { console.error(msg); } + else { console.log( msg); } + } + process.exit(code); +} + +module.exports = processUsers; diff --git a/website/assets/sprites/spritesmith/gear/events/birthday/broad_armor_special_birthday2017.png b/website/assets/sprites/spritesmith/gear/events/birthday/broad_armor_special_birthday2017.png new file mode 100644 index 0000000000..2b8959f4d0 Binary files /dev/null and b/website/assets/sprites/spritesmith/gear/events/birthday/broad_armor_special_birthday2017.png differ diff --git a/website/assets/sprites/spritesmith/gear/events/birthday/shop_armor_special_birthday2017.png b/website/assets/sprites/spritesmith/gear/events/birthday/shop_armor_special_birthday2017.png new file mode 100644 index 0000000000..7d3131ec4e Binary files /dev/null and b/website/assets/sprites/spritesmith/gear/events/birthday/shop_armor_special_birthday2017.png differ diff --git a/website/assets/sprites/spritesmith/gear/events/birthday/slim_armor_special_birthday2017.png b/website/assets/sprites/spritesmith/gear/events/birthday/slim_armor_special_birthday2017.png new file mode 100644 index 0000000000..f3f9ffa1ad Binary files /dev/null and b/website/assets/sprites/spritesmith/gear/events/birthday/slim_armor_special_birthday2017.png differ diff --git a/website/assets/sprites/spritesmith/npcs/npc_alex.png b/website/assets/sprites/spritesmith/npcs/npc_alex.png index 8d45538129..9d322bdeec 100644 Binary files a/website/assets/sprites/spritesmith/npcs/npc_alex.png and b/website/assets/sprites/spritesmith/npcs/npc_alex.png differ diff --git a/website/assets/sprites/spritesmith/npcs/npc_bailey.png b/website/assets/sprites/spritesmith/npcs/npc_bailey.png index db86596503..cec18b6ef8 100644 Binary files a/website/assets/sprites/spritesmith/npcs/npc_bailey.png and b/website/assets/sprites/spritesmith/npcs/npc_bailey.png differ diff --git a/website/assets/sprites/spritesmith/npcs/npc_daniel.png b/website/assets/sprites/spritesmith/npcs/npc_daniel.png index f28a922a1a..c41467d6ab 100644 Binary files a/website/assets/sprites/spritesmith/npcs/npc_daniel.png and b/website/assets/sprites/spritesmith/npcs/npc_daniel.png differ diff --git a/website/assets/sprites/spritesmith/npcs/npc_ian.png b/website/assets/sprites/spritesmith/npcs/npc_ian.png index 6d490c1152..fc421487a8 100644 Binary files a/website/assets/sprites/spritesmith/npcs/npc_ian.png and b/website/assets/sprites/spritesmith/npcs/npc_ian.png differ diff --git a/website/assets/sprites/spritesmith/npcs/npc_justin.png b/website/assets/sprites/spritesmith/npcs/npc_justin.png index bf42f04508..08ad42e374 100644 Binary files a/website/assets/sprites/spritesmith/npcs/npc_justin.png and b/website/assets/sprites/spritesmith/npcs/npc_justin.png differ diff --git a/website/assets/sprites/spritesmith/npcs/npc_matt.png b/website/assets/sprites/spritesmith/npcs/npc_matt.png index ed0e3bab59..26fe312661 100644 Binary files a/website/assets/sprites/spritesmith/npcs/npc_matt.png and b/website/assets/sprites/spritesmith/npcs/npc_matt.png differ diff --git a/website/common/locales/en/content.json b/website/common/locales/en/content.json index 41c54b203c..842103363b 100644 --- a/website/common/locales/en/content.json +++ b/website/common/locales/en/content.json @@ -218,6 +218,7 @@ "hatchingPotionGhost": "Ghost", "hatchingPotionRoyalPurple": "Royal Purple", "hatchingPotionHolly": "Holly", + "hatchingPotionCupid": "Cupid", "hatchingPotionNotes": "Pour this on an egg, and it will hatch as a <%= potText(locale) %> pet.", "premiumPotionAddlNotes": "Not usable on quest pet eggs.", diff --git a/website/common/script/content/constants.js b/website/common/script/content/constants.js index 69a8aa7c31..fe4634ab94 100644 --- a/website/common/script/content/constants.js +++ b/website/common/script/content/constants.js @@ -13,7 +13,7 @@ export const CLASSES = [ export const EVENTS = { winter: { start: '2013-12-31', end: '2014-02-01' }, - birthday: { start: '2016-01-29', end: '2016-02-02' }, + birthday: { start: '2017-01-31', end: '2017-02-02' }, spring: { start: '2014-03-21', end: '2014-05-01' }, summer: { start: '2014-06-20', end: '2014-08-01' }, fall: { start: '2014-09-21', end: '2014-11-01' }, diff --git a/website/common/script/content/gear/sets/special/index.js b/website/common/script/content/gear/sets/special/index.js index 3b5e55eafc..aa51be7ddf 100644 --- a/website/common/script/content/gear/sets/special/index.js +++ b/website/common/script/content/gear/sets/special/index.js @@ -531,6 +531,12 @@ let armor = { value: 90, con: 15, }, + birthday2017: { + text: t('armorSpecialBirthday2017Text'), + notes: t('armorSpecialBirthday2017Notes'), + value: 0, + canOwn: ownsItem('armor_special_birthday2017'), + }, }; let back = { diff --git a/website/common/script/content/index.js b/website/common/script/content/index.js index c700f4817c..2a68b3c4e0 100644 --- a/website/common/script/content/index.js +++ b/website/common/script/content/index.js @@ -149,12 +149,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/server/models/user/hooks.js b/website/server/models/user/hooks.js index 5c15db3733..e7e2547707 100644 --- a/website/server/models/user/hooks.js +++ b/website/server/models/user/hooks.js @@ -85,6 +85,19 @@ function _setUpNewUser (user) { user._ABtests.checkInModals = '20161221_showCheckInPreviews'; // show 'preview' check-in modals } user.items.quests.dustbunnies = 1; + user.items.gear.owned.armor_special_birthday = false; + user.items.food = { + 'Cake_Base': 1, + 'Cake_CottonCandyBlue': 1, + 'Cake_CottonCandyPink': 1, + 'Cake_Desert': 1, + 'Cake_Golden': 1, + 'Cake_Red': 1, + 'Cake_Shade': 1, + 'Cake_Skeleton': 1, + 'Cake_White': 1, + 'Cake_Zombie': 1, + }; if (user.registeredThrough === 'habitica-web' || user.registeredThrough === 'habitica-android') { taskTypes = ['habit', 'daily', 'todo', 'reward', 'tag']; diff --git a/website/views/shared/new-stuff.jade b/website/views/shared/new-stuff.jade index 4fdcf34700..eab7f2098e 100644 --- a/website/views/shared/new-stuff.jade +++ b/website/views/shared/new-stuff.jade @@ -1,23 +1,62 @@ -h2 1/26/2017 - BEFFYMAROO JOINS HABITICA STAFF; GUILD SPOTLIGHT ON HEALTH AND FITNESS +h2 1/31/2017 - HABITICA BIRTHDAY PARTY AND LAST CHANCE FOR MANY SPECIAL ITEMS hr tr td - .promo_contrib_spotlight_beffymaroo.pull-right - h3 New Staff Member: Beffymaroo! - p We're thrilled to announce that our long-time moderator and pixel artist Beffymaroo will be coming onboard as a staff member! She's been a major part of our community for a long time, and we couldn't be happier to welcome her aboard. Go congratulate her in the Tavern! - p.small.muted by the Habitica Team + h3 Habitica Birthday Bash + p January 31st is Habitica's Birthday! Thank you so much for being a part of our community - it means a lot. + br + p Now come join us and the NPCs as we celebrate! tr td - .promo_working_out.pull-left.slight-right-margin - h3 Guild Spotlight: Health and Fitness - p There's a new Guild Spotlight on the blog that highlights the Guilds that can help you as you evaluate your Health and Fitness goals for 2017! Check it out now to find Habitica's best Health and Fitness communities. - p.small.muted by Beffymaroo + .Pet_Food_Cake_Base.pull-left.slight-right-margin + h3 Cake for Everybody! + p 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. + tr + td + h3 Party Robes + p There are Party Robes available for free in the Rewards column! Don them with pride. + tr + td + .promo_holly_potions.pull-left.slight-right-margin + .achievement-birthday2x.pull-right + h3 Birthday Bash Achievement + p 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. + tr + td + h3 Last Chance for Winter Wonderland Outfits, Wintry Hair Colors, and Snowballs + p Today is the final day of the Winter Wonderland Festival, so if you still have any remaining Winter Wonderland Items that you want to buy, you'd better do it now! The Seasonal Edition items and Hair Colors won't be back until next December, and if the Limited Edition items return they will have increased prices or changed art, so be sure to snag them today! Due to the fact that the Wintry Skins were released later than the rest of the Seasonal Customization items, we've decided to make a special one-time exception to their end date, so they will be available until February 3rd rather than January 31st. + tr + td + .promo_mystery_201701.pull-right + h3 Last Chance for Time-Freezer Set + p Reminder: it's the final day to subscribe and receive the Timefreezer Set! Subscribing also lets you buy gems for gold. The longer your subscription, the more gems you get! + br + p Thanks so much for your support! You help keep Habitica running. + p.small.muted by Lemoness + tr + td + h3 Last Chance for Holly and Peppermint Hatching Potions + p Reminder: the 31st is the final day to buy Holly and Peppermint Hatching Potions! If they come back, it won't be until next year at the earliest, so don't delay! + p.small.muted by Vampitch, Lemoness, and SabreCat if menuItem !== 'oldNews' hr a(href='/static/old-news', target='_blank') Read older news mixin oldNews + h2 1/26/2017 - BEFFYMAROO JOINS HABITICA STAFF; GUILD SPOTLIGHT ON HEALTH AND FITNESS + tr + td + .promo_contrib_spotlight_beffymaroo.pull-right + h3 New Staff Member: Beffymaroo! + p We're thrilled to announce that our long-time moderator and pixel artist Beffymaroo will be coming onboard as a staff member! She's been a major part of our community for a long time, and we couldn't be happier to welcome her aboard. Go congratulate her in the Tavern! + p.small.muted by the Habitica Team + tr + td + .promo_working_out.pull-left.slight-right-margin + h3 Guild Spotlight: Health and Fitness + p There's a new Guild Spotlight on the blog that highlights the Guilds that can help you as you evaluate your Health and Fitness goals for 2017! Check it out now to find Habitica's best Health and Fitness communities. + p.small.muted by Beffymaroo h2 1/24/2017 - JANUARY SUBSCRIBER ITEMS REVEALED tr td