steamcommunity 3.49.0 → 3.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/classes/CEconItem.js +6 -1
- package/components/users.js +10 -1
- package/package.json +1 -1
package/classes/CEconItem.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module.exports = CEconItem;
|
|
2
2
|
|
|
3
|
-
function CEconItem(item, description, contextID) {
|
|
3
|
+
function CEconItem(item, description, contextID, assetProperties) {
|
|
4
4
|
var thing;
|
|
5
5
|
for (thing in item) {
|
|
6
6
|
if (item.hasOwnProperty(thing)) {
|
|
@@ -86,6 +86,11 @@ function CEconItem(item, description, contextID) {
|
|
|
86
86
|
this.actions = [];
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
// Assign asset_properties if provided
|
|
90
|
+
if (assetProperties) {
|
|
91
|
+
this.asset_properties = assetProperties;
|
|
92
|
+
}
|
|
93
|
+
|
|
89
94
|
// One wouldn't think that we need this if statement, but apparently v8 has a weird bug/quirk where deleting a
|
|
90
95
|
// property results in greatly increased memory usage. Because that makes sense.
|
|
91
96
|
if (this.currency) {
|
package/components/users.js
CHANGED
|
@@ -647,12 +647,21 @@ SteamCommunity.prototype.getUserInventoryContents = function(userID, appID, cont
|
|
|
647
647
|
return;
|
|
648
648
|
}
|
|
649
649
|
|
|
650
|
+
// Build asset_properties lookup by assetid
|
|
651
|
+
var assetPropertiesLookup = {};
|
|
652
|
+
if (body.asset_properties) {
|
|
653
|
+
for (var j = 0; j < body.asset_properties.length; j++) {
|
|
654
|
+
assetPropertiesLookup[body.asset_properties[j].assetid] = body.asset_properties[j].asset_properties;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
|
|
650
658
|
for (var i = 0; i < body.assets.length; i++) {
|
|
651
659
|
var description = getDescription(body.descriptions, body.assets[i].classid, body.assets[i].instanceid);
|
|
652
660
|
|
|
653
661
|
if (!tradableOnly || (description && description.tradable)) {
|
|
654
662
|
body.assets[i].pos = pos++;
|
|
655
|
-
|
|
663
|
+
var assetProperties = assetPropertiesLookup[body.assets[i].assetid] || null;
|
|
664
|
+
(body.assets[i].currencyid ? currency : inventory).push(new CEconItem(body.assets[i], description, contextID, assetProperties));
|
|
656
665
|
}
|
|
657
666
|
}
|
|
658
667
|
|