这是其中一个示例的基本代码,
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(', '));
}
});
}
});
我正在尝试做的是类似于第 10 行,他在其中返回名称,但是我想获取项目实例 ID,以便我可以将其放入数组中。
任何帮助将不胜感激。