From 1a5d22ca7890175275ef8b77c31cc0dce705d85a Mon Sep 17 00:00:00 2001 From: Benjamin S Wolf Date: Sat, 30 Nov 2024 19:51:26 -0800 Subject: [PATCH] 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> --- Options.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Options.py b/Options.py index 0d0e6ae1..d3b2e6c1 100644 --- a/Options.py +++ b/Options.py @@ -863,6 +863,8 @@ class ItemDict(OptionDict): verify_item_name = True 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()): raise Exception("Cannot have non-positive item counts.") super(ItemDict, self).__init__(value)