JSONify Item Randomizer options

This commit is contained in:
Mike A. Trethewey
2020-02-17 00:03:54 -08:00
parent 88a3074e74
commit 2b68d7c74e
4 changed files with 284 additions and 221 deletions

View File

@@ -1,5 +1,7 @@
from tkinter import ttk, IntVar, StringVar, Checkbutton, Frame, Label, OptionMenu, E, W, LEFT, RIGHT from tkinter import ttk, IntVar, StringVar, Checkbutton, Frame, Label, OptionMenu, E, W, LEFT, RIGHT
import gui.widgets as widgets import gui.widgets as widgets
import json
import os
def item_page(parent): def item_page(parent):
# Item Randomizer # Item Randomizer
@@ -8,19 +10,12 @@ def item_page(parent):
# Item Randomizer options # Item Randomizer options
self.widgets = {} self.widgets = {}
myDict = { with open(os.path.join("resources","app","gui","randomize","item","checkboxes.json")) as checkboxes:
## Retro (eventually needs to become a World State) myDict = json.load(checkboxes)
"retro": { dictWidgets = widgets.make_widgets_from_dict(self, myDict, self)
"type": "checkbox", for key in dictWidgets:
"label": { self.widgets[key] = dictWidgets[key]
"text": "Retro mode (universal keys)" self.widgets[key].pack(anchor=W)
}
}
}
dictWidgets = widgets.make_widgets_from_dict(self, myDict, self)
for key in dictWidgets:
self.widgets[key] = dictWidgets[key]
self.widgets[key].pack(anchor=W)
leftItemFrame = Frame(self) leftItemFrame = Frame(self)
rightItemFrame = Frame(self) rightItemFrame = Frame(self)
@@ -31,214 +26,18 @@ def item_page(parent):
vals = [*map(str,range(0,7+1)),"random"] vals = [*map(str,range(0,7+1)),"random"]
crystalsOptions = {keys[i]: vals[i] for i in range(len(keys))} crystalsOptions = {keys[i]: vals[i] for i in range(len(keys))}
myDict = { with open(os.path.join("resources","app","gui","randomize","item","leftItemFrame.json")) as leftItemFrameItems:
## World State myDict = json.load(leftItemFrameItems)
"worldstate": { dictWidgets = widgets.make_widgets_from_dict(self, myDict, leftItemFrame)
"type": "selectbox", for key in dictWidgets:
"label": { self.widgets[key] = dictWidgets[key]
"text": "World State" self.widgets[key].pack(anchor=E)
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": { "side": RIGHT },
"default": "Open"
},
"options": {
"Standard": "standard",
"Open": "open",
"Inverted": "inverted"
}
},
## Logic Level
"logiclevel": {
"type": "selectbox",
"label": {
"text": "Logic Level"
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": { "side": RIGHT }
},
"options": {
"No Glitches": "noglitches",
"Minor Glitches": "minorglitches",
"No Logic": "nologic"
}
},
## Goal
"goal": {
"type": "selectbox",
"label": {
"text": "Goal"
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": { "side": RIGHT }
},
"options": {
"Defeat Ganon": "ganon",
"Master Sword Pedestal": "pedestal",
"All Dungeons": "dungeons",
"Triforce Hunt": "triforcehunt",
"Crystals": "crystals"
}
},
## Number of crystals to open GT
"crystals_gt": {
"type": "selectbox",
"label": {
"text": "Crystals to open GT"
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": { "side": RIGHT }
},
"options": crystalsOptions
},
## Number of crystals to damage Ganon
"crystals_ganon": {
"type": "selectbox",
"label": {
"text": "Crystals to harm Ganon"
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": { "side": RIGHT }
},
"options": crystalsOptions
},
## Weapons
"weapons": {
"type": "selectbox",
"label": {
"text": "Weapons"
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": { "side": RIGHT }
},
"options": {
"Randomized": "random",
"Assured": "assured",
"Swordless": "swordless",
"Vanilla": "vanilla"
}
}
}
dictWidgets = widgets.make_widgets_from_dict(self, myDict, leftItemFrame)
for key in dictWidgets:
self.widgets[key] = dictWidgets[key]
self.widgets[key].pack(anchor=E)
myDict = { with open(os.path.join("resources","app","gui","randomize","item","rightItemFrame.json")) as rightItemFrameItems:
## Item Pool myDict = json.load(rightItemFrameItems)
"itempool": { dictWidgets = widgets.make_widgets_from_dict(self, myDict, rightItemFrame)
"type": "selectbox", for key in dictWidgets:
"label": { self.widgets[key] = dictWidgets[key]
"text": "Item Pool" self.widgets[key].pack(anchor=E)
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": { "side": RIGHT }
},
"options": {
"Normal": "normal",
"Hard": "hard",
"Expert": "expert"
}
},
## Item Functionality
"itemfunction": {
"type": "selectbox",
"label": {
"text": "Item Functionality"
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": { "side": RIGHT }
},
"options": {
"Normal": "normal",
"Hard": "hard",
"Expert": "expert"
}
},
## Timer setting
"timer": {
"type": "selectbox",
"label": {
"text": "Timer Setting"
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": { "side": RIGHT }
},
"options": {
"No Timer": "none",
"Stopwatch": "display",
"Timed": "timed",
"Timed OHKO": "timed-ohko",
"OHKO": "ohko",
"Timed Countdown": "timed-countdown"
}
},
## Progressives: On/Off
"progressives": {
"type": "selectbox",
"label": {
"text": "Progressive Items"
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": { "side": RIGHT }
},
"options": {
"On": "on",
"Off": "off",
"Random": "random"
}
},
## Accessibility
"accessibility": {
"type": "selectbox",
"label": {
"text": "Accessibility"
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": { "side": RIGHT }
},
"options": {
"100% Inventory": "items",
"100% Locations": "locations",
"Beatable": "none"
}
},
## Item Sorting Algorithm
"sortingalgo": {
"type": "selectbox",
"label": {
"text": "Item Sorting"
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": { "side": RIGHT },
"default": "Balanced"
},
"options": {
"Freshness": "freshness",
"Flood": "flood",
"VT8.21": "vt21",
"VT8.22": "vt22",
"VT8.25": "vt25",
"VT8.26": "vt26",
"Balanced": "balanced"
}
}
}
dictWidgets = widgets.make_widgets_from_dict(self, myDict, rightItemFrame)
for key in dictWidgets:
self.widgets[key] = dictWidgets[key]
self.widgets[key].pack(anchor=E)
return self return self

