magicbear / palworld-server-toolkit

PalWorld Server Toolkits - For Save file modify, list the players, repair sav file, etc...
MIT License
513 stars 61 forks source link

BatchDeleteUnreferencedItemContainers() command not work to my save data #78

Closed guirijoa closed 4 months ago

guirijoa commented 4 months ago

Hi. I'm playing with my friends palworld about a month. and my friends started playing less and less games. so there are bunch of bases everywhere you can see. since yesterday, server started turn off itself everytime. I saw the crash report and searching it. people said use this toolkit. so I used it and bases are completely removed but crash didn't stop at all. and I found the information about my problem that if level.sav file size over 50MB can cause crash. they said try to delete Unreferenced Items. I tried it. but there are some issue.. plz help.

sorry for bad english.

level.sav - https://drive.google.com/file/d/1Y9ACD6uq7UJolGyGI7EdyV87DZyrRP4o

PS D:\SteamLibrary\steamapps\common\PalServer\Pal\Saved\SaveGames\0\192BCE0E407944713C265CB9D33D9549> python -i -m palworld_server_toolkit.editor -o Level.sav Level.sav Loading Level.sav...Done in 3.10s. Parsing Level.sav...Done in 2.84s. Guild 택진 길드 Admin e66e1e18-0000-0000-0000-000000000000 Group ID 5c777577-4752-d829-ea87-9586dfbb6692 Base Camp Level: 20 Character Count: 1186 Base ID f9f2e8d4-46e6-e3e0-74d2-7a9d2199da9c -> 新規生成拠点テンプレート名26(仮) -269981, 123154, 4759 Map ID 39402b36-45a7-defc-519b-50bc0d8d5a69 Base ID 6f15f7ee-4da5-5014-0da3-499c94717e35 -> 新規生成拠点テンプレート名26(仮) -150093, 81816, -1705 Map ID 32b8ab75-478c-03ca-54a0-2b8abea513c5 Base ID 07a2fec8-4a11-3385-5b02-8a9cba7e609e -> 新規生成拠点テンプレート名23(仮) -162449, 159135, 8099 Map ID 1a81f653-40cd-275d-7e23-a38e9a413ab4

Player  농사꾼이여유                                [e66e1e18-0000-0000-0000-000000000000] Last Online: 2024-02-18 20:16:55 -  2 d 4 h 11 m 47 s
Player  G.BISA                              [2d681aa8-0000-0000-0000-000000000000] Last Online: 2024-02-12 23:34:38 -  8 d 54 m 5 s

Guild 조저씨네 아가들 Admin fcbb1dcb-0000-0000-0000-000000000000 Group ID d2d9c1c0-45b4-83ba-7629-86af98b8009b Base Camp Level: 20 Character Count: 541 Base ID c67c2df6-4553-3780-167b-9093c7b2b480 -> 新規生成拠点テンプレート名12(仮) -304455, 229501, 2849 Map ID 7de32e39-40b4-be6f-73c8-71acb4c8aceb Base ID 66b4013f-49d9-ea5f-385e-40a7141e0546 -> 新規生成拠点テンプレート名26(仮) 103997, 303452, 16843 Map ID c9b39259-46f2-38f4-ef9e-cdbf0a05b217

Player  jojerssi                            [fcbb1dcb-0000-0000-0000-000000000000] Last Online: 2024-02-21 00:28:43 -  0 s

Guild 헤헿 Admin 087c2d86-0000-0000-0000-000000000000 Group ID 79523856-43c4-9e05-f1c2-38a6c8630da2 Base Camp Level: 16 Character Count: 511 Base ID 64db0b03-4daa-f9f1-0065-c3b3f8a3606d -> 新規生成拠点テンプレート名13(仮) -289858, 39731, 13735 Map ID 31db180d-45b2-dd07-c1ee-d5bed1cc12a1 Base ID bd822e10-4dd5-0fea-c9f3-37a9fc444d45 -> 新規生成拠点テンプレート名24(仮) -166003, 86468, -1337 Map ID 94ea414e-403d-b675-414f-eba6555332ca Base ID c41ace94-4ecc-5eb7-b7b8-fabc75ca306d -> 新規生成拠点テンプレート名26(仮) -308315, -112865, 34668 Map ID 87601ff4-4fc4-296d-30f5-e396e072d5a2

Player  릴리                                [087c2d86-0000-0000-0000-000000000000] Last Online: 2024-02-10 13:39:50 -  10 d 10 h 48 m 52 s

