現(xiàn)在房主玩家A,其他角色玩家B,要把房主A轉(zhuǎn)給B,保留A的角色信息。
思路:把存檔從玩家A拷貝到玩家B,玩家B登錄游戲,此時使用的是房主的身份,讓原房主A加入游戲,創(chuàng)建新的身份信息C。
然后把房主A的身份信息轉(zhuǎn)變成C,把玩家B轉(zhuǎn)變成房主。
使用工具:https://github.com/deafdudecomputers/PalWorldSaveTools
第一步下載源碼,安裝依賴。
找到存檔文件,C:\Users\Administrator\AppData\Local\Pal\Saved\SaveGames{你的steamid}{存檔}
然后獲取玩家B的GUID,執(zhí)行下面腳本,替換save_path為你的存檔路徑,執(zhí)行腳本,會打印出玩家名稱和GUID
# This Python file uses the following encoding: utf-8
import argparse, json, os
from fix_save import *
def find_guid_info(level_json, guid):
guid_formatted = '{}-{}-{}-{}-{}'.format(guid[:8], guid[8:12], guid[12:16], guid[16:20], guid[20:]).lower()
print('guid_formatted=====================',guid_formatted)
character_save_parameter_map = level_json['properties']['worldSaveData']['value']['CharacterSaveParameterMap']['value']
for i in range(len(character_save_parameter_map)):
candidate_guid_formatted = character_save_parameter_map[i]['key']['PlayerUId']['value']
save_parameter = character_save_parameter_map[i]['value']['RawData']['value']['object']['SaveParameter']['value']
if guid_formatted == candidate_guid_formatted and 'IsPlayer' in save_parameter and save_parameter['IsPlayer']['value'] == True:
nickName = save_parameter['NickName']['value'] + ' (Lvl. ' + (str(save_parameter['Level']['value']) if 'Level' in save_parameter else '0') + ')'
print('nickName=====',nickName,guid_formatted)
return nickName
return ''
def sav_to_json(filepath):
print(f"Converting {filepath} to JSON")
print("Decompressing sav file")
with open(filepath, "rb") as f:
data = f.read()
raw_gvas, _ = decompress_sav_to_gvas(data)
print("Loading GVAS file")
#gvas_file = GvasFile.read(raw_gvas, PALWORLD_TYPE_HINTS, PALWORLD_CUSTOM_PROPERTIES)
gvas_file = ProgressGvasFile.read(raw_gvas, PALWORLD_TYPE_HINTS, SKP_PALWORLD_CUSTOM_PROPERTIES)
json_data = gvas_file.dump()
return json_data
def json_to_sav(json_data, output_filepath):
print(f"Converting data to SAV, saving to {output_filepath}")
gvas_file = GvasFile.load(json_data)
print("Compressing SAV file")
if (
"Pal.PalWorldSaveGame" in gvas_file.header.save_game_class_name
or "Pal.PalLocalWorldSaveGame" in gvas_file.header.save_game_class_name
):
save_type = 0x32
else:
save_type = 0x31
#sav_file = compress_gvas_to_sav(gvas_file.write(PALWORLD_CUSTOM_PROPERTIES), save_type)
sav_file = compress_gvas_to_sav(gvas_file.write(SKP_PALWORLD_CUSTOM_PROPERTIES), save_type)
print(f"Writing SAV file to {output_filepath}")
with open(output_filepath, "wb") as f:
f.write(sav_file)
if __name__ == "__main__":
save_path="C:/Users/Administrator/source/PalWorldSaveTools-main/LocalWorldSave"
players_folder = os.path.join(save_path, 'Players')
if os.path.exists(players_folder) and os.path.isdir(players_folder):
# List all files and remove the '.sav' extension.
file_names = [
os.path.splitext(f)[0]
for f in os.listdir(players_folder)
if os.path.isfile(os.path.join(players_folder, f)) and f.endswith('.sav')
]
level_sav_path = os.path.join(save_path,'Level.sav')
level_json = sav_to_json(level_sav_path)
usernames = [
find_guid_info(level_json, guid)
for guid in file_names
]
new_guid="7FACBEA1000000000000000000000000"
old_guid="00000000000000000000000000000001"
new_guid_formatted = '{}-{}-{}-{}-{}'.format(new_guid[:8], new_guid[8:12], new_guid[12:16], new_guid[16:20], new_guid[20:]).lower()
old_guid_formatted = '{}-{}-{}-{}-{}'.format(old_guid[:8], old_guid[8:12], old_guid[12:16], old_guid[16:20], old_guid[20:]).lower()
print('new_guid_formatted==========',new_guid_formatted)
print('old_guid_formatted==========',old_guid_formatted)
old_sav_path = os.path.join(save_path, 'Players', old_guid + '.sav')
new_sav_path = os.path.join(save_path, 'Players', new_guid + '.sav')
if not os.path.exists(save_path):
print(f'ERROR: Your given <save_path> "{save_path}" does not exist.')
exit(1)
if not os.path.exists(new_sav_path):
print(f'ERROR: Your player save "{new_sav_path}" does not exist. Did the player create a character?')
exit(1)
print('WARNING: Running this script WILL change your save files... Backup recommended.')
old_json = sav_to_json(old_sav_path)
print('Modifying JSON save data...')
old_PlayerUId = old_json['properties']['SaveData']['value']['PlayerUId']['value']
print('old_PlayerUId=====',old_PlayerUId)
old_json['properties']['SaveData']['value']['PlayerUId']['value'] = new_guid_formatted
old_instance_id = old_json['properties']['SaveData']['value']['IndividualId']['value']['InstanceId']['value']
print('old_instance_id================',old_instance_id)
print('Fix has been applied! Have fun!')
房主A的GUID是00000000-0000-0000-0000-000000000001
玩家B的GUID是419b2e2f-0000-0000-0000-000000000000
房主A加入B的房間新的身份信息是7FACBEA1000000000000000000000000
將存檔信息拷貝到PalWorldSaveTools-main\LocalWorldSave中
備份00000000-0000-0000-0000-000000000001
第一步:將房主A變成新身份C
執(zhí)行fix_host_save.cmd,新GUID:7FACBEA1000000000000000000000000 舊GUDI:00000000-0000-0000-0000-000000000001
確認(rèn)等待完成,執(zhí)行成功后會刪除舊的GUID.sav
第二步:將房主變成玩家B
將00000000-0000-0000-0000-000000000001.sav備份恢復(fù),執(zhí)行時需要有文件存在否則執(zhí)行失敗.
執(zhí)行fix_host_save.cmd,新GUID:00000000-0000-0000-0000-000000000001 舊GUDI:419b2e2f-0000-0000-0000-000000000000
確認(rèn)等待完成
將修改后的存檔信息替換到原存檔。
新房主B登錄游戲,原房主A加入游戲。身份信息已經(jīng)變了