[英]Node.js steam trade bot, finding the items instanceid
Here is the basic code from one of the examples, 这是其中一个示例的基本代码,
offers.on('receivedOfferChanged', function (offer, oldState) {
logger.info(offer.partner.getSteam3RenderedID() +" Offer #" + offer.id + " changed: " + TradeOfferManager.getStateName(oldState) + " -> " + TradeOfferManager.getStateName(offer.state));
// Alert us when we accept an offer
if (offer.state == TradeOfferManager.ETradeOfferState.Accepted) {
offer.getReceivedItems(function (err, items) {
if (err) {
logger.error("Couldn't get received items: " + err);
} else {
var names = items.map(function(item) {
return item.name;
});
// Log a comma-separated list of items received
logger.info("Received: " + names.join(', '));
}
});
}
});
What I am trying to do is whats similar to line 10 where he returns the name however I want to get the items instance id so that I may be able to place it into a array. 我想要做的是类似于第10行的操作,在该行中他返回了名称,但是我想获取item实例ID,以便可以将其放入数组中。
Any assistance would be well appreciated. 任何帮助将不胜感激。
This thread is now 1 years old but I still want to answer it for people who still don't have the answer. 该线程现在已有1年历史了,但是我仍然想为仍然没有答案的人们回答它。
As stated here: https://github.com/DoctorMcKay/node-steamcommunity/wiki/CEconItem Img: http://prntscr.com/cx6qa9 如此处所述: https : //github.com/DoctorMcKay/node-steamcommunity/wiki/CEconItem图: http : //prntscr.com/cx6qa9
You can get the InstanceID by asking it. 您可以通过询问获得InstanceID。
var instance_id = items.map(function(item) {
return item.instanceid;
});
var instanceIDs = instance_id.join('/');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.