Fix Hints toggle on CLI

This commit is contained in:
Mike A. Trethewey
2020-04-07 02:17:25 -07:00
parent c9d6b87d94
commit 4c35b39e35
3 changed files with 78 additions and 41 deletions

11
CLI.py
View File

@@ -123,6 +123,7 @@ def parse_settings():
"accessibility": "items",
"algorithm": "balanced",
# Shuffle Ganon defaults to TRUE
"openpyramid": False,
"shuffleganon": True,
"shuffle": "vanilla",
@@ -146,7 +147,9 @@ def parse_settings():
"multi": 1,
"names": "",
# Hints default to TRUE
"hints": True,
"no_hints": False,
"disablemusic": False,
"quickswap": False,
"heartcolor": "red",
@@ -156,11 +159,11 @@ def parse_settings():
"ow_palettes": "default",
"uw_palettes": "default",
"suppress_spoiler": True,
# Spoiler defaults to FALSE
# Playthrough defaults to TRUE
# ROM defaults to TRUE
"create_spoiler": False,
"skip_playthrough": False,
"calc_playthrough": True,
"suppress_rom": False,
"create_rom": True,
"usestartinventory": False,
"custom": False,
@@ -310,9 +313,9 @@ def get_args_priority(settings_args, gui_args, cli_args):
else:
newArgs[key] = args[key]
newArgs[key] = update_deprecated_args(newArgs[key])
else:
newArgs[key] = args[key]
newArgs[key] = update_deprecated_args(newArgs[key])
args = newArgs

View File

@@ -249,43 +249,72 @@ def print_wiki_doors_by_region(d_regions, world, player):
f.write(toprint)
def update_deprecated_args(args):
argVars = vars(args)
truthy = [ 1, True, "True", "true" ]
# Don't do: Yes
# Do: No
if "suppress_spoiler" in argVars:
args.create_spoiler = args.suppress_spoiler not in truthy
# Don't do: No
# Do: Yes
if "create_spoiler" in argVars:
args.suppress_spoiler = not args.create_spoiler in truthy
if args:
argVars = vars(args)
truthy = [ 1, True, "True", "true" ]
# Hints default to TRUE
# Don't do: Yes
# Do: No
if "no_hints" in argVars:
src = "no_hints"
if isinstance(argVars["hints"],dict):
tmp = {}
for idx in range(1,len(argVars["hints"]) + 1):
tmp[idx] = not argVars[src] in truthy # tmp = !src
args.hints = tmp # dest = tmp
else:
args.hints = not args.no_hints in truthy # dest = !src
# Don't do: No
# Do: Yes
if "hints" in argVars:
src = "hints"
if isinstance(argVars["hints"],dict):
tmp = {}
for idx in range(1,len(argVars["hints"]) + 1):
tmp[idx] = not argVars[src] in truthy # tmp = !src
args.no_hints = tmp # dest = tmp
else:
args.no_hints = not args.hints in truthy # dest = !src
# Don't do: Yes
# Do: No
if "suppress_rom" in argVars:
args.create_rom = args.suppress_rom not in truthy
# Don't do: No
# Do: Yes
if "create_rom" in argVars:
args.suppress_rom = not args.create_rom in truthy
# Spoiler defaults to FALSE
# Don't do: No
# Do: Yes
if "create_spoiler" in argVars:
args.suppress_spoiler = not args.create_spoiler in truthy
# Don't do: Yes
# Do: No
if "suppress_spoiler" in argVars:
args.create_spoiler = not args.suppress_spoiler in truthy
# Don't do: Yes
# Do: No
if "no_shuffleganon" in argVars:
args.shuffleganon = not args.no_shuffleganon in truthy
# Don't do: No
# Do: Yes
if "shuffleganon" in argVars:
args.no_shuffleganon = not args.shuffleganon in truthy
# ROM defaults to TRUE
# Don't do: Yes
# Do: No
if "suppress_rom" in argVars:
args.create_rom = not args.suppress_rom in truthy
# Don't do: No
# Do: Yes
if "create_rom" in argVars:
args.suppress_rom = not args.create_rom in truthy
# Don't do: Yes
# Do: No
if "skip_playthrough" in argVars:
args.calc_playthrough = not args.skip_playthrough in truthy
# Don't do: No
# Do: Yes
if "calc_playthrough" in argVars:
args.skip_playthrough = not args.calc_playthrough in truthy
# Shuffle Ganon defaults to TRUE
# Don't do: Yes
# Do: No
if "no_shuffleganon" in argVars:
args.shuffleganon = not args.no_shuffleganon in truthy
# Don't do: No
# Do: Yes
if "shuffleganon" in argVars:
args.no_shuffleganon = not args.shuffleganon in truthy
# Playthrough defaults to TRUE
# Don't do: Yes
# Do: No
if "skip_playthrough" in argVars:
args.calc_playthrough = not args.skip_playthrough in truthy
# Don't do: No
# Do: Yes
if "calc_playthrough" in argVars:
args.skip_playthrough = not args.calc_playthrough in truthy
return args

View File

@@ -5,11 +5,11 @@
"type": "bool"
},
"create_spoiler": {
"action": "store_false",
"action": "store_true",
"type": "bool"
},
"suppress_spoiler": {
"action": "store_true",
"action": "store_false",
"dest": "create_spoiler",
"help": "suppress"
},
@@ -204,9 +204,14 @@
]
},
"hints": {
"action": "store_true",
"action": "store_false",
"type": "bool"
},
"no_hints": {
"action": "store_true",
"dest": "hints",
"help": "suppress"
},
"heartbeep": {
"choices": [
"normal",