Jump to content
McKay Development

Recommended Posts

Posted (edited)

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?
Edited by orcnaydn

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...