Скрипт сканирует инвентарь на наличие фонов и смайликов из зимней распродажи 2018 и крафтит их в самоцветы.
Лог выводится в консоль.
Скрипт просто вставить в консоль на странице инвентаря.
БОНУС:
Лог выводится в консоль.
Код:
var n = 0;
function unique(arr){
var obj = {};
for(var i=0;i<arr.length;i++){
var str=arr[i];
obj[str]=true;
}
return Object.keys(obj);
}
var assets = [];
var descriptions = [];
var assetid = [];
var classid = [];
console.log('Сканирование инвентаря');
function scan(start_assetid){
if(start_assetid != undefined) start_assetid = '&start_assetid=' + start_assetid; else start_assetid = '';
$J.get('https://steamcommunity.com/inventory/' + g_steamID + '/753/6?l=english&count=5000' + start_assetid).done(function(data){
assets = assets.concat(data.assets);
descriptions = descriptions.concat(data.descriptions);
if(data.last_assetid != undefined) scan(data.last_assetid); else{
for(var i = 0; i < descriptions.length; i++){
var tag = JSON.stringify(descriptions[i].tags);
if(tag.match(/internal_name..("app_991980")/)!=null){
if(tag.match(/localized_tag_name..("Emoticon")/)!=null || tag.match(/localized_tag_name..("Profile Background")/)!=null){
classid = classid.concat([descriptions[i].classid]);
}
}
}
for(var a = 0; a < classid.length; a++){
for(var h = 0; h < assets.length; h++){
if(assets[h].classid == classid[a]){
assetid = assetid.concat([assets[h].assetid]);
}
}
}
assetid=unique(assetid);
console.log('Найдено ' + assetid.length + ' смайликов и фонов (The Steam Winter Sale - 2018)');
function ajaxgrindintogoo(){
console.log('Крафт ' + (n + 1) + ' из ' + assetid.length + ' штук');
$J.post(g_strProfileURL + '/ajaxgrindintogoo/',{
sessionid: g_sessionID,
appid: 991980,
assetid: assetid[n],
contextid: 6,
goo_value_expected: 100
}).always(function(){
n++;
if(assetid.length > n){
ajaxgrindintogoo();
}else{
alert(true);
}
});
};
if(assetid.length != 0) ajaxgrindintogoo();
}
}).fail(function(){
console.log('Ошибка при сканировании, повтор через 5 секунд');
setTimeout(function(){
scan(start_assetid);
},5000);
});
}
scan();
БОНУС:
Код:
var n = 0;
function unique(arr){
var obj = {};
for(var i=0;i<arr.length;i++){
var str=arr[i];
obj[str]=true;
}
return Object.keys(obj);
}
var assets = [];
var descriptions = [];
var assetid = [];
var classid = [];
console.log('Сканирование инвентаря');
function scan(start_assetid){
if(start_assetid != undefined) start_assetid = '&start_assetid=' + start_assetid; else start_assetid = '';
$J.get('https://steamcommunity.com/inventory/' + g_steamID + '/753/6?l=english&count=5000' + start_assetid).done(function(data){
assets = assets.concat(data.assets);
descriptions = descriptions.concat(data.descriptions);
if(data.last_assetid != undefined) scan(data.last_assetid); else{
for(var i = 0; i < descriptions.length; i++){
var owner_actions = JSON.stringify(descriptions[i].owner_actions[0].link);
if(descriptions[i].market_fee_app==991980){
if(owner_actions.match(/ActivateCommunityItemConsumable\( 991980,/)!=null){
var action = owner_actions.match(/"action\\": \\"(.*)\\",\\/)[1];
var message = owner_actions.match(/"message\\": \\"(.*)\\"\\/)[1];
var item_type = owner_actions.match(/n}, (\d*), '/)[1];
classid = classid.concat([[descriptions[i].classid,action,message,item_type]]);
}
}
}
for(var a = 0; a < classid.length; a++){
for(var h = 0; h < assets.length; h++){
if(assets[h].classid == classid[a][0]){
assetid = assetid.concat([[assets[h].assetid,classid[a][1],classid[a][2],classid[a][3]]]);
}
}
}
assetid=unique(assetid);
console.log('Найдено ' + assetid.length + ' расходуемых предметов (The Steam Winter Sale - 2018)');
function ajaxactivateconsumable(){
var asset = assetid[n].split(/,/);
console.log('Крафт ' + (n + 1) + ' из ' + assetid.length + ' штук');
$J.post(g_strProfileURL + '/ajaxactivateconsumable/',{
sessionid: g_sessionID,
appid: 991980,
item_type: asset[3],
assetid: asset[0],
actionparams: '{"action": "'+asset[1]+'","message": "'+asset[2]+'"}'
}).always(function(){
n++;
if(assetid.length > n){
ajaxactivateconsumable();
}else{
alert(true);
}
});
};
if(assetid.length != 0) ajaxactivateconsumable();
}
}).fail(function(){
console.log('Ошибка при сканировании, повтор через 5 секунд');
setTimeout(function(){
scan(start_assetid);
},5000);
});
}
scan();
Последнее редактирование: