Make CMarketItem not broken for non-CSGO apps (fixes #196)

This commit is contained in:
Alex Corn 2018-04-10 01:01:03 -04:00
parent 645e03b89c
commit 754847ee88

View File

@ -49,7 +49,7 @@ function CMarketItem(appid, hashName, community, body, $) {
}
this.commodity = false;
var match = body.match(/Market_LoadOrderSpread\(\s*(\d+)\s*\);/);
match = body.match(/Market_LoadOrderSpread\(\s*(\d+)\s*\);/);
if(match) {
this.commodity = true;
this.commodityID = parseInt(match[1], 10);
@ -78,7 +78,8 @@ function CMarketItem(appid, hashName, community, body, $) {
if (match) {
try {
this.assets = JSON.parse(match[1]);
this.assets = this.assets['730']['2'];
this.assets = this.assets[appid];
this.assets = this.assets[Object.keys(this.assets)[0]];
this.firstAsset = this.assets[Object.keys(this.assets)[0]];
} catch (e) {
// ignore