Skip to content

Commit

Permalink
v0.3.4
Browse files Browse the repository at this point in the history
-------

Major:

- DeleteMapObject will delete item containers now
- Performance Upgrade for Multiple Functions
- Mapping Cache System

Feature:

- BatchDeleteItemContainers

Fix:

- Loading Cache cause Save Failed
- Edit Player if didn't change Array Value, can not save
  • Loading branch information
magicbear committed Feb 7, 2024
1 parent 907ce71 commit 9cc1bfd
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ Feature:

- BatchDeleteItemContainers

Fix:

- Loading Cache cause Save Failed
- Edit Player if didn't change Array Value, can not save

v0.3.3
-------

Expand Down
31 changes: 23 additions & 8 deletions palworld_server_toolkit/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,10 @@ def parse_skiped_item(properties, skip_path, progress=True, recursive=True):
) as reader:
if progress:
skip_loading_progress(reader, len(properties['value'])).start()
properties['value'] = reader.property(properties["skip_type"], len(properties['value']),
".worldSaveData.%s" % skip_path)['value']
decoded_properties = reader.property(properties["skip_type"], len(properties['value']),
".worldSaveData.%s" % skip_path)
for k in decoded_properties:
properties[k] = decoded_properties[k]
del properties['custom_type']
del properties["skip_type"]
return properties
Expand Down Expand Up @@ -591,7 +593,7 @@ def assign_attrib_var(self, var, attrib):
def save(self, attribs, attrib_var, path=""):
for attribute_key in attribs:
attrib = attribs[attribute_key]
if attribute_key not in attrib_var:
if attribute_key not in attrib_var or attrib_var[attribute_key] is None:
continue
if not isinstance(attrib, dict):
continue
Expand Down Expand Up @@ -935,9 +937,9 @@ def __init__(self, player_uid):
'SaveParameter']['value']
self.gui.title("Player Item Edit - %s" % player_uid)
tabs = ttk.Notebook(master=self)
threading.Thread(target=self.load, args=[tabs, player_gvas]).start()
tabs.pack(anchor=tk.constants.N, fill=tk.constants.BOTH, expand=True)
tk.Button(master=self.gui, font=self.font, text="Save", command=self.savedata).pack(fill=tk.constants.X, anchor=tk.constants.S, expand=False)
threading.Thread(target=self.load, args=[tabs, player_gvas]).start()

def load(self, tabs, player_gvas):
if MappingCache.ItemContainerSaveData is None:
Expand All @@ -952,6 +954,7 @@ def load(self, tabs, player_gvas):
item_container = parse_item(
MappingCache.ItemContainerSaveData[player_gvas['inventoryInfo']['value'][idx_key]['value']['ID'][
'value']], "ItemContainerSaveData")
gp(item_container)
self.item_containers[idx_key[:-11]] = [{
'SlotIndex': item['SlotIndex'],
'ItemId': item['ItemId']['value']['StaticId'],
Expand All @@ -969,6 +972,14 @@ def savedata(self):
for idx, item in enumerate(self.item_containers[idx_key]):
self.save(self.item_containers[idx_key][idx], self.item_container_vars[idx_key][idx])
self.destroy()
err, player_gvas, player_sav_file, player_gvas_file = GetPlayerGvas(self.player_uid)
for idx_key in ['CommonContainerId', 'DropSlotContainerId', 'EssentialContainerId', 'FoodEquipContainerId',
'PlayerEquipArmorContainerId', 'WeaponLoadOutContainerId']:
if player_gvas['inventoryInfo']['value'][idx_key]['value']['ID']['value'] in MappingCache.ItemContainerSaveData:
item_container = parse_item(
MappingCache.ItemContainerSaveData[player_gvas['inventoryInfo']['value'][idx_key]['value']['ID'][
'value']], "ItemContainerSaveData")
gp(item_container)


class PlayerSaveEdit(ParamEditor):
Expand Down Expand Up @@ -1333,7 +1344,8 @@ def move_guild(self):
try:
uuid.UUID(target_guild_uuid)
except Exception as e:
messagebox.showerror("Target Guild Error", str(e))
traceback.print_exception(e)
messagebox.showerror("Target Guild Error", "\n".join(traceback.format_exception(e)))
return None

target_guild = None
Expand All @@ -1352,7 +1364,8 @@ def move_guild(self):
self.load_players()
self.load_guilds()
except Exception as e:
messagebox.showerror("Move Guild Error", str(e))
traceback.print_exception(e)
messagebox.showerror("Move Guild Error", "\n".join(traceback.format_exception(e)))

def save(self):
if 'yes' == messagebox.showwarning("Save", "Confirm to save file?", type=messagebox.YESNO):
Expand All @@ -1362,7 +1375,8 @@ def save(self):
print()
sys.exit(0)
except Exception as e:
messagebox.showerror("Save Error", str(e))
traceback.print_exception(e)
messagebox.showerror("Save Error", "\n".join(traceback.format_exception(e)))

def edit_player(self):
target_uuid = self.parse_target_uuid()
Expand Down Expand Up @@ -1431,7 +1445,8 @@ def select_guild(self, evt):
try:
uuid.UUID(target_guild_uuid)
except Exception as e:
messagebox.showerror("Target Guild Error", str(e))
traceback.print_exception(e)
messagebox.showerror("Target Guild Error", "\n".join(traceback.format_exception(e)))
self.target_base['value'] = []
self.target_base.set("ERROR")
return None
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = palworld-server-toolkit
version = 0.3.3
version = 0.3.4
author = MagicBear
author_email = [email protected]
description = A toolset for PalWorld Server
Expand Down

0 comments on commit 9cc1bfd

Please sign in to comment.