Jump to content
McKay Development

orcnaydn

Member
  • Posts

    5
  • Joined

  • Last visited

Posts posted by orcnaydn

  1. I want to someone type my bot !selltf, his sell max 15 sets per game how can i do that?

    My Code;

     

    Inventory.prototype.getCustomerSets = function(ignore, sid64, callback, permit){
    	let self=this;
    	this.community.getUserInventoryContents(sid64, 753, 6, true, (err, items) => {
    			if(err){
    				callback(err); 
    			}
    			else {
    				
    				items = items.filter(item => {
    					if(item.getTag("item_class").internal_name == "item_class_2" && item.getTag("cardborder").internal_name == "cardborder_0"){ 
    						return item;
    					}
    				});
    				
    				let customer_sets=[],
    					customer_cards={};
    				
    				items.forEach( card => {
    					const appid=card.market_hash_name.split("-")[0];
    					if(!customer_cards[appid]){customer_cards[appid]={};}
    					if(!customer_cards[appid][card.market_hash_name]){customer_cards[appid][card.market_hash_name]=[];}
    					customer_cards[appid][card.market_hash_name].push(card);
    				});
    
    				for(let appid in customer_cards){
    					if(self.card_db[appid]){
    						if(Object.keys(customer_cards[appid]).length == self.card_db[appid]){
    							
    							let customerHave = Math.min.apply( Math, values(customer_cards[appid]).map( card => card.length ) ),
    								botHave = self.AvailableSets[appid] ? self.AvailableSets[appid].length : 0,
    								limit = permit ? (self.maxStock+permit) : self.maxStock,
    								falt = limit-botHave;
    							
    							customerHave = !ignore ? ( (falt > 0) ? ( Math.min( ...[ falt, customerHave ]  ) ) : 0 ) : customerHave;
    							
    							for (let i=0;i<customerHave;i++) {
    								let currentCustomerSet=[]
    								for(let card in customer_cards[appid]){
    									currentCustomerSet.push(customer_cards[appid][card][i]);
    								}
    								customer_sets.push(currentCustomerSet);
    							}
    						}
    					} else {
    						self.getAppIdCount(appid);
    					}					
    				}
    				callback(null, customer_sets);
    			}
    		});
    }
    

  2. community.getUserInventoryContents(partner, 753, 6, true, (error, items) => {
    if(error) {
    users.removeReservation(partner, true, removeFunc);
    return callback(error);
    }
    
    let count = 0;
    
    for(let i = 0; i < items.length; i++) {
    let item = items[i];
    
    if(item.type.toLowerCase() != "Trading Card")
    continue;
    
    count += item.amount;
    
    if(count > price) {
    item.amount -= (count - price);
    count -= (count - price);
    }
    
    offer.addTheirItem(item);
    
    if(count == price)
    break;
    }
    
    if(count < price) {
    users.removeReservation(partner, true, removeFunc);
    return callback("You do not have enough gems to purchase random games.");
    }
    
    if(count > price) {
    users.removeReservation(partner, true, removeFunc);
    return callback("An unexpected error occurred, please try again.");
    }
    
    offer.send((error, status) => {
    if(error) {
    users.removeReservation(partner, true, removeFunc);
    return callback(error);
    }
    
    if(status == "pending") {
    community.acceptConfirmationForObject(files.getConfig().identity, offer.id, error => {
    if(error) {
    users.removeReservation(partner, true, removeFunc);
    return callback(error);
    }
    
    callback(null, "https://steamcommunity.com/tradeoffer/" + offer.id);
    });
    } else if(status == "sent")
    callback(null, "https://steamcommunity.com/tradeoffer/" + offer.id);
    });
    });
    
    break;
    default:
    users.removeReservation(partner, true, (error) => {
    if(error)
    return callback(error);
    
    return callback("Invalid payment method");
    });
    }
    });
    });
    }
    
     
    Where is my fault?
  3. I want take random 5 trading cards how can i do ?

    i use this;

     

    community.getUserInventory(partner, 753, 6, true, (error, items) => {
    if(error) {
    users.removeReservation(partner, true, removeFunc);
    return callback(error);
    }
     
    let count = 0;
     
    for(let i = 0; i < items.length; i++) {
    let item = items;
     
    if(item.type.toLowerCase() != "Steam Trading Cards")
    continue;
     
    count += item.amount;
     
    if(count > price) {
    item.amount -= (count - price);
    count -= (count - price);
    }
     
    offer.addTheirItem(item);
     
    if(count == price)
    break;
    }


    But dont working help me please
  4. How to fix it i try all webLogOn script but dont working ı use this commands;

     

    const async = require('async');
     
    const TradeOfferManager = require('steam-tradeoffer-manager');
    var manager = null;
     
    const SteamCommunity = require('steamcommunity');
    var community = null;
    const WebAPI = require('@doctormckay/steam-webapi');
    var api = null;
    const SteamID = require('steamid');
     
    const steam = require('./steam');
    const users = require('./users');
    const files = require('./files');
     
    var first = true;
    var ongoing = false;
     
    exports.setup = (client, cookies, callback) => {
    manager = new TradeOfferManager({
    steam: client,
    domain: "example.net"
    });
    community = new SteamCommunity();
     
    manager.setCookies(cookies);
    community.setCookies(cookies);
    api = new WebAPI(files.getConfig().apikey);
    if(first) {
    callback();
    first = false;
    }
    registerEvents();
     
    community.on("sessionExpired",function(err) {
    client.webLogOn();
    });
×
×
  • Create New...