Lacro59 / playnite-successstory-plugin

This plugin shows the game achievements in Playnite.
https://playnite.link
MIT License
178 stars 33 forks source link

Download Plugin Data removes achievement progress on Steam #444

Closed Whitechapel-1888 closed 3 months ago

Whitechapel-1888 commented 10 months ago

Success Story 3.1.7

I updated my entire game library using "Main Menu > Extensions > Success Story > Download plugin data...". This downloaded the correct achievements for all games fixing this issue, but removed all progress from my steam games: image

I completed this game some time ago: image

RetroAchievements & GoG are not affected.

Lacro59 commented 10 months ago

Can you post your extension.log?

Whitechapel-1888 commented 10 months ago

Can you post your extension.log?

I would but there's no error notification, so no log dump is created. Is the extension.log accessible somewhere else?

damirarh commented 10 months ago

The same thing is happening to me in the last two versions. There are no errors, here are the relevant entries from the log for the problematic scan:


08-01 18:31:34.870|INFO |SuccessStory#PluginDatabaseObject`4:RefreshNoLoader(Half-Life: Alyx - e413dbda-4685-4eac-9697-bb2afd950834)
08-01 18:31:34.870|INFO |SuccessStory#PluginDatabaseObject`4:Used SuccessStory.Clients.SteamAchievements for Half-Life: Alyx - e413dbda-4685-4eac-9697-bb2afd950834
08-01 18:31:34.870|INFO |SuccessStory#SteamAchievements:GetAchievements() - IsLocal : False, IsManual : False, HasApiKey: False, SteamIsPrivate: False
08-01 18:31:35.306|INFO |SuccessStory#SteamAchievements:SteamApi.GetAchievements()
08-01 18:31:37.284|INFO |SuccessStory#PluginDatabaseObject`4:0/42 achievements find for Half-Life: Alyx - e413dbda-4685-4eac-9697-bb2afd950834

I haven't had time to debug the issue yet. Maybe something fails to parse because of a different locale.

damirarh commented 10 months ago

Ok, I did some debugging. As far as I can tell, the issue is caused by this if statement:

https://github.com/Lacro59/playnite-successstory-plugin/blob/032c98d45b9ce12f950c091263eb7f8e17d7b910/source/Clients/SteamAchievements.cs#L89-L90

At this point steamAchievements contains all the achievements but without any unlock data because I didn't enter a Steam API key. Because of this my accountInfos is null and the whole block below is skipped (not marking any of my achievements as unlocked):

https://github.com/Lacro59/playnite-plugincommon/blob/95b985867adc9ae54b043ad3d13a4be733637474/CommonPluginsStores/Steam/SteamApi.cs#L424-L456

If I change the if statement above to force the code to continue in the else block, then it correctly scrapes the unlocked achievements. I changed it as follows:

var accountInfos = SteamApi.CurrentAccountInfos;
ObservableCollection<GameAchievement> steamAchievements = SteamApi.GetAchievements(game.GameId, accountInfos);
if (steamAchievements?.Count > 0 && accountInfos != null && accountInfos.IsCurrent)

I didn't create a PR because I'm not sure that this change won't break something else.

OdinIsLord commented 10 months ago

Same, all steam games are at 0% progress.

PatrykJWisniewski commented 9 months ago

I was having this issue as well. Never had to use an API key before, but adding one fixed this issue for me.

Whitechapel-1888 commented 9 months ago

I was having this issue as well. Never had to use an API key before, but adding one fixed this issue for me.

I have added an API key but the steam achievements still do not show up. I updated the game library, downloaded the SuccessStory plugin data, and refreshed individually and nothing worked.

OdinIsLord commented 9 months ago

I was having this issue as well. Never had to use an API key before, but adding one fixed this issue for me.

I have added an API key but the steam achievements still do not show up. I updated the game library, downloaded the SuccessStory plugin data, and refreshed individually and nothing worked.

Yeah I kinda gave up on it. Funny how the only games left that don't have achievements working are the games I paid for.

damirarh commented 9 months ago

I was having this issue as well. Never had to use an API key before, but adding one fixed this issue for me.

I have added an API key but the steam achievements still do not show up. I updated the game library, downloaded the SuccessStory plugin data, and refreshed individually and nothing worked.

@Whitechapel-1888 Did you add the API key to SuccessStory settings (they are separate from the Steam integrations settings)? To add the API key for SuccessStory, navigate to Main Menu > Add-ons... and then Extension settings > Generic > SuccessStory. Click the Libraries tab, expand Steam and enter the API Key there. image

Whitechapel-1888 commented 9 months ago

@damirarh I wasn't aware that there was an extra field to enter the API key, but this indeed works...

So, is there a specific reason why SuccessStory needs this extra field and cannot authenticate via the API key saved in playnite? Also, the fact that this works surprises me. From the code snippet above, I guessed the issue would apply to everyone eventually, regardless of the method of authentification.

DarylGraves commented 8 months ago

I've had a similar situation today. I'm not 100% sure how I fixed it as it takes ages to scan each time I make a change but I think unchecking "Always keep my total playtime private even if users can see my game details." may have been the issue for me.

I did also add the API key in as well but I have tried adding and removing that multiple times today and didn't have luck on it's own.

These are my Steam settings in the end:

image

Whitechapel-1888 commented 8 months ago

Eh, so despite using an API key, my achievement progress from steam games are being removed when the extension updates (so after playing and when manually updating).

Edit: actually, nevermind that. I generated a new API key and forgot to update the success story plugin...

Lacro59 commented 3 months ago

Can you try this? https://github.com/Lacro59/playnite-successstory-plugin/issues/479#issuecomment-2191342743