Closed cwhelchel closed 11 years ago
This looks like it could be pretty useful. So I'm assuming schemaItem will work but you won't get anything from inventoryItem?
@waylaidwanderer Correct. Not until we figure out how to map some of the things from the available data to the fields in inventoryItem
.
I think the only, relevant and needed data is whether or not it's craft-able. The available JSON has the raw HTML:
(Not usable in crafting)
Which is fine for a person trading. Most other decisions I think can be made from the schema data and the stuff that's in the JSON. Non trade-able items don't even show up in the foreign inventory.
FYI here's what the JSON for the foreign inventory looks like
I've seen json ("rgInventory" specifically) like this elsewhere in the SteamBot code but I'm not sure where....
The problem with this is that the bot can't request it's own backpack when it's outside of a trade. Is there any way to fix that?
Otherwise, this is amazing.
@redjazz96 You mean when the bot has a private backpack? I haven't messed with that at all. This is only for trade partners (OtherSID) that have a private backpack.
That's something I can surely look into though.
Back when i looked into this the defindex wasn't present in the json so i guess they changed that, perhaps for the market update. However even back then the problem was determining the attributes of the item like you mentioned the crafting attribute is probably the most important one. The real question i think is whether its a good enough compromise for your purposes, if you wanted to get more attributes from the item you would have to dig inside the json and html attributes. If i'm not mistaken some of the attributes were also impossible to get, if i recall correctly it was an account_info - steamid which was missing for personalized/crafted items. So again if that's the case depending on the bot's functions it might not be for everyone.
On the flip side you can quite easily extend this functionality to work for all tradeable games/items.
@StormReaper The account steam ID is probably not available for a personalized (crafted) in the context of a trade anyway. This is there tho (see descriptions):
"descriptions": [
{
"type": "html",
"value": "Crafted by John, Boring Old John.",
"color": "7ea9d1"
},
}
If you think about it, these HTML fragments are all that's needed with trading with a human, because they can read and say "Ohh that's not craftable" or "Ohh someone tf2-famous crafted that" (IDK if the human trader can verify the actual steamid of the craft tho - hence the absence of a third party steam id).
I think most bots wouldn't care about gifted-by or crafted-by tags; it'd just care about it being usable in crafting.
Fixed with #384
See this branch: https://github.com/cwhelchel/SteamBot/tree/fix/privatebp
I don't want to pull this yet but I do want everyone to try it out. I've done some basic testing but I need everyone else to help out with testing.
There may be bugs or other issues. Let me know here.
Update - to expand upon what this is doing.
There is a trade web call that can be used to get the inventory of someone you are in trade with:
It takes the trade's current contextid and can only be used in the trade window. Also it takes an app_id which is why i'm thinking that this can be used to get info about other game's items and even steam inventory items.
The return has a classid for a given itemid (which is known to the trade from the tradestatus) as well as some descriptions that contain various bits of info but most importantly, the defindex of the class id. This is used to get the correct schema info but not the actual item information. Therefore, this code won't pass in a valid instance of
inventoryItem
to the UserHandler fuctions:I think the biggest issue is figuring out properties of an item (like if the item is craft-able/trade-able)