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 = 'CONFECTION HATCHING POTION QUEST, APRIL FOOL BLOG POST, AND SHINY SEEDS!'; 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')}

4/7/2020 - ${LAST_ANNOUNCEMENT_TITLE}


April Fool's Challenge Winners and Blog Post!

The winners of the April Fool's Social Media Challenge have been selected! Congratulations to Silvercat17, RaidingPartyGames, Pangdood, Spacehawk, and VixiMonster!

Thank you to everyone who shared their awesome pics with their dessert pets! You can see a fun recap of the shenanigans on our blog. Stay tuned to see what wacky antics the Fool gets up to next year!

Confection Magic Hatching Potion Quest!

Oh, no! Just as Habiticans were going back to daily life, missing their cute dessert pets, it looks like some kind of syrupy monstrosity has emerged to threaten the land!

Can you help the April Fool save Habitica from the Awful Waffle? Join the battle, and earn special Confection Magic Hatching potions by completing your everyday tasks.

You can purchase the limited Confection Magic Hatching Potion Quest from the Quest Shop between now and April 30! Each quest completion awards participants three potions each. Confection pets do not have mount forms, so keep that in mind when you're purchasing!

Garden Potions have also returned, if you prefer a healthier treat! You can find them in the Market until April 30. Keep in mind that Garden pets also do not have mount forms when deciding how many to purchase.

After they're gone, it will be at least a year before the Confection Magic Hatching Potion Quest or the Garden Magic Potions are available again, so be sure to get them now!

by Beffymaroo, Piyo, Viirus, and SabreCat

Shiny Seeds

Throw a Shiny Seed at your friends and they will turn into a cheerful flower until their next cron! You can buy the Seeds in the Seasonal Shop with Gold. Plus, if you get transformed by a Shiny Seed, you'll receive the Agricultural Friends badge!

Don't want to be a flower? Just buy some Petal-Free Potion from your Rewards column to reverse it.

Shiny Seeds will be available in the Seasonal Shop until April 30th!

by Lemoness
`, }); }, }; /** * @api {post} /api/v3/news/tell-me-later Allow latest Bailey announcement to be read later * @apiName TellMeLaterNews * @apiDescription Add a notification to allow viewing of the latest "New Stuff by Bailey" message. * Prevent this specific Bailey message from appearing automatically. * @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;