## 现象
用户使用存档上传功能在导入完整的Saved文件夹后,仍然只有地图信息,没有人物信息,需要恢复以前的用户存档。
这种情况可能在这些场景中出现:
- 腾讯云的存档转阿里云
- 已有ECS转计算巢,地图在人物角色丢失
## 具体解决方案
### 前提
1. 执行该修复方案的前提是必须已经有可用的存档备份。
2. 所有人退出游戏。
### Linux
#### 备份、获取steamappid信息
1. 远程登录服务器
1. 进去计算巢的服务实例页面:[https://computenest.console.aliyun.com/service/instance/cn-hangzhou](https://computenest.console.aliyun.com/service/instance/cn-hangzhou),然后点击具体的服务实例。
2. 点击资源,然后再点击远程连接,弹出页面点击免密登录
3. 选择会话管理后点击确定
2. 先关闭幻兽帕鲁服务端服务
```
# 关闭服务
sudo systemctl stop pal-server
```
3. 备份游戏存档,执行下面命令后将会在/home/ecs-assist-user/.steam/SteamApps/common/PalServer/Pal/Saved_Backup文件夹中创建一个备份的存档文件,如下所示。
```
sudo apt install zip unzip
# 定义存档路径和备份路径
destinationDir="/home/ecs-assist-user/.steam/SteamApps/common/PalServer/Pal/Saved"
desParentDir="/home/ecs-assist-user/.steam/SteamApps/common/PalServer/Pal"
backupDir="/home/ecs-assist-user/.steam/SteamApps/common/PalServer/Pal/Saved_Backup"
# 生成备份文件的名称,包含日期以便于区分不同的备份
timestamp=$(date +"%Y%m%d%H%M%S")
backupFileName="Saved_Backup_${timestamp}.zip"
# 创建备份目录,如果不存在的话
mkdir -p "$backupDir"
# 打包指定目录到ZIP文件
zip -r "$backupDir/$backupFileName" "$destinationDir"
```
4. 查看steam appId。计算巢部署的Linux路径下可查看此文件Steam appid
```
cat /home/ecs-assist-user/.steam/SteamApps/common/PalServer/Pal/Binaries/Linux/steam_appid.txt
```
5. 如果显示的是0,则执行下面命令。
```
sudo cp /home/ecs-assist-user/.steam/SteamApps/common/PalServer/Pal/Binaries/Linux/steam_appid.txt /home/ecs-assist-user/.steam/SteamApps/common/PalServer/Pal/Binaries/Linux/steam_appid.txt.bak
sudo echo 2394010 | sudo tee /home/ecs-assist-user/.steam/SteamApps/common/PalServer/Pal/Binaries/Linux/steam_appid.txt
sudo chattr +i /home/ecs-assist-user/.steam/SteamApps/common/PalServer/Pal/Binaries/Linux/steam_appid.txt
```
6. 如果显示的是2394010,则执行下面命令。
```
sudo cp /home/ecs-assist-user/.steam/SteamApps/common/PalServer/Pal/Binaries/Linux/steam_appid.txt /home/ecs-assist-user/.steam/SteamApps/common/PalServer/Pal/Binaries/Linux/steam_appid.txt.bak
sudo echo 0 | sudo tee /home/ecs-assist-user/.steam/SteamApps/common/PalServer/Pal/Binaries/Linux/steam_appid.txt
sudo chattr +i /home/ecs-assist-user/.steam/SteamApps/common/PalServer/Pal/Binaries/Linux/steam_appid.txt
```
7. 将备份的.zip压缩包解压后替换当前Saved文件。
如果你的计算巢帕鲁服务版本支持 **游戏运维-上传存档,则直接上传你本地的存档即可完成替换。**
如果你的计算巢版本不支持上传存档自动替换,则参考存档[手动替换教程实现存档替换](https://developer.aliyun.com/article/1428619),替换后重启
8. 执行重启命令。
```
sudo systemctl start pal-server
```
### Windows
#### 登录到ECS并备份当前存档
1. 在[计算巢](https://computenest.console.aliyun.com)找到你的服务实例,点击资源类型【实例】的云资源进入ECS控制台
2. 在ECS控制台详情页右上角点击远程连接,选择workbench登录
3. 输入密码即可进入
4. 打开powershell。输入该命令完成备份
```
# 定义存档路径和备份路径
$destinationDir = "C:\Program Files\PalServer\steam\steamapps\common\PalServer\Pal\Saved"
$savedParentDir = "C:\Program Files\PalServer\steam\steamapps\common\PalServer\Pal"
# 定义备份目录,确保它不在源目录的子目录中
$backupDir = "C:\Program Files\PalServer\steam\steamapps\common\PalServer\Pal\Saved_Backup"
# 生成备份文件的名称,包含日期以便于区分不同的备份
$timestamp = Get-Date -Format "yyyyMMddHHmmss"
$backupFileName = "Saved_Backup_$timestamp.zip"
# 创建备份目录,如果不存在的话
if (-not (Test-Path -Path $backupDir)) {
New-Item -ItemType Directory -Path $backupDir
}
# 打包指定目录到ZIP文件
Compress-Archive -Path $destinationDir -DestinationPath "$backupDir\$backupFileName"
# 输出备份完成的信息
Write-Host "Backup completed: $backupDir\$backupFileName"
# 停止 pal-server 服务以准备更新存档
$ProcessName = "PalServer-Win64-Test-Cmd"
if (Get-Process -Name $ProcessName -ErrorAction SilentlyContinue) {
Stop-Process -Name $ProcessName -Force
Start-Sleep -Seconds 1
}
```
#### 获取当前的steamappid
计算巢部署的Windows路径下可查看此文件获取Steam appid.windows下可直接搜搜steam_appid.txt该文件,如不存在代表steamappid=0.
```
C:\Program Files\PalServer\steam\steamapps\common\PalServer\Pal\Binaries\Win64\steam_appid.txt
```
#### 根据steamappid的值决定操作
如果当前steam appid=2394010或1623730,下面的执行采用默认情况即可。
1. 路径切换到
```
C:\Program Files\PalServer\steam\steamapps\common\PalServer\Pal\Binaries\Win64
```
2. 打开steam_appid.txt文件,输入0并保存。(steam appid=2394010或1623730)
如果steam appid=0或文件不存在,则新建steam_appid.txt文件,输入2394010并保存
3. 右键打开该文件属性,设置为只读。
4. 打开Powershell,输入该指令
```
$TaskName = "PalServerAutoStart"
Start-ScheduledTask -TaskName $TaskName
```
#### 将之前备份的存档覆盖当前存档
如果你的计算巢版本支持 **游戏运维-上传存档,则直接上传你本地的存档即可完成替换。**
如果你的计算巢版本不支持上传存档自动替换,则参考存档[手动替换教程实现存档替换](https://developer.aliyun.com/article/1428619),替换后重启