Skip to content

Commit

Permalink
Swapped from devRoman to devRealRob, required a python version bump. …
Browse files Browse the repository at this point in the history
…Improved installation instructions and a python version check also set up.
  • Loading branch information
matthewkirby committed May 4, 2024
1 parent f662c0d commit 3e9afb9
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,28 @@ The above functionality requires this external generator to run, but this code a


# Instructions
Requirements: Python 3.7 (or newer)
Requirements: Python 3.9 (or newer)

1. Download the latest [release](https://github.com/matthewkirby/plando-random-settings/releases) and unzip the folder anywhere.
2. Place your Ocarina of Time 1.0 rom in this directory. It must have the `.z64` file extension. If your rom has a different file extension or is a later version of the game, you can use [this tool](https://oot.flagrama.com/) to convert to the required version.
3. Run `RandomSettingsGenerator.py`. This can be done by double-clicking the file or running the script via the command line `python3 RandomSettingsGenerator.py`.
4. After it finishes running, your patch file will be saved in the `patches` directory.


# Advanced Instructions
```console
$ pip install virtualenv
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt install python3.9 && sudo apt install python3.9-distutils
$ virtualenv -p python3.9 venv
$ source venv/bin/activate
$ pip install requests
$ python RandomSettingsGenerator.py
```


# Rolling seeds with Weight Overrides
If you are playing a format besides an official Random Setting League race, you may wish to edit the weights.
If you are playing a format besides an official Random Setting League race, you may wish to edit the weights.

1. Put the weights you wish to change into a JSON file in the weights folder
2. Open `RandomSettingsGenerator.py` in a text editor and add the line `global_override_fname = "<override file name>.json"` where you replace `<override file name>` with the name of your weights file.
Expand Down
3 changes: 2 additions & 1 deletion RandomSettingsGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import argparse

import update_randomizer as ur
ur.check_python()
ur.check_version()

from utils import cleanup
Expand Down Expand Up @@ -46,7 +47,7 @@ def range_limited_int_type(arg):
""" Type function for argparse - a positive int """
try:
i = int(arg)
except ValueError:
except ValueError:
raise argparse.ArgumentTypeError("Must be an integer")
if i < 1:
raise argparse.ArgumentTypeError("Argument must be > 0")
Expand Down
11 changes: 8 additions & 3 deletions rslversion.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
__version__ = "2.5.11"
__version__ = "2.6.0"

randomizer_version = '7.1.181 R-1'
randomizer_commit = '4dbfdae3b8d1242af895569feb06536581dcf2b6'
# Randomizer Info
randomizer_repo = 'rrealmuto/OoT-Randomizer'
randomizer_version = '8.1.29 Rob-101'
randomizer_commit = 'c342eb28bceb1bc4609a955b090a48e6c8632647'

# Requirements
MIN_PY_VERSION = (3, 9)
13 changes: 9 additions & 4 deletions update_randomizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@
import shutil
import subprocess
from utils import cleanup
from rslversion import randomizer_commit, randomizer_version
import rslversion as rslv
try:
import requests
except ModuleNotFoundError:
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'requests'])
import requests


def check_python():
if sys.version_info < rslv.MIN_PY_VERSION:
print(f"Error: Python {rslv.MIN_PY_VERSION[0]}.{rslv.MIN_PY_VERSION[1]} or higher is required to run this script.")
sys.exit(1)

def check_version():
""" Ensure the downloaded version of the randomizer is the correct, if not update """
if os.path.isfile(os.path.join('randomizer', 'version.py')):
from randomizer import version as ootrversion
if ootrversion.__version__ == randomizer_version:
if ootrversion.__version__ == rslv.randomizer_version:
return
print("Updating the randomizer...")
shutil.rmtree('randomizer')
Expand All @@ -36,15 +41,15 @@ def download_randomizer():
cleanup(zippath)

# Download the zipped randomizer
req = requests.get(f'https://github.com/Roman971/OoT-Randomizer/archive/{randomizer_commit}.zip', stream=True)
req = requests.get(f'https://github.com/{rslv.randomizer_repo}/archive/{rslv.randomizer_commit}.zip', stream=True)
with open(zippath, 'wb') as fin:
for chunk in req.iter_content():
fin.write(chunk)

# Extract the zip file and add __init__.py
with zipfile.ZipFile(zippath, 'r') as zipped:
zipped.extractall('.')
shutil.move(f'OoT-Randomizer-{randomizer_commit}', 'randomizer')
shutil.move(f'OoT-Randomizer-{rslv.randomizer_commit}', 'randomizer')
with open(os.path.join('randomizer', '__init__.py'), 'w') as fin:
pass

Expand Down

0 comments on commit 3e9afb9

Please sign in to comment.