From b4035b5116e1c26a9895be5da18ff6c0e64d8c05 Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Fri, 27 Sep 2019 10:15:26 -0500 Subject: [PATCH] feat(kickstarter): stats, descriptions, migration --- .../archive/2019/20190927_kickstarter.js | 55 +++++++++++++++++++ website/common/locales/en/gear.json | 10 ++++ .../script/content/gear/sets/special/index.js | 27 ++++++--- 3 files changed, 83 insertions(+), 9 deletions(-) create mode 100644 migrations/archive/2019/20190927_kickstarter.js diff --git a/migrations/archive/2019/20190927_kickstarter.js b/migrations/archive/2019/20190927_kickstarter.js new file mode 100644 index 0000000000..47c8906618 --- /dev/null +++ b/migrations/archive/2019/20190927_kickstarter.js @@ -0,0 +1,55 @@ +/* eslint-disable no-console */ +const MIGRATION_NAME = '20190927_kickstarter'; +import { v4 as uuid } from 'uuid'; + +import { model as User } from '../../website/server/models/user'; + +const progressCount = 1000; +let count = 0; + +async function updateUser (user) { + count++; + + const set = {}; + + set.migration = MIGRATION_NAME; + + set['items.gear.owned.armor_special_ks2019'] = false; + const push = {pinnedItems: {type: 'marketGear', path: 'gear.flat.armor_special_ks2019', _id: uuid()}}; + + return await User.update({_id: user._id}, {$set: set, $push: push}).exec(); +} + +module.exports = async function processUsers () { + let query = { + migration: {$ne: MIGRATION_NAME}, + 'auth.local.lowerCaseUsername': {$in: []}, + }; + + 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 + } +}; diff --git a/website/common/locales/en/gear.json b/website/common/locales/en/gear.json index fde6b2cded..f1487ae0a5 100644 --- a/website/common/locales/en/gear.json +++ b/website/common/locales/en/gear.json @@ -122,6 +122,8 @@ "weaponSpecialTachiNotes": "This light and curved sword will shred your tasks to ribbons! Increases Strength by <%= str %>.", "weaponSpecialAetherCrystalsText": "Aether Crystals", "weaponSpecialAetherCrystalsNotes": "These bracers and crystals once belonged to the Lost Masterclasser herself. Increases all Stats by <%= attrs %>.", + "weaponSpecialKS2019Text": "Mythic Gryphon Glaive", + "weaponSpecialKS2019Notes": "Curved as a gryphon's beak and talons, this ornate polearm reminds you to power through when the task ahead feels daunting. Increases Strength by <%= str %>.", "weaponSpecialYetiText": "Yeti-Tamer Spear", "weaponSpecialYetiNotes": "This spear allows its user to command any yeti. Increases Strength by <%= str %>. Limited Edition 2013-2014 Winter Gear.", @@ -539,6 +541,8 @@ "armorSpecialTurkeyArmorBaseNotes": "Keep your drumsticks warm and cozy in this feathery armor! Confers no benefit.", "armorSpecialTurkeyArmorGildedText": "Gilded Turkey Armor", "armorSpecialTurkeyArmorGildedNotes": "Strut your stuff in this seasonally shiny armor! Confers no benefit.", + "armorSpecialKS2019Text": "Mythic Gryphon Armor", + "armorSpecialKS2019Notes": "Glowing from within like a gryphon's noble heart, this resplendent armor encourages you to take pride in your accomplishments. Increases Constitution by <%= con %>.", "armorSpecialYetiText": "Yeti-Tamer Robe", "armorSpecialYetiNotes": "Fuzzy and fierce. Increases Constitution by <%= con %>. Limited Edition 2013-2014 Winter Gear.", @@ -1067,6 +1071,8 @@ "headSpecialTurkeyHelmGildedNotes": "Gobble gobble! Bling bling! Confers no benefit.", "headSpecialPiDayText": "Pi Hat", "headSpecialPiDayNotes": "Try to balance this slice of delicious pie on your head while walking in a circle. Or throw it at a red Daily! Or you could just eat it. Your choice! Confers no benefit.", + "headSpecialKS2019Text": "Mythic Gryphon Helm", + "headSpecialKS2019Notes": "Adorned with a gryphon's likeness and plumage, this glorious helmet symbolizes the way your skills and bearing stand as an example to others. Increases Intelligence by <%= int %>.", "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.", @@ -1563,6 +1569,8 @@ "shieldSpecialWakizashiNotes": "This short sword is perfect for close-quarters battles with your Dailies! Increases Constitution by <%= con %>.", "shieldSpecialPiDayText": "Pi Shield", "shieldSpecialPiDayNotes": "We dare you to calculate the ratio of this shield's circumference to its deliciousness! Confers no benefit.", + "shieldSpecialKS2019Text": "Mythic Gryphon Shield", + "shieldSpecialKS2019Notes": "Sparkling like the shell of a gryphon egg, this magnificent shield shows you how to stand ready to help when your own burdens are light. Increases Perception by <%= per %>.", "shieldSpecialYetiText": "Yeti-Tamer Shield", "shieldSpecialYetiNotes": "This shield reflects light from the snow. Increases Constitution by <%= con %>. Limited Edition 2013-2014 Winter Gear.", @@ -2063,6 +2071,8 @@ "eyewearSpecialAetherMaskText": "Aether Mask", "eyewearSpecialAetherMaskNotes": "This mask has a mysterious history. Increases Intelligence by <%= int %>.", + "eyewearSpecialKS2019Text": "Mythic Gryphon Visor", + "eyewearSpecialKS2019Notes": "Bold as a gryphon's... hmm, gryphons don't have visors. It reminds you to... oh, who are we kidding, it just looks cool! Confers no benefit.", "eyewearSpecialSummerRogueText": "Roguish Eyepatch", "eyewearSpecialSummerRogueNotes": "It doesn't take a scallywag to see how stylish this is! Confers no benefit. Limited Edition 2014 Summer Gear.", diff --git a/website/common/script/content/gear/sets/special/index.js b/website/common/script/content/gear/sets/special/index.js index a65055e208..36917da31a 100644 --- a/website/common/script/content/gear/sets/special/index.js +++ b/website/common/script/content/gear/sets/special/index.js @@ -1259,8 +1259,10 @@ let armor = { }, ks2019: { text: t('armorSpecialKS2019Text'), - notes: t('armorSpecialKS2019Notes'), - value: 200, + notes: t('armorSpecialKS2019Notes', { con: 20 }), + value: 0, + con: 20, + canOwn: ownsItem('armor_special_ks2019'), }, }; @@ -1610,7 +1612,8 @@ let eyewear = { ks2019: { text: t('eyewearSpecialKS2019Text'), notes: t('eyewearSpecialKS2019Notes'), - value: 200, + value: 0, + canOwn: ownsItem('eyewear_special_ks2019'), }, }; @@ -2877,8 +2880,10 @@ let head = { }, ks2019: { text: t('headSpecialKS2019Text'), - notes: t('headSpecialKS2019Notes'), - value: 200, + notes: t('headSpecialKS2019Notes', { int: 20 }), + value: 0, + int: 20, + canOwn: ownsItem('head_special_ks2019'), }, }; @@ -4096,8 +4101,10 @@ let shield = { }, ks2019: { text: t('shieldSpecialKS2019Text'), - notes: t('shieldSpecialKS2019Notes'), - value: 200, + notes: t('shieldSpecialKS2019Notes', { per: 20 }), + value: 0, + per: 20, + canOwn: ownsItem('shield_special_ks2019'), }, }; @@ -5354,8 +5361,10 @@ let weapon = { }, ks2019: { text: t('weaponSpecialKS2019Text'), - notes: t('weaponSpecialKS2019Notes'), - value: 200, + notes: t('weaponSpecialKS2019Notes', { str: 20 }), + value: 0, + str: 20, + canOwn: ownsItem('weapon_special_ks2019'), }, };