Browse Source

Merge branch 'master' into 'release'

bug #1989

See merge request Isleward/isleward!624
tags/v0.12.0.10
Big Bad Waffle 11 months ago
parent
commit
0cf9b5e15c
2 changed files with 11 additions and 25 deletions
  1. +3
    -20
      src/server/components/auth.js
  2. +8
    -5
      src/server/security/connections.js

+ 3
- 20
src/server/components/auth.js View File

@@ -91,7 +91,7 @@ module.exports = {
await leaderboard.setLevel(character.name, this.obj.stats.values.level, prophecies);
},

doSave: async function (callback, saveStash = true) {
doSave: async function (callback) {
const simple = this.obj.getSimple(true, true);
delete simple.destroyed;
delete simple.forceDestroy;
@@ -106,8 +106,7 @@ module.exports = {
serialize: true
});

if (saveStash)
await this.doSaveStash();
await this.doSaveStash();

if (callback)
callback();
@@ -116,7 +115,7 @@ module.exports = {
//This function is called from the 'forceSave' command. Because of this, the first argument is the action data
// instead of (callback, saveStash)
doSaveManual: async function (msg) {
await this.doSave(null, true);
await this.doSave();

process.send({
module: 'atlas',
@@ -215,22 +214,6 @@ module.exports = {
social.customChannels = this.customChannels;
},

getStash: async function (data, character) {
this.stash = await io.getAsync({
key: this.username,
table: 'stash',
isArray: true,
clean: true
});

fixes.fixStash(this.stash);

await eventEmitter.emit('onAfterGetStash', {
obj: this.obj,
stash: this.stash
});
},

verifySkin: async function (character) {
const doesOwn = await this.doesOwnSkin(character.skinId);



+ 8
- 5
src/server/security/connections.js View File

@@ -43,7 +43,10 @@ module.exports = {
sessionDuration: sessionDuration
}]
});
atlas.removeObject(player);

await new Promise(res => {
atlas.removeObject(player, false, res);
});
}

if (player.name) {
@@ -72,7 +75,7 @@ module.exports = {
routeGlobal.call(this, msg);
},

unzone: function (msg) {
unzone: async function (msg) {
let socket = msg.socket;
let player = this.players.find(p => p.socket.id === socket.id);

@@ -82,7 +85,9 @@ module.exports = {
if (player.social)
player.social.dc();

atlas.removeObject(player, true, this.onUnzone.bind(this, player, msg));
await new Promise(res => {
atlas.removeObject(player, true, res);
});

let keys = Object.keys(player);
keys.forEach(function (k) {
@@ -113,9 +118,7 @@ module.exports = {
delete player.auth.charname;

this.modifyPlayerCount(-1);
},

onUnzone: async function (player, msg) {
msg.callback();
},



Loading…
Cancel
Save