function getFloat(url, cb) {
var options = {
url: url
};
function cab(error, response, body){
if (!error && response.statusCode == 200) {
cb(JSON.parse(body).iteminfo.floatvalue);
}
}
request(options, cab);
}
Bot.prototype.inventory = function(command, data, callback){
var self = this, req = this._request, s64 = this.steamClient.steamID;
var float;
this.offers.loadMyInventory({appId: this._options.appid, contextId: 2, language: "english"},function(err, botItems){
if(err){
if (typeof callback === 'function') {
callback(false, err.message);
}
return;
};
//var float = JSON.parce(body.iteminfo.floatvalue);
var items = [], i = 0, fvl;
botItems.forEach(function(item){
var url3 = "http://api.csgofloat.com:1739/?url="+item.actions[0].link;
var url2 = url3.replace('%owner_steamid%', s64);
var url = url2.replace('%assetid%', item.id);
getFloat(url, function(f){
console.log(f); (<- ЭТА ПЕРЕМЕННАЯ НУЖНА)
});
console.log(fn);
items[i++] = {
assetid: item.id,
name: item.name,
classid: item.classid,
instanceid: item.instanceid,
amount: item.amount,
pos: item.pos,
icon_url: item.icon_url,
icon_url_large: item.icon_url_large,
market_name: item.market_name,
market_hash_name: item.market_hash_name,
name_color: item.name_color,
type: item.type,
tags: item.tags,
actions: item.actions,
floatvalue: (ТУТ НУЖНА ЭТА ПЕРЕМЕННАЯ)
};
});
this.sendCommand(this.COMMANDS_ID.inventory, {itemsd: items}, function(response){
if (typeof callback === 'function') {
callback(response.success);
}
});
}.bind(this));
};