View File

@@ -0,0 +1,8 @@
{
"retro": {
"type": "checkbox",
"label": {
"text": "Retro mode (universal keys)"
}
}
}

View File

@@ -0,0 +1,132 @@
{
"worldstate": {
"type": "selectbox",
"label": {
"text": "World State"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
},
"default": "Open"
},
"options": {
"Standard": "standard",
"Open": "open",
"Inverted": "inverted"
}
},
"logiclevel": {
"type": "selectbox",
"label": {
"text": "Logic Level"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
}
},
"options": {
"No Glitches": "noglitches",
"Minor Glitches": "minorglitches",
"No Logic": "nologic"
}
},
"goal": {
"type": "selectbox",
"label": {
"text": "Goal"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
}
},
"options": {
"Defeat Ganon": "ganon",
"Master Sword Pedestal": "pedestal",
"All Dungeons": "dungeons",
"Triforce Hunt": "triforcehunt",
"Crystals": "crystals"
}
},
"crystals_gt": {
"type": "selectbox",
"label": {
"text": "Crystals to open GT"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
}
},
"options": {
"0": "0",
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6",
"7": "7",
"Random": "random"
}
},
"crystals_ganon": {
"type": "selectbox",
"label": {
"text": "Crystals to harm Ganon"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
}
},
"options": {
"0": "0",
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6",
"7": "7",
"Random": "random"
}
},
"weapons": {
"type": "selectbox",
"label": {
"text": "Weapons"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
}
},
"options": {
"Randomized": "random",
"Assured": "assured",
"Swordless": "swordless",
"Vanilla": "vanilla"
}
}
}

View File

@@ -0,0 +1,124 @@
{
"itempool": {
"type": "selectbox",
"label": {
"text": "Item Pool"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
}
},
"options": {
"Normal": "normal",
"Hard": "hard",
"Expert": "expert"
}
},
"itemfunction": {
"type": "selectbox",
"label": {
"text": "Item Functionality"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
}
},
"options": {
"Normal": "normal",
"Hard": "hard",
"Expert": "expert"
}
},
"timer": {
"type": "selectbox",
"label": {
"text": "Timer Setting"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
}
},
"options": {
"No Timer": "none",
"Stopwatch": "display",
"Timed": "timed",
"Timed OHKO": "timed-ohko",
"OHKO": "ohko",
"Timed Countdown": "timed-countdown"
}
},
"progressives": {
"type": "selectbox",
"label": {
"text": "Progressive Items"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
}
},
"options": {
"On": "on",
"Off": "off",
"Random": "random"
}
},
"accessibility": {
"type": "selectbox",
"label": {
"text": "Accessibility"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
}
},
"options": {
"100% Inventory": "items",
"100% Locations": "locations",
"Beatable": "none"
}
},
"sortingalgo": {
"type": "selectbox",
"label": {
"text": "Item Sorting"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
},
"default": "Balanced"
},
"options": {
"Freshness": "freshness",
"Flood": "flood",
"VT8.21": "vt21",
"VT8.22": "vt22",
"VT8.25": "vt25",
"VT8.26": "vt26",
"Balanced": "balanced"
}
}
}