Source code for baclassic._chest

# Released under the MIT License. See LICENSE for details.
#
"""Chest related functionality."""

from __future__ import annotations

from dataclasses import dataclass
from typing import TYPE_CHECKING

from bacommon.classic import ClassicChestAppearance

if TYPE_CHECKING:
    pass


[docs] @dataclass class ChestAppearanceDisplayInfo: """Info about how to locally display chest appearances.""" # NOTE TO SELF: Don't rename these attrs; the C++ layer is hard # coded to look for them. texclosed: str texclosedtint: str texopen: str texopentint: str color: tuple[float, float, float] tint: tuple[float, float, float] tint2: tuple[float, float, float]
#: Fallback :class:`ChestAppearanceDisplayInfo` used when a chest's #: declared appearance has no entry in #: :data:`CHEST_APPEARANCE_DISPLAY_INFOS`. CHEST_APPEARANCE_DISPLAY_INFO_DEFAULT = ChestAppearanceDisplayInfo( texclosed='chestIcon', texclosedtint='chestIconTint', texopen='chestOpenIcon', texopentint='chestOpenIconTint', color=(1, 1, 1), tint=(1, 1, 1), tint2=(1, 1, 1), ) #: Per-:class:`ClassicChestAppearance` rendering info for chests #: the engine knows how to draw. Entries absent here fall back to #: :data:`CHEST_APPEARANCE_DISPLAY_INFO_DEFAULT`. CHEST_APPEARANCE_DISPLAY_INFOS: dict[ ClassicChestAppearance, ChestAppearanceDisplayInfo ] = { ClassicChestAppearance.L2: ChestAppearanceDisplayInfo( texclosed='chestIcon', texclosedtint='chestIconTint', texopen='chestOpenIcon', texopentint='chestOpenIconTint', color=(0.8, 1.0, 0.93), tint=(0.65, 1.0, 0.8), tint2=(0.65, 1.0, 0.8), ), ClassicChestAppearance.L3: ChestAppearanceDisplayInfo( texclosed='chestIcon', texclosedtint='chestIconTint', texopen='chestOpenIcon', texopentint='chestOpenIconTint', color=(0.75, 0.9, 1.3), tint=(0.7, 1, 1.9), tint2=(0.7, 1, 1.9), ), ClassicChestAppearance.L4: ChestAppearanceDisplayInfo( texclosed='chestIcon', texclosedtint='chestIconTint', texopen='chestOpenIcon', texopentint='chestOpenIconTint', color=(0.7, 1.0, 1.4), tint=(1.4, 1.6, 2.0), tint2=(1.4, 1.6, 2.0), ), ClassicChestAppearance.L5: ChestAppearanceDisplayInfo( texclosed='chestIcon', texclosedtint='chestIconTint', texopen='chestOpenIcon', texopentint='chestOpenIconTint', color=(0.75, 0.5, 2.4), tint=(1.0, 0.8, 0.0), tint2=(1.0, 0.8, 0.0), ), ClassicChestAppearance.L6: ChestAppearanceDisplayInfo( texclosed='chestIcon', texclosedtint='chestIconTint', texopen='chestOpenIcon', texopentint='chestOpenIconTint', color=(1.1, 0.8, 0.0), tint=(2, 2, 2), tint2=(2, 2, 2), ), } # Docs-generation hack; import some stuff that we likely only forward-declared # in our actual source code so that docs tools can find it. from typing import (Coroutine, Any, Literal, Callable, Generator, Awaitable, Sequence, Self) import asyncio from concurrent.futures import Future from pathlib import Path from enum import Enum