@@ -2,7 +2,6 @@ | |||
const bcrypt = require('bcrypt-nodejs'); | |||
const messages = require('../misc/messages'); | |||
const skins = require('../config/skins'); | |||
const roles = require('../config/roles'); | |||
const profanities = require('../misc/profanities'); | |||
const fixes = require('../fixes/fixes'); | |||
const spirits = require('../config/spirits'); | |||
@@ -48,6 +47,8 @@ const getCreateLock = async () => { | |||
module.exports = { | |||
type: 'auth', | |||
accountLevel: 1, | |||
username: null, | |||
charname: null, | |||
characters: {}, | |||
@@ -129,7 +130,8 @@ module.exports = { | |||
type: 'auth', | |||
username: this.username, | |||
charname: this.charname, | |||
skins: this.skins | |||
skins: this.skins, | |||
accountLevel: this.accountLevel | |||
}; | |||
}, | |||
@@ -222,8 +224,7 @@ module.exports = { | |||
}, | |||
getSkinList: function (msg) { | |||
let list = [...this.skins, ...roles.getSkins(this.username)]; | |||
let skinList = skins.getSkinList(list); | |||
const skinList = skins.getSkinList(this.skins); | |||
msg.callback(skinList); | |||
}, | |||
@@ -252,8 +253,7 @@ module.exports = { | |||
}, | |||
verifySkin: function (character) { | |||
let list = [...this.skins, ...roles.getSkins(this.username)]; | |||
let skinList = skins.getSkinList(list); | |||
const skinList = skins.getSkinList(this.skins); | |||
if (!skinList.some(s => (s.id === character.skinId))) { | |||
character.skinId = '1.0'; | |||
@@ -263,8 +263,7 @@ module.exports = { | |||
}, | |||
doesOwnSkin: function (skinId) { | |||
let list = [...this.skins, ...roles.getSkins(this.username)]; | |||
let skinList = skins.getSkinList(list); | |||
const skinList = skins.getSkinList(this.skins); | |||
return skinList.some(s => s.id === (skinId + '') || s === '*'); | |||
}, | |||
@@ -1,4 +1,3 @@ | |||
const roles = require('../../config/roles'); | |||
const generator = require('../../items/generator'); | |||
const configSlots = require('../../items/config/slots'); | |||
const configMaterials = require('../../items/config/materials'); | |||
@@ -68,15 +67,18 @@ const contextActions = []; | |||
const commandActions = {}; | |||
module.exports = { | |||
actions: [], | |||
customChannels: [], | |||
roleLevel: null, | |||
init: function (blueprint) { | |||
if (this.customChannels) { | |||
this.customChannels = this.customChannels | |||
.filter((c, i) => (this.customChannels.indexOf(c) === i)); | |||
} | |||
}, | |||
calculateActions: function () { | |||
const chatCommandConfig = { | |||
localCommands, | |||
contextActions: extend([], contextActions), | |||
@@ -93,14 +95,8 @@ module.exports = { | |||
this[actionName] = actionHandler.bind(this); | |||
}); | |||
this.roleLevel = roles.getRoleLevel(this.obj); | |||
this.calculateActions(chatCommandConfig.contextActions); | |||
}, | |||
calculateActions: function (actions) { | |||
this.actions = actions | |||
.filter(c => this.roleLevel >= commandRoles[c.command]); | |||
this.actions = chatCommandConfig.contextActions | |||
.filter(c => this.obj.auth.accountLevel >= commandRoles[c.command]); | |||
}, | |||
onBeforeChat: function (msg) { | |||
@@ -124,7 +120,7 @@ module.exports = { | |||
}] | |||
}); | |||
return; | |||
} else if (this.roleLevel < commandRoles[actionName]) { | |||
} else if (this.obj.auth.accountLevel < commandRoles[actionName]) { | |||
this.obj.socket.emit('events', { | |||
onGetMessages: [{ | |||
messages: [{ | |||
@@ -321,7 +317,7 @@ module.exports = { | |||
const msg = [ | |||
'You can use the following commands:', | |||
...Object.keys(commandRoles) | |||
.filter(c => this.roleLevel >= commandRoles[c]) | |||
.filter(c => this.obj.auth.accountLevel >= commandRoles[c]) | |||
.map(c => `/${c}`) | |||
].join('<br />'); | |||
@@ -1,5 +1,4 @@ | |||
let classes = require('../config/spirits'); | |||
let roles = require('../config/roles'); | |||
let serverConfig = require('../config/serverConfig'); | |||
const eventEmitter = require('../misc/events'); | |||
@@ -42,8 +41,6 @@ module.exports = { | |||
character.components = character.components || []; | |||
roles.onBeforePlayerEnterGame(obj, character); | |||
let blueprintStats = character.components.find(c => c.type === 'stats') || {}; | |||
extend(blueprintStats, classes.stats[obj.class]); | |||
if (!blueprintStats.values.hp) | |||
@@ -51,7 +48,7 @@ module.exports = { | |||
let stats = obj.addComponent('stats'); | |||
for (let s in blueprintStats.values) | |||
stats.values[s] = blueprintStats.values[s]; | |||
for (let s in blueprintStats.stats) | |||
stats.stats[s] = blueprintStats.stats[s]; | |||
@@ -76,7 +73,6 @@ module.exports = { | |||
obj.addComponent('stash', { | |||
items: character.stash | |||
}); | |||
obj.stash.calculateMaxItems(roles.getExtraStashSlots(character.account)); | |||
let blueprintEffects = character.components.find(c => c.type === 'effects') || {}; | |||
if (blueprintEffects.effects) { | |||
@@ -1,5 +1,3 @@ | |||
const roles = require('../config/roles'); | |||
const sendObjToZone = require('./portal/sendObjToZone'); | |||
module.exports = { | |||
@@ -21,10 +19,6 @@ module.exports = { | |||
collisionEnter: async function (obj) { | |||
if (!obj.player) | |||
return; | |||
else if (this.patronLevel) { | |||
if (!roles.isRoleLevel(obj, this.patronLevel, 'enter this area')) | |||
return; | |||
} | |||
const { toZone: zoneName, toPos, toRelativePos } = this; | |||
@@ -1,7 +1,5 @@ | |||
const roles = require('../../config/roles'); | |||
module.exports = (obj, time) => { | |||
const roleLevel = roles.getRoleLevel(obj); | |||
const roleLevel = obj.auth.accountLevel; | |||
if (roleLevel >= 5) | |||
return true; | |||
@@ -1,4 +1,3 @@ | |||
const roles = require('../../config/roles'); | |||
const events = require('../../misc/events'); | |||
const profanities = require('../../misc/profanities'); | |||
const canChat = require('./canChat'); | |||
@@ -1,7 +1,7 @@ | |||
const cpnInventory = require('./inventory'); | |||
const { isItemStackable } = require('./inventory/helpers'); | |||
const maxItems = 50; | |||
const maxItemsBase = 50; | |||
module.exports = { | |||
type: 'stash', | |||
@@ -10,7 +10,7 @@ module.exports = { | |||
items: [], | |||
changed: false, | |||
maxItems, | |||
maxItems: maxItemsBase, | |||
init: function (blueprint) { | |||
let items = blueprint.items || []; | |||
@@ -23,10 +23,6 @@ module.exports = { | |||
this.blueprint = blueprint; | |||
}, | |||
calculateMaxItems: function (extraSlots) { | |||
this.maxItems = maxItems + extraSlots; | |||
}, | |||
getItem: function (item) { | |||
//Material? | |||
let exists = false; | |||
@@ -147,8 +143,10 @@ module.exports = { | |||
}, | |||
open: function () { | |||
if (this.active) | |||
this.obj.instance.syncer.queue('onOpenStash', {}, [this.obj.serverId]); | |||
const { active, obj } = this; | |||
if (active) | |||
obj.instance.syncer.queue('onOpenStash', {}, [obj.serverId]); | |||
}, | |||
simplify: function (self) { | |||
@@ -1,89 +0,0 @@ | |||
let sheets = require('../security/sheets'); | |||
module.exports = { | |||
getAccount: function (name) { | |||
return sheets.getRecord(name); | |||
}, | |||
onBeforePlayerEnterGame: function (obj, blueprint) { | |||
let account = obj.account; | |||
let config = this.getAccount(account) || {}; | |||
if (config.items) { | |||
let blueprintInventory = blueprint.components.find(c => (c.type === 'inventory')); | |||
if (!blueprintInventory) { | |||
blueprint.components.push({ | |||
type: 'inventory', | |||
items: [] | |||
}); | |||
return; | |||
} else if (!blueprintInventory.items) | |||
blueprintInventory.items = []; | |||
let items = blueprintInventory.items; | |||
config.items.forEach(function (item) { | |||
let hasItem = items.find(i => (i.name === item.name)); | |||
if (hasItem) | |||
return; | |||
items.push(item); | |||
}, this); | |||
} | |||
}, | |||
getRoleLevel: function (player) { | |||
let account = player.account; | |||
let level = this.getAccount(account) ? this.getAccount(account).level : 0; | |||
return level; | |||
}, | |||
isRoleLevel: function (player, requireLevel, message) { | |||
let account = player.account; | |||
let level = this.getAccount(account) ? this.getAccount(account).level : 0; | |||
let success = (level >= requireLevel); | |||
if ((!success) && (message)) | |||
this.sendMessage(player, message); | |||
return success; | |||
}, | |||
getRoleMessageStyle: function (player) { | |||
let account = player.account; | |||
return this.getAccount(account) ? this.getAccount(account).messageStyle : null; | |||
}, | |||
getRoleMessagePrefix: function (player) { | |||
let account = player.account; | |||
return this.getAccount(account) ? this.getAccount(account).messagePrefix : null; | |||
}, | |||
getSkins: function (account) { | |||
let skins = []; | |||
account = this.getAccount(account) || { | |||
skins: [] | |||
}; | |||
(account.skins || []).forEach(function (s) { | |||
skins.push(s); | |||
}); | |||
skins = skins.filter((s, i) => (skins.indexOf(s) === i)); | |||
return skins; | |||
}, | |||
getExtraStashSlots: function (accountName) { | |||
const account = this.getAccount(accountName); | |||
if (!account) | |||
return 0; | |||
return account.extraStashSlots || 0; | |||
}, | |||
sendMessage: function (player, msg) { | |||
const message = `Only certain roles can ${msg} at the moment`; | |||
player.social.notifySelf({ message }); | |||
} | |||
}; |
@@ -12,7 +12,6 @@ let spells = require('./config/spells'); | |||
let itemTypes = require('./items/config/types'); | |||
let recipes = require('./config/recipes/recipes'); | |||
let mapList = require('./config/maps/mapList'); | |||
let sheets = require('./security/sheets'); | |||
let fixes = require('./fixes/fixes'); | |||
let profanities = require('./misc/profanities'); | |||
const routerConfig = require('./security/routerConfig'); | |||
@@ -57,7 +56,6 @@ let startup = { | |||
await leaderboard.init(); | |||
atlas.init(); | |||
sheets.init(); | |||
}, | |||
onError: async function (e) { | |||
@@ -203,14 +203,6 @@ | |||
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", | |||
"dev": true | |||
}, | |||
"abort-controller": { | |||
"version": "3.0.0", | |||
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", | |||
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", | |||
"requires": { | |||
"event-target-shim": "^5.0.0" | |||
} | |||
}, | |||
"accepts": { | |||
"version": "1.3.7", | |||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", | |||
@@ -237,29 +229,6 @@ | |||
"resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", | |||
"integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=" | |||
}, | |||
"agent-base": { | |||
"version": "6.0.2", | |||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", | |||
"integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", | |||
"requires": { | |||
"debug": "4" | |||
}, | |||
"dependencies": { | |||
"debug": { | |||
"version": "4.3.1", | |||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", | |||
"integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", | |||
"requires": { | |||
"ms": "2.1.2" | |||
} | |||
}, | |||
"ms": { | |||
"version": "2.1.2", | |||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", | |||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" | |||
} | |||
} | |||
}, | |||
"ajv": { | |||
"version": "6.12.0", | |||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", | |||
@@ -327,11 +296,6 @@ | |||
"resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", | |||
"integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==" | |||
}, | |||
"arrify": { | |||
"version": "2.0.1", | |||
"resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", | |||
"integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==" | |||
}, | |||
"asn1": { | |||
"version": "0.2.4", | |||
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", | |||
@@ -404,11 +368,6 @@ | |||
"resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.4.tgz", | |||
"integrity": "sha1-mBjHngWbE1X5fgQooBfIOOkLqBI=" | |||
}, | |||
"base64-js": { | |||
"version": "1.5.1", | |||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", | |||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" | |||
}, | |||
"base64id": { | |||
"version": "2.0.0", | |||
"resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", | |||
@@ -427,11 +386,6 @@ | |||
"tweetnacl": "^0.14.3" | |||
} | |||
}, | |||
"bignumber.js": { | |||
"version": "9.0.1", | |||
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz", | |||
"integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==" | |||
}, | |||
"blob": { | |||
"version": "0.0.5", | |||
"resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz", | |||
@@ -486,11 +440,6 @@ | |||
"concat-map": "0.0.1" | |||
} | |||
}, | |||
"buffer-equal-constant-time": { | |||
"version": "1.0.1", | |||
"resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", | |||
"integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" | |||
}, | |||
"bytes": { | |||
"version": "3.0.0", | |||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", | |||
@@ -727,14 +676,6 @@ | |||
"safer-buffer": "^2.1.0" | |||
} | |||
}, | |||
"ecdsa-sig-formatter": { | |||
"version": "1.0.11", | |||
"resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", | |||
"integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", | |||
"requires": { | |||
"safe-buffer": "^5.0.1" | |||
} | |||
}, | |||
"ee-first": { | |||
"version": "1.1.1", | |||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", | |||
@@ -1097,11 +1038,6 @@ | |||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", | |||
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" | |||
}, | |||
"event-target-shim": { | |||
"version": "5.0.1", | |||
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", | |||
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" | |||
}, | |||
"express": { | |||
"version": "4.17.1", | |||
"resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", | |||
@@ -1181,11 +1117,6 @@ | |||
"integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", | |||
"dev": true | |||
}, | |||
"fast-text-encoding": { | |||
"version": "1.0.3", | |||
"resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.3.tgz", | |||
"integrity": "sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig==" | |||
}, | |||
"file-entry-cache": { | |||
"version": "5.0.1", | |||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", | |||
@@ -1343,27 +1274,6 @@ | |||
} | |||
} | |||
}, | |||
"gaxios": { | |||
"version": "4.1.0", | |||
"resolved": "https://registry.npmjs.org/gaxios/-/gaxios-4.1.0.tgz", | |||
"integrity": "sha512-vb0to8xzGnA2qcgywAjtshOKKVDf2eQhJoiL6fHhgW5tVN7wNk7egnYIO9zotfn3lQ3De1VPdf7V5/BWfCtCmg==", | |||
"requires": { | |||
"abort-controller": "^3.0.0", | |||
"extend": "^3.0.2", | |||
"https-proxy-agent": "^5.0.0", | |||
"is-stream": "^2.0.0", | |||
"node-fetch": "^2.3.0" | |||
} | |||
}, | |||
"gcp-metadata": { | |||
"version": "4.2.1", | |||
"resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-4.2.1.tgz", | |||
"integrity": "sha512-tSk+REe5iq/N+K+SK1XjZJUrFPuDqGZVzCy2vocIHIGmPlTGsa8owXMJwGkrXr73NO0AzhPW4MF2DEHz7P2AVw==", | |||
"requires": { | |||
"gaxios": "^4.0.0", | |||
"json-bigint": "^1.0.0" | |||
} | |||
}, | |||
"getpass": { | |||
"version": "0.1.7", | |||
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", | |||
@@ -1401,47 +1311,6 @@ | |||
"integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", | |||
"dev": true | |||
}, | |||
"google-auth-library": { | |||
"version": "6.1.3", | |||
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-6.1.3.tgz", | |||
"integrity": "sha512-m9mwvY3GWbr7ZYEbl61isWmk+fvTmOt0YNUfPOUY2VH8K5pZlAIWJjxEi0PqR3OjMretyiQLI6GURMrPSwHQ2g==", | |||
"requires": { | |||
"arrify": "^2.0.0", | |||
"base64-js": "^1.3.0", | |||
"ecdsa-sig-formatter": "^1.0.11", | |||
"fast-text-encoding": "^1.0.0", | |||
"gaxios": "^4.0.0", | |||
"gcp-metadata": "^4.2.0", | |||
"gtoken": "^5.0.4", | |||
"jws": "^4.0.0", | |||
"lru-cache": "^6.0.0" | |||
} | |||
}, | |||
"google-p12-pem": { | |||
"version": "3.0.3", | |||
"resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-3.0.3.tgz", | |||
"integrity": "sha512-wS0ek4ZtFx/ACKYF3JhyGe5kzH7pgiQ7J5otlumqR9psmWMYc+U9cErKlCYVYHoUaidXHdZ2xbo34kB+S+24hA==", | |||
"requires": { | |||
"node-forge": "^0.10.0" | |||
} | |||
}, | |||
"google-spreadsheet": { | |||
"version": "3.1.15", | |||
"resolved": "https://registry.npmjs.org/google-spreadsheet/-/google-spreadsheet-3.1.15.tgz", | |||
"integrity": "sha512-S5477f3Gf3Mz6AXgCw7dbaYnzu5aHou1AX4sDqrGboQWnAytkxqJGKQiXN+zzRTTcYzSTJCe0g7KqCPZO9xiOw==", | |||
"requires": { | |||
"axios": "^0.21.1", | |||
"google-auth-library": "^6.1.3", | |||
"lodash": "^4.17.20" | |||
}, | |||
"dependencies": { | |||
"lodash": { | |||
"version": "4.17.21", | |||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", | |||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" | |||
} | |||
} | |||
}, | |||
"graceful-fs": { | |||
"version": "4.2.3", | |||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", | |||
@@ -1449,24 +1318,6 @@ | |||
"dev": true, | |||
"optional": true | |||
}, | |||
"gtoken": { | |||
"version": "5.1.0", | |||
"resolved": "https://registry.npmjs.org/gtoken/-/gtoken-5.1.0.tgz", | |||
"integrity": "sha512-4d8N6Lk8TEAHl9vVoRVMh9BNOKWVgl2DdNtr3428O75r3QFrF/a5MMu851VmK0AA8+iSvbwRv69k5XnMLURGhg==", | |||
"requires": { | |||
"gaxios": "^4.0.0", | |||
"google-p12-pem": "^3.0.3", | |||
"jws": "^4.0.0", | |||
"mime": "^2.2.0" | |||
}, | |||
"dependencies": { | |||
"mime": { | |||
"version": "2.4.7", | |||
"resolved": "https://registry.npmjs.org/mime/-/mime-2.4.7.tgz", | |||
"integrity": "sha512-dhNd1uA2u397uQk3Nv5LM4lm93WYDUXFn3Fu291FJerns4jyTudqhIWe4W04YLy7Uk1tm1Ore04NpjRvQp/NPA==" | |||
} | |||
} | |||
}, | |||
"har-schema": { | |||
"version": "2.0.0", | |||
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", | |||
@@ -1528,30 +1379,6 @@ | |||
"sshpk": "^1.7.0" | |||
} | |||
}, | |||
"https-proxy-agent": { | |||
"version": "5.0.0", | |||
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", | |||
"integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", | |||
"requires": { | |||
"agent-base": "6", | |||
"debug": "4" | |||
}, | |||
"dependencies": { | |||
"debug": { | |||
"version": "4.3.1", | |||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", | |||
"integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", | |||
"requires": { | |||
"ms": "2.1.2" | |||
} | |||
}, | |||
"ms": { | |||
"version": "2.1.2", | |||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", | |||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" | |||
} | |||
} | |||
}, | |||
"iconv-lite": { | |||
"version": "0.4.24", | |||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", | |||
@@ -1651,11 +1478,6 @@ | |||
"is-extglob": "^2.1.1" | |||
} | |||
}, | |||
"is-stream": { | |||
"version": "2.0.0", | |||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", | |||
"integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" | |||
}, | |||
"is-typedarray": { | |||
"version": "1.0.0", | |||
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", | |||
@@ -1704,14 +1526,6 @@ | |||
"integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", | |||
"dev": true | |||
}, | |||
"json-bigint": { | |||
"version": "1.0.0", | |||
"resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", | |||
"integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", | |||
"requires": { | |||
"bignumber.js": "^9.0.0" | |||
} | |||
}, | |||
"json-schema": { | |||
"version": "0.2.3", | |||
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", | |||
@@ -1744,25 +1558,6 @@ | |||
"verror": "1.10.0" | |||
} | |||
}, | |||
"jwa": { | |||
"version": "2.0.0", | |||
"resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", | |||
"integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", | |||
"requires": { | |||
"buffer-equal-constant-time": "1.0.1", | |||
"ecdsa-sig-formatter": "1.0.11", | |||
"safe-buffer": "^5.0.1" | |||
} | |||
}, | |||
"jws": { | |||
"version": "4.0.0", | |||
"resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", | |||
"integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", | |||
"requires": { | |||
"jwa": "^2.0.0", | |||
"safe-buffer": "^5.0.1" | |||
} | |||
}, | |||
"levn": { | |||
"version": "0.4.1", | |||
"resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", | |||
@@ -1779,21 +1574,6 @@ | |||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", | |||
"dev": true | |||
}, | |||
"lru-cache": { | |||
"version": "6.0.0", | |||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", | |||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", | |||
"requires": { | |||
"yallist": "^4.0.0" | |||
}, | |||
"dependencies": { | |||
"yallist": { | |||
"version": "4.0.0", | |||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", | |||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" | |||
} | |||
} | |||
}, | |||
"media-typer": { | |||
"version": "0.3.0", | |||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", | |||
@@ -1920,16 +1700,6 @@ | |||
"integrity": "sha512-ASCL5U13as7HhOExbT6OlWJJUV/lLzL2voOSP1UVehpRD8FbSrSDjfScK/KwAvVTI5AS6r4VwbOMlIqtvRidnA==", | |||
"dev": true | |||
}, | |||
"node-fetch": { | |||
"version": "2.6.1", | |||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", | |||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" | |||
}, | |||
"node-forge": { | |||
"version": "0.10.0", | |||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", | |||
"integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" | |||
}, | |||
"node-gyp": { | |||
"version": "3.8.0", | |||
"resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz", | |||
@@ -8,7 +8,6 @@ | |||
"compression": "^1.7.4", | |||
"express": "^4.17.1", | |||
"express-minify": "^1.0.0", | |||
"google-spreadsheet": "^3.1.15", | |||
"image-size": "^0.9.2", | |||
"rethinkdbdash": "^2.3.31", | |||
"socket.io": "^2.4.1", | |||
@@ -1,14 +0,0 @@ | |||
/* eslint-disable */ | |||
module.exports = { | |||
type: 'service_account', | |||
project_id: '', | |||
private_key_id: '', | |||
private_key: '', | |||
client_email: '', | |||
client_id: '', | |||
auth_uri: 'https://accounts.google.com/o/oauth2/auth', | |||
token_uri: 'https://accounts.google.com/o/oauth2/token', | |||
auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs', | |||
client_x509_cert_url: '' | |||
}; |
@@ -1,14 +1,22 @@ | |||
const bcrypt = require('bcrypt-nodejs'); | |||
const roles = require('../../config/roles'); | |||
const doSaveAll = async (res, config, err, compareResult) => { | |||
if (!compareResult) | |||
return; | |||
let roleLevel = roles.getRoleLevel({ | |||
account: config.username | |||
const char = await io.getAsync({ | |||
table: 'character', | |||
key: config.username | |||
}); | |||
if (roleLevel < 9) | |||
if (!char) | |||
return; | |||
const auth = (char.components || []).find(c => c.type === 'auth'); | |||
if (!auth) | |||
return; | |||
if (auth.accountLevel < 9) | |||
return; | |||
await atlas.returnWhenZonesIdle(); | |||
@@ -42,7 +50,7 @@ module.exports = async (req, res, next) => { | |||
.join(' '); | |||
}); | |||
if (['msg', 'username', 'pwd'].some(p => !config[p])) | |||
if (['msg', 'username', 'pwd', 'character'].some(p => !config[p])) | |||
return; | |||
let storedPassword = await io.getAsync({ | |||
@@ -1,86 +0,0 @@ | |||
const { GoogleSpreadsheet: googleSheets } = require('google-spreadsheet'); | |||
let creds = require('./creds'); | |||
let sheetsConfig = require('./sheetsConfig'); | |||
module.exports = { | |||
doc: null, | |||
sheet: null, | |||
records: null, | |||
init: async function () { | |||
if (sheetsConfig.roles) { | |||
this.update = function () {}; | |||
this.onGetRows(null, sheetsConfig.roles); | |||
return; | |||
} | |||
this.doc = new googleSheets(sheetsConfig.sheetId); | |||
await this.doc.useServiceAccountAuth(creds); | |||
await this.loadInfo(); | |||
}, | |||
loadInfo: async function () { | |||
await this.doc.loadInfo(); | |||
this.onGetInfo(); | |||
}, | |||
onGetInfo: function () { | |||
this.sheet = this.doc.sheetsByIndex[0]; | |||
if (!this.sheet) { | |||
setTimeout(this.loadInfo.bind(this), 300000); | |||
return; | |||
} | |||
this.update(); | |||
}, | |||
getRecord: function (name) { | |||
return (this.records || []).find(r => (r.username === name)); | |||
}, | |||
onGetRows: function (err, rows) { | |||
if (rows) { | |||
try { | |||
let records = (rows || []).map(function (r) { | |||
let o = {}; | |||
Object.keys(r).forEach(function (p) { | |||
if (['id', 'app:edited', '_links', '_xml', 'save', 'del'].indexOf(p) > -1) | |||
return; | |||
o[p] = r[p]; | |||
}); | |||
o.messageStyle = o.messagestyle; | |||
delete o.messagestyle; | |||
o.messagePrefix = o.messageprefix; | |||
delete o.messageprefix; | |||
o.extraStashSlots = ~~o.extrastashslots; | |||
o.level = ~~o.level; | |||
if (typeof (o.items) === 'string') | |||
o.items = JSON.parse(o.items || '[]'); | |||
if (typeof (o.skins) === 'string') | |||
o.skins = JSON.parse(o.skins || '[]'); | |||
return o; | |||
}); | |||
this.records = records; | |||
} catch (e) {} | |||
} | |||
setTimeout(this.update.bind(this), 300000); | |||
}, | |||
update: async function () { | |||
try { | |||
const records = await this.sheet.getRows(); | |||
this.onGetRows(null, records); | |||
} catch (e) { | |||
setTimeout(this.update.bind(this), 300000); | |||
} | |||
} | |||
}; |
@@ -1,21 +0,0 @@ | |||
module.exports = { | |||
sheetId: '', | |||
roles: [{ | |||
username: 'waffle', | |||
level: 10, | |||
messagestyle: 'color-blueA', | |||
messageprefix: '(dev) ', | |||
skins: ['*'], | |||
items: [{ | |||
type: 'key', | |||
name: 'Key to the world', | |||
sprite: [12, 0], | |||
keyId: 'world', | |||
noSalvage: true, | |||
noDrop: true, | |||
noDestroy: true | |||
}], | |||
extrastashslots: 10 | |||
}] | |||
}; |
@@ -17,7 +17,6 @@ let spells = require('../config/spells'); | |||
let recipes = require('../config/recipes/recipes'); | |||
let itemTypes = require('../items/config/types'); | |||
let mapList = require('../config/maps/mapList'); | |||
let sheets = require('../security/sheets'); | |||
let itemEffects = require('../items/itemEffects'); | |||
const profanities = require('../misc/profanities'); | |||
@@ -31,7 +30,6 @@ let onCpnsReady = async function () { | |||
itemTypes.init(); | |||
mapList.init(); | |||
recipes.init(); | |||
sheets.init(); | |||
itemEffects.init(); | |||
profanities.init(); | |||
await clientConfig.init(); | |||