feat(content): NYE hats

This commit is contained in:
Sabe Jones
2020-12-29 18:58:57 -06:00
parent 69e40e2114
commit 595a31db99
11 changed files with 2234 additions and 2088 deletions

View File

@@ -0,0 +1,126 @@
/* eslint-disable no-console */
const MIGRATION_NAME = '20201229_nye';
import { model as User } from '../../../website/server/models/user';
import { v4 as uuid } from 'uuid';
const progressCount = 1000;
let count = 0;
async function updateUser (user) {
count++;
const set = { migration: MIGRATION_NAME };
let push;
if (typeof user.items.gear.owned.head_special_nye2019 !== 'undefined') {
set['items.gear.owned.head_special_nye2020'] = false;
push = [
{
type: 'marketGear',
path: 'gear.flat.head_special_nye2020',
_id: uuid(),
},
];
} else if (typeof user.items.gear.owned.head_special_nye2018 !== 'undefined') {
set['items.gear.owned.head_special_nye2019'] = false;
push = [
{
type: 'marketGear',
path: 'gear.flat.head_special_nye2019',
_id: uuid(),
},
];
} else if (typeof user.items.gear.owned.head_special_nye2017 !== 'undefined') {
set['items.gear.owned.head_special_nye2018'] = false;
push = [
{
type: 'marketGear',
path: 'gear.flat.head_special_nye2018',
_id: uuid(),
},
];
} else if (typeof user.items.gear.owned.head_special_nye2016 !== 'undefined') {
set['items.gear.owned.head_special_nye2017'] = false;
push = [
{
type: 'marketGear',
path: 'gear.flat.head_special_nye2017',
_id: uuid(),
},
];
} else if (typeof user.items.gear.owned.head_special_nye2015 !== 'undefined') {
set['items.gear.owned.head_special_nye2016'] = false;
push = [
{
type: 'marketGear',
path: 'gear.flat.head_special_nye2016',
_id: uuid(),
},
];
} else if (typeof user.items.gear.owned.head_special_nye2014 !== 'undefined') {
set['items.gear.owned.head_special_nye2015'] = false;
push = [
{
type: 'marketGear',
path: 'gear.flat.head_special_nye2015',
_id: uuid(),
},
];
} else if (typeof user.items.gear.owned.head_special_nye !== 'undefined') {
set['items.gear.owned.head_special_nye2014'] = false;
push = [
{
type: 'marketGear',
path: 'gear.flat.head_special_nye2014',
_id: uuid(),
},
];
} else {
set['items.gear.owned.head_special_nye'] = false;
push = [
{
type: 'marketGear',
path: 'gear.flat.head_special_nye',
_id: uuid(),
},
];
}
if (count % progressCount === 0) console.warn(`${count} ${user._id}`);
return await User.update({_id: user._id}, {$set: set, $push: {pinnedItems: {$each: push}}}).exec();
}
export default async function processUsers () {
let query = {
'auth.timestamps.loggedin': {$gt: new Date('2020-12-01')},
migration: {$ne: MIGRATION_NAME},
};
const fields = {
_id: 1,
items: 1,
};
while (true) { // eslint-disable-line no-constant-condition
const users = await User // eslint-disable-line no-await-in-loop
.find(query)
.limit(250)
.sort({_id: 1})
.select(fields)
.lean()
.exec();
if (users.length === 0) {
console.warn('All appropriate users found and modified.');
console.warn(`\n${count} users processed\n`);
break;
} else {
query._id = {
$gt: users[users.length - 1],
};
}
await Promise.all(users.map(updateUser)); // eslint-disable-line no-await-in-loop
}
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 KiB

After

Width:  |  Height:  |  Size: 207 KiB

View File

@@ -386,6 +386,9 @@
"weaponSpecialWinter2021HealerText": "Flake-Flanged Rod",
"weaponSpecialWinter2021HealerNotes": "Conduct your battles with a flourish and a flurry! Increases Intelligence by <%= int %>. Limited Edition 2020-2021 Winter Gear.",
"headSpecialNye2020Text": "Extravagant Party Hat",
"headSpecialNye2020Notes": "You've received an Extravagant Party Hat! Wear it with pride while ringing in the New Year! Confers no benefit.",
"weaponMystery201411Text": "Pitchfork of Feasting",
"weaponMystery201411Notes": "Stab your enemies or dig in to your favorite foods - this versatile pitchfork does it all! Confers no benefit. November 2014 Subscriber Item.",
"weaponMystery201502Text": "Shimmery Winged Staff of Love and Also Truth",

View File

@@ -1659,6 +1659,12 @@ const head = {
winter2021Healer: {
set: 'winter2021ArcticExplorerHealerSet',
},
nye2020: {
text: t('headSpecialNye2020Text'),
notes: t('headSpecialNye2020Notes'),
value: 0,
canOwn: ownsItem('head_special_nye2020'),
},
};
const headStats = {

View File

@@ -109,7 +109,7 @@ api.cardTypes = {
nye: {
key: 'nye',
messageOptions: 5,
yearRound: moment().isBefore('2020-01-02'),
yearRound: moment().isBefore('2021-01-02'),
},
thankyou: {
key: 'thankyou',

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

View File

@@ -144,10 +144,9 @@ function _setUpNewUser (user) {
user.items.quests.dustbunnies = 1;
user.purchased.background.violet = true;
user.preferences.background = 'violet';
if (moment().isBefore('2020-11-30')) {
user.migration = '20201126_harvest_feast';
user.items.pets['Turkey-Base'] = 5;
user.items.currentPet = 'Turkey-Base';
if (moment().isBefore('2021-01-02')) {
user.items.gear.owned.head_special_nye = true;
user.items.gear.equipped.head = 'head_special_nye';
}
user.markModified('items achievements');