zoffline / zwift-offline

Use Zwift offline
GNU Affero General Public License v3.0
768 stars 123 forks source link

How to find achievements.bin and profile.bin files back #308

Closed Irving87 closed 9 months ago

Irving87 commented 9 months ago

Hello, I have been riding with zwift-offline for more than two months, I'm doing the 50,000 climb challenge and have completed over 30,000 climbs. Today I accidentally clicked "Download profile" and "Download achievements" button on the page of "Settings-Zwift credentials", and the achievements.bin& profile.bin file in the /storage/1 changed, And my zwift level became very low, and the climbing challenge progress was gone. So i want to ask how to find achievements.bin and profile.bin files back, or how to manually modify these two files Thanks!

fatsbrown commented 9 months ago

Hello. Unfortunately, if you don't have a backup, I don't think you can restore those files.

profile.bin can be easily modified with a script like this (run from zoffline repo folder)

import protobuf.profile_pb2
profile = protobuf.profile_pb2.PlayerProfile()
profile_file = 'storage/1/profile.bin'
with open(profile_file, 'rb') as f:
    profile.ParseFromString(f.read())
profile.total_xp = 500000
profile.total_distance_in_meters = 50000000
profile.elevation_gain_in_meters = 500000
profile.total_gold_drops = 50000000
with open(profile_file, 'wb') as f:
    f.write(profile.SerializeToString())

Make sure you select the Everest challenge before editing the profile, otherwise the added elevation_gain_in_meters will not count for the challenge.

achievements.bin is a bit more tricky because you need to know the IDs

achievements = protobuf.profile_pb2.Achievements()
achievements.achievements.add().id = 75
achievements.achievements.add().id = 78
achievements.achievements.add().id = 147
with open('storage/1/achievements.bin', 'wb') as f:
    f.write(achievements.SerializeToString())

You can find the IDs in https://cdn.zwift.com/gameassets/GameDictionary.xml

Irving87 commented 9 months ago
t

Wow, this is really detailed, thank you very much. There are a few more questions I would like to ask:

  1. Are the levels and challenges in zwiftoffline unable to be synchronized to zwift online? Because I observed that the level in Companion app is not the same as the level in zwiftoffline;
  2. Is there no left and right balance data of the power meter in the fit file recorded by zwiftoffline? My riding platform has a left and right balance function, but today I synced it to Garmin and I didn’t see the left and right balance data;
  3. How to synchronize the screenshots in zwift to strava after each ride?
fatsbrown commented 9 months ago
  1. No, offline profile is not synced to online server. It's doable (proof of concept in https://github.com/ursoft/zwift-offline/blob/master/storage/profile_sync.py) but it's not implemented in zoffline.
  2. zoffline just uploads the FIT data generated by ZwiftApp, so if it's not on Garmin, most likely it's not in the FIT.
  3. It's not possible due to Strava restriction (details in https://github.com/zoffline/zwift-offline/issues/28).
Irving87 commented 9 months ago
  1. No, offline profile is not synced to online server. It's doable (proof of concept in https://github.com/ursoft/zwift-offline/blob/master/storage/profile_sync.py) but it's not implemented in zoffline.
  2. zoffline just uploads the FIT data generated by ZwiftApp, so if it's not on Garmin, most likely it's not in the FIT.
  3. It's not possible due to Strava restriction (details in Support Zwift screenshots #28).

“It's doable (proof of concept in https://github.com/ursoft/zwift-offline/blob/master/storage/profile_sync.py) but it's not implemented in zoffline.” ---So, if I run this "profile_sync.py" script, offline profile will sync to online server?

fatsbrown commented 9 months ago

I have not tried it myself, but it's supposed to do it.

Irving87 commented 9 months ago

, if I run this "profile_sync.py" script, offline profile will sync

Thanks, This is the best open source repositories I've ever seen

jricoclq commented 7 months ago

Hello. Unfortunately, if you don't have a backup, I don't think you can restore those files.

profile.bin can be easily modified with a script like this (run from zoffline repo folder)

import protobuf.profile_pb2
profile = protobuf.profile_pb2.PlayerProfile()
profile_file = 'storage/1/profile.bin'
with open(profile_file, 'rb') as f:
    profile.ParseFromString(f.read())
profile.total_xp = 500000
profile.total_distance_in_meters = 50000000
profile.elevation_gain_in_meters = 500000
profile.total_gold_drops = 50000000
with open(profile_file, 'wb') as f:
    f.write(profile.SerializeToString())

Make sure you select the Everest challenge before editing the profile, otherwise the added elevation_gain_in_meters will not count for the challenge.

achievements.bin is a bit more tricky because you need to know the IDs

achievements = protobuf.profile_pb2.Achievements()
achievements.achievements.add().id = 75
achievements.achievements.add().id = 78
achievements.achievements.add().id = 147
with open('storage/1/achievements.bin', 'wb') as f:
    f.write(achievements.SerializeToString())

You can find the IDs in https://cdn.zwift.com/gameassets/GameDictionary.xml

May I ask if I have changed my experience as instructed (to level 100, 591000XP), but the score in this area is still the same as the previous level. After cycling for a period of time, the level returns to its original level. How can I modify this area or make it so that it does not revert back to its original level? TKS b4c07927a134c5893b7b8952726fa90

fatsbrown commented 7 months ago

Check the file economy_config.txt in the storage/1 directory, it's customized for the active profile when it was created. You can delete it so that it will be re-created, customized for the current profile, or copy the file from the data directory if you want to use the default scheme regardless of the current profile XP and level.

jricoclq commented 7 months ago

Check the file economy_config.txt in the storage/1 directory, it's customized for the active profile when it was created. You can delete it so that it will be re-created, customized for the current profile, or copy the file from the data directory if you want to use the default scheme regardless of the current profile XP and level.

I tried, but the score displayed above is still the value of the downloaded profile.bin . After riding a course, increasing the level will return to the original level. I found that the score section remains unchanged.Or how to update this score?

fatsbrown commented 7 months ago

What do you mean with "score"?

There's "level" and "XP". You can't set only the level, you need to set also the matching XP.

For example, if you want to set level 70 using the default economy config (level 100 at 591000 XP)

profile.achievement_level = 7000
profile.total_xp = 296000