from .generated import common_pb2 as common_pb2 from .generated import data_pb2 as data_pb2 import pkgutil class Lingo2StaticLogic: item_id_to_name: dict[int, str] location_id_to_name: dict[int, str] item_name_to_id: dict[str, int] location_name_to_id: dict[str, int] def __init__(self): self.item_id_to_name = {} self.location_id_to_name = {} file = pkgutil.get_data(__name__, "generated/data.binpb") self.objects = data_pb2.AllObjects() self.objects.ParseFromString(bytearray(file)) for door in self.objects.doors: if door.type == common_pb2.DoorType.STANDARD: location_name = f"{self.objects.maps[door.map_id].name} - {door.name}" self.location_id_to_name[door.ap_id] = location_name if door.type != common_pb2.DoorType.EVENT: item_name = f"{self.objects.maps[door.map_id].name} - {door.name}" self.item_id_to_name[door.ap_id] = item_name self.item_name_to_id = {name: ap_id for ap_id, name in self.item_id_to_name.items()} self.location_name_to_id = {name: ap_id for ap_id, name in self.location_id_to_name.items()}