-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add debug scripts to easilly get all pets/mounts/gear
- Loading branch information
1 parent
ed013ee
commit d62807f
Showing
5 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { MongoClient as mongo } from 'mongodb'; | ||
import config from '../config'; | ||
|
||
module.exports.updateUser = (_id, path, value) => { | ||
mongo.connect(config.NODE_DB_URI, (err, db) => { | ||
if (err) throw err; | ||
|
||
let collection = db.collection('users'); | ||
collection.updateOne( | ||
{ _id }, | ||
{ $set: { [`${path}`]: value } }, | ||
(updateErr, result) => { | ||
if (updateErr) throw updateErr; | ||
console.log('done updating', _id); | ||
db.close(); | ||
} | ||
); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict'; | ||
|
||
require('babel-register'); | ||
|
||
let _ = require('lodash'); | ||
let updateUser = require('./_helper').updateUser; | ||
|
||
let userId = process.argv[2]; | ||
|
||
if (!userId) { | ||
console.error('USAGE: node debug-scripts/grant-all-equipment.js <user_id>'); | ||
console.error('EFFECT: Adds all gear to specified user'); | ||
return; | ||
} | ||
|
||
let gearFlat = require('../common').content.gear.flat; | ||
|
||
let userGear = {}; | ||
|
||
_.each(gearFlat, (piece, key) => { | ||
userGear[key] = true; | ||
}); | ||
|
||
updateUser(userId, 'items.gear.owned', userGear); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
|
||
require('babel-register'); | ||
|
||
let _ = require('lodash'); | ||
let updateUser = require('./_helper').updateUser; | ||
let userId = process.argv[2]; | ||
|
||
if (!userId) { | ||
console.error('USAGE: node debug-scripts/grant-all-mounts.js <user_id>'); | ||
console.error('EFFECT: Adds all mounts to specified user'); | ||
return; | ||
} | ||
|
||
let dropMounts = require('../common').content.mounts; | ||
let questMounts = require('../common').content.questMounts; | ||
let specialMounts = require('../common').content.specialMounts; | ||
let premiumMounts = require('../common').content.premiumPets; // premium mounts isn't exposed on the content object | ||
|
||
let userMounts = {}; | ||
|
||
_.each([ dropMounts, questMounts, specialMounts, premiumMounts ], (set) => { | ||
_.each(set, (pet, key) => { | ||
userMounts[key] = true; | ||
}); | ||
}) | ||
|
||
updateUser(userId, 'items.mounts', userMounts); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
|
||
require('babel-register'); | ||
|
||
let _ = require('lodash'); | ||
let updateUser = require('./_helper').updateUser; | ||
let userId = process.argv[2]; | ||
|
||
if (!userId) { | ||
console.error('USAGE: node debug-scripts/grant-all-pets.js <user_id>'); | ||
console.error('EFFECT: Adds all pets to specified user'); | ||
return; | ||
} | ||
|
||
let dropPets = require('../common').content.pets; | ||
let questPets = require('../common').content.questPets; | ||
let specialPets = require('../common').content.specialPets; | ||
let premiumPets = require('../common').content.premiumPets; | ||
|
||
let userPets = {}; | ||
|
||
_.each([ dropPets, questPets, specialPets, premiumPets ], (set) => { | ||
_.each(set, (pet, key) => { | ||
userPets[key] = 95; | ||
}); | ||
}) | ||
|
||
updateUser(userId, 'items.pets', userPets); |