From 48305adaa08f808316230e230e37af41791769a4 Mon Sep 17 00:00:00 2001 From: Bonta-kun <40473493+Bonta0@users.noreply.github.com> Date: Mon, 6 Jan 2020 20:01:03 +0100 Subject: [PATCH] Mystery: weights can now specify a default value for convenience, eg: dungeon_items: full startinventory: Pegasus Boots: on --- Mystery.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Mystery.py b/Mystery.py index e19a5203..298b9217 100644 --- a/Mystery.py +++ b/Mystery.py @@ -110,6 +110,10 @@ def get_weights(path): def roll_settings(weights): def get_choice(option, root=weights): + if type(root[option]) is not dict: + return root[option] + if not root[option]: + return None return random.choices(list(root[option].keys()), weights=list(map(int,root[option].values())))[0].replace('"','').replace("'",'') ret = argparse.Namespace()