diff --git a/src/server/components/auth.js b/src/server/components/auth.js index e0aa7855..f7f7d062 100644 --- a/src/server/components/auth.js +++ b/src/server/components/auth.js @@ -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); diff --git a/src/server/components/trade.js b/src/server/components/trade.js index 4e01006a..4af96e40 100644 --- a/src/server/components/trade.js +++ b/src/server/components/trade.js @@ -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.');