2023-11-08 23:35:12 +00:00
|
|
|
from enum import Flag, auto
|
|
|
|
from typing import Dict, List, NamedTuple
|
|
|
|
|
|
|
|
from BaseClasses import Location
|
2024-03-15 08:26:00 +00:00
|
|
|
from .datatypes import RoomAndPanel
|
|
|
|
from .static_logic import DOORS_BY_ROOM, PANELS_BY_ROOM, get_door_location_id, get_panel_location_id
|
2023-11-08 23:35:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
class LocationClassification(Flag):
|
|
|
|
normal = auto()
|
|
|
|
reduced = auto()
|
|
|
|
insanity = auto()
|
2024-05-02 07:52:16 +00:00
|
|
|
small_sphere_one = auto()
|
2023-11-08 23:35:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
class LocationData(NamedTuple):
|
|
|
|
"""
|
|
|
|
LocationData for a location in Lingo
|
|
|
|
"""
|
|
|
|
code: int
|
|
|
|
room: str
|
|
|
|
panels: List[RoomAndPanel]
|
|
|
|
classification: LocationClassification
|
|
|
|
|
|
|
|
|
|
|
|
class LingoLocation(Location):
|
|
|
|
"""
|
|
|
|
Location from the game Lingo
|
|
|
|
"""
|
|
|
|
game: str = "Lingo"
|
|
|
|
|
|
|
|
|
|
|
|
ALL_LOCATION_TABLE: Dict[str, LocationData] = {}
|
2024-03-21 15:46:53 +00:00
|
|
|
LOCATIONS_BY_GROUP: Dict[str, List[str]] = {}
|
2023-11-08 23:35:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
def load_location_data():
|
2024-03-21 15:46:53 +00:00
|
|
|
global ALL_LOCATION_TABLE, LOCATIONS_BY_GROUP
|
2023-11-08 23:35:12 +00:00
|
|
|
|
|
|
|
for room_name, panels in PANELS_BY_ROOM.items():
|
|
|
|
for panel_name, panel in panels.items():
|
2024-05-23 00:09:52 +00:00
|
|
|
location_name = f"{room_name} - {panel_name}" if panel.location_name is None else panel.location_name
|
2023-11-08 23:35:12 +00:00
|
|
|
|
|
|
|
classification = LocationClassification.insanity
|
|
|
|
if panel.check:
|
|
|
|
classification |= LocationClassification.normal
|
|
|
|
|
|
|
|
if not panel.exclude_reduce:
|
|
|
|
classification |= LocationClassification.reduced
|
|
|
|
|
2024-05-02 07:52:16 +00:00
|
|
|
if room_name == "Starting Room":
|
|
|
|
classification |= LocationClassification.small_sphere_one
|
|
|
|
|
2023-11-08 23:35:12 +00:00
|
|
|
ALL_LOCATION_TABLE[location_name] = \
|
|
|
|
LocationData(get_panel_location_id(room_name, panel_name), room_name,
|
|
|
|
[RoomAndPanel(None, panel_name)], classification)
|
|
|
|
|
2024-03-21 15:46:53 +00:00
|
|
|
if panel.achievement:
|
|
|
|
LOCATIONS_BY_GROUP.setdefault("Achievements", []).append(location_name)
|
|
|
|
|
2023-11-08 23:35:12 +00:00
|
|
|
for room_name, doors in DOORS_BY_ROOM.items():
|
|
|
|
for door_name, door in doors.items():
|
Lingo: The Pilgrim Update (#2884)
* An option was added to enable or disable the pilgrimage, and it defaults to disabled. When disabled, the client will prevent you from performing a pilgrimage (i.e. the yellow border will not appear when you enter the 1 sunwarp). The sun painting is added to the item pool when pilgrimage is disabled, as otherwise there is no way into the Pilgrim Antechamber. Inversely, the sun painting is no longer in the item pool when pilgrimage is enabled (even if door shuffle is on), requiring you to perform a pilgrimage to get to that room.
* The canonical pilgrimage has been deprecated. Instead, there is logic for determining whether a pilgrimage is possible.
* Two options were added that allow the player to decide whether paintings and/or Crossroads - Roof Access are permitted during the pilgrimage. Both default to disabled. These options apply both to logical expectations in the generator, and are also enforced by the game client.
* An option was added to control how sunwarps are accessed. The default is for them to always be accessible, like in the base game. It is also possible to disable them entirely (which is not possible when pilgrimage is enabled), or lock them behind items similar to door shuffle. It can either be one item that unlocks all sunwarps at the same time, six progressive items that unlock the sunwarps from 1 to 6, or six individual items that unlock the sunwarps in any order. This option is independent from door shuffle.
* An option was added that shuffles sunwarps. This acts similarly to painting shuffle. The 12 sunwarps are re-ordered and re-paired. Sunwarps that were previously entrances or exits do not need to stay entrances or exits. Performing a pilgrimage requires proceeding through the sunwarps in the new order, rather than the original one.
* Pilgrimage was added as a win condition. It requires you to solve the blue PILGRIM panel in the Pilgrim Antechamber.
2024-04-18 16:45:33 +00:00
|
|
|
if door.skip_location or door.event or not door.panels:
|
2023-11-08 23:35:12 +00:00
|
|
|
continue
|
|
|
|
|
|
|
|
location_name = door.location_name
|
|
|
|
classification = LocationClassification.normal
|
|
|
|
if door.include_reduce:
|
|
|
|
classification |= LocationClassification.reduced
|
|
|
|
|
|
|
|
if location_name in ALL_LOCATION_TABLE:
|
|
|
|
new_id = ALL_LOCATION_TABLE[location_name].code
|
|
|
|
classification |= ALL_LOCATION_TABLE[location_name].classification
|
|
|
|
else:
|
|
|
|
new_id = get_door_location_id(room_name, door_name)
|
|
|
|
|
|
|
|
ALL_LOCATION_TABLE[location_name] = LocationData(new_id, room_name, door.panels, classification)
|
|
|
|
|
|
|
|
|
|
|
|
# Initialize location data on the module scope.
|
|
|
|
load_location_data()
|