rafaelgomesxyz / esgst

An extension that enhances SteamGifts / SteamTrades.
MIT License
147 stars 23 forks source link

Hide all owned games and DLC #41

Closed Revadike closed 6 years ago

Revadike commented 6 years ago

Much like this script does using this public database and steam private API, provide users the option to hide all giveaways of owned games and DLC. This will also include removed games. Essentially it will prevent users from accidentally entering giveaways of owned items that are not able to be detected by steam's public API. The hiding can be done during syncing of groups, etc.

marlop352 commented 6 years ago

isn't that the same as filtering the owned tag/category using the giveaways filter?

rafaelgomesxyz commented 6 years ago

Giveaway Filters already does this.

Revadike commented 6 years ago

Differently, but ok.

rafaelgomesxyz commented 6 years ago

How is it different? Doesn't it just hide those giveaways the same way the filters do? I didn't check the code of the script, just read your description.

Revadike commented 5 years ago

I think this request is still valid. I am pretty sure you are doing it differently. I am talking about hiding games and DLC through steamgift's hide giveaway feature. For that you need the steamgift's native gameid. But if you want to hide all owned (gathered from steam userdata), you need appid/subid to gameid conversion, which my API is the only one that provides this: https://royalgamer06.ga/sgdb.json Just check the code of my script and it will make more sense.

rafaelgomesxyz commented 5 years ago

Sorry, back then I didn't understand that you were talking about SteamGifts' filter list, but this has already been implemented in Multi-Manager (actually 10 days ago xD): https://github.com/gsrafael01/ESGST/blob/master/src/modules/General/MultiManager.js#L1085

But there's no single-click way to hide all owned games at the moment, although I can implement that. Currently you have to either go to your owned games page on SteamGifts and use the feature there or get store links to all of the games in your account and give them to the feature.

I use SteamGifts' new giveaway search to retrieve game IDs (as you can see in the function linked above), but I could add your API as the primary method if it's reliable. Though I guess it's the same thing (1 request).

Revadike commented 5 years ago

Yes, it's reliable and I use the same way of collecting/retrieving the ID's. My bot scans steamgifts archive periodically for any new giveaway games and then requests/updates the ID's. I do this so individuals don't have to and therefore will reduce the load on steamgifts significantly. Why?

This is exactly why I made this API in the first place. Not just for my script, but anyone that could make use of it and reduce load on steamgifts.

And yes, like my userscript does, it gets the owned steam store id's (appids) from https://store.steampowered.com/dynamicstore/userdata/ and use that data combined with my game id database to hide all owned apps. I suggest you check out my userscript's code, it's easy code.

rafaelgomesxyz commented 5 years ago

Ok, I'll add your API as the primary method then.

I don't need to check the code, ESGST already has all the logic in place. :)

rafaelgomesxyz commented 5 years ago

From initially looking at the API, I see this:

45420: 1431836977

Is it correct? I don't think Steam has ids that long, it looks like a date timestamp.

Revadike commented 5 years ago

That is correct. Just check yourself by searching for that game when creating a giveaway and then view the source.

rafaelgomesxyz commented 5 years ago

Yeah, I got confused, I thought 45420 was the SteamGifts id and 1431836977 was the Steam id, but it's the other way around. What is gameids for?

Revadike commented 5 years ago

That's just the reverse.

rafaelgomesxyz commented 5 years ago

But can't the reverse be appids and subids?

Revadike commented 5 years ago

But can't the reverse be appids and subids?

what do you mean?

rafaelgomesxyz commented 5 years ago

There are 4 possible mappings:

Steam appid => SteamGifts id Steam subid => SteamGifts id SteamGifts id => Steam appid SteamGifts id => Steam subid

The gameids object is mapping SteamGifts ids to what? Steam appids or subids? They can be both, so you'd have to separate them.

Revadike commented 5 years ago

yes both and they are already separated you could do: Object.keys(json.appids).includes(json.gameids[gameid]) ? "appid" : "subid";

rafaelgomesxyz commented 5 years ago

Problem is appids and subids can have the same id. Let's say there's an entry like this in gameids:

"20": "50200"

And let's say appids has an entry like this:

"50200": "100"

And let's say subids has an entry like this:

"50200": "20"

It would incorrectly detect 20 as the appid 50200, when, in fact, 20 is the subid 50200.

I don't know if you understand what I'm saying. Occurrences like this are a bit rare, but they exist, I used to not differentiate between appids and subids on ESGST because I thought they were unique, until I found an id that was the same.

Revadike commented 5 years ago

Yes, I see the problem, but this is rare and 90% of all ID's are appids, so the best guess will be appid. However, I don't really see why you would need to know this anyway. Wouldn't you just get the list of appids and the list of owned subs from steam userdata? Then just use the different categories to get the sg gameid for hiding it. You shouldn't use my endpoint to differentiate subids from appids anyway.

rafaelgomesxyz commented 5 years ago

Even if it was 99.99%, there would be no harm in separating them to prevent issues, it's very easy to just use the format { "id": "20", "type": "apps" }.

For hiding games, I'm already using your endpoint and it's all sorted out.

But I was also going to use your endpoint for something else, when a giveaway doesn't have the Steam id on SteamGifts, but has the attribute data-game-id. In that case, I could use the reverse method to get the Steam id of the game. But since the gameids endpoint is not 100% accurate, I cannot use it.

It's just a suggestion, I'm currently using whitelist filters to get the Steam ids of those games (see #1077).

Revadike commented 5 years ago

No, it would be redundant. You could for example do this: "SteamGifts GameID " + gameid + " is a Steam " + (Object.entries(json.appids).includes(gameid) ? "Appid" : "Subid") This is different from the previous example.

rafaelgomesxyz commented 5 years ago

It's not redundant.

Using the reverse method to get a Steam id from a SteamGifts id (if it was in the format I mentioned):

steam_obj = json.gameids[game_id];
if (steam_obj) {
  steam_id = steam_obj.id;
  steam_type = steam_obj.type;
}

Using the regular method:

steam_id = Object.keys(json.appids).filter(x => json.appids[x] == game_id)[0];
if (steam_id) {
  steam_type = "apps";
} else {
  steam_id = Object.keys(json.subids).filter(x => json.subids[x] == game_id)[0];
  if (steam_id) {
    steam_type = "subs";
  }
}

First method is much nicer.

But anyway, like I said, it was just a suggestion to make the endpoint 100% accurate, but clearly you don't agree, so nevermind.