blob: a3b86bf8277e6c42859c46779cc866a4d3ee1318 (
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
|
from .generated import common_pb2 as common_pb2
from typing import TYPE_CHECKING, NamedTuple
if TYPE_CHECKING:
from . import Lingo2World
class PlayerLocation(NamedTuple):
code: int | None
class Lingo2PlayerLogic:
locations_by_room: dict[int, list[PlayerLocation]]
def __init__(self, world: "Lingo2World"):
self.locations_by_room = {}
for door in world.static_logic.objects.doors:
if door.type in [common_pb2.DoorType.STANDARD, common_pb2.DoorType.LOCATION_ONLY]:
self.locations_by_room.setdefault(door.room_id, []).append(PlayerLocation(door.ap_id))
for letter in world.static_logic.objects.letters:
self.locations_by_room.setdefault(letter.room_id, []).append(PlayerLocation(letter.ap_id))
for mastery in world.static_logic.objects.masteries:
self.locations_by_room.setdefault(mastery.room_id, []).append(PlayerLocation(mastery.ap_id))
|