Skip to main content

A package to decrypt, edit and encrypt EasySave files used in Unity games

Project description

es3-modifier

es3-modifier is a Python package designed for handling stat files generated by Unity's Easy Save tool. With it, you can seamlessly open, modify, and save new stats. This project was created for use in es3-editor

Installation

To get started, you can easily install the package using pip:

pip install es3-modifier

Usage

Below is a practical demonstration of how to use this package. In this instance, we'll be working with the Phasmophobia game save file, extracting key details, and adjusting specific player stats:

import os, re, json
from es3_modifier import ES3

def format_inventory_name(name):
  """Format the inventory name for better readability."""
  name = re.sub(r'(?<=[a-z])([A-Z])', r' \1', name)
  name = re.sub(r'(?<=[A-Z])([A-Z][a-z])', r' \1', name)
  return name.replace('Inventory', '').rstrip()

# Define the path to the Phasmophobia save file
phasmophobia_path = f'{os.environ["USERPROFILE"]}\\AppData\\LocalLow\\Kinetic Games\\Phasmophobia\\SaveFile.txt'

# Initialize ES3 with the Phasmophobia save data
with open(phasmophobia_path, 'rb') as file:
  es3 = ES3(file.read(), 't36gref9u84y7f43g')

try:
  # Load and decrypt the save data
  decrypted = es3.load()

  # Display player stats
  print(f'Money: ${decrypted["PlayersMoney"]["value"]:,}')
  print(f'Legacy Level: {decrypted["Level"]["value"]}')
  print(f'Level: {decrypted["NewLevel"]["value"]}')
  print(f'Prestige: {decrypted["PrestigeIndex"]["value"]}')

  # Display inventory
  print('\n== Inventory ==')
  for key, value in decrypted.items():
    if 'Inventory' not in key:
      continue
    formatted_name = format_inventory_name(key)
    amount = value['value']
    print(f'{formatted_name}: {amount}')

  # Modify save data values
  decrypted['PlayersMoney']['value'] = 99999
  decrypted['NewLevel']['value'] = 123

  # Save the modified data
  with open('new.txt', 'wb') as out_file:
    out_file.write(es3.save(json.dumps(decrypted)))

except Exception as e:
  print(e)

Remember to always create backups before editing your save files!

Prerequisites

This package uses pycryptodome for AES, it will automatically be installed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

es3-modifier-0.1.0.tar.gz (15.8 kB view hashes)

Uploaded Source

Built Distribution

es3_modifier-0.1.0-py3-none-any.whl (16.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page