blob: d3ed85c1d46f4eed002cea6332166cfccfbedea1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
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.rooms[door.room_id].display_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.rooms[door.room_id].display_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()}
|