import { authWithHeaders } from '../../middlewares/auth'; const api = {}; // @TODO export this const, cannot export it from here because only routes are exported from // controllers const LAST_ANNOUNCEMENT_TITLE = 'WINTER WONDERLAND BEGINS! CLASS OUTFITS, QUESTS, AND HATCHING POTIONS'; const worldDmg = { // @TODO bailey: false, }; /** * @api {get} /api/v3/news Get latest Bailey announcement * @apiName GetNews * @apiGroup News * * * @apiSuccess {Object} html Latest Bailey html * */ api.getNews = { method: 'GET', url: '/news', async handler (req, res) { const baileyClass = worldDmg.bailey ? 'npc_bailey_broken' : 'npc_bailey'; res.status(200).send({ html: `

${res.t('newStuff')}

12/19/2019 - ${LAST_ANNOUNCEMENT_TITLE}


A wintery breeze is blowing in from the Stoïkalm Steppes, and the snow is gently drifting down over Habit City. The Winter Wonderland event has begun!

Winter Class Outfits

From now until January 31st, limited edition outfits are available in the Rewards column. Depending on your class, you can be an Evergreen Warrior, Bell Mage, Winter Spice Healer, or Lantern Rogue! You'd better get productive to earn enough Gold before they disappear. Good luck!

by Vikte, gawrone, jjgame83, Aspiring Advocate, and SabreCat

Seasonal Shop is Open!

The Seasonal Shop has opened! The Seasonal Sorceress is stocking the seasonal edition versions of previous winter outfits, now available for Gems instead of Gold, and the Winter Quest Chain. Plus, there will be more fun things in the shop as the event progresses. The Seasonal Shop will only be open until January 31st, so don't wait!

by Lt Cabel, Vikte, AnnDeLune, Persephone, WeeWitch, katy133, yayannabelle, Stefalupagus, Io Breese, foreverender, Podcod, Beffymaroo, SabreCat, and Lemoness

Discounted Quest Bundle: Winter Quests

If you're looking to add some cold weather friends to your Habitica stable, you're in luck! From now until January 31, you can purchase the Winter Quest Bundle and receive the Trapper Santa, Find the Cub, and Penguin quests, all for only 7 Gems! That's a discount of 5 Gems from the price of purchasing them separately. Check it out in the Quest Shop today!

by Lemoness and SabreCat
Art by UncommonCriminal, Shaner, Eevachu, Pandoro, melynnrose, Breadstrings, Rattify, and PainterProphet
Writing by Lefnire, Leephon, and Daniel the Bard

New Aurora Hatching Potions and the Return of Holly and Starry Night!

There's a new pet breed in town! Check out the brand-new Aurora Potions and the return of Holly and Starry Night Potions to brighten your Winter Wonderland avatar look. Buy them from the Market and use them to hatch any standard pet egg. (Magic Hatching Potions do not work on Quest Pet eggs.) Magic Hatching Potion Pets aren't picky, so they'll happily eat any kind of food that you feed them!

After they're gone, it will be at least a year before these three Hatching Potions are available again, so be sure to get them now!

by QuartzFox, Archeia, Willow The Witty, JinjooHat, Tyche Alba, and SabreCat
`, }); }, }; /** * @api {post} /api/v3/news/tell-me-later Get latest Bailey announcement in a second moment * @apiName TellMeLaterNews * @apiGroup News * * * @apiSuccess {Object} data An empty Object * */ api.tellMeLaterNews = { method: 'POST', middlewares: [authWithHeaders()], url: '/news/tell-me-later', async handler (req, res) { const { user } = res.locals; user.flags.newStuff = false; const existingNotificationIndex = user.notifications.findIndex(n => n && n.type === 'NEW_STUFF'); if (existingNotificationIndex !== -1) user.notifications.splice(existingNotificationIndex, 1); user.addNotification('NEW_STUFF', { title: LAST_ANNOUNCEMENT_TITLE }, true); // seen by default await user.save(); res.respond(200, {}); }, }; export default api;