steamcommunity 3.41.8 → 3.44.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/.github/FUNDING.yml +2 -2
- package/.idea/codeStyles/Project.xml +0 -3
- package/.idea/codeStyles/codeStyleConfig.xml +1 -0
- package/.idea/copyright/profiles_settings.xml +2 -2
- package/.idea/inspectionProfiles/Project_Default.xml +10 -10
- package/.idea/jsLibraryMappings.xml +5 -5
- package/.idea/misc.xml +5 -5
- package/.idea/modules.xml +8 -7
- package/.idea/steamcommunity.iml +9 -8
- package/.idea/vcs.xml +6 -5
- package/README.md +23 -23
- package/classes/CConfirmation.js +35 -35
- package/classes/CEconItem.js +120 -120
- package/classes/CMarketItem.js +189 -189
- package/classes/CMarketSearchResult.js +89 -89
- package/classes/CSteamGroup.js +155 -155
- package/classes/CSteamUser.js +8 -0
- package/components/chat.js +283 -283
- package/components/groups.js +732 -732
- package/components/help.js +64 -0
- package/components/http.js +150 -150
- package/components/inventoryhistory.js +188 -188
- package/components/market.js +387 -214
- package/components/twofactor.js +159 -159
- package/components/users.js +767 -667
- package/components/webapi.js +57 -73
- package/examples/disable_twofactor.js +62 -62
- package/examples/edit-group-announcement.js +118 -118
- package/examples/enable_twofactor.js +112 -112
- package/index.js +35 -2
- package/package.json +1 -1
- package/resources/EFriendRelationship.js +23 -0
- package/resources/EPersonaState.js +2 -2
- package/resources/EPersonaStateFlag.js +6 -1
- package/resources/EResult.js +14 -0
package/.github/FUNDING.yml
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
github: DoctorMcKay
|
|
2
|
-
custom: 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=N36YVAT42CZ4G&item_name=node%2dsteamcommunity¤cy_code=USD'
|
|
1
|
+
github: DoctorMcKay
|
|
2
|
+
custom: 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=N36YVAT42CZ4G&item_name=node%2dsteamcommunity¤cy_code=USD'
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
<component name="ProjectCodeStyleConfiguration">
|
|
2
2
|
<code_scheme name="Project" version="173">
|
|
3
|
-
<XML>
|
|
4
|
-
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
|
5
|
-
</XML>
|
|
6
3
|
<codeStyleSettings language="JSON">
|
|
7
4
|
<indentOptions>
|
|
8
5
|
<option name="USE_TAB_CHARACTER" value="true" />
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<component name="CopyrightManager">
|
|
2
|
-
<settings default="" />
|
|
1
|
+
<component name="CopyrightManager">
|
|
2
|
+
<settings default="" />
|
|
3
3
|
</component>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<component name="InspectionProjectProfileManager">
|
|
2
|
-
<profile version="1.0">
|
|
3
|
-
<option name="myName" value="Project Default" />
|
|
4
|
-
<inspection_tool class="ES6ConvertRequireIntoImport" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
|
5
|
-
<inspection_tool class="ES6ConvertToForOf" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
|
6
|
-
<inspection_tool class="ES6ConvertVarToLetConst" enabled="false" level="WARNING" enabled_by_default="false" />
|
|
7
|
-
<inspection_tool class="JSEqualityComparisonWithCoercion" enabled="false" level="WARNING" enabled_by_default="false" />
|
|
8
|
-
<inspection_tool class="JSFunctionExpressionToArrowFunction" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
|
9
|
-
<inspection_tool class="JSStringConcatenationToES6Template" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
|
10
|
-
</profile>
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
|
2
|
+
<profile version="1.0">
|
|
3
|
+
<option name="myName" value="Project Default" />
|
|
4
|
+
<inspection_tool class="ES6ConvertRequireIntoImport" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
|
5
|
+
<inspection_tool class="ES6ConvertToForOf" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
|
6
|
+
<inspection_tool class="ES6ConvertVarToLetConst" enabled="false" level="WARNING" enabled_by_default="false" />
|
|
7
|
+
<inspection_tool class="JSEqualityComparisonWithCoercion" enabled="false" level="WARNING" enabled_by_default="false" />
|
|
8
|
+
<inspection_tool class="JSFunctionExpressionToArrowFunction" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
|
9
|
+
<inspection_tool class="JSStringConcatenationToES6Template" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
|
10
|
+
</profile>
|
|
11
11
|
</component>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="JavaScriptLibraryMappings">
|
|
4
|
-
<includedPredefinedLibrary name="Node.js Core" />
|
|
5
|
-
</component>
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="JavaScriptLibraryMappings">
|
|
4
|
+
<includedPredefinedLibrary name="Node.js Core" />
|
|
5
|
+
</component>
|
|
6
6
|
</project>
|
package/.idea/misc.xml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="JavaScriptSettings">
|
|
4
|
-
<option name="languageLevel" value="ES6" />
|
|
5
|
-
</component>
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="JavaScriptSettings">
|
|
4
|
+
<option name="languageLevel" value="ES6" />
|
|
5
|
+
</component>
|
|
6
6
|
</project>
|
package/.idea/modules.xml
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/../node-steamcommunity Wiki/.idea/node-steamcommunity Wiki.iml" filepath="$PROJECT_DIR$/../node-steamcommunity Wiki/.idea/node-steamcommunity Wiki.iml" />
|
|
6
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/steamcommunity.iml" filepath="$PROJECT_DIR$/.idea/steamcommunity.iml" />
|
|
7
|
+
</modules>
|
|
8
|
+
</component>
|
|
8
9
|
</project>
|
package/.idea/steamcommunity.iml
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
-
<exclude-output />
|
|
5
|
-
<content url="file://$MODULE_DIR$" />
|
|
6
|
-
<orderEntry type="inheritedJdk" />
|
|
7
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
-
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
+
<exclude-output />
|
|
5
|
+
<content url="file://$MODULE_DIR$" />
|
|
6
|
+
<orderEntry type="inheritedJdk" />
|
|
7
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
+
<orderEntry type="module" module-name="node-steamcommunity Wiki" />
|
|
9
|
+
</component>
|
|
9
10
|
</module>
|
package/.idea/vcs.xml
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="VcsDirectoryMappings">
|
|
4
|
-
<mapping directory="" vcs="Git" />
|
|
5
|
-
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="VcsDirectoryMappings">
|
|
4
|
+
<mapping directory="" vcs="Git" />
|
|
5
|
+
<mapping directory="$PROJECT_DIR$/../node-steamcommunity Wiki" vcs="Git" />
|
|
6
|
+
</component>
|
|
6
7
|
</project>
|
package/README.md
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
# Steam Community for Node.js
|
|
2
|
-
[](https://npmjs.com/package/steamcommunity)
|
|
3
|
-
[](https://npmjs.com/package/steamcommunity)
|
|
4
|
-
[](https://david-dm.org/DoctorMcKay/node-steamcommunity)
|
|
5
|
-
[](https://github.com/DoctorMcKay/node-steamcommunity/blob/master/LICENSE)
|
|
6
|
-
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=N36YVAT42CZ4G&item_name=node%2dsteamcommunity¤cy_code=USD)
|
|
7
|
-
|
|
8
|
-
This module provides an easy interface for the Steam Community website. This module can be used to simply login to steamcommunity.com for use with other libraries, or to interact with steamcommunity.com.
|
|
9
|
-
|
|
10
|
-
It supports Steam Guard and CAPTCHAs.
|
|
11
|
-
|
|
12
|
-
**Have a question about the module or coding in general? *Do not create a GitHub issue.* GitHub issues are for feature
|
|
13
|
-
requests and bug reports. Instead, post in the [dedicated forum](https://dev.doctormckay.com/forum/8-node-steamcommunity/).
|
|
14
|
-
Such issues may be ignored!**
|
|
15
|
-
|
|
16
|
-
# Documentation
|
|
17
|
-
|
|
18
|
-
Documentation is available on the [GitHub wiki](https://github.com/DoctorMcKay/node-steamcommunity/wiki).
|
|
19
|
-
|
|
20
|
-
# Support
|
|
21
|
-
|
|
22
|
-
Report bugs on the [issue tracker](https://github.com/DoctorMcKay/node-steamcommunity/issues) or ask questions
|
|
23
|
-
on the [dedicated forum](https://dev.doctormckay.com/forum/8-node-steamcommunity/).
|
|
1
|
+
# Steam Community for Node.js
|
|
2
|
+
[](https://npmjs.com/package/steamcommunity)
|
|
3
|
+
[](https://npmjs.com/package/steamcommunity)
|
|
4
|
+
[](https://david-dm.org/DoctorMcKay/node-steamcommunity)
|
|
5
|
+
[](https://github.com/DoctorMcKay/node-steamcommunity/blob/master/LICENSE)
|
|
6
|
+
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=N36YVAT42CZ4G&item_name=node%2dsteamcommunity¤cy_code=USD)
|
|
7
|
+
|
|
8
|
+
This module provides an easy interface for the Steam Community website. This module can be used to simply login to steamcommunity.com for use with other libraries, or to interact with steamcommunity.com.
|
|
9
|
+
|
|
10
|
+
It supports Steam Guard and CAPTCHAs.
|
|
11
|
+
|
|
12
|
+
**Have a question about the module or coding in general? *Do not create a GitHub issue.* GitHub issues are for feature
|
|
13
|
+
requests and bug reports. Instead, post in the [dedicated forum](https://dev.doctormckay.com/forum/8-node-steamcommunity/).
|
|
14
|
+
Such issues may be ignored!**
|
|
15
|
+
|
|
16
|
+
# Documentation
|
|
17
|
+
|
|
18
|
+
Documentation is available on the [GitHub wiki](https://github.com/DoctorMcKay/node-steamcommunity/wiki).
|
|
19
|
+
|
|
20
|
+
# Support
|
|
21
|
+
|
|
22
|
+
Report bugs on the [issue tracker](https://github.com/DoctorMcKay/node-steamcommunity/issues) or ask questions
|
|
23
|
+
on the [dedicated forum](https://dev.doctormckay.com/forum/8-node-steamcommunity/).
|
package/classes/CConfirmation.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
var SteamCommunity = require('../index.js');
|
|
2
|
-
|
|
3
|
-
module.exports = CConfirmation;
|
|
4
|
-
|
|
5
|
-
function CConfirmation(community, data) {
|
|
6
|
-
Object.defineProperty(this, "_community", {"value": community});
|
|
7
|
-
|
|
8
|
-
this.id = data.id.toString();
|
|
9
|
-
this.type = data.type;
|
|
10
|
-
this.creator = data.creator.toString();
|
|
11
|
-
this.key = data.key;
|
|
12
|
-
this.title = data.title;
|
|
13
|
-
this.receiving = data.receiving;
|
|
14
|
-
this.time = data.time;
|
|
15
|
-
this.icon = data.icon;
|
|
16
|
-
this.offerID = this.type == SteamCommunity.ConfirmationType.Trade ? this.creator : null;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
CConfirmation.prototype.getOfferID = function(time, key, callback) {
|
|
20
|
-
if (this.type && this.creator) {
|
|
21
|
-
if (this.type != SteamCommunity.ConfirmationType.Trade) {
|
|
22
|
-
callback(new Error("Not a trade confirmation"));
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
callback(null, this.creator);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
this._community.getConfirmationOfferID(this.id, time, key, callback);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
CConfirmation.prototype.respond = function(time, key, accept, callback) {
|
|
34
|
-
this._community.respondToConfirmation(this.id, this.key, time, key, accept, callback);
|
|
35
|
-
};
|
|
1
|
+
var SteamCommunity = require('../index.js');
|
|
2
|
+
|
|
3
|
+
module.exports = CConfirmation;
|
|
4
|
+
|
|
5
|
+
function CConfirmation(community, data) {
|
|
6
|
+
Object.defineProperty(this, "_community", {"value": community});
|
|
7
|
+
|
|
8
|
+
this.id = data.id.toString();
|
|
9
|
+
this.type = data.type;
|
|
10
|
+
this.creator = data.creator.toString();
|
|
11
|
+
this.key = data.key;
|
|
12
|
+
this.title = data.title;
|
|
13
|
+
this.receiving = data.receiving;
|
|
14
|
+
this.time = data.time;
|
|
15
|
+
this.icon = data.icon;
|
|
16
|
+
this.offerID = this.type == SteamCommunity.ConfirmationType.Trade ? this.creator : null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
CConfirmation.prototype.getOfferID = function(time, key, callback) {
|
|
20
|
+
if (this.type && this.creator) {
|
|
21
|
+
if (this.type != SteamCommunity.ConfirmationType.Trade) {
|
|
22
|
+
callback(new Error("Not a trade confirmation"));
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
callback(null, this.creator);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
this._community.getConfirmationOfferID(this.id, time, key, callback);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
CConfirmation.prototype.respond = function(time, key, accept, callback) {
|
|
34
|
+
this._community.respondToConfirmation(this.id, this.key, time, key, accept, callback);
|
|
35
|
+
};
|
package/classes/CEconItem.js
CHANGED
|
@@ -1,120 +1,120 @@
|
|
|
1
|
-
module.exports = CEconItem;
|
|
2
|
-
|
|
3
|
-
function CEconItem(item, description, contextID) {
|
|
4
|
-
var thing;
|
|
5
|
-
for (thing in item) {
|
|
6
|
-
if (item.hasOwnProperty(thing)) {
|
|
7
|
-
this[thing] = item[thing];
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
var isCurrency = !!(this.is_currency || this.currency) || typeof this.currencyid !== 'undefined'; // I don't want to put this on the object yet; it's nice to have the ids at the top of printed output
|
|
12
|
-
|
|
13
|
-
if (isCurrency) {
|
|
14
|
-
this.currencyid = this.id = (this.id || this.currencyid);
|
|
15
|
-
} else {
|
|
16
|
-
this.assetid = this.id = (this.id || this.assetid);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
this.instanceid = this.instanceid || '0';
|
|
20
|
-
this.amount = parseInt(this.amount, 10);
|
|
21
|
-
this.contextid = this.contextid || contextID.toString();
|
|
22
|
-
|
|
23
|
-
// Merge the description
|
|
24
|
-
if (description) {
|
|
25
|
-
// Is this a listing of descriptions?
|
|
26
|
-
if (description[this.classid + '_' + this.instanceid]) {
|
|
27
|
-
description = description[this.classid + '_' + this.instanceid];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
for (thing in description) {
|
|
31
|
-
if (description.hasOwnProperty(thing)) {
|
|
32
|
-
this[thing] = description[thing];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
this.is_currency = isCurrency;
|
|
38
|
-
this.tradable = !!this.tradable;
|
|
39
|
-
this.marketable = !!this.marketable;
|
|
40
|
-
this.commodity = !!this.commodity;
|
|
41
|
-
this.market_tradable_restriction = (this.market_tradable_restriction ? parseInt(this.market_tradable_restriction, 10) : 0);
|
|
42
|
-
this.market_marketable_restriction = (this.market_marketable_restriction ? parseInt(this.market_marketable_restriction, 10) : 0);
|
|
43
|
-
this.fraudwarnings = this.fraudwarnings || [];
|
|
44
|
-
this.descriptions = this.descriptions || [];
|
|
45
|
-
|
|
46
|
-
if (this.owner && JSON.stringify(this.owner) == '{}') {
|
|
47
|
-
this.owner = null;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Restore old property names of tags
|
|
51
|
-
if (this.tags) {
|
|
52
|
-
this.tags = this.tags.map(function(tag) {
|
|
53
|
-
return {
|
|
54
|
-
"internal_name": tag.internal_name,
|
|
55
|
-
"name": tag.localized_tag_name || tag.name,
|
|
56
|
-
"category": tag.category,
|
|
57
|
-
"color": tag.color || "",
|
|
58
|
-
"category_name": tag.localized_category_name || tag.category_name
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Restore market_fee_app, if applicable
|
|
64
|
-
var match;
|
|
65
|
-
if (this.appid == 753 && this.contextid == 6 && this.market_hash_name && (match = this.market_hash_name.match(/^(\d+)\-/))) {
|
|
66
|
-
this.market_fee_app = parseInt(match[1], 10);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Restore cache_expiration, if we can (for CS:GO items)
|
|
70
|
-
if (this.appid == 730 && this.contextid == 2 && this.owner_descriptions) {
|
|
71
|
-
let description = this.owner_descriptions.find(d => d.value && d.value.indexOf('Tradable After ') == 0);
|
|
72
|
-
if (description) {
|
|
73
|
-
let date = new Date(description.value.substring(15).replace(/[,()]/g, ''));
|
|
74
|
-
if (date) {
|
|
75
|
-
this.cache_expiration = date.toISOString();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// If we have item_expiration, also set cache_expiration to the same value
|
|
81
|
-
if (this.item_expiration) {
|
|
82
|
-
this.cache_expiration = this.item_expiration;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (this.actions === "") {
|
|
86
|
-
this.actions = [];
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// One wouldn't think that we need this if statement, but apparently v8 has a weird bug/quirk where deleting a
|
|
90
|
-
// property results in greatly increased memory usage. Because that makes sense.
|
|
91
|
-
if (this.currency) {
|
|
92
|
-
delete this.currency;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
CEconItem.prototype.getImageURL = function() {
|
|
97
|
-
return "https://steamcommunity-a.akamaihd.net/economy/image/" + this.icon_url + "/";
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
CEconItem.prototype.getLargeImageURL = function() {
|
|
101
|
-
if(!this.icon_url_large) {
|
|
102
|
-
return this.getImageURL();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return "https://steamcommunity-a.akamaihd.net/economy/image/" + this.icon_url_large + "/";
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
CEconItem.prototype.getTag = function(category) {
|
|
109
|
-
if (!this.tags) {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
for (var i = 0; i < this.tags.length; i++) {
|
|
114
|
-
if (this.tags[i].category == category) {
|
|
115
|
-
return this.tags[i];
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return null;
|
|
120
|
-
};
|
|
1
|
+
module.exports = CEconItem;
|
|
2
|
+
|
|
3
|
+
function CEconItem(item, description, contextID) {
|
|
4
|
+
var thing;
|
|
5
|
+
for (thing in item) {
|
|
6
|
+
if (item.hasOwnProperty(thing)) {
|
|
7
|
+
this[thing] = item[thing];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
var isCurrency = !!(this.is_currency || this.currency) || typeof this.currencyid !== 'undefined'; // I don't want to put this on the object yet; it's nice to have the ids at the top of printed output
|
|
12
|
+
|
|
13
|
+
if (isCurrency) {
|
|
14
|
+
this.currencyid = this.id = (this.id || this.currencyid);
|
|
15
|
+
} else {
|
|
16
|
+
this.assetid = this.id = (this.id || this.assetid);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
this.instanceid = this.instanceid || '0';
|
|
20
|
+
this.amount = parseInt(this.amount, 10);
|
|
21
|
+
this.contextid = this.contextid || contextID.toString();
|
|
22
|
+
|
|
23
|
+
// Merge the description
|
|
24
|
+
if (description) {
|
|
25
|
+
// Is this a listing of descriptions?
|
|
26
|
+
if (description[this.classid + '_' + this.instanceid]) {
|
|
27
|
+
description = description[this.classid + '_' + this.instanceid];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
for (thing in description) {
|
|
31
|
+
if (description.hasOwnProperty(thing)) {
|
|
32
|
+
this[thing] = description[thing];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
this.is_currency = isCurrency;
|
|
38
|
+
this.tradable = !!this.tradable;
|
|
39
|
+
this.marketable = !!this.marketable;
|
|
40
|
+
this.commodity = !!this.commodity;
|
|
41
|
+
this.market_tradable_restriction = (this.market_tradable_restriction ? parseInt(this.market_tradable_restriction, 10) : 0);
|
|
42
|
+
this.market_marketable_restriction = (this.market_marketable_restriction ? parseInt(this.market_marketable_restriction, 10) : 0);
|
|
43
|
+
this.fraudwarnings = this.fraudwarnings || [];
|
|
44
|
+
this.descriptions = this.descriptions || [];
|
|
45
|
+
|
|
46
|
+
if (this.owner && JSON.stringify(this.owner) == '{}') {
|
|
47
|
+
this.owner = null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Restore old property names of tags
|
|
51
|
+
if (this.tags) {
|
|
52
|
+
this.tags = this.tags.map(function(tag) {
|
|
53
|
+
return {
|
|
54
|
+
"internal_name": tag.internal_name,
|
|
55
|
+
"name": tag.localized_tag_name || tag.name,
|
|
56
|
+
"category": tag.category,
|
|
57
|
+
"color": tag.color || "",
|
|
58
|
+
"category_name": tag.localized_category_name || tag.category_name
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Restore market_fee_app, if applicable
|
|
64
|
+
var match;
|
|
65
|
+
if (this.appid == 753 && this.contextid == 6 && this.market_hash_name && (match = this.market_hash_name.match(/^(\d+)\-/))) {
|
|
66
|
+
this.market_fee_app = parseInt(match[1], 10);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Restore cache_expiration, if we can (for CS:GO items)
|
|
70
|
+
if (this.appid == 730 && this.contextid == 2 && this.owner_descriptions) {
|
|
71
|
+
let description = this.owner_descriptions.find(d => d.value && d.value.indexOf('Tradable After ') == 0);
|
|
72
|
+
if (description) {
|
|
73
|
+
let date = new Date(description.value.substring(15).replace(/[,()]/g, ''));
|
|
74
|
+
if (date) {
|
|
75
|
+
this.cache_expiration = date.toISOString();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// If we have item_expiration, also set cache_expiration to the same value
|
|
81
|
+
if (this.item_expiration) {
|
|
82
|
+
this.cache_expiration = this.item_expiration;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (this.actions === "") {
|
|
86
|
+
this.actions = [];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// One wouldn't think that we need this if statement, but apparently v8 has a weird bug/quirk where deleting a
|
|
90
|
+
// property results in greatly increased memory usage. Because that makes sense.
|
|
91
|
+
if (this.currency) {
|
|
92
|
+
delete this.currency;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
CEconItem.prototype.getImageURL = function() {
|
|
97
|
+
return "https://steamcommunity-a.akamaihd.net/economy/image/" + this.icon_url + "/";
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
CEconItem.prototype.getLargeImageURL = function() {
|
|
101
|
+
if(!this.icon_url_large) {
|
|
102
|
+
return this.getImageURL();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return "https://steamcommunity-a.akamaihd.net/economy/image/" + this.icon_url_large + "/";
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
CEconItem.prototype.getTag = function(category) {
|
|
109
|
+
if (!this.tags) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
for (var i = 0; i < this.tags.length; i++) {
|
|
114
|
+
if (this.tags[i].category == category) {
|
|
115
|
+
return this.tags[i];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return null;
|
|
120
|
+
};
|