feat(event): Naming Day 2017

This commit is contained in:
SabreCat
2017-07-31 20:22:09 +00:00
parent aad6130b21
commit 568e8840ed
10 changed files with 169 additions and 15 deletions

View File

@@ -0,0 +1,109 @@
var migrationName = '20170731_naming_day.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 Royal Purple Gryphon Helm to Royal Purple Gryphon pet owners,
* award Royal Purple Gryphon pet to Royal Purple Gryphon mount owners,
* award Royal Purple Gryphon mount to everyone else
*/
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-01')},
};
if (lastId) {
query._id = {
$gt: lastId
}
}
dbUsers.find(query, {
sort: {_id: 1},
limit: 250,
fields: [
'items.mounts',
'items.pets',
] // specify fields we are interested in to limit retrieved data (empty if we're not reading data):
})
.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 = {};
var inc = {
'achievements.habiticaDays': 1,
'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
};
if (user.items.pets['Gryphon-RoyalPurple']) {
set = {'migration':migrationName, 'items.gear.owned.head_special_namingDay2017': false};
} else if (user.items.mounts['Gryphon-RoyalPurple']) {
set = {'migration':migrationName, 'items.pets.Gryphon-RoyalPurple': 5};
} else {
set = {'migration':migrationName, 'items.mounts.Gryphon-RoyalPurple': true};
}
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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -740,6 +740,8 @@
"headSpecialDandyHatNotes": "What a merry chapeau! You'll look quite fine enjoying a stroll in it. Increases Constitution by <%= con %>.", "headSpecialDandyHatNotes": "What a merry chapeau! You'll look quite fine enjoying a stroll in it. Increases Constitution by <%= con %>.",
"headSpecialKabutoText": "Kabuto", "headSpecialKabutoText": "Kabuto",
"headSpecialKabutoNotes": "This helm is functional and beautiful! Your enemies will become distracted admiring it. Increases Intelligence by <%= int %>.", "headSpecialKabutoNotes": "This helm is functional and beautiful! Your enemies will become distracted admiring it. Increases Intelligence by <%= int %>.",
"headSpecialNamingDay2017Text": "Royal Purple Gryphon Helm",
"headSpecialNamingDay2017Notes": "Happy Naming Day! Wear this fierce and feathery helm as you celebrate Habitica. Confers no benefit.",
"headSpecialNyeText": "Absurd Party Hat", "headSpecialNyeText": "Absurd Party Hat",
"headSpecialNyeNotes": "You've received an Absurd Party Hat! Wear it with pride while ringing in the New Year! Confers no benefit.", "headSpecialNyeNotes": "You've received an Absurd Party Hat! Wear it with pride while ringing in the New Year! Confers no benefit.",

View File

