pokerogue读取存档数据失败解决办法

网页版玩起来网络不给力,就导出存档把数据导入到本地离线版畅玩,结果在本地导出存档同步数据到网页版时,本地版导出的数据格式有问题,导致网页版存档毁坏,检查网页存档发现system的dexData和starterData数据直接没了,幸好网页导出的存档文件在回收站没删,感觉恢复出来把存档解析为json格式,将原来存档里的dexData和starterData数据修改到最新存档里,重新上传新存档解决。

恢复存档的前提需要有存档文件,才能执行以下步骤
.prsv存档文件转json
`

import execjs

secret_key = 'x0i2O7WRiANTqPmZ'
node = execjs.get()

encrypt_rst = "这里输入存档数据"
decrypt_rst = ctx.call('decrypt', encrypt_rst, secret_key)
print(decrypt_rst)

`

上传存档
`

from curl_cffi import requests

clientSessionId = "xxxxxx"
Authorization = "xxxxxx="
slot = 1

headers = {
  'Host': 'api.pokerogue.net',
  'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:125.0) Gecko/20100101 Firefox/125.0',
  'Accept': '*/*',
  'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
  'Accept-Encoding': 'gzip, deflate, br',
  'Referer': 'https://pokerogue.net/',
  'Authorization': self.Authorization,
  'Origin': 'https://pokerogue.net',
  'Connection': 'keep-alive'
}
url = f"https://api.pokerogue.net/savedata/system/get?clientSessionId={clientSessionId}"
resp = requests.get(url=url, headers=headers)
sysdata = resp.json()
url = f"https://api.pokerogue.net/savedata/session/get?slot={slot}&clientSessionId={clientSessionId}"
resp = requests.get(url=url, headers=headers)
session = resp.json()

decrypt_rst["dexData"] = sysdata["dexData"]
decrypt_rst["starterData"] = sysdata["starterData"]

url = "https://api.pokerogue.net/savedata/updateall"
headers = {
    'Host': 'api.pokerogue.net',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:125.0) Gecko/20100101 Firefox/125.0',
    'Accept': 'application/json',
    'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
    'Accept-Encoding': 'gzip, deflate, br',
    'Referer': 'https://pokerogue.net/',
    'Content-Type': 'application/json',
    'Authorization': self.Authorization,
    'Origin': 'https://pokerogue.net',
    'Connection': 'keep-alive'
}
data = {"system": sysdata , "session": session, "sessionSlotId": sessionSlotId, "clientSessionId": clientSessionId}
resp = requests.post(url=url, headers=headers, json=data)
print(resp.text)

`

执行完上面代码存档应该就恢复好了,又可以正常玩耍咯。

posted @ 2024-06-28 19:29  Naihe\  阅读(779)  评论(0编辑  收藏  举报
// 音乐播放器