Skip to content

Commit

Permalink
0.8.3
Browse files Browse the repository at this point in the history
-------

Fix:

- i18n bug for Pal Name

Feature:

- MigrateBaseCamp - premium feature
- MigrateBaseCampBuilder - premium feature
  • Loading branch information
magicbear committed Feb 23, 2024
1 parent f2b4a3f commit 566bc96
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 10 deletions.
4 changes: 3 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
graft palworld_server_toolkit/pal_edit/palworld_pal_edit/resources
prune palworld_server_toolkit/resources/items
prune palworld_server_toolkit/resources/pal_category
prune palworld_server_toolkit/resources/pal_inventory
prune palworld_server_toolkit/resources/pal_inventory
exclude palworld_server_toolkit/premium.py
exclude CxFreezeCompile.py
45 changes: 40 additions & 5 deletions palworld_server_toolkit/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,7 @@ def delete_player(self):
messagebox.showerror("Delete Error", "\n".join(traceback.format_exception(e)))

def status(self, status, ext_msg=""):
self.lbl_status.config(text=self.lang_data['status_' + status]+ext_msg)
self.lbl_status.config(text=self.lang_data['status_' + status] + ext_msg)
self.gui.update()

def move_guild(self):
Expand Down Expand Up @@ -2077,7 +2077,6 @@ def migrate_base(self):
messagebox.showerror("Migrate", "Failed to migrate\n" + "\n".join(traceback.format_exception(e)))
self.status('done')


def migrate_builder(self):
try:
target_base = toUUID(self.target_base.get().split(" - ")[0])
Expand Down Expand Up @@ -2420,8 +2419,8 @@ def build_gui(self):

if 'MigrateBaseCampBuilder' in globals().keys():
self.i18n['migrate_builder'] = g_merge_base = ttk.Button(master=f_target_guildbase, text="Migrate Builder",
style="custom.TButton",
command=self.migrate_builder)
style="custom.TButton",
command=self.migrate_builder)
g_merge_base.pack(side="left")

self.i18n['adjust_base_worker'] = adjust_base_worker = ttk.Button(master=f_target_guildbase,
Expand Down Expand Up @@ -2953,6 +2952,7 @@ def CopyPlayer(player_uid, new_player_uid, old_wsd, dry_run=False):
f.write(sav_file)
RepairPlayer(new_player_uid)


def MoveToGuild(player_uid, group_id):
player_uid = toUUID(player_uid)
group_id = toUUID(group_id)
Expand Down Expand Up @@ -3539,7 +3539,8 @@ def MigrateAllToNoSteam(dry_run=False):
migrate_sets = []
skip_player_id = []
for player_uid in MappingCache.PlayerIdMapping:
new_uuid = toUUID(PlayerUid2NoSteam(int.from_bytes(player_uid.raw_bytes[0:4], byteorder='little')) + "-0000-0000-0000-000000000000")
new_uuid = toUUID(PlayerUid2NoSteam(
int.from_bytes(player_uid.raw_bytes[0:4], byteorder='little')) + "-0000-0000-0000-000000000000")
migrate_sets.append((player_uid, new_uuid))
if new_uuid in MappingCache.PlayerIdMapping:
skip_player_id.append(new_uuid)
Expand All @@ -3551,6 +3552,7 @@ def MigrateAllToNoSteam(dry_run=False):
if src_uuid not in skip_player_id:
MigratePlayer(src_uuid, new_uuid)


def MigrateBuilding(player_uid, new_player_uid):
player_uid = toUUID(player_uid)
new_player_uid = toUUID(new_player_uid)
Expand Down Expand Up @@ -4291,6 +4293,30 @@ def FindDamageRefContainer(dry_run=False):
f"MapObject {tcl(33)}{map_id}{tcl(0)} -> Repair Work {tcl(33)}{repair_work_id}{tcl(0)} invalid {map_object_debug_msg}")
InvalidObjects['MapObject'].add(map_id)

connector = mapObject['Model']['value']['Connector']['value']['RawData']
reference_ids = []
if 'value' in connector:
# Parent of this object
if 'connect' in connector['value']:
if 'any_place' in connector['value']['connect']:
for connection_item in connector['value']['connect']['any_place']:
if connection_item["connect_to_model_instance_id"] not in MappingCache.MapObjectSaveData:
connect_instance_id = connection_item["connect_to_model_instance_id"]
log.info(
f"MapObject {tcl(33)}{map_id}{tcl(0)} -> any_place Connector "
f"{tcl(33)}{connect_instance_id}{tcl(0)} invalid {map_object_debug_msg}")
InvalidObjects['MapObject'].add(map_id)

if 'other_connectors' in connector['value']:
for other_connection_list in connector['value']['other_connectors']:
for connection_item in other_connection_list['connect']:
if connection_item["connect_to_model_instance_id"] not in MappingCache.MapObjectSaveData:
connect_instance_id = connection_item["connect_to_model_instance_id"]
log.info(
f"MapObject {tcl(33)}{map_id}{tcl(0)} -> other_connectors Connector "
f"{tcl(33)}{connect_instance_id}{tcl(0)} invalid {map_object_debug_msg}")
InvalidObjects['MapObject'].add(map_id)

for spawn_id in MappingCache.MapObjectSpawnerInStageSaveData:
spawn_obj = MappingCache.MapObjectSpawnerInStageSaveData[spawn_id]
for spawn_item in spawn_obj['value']['ItemMap']['value']:
Expand Down Expand Up @@ -4527,6 +4553,14 @@ def DeleteItemContainer(itemContainerId, isBatch=False):
MappingCache.LoadItemContainerMaps()


def LoadMapByRange(x, y):
for map_id in MappingCache.MapObjectSaveData:
mapObject = parse_item(MappingCache.MapObjectSaveData[map_id], "MapObjectSaveData.MapObjectSaveData")
vector = mapObject['WorldLocation']['value']
if (x[0] <= vector['x'] / 305 and vector['x'] / 305 <= x[1] and
y[0] <= vector['y'] / 1125 and vector['y'] / 1125 <= y[1]):
gp(mapObject)

def DeletePlayer(player_uid, InstanceId=None, dry_run=False):
load_skipped_decode(wsd, ['ItemContainerSaveData', 'CharacterContainerSaveData', 'MapObjectSaveData',
'MapObjectSpawnerInStageSaveData', 'DynamicItemSaveData'], False)
Expand Down Expand Up @@ -5763,6 +5797,7 @@ def buildDotImage():
else:
sys.stderr.write(cmd.stderr)


if os.path.exists(f"{module_dir}/premium.py"):
exec(code.compile_command(open(f"{module_dir}/premium.py", "r").read(), f"{module_dir}/premium.py", "exec"))

Expand Down
1 change: 0 additions & 1 deletion palworld_server_toolkit/palobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,6 @@ def fstring(self) -> str:
try:
return data.decode(encoding)
except Exception as e:
print(self.raise_error)
if self.raise_error:
raise Exception(
f"Error decoding {encoding} string of length {size}: {bytes(data)!r}"
Expand Down
7 changes: 5 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ classifiers =

[options]
package_dir =
palworld_server_toolkit.PalEdit=palworld_server_toolkit/pal_edit/palworld_pal_edit
palworld_pal_edit=palworld_server_toolkit/pal_edit/palworld_pal_edit
#packages = find:
packages =
palworld_server_toolkit
palworld_server_toolkit.PalEdit
palworld_pal_edit
python_requires = >=3.9
exclude =
CxFreezeCompile.py
palworld_server_toolkit/premium.py

0 comments on commit 566bc96

Please sign in to comment.