51 lines
2.3 KiB
TypeScript
51 lines
2.3 KiB
TypeScript
export function normalizedKey(value: string): string {
|
|
return value.normalize("NFKD").replace(/[^a-zA-Z]/gu, "").toLowerCase();
|
|
}
|
|
|
|
export function gcsimKey(kind: "character" | "weapon" | "artifact", name: string, element?: string | null, id?: string): string {
|
|
if (kind === "character" && (id?.startsWith("traveler_") || name === "Traveler")) {
|
|
return `aether${element?.toLowerCase() ?? ""}`;
|
|
}
|
|
return normalizedKey(name);
|
|
}
|
|
|
|
const characterAliases: Record<string, string> = {
|
|
ayaka: "kamisatoayaka", ayato: "kamisatoayato", kazuha: "kaedeharakazuha", kaz: "kaedeharakazuha",
|
|
raiden: "raidenshogun", baal: "raidenshogun", kokomi: "sangonomiyakokomi", sara: "kujousara",
|
|
childe: "tartaglia", hutao: "hutao", itto: "aratakiitto", heizou: "shikanoinheizou", shinobu: "kukishinobu",
|
|
kuki: "kukishinobu", yae: "yaemiko", miko: "yaemiko", mav: "mavuika",
|
|
};
|
|
|
|
export function canonicalCharacterKey(key: string): string {
|
|
const normalized = normalizedKey(key);
|
|
return characterAliases[normalized] ?? normalized;
|
|
}
|
|
|
|
// Documented gcsim names: https://docs.gcsim.app/reference/weapons/favoniussword/
|
|
// https://docs.gcsim.app/reference/weapons/thrillingtalesofdragonslayers/
|
|
const weaponAliases: Record<string, string> = {
|
|
favsword: "favoniussword", favgs: "favoniusgreatsword", favbow: "favoniuswarbow",
|
|
favlance: "favoniuslance", favspear: "favoniuslance", favcodex: "favoniuscodex",
|
|
ttds: "thrillingtalesofdragonslayers",
|
|
};
|
|
|
|
export function canonicalWeaponKey(key: string): string {
|
|
const normalized = normalizedKey(key);
|
|
return weaponAliases[normalized] ?? normalized;
|
|
}
|
|
|
|
// Documented gcsim names: https://docs.gcsim.app/reference/artifacts/tenacityofthemillelith/
|
|
// https://docs.gcsim.app/reference/artifacts/noblesseoblige/
|
|
// https://docs.gcsim.app/reference/artifacts/scrolloftheheroofcindercity/
|
|
const artifactAliases: Record<string, string> = {
|
|
totm: "tenacityofthemillelith", tom: "tenacityofthemillelith",
|
|
tenacity: "tenacityofthemillelith", millelith: "tenacityofthemillelith",
|
|
no: "noblesseoblige", noblesse: "noblesseoblige",
|
|
scroll: "scrolloftheheroofcindercity", sothocc: "scrolloftheheroofcindercity",
|
|
};
|
|
|
|
export function canonicalArtifactKey(key: string): string {
|
|
const normalized = normalizedKey(key);
|
|
return artifactAliases[normalized] ?? normalized;
|
|
}
|