Mystery: weights can now specify a default value for convenience, eg:
dungeon_items: full startinventory: Pegasus Boots: on
This commit is contained in:
parent
7d05d697dd
commit
48305adaa0
|
@ -110,6 +110,10 @@ def get_weights(path):
|
||||||
|
|
||||||
def roll_settings(weights):
|
def roll_settings(weights):
|
||||||
def get_choice(option, root=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("'",'')
|
return random.choices(list(root[option].keys()), weights=list(map(int,root[option].values())))[0].replace('"','').replace("'",'')
|
||||||
|
|
||||||
ret = argparse.Namespace()
|
ret = argparse.Namespace()
|
||||||
|
|
Loading…
Reference in New Issue