mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 16:02:20 +02:00
Create getShinyDescriptor function in utils
This commit is contained in:
parent
d69fc04188
commit
438c2cba39
@ -2,6 +2,7 @@ import { MoneyFormat } from "#enums/money-format";
|
|||||||
import { Moves } from "#enums/moves";
|
import { Moves } from "#enums/moves";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
||||||
|
import type { Variant } from "#app/sprites/variant";
|
||||||
|
|
||||||
export type nil = null | undefined;
|
export type nil = null | undefined;
|
||||||
|
|
||||||
@ -576,3 +577,18 @@ export function animationFileName(move: Moves): string {
|
|||||||
export function camelCaseToKebabCase(str: string): string {
|
export function camelCaseToKebabCase(str: string): string {
|
||||||
return str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (s, o) => (o ? "-" : "") + s.toLowerCase());
|
return str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (s, o) => (o ? "-" : "") + s.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get the localized shiny descriptor for the provided variant
|
||||||
|
* @param variant - The variant to get the shiny descriptor for
|
||||||
|
* @returns The localized shiny descriptor
|
||||||
|
*/
|
||||||
|
export function getShinyDescriptor(variant: Variant): string {
|
||||||
|
switch (variant) {
|
||||||
|
case 2:
|
||||||
|
return i18next.t("common:epicShiny");
|
||||||
|
case 1:
|
||||||
|
return i18next.t("common:shiny");
|
||||||
|
case 0:
|
||||||
|
return i18next.t("common:normal");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user