@@ -1436,6 +1436,12 @@ let head = {
value: 60, value: 60,
int: 7, int: 7,
}, },
namingDay2017: {
text: t('headSpecialNamingDay2017Text'),
notes: t('headSpecialNamingDay2017Notes'),
value: 0,
canOwn: ownsItem('head_special_namingDay2017'),
},
}; };
let headAccessory = { let headAccessory = {

View File

@@ -1,31 +1,68 @@
h2 7/30/2017 - LAST CHANCES FOR LIMITED ITEMS AND HABITICANS HELPING ENTREPRENEURS h2 7/31/2017 - HABITICA NAMING DAY, PURPLE GRYPHON REWARDS, AND COMING-SOON HABITICA SITE UPGRADE
hr hr
.promo_aquatic_potions.pull-left.slight-right-margin
tr tr
td td
.promo_mystery_201707.pull-right .achievement-habiticaDay2x.pull-right
h3 Last Chance for Jellymancer Set h3 Habitica Naming Day
p Reminder: you only have two days to <a href='/#/options/settings/subscription'>subscribe</a> and receive the Jellymancer Set! Subscribing also lets you buy gems for gold. The longer your subscription, the more gems you get! p Happy Habitica Naming Day! In honor of the day when we changed the name of the app from HabitRPG to Habitica, we've given everyone an achievement, as well as some delicious cake for your pets and mounts.
p.small.muted by Lemoness and SabreCat
tr
td
.promo_naming_day_2017.pull-left.slight-right-margin
h3 Habitica Purple Gryphons
p Speaking of pets and mounts, we've given all new users our Purple Gryphon Mount, Melior! If you already received Melior last year, we've given you his little sister Meliora, a Purple Gryphon Pet. You can find them in the Rare Pet/Rare Mount sections of the stable! Already had both of them? Now you get a cool Purple Gryphon Helm in the Rewards column!
br br
p Thanks so much for your support! You help keep Habitica running. p Thanks for being a Habitica user -- you all mean so much to us. We hope that you enjoy your presents!
p.small.muted by Lemoness p.small.muted by Lemoness, Beffymaroo, and Baconsaur
tr tr
td td
h3 Last Chance for Aquatic Hatching Potions .promo_redesign_header.pull-right
p Reminder: there are only two days left to <a href='/#/options/inventory/drops'>buy Aquatic Hatching Potions!</a> If they come back, it won't be until next year at the earliest, so don't delay! h3 Coming Soon: Habitica Levels Up
p.small.muted by Stefalupagus and Beffymaroo p We're very excited to announce a big change that we've been working on for a long time: Habitica is getting a huge design upgrade that will make it faster, prettier, and easier to use!
tr
td
h3 Habiticans Helping Entrepreneurs
p Did you know that Habitica has partnered with <a href='http://www.playseeds.com/#social-good' target='_blank'>Seeds</a>, an organization that sends micro-loans to entrepreneurs in developing countries? When you buy the 84-gem pack in the apps, a portion of the proceeds will go directly to small business owners in developing countries to help improve their lives. Last month alone, Habitica provided an estimated 128 micro-loans to entrepreneurs in Kenya thanks to the generosity of Habitica users!
br br
p You can learn more about how it works by tapping the gem icon in your app. Check it out! p In particular, many of our design choices are the result of a ton of user feedback that weve been compiling over time.
br
p The upgrade will be happening later this August, so stay tuned for more details soon! Some exciting things to look forward to:
br
.promo_redesign_tavern.center-block
br
ul
li An emphasis on making the world of Habitica feel more immersive, including new NPC banners that show cool scenes, avatars that are visible in chat, and a login page highlighting the night-time Habitica countryside
li Fun new features such as tags for Guilds and Challenges, more filtering options, and the ability to customize your Reward column by pinning any purchasable item in the game.
li A cleaner look that is more intuitive to learn, and more consistent with our mobile apps
li A special veteran pet awarded to all users!
br
.promo_redesign_login.center-block
br
p Keep an eye on upcoming Bailey announcements for more information soon!
p.small.muted by Paglias, TheHollidayInn, Negue, Apollo, piyorii, beffymaroo, Lemoness, redphoenix, viirus, and the rest of the Habitica Team
if menuItem !== 'oldNews' if menuItem !== 'oldNews'
hr hr
a(href='/static/old-news', target='_blank') Read older news a(href='/static/old-news', target='_blank') Read older news
mixin oldNews mixin oldNews
h2 7/30/2017 - LAST CHANCES FOR LIMITED ITEMS AND HABITICANS HELPING ENTREPRENEURS
.promo_aquatic_potions.pull-left.slight-right-margin
tr
td
.promo_mystery_201707.pull-right
h3 Last Chance for Jellymancer Set
p Reminder: you only have two days to <a href='/#/options/settings/subscription'>subscribe</a> and receive the Jellymancer 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 Aquatic Hatching Potions
p Reminder: there are only two days left to <a href='/#/options/inventory/drops'>buy Aquatic Hatching Potions!</a> If they come back, it won't be until next year at the earliest, so don't delay!
p.small.muted by Stefalupagus and Beffymaroo
tr
td
h3 Habiticans Helping Entrepreneurs
p Did you know that Habitica has partnered with <a href='http://www.playseeds.com/#social-good' target='_blank'>Seeds</a>, an organization that sends micro-loans to entrepreneurs in developing countries? When you buy the 84-gem pack in the apps, a portion of the proceeds will go directly to small business owners in developing countries to help improve their lives. Last month alone, Habitica provided an estimated 128 micro-loans to entrepreneurs in Kenya thanks to the generosity of Habitica users!
br
p You can learn more about how it works by tapping the gem icon in your app. Check it out!
h2 7/27/2017 - GUILD SPOTLIGHT: PET CARE h2 7/27/2017 - GUILD SPOTLIGHT: PET CARE
tr tr
td td