Added Overworld Shuffle parameter to CLI and Gui

This commit is contained in:
codemann8
2021-02-10 22:11:50 -06:00
parent 965b886c2d
commit b11054e6bf
12 changed files with 90 additions and 3 deletions

View File

@@ -18,10 +18,11 @@ from RoomData import Room
class World(object): class World(object):
def __init__(self, players, shuffle, doorShuffle, logic, mode, swords, difficulty, difficulty_adjustments, def __init__(self, players, owShuffle, shuffle, doorShuffle, logic, mode, swords, difficulty, difficulty_adjustments,
timer, progressive, goal, algorithm, accessibility, shuffle_ganon, retro, custom, customitemarray, hints): timer, progressive, goal, algorithm, accessibility, shuffle_ganon, retro, custom, customitemarray, hints):
self.players = players self.players = players
self.teams = 1 self.teams = 1
self.owShuffle = owShuffle.copy()
self.shuffle = shuffle.copy() self.shuffle = shuffle.copy()
self.doorShuffle = doorShuffle.copy() self.doorShuffle = doorShuffle.copy()
self.intensity = {} self.intensity = {}
@@ -1926,6 +1927,7 @@ class Spoiler(object):
'retro': self.world.retro, 'retro': self.world.retro,
'weapons': self.world.swords, 'weapons': self.world.swords,
'goal': self.world.goal, 'goal': self.world.goal,
'ow_shuffle': self.world.owShuffle,
'shuffle': self.world.shuffle, 'shuffle': self.world.shuffle,
'door_shuffle': self.world.doorShuffle, 'door_shuffle': self.world.doorShuffle,
'intensity': self.world.intensity, 'intensity': self.world.intensity,
@@ -1991,6 +1993,7 @@ class Spoiler(object):
outfile.write('Goal: %s\n' % self.metadata['goal'][player]) outfile.write('Goal: %s\n' % self.metadata['goal'][player])
outfile.write('Difficulty: %s\n' % self.metadata['item_pool'][player]) outfile.write('Difficulty: %s\n' % self.metadata['item_pool'][player])
outfile.write('Item Functionality: %s\n' % self.metadata['item_functionality'][player]) outfile.write('Item Functionality: %s\n' % self.metadata['item_functionality'][player])
outfile.write('Overworld Shuffle: %s\n' % self.metadata['ow_shuffle'][player])
outfile.write('Entrance Shuffle: %s\n' % self.metadata['shuffle'][player]) outfile.write('Entrance Shuffle: %s\n' % self.metadata['shuffle'][player])
outfile.write('Door Shuffle: %s\n' % self.metadata['door_shuffle'][player]) outfile.write('Door Shuffle: %s\n' % self.metadata['door_shuffle'][player])
outfile.write('Intensity: %s\n' % self.metadata['intensity'][player]) outfile.write('Intensity: %s\n' % self.metadata['intensity'][player])

3
CLI.py
View File

