Added contextid property to CEconItem objects

This commit is contained in:
Alexander Corn 2015-09-07 00:10:32 -04:00
parent c3f5b492b3
commit 82f1d490f9
2 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,6 @@
module.exports = CEconItem; module.exports = CEconItem;
function CEconItem(item, descriptions) { function CEconItem(item, descriptions, contextID) {
var thing; var thing;
for(thing in item) { for(thing in item) {
if(item.hasOwnProperty(thing)) { if(item.hasOwnProperty(thing)) {
@ -11,6 +11,7 @@ function CEconItem(item, descriptions) {
this.assetid = this.id = (this.id || this.assetid); this.assetid = this.id = (this.id || this.assetid);
this.instanceid = this.instanceid || '0'; this.instanceid = this.instanceid || '0';
this.amount = parseInt(this.amount, 10); this.amount = parseInt(this.amount, 10);
this.contextid = contextID.toString();
// Merge the description // Merge the description
var description = descriptions[this.classid + '_' + this.instanceid]; var description = descriptions[this.classid + '_' + this.instanceid];

View File

@ -272,7 +272,7 @@ SteamCommunity.prototype.getUserInventory = function(userID, appID, contextID, t
continue; continue;
} }
inventory.push(new CEconItem(body.rgInventory[i], body.rgDescriptions)); inventory.push(new CEconItem(body.rgInventory[i], body.rgDescriptions, contextID));
} }
for(i in body.rgCurrency) { for(i in body.rgCurrency) {
@ -280,7 +280,7 @@ SteamCommunity.prototype.getUserInventory = function(userID, appID, contextID, t
continue; continue;
} }
currency.push(new CEconItem(body.rgInventory[i], body.rgDescriptions)); currency.push(new CEconItem(body.rgInventory[i], body.rgDescriptions, contextID));
} }
if(body.more) { if(body.more) {