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

View File

@@ -249,43 +249,72 @@ def print_wiki_doors_by_region(d_regions, world, player):
f.write(toprint) f.write(toprint)
def update_deprecated_args(args): def update_deprecated_args(args):
argVars = vars(args) if args:
truthy = [ 1, True, "True", "true" ] argVars = vars(args)
# Don't do: Yes truthy = [ 1, True, "True", "true" ]
# Do: No # Hints default to TRUE
if "suppress_spoiler" in argVars: # Don't do: Yes
args.create_spoiler = args.suppress_spoiler not in truthy # Do: No
# Don't do: No if "no_hints" in argVars:
# Do: Yes src = "no_hints"
if "create_spoiler" in argVars: if isinstance(argVars["hints"],dict):
args.suppress_spoiler = not args.create_spoiler in truthy 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 # Spoiler defaults to FALSE
# Do: No # Don't do: No
if "suppress_rom" in argVars: # Do: Yes
args.create_rom = args.suppress_rom not in truthy if "create_spoiler" in argVars:
# Don't do: No args.suppress_spoiler = not args.create_spoiler in truthy
# Do: Yes # Don't do: Yes
if "create_rom" in argVars: # Do: No
args.suppress_rom = not args.create_rom in truthy if "suppress_spoiler" in argVars:
args.create_spoiler = not args.suppress_spoiler in truthy
# Don't do: Yes # ROM defaults to TRUE
# Do: No # Don't do: Yes
if "no_shuffleganon" in argVars: # Do: No
args.shuffleganon = not args.no_shuffleganon in truthy if "suppress_rom" in argVars:
# Don't do: No args.create_rom = not args.suppress_rom in truthy
# Do: Yes # Don't do: No
if "shuffleganon" in argVars: # Do: Yes
args.no_shuffleganon = not args.shuffleganon in truthy if "create_rom" in argVars:
args.suppress_rom = not args.create_rom in truthy
# Don't do: Yes # Shuffle Ganon defaults to TRUE
# Do: No # Don't do: Yes
if "skip_playthrough" in argVars: # Do: No
args.calc_playthrough = not args.skip_playthrough in truthy if "no_shuffleganon" in argVars:
# Don't do: No args.shuffleganon = not args.no_shuffleganon in truthy
# Do: Yes # Don't do: No
if "calc_playthrough" in argVars: # Do: Yes
args.skip_playthrough = not args.calc_playthrough in truthy 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 return args

View File

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