Files
2026-11-23 23:55:37 +07:00

194 lines
6.8 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** Display metadata only. The engine remains authoritative for costs and targets. */
type Family = "movement" | "weather" | "incident" | "special";
type Face = [string, string, Family, string];
const faces: Record<string, Face> = {
A: [
"Подготовка к вылету",
"Boarding",
"movement",
"Выведите борт из ангара на свободную стоянку A.",
],
B: [
"Буксировка и запуск",
"Push and Start",
"movement",
"Переведите борт с обычной стоянки A на свободную позицию B.",
],
C: [
"Запуск двигателей",
"Start Up",
"movement",
"На стоянке A/C переведите борт с позиции A на C.",
],
D: [
"Отправление на полосу",
"Departure",
"movement",
"Переведите борт с B или C в очередь выбранной ВПП.",
],
LC: [
"Счастливый капитан",
"Lucky Captain",
"special",
"Заменяет одну карту A, B, C или D при оплате движения.",
],
VIP: [
"Обслуживание VIP",
"VIP",
"special",
"Направьте один борт из ангара или с A, B, C на свободную ветку VIP.",
],
AI: [
"Противообледенительная обработка",
"Anti-Icing",
"special",
"При обледенении обработайте борт на старте. Нужно 1–3 карты по размеру.",
],
FLR: [
"Техническая неисправность",
"Failure",
"incident",
"Верните борт соперника с поля в ангар. При открытом доборе действует на свой борт.",
],
DLY: [
"Задержка рейса",
"Delay",
"incident",
"Возврат с A, B, C или VIP в ангар. При розыгрыше цель чужая, при обмене — своя.",
],
SC: [
"Чистое небо",
"Sky Clear",
"weather",
"Вылет разрешён всем типам самолётов с обеих полос.",
],
FG: [
"Туман",
"Fog",
"weather",
"Вылеты и продвижение очередей на обеих полосах приостановлены.",
],
SN: [
"Снег",
"Snow",
"weather",
"Движение стоит на карту больше. Широкофюзеляжные борта не взлетают.",
],
CW: [
"Боковой ветер",
"Crosswind",
"weather",
"Малым самолётам вылет запрещён. При очереди борт уступает старт.",
],
ICE: [
"Обледенение",
"Ice",
"weather",
"Для вылета требуется противообледенительная обработка.",
],
"31L": [
"Левая полоса закрыта",
"31L Closed",
"weather",
"Вылет и продвижение очереди на ВПП 31L приостановлены.",
],
"31R": [
"Правая полоса закрыта",
"31R Closed",
"weather",
"Вылет и продвижение очереди на ВПП 31R приостановлены.",
],
};
const families = {
movement: "Движение",
weather: "Погода",
incident: "Неприятность",
special: "Специальная",
};
const line = (d: string) => '<path d="' + d + '"/>';
const cloud =
'<path d="M28 31h32a7 7 0 0 0 0-14 12 12 0 0 0-22-2 8 8 0 1 0-10 16Z"/>';
const snowflake = line(
"M44 7v33m-14-25 28 17m0-17L30 32m10-22 4 4 4-4m0 27-4-4-4 4m-9-17 6-1-1-6m20 15-6 1 1 6m-20-7 6 1-1 6m20-15-6-1 1-6",
);
const nose = line(
"M20 28l31-5 16-9q7-2 3 4L57 31l-32 3-10-8 5-2z M43 24l-6-11 5-2 12 12",
);
const icons: Record<string, string> = {
A:
line(
"M13 36h21l20-22h12v-5H51L29 31H13z M31 29h7m-2-7h8m-3-6h8 M19 32v-6",
) + '<circle cx="24" cy="39" r="3"/><circle cx="48" cy="34" r="3"/>',
B:
line("M15 31v-9h10l4-8h12l4 11h9v7H15zm13-8h12l-3-6h-6z M55 28h11l8-11") +
'<circle cx="23" cy="33" r="4"/><circle cx="45" cy="33" r="4"/>',
C:
'<circle cx="44" cy="24" r="17"/><circle cx="44" cy="24" r="4"/>' +
Array.from(
{ length: 8 },
(_, i) =>
`<path d="M45 20q8-4 6-9" transform="rotate(${45 * i} 44 24)"/>`,
).join(""),
D: nose + line("M12 40h58m-49-4 8-1m3-1 7-1"),
LC:
line(
"M17 18l27-9 27 9-11 7-16-4-16 4z M29 26v5q13 10 30 0v-5 M36 24l8 3 8-3",
) + '<circle cx="44" cy="17" r="3"/>',
VIP:
line("M20 14l12 7 12-12 12 12 12-7-5 20H25z M26 39h37") +
'<circle cx="44" cy="27" r="2"/>',
AI:
line(
"M15 33h35v-8H35l-3-9H21v11h-6z M38 24l12-16 12 4-2 4-8-2-7 11 M65 16l7 3m-9 0 7 5m-10-3 5 7",
) + '<circle cx="23" cy="35" r="4"/><circle cx="43" cy="35" r="4"/>',
FLR: line(
"M26 37l17-16a12 12 0 0 1 15-14l-8 9 6 5 9-8a12 12 0 0 1-17 14L31 42Z",
),
DLY:
'<circle cx="44" cy="25" r="16"/>' +
line("M44 14v12l8 4m-12-25h8m-4 0v3 M22 17h-8m7 8H9m15 8H13"),
SC:
'<circle cx="44" cy="24" r="9"/>' +
line(
"M44 4v6m0 28v6M24 24h6m28 0h6M30 10l4 4m20 20 4 4m0-28-4 4m-20 20-4 4",
),
FG: cloud + line("M15 33h34m6 0h18m-52 5h44m-38 5h18m6 0h13"),
SN:
cloud +
line(
"M33 35v7m-3-5 6 3m0-3-6 3m15-5v6m-3-4 6 2m0-2-6 2m15-6v7m-3-5 6 3m0-3-6 3",
),
CW: line(
"M27 40V8m0 4 37 5-4 11-33-6z M39 14l-2 10m12-9-2 11m12-10-2 11 M14 15h7m-10 7h10m47 0h10",
),
ICE: snowflake,
};
for (const code of ["31L", "31R"])
icons[code] =
line("M20 10h46v28H20z M25 13v22m36-22v22m-24-19 14 16m0-16L37 32") +
`<text x="73" y="36" fill="currentColor" stroke="none" font-size="12">${code.slice(-1)}</text>`;
export function cardLabel(code: string) {
return faces[code]?.[0] || code;
}
export function cardCaption(code: string) {
return code + " · " + cardLabel(code);
}
export function cardFace(
code: string,
index: number,
selectable: boolean,
selected: boolean,
) {
const [title, english, family, effect] = faces[code];
const tag = selectable ? "button" : "div";
const action = selectable
? `type="button" data-act="card" data-val="${index}" aria-pressed="${selected}"`
: "";
return `<${tag} class="flight-card fc-${family}${selected ? " chosen" : ""}" ${action} data-code="${code}">
<span class="fc-head"><b>${code}</b><span>${families[family]}</span></span>
<svg viewBox="0 0 88 48" aria-hidden="true" class="fc-art"><g stroke="currentColor" stroke-width="2" fill="none" stroke-linejoin="round" stroke-linecap="round">${icons[code]}</g></svg>
<span class="fc-title">${title}</span><span class="fc-en" lang="en">${english}</span>
<span class="fc-effect">${effect}</span></${tag}>`;
}