@@ -87,7 +87,7 @@ def parse_cli(argv, no_defaults=False):
for player in range(1, multiargs.multi + 1): for player in range(1, multiargs.multi + 1):
playerargs = parse_cli(shlex.split(getattr(ret,f"p{player}")), True) playerargs = parse_cli(shlex.split(getattr(ret,f"p{player}")), True)
for name in ['logic', 'mode', 'swords', 'goal', 'difficulty', 'item_functionality', for name in ['logic', 'mode', 'swords', 'goal', 'difficulty', 'item_functionality', 'ow_shuffle',
'shuffle', 'door_shuffle', 'intensity', 'crystals_ganon', 'crystals_gt', 'openpyramid', 'shuffle', 'door_shuffle', 'intensity', 'crystals_ganon', 'crystals_gt', 'openpyramid',
'mapshuffle', 'compassshuffle', 'keyshuffle', 'bigkeyshuffle', 'startinventory', 'mapshuffle', 'compassshuffle', 'keyshuffle', 'bigkeyshuffle', 'startinventory',
'retro', 'accessibility', 'hints', 'beemizer', 'experimental', 'dungeon_counters', 'retro', 'accessibility', 'hints', 'beemizer', 'experimental', 'dungeon_counters',
@@ -124,6 +124,7 @@ def parse_settings():
# Shuffle Ganon defaults to TRUE # Shuffle Ganon defaults to TRUE
"openpyramid": False, "openpyramid": False,
"shuffleganon": True, "shuffleganon": True,
"ow_shuffle": "vanilla",
"shuffle": "vanilla", "shuffle": "vanilla",
"shufflepots": False, "shufflepots": False,

6
Gui.py
View File

@@ -10,6 +10,7 @@ from source.gui.startinventory.overview import startinventory_page
from source.gui.custom.overview import custom_page from source.gui.custom.overview import custom_page
from source.gui.loadcliargs import loadcliargs, loadadjustargs from source.gui.loadcliargs import loadcliargs, loadadjustargs
from source.gui.randomize.item import item_page from source.gui.randomize.item import item_page
from source.gui.randomize.overworld import overworld_page
from source.gui.randomize.entrando import entrando_page from source.gui.randomize.entrando import entrando_page
from source.gui.randomize.enemizer import enemizer_page from source.gui.randomize.enemizer import enemizer_page
from source.gui.randomize.dungeon import dungeon_page from source.gui.randomize.dungeon import dungeon_page
@@ -107,6 +108,7 @@ def guiMain(args=None):
# Randomize notebook page: # Randomize notebook page:
# make notebook pages: Item, Entrances, Enemizer, Dungeon Shuffle, Multiworld, Game Options, Generation Setup # make notebook pages: Item, Entrances, Enemizer, Dungeon Shuffle, Multiworld, Game Options, Generation Setup
# Item: Item Randomizer settings # Item: Item Randomizer settings
# Overworld: Overworld Randomizer settings
# Entrances: Entrance Randomizer settings # Entrances: Entrance Randomizer settings
# Enemizer: Enemy Randomizer settings # Enemizer: Enemy Randomizer settings
# Dungeon Shuffle: Dungeon Door Randomizer settings # Dungeon Shuffle: Dungeon Door Randomizer settings
@@ -122,6 +124,10 @@ def guiMain(args=None):
self.pages["randomizer"].pages["item"] = item_page(self.pages["randomizer"].notebook) self.pages["randomizer"].pages["item"] = item_page(self.pages["randomizer"].notebook)
self.pages["randomizer"].notebook.add(self.pages["randomizer"].pages["item"], text="Items") self.pages["randomizer"].notebook.add(self.pages["randomizer"].pages["item"], text="Items")
# Overworld Randomizer
self.pages["randomizer"].pages["overworld"] = overworld_page(self.pages["randomizer"].notebook)
self.pages["randomizer"].notebook.add(self.pages["randomizer"].pages["overworld"], text="Overworld")
# Entrance Randomizer # Entrance Randomizer
self.pages["randomizer"].pages["entrance"] = entrando_page(self.pages["randomizer"].notebook) self.pages["randomizer"].pages["entrance"] = entrando_page(self.pages["randomizer"].notebook)
self.pages["randomizer"].notebook.add(self.pages["randomizer"].pages["entrance"], text="Entrances") self.pages["randomizer"].notebook.add(self.pages["randomizer"].pages["entrance"], text="Entrances")

View File

@@ -39,7 +39,7 @@ def main(args, seed=None, fish=None):
start = time.perf_counter() start = time.perf_counter()
# initialize the world # initialize the world
world = World(args.multi, args.shuffle, args.door_shuffle, args.logic, args.mode, args.swords, world = World(args.multi, args.ow_shuffle, args.shuffle, args.door_shuffle, args.logic, args.mode, args.swords,
args.difficulty, args.item_functionality, args.timer, args.progressive, args.goal, args.algorithm, args.difficulty, args.item_functionality, args.timer, args.progressive, args.goal, args.algorithm,
args.accessibility, args.shuffleganon, args.retro, args.custom, args.customitemarray, args.hints) args.accessibility, args.shuffleganon, args.retro, args.custom, args.customitemarray, args.hints)
logger = logging.getLogger('') logger = logging.getLogger('')

View File

@@ -145,6 +145,8 @@ def roll_settings(weights):
ret.accessibility = get_choice('accessibility') ret.accessibility = get_choice('accessibility')
overworld_shuffle = get_choice('overworld_shuffle')
ret.ow_shuffle = overworld_shuffle if overworld_shuffle != 'none' else 'vanilla'
entrance_shuffle = get_choice('entrance_shuffle') entrance_shuffle = get_choice('entrance_shuffle')
ret.shuffle = entrance_shuffle if entrance_shuffle != 'none' else 'vanilla' ret.shuffle = entrance_shuffle if entrance_shuffle != 'none' else 'vanilla'
door_shuffle = get_choice('door_shuffle') door_shuffle = get_choice('door_shuffle')

View File

@@ -121,6 +121,12 @@ Use to batch generate multiple seeds with same settings. If a seed number is pro
Show the help message and exit. Show the help message and exit.
```
--ow_shuffle <mode>
```
For specifying the overworld shuffle you want as above. (default: vanilla)
``` ```
--door_shuffle <mode> --door_shuffle <mode>
``` ```

View File

@@ -104,6 +104,14 @@
"vt26" "vt26"
] ]
}, },
"ow_shuffle": {
"choices": [
"vanilla",
"simple",
"full",
"crossed"
]
},
"shuffle": { "shuffle": {
"choices": [ "choices": [
"vanilla", "vanilla",

View File

@@ -6,6 +6,7 @@
"version": "Version", "version": "Version",
"seed": "Seed", "seed": "Seed",
"player": "Player", "player": "Player",
"shuffling.overworld": "Shuffling overworld",
"shuffling.world": "Shuffling the World about", "shuffling.world": "Shuffling the World about",
"shuffling.dungeons": "Shuffling dungeons", "shuffling.dungeons": "Shuffling dungeons",
"shuffling.pots": "Shuffling pots", "shuffling.pots": "Shuffling pots",
@@ -192,6 +193,16 @@
"The dungeon variants only mix up dungeons and keep the rest of", "The dungeon variants only mix up dungeons and keep the rest of",
"the overworld vanilla." "the overworld vanilla."
], ],
"ow_shuffle": [
"Select Overworld Shuffling Algorithm. (default: %(default)s)",
"Vanilla: All overworld transitions are connected the same",
" way they were in the base game.",
"Simple: Overworld retains the same vanilla shape, but some overworld",
" screens will be swapped with their opposite world version.",
"Full: Overworld screen transitions will lead to other",
" overworld screens from the same world.",
"Crossed: Overworld screen transitions can lead to any other overworld screen."
],
"door_shuffle": [ "door_shuffle": [
"Select Door Shuffling Algorithm. (default: %(default)s)", "Select Door Shuffling Algorithm. (default: %(default)s)",
"Basic: Doors are mixed within a single dungeon.", "Basic: Doors are mixed within a single dungeon.",

View File

@@ -109,6 +109,12 @@
"randomizer.enemizer.enemizercli.online": "(get online)", "randomizer.enemizer.enemizercli.online": "(get online)",
"randomizer.overworld.overworldshuffle": "Overworld Shuffle",
"randomizer.overworld.overworldshuffle.vanilla": "Vanilla",
"randomizer.overworld.overworldshuffle.simple": "Simple",
"randomizer.overworld.overworldshuffle.full": "Full",
"randomizer.overworld.overworldshuffle.crossed": "Crossed",
"randomizer.entrance.openpyramid": "Pre-open Pyramid Hole", "randomizer.entrance.openpyramid": "Pre-open Pyramid Hole",
"randomizer.entrance.shuffleganon": "Include Ganon's Tower and Pyramid Hole in shuffle pool", "randomizer.entrance.shuffleganon": "Include Ganon's Tower and Pyramid Hole in shuffle pool",

View File

@@ -0,0 +1,12 @@
{
"widgets": {
"overworldshuffle": {
"type": "selectbox",
"default": "vanilla",
"options": [
"vanilla",
"full"
]
}
}
}

View File

@@ -69,6 +69,9 @@ SETTINGSTOPROCESS = {
"accessibility": "accessibility", "accessibility": "accessibility",
"sortingalgo": "algorithm" "sortingalgo": "algorithm"
}, },
"overworld": {
"overworldshuffle": "ow_shuffle"
},
"entrance": { "entrance": {
"openpyramid": "openpyramid", "openpyramid": "openpyramid",
"shuffleganon": "shuffleganon", "shuffleganon": "shuffleganon",

View File

@@ -0,0 +1,29 @@
from tkinter import ttk, Frame, Label, E, W, LEFT, RIGHT
import source.gui.widgets as widgets
import json
import os
def overworld_page(parent):
# Overworld Shuffle
self = ttk.Frame(parent)
# Overworld Shuffle options
self.widgets = {}
# Overworld Shuffle option sections
self.frames = {}
# Load Overworld Shuffle option widgets as defined by JSON file
# Defns include frame name, widget type, widget options, widget placement attributes
# These get split left & right
self.frames["widgets"] = Frame(self)
self.frames["widgets"].pack(anchor=W)
with open(os.path.join("resources","app","gui","randomize","overworld","widgets.json")) as overworldWidgets:
myDict = json.load(overworldWidgets)
myDict = myDict["widgets"]
dictWidgets = widgets.make_widgets_from_dict(self, myDict, self.frames["widgets"])
for key in dictWidgets:
self.widgets[key] = dictWidgets[key]
self.widgets[key].pack(anchor=W)
return self