Jump to content
McKay Development

Asset ID mapping


Recommended Posts

I want to map the asset ids of items that some in my inventory by that i mean i have a accept gifts function which accepts gift trades i want to see the new asset id of the item how can i do that without calling additional methods is this possible ?

Link to comment
Share on other sites

my problem statement is i want to input the asset ids and the name of items in my database as soon as they are received what is the most fastest and efficient way to do that?

18 hours ago, Dr. McKay said:

Not possible without calling additional methods, no.

 

Link to comment
Share on other sites

On 5/23/2024 at 7:54 AM, Dr. McKay said:

they are one way trades  like when u get trades from p2p market places i have read the description of the method this applies to two way trades i am asking about 1 way trades or in other words gift trades

Link to comment
Share on other sites

Posted (edited)
On 5/23/2024 at 7:54 AM, Dr. McKay said:

i have now resolved issue to listening received offerchange event when a n offer changes to accepted and is a gift then it extracts the id and send it to db is this approach ok?

Edited by TheMaster
was dublicated
Link to comment
Share on other sites

1 hour ago, TheMaster said:

they are one way trades  like when u get trades from p2p market places i have read the description of the method this applies to two way trades i am asking about 1 way trades or in other words gift trades

It works for one-sided trades as well. An exchange is still an exchange, even if one side is empty.

44 minutes ago, TheMaster said:

i have now resolved issue to listening received offerchange event when a n offer changes to accepted and is a gift then it extracts the id and send it to db is this approach ok?

Extracts the ID how?

Link to comment
Share on other sites

8 minutes ago, Dr. McKay said:

It works for one-sided trades as well. An exchange is still an exchange, even if one side is empty.

Extracts the ID how?

    manager.on('receivedOfferChanged', function(offer, oldState) {
        console.log(green, `RECEIVED OFFER changed: ${TradeOfferManager.ETradeOfferState[oldState]} -> ${TradeOfferManager.ETradeOfferState[offer.state]}`);
   
        // Extract asset IDs and market hash names of the received items
        if (offer.itemsToReceive && offer.itemsToReceive.length > 0) {
            offer.itemsToReceive.forEach(item => {
                console.log(`Received item asset ID: ${item.assetid}, Market Hash Name: ${item.market_hash_name}`);
            });
        } else {
            console.log('No items received in this offer.');
        }
    });
Link to comment
Share on other sites

Posted (edited)
3 minutes ago, Dr. McKay said:

Those are the asset IDs before the exchange happened, not after.

then how to get the new asset ids i somewhere saw this mapping but cant remember the same get exchage details?

Edited by TheMaster
Link to comment
Share on other sites

1 minute ago, Dr. McKay said:

Use getExchangeDetails.

so this is the algorithm i think is possible as i dont have the trade id of the trade from the p2p website what i do is i check i modify the received offer changed event to get the trade offer id of the gift trade and then use the  getOffer(id, callback) method to call the get exchange details method as it says in the wiki it must be created with the get offer or offers method right?
TradeOffer is a class which represents an individual trade offer sent or received by your account. It cannot be instantiated directly, it must be created using TradeOfferManager#createOffer, TradeOfferManager#getOffer, or TradeOfferManager#getOffers.
 

Link to comment
Share on other sites

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...