From 00d766777114c57a2c2fd919ef8640237f6a3df8 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sun, 7 Jun 2020 00:19:19 +0200 Subject: [PATCH] extend hint system with group names --- MultiServer.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/MultiServer.py b/MultiServer.py index 74adb576..f778d1e2 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -27,7 +27,7 @@ import Utils from Utils import get_item_name_from_id, get_location_name_from_address, ReceivedItem from NetUtils import Node, Endpoint -console_names = frozenset(set(Items.item_table) | set(Regions.location_table)) +console_names = frozenset(set(Items.item_table) | set(Regions.location_table) | set(Items.item_name_groups)) CLIENT_PLAYING = 0 CLIENT_GOAL = 1 @@ -668,6 +668,10 @@ class ClientMessageProcessor(CommandProcessor): if item_name in Items.hint_blacklist: self.output(f"Sorry, \"{item_name}\" is marked as non-hintable.") hints = [] + elif item_name in Items.item_name_groups: + hints = [] + for item in Items.item_name_groups[item_name]: + hints.extend(collect_hints(self.ctx, self.client.team, self.client.slot, item)) elif item_name in Items.item_table: # item name hints = collect_hints(self.ctx, self.client.team, self.client.slot, item_name) else: # location name @@ -929,12 +933,15 @@ class ServerCommandProcessor(CommandProcessor): item = " ".join(item_or_location) item, usable, response = get_intended_text(item) if usable: - if item in Items.item_table: # item name + if item in Items.item_name_groups: + hints = [] + for item in Items.item_name_groups[item]: + hints.extend(collect_hints(self.ctx, team, slot, item)) + elif item in Items.item_table: # item name hints = collect_hints(self.ctx, team, slot, item) - notify_hints(self.ctx, team, hints) else: # location name hints = collect_hints_location(self.ctx, team, slot, item) - notify_hints(self.ctx, team, hints) + notify_hints(self.ctx, team, hints) return True else: self.output(response)