Added better paging controls for new inventory endpoint

This commit is contained in:
Alexander Corn 2016-12-13 01:29:06 -05:00
parent 9a3cf927c0
commit d367e8eae4

View File

@ -267,7 +267,7 @@ SteamCommunity.prototype.getUserInventory = function(userID, appID, contextID, t
var pos = 1;
get([], [], 1);
function get(inventory, currency, step, start) {
function get(inventory, currency, start) {
self.httpRequest({
"uri": "https://steamcommunity.com/inventory/" + userID.getSteamID64() + "/" + appID + "/" + contextID,
"headers": {
@ -311,8 +311,8 @@ SteamCommunity.prototype.getUserInventory = function(userID, appID, contextID, t
}
}
if(body.total_inventory_count > 5000 * step) {
get(inventory, currency, step + 1, body.assets[body.assets.length - 1].assetid);
if (body.more_items) {
get(inventory, currency, body.last_assetid);
} else {
callback(null, inventory, currency, body.total_inventory_count);
}