mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
feat(event): Naming Day 2017
This commit is contained in:
109
migrations/20170731_naming_day.js
Normal file
109
migrations/20170731_naming_day.js
Normal 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 |
@@ -740,6 +740,8 @@
|
||||
"headSpecialDandyHatNotes": "What a merry chapeau! You'll look quite fine enjoying a stroll in it. Increases Constitution by <%= con %>.",
|
||||
"headSpecialKabutoText": "Kabuto",
|
||||
"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",
|
||||
"headSpecialNyeNotes": "You've received an Absurd Party Hat! Wear it with pride while ringing in the New Year! Confers no benefit.",
|
||||
|
||||
@@ -1436,6 +1436,12 @@ let head = {
|
||||
value: 60,
|
||||
int: 7,
|
||||
},
|
||||
namingDay2017: {
|
||||
text: t('headSpecialNamingDay2017Text'),
|
||||
notes: t('headSpecialNamingDay2017Notes'),
|
||||
value: 0,
|
||||
canOwn: ownsItem('head_special_namingDay2017'),
|
||||
},
|
||||
};
|
||||
|
||||
let headAccessory = {
|
||||
|
||||
@@ -1,5 +1,48 @@
|
||||
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
|
||||
tr
|
||||
td
|
||||
.achievement-habiticaDay2x.pull-right
|
||||
h3 Habitica Naming Day
|
||||
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
|
||||
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, Beffymaroo, and Baconsaur
|
||||
tr
|
||||
td
|
||||
.promo_redesign_header.pull-right
|
||||
h3 Coming Soon: Habitica Levels Up
|
||||
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!
|
||||
br
|
||||
p In particular, many of our design choices are the result of a ton of user feedback that we’ve 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'
|
||||
hr
|
||||
a(href='/static/old-news', target='_blank') Read older news
|
||||
|
||||
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
|
||||
@@ -20,12 +63,6 @@ h2 7/30/2017 - LAST CHANCES FOR LIMITED ITEMS AND HABITICANS HELPING ENTREPRENEU
|
||||
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!
|
||||
|
||||
if menuItem !== 'oldNews'
|
||||
hr
|
||||
a(href='/static/old-news', target='_blank') Read older news
|
||||
|
||||
mixin oldNews
|
||||
h2 7/27/2017 - GUILD SPOTLIGHT: PET CARE
|
||||
tr
|
||||
td
|
||||
|
||||
Reference in New Issue
Block a user