Browse Source

bug #1825: Made the onBeforeGetAccountSkins event async

tags/v0.10.1^2
Shaun 2 years ago
parent
commit
a19f3ee0f1
2 changed files with 9 additions and 9 deletions
  1. +7
    -7
      src/server/components/auth.js
  2. +2
    -2
      src/server/components/trade.js

+ 7
- 7
src/server/components/auth.js View File

@@ -178,7 +178,7 @@ module.exports = {
await this.getCustomChannels(character);
await this.getStash();

this.verifySkin(character);
await this.verifySkin(character);

data.callback(character);
},
@@ -212,8 +212,8 @@ module.exports = {
});
},

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

if (doesOwn)
return;
@@ -225,7 +225,7 @@ module.exports = {
character.sheetName = skins.getSpritesheet(defaultTo);
},

doesOwnSkin: function (skinId) {
doesOwnSkin: async function (skinId) {
const allSkins = skins.getList();
const filteredSkins = allSkins.filter(({ default: isDefaultSkin }) => isDefaultSkin);

@@ -235,7 +235,7 @@ module.exports = {
filteredSkins
};

eventEmitter.emit('onBeforeGetAccountSkins', msgSkinList);
await eventEmitter.emit('onBeforeGetAccountSkins', msgSkinList);

const result = filteredSkins.some(f => f.id === skinId);

@@ -252,7 +252,7 @@ module.exports = {
filteredSkins
};

eventEmitter.emit('onBeforeGetAccountSkins', msgSkinList);
await eventEmitter.emit('onBeforeGetAccountSkins', msgSkinList);

callback(filteredSkins);
},
@@ -445,7 +445,7 @@ module.exports = {

let simple = this.obj.getSimple(true);

this.verifySkin(simple);
await this.verifySkin(simple);
let prophecies = (data.prophecies || []).filter(p => p);


+ 2
- 2
src/server/components/trade.js View File

@@ -152,7 +152,7 @@ module.exports = {
this.buyback(msg);
},

buy: function (msg) {
buy: async function (msg) {
let target = this.target;
if (!target)
return;
@@ -191,7 +191,7 @@ module.exports = {
}

if (item.type === 'skin') {
let haveSkin = this.obj.auth.doesOwnSkin(item.skinId);
let haveSkin = await this.obj.auth.doesOwnSkin(item.skinId);

if (haveSkin) {
sendMessage(this.obj, 'color-redA', 'You have already unlocked that skin.');


Loading…
Cancel
Save