Re-vamp multiple settings as buttons.
Minor logic clean up.
This commit is contained in:
@@ -3295,7 +3295,7 @@ def find_inaccessible_regions(world, player):
|
|||||||
while len(queue) > 0:
|
while len(queue) > 0:
|
||||||
next_region = queue.popleft()
|
next_region = queue.popleft()
|
||||||
visited_regions.add(next_region)
|
visited_regions.add(next_region)
|
||||||
if next_region.name == 'Dark Sanctuary Hint': # special spawn point in cave
|
if world.mode[player] == 'inverted' and next_region.name == 'Dark Sanctuary Hint': # special spawn point in cave
|
||||||
for ent in next_region.entrances:
|
for ent in next_region.entrances:
|
||||||
parent = ent.parent_region
|
parent = ent.parent_region
|
||||||
if parent and parent.type is not RegionType.Dungeon and parent not in queue and parent not in visited_regions:
|
if parent and parent.type is not RegionType.Dungeon and parent not in queue and parent not in visited_regions:
|
||||||
|
|||||||
1
Rules.py
1
Rules.py
@@ -192,7 +192,6 @@ def global_rules(world, player):
|
|||||||
set_rule(world.get_location('Purple Chest', player), lambda state: state.has('Pick Up Purple Chest', player)) # Can S&Q with chest
|
set_rule(world.get_location('Purple Chest', player), lambda state: state.has('Pick Up Purple Chest', player)) # Can S&Q with chest
|
||||||
|
|
||||||
# underworld rules
|
# underworld rules
|
||||||
set_rule(world.get_entrance('Old Man Cave Exit (West)', player), lambda state: False) # drop cannot be climbed up
|
|
||||||
set_rule(world.get_location('Mimic Cave', player), lambda state: state.has('Hammer', player))
|
set_rule(world.get_location('Mimic Cave', player), lambda state: state.has('Hammer', player))
|
||||||
set_rule(world.get_entrance('Paradox Cave Push Block Reverse', player), lambda state: state.has_Mirror(player)) # can erase block - overridden in noglitches
|
set_rule(world.get_entrance('Paradox Cave Push Block Reverse', player), lambda state: state.has_Mirror(player)) # can erase block - overridden in noglitches
|
||||||
set_rule(world.get_location('Potion Shop', player), lambda state: state.has('Mushroom', player) and state.can_reach('Potion Shop Area', 'Region', player))
|
set_rule(world.get_location('Potion Shop', player), lambda state: state.has('Mushroom', player) and state.can_reach('Potion Shop Area', 'Region', player))
|
||||||
|
|||||||
@@ -226,6 +226,7 @@
|
|||||||
"randomizer.item.worldstate.open": "Open",
|
"randomizer.item.worldstate.open": "Open",
|
||||||
"randomizer.item.worldstate.inverted": "Inverted",
|
"randomizer.item.worldstate.inverted": "Inverted",
|
||||||
"randomizer.item.worldstate.retro": "Retro",
|
"randomizer.item.worldstate.retro": "Retro",
|
||||||
|
"randomizer.item.retro": "Enable Retro",
|
||||||
|
|
||||||
"randomizer.item.logiclevel": "Logic Level",
|
"randomizer.item.logiclevel": "Logic Level",
|
||||||
"randomizer.item.logiclevel.noglitches": "No Glitches",
|
"randomizer.item.logiclevel.noglitches": "No Glitches",
|
||||||
@@ -320,7 +321,7 @@
|
|||||||
"randomizer.item.potshuffle": "Pot Shuffle (Legacy)",
|
"randomizer.item.potshuffle": "Pot Shuffle (Legacy)",
|
||||||
|
|
||||||
"randomizer.item.dropshuffle": "Shuffle Enemy Key Drops",
|
"randomizer.item.dropshuffle": "Shuffle Enemy Key Drops",
|
||||||
"randomizer.item.keydropshuffle": "Key Drop Shuffle (Legacy)",
|
"randomizer.item.keydropshuffle": "Enable Key Drop Shuffle (Legacy)",
|
||||||
|
|
||||||
"randomizer.item.take_any": "Take Any Caves",
|
"randomizer.item.take_any": "Take Any Caves",
|
||||||
"randomizer.item.take_any.none": "None",
|
"randomizer.item.take_any.none": "None",
|
||||||
|
|||||||
@@ -11,12 +11,8 @@
|
|||||||
"options": [
|
"options": [
|
||||||
"standard",
|
"standard",
|
||||||
"open",
|
"open",
|
||||||
"inverted",
|
"inverted"
|
||||||
"retro"
|
]
|
||||||
],
|
|
||||||
"config": {
|
|
||||||
"command": "worldstate"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"logiclevel": {
|
"logiclevel": {
|
||||||
"type": "selectbox",
|
"type": "selectbox",
|
||||||
@@ -65,6 +61,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rightItemFrame": {
|
"rightItemFrame": {
|
||||||
|
"retro": {
|
||||||
|
"type": "button",
|
||||||
|
"config": {
|
||||||
|
"command": "retro"
|
||||||
|
}
|
||||||
|
},
|
||||||
"sortingalgo": {
|
"sortingalgo": {
|
||||||
"type": "selectbox",
|
"type": "selectbox",
|
||||||
"default": "balanced",
|
"default": "balanced",
|
||||||
@@ -140,20 +142,28 @@
|
|||||||
"colorizepots": {
|
"colorizepots": {
|
||||||
"type": "checkbox",
|
"type": "checkbox",
|
||||||
"config": {
|
"config": {
|
||||||
"padx": [50,0]
|
"padx": [
|
||||||
|
50,
|
||||||
|
0
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"potshuffle": {
|
"potshuffle": {
|
||||||
"type": "checkbox",
|
"type": "checkbox",
|
||||||
"config": {
|
"config": {
|
||||||
"padx": [50,0]
|
"padx": [
|
||||||
|
50,
|
||||||
|
0
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dropshuffle": {
|
"dropshuffle": {
|
||||||
"type": "checkbox"
|
"type": "checkbox"
|
||||||
},
|
}
|
||||||
|
},
|
||||||
|
"leftPoolFrame2": {
|
||||||
"keydropshuffle": {
|
"keydropshuffle": {
|
||||||
"type": "checkbox",
|
"type": "button",
|
||||||
"config": {
|
"config": {
|
||||||
"command": "keydropshuffle"
|
"command": "keydropshuffle"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ SETTINGSTOPROCESS = {
|
|||||||
"crystals_ganon": "crystals_ganon",
|
"crystals_ganon": "crystals_ganon",
|
||||||
"weapons": "swords",
|
"weapons": "swords",
|
||||||
|
|
||||||
|
"retro": "retro",
|
||||||
"sortingalgo": "algorithm",
|
"sortingalgo": "algorithm",
|
||||||
"accessibility": "accessibility",
|
"accessibility": "accessibility",
|
||||||
"restrict_boss_items": "restrict_boss_items",
|
"restrict_boss_items": "restrict_boss_items",
|
||||||
|
|||||||
@@ -57,7 +57,10 @@ def loadcliargs(gui, args, settings=None):
|
|||||||
pagewidgets[widget].selectbox.options = theseOptions
|
pagewidgets[widget].selectbox.options = theseOptions
|
||||||
elif thisType == "spinbox":
|
elif thisType == "spinbox":
|
||||||
pagewidgets[widget].label.configure(text=label)
|
pagewidgets[widget].label.configure(text=label)
|
||||||
pagewidgets[widget].storageVar.set(args[arg])
|
elif thisType == 'button':
|
||||||
|
pagewidgets[widget].button.configure(text=label)
|
||||||
|
if hasattr(pagewidgets[widget], 'storageVar'):
|
||||||
|
pagewidgets[widget].storageVar.set(args[arg])
|
||||||
# If we're on the Game Options page and it's not about Hints
|
# If we're on the Game Options page and it's not about Hints
|
||||||
if subpage == "gameoptions" and widget not in ["hints", "collection_rate"]:
|
if subpage == "gameoptions" and widget not in ["hints", "collection_rate"]:
|
||||||
# Check if we've got settings
|
# Check if we've got settings
|
||||||
|
|||||||
@@ -43,7 +43,10 @@ def item_page(parent):
|
|||||||
self.frames["leftPoolHeader"].pack(side=TOP, anchor=W)
|
self.frames["leftPoolHeader"].pack(side=TOP, anchor=W)
|
||||||
|
|
||||||
self.frames["leftPoolFrame"] = Frame(self.frames["leftPoolContainer"])
|
self.frames["leftPoolFrame"] = Frame(self.frames["leftPoolContainer"])
|
||||||
self.frames["leftPoolFrame"].pack(side=LEFT, fill=Y)
|
self.frames["leftPoolFrame"].pack(side=TOP, fill=Y)
|
||||||
|
|
||||||
|
self.frames["leftPoolFrame2"] = Frame(self.frames["leftPoolContainer"])
|
||||||
|
self.frames["leftPoolFrame2"].pack(side=LEFT, fill=Y)
|
||||||
|
|
||||||
self.frames["rightPoolFrame"] = Frame(self.frames["poolFrame"])
|
self.frames["rightPoolFrame"] = Frame(self.frames["poolFrame"])
|
||||||
self.frames["rightPoolFrame"].pack(side=RIGHT)
|
self.frames["rightPoolFrame"].pack(side=RIGHT)
|
||||||
@@ -62,14 +65,16 @@ def item_page(parent):
|
|||||||
for key in dictWidgets:
|
for key in dictWidgets:
|
||||||
self.widgets[key] = dictWidgets[key]
|
self.widgets[key] = dictWidgets[key]
|
||||||
packAttrs = {"anchor":E}
|
packAttrs = {"anchor":E}
|
||||||
if self.widgets[key].type == "checkbox" or framename == "leftPoolFrame":
|
if key == "retro":
|
||||||
|
packAttrs["side"] = RIGHT
|
||||||
|
if self.widgets[key].type == "checkbox" or framename.startswith("leftPoolFrame"):
|
||||||
packAttrs["anchor"] = W
|
packAttrs["anchor"] = W
|
||||||
if framename == "checkboxes":
|
if framename == "checkboxes":
|
||||||
packAttrs["side"] = LEFT
|
packAttrs["side"] = LEFT
|
||||||
packAttrs["padx"] = (10,0)
|
packAttrs["padx"] = (10, 0)
|
||||||
elif framename == "leftPoolHeader":
|
elif framename == "leftPoolHeader":
|
||||||
packAttrs["side"] = LEFT
|
packAttrs["side"] = LEFT
|
||||||
packAttrs["padx"] = (0,20)
|
packAttrs["padx"] = (0, 20)
|
||||||
packAttrs = widgets.add_padding_from_config(packAttrs, theseWidgets[key])
|
packAttrs = widgets.add_padding_from_config(packAttrs, theseWidgets[key])
|
||||||
self.widgets[key].pack(packAttrs)
|
self.widgets[key].pack(packAttrs)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
from tkinter import messagebox, Checkbutton, Entry, Frame, IntVar, Label, OptionMenu, Spinbox, StringVar, LEFT, RIGHT, X
|
from tkinter import messagebox, Checkbutton, Entry, Frame, IntVar, Label, OptionMenu, Spinbox, StringVar, LEFT, RIGHT, X
|
||||||
|
from tkinter import Button
|
||||||
from source.classes.Empty import Empty
|
from source.classes.Empty import Empty
|
||||||
|
|
||||||
# Override Spinbox to include mousewheel support for changing value
|
# Override Spinbox to include mousewheel support for changing value
|
||||||
@@ -172,6 +174,22 @@ def make_textbox(self, parent, label, storageVar, manager, managerAttrs):
|
|||||||
widget.textbox.pack(managerAttrs["textbox"] if managerAttrs is not None and "textbox" in managerAttrs else None)
|
widget.textbox.pack(managerAttrs["textbox"] if managerAttrs is not None and "textbox" in managerAttrs else None)
|
||||||
return widget
|
return widget
|
||||||
|
|
||||||
|
|
||||||
|
def make_button(self, parent, label, manager, managerAttrs, config):
|
||||||
|
self = Frame(parent)
|
||||||
|
if config and "command" in config:
|
||||||
|
self.command = config["command"]
|
||||||
|
else:
|
||||||
|
self.command = lambda: None
|
||||||
|
|
||||||
|
self.button = Button(parent, text=label, command=lambda: widget_command(self, self.command))
|
||||||
|
if managerAttrs is not None:
|
||||||
|
self.button.pack(managerAttrs)
|
||||||
|
else:
|
||||||
|
self.button.pack(anchor='w')
|
||||||
|
return self
|
||||||
|
|
||||||
|
|
||||||
# Make a generic widget
|
# Make a generic widget
|
||||||
def make_widget(self, type, parent, label, storageVar=None, manager=None, managerAttrs=dict(),
|
def make_widget(self, type, parent, label, storageVar=None, manager=None, managerAttrs=dict(),
|
||||||
options=None, config=None):
|
options=None, config=None):
|
||||||
@@ -201,6 +219,8 @@ def make_widget(self, type, parent, label, storageVar=None, manager=None, manage
|
|||||||
if thisStorageVar is None:
|
if thisStorageVar is None:
|
||||||
thisStorageVar = StringVar()
|
thisStorageVar = StringVar()
|
||||||
widget = make_textbox(self, parent, label, thisStorageVar, manager, managerAttrs)
|
widget = make_textbox(self, parent, label, thisStorageVar, manager, managerAttrs)
|
||||||
|
elif type == 'button':
|
||||||
|
widget = make_button(self, parent, label, manager, managerAttrs, config)
|
||||||
widget.type = type
|
widget.type = type
|
||||||
return widget
|
return widget
|
||||||
|
|
||||||
@@ -243,47 +263,36 @@ def add_padding_from_config(packAttrs, defn):
|
|||||||
def widget_command(widget, command=""):
|
def widget_command(widget, command=""):
|
||||||
root = widget.winfo_toplevel()
|
root = widget.winfo_toplevel()
|
||||||
text_output = ""
|
text_output = ""
|
||||||
if command == "worldstate":
|
if command == "retro":
|
||||||
if widget.storageVar.get() == 'retro':
|
temp_widget = root.pages["randomizer"].pages["dungeon"].widgets["smallkeyshuffle"]
|
||||||
temp_widget = root.pages["randomizer"].pages["dungeon"].widgets["smallkeyshuffle"]
|
text_output += f'\n {temp_widget.label.cget("text")}'
|
||||||
text_output += f'\n {temp_widget.label.cget("text")}'
|
temp_widget.storageVar.set('universal')
|
||||||
temp_widget.storageVar.set('universal')
|
|
||||||
|
|
||||||
temp_widget = root.pages["randomizer"].pages["item"].widgets["bow_mode"]
|
temp_widget = root.pages["randomizer"].pages["item"].widgets["bow_mode"]
|
||||||
text_output += f'\n {temp_widget.label.cget("text")}'
|
text_output += f'\n {temp_widget.label.cget("text")}'
|
||||||
if temp_widget.storageVar.get() == 'progressive':
|
if temp_widget.storageVar.get() == 'progressive':
|
||||||
temp_widget.storageVar.set('retro')
|
temp_widget.storageVar.set('retro')
|
||||||
elif temp_widget.storageVar.get() == 'silvers':
|
elif temp_widget.storageVar.get() == 'silvers':
|
||||||
temp_widget.storageVar.set('retro_silvers')
|
temp_widget.storageVar.set('retro_silvers')
|
||||||
|
|
||||||
temp_widget = root.pages["randomizer"].pages["item"].widgets["take_any"]
|
temp_widget = root.pages["randomizer"].pages["item"].widgets["take_any"]
|
||||||
text_output += f'\n {temp_widget.label.cget("text")}'
|
text_output += f'\n {temp_widget.label.cget("text")}'
|
||||||
if temp_widget.storageVar.get() == 'none':
|
if temp_widget.storageVar.get() == 'none':
|
||||||
temp_widget.storageVar.set('random')
|
temp_widget.storageVar.set('random')
|
||||||
|
|
||||||
widget.storageVar.set('open')
|
messagebox.showinfo('', f'The following settings were changed:{text_output}')
|
||||||
messagebox.showinfo('', f'The following settings were changed:{text_output}')
|
|
||||||
elif command == "keydropshuffle":
|
elif command == "keydropshuffle":
|
||||||
if widget.storageVar.get() > 0:
|
temp_widget = root.pages["randomizer"].pages["item"].widgets["pottery"]
|
||||||
temp_widget = root.pages["randomizer"].pages["item"].widgets["pottery"]
|
text_output += f'\n {temp_widget.label.cget("text")}'
|
||||||
if temp_widget.storageVar.get() == 'none':
|
if temp_widget.storageVar.get() == 'none':
|
||||||
text_output += f'\n {temp_widget.label.cget("text")}'
|
|
||||||
temp_widget.storageVar.set('keys')
|
temp_widget.storageVar.set('keys')
|
||||||
|
|
||||||
|
temp_widget = root.pages["randomizer"].pages["item"].widgets["dropshuffle"]
|
||||||
|
text_output += f'\n {temp_widget.checkbox.cget("text")}'
|
||||||
|
if temp_widget.storageVar.get() == 0:
|
||||||
|
temp_widget.storageVar.set(1)
|
||||||
|
|
||||||
|
if text_output:
|
||||||
|
messagebox.showinfo('', f'The following settings were changed:{text_output}')
|
||||||
|
|
||||||
temp_widget = root.pages["randomizer"].pages["item"].widgets["dropshuffle"]
|
|
||||||
if temp_widget.storageVar.get() == 0:
|
|
||||||
temp_widget.storageVar.set(1)
|
|
||||||
text_output += f'\n {temp_widget.checkbox.cget("text")}'
|
|
||||||
if text_output:
|
|
||||||
messagebox.showinfo('', f'The following settings were changed:{text_output}')
|
|
||||||
else:
|
|
||||||
temp_widget = root.pages["randomizer"].pages["item"].widgets["pottery"]
|
|
||||||
if temp_widget.storageVar.get() == 'keys':
|
|
||||||
text_output += f'\n {temp_widget.label.cget("text")}'
|
|
||||||
temp_widget.storageVar.set('none')
|
|
||||||
temp_widget = root.pages["randomizer"].pages["item"].widgets["dropshuffle"]
|
|
||||||
if temp_widget.storageVar.get() == 1:
|
|
||||||
temp_widget.storageVar.set(0)
|
|
||||||
text_output += f'\n {temp_widget.checkbox.cget("text")}'
|
|
||||||
if text_output:
|
|
||||||
messagebox.showinfo('', f'The following settings were changed:{text_output}')
|
|
||||||
|
|||||||
Reference in New Issue
Block a user