2026-02-20 08:16:43 -05:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from dataclasses import dataclass
|
|
|
|
|
from typing import Literal
|
|
|
|
|
|
2026-02-21 16:01:40 -05:00
|
|
|
ItemType = Literal["radio_station", "dice", "wheel", "clock"]
|
|
|
|
|
CLOCK_DEFAULT_TIME_ZONE = "America/Detroit"
|
|
|
|
|
CLOCK_TIME_ZONE_OPTIONS: tuple[str, ...] = (
|
2026-02-21 16:04:55 -05:00
|
|
|
"America/Anchorage",
|
|
|
|
|
"America/Argentina/Buenos_Aires",
|
|
|
|
|
"America/Chicago",
|
2026-02-21 16:01:40 -05:00
|
|
|
"America/Detroit",
|
|
|
|
|
"America/Indiana/Indianapolis",
|
2026-02-21 16:04:55 -05:00
|
|
|
"America/Halifax",
|
|
|
|
|
"America/Los_Angeles",
|
|
|
|
|
"America/St_Johns",
|
|
|
|
|
"Asia/Bangkok",
|
|
|
|
|
"Asia/Dhaka",
|
|
|
|
|
"Asia/Dubai",
|
|
|
|
|
"Asia/Hong_Kong",
|
|
|
|
|
"Asia/Kabul",
|
|
|
|
|
"Asia/Karachi",
|
|
|
|
|
"Asia/Kathmandu",
|
|
|
|
|
"Asia/Kolkata",
|
|
|
|
|
"Asia/Seoul",
|
|
|
|
|
"Asia/Singapore",
|
|
|
|
|
"Asia/Tehran",
|
|
|
|
|
"Asia/Tokyo",
|
|
|
|
|
"Asia/Yangon",
|
|
|
|
|
"Atlantic/Azores",
|
|
|
|
|
"Atlantic/South_Georgia",
|
|
|
|
|
"Australia/Brisbane",
|
|
|
|
|
"Australia/Darwin",
|
|
|
|
|
"Australia/Eucla",
|
|
|
|
|
"Australia/Lord_Howe",
|
|
|
|
|
"Europe/Berlin",
|
|
|
|
|
"Europe/Helsinki",
|
2026-02-21 16:01:40 -05:00
|
|
|
"America/Kentucky/Louisville",
|
2026-02-21 16:04:55 -05:00
|
|
|
"Europe/London",
|
|
|
|
|
"Europe/Moscow",
|
|
|
|
|
"Pacific/Auckland",
|
|
|
|
|
"Pacific/Chatham",
|
|
|
|
|
"Pacific/Honolulu",
|
|
|
|
|
"Pacific/Kiritimati",
|
|
|
|
|
"Pacific/Noumea",
|
|
|
|
|
"Pacific/Pago_Pago",
|
|
|
|
|
"Pacific/Apia",
|
|
|
|
|
"UTC",
|
2026-02-21 16:01:40 -05:00
|
|
|
)
|
2026-02-20 08:16:43 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
|
|
|
class ItemDefinition:
|
|
|
|
|
default_title: str
|
|
|
|
|
capabilities: tuple[str, ...]
|
2026-02-21 16:13:48 -05:00
|
|
|
use_sound: str | None
|
2026-02-21 16:01:40 -05:00
|
|
|
emit_sound: str | None
|
2026-02-20 08:16:43 -05:00
|
|
|
default_params: dict
|
2026-02-20 16:47:11 -05:00
|
|
|
use_cooldown_ms: int = 1000
|
2026-02-20 08:16:43 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
ITEM_DEFINITIONS: dict[ItemType, ItemDefinition] = {
|
|
|
|
|
"radio_station": ItemDefinition(
|
|
|
|
|
default_title="radio",
|
2026-02-21 01:11:08 -05:00
|
|
|
capabilities=("editable", "carryable", "deletable", "usable"),
|
2026-02-21 16:13:48 -05:00
|
|
|
use_sound=None,
|
2026-02-21 16:01:40 -05:00
|
|
|
emit_sound=None,
|
2026-02-21 01:48:20 -05:00
|
|
|
default_params={"streamUrl": "", "enabled": True, "channel": "stereo", "volume": 50, "effect": "off", "effectValue": 50},
|
2026-02-20 08:16:43 -05:00
|
|
|
),
|
|
|
|
|
"dice": ItemDefinition(
|
|
|
|
|
default_title="Dice",
|
|
|
|
|
capabilities=("editable", "carryable", "deletable", "usable"),
|
2026-02-21 16:13:48 -05:00
|
|
|
use_sound="sounds/roll.ogg",
|
|
|
|
|
emit_sound=None,
|
2026-02-20 08:16:43 -05:00
|
|
|
default_params={"sides": 6, "number": 2},
|
|
|
|
|
),
|
2026-02-21 00:55:19 -05:00
|
|
|
"wheel": ItemDefinition(
|
|
|
|
|
default_title="wheel",
|
|
|
|
|
capabilities=("editable", "carryable", "deletable", "usable"),
|
2026-02-21 16:13:48 -05:00
|
|
|
use_sound="sounds/spin.ogg",
|
|
|
|
|
emit_sound=None,
|
2026-02-21 00:55:19 -05:00
|
|
|
default_params={"spaces": "yes, no"},
|
|
|
|
|
use_cooldown_ms=4000,
|
|
|
|
|
),
|
2026-02-21 16:01:40 -05:00
|
|
|
"clock": ItemDefinition(
|
|
|
|
|
default_title="clock",
|
|
|
|
|
capabilities=("editable", "carryable", "deletable", "usable"),
|
2026-02-21 16:13:48 -05:00
|
|
|
use_sound=None,
|
2026-02-21 16:01:40 -05:00
|
|
|
emit_sound="sounds/clock.ogg",
|
|
|
|
|
default_params={"timeZone": CLOCK_DEFAULT_TIME_ZONE, "use24Hour": False},
|
|
|
|
|
),
|
2026-02-20 08:16:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_item_definition(item_type: ItemType) -> ItemDefinition:
|
|
|
|
|
return ITEM_DEFINITIONS[item_type]
|
2026-02-20 16:47:11 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_item_use_cooldown_ms(item_type: ItemType) -> int:
|
|
|
|
|
definition = get_item_definition(item_type)
|
|
|
|
|
cooldown_ms = definition.use_cooldown_ms
|
|
|
|
|
if isinstance(cooldown_ms, int) and cooldown_ms > 0:
|
|
|
|
|
return cooldown_ms
|
|
|
|
|
return 1000
|