mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Core: Add new error message for item count when defined as a set instead of a dict (#4100)
* Core: New error message if item count is a set * Apply suggestion for error message Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> * Apply item count error suggestion Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com> --------- Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com>
This commit is contained in:
@@ -863,6 +863,8 @@ class ItemDict(OptionDict):
|
|||||||
verify_item_name = True
|
verify_item_name = True
|
||||||
|
|
||||||
def __init__(self, value: typing.Dict[str, int]):
|
def __init__(self, value: typing.Dict[str, int]):
|
||||||
|
if any(item_count is None for item_count in value.values()):
|
||||||
|
raise Exception("Items must have counts associated with them. Please provide positive integer values in the format \"item\": count .")
|
||||||
if any(item_count < 1 for item_count in value.values()):
|
if any(item_count < 1 for item_count in value.values()):
|
||||||
raise Exception("Cannot have non-positive item counts.")
|
raise Exception("Cannot have non-positive item counts.")
|
||||||
super(ItemDict, self).__init__(value)
|
super(ItemDict, self).__init__(value)
|
||||||
|
Reference in New Issue
Block a user