breakout71/src/help.ts

51 lines
1.3 KiB
TypeScript
Raw Normal View History

2025-03-31 20:13:47 +02:00
import { allLevels, icons, upgrades } from "./loadGameData";
import { t } from "./i18n/i18n";
import { asyncAlert } from "./asyncAlert";
import { miniMarkDown } from "./pure_functions";
2025-03-31 20:08:17 +02:00
export function helpMenuEntry() {
2025-03-31 20:13:47 +02:00
return {
icon: icons["icon:help"],
text: t("main_menu.help_title"),
help: t("main_menu.help_help"),
async value() {
await asyncAlert({
title: t("main_menu.help_title"),
allowClose: true,
content: [
miniMarkDown(t("main_menu.help_content")),
t("main_menu.help_upgrades"),
...upgrades.map(
(u) => `
2025-03-31 20:08:17 +02:00
<div class="upgrade used">
${u.icon}
<p>
<strong>${u.name}</strong><br/>
${u.help(1)}
</p>
</div>
${miniMarkDown(u.fullHelp)}
2025-03-31 20:13:47 +02:00
`,
),
miniMarkDown(t("main_menu.credits")),
2025-03-31 20:08:17 +02:00
2025-03-31 20:13:47 +02:00
t("main_menu.credit_levels"),
...allLevels
.filter((l) => l.credit?.startsWith("http"))
.map(
(l) => `
2025-03-31 20:08:17 +02:00
<div class="upgrade used">
${icons[l.name]}
<p>
<strong>${l.name}</strong><br/>
<a href="${l.credit}" target="_blank">${l.credit}</a>
</p>
2025-03-31 20:13:47 +02:00
</div>`,
),
],
});
},
};
2025-03-31 20:08:17 +02:00
}