Guild 무명 길드 Admin 488d2c98-0000-0000-0000-000000000000 Group ID cf64f103-4c10-2e4a-ca07-b08c0e33bda4 Base Camp Level: 13 Character Count: 395 Base ID eea98905-4ab9-f8f2-6918-1c83ccf90303 -> 新規生成拠点テンプレート名5(仮) -328143, 237449, -110 Map ID 67391e32-4117-e806-ab3c-5e86c1d59e46 Base ID 6b8e0e9f-4914-73f1-d774-43890ac69a04 -> 新規生成拠点テンプレート名12(仮) -280312, 107693, -631 Map ID b29ad217-48df-d9e3-ee21-b18b260fa4ae

Player  루피사냥꾼                                  [488d2c98-0000-0000-0000-000000000000] Last Online: 2024-02-07 20:29:01 -  13 d 3 h 59 m 41 s
Player  김루트                              [2af200f6-0000-0000-0000-000000000000] Last Online: 2024-02-05 21:01:26 -  15 d 3 h 27 m 16 s

Guild 재이월드 Admin b887f766-0000-0000-0000-000000000000 Group ID a3663e39-4868-a3de-0b4b-7e859e19c3cc Base Camp Level: 20 Character Count: 2764 Base ID d6dece0e-4501-01cd-bc9a-76b497279ddf -> 新規生成拠点テンプレート名24(仮) -319618, 172627, -1267 Map ID 0637c7c8-459c-5986-ec87-249b41094a6b Base ID b2c4e4d9-49b2-87f1-ea88-81a73adc4645 -> 新規生成拠点テンプレート名27(仮) -165914, 273030, 3514 Map ID a8de79e4-4e3f-0647-4cb5-05a6f329e7cf

Player  포식자                              [b887f766-0000-0000-0000-000000000000] Last Online: 2024-02-20 23:56:48 -  31 m 54 s
Player  김지우                              [a9682b25-0000-0000-0000-000000000000] Last Online: 2024-02-18 20:20:16 -  2 d 4 h 8 m 27 s
Player  꿀재이                              [eed6d9d5-0000-0000-0000-000000000000] Last Online: 2024-02-20 23:34:50 -  53 m 52 s

Guild 무명 길드 Admin d2451858-0000-0000-0000-000000000000 Group ID ab58fa50-43ac-7755-03aa-6ea3ef0ec576 Base Camp Level: 20 Character Count: 466

Player  bnm7706                             [d2451858-0000-0000-0000-000000000000] Last Online: 2024-02-12 16:06:21 -  8 d 8 h 22 m 21 s

Guild AMARI Admin eb05889e-0000-0000-0000-000000000000 Group ID d154cec9-4398-40ea-f9eb-fc965e2a9535 Base Camp Level: 16 Character Count: 390 Base ID a33296fd-4607-3051-ebe7-ee9dd21fadd7 -> 新規生成拠点テンプレート名25(仮) -454368, -118810, 4488 Map ID 9c4f0656-4a44-9677-39fe-8e8197bf0f30 Base ID 472bed0a-4049-2951-a20a-839e3d4d60a8 -> 新規生成拠点テンプレート名27(仮) -365348, 162207, 4099 Map ID 4b87ee08-4d40-1fc2-01f4-9797c388dae4

Player  amari                               [eb05889e-0000-0000-0000-000000000000] Last Online: 2024-02-20 23:56:48 -  31 m 54 s

Guild 무명 길드 Admin 6ef0f495-0000-0000-0000-000000000000 Group ID 856e4d26-4cc2-9b84-124b-d9b5ee796a30 Base Camp Level: 1 Character Count: 1

Player  bnm7706                             [6ef0f495-0000-0000-0000-000000000000] Last Online: 2024-01-25 13:28:58 -  26 d 10 h 59 m 44 s

Guild 무명 길드 Admin 750de48f-0000-0000-0000-000000000000 Group ID 7398303a-4ac8-57f1-ff97-8b9bc7c04674 Base Camp Level: 13 Character Count: 116

Player  이원곤                              [750de48f-0000-0000-0000-000000000000] Last Online: 2024-02-02 18:00:57 -  18 d 6 h 27 m 45 s

Guild 4샷건살인마 Admin 30c3e3e3-0000-0000-0000-000000000000 Group ID 32027dae-4a14-65ea-c61a-939f360de43b Base Camp Level: 15 Character Count: 400 Base ID 174d49af-4805-1d6a-15ab-818a2336c840 -> 新規生成拠点テンプレート名25(仮) -451948, 96846, 3374 Map ID cba25891-4dbd-69f5-7a98-c89510779fc6 Base ID 386a43e3-4881-b813-50a9-b2a2139616fa -> 新規生成拠点テンプレート名25(仮) -447004, 69636, 2339 Map ID 450f5b12-4812-e790-ebad-47a5fc28f566 Base ID aa8c440d-4662-f100-ea09-ad8fbcc150a4 -> 新規生成拠点テンプレート名22(仮) -201023, 141611, 8200 Map ID 99ae5b91-4de9-82ef-57e7-e8bd7cc45244

