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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file es3-modifier-0.1.0.tar.gz.

File metadata

  • Download URL: es3-modifier-0.1.0.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for es3-modifier-0.1.0.tar.gz
Algorithm Hash digest
SHA256 18cb3031f3fab19fab6bdd519c915a7f653a57f8dc1de11253de2069484970c8
MD5 bf9a2ee10cca98ba4f3667fae03ba90e
BLAKE2b-256 179d7c648d2852e220a36cbd51ab06e9cf750ff08b394749c18066e63ba1b7b9

See more details on using hashes here.

File details

Details for the file es3_modifier-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: es3_modifier-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for es3_modifier-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 838843c4391e3b68cd66be34a8b9d2e203ba12cdc6776a587a3c0be1979b5d0d
MD5 cb1558b6c65570cd94d6a126cf41cb36
BLAKE2b-256 635a2f587453f89efa36301032dab5492245982e4961a54a2ca54c4740c8be16

See more details on using hashes here.

Supported by

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