Selaa lähdekoodia

bug #1825: Made the onBeforeGetAccountSkins event async

tags/v0.10.1^2
Shaun 2 vuotta sitten
vanhempi
commit
a19f3ee0f1
2 muutettua tiedostoa jossa 9 lisäystä ja 9 poistoa
  1. +7
    -7
      src/server/components/auth.js
  2. +2
    -2
      src/server/components/trade.js

+ 7
- 7
src/server/components/auth.js Näytä tiedosto

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


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


data.callback(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) if (doesOwn)
return; return;
@@ -225,7 +225,7 @@ module.exports = {
character.sheetName = skins.getSpritesheet(defaultTo); character.sheetName = skins.getSpritesheet(defaultTo);
}, },


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


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


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


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


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


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


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


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


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


+ 2
- 2
src/server/components/trade.js Näytä tiedosto

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


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


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


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


Ladataan…
Peruuta
Tallenna