Player  학시                                [30c3e3e3-0000-0000-0000-000000000000] Last Online: 2024-02-20 21:49:26 -  2 h 39 m 17 s

Guild 여우 Admin 4d700e00-0000-0000-0000-000000000000 Group ID 09e91e2e-4e79-25f6-ac5f-78946fc38769 Base Camp Level: 16 Character Count: 871 Base ID 5b134ce0-44e0-b4cf-492d-f8a6a23a9d01 -> 新規生成拠点テンプレート名18(仮) -143572, 242859, 14188 Map ID fb70f960-40fc-d00b-b805-ccaff5138345

Player  GGoMaengEE                          [4d700e00-0000-0000-0000-000000000000] Last Online: 2024-02-09 17:31:36 -  11 d 6 h 57 m 6 s
Player  응애아기지우                                [69388ce8-0000-0000-0000-000000000000] Last Online: 2024-02-01 00:19:51 -  20 d 8 m 51 s

Guild 무명 길드 Admin ac49236a-0000-0000-0000-000000000000 Group ID 5d663fdb-4f27-e407-8173-49a2cf03c955 Base Camp Level: 12 Character Count: 116

Player  주우옥                              [ac49236a-0000-0000-0000-000000000000] Last Online: 2024-02-15 01:25:13 -  5 d 23 h 3 m 29 s

Guild 무명 길드 Admin a2cd318c-0000-0000-0000-000000000000 Group ID 458c3974-48cd-f610-61c3-0590ea43594a Base Camp Level: 1 Character Count: 1

Player  oyeon                               [a2cd318c-0000-0000-0000-000000000000] Last Online: 2024-01-28 08:06:01 -  23 d 16 h 22 m 41 s

Guild 무명 길드 Admin ede55bf7-0000-0000-0000-000000000000 Group ID f540229e-4bea-5be1-8c1a-cbaab4c4c19e Base Camp Level: 1 Character Count: 7

Player  하이룽                              [ede55bf7-0000-0000-0000-000000000000] Last Online: 2024-01-28 09:28:21 -  23 d 15 h 21 s

PlayerUId e66e1e18-0000-0000-0000-000000000000 [InstanceID 8f118cc0-4ad0-3acb-0c00-f28bbc8bec64 ] -> Level 50 농사꾼이여유 PlayerUId 2af200f6-0000-0000-0000-000000000000 [InstanceID 90f5d43a-4391-5002-3a0d-41a65cafd0fd ] -> Level 18 김루트PlayerUId fcbb1dcb-0000-0000-0000-000000000000 [InstanceID 17d882d2-476c-a5fa-6e2a-ec93ecef4379 ] -> Level 50 jojerssi PlayerUId 087c2d86-0000-0000-0000-000000000000 [InstanceID 21a3be3b-499f-2a96-31a4-03bf9231c053 ] -> Level 41 릴리 PlayerUId 488d2c98-0000-0000-0000-000000000000 [InstanceID 09008235-4921-f3c1-e263-c888fdac7098 ] -> Level 26 루피사냥꾼 PlayerUId b887f766-0000-0000-0000-000000000000 [InstanceID 2d8f614b-40ba-d786-cf74-e7aaff6600fe ] -> Level 49 포식자PlayerUId d2451858-0000-0000-0000-000000000000 [InstanceID d23e33fd-4fcc-93ee-5e1e-7d86c8e2bf59 ] -> Level 47 bnm7706 PlayerUId eb05889e-0000-0000-0000-000000000000 [InstanceID 19b13331-4d9e-06c6-d4de-c6ab3485c63d ] -> Level 50 amari PlayerUId 6ef0f495-0000-0000-0000-000000000000 [InstanceID c2eff529-49cc-2669-92ac-6e83fe6dd36d ] -> Level 2 bnm7706 PlayerUId 750de48f-0000-0000-0000-000000000000 [InstanceID 98736889-409b-761a-9d48-dc9f9b442b31 ] -> Level 25 이원곤PlayerUId a9682b25-0000-0000-0000-000000000000 [InstanceID 0e388fc4-42fe-189e-8116-40bd6c2124e4 ] -> Level 16 김지우PlayerUId 69388ce8-0000-0000-0000-000000000000 [InstanceID 6477e038-4d0c-f0c5-29d9-2c827975cf31 ] -> Level 29 응애아기지우 PlayerUId ac49236a-0000-0000-0000-000000000000 [InstanceID c2afc40f-408a-4583-ebe8-82b0a76dfc56 ] -> Level 20 주우옥PlayerUId 30c3e3e3-0000-0000-0000-000000000000 [InstanceID 1d51d03e-435e-8561-bb29-d5bb3610bcba ] -> Level 50 학시 PlayerUId 4d700e00-0000-0000-0000-000000000000 [InstanceID a7514ff0-4d4d-f026-b958-d484e8f883f2 ] -> Level 37 GGoMaengEE PlayerUId 2d681aa8-0000-0000-0000-000000000000 [InstanceID 6f3efec7-4ce0-2a81-9311-12bd4eeab3b9 ] -> Level 35 G.BISAPlayerUId ede55bf7-0000-0000-0000-000000000000 [InstanceID 01b28feb-4dbf-6b4d-1a0a-da8b2556c704 ] -> Level 5 하이룽PlayerUId a2cd318c-0000-0000-0000-000000000000 [InstanceID 8cc51440-4793-69a5-941a-e0b3e98ac518 ] -> Level 2 oyeon PlayerUId eed6d9d5-0000-0000-0000-000000000000 [InstanceID cbd66df0-4257-00ca-1275-2e90e0dac54c ] -> Level 43 꿀재이INFO: Total load in 7805.277ms Go To Interactive Mode (no auto save), we have follow command: ShowPlayers() - List the Players FixDuplicateUser(dry_run=False) - Remove duplicate player instance ShowGuild() - List the Guild and members BindGuildInstanceId(uid,instance_id) - Update Guild binding instance for user RenamePlayer(uid,new_name) - Rename player to new_name DeletePlayer(uid,InstanceId=None, dry_run=False) - Wipe player data from save InstanceId: delete specified InstanceId dry_run: only show how to delete DeleteGuild(gid) - Delete Guild DeleteBaseCamp(base_id) - Delete Guild Base Camp EditPlayer(uid) - Allocate player base meta data to variable 'player' OpenBackup(filename) - Open Backup Level.sav file and assign to backup_wsd MigratePlayer(old_uid,new_uid) - Migrate the player from old PlayerUId to new PlayerUId Note: the PlayerUId is use in the Sav file, when use to fix broken save, you can rename the old player save to another UID and put in old_uid field. CopyPlayer(old_uid,new_uid, backup_wsd) - Copy the player from old PlayerUId to new PlayerUId CopyBaseCamp(base_id,new_group_id, backup_wsd)

