Merge branch 'main' into multishop
This commit is contained in:
commit
2b730ab1d4
|
@ -1471,16 +1471,16 @@ class PlandoItem(NamedTuple):
|
||||||
location: str
|
location: str
|
||||||
world: Union[bool, str] = False # False -> own world, True -> not own world
|
world: Union[bool, str] = False # False -> own world, True -> not own world
|
||||||
from_pool: bool = True # if item should be removed from item pool
|
from_pool: bool = True # if item should be removed from item pool
|
||||||
force: Union[bool, str] = 'silent' # False -> warns if item not successfully placed. True -> errors out on failure to place item.
|
force: str = 'silent' # false -> warns if item not successfully placed. true -> errors out on failure to place item.
|
||||||
|
|
||||||
def warn(self, warning: str):
|
def warn(self, warning: str):
|
||||||
if str(self.force).lower() in ['true', 'fail', 'failure', 'none', 'false', 'warn', 'warning']:
|
if self.force in ['true', 'fail', 'failure', 'none', 'false', 'warn', 'warning']:
|
||||||
logging.warning(f'{warning}')
|
logging.warning(f'{warning}')
|
||||||
else:
|
else:
|
||||||
logging.debug(f'{warning}')
|
logging.debug(f'{warning}')
|
||||||
|
|
||||||
def failed(self, warning: str, exception=Exception):
|
def failed(self, warning: str, exception=Exception):
|
||||||
if str(self.force).lower() in ['true', 'fail', 'failure']:
|
if self.force in ['true', 'fail', 'failure']:
|
||||||
raise exception(warning)
|
raise exception(warning)
|
||||||
else:
|
else:
|
||||||
self.warn(warning)
|
self.warn(warning)
|
||||||
|
|
|
@ -576,7 +576,7 @@ def roll_settings(weights, plando_options: typing.Set[str] = frozenset(("bosses"
|
||||||
if roll_percentage(get_choice("percentage", placement, 100)):
|
if roll_percentage(get_choice("percentage", placement, 100)):
|
||||||
from_pool = get_choice("from_pool", placement, PlandoItem.from_pool)
|
from_pool = get_choice("from_pool", placement, PlandoItem.from_pool)
|
||||||
location_world = get_choice("world", placement, PlandoItem.world)
|
location_world = get_choice("world", placement, PlandoItem.world)
|
||||||
force = get_choice("force", placement, PlandoItem.force)
|
force = str(get_choice("force", placement, PlandoItem.force)).lower()
|
||||||
if "items" in placement and "locations" in placement:
|
if "items" in placement and "locations" in placement:
|
||||||
items = placement["items"]
|
items = placement["items"]
|
||||||
locations = placement["locations"]
|
locations = placement["locations"]
|
||||||
|
|
|
@ -49,7 +49,7 @@ boss_shuffle:
|
||||||
|
|
||||||
### Items
|
### Items
|
||||||
- This module is disabled by default.
|
- This module is disabled by default.
|
||||||
- Has the options from_pool, world, percentage and either item and location or items and locations
|
- Has the options from_pool, world, percentage, force and either item and location or items and locations
|
||||||
- All of these options support subweights
|
- All of these options support subweights
|
||||||
- percentage is the percentage chance for this block to trigger
|
- percentage is the percentage chance for this block to trigger
|
||||||
- is a number in the range [0, 100], can be omitted entirely for 100%
|
- is a number in the range [0, 100], can be omitted entirely for 100%
|
||||||
|
@ -62,6 +62,10 @@ boss_shuffle:
|
||||||
- can be true, to target any other player's world
|
- can be true, to target any other player's world
|
||||||
- can be false, to target own world and is the default
|
- can be false, to target own world and is the default
|
||||||
- can be null, to target a random world
|
- can be null, to target a random world
|
||||||
|
- force is either "silent", "true" or "false".
|
||||||
|
- "true" means the item has to be placed, or the generator aborts with an exception.
|
||||||
|
- "false" means the generator logs a warning if the placement can't be done.
|
||||||
|
- "silent" means that this entry is entirely ignored if the placement fails and is the default.
|
||||||
- Single Placement
|
- Single Placement
|
||||||
- place a single item at a single location
|
- place a single item at a single location
|
||||||
- item denotes the Item to place
|
- item denotes the Item to place
|
||||||
|
|
Loading…
Reference in New Issue