SteamBot icon indicating copy to clipboard operation
SteamBot copied to clipboard

Goals for a new Inventory

Open BlueRaja opened this issue 11 years ago • 17 comments

Alright, I think it's time to finally sit down and rewrite the inventory system. The current one has a lot of issues. Here's a list of goals I'd like to accomplish:

  • Consolidate Item and Inventory into single classes. No more of this "grabbing the description for an item" crap. No more separate Inventory classes for TF2 vs. other games. No more "Item may have a Schema.Item, Inventory.Item, or both, depending on circumstances".

    Note that we may still have multiple classes for different Inventory/Item types, but they should all be derived from a common base class.

  • Inventory should work with "friends-only" inventories, and private inventories during a trade.

  • Bot should not block the trade while waiting for inventories to load. Probably the easiest way to make this happen is to not call OnTradeItemAdded until all Inventories have been loaded.

  • Inventory should work with more than 2500 items.

  • Inventory should be loaded using the correct URL (if that's even possible)

  • Should be compatible with StormReaper's TradeOffer PR, since a lot of people are using that. Add partnerInventory API support.

  • New: Should work with items that have amounts, like gems.

  • As an optional goal, should work with Spiral Knights (does anyone even care about this?)

Can anyone think of anything else?

This is going to be a major breaking change, but I think that's acceptable. This has been a long time coming.

BlueRaja avatar Oct 11 '14 14:10 BlueRaja

What's the plan on this, sounds like a bit of work, who's going to stay implementing it? On 11 Oct 2014 15:38, "BlueRaja" [email protected] wrote:

Alright, I think it's time to finally sit down and rewrite the inventory system. The current one has a lot of issues. Here's a list of goals I'd like to accomplish:

  • Consolidate Item and Inventory into single classes. No more of this "grabbing the description for an item" crap. No more separate Inventory classes for TF2 vs. other games. No more "Item may have a Schema.Item, Inventory.Item, or both, depending on circumstances". Note that we may still have multiple classes for different Inventory/ Item types, but they should all be derived from a common base class.
  • Inventory should work with "friends-only" inventories https://github.com/Jessecar96/SteamBot/issues/639, and private inventories https://github.com/Jessecar96/SteamBot/issues/560 during a trade.
  • Bot should not block the trade while waiting for inventories to load. Probably the easiest way to make this happen is to not call OnTradeItemAdded until all Inventories have been loaded.
  • Inventory should work with more than 2500 items https://github.com/Jessecar96/SteamBot/issues/640.
  • Inventory should be loaded using the correct URL https://github.com/Jessecar96/SteamBot/issues/641 (if that's even possible)
  • Should be compatible with StormReaper's TradeOffer PR https://github.com/Jessecar96/SteamBot/pull/633, since a lot of people are using that.
  • As an optional goal, should work with Spiral Knights https://github.com/Jessecar96/SteamBot/issues/575 (does anyone even care about this?)

Can anyone think of anything else?

This is going to be a major breaking change, but I think that's acceptable. This has been a long time coming.

— Reply to this email directly or view it on GitHub https://github.com/Jessecar96/SteamBot/issues/642.

Bottswana avatar Oct 11 '14 14:10 Bottswana

Another goal, add support for partnerinventory web interface which is used by Trade Offers.

For reference: /tradeoffer/<TRADE_OFFER_ID>/partnerinventory/?sessionid=<SESSION_ID>&partner=<STEAMID64>&appid=<HERP>&contextid=<DERP>

scholtzm avatar Oct 11 '14 15:10 scholtzm

No more separate Inventory classes for TF2 vs. other games

Will it be possible to specify an appid in the settings file for each bot, which is used to determine which inventory to load?

BTW, it would be nice if releases were tagged, so that it's easy to merge changes without worrying about BC breaks.

glen-84 avatar Oct 11 '14 20:10 glen-84

@glen-84 appid and contextid will have to be specified, but most likely just in your code and not a settings file.

scholtzm avatar Oct 11 '14 21:10 scholtzm

@scholtzm I was hoping to avoid code changes, like we currently do with replacing 440 with 570 in a bunch of places. This would also allow you to have multiple bots with inventories from different games (f.e. one Dota 2 bot and one CS:GO bot).

glen-84 avatar Oct 11 '14 21:10 glen-84

I have separate config for "my" stuff, you could probably do the same. Nonetheless it's too soon to tell how the things will go.

scholtzm avatar Oct 11 '14 21:10 scholtzm

This Inventory change is going to be a major breaking change, so you will definitely need some code changes regardless.

I think it makes more sense to specify which inventories to load in code rather than config files (it's something that varies by user-handler, not by bot-instance), but I'm open changing my mind.

BlueRaja avatar Oct 11 '14 21:10 BlueRaja

Can Generic Schemas be of use? Also for inventory loading, how about a call to the userhandler with a list that the userhandler can fill with appids of inventories to load.

WildCard65 avatar Oct 11 '14 23:10 WildCard65

I'm not sure if Schemas are necessary, or if we can get everything from the inventory/json API

BlueRaja avatar Oct 12 '14 19:10 BlueRaja

I thought Valve have been trying to kill the community api on steamcommunity.com for a while now. I don't know if that is relevant, but if it is, is it something to consider during this rewrite?

If the information is old my apologies, haven't worked on the inventory API since dabbling with a dota2 site a few years ago. Actually it might only be the XML based api on steamcommunity they have 'depreciated'.

Bottswana avatar Oct 12 '14 20:10 Bottswana

Well I started on a generic schema system.

On Sun, Oct 12, 2014 at 4:11 PM, Bottswana [email protected] wrote:

I thought Valve have been trying to kill the json api on steamcommunity.com for a while now. I don't know if that is relevant, but if it is, is it something to consider during this rewrite?

If the information is old my apologies, haven't worked on the inventory API since dabbling with a dota2 site a few years ago.

— Reply to this email directly or view it on GitHub https://github.com/Jessecar96/SteamBot/issues/642#issuecomment-58820503.

WildCard65 avatar Oct 12 '14 20:10 WildCard65

@Bottswana Right now regular trades and trade offers use the API provided by steamcommunity.com so imo it's the best to use that. Considering they have recently updated it (partner inventory in trade offers), I don't think they are going to kill it any time soon.

scholtzm avatar Oct 13 '14 08:10 scholtzm

Yeah looks like the Inventory (json) API isn't on the hate list, only the ?xml=1 API's. For the reference, these are the ones they want to depreciate: https://partner.steamgames.com/documentation/community_data

Bottswana avatar Oct 13 '14 08:10 Bottswana

Also one thing I noticed is type inconsistency. Sometimes, item IDs are declared as long, sometimes as ulong etc. Since we are doing breaking changes, this could be also looked into.

scholtzm avatar Oct 27 '14 18:10 scholtzm

Any news? It's been almost a year.

aleksamagicka avatar Nov 23 '15 20:11 aleksamagicka

I know this is around two years old, but I'd just like to ask if anyone has found a way to get a user's Spiral Knights inventory? I know you can find the context ids of the inventories manually but have we found a way to do it programamtically yet?

crunchyintheory avatar Jun 02 '17 01:06 crunchyintheory

I dislike bumping old issues such as this. However, after watching the Steam API recently, I feel as though we need to have some of this pushed/updated as the API has become more and more unstable recently causing the bot to fail to login which if this was to be pushed, this would remove some of these issues.

ghost avatar Apr 16 '18 20:04 ghost