Advance feature: search_key(wsd, '') - Locate the key in the structure search_values(wsd, '') - Locate the value in the structure PrettyPrint(value) - Use XML format to show the value

BatchDeleteUnreferencedItemContainers() Parsing .worldSaveData.MapObjectSaveData...Done in 9.34s Parse skipped data in 9.34s Parsing .worldSaveData.DynamicItemSaveData...Done in 0.11s Parsing .worldSaveData.ItemContainerSaveData...Traceback (most recent call last): File "", line 1, in File "C:\Users\JO\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\palworld_server_toolkit\editor.py", line 4078, in BatchDeleteUnreferencedItemContainers unreferencedContainerIds = FindAllUnreferencedItemContainerIds() File "C:\Users\JO\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\palworld_server_toolkit\editor.py", line 4028, in FindAllUnreferencedItemContainerIds referencedContainerIds = set(FindReferenceItemContainerIds()) File "C:\Users\JO\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\palworld_server_toolkit\editor.py", line 3747, in FindReferenceItemContainerIds for uuid in MappingCache.ItemContainerSaveData: File "C:\Users\JO\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\palworld_server_toolkit\editor.py", line 151, in getattr self.LoadItemContainerMaps() File "C:\Users\JO\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\palworld_server_toolkit\editor.py", line 210, in LoadItemContainerMaps load_skipped_decode(self._worldSaveData, ['ItemContainerSaveData', 'DynamicItemSaveData'], False) File "C:\Users\JO\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\palworld_server_toolkit\editor.py", line 416, in load_skipped_decode parse_skiped_item(properties, skip_path, True, recursive, File "C:\Users\JO\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\palworld_server_toolkit\editor.py", line 379, in parse_skiped_item mp[f".worldSaveData.{skip_path}"] = reader.load_mp_map(properties, f".worldSaveData.{skip_path}", File "C:\Users\JO\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\palworld_server_toolkit\palobject.py", line 879, in load_mp_map share_mp = MPMapProperty(data=data, count=count) File "C:\Users\JO\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\palworld_server_toolkit\palobject.py", line 537, in init ctypes.memmove(self.memaddr + self.prop.size - self.prop.datasize, data, self.prop.datasize) OSError: exception: access violation writing 0x000002359BFFFFF0

magicbear commented 4 months ago

run the python script with -r argument in the end

guirijoa commented 4 months ago

it works! thank you so much!!

what dose meaning of -r argument ??

magicbear commented 4 months ago

prevent to use multi process feature