Refactor battlesuits data
This commit is contained in:
@@ -1,14 +1,12 @@
|
|||||||
/** @jsxImportSource theme-ui */
|
/** @jsxImportSource theme-ui */
|
||||||
import { Box, Card, Text, Flex } from '@theme-ui/components'
|
import { Box, Card, Text, Flex } from '@theme-ui/components'
|
||||||
import { useRouter } from 'next/router'
|
|
||||||
import { assetsBucketBaseUrl } from '../../lib/consts'
|
import { assetsBucketBaseUrl } from '../../lib/consts'
|
||||||
import { BattlesuitData } from '../../lib/honkai3rd/battlesuits'
|
import { BattlesuitData } from '../../lib/honkai3rd/battlesuits'
|
||||||
import { translate } from '../../lib/i18n'
|
|
||||||
import PageLink from '../atoms/PageLink'
|
import PageLink from '../atoms/PageLink'
|
||||||
import SquareImageBox from '../atoms/SquareImageBox'
|
import SquareImageBox from '../atoms/SquareImageBox'
|
||||||
|
|
||||||
interface BattlesuitCardProps {
|
interface BattlesuitCardProps {
|
||||||
battlesuit: Pick<BattlesuitData, 'id' | 'name' | 'krName'>
|
battlesuit: Pick<BattlesuitData, 'id' | 'name'>
|
||||||
hidden?: boolean
|
hidden?: boolean
|
||||||
size?: 'sm' | 'default'
|
size?: 'sm' | 'default'
|
||||||
href?: string
|
href?: string
|
||||||
@@ -22,14 +20,6 @@ const BattlesuitCard = ({
|
|||||||
href,
|
href,
|
||||||
m,
|
m,
|
||||||
}: BattlesuitCardProps) => {
|
}: BattlesuitCardProps) => {
|
||||||
const { locale } = useRouter()
|
|
||||||
|
|
||||||
const battlesuitName = translate(
|
|
||||||
locale,
|
|
||||||
{ 'ko-KR': battlesuit.krName },
|
|
||||||
battlesuit.name
|
|
||||||
)
|
|
||||||
|
|
||||||
if (href == null) {
|
if (href == null) {
|
||||||
href = `/honkai3rd/battlesuits/${battlesuit.id}`
|
href = `/honkai3rd/battlesuits/${battlesuit.id}`
|
||||||
}
|
}
|
||||||
@@ -50,7 +40,7 @@ const BattlesuitCard = ({
|
|||||||
<Flex sx={{ alignItems: 'center' }}>
|
<Flex sx={{ alignItems: 'center' }}>
|
||||||
<SquareImageBox
|
<SquareImageBox
|
||||||
mr={2}
|
mr={2}
|
||||||
alt={battlesuitName}
|
alt={battlesuit.name}
|
||||||
src={`${assetsBucketBaseUrl}/honkai3rd/battlesuits/portrait-${battlesuit.id}.png`}
|
src={`${assetsBucketBaseUrl}/honkai3rd/battlesuits/portrait-${battlesuit.id}.png`}
|
||||||
size={30}
|
size={30}
|
||||||
/>
|
/>
|
||||||
@@ -62,7 +52,7 @@ const BattlesuitCard = ({
|
|||||||
whiteSpace: 'nowrap',
|
whiteSpace: 'nowrap',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{battlesuitName}
|
{battlesuit.name}
|
||||||
</Text>
|
</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
</PageLink>
|
</PageLink>
|
||||||
@@ -84,7 +74,7 @@ const BattlesuitCard = ({
|
|||||||
>
|
>
|
||||||
<PageLink href={href}>
|
<PageLink href={href}>
|
||||||
<SquareImageBox
|
<SquareImageBox
|
||||||
alt={battlesuitName}
|
alt={battlesuit.name}
|
||||||
src={`${assetsBucketBaseUrl}/honkai3rd/battlesuits/portrait-${battlesuit.id}.png`}
|
src={`${assetsBucketBaseUrl}/honkai3rd/battlesuits/portrait-${battlesuit.id}.png`}
|
||||||
size={100}
|
size={100}
|
||||||
/>
|
/>
|
||||||
@@ -97,7 +87,7 @@ const BattlesuitCard = ({
|
|||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text>{battlesuitName}</Text>
|
<Text>{battlesuit.name}</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</PageLink>
|
</PageLink>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
export interface BattlesuitSkill {
|
export interface BattlesuitSkill {
|
||||||
name: string
|
name: string
|
||||||
krName?: string
|
|
||||||
description: string
|
description: string
|
||||||
krDescription?: string
|
|
||||||
requiredRank?: string
|
requiredRank?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,7 +21,6 @@ export interface BattlesuitData {
|
|||||||
id: string
|
id: string
|
||||||
version?: string
|
version?: string
|
||||||
name: string
|
name: string
|
||||||
krName?: string
|
|
||||||
type: string
|
type: string
|
||||||
valkyrie: string
|
valkyrie: string
|
||||||
features: string[]
|
features: string[]
|
||||||
|
|||||||
@@ -59,12 +59,6 @@ const BattlesuitShowPage = ({
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { locale } = useRouter()
|
const { locale } = useRouter()
|
||||||
|
|
||||||
const battlesuitName = translate(
|
|
||||||
locale,
|
|
||||||
{ ['ko-KR']: battlesuit.krName },
|
|
||||||
battlesuit.name
|
|
||||||
)
|
|
||||||
|
|
||||||
const { label: valkyrieLabel, krLabel } = valkyries.find(
|
const { label: valkyrieLabel, krLabel } = valkyries.find(
|
||||||
(aValkyrie) => aValkyrie.value === battlesuit.valkyrie
|
(aValkyrie) => aValkyrie.value === battlesuit.valkyrie
|
||||||
) || { label: battlesuit.valkyrie, krLabel: battlesuit.valkyrie }
|
) || { label: battlesuit.valkyrie, krLabel: battlesuit.valkyrie }
|
||||||
@@ -85,7 +79,7 @@ const BattlesuitShowPage = ({
|
|||||||
return (
|
return (
|
||||||
<Honkai3rdLayout>
|
<Honkai3rdLayout>
|
||||||
<Head
|
<Head
|
||||||
title={`${battlesuitName} - ${t('common.honkai-3rd')} - ${t(
|
title={`${battlesuit.name} - ${t('common.honkai-3rd')} - ${t(
|
||||||
'common.abyss-lab'
|
'common.abyss-lab'
|
||||||
)}`}
|
)}`}
|
||||||
description={`${t('common.honkai-3rd')} ${t(
|
description={`${t('common.honkai-3rd')} ${t(
|
||||||
@@ -116,12 +110,12 @@ const BattlesuitShowPage = ({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
href: `/honkai3rd/battlesuits/${battlesuit.id}`,
|
href: `/honkai3rd/battlesuits/${battlesuit.id}`,
|
||||||
label: battlesuitName,
|
label: battlesuit.name,
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Heading as='h1'>{battlesuitName}</Heading>
|
<Heading as='h1'>{battlesuit.name}</Heading>
|
||||||
|
|
||||||
<Box mb={3}>
|
<Box mb={3}>
|
||||||
<Box
|
<Box
|
||||||
@@ -133,7 +127,7 @@ const BattlesuitShowPage = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Image
|
<Image
|
||||||
alt={battlesuitName}
|
alt={battlesuit.name}
|
||||||
src={`${assetsBucketBaseUrl}/honkai3rd/battlesuits/${battlesuit.id}.png`}
|
src={`${assetsBucketBaseUrl}/honkai3rd/battlesuits/${battlesuit.id}.png`}
|
||||||
width={400}
|
width={400}
|
||||||
height={400}
|
height={400}
|
||||||
@@ -239,44 +233,37 @@ const BattlesuitShowPage = ({
|
|||||||
<BattlesuitSkillGroupCard
|
<BattlesuitSkillGroupCard
|
||||||
heading={t('battlesuit-show.leader')}
|
heading={t('battlesuit-show.leader')}
|
||||||
skillGroup={battlesuit.leader}
|
skillGroup={battlesuit.leader}
|
||||||
locale={locale}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<BattlesuitSkillGroupCard
|
<BattlesuitSkillGroupCard
|
||||||
heading={t('battlesuit-show.passive')}
|
heading={t('battlesuit-show.passive')}
|
||||||
skillGroup={battlesuit.passive}
|
skillGroup={battlesuit.passive}
|
||||||
locale={locale}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<BattlesuitSkillGroupCard
|
<BattlesuitSkillGroupCard
|
||||||
heading={t('battlesuit-show.evasion')}
|
heading={t('battlesuit-show.evasion')}
|
||||||
skillGroup={battlesuit.evasion}
|
skillGroup={battlesuit.evasion}
|
||||||
locale={locale}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<BattlesuitSkillGroupCard
|
<BattlesuitSkillGroupCard
|
||||||
heading={t('battlesuit-show.special-attack')}
|
heading={t('battlesuit-show.special-attack')}
|
||||||
skillGroup={battlesuit.special}
|
skillGroup={battlesuit.special}
|
||||||
locale={locale}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<BattlesuitSkillGroupCard
|
<BattlesuitSkillGroupCard
|
||||||
heading={t('battlesuit-show.ultimate')}
|
heading={t('battlesuit-show.ultimate')}
|
||||||
skillGroup={battlesuit.ultimate}
|
skillGroup={battlesuit.ultimate}
|
||||||
locale={locale}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<BattlesuitSkillGroupCard
|
<BattlesuitSkillGroupCard
|
||||||
heading={t('battlesuit-show.basic-attack')}
|
heading={t('battlesuit-show.basic-attack')}
|
||||||
skillGroup={battlesuit.basic}
|
skillGroup={battlesuit.basic}
|
||||||
locale={locale}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{battlesuit.sp != null && (
|
{battlesuit.sp != null && (
|
||||||
<BattlesuitSkillGroupCard
|
<BattlesuitSkillGroupCard
|
||||||
heading={t('battlesuit-show.sp-skill')}
|
heading={t('battlesuit-show.sp-skill')}
|
||||||
skillGroup={battlesuit.sp}
|
skillGroup={battlesuit.sp}
|
||||||
locale={locale}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
@@ -290,7 +277,7 @@ export async function getStaticProps({
|
|||||||
params,
|
params,
|
||||||
locale,
|
locale,
|
||||||
}: NextPageContext & { params: { battlesuitId: string } }) {
|
}: NextPageContext & { params: { battlesuitId: string } }) {
|
||||||
const battlesuit = getBattlesuitById(params.battlesuitId)!
|
const battlesuit = getBattlesuitById(params.battlesuitId, locale)!
|
||||||
const { weaponIds, stigmataIds } = (battlesuit.equipment || []).reduce<{
|
const { weaponIds, stigmataIds } = (battlesuit.equipment || []).reduce<{
|
||||||
weaponIds: string[]
|
weaponIds: string[]
|
||||||
stigmataIds: string[]
|
stigmataIds: string[]
|
||||||
@@ -336,13 +323,11 @@ export async function getStaticPaths() {
|
|||||||
interface BattlesuitSkillGroupCardProps {
|
interface BattlesuitSkillGroupCardProps {
|
||||||
heading: string
|
heading: string
|
||||||
skillGroup: BattlesuitSkillGroup
|
skillGroup: BattlesuitSkillGroup
|
||||||
locale?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const BattlesuitSkillGroupCard = ({
|
const BattlesuitSkillGroupCard = ({
|
||||||
heading,
|
heading,
|
||||||
skillGroup,
|
skillGroup,
|
||||||
locale,
|
|
||||||
}: BattlesuitSkillGroupCardProps) => {
|
}: BattlesuitSkillGroupCardProps) => {
|
||||||
return (
|
return (
|
||||||
<Card mb={3}>
|
<Card mb={3}>
|
||||||
@@ -353,39 +338,21 @@ const BattlesuitSkillGroupCard = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Heading as='h2' mb={1}>
|
<Heading as='h2' mb={1}>
|
||||||
{translate(
|
{skillGroup.core.name}
|
||||||
locale,
|
|
||||||
{ 'ko-KR': skillGroup.core.krName },
|
|
||||||
skillGroup.core.name
|
|
||||||
)}
|
|
||||||
</Heading>
|
</Heading>
|
||||||
<SecondaryLabel>{heading}</SecondaryLabel>
|
<SecondaryLabel>{heading}</SecondaryLabel>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Paragraph p={2} sx={{ whiteSpace: 'pre-wrap', borderBottom: 'default' }}>
|
<Paragraph p={2} sx={{ whiteSpace: 'pre-wrap', borderBottom: 'default' }}>
|
||||||
{translate(
|
{skillGroup.core.description}
|
||||||
locale,
|
|
||||||
{ 'ko-KR': skillGroup.core.krDescription },
|
|
||||||
skillGroup.core.description
|
|
||||||
)}
|
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
|
|
||||||
{skillGroup.subskills.map((subskill) => {
|
{skillGroup.subskills.map((subskill) => {
|
||||||
const skillName = translate(
|
|
||||||
locale,
|
|
||||||
{ 'ko-KR': subskill.krName },
|
|
||||||
subskill.name
|
|
||||||
)
|
|
||||||
const skillDescription = translate(
|
|
||||||
locale,
|
|
||||||
{ 'ko-KR': subskill.krDescription },
|
|
||||||
subskill.description
|
|
||||||
)
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment key={subskill.name}>
|
<React.Fragment key={subskill.name}>
|
||||||
<Heading as='h3' p={2} m={0} sx={{ borderBottom: 'default' }}>
|
<Heading as='h3' p={2} m={0} sx={{ borderBottom: 'default' }}>
|
||||||
<Flex sx={{ alignItems: 'center' }}>
|
<Flex sx={{ alignItems: 'center' }}>
|
||||||
<Text>{skillName}</Text>
|
<Text>{subskill.name}</Text>
|
||||||
{subskill.requiredRank != null ? (
|
{subskill.requiredRank != null ? (
|
||||||
/^[0-9]/.test(subskill.requiredRank) ? (
|
/^[0-9]/.test(subskill.requiredRank) ? (
|
||||||
<Box
|
<Box
|
||||||
@@ -415,7 +382,7 @@ const BattlesuitSkillGroupCard = ({
|
|||||||
'&:last-child': { borderBottom: 'none' },
|
'&:last-child': { borderBottom: 'none' },
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{skillDescription}
|
{subskill.description}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
/** @jsxImportSource theme-ui */
|
/** @jsxImportSource theme-ui */
|
||||||
import { Box, Heading, Flex, Button } from '@theme-ui/components'
|
import { Box, Heading, Flex, Button } from '@theme-ui/components'
|
||||||
import { pick } from 'ramda'
|
|
||||||
import { useCallback, useMemo, useState } from 'react'
|
import { useCallback, useMemo, useState } from 'react'
|
||||||
import FilterButton from '../../../components/atoms/FilterButton'
|
import FilterButton from '../../../components/atoms/FilterButton'
|
||||||
import Breadcrumb from '../../../components/organisms/Breadcrumb'
|
import Breadcrumb from '../../../components/organisms/Breadcrumb'
|
||||||
@@ -21,7 +20,7 @@ import Honkai3rdLayout from '../../../components/layouts/Honkai3rdLayout'
|
|||||||
|
|
||||||
type BattlesuitListItemData = Pick<
|
type BattlesuitListItemData = Pick<
|
||||||
BattlesuitData,
|
BattlesuitData,
|
||||||
'id' | 'name' | 'krName' | 'features' | 'type' | 'valkyrie'
|
'id' | 'name' | 'features' | 'type' | 'valkyrie'
|
||||||
>
|
>
|
||||||
|
|
||||||
interface BattlesuitListPageProps {
|
interface BattlesuitListPageProps {
|
||||||
@@ -171,12 +170,15 @@ export default BattlesuitListPage
|
|||||||
export async function getStaticProps({ locale }: NextPageContext) {
|
export async function getStaticProps({ locale }: NextPageContext) {
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
battlesuits: listBattlesuits().map((battlesuit) =>
|
battlesuits: listBattlesuits().map((battlesuit) => {
|
||||||
pick(
|
return {
|
||||||
['id', 'name', 'krName', 'features', 'type', 'valkyrie'],
|
id: battlesuit.id,
|
||||||
battlesuit
|
name: battlesuit.name,
|
||||||
)
|
features: battlesuit.features,
|
||||||
),
|
type: battlesuit.type,
|
||||||
|
valikyrie: battlesuit.valkyrie,
|
||||||
|
}
|
||||||
|
}),
|
||||||
...(await getI18NProps(locale)),
|
...(await getI18NProps(locale)),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ import Breadcrumb from '../../../../components/organisms/Breadcrumb'
|
|||||||
import { BattlesuitData } from '../../../../lib/honkai3rd/battlesuits'
|
import { BattlesuitData } from '../../../../lib/honkai3rd/battlesuits'
|
||||||
import { generateI18NPaths, getI18NProps } from '../../../../server/i18n'
|
import { generateI18NPaths, getI18NProps } from '../../../../server/i18n'
|
||||||
import { getBattlesuitById } from '../../../../server/data/honkai3rd/battlesuits'
|
import { getBattlesuitById } from '../../../../server/data/honkai3rd/battlesuits'
|
||||||
import { translate, useTranslation } from '../../../../lib/i18n'
|
import { useTranslation } from '../../../../lib/i18n'
|
||||||
import { useRouter } from 'next/router'
|
|
||||||
import Head from '../../../../components/atoms/Head'
|
import Head from '../../../../components/atoms/Head'
|
||||||
import { assetsBucketBaseUrl } from '../../../../lib/consts'
|
import { assetsBucketBaseUrl } from '../../../../lib/consts'
|
||||||
import Honkai3rdLayout from '../../../../components/layouts/Honkai3rdLayout'
|
import Honkai3rdLayout from '../../../../components/layouts/Honkai3rdLayout'
|
||||||
@@ -38,18 +37,10 @@ const BattlesuitShowPage = ({
|
|||||||
signetSet,
|
signetSet,
|
||||||
}: BattlesuitShowPageProps) => {
|
}: BattlesuitShowPageProps) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { locale } = useRouter()
|
|
||||||
|
|
||||||
const battlesuitName = translate(
|
|
||||||
locale,
|
|
||||||
{ ['ko-KR']: battlesuit.krName },
|
|
||||||
battlesuit.name
|
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Honkai3rdLayout>
|
<Honkai3rdLayout>
|
||||||
<Head
|
<Head
|
||||||
title={`${battlesuitName} (${t('common.elysian-realm')}) - ${t(
|
title={`${battlesuit.name} (${t('common.elysian-realm')}) - ${t(
|
||||||
'common.honkai-3rd'
|
'common.honkai-3rd'
|
||||||
)} - ${t('common.abyss-lab')}`}
|
)} - ${t('common.abyss-lab')}`}
|
||||||
description={`${t('common.honkai-3rd')} ${t(
|
description={`${t('common.honkai-3rd')} ${t(
|
||||||
@@ -67,12 +58,12 @@ const BattlesuitShowPage = ({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
href: `/honkai3rd/elysian-realm/battlesuits/${battlesuit.id}`,
|
href: `/honkai3rd/elysian-realm/battlesuits/${battlesuit.id}`,
|
||||||
label: battlesuitName,
|
label: battlesuit.name,
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Heading as='h1'>{battlesuitName}</Heading>
|
<Heading as='h1'>{battlesuit.name}</Heading>
|
||||||
|
|
||||||
<Box mb={3}>
|
<Box mb={3}>
|
||||||
<Box
|
<Box
|
||||||
@@ -84,7 +75,7 @@ const BattlesuitShowPage = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Image
|
<Image
|
||||||
alt={battlesuitName}
|
alt={battlesuit.name}
|
||||||
src={`${assetsBucketBaseUrl}/honkai3rd/battlesuits/${battlesuit.id}.png`}
|
src={`${assetsBucketBaseUrl}/honkai3rd/battlesuits/${battlesuit.id}.png`}
|
||||||
width={400}
|
width={400}
|
||||||
height={400}
|
height={400}
|
||||||
@@ -111,7 +102,7 @@ export async function getStaticProps({
|
|||||||
locale,
|
locale,
|
||||||
}: NextPageContext & { params: { battlesuitId: string } }) {
|
}: NextPageContext & { params: { battlesuitId: string } }) {
|
||||||
try {
|
try {
|
||||||
const battlesuit = getBattlesuitById(params.battlesuitId)!
|
const battlesuit = getBattlesuitById(params.battlesuitId, locale)!
|
||||||
const { weaponIds, stigmataIds } = (battlesuit.equipment || []).reduce<{
|
const { weaponIds, stigmataIds } = (battlesuit.equipment || []).reduce<{
|
||||||
weaponIds: string[]
|
weaponIds: string[]
|
||||||
stigmataIds: string[]
|
stigmataIds: string[]
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import {
|
|||||||
|
|
||||||
type BattlesuitListItemData = Pick<
|
type BattlesuitListItemData = Pick<
|
||||||
BattlesuitData,
|
BattlesuitData,
|
||||||
'id' | 'name' | 'krName' | 'features' | 'type' | 'valkyrie'
|
'id' | 'name' | 'features' | 'type' | 'valkyrie'
|
||||||
>
|
>
|
||||||
|
|
||||||
interface BattlesuitListPageProps {
|
interface BattlesuitListPageProps {
|
||||||
@@ -182,7 +182,7 @@ export async function getStaticProps({ locale }: NextPageContext) {
|
|||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
battlesuitMap: getBattlesuitMapByIds(erBattlesuitIds),
|
battlesuitMap: getBattlesuitMapByIds(erBattlesuitIds, locale),
|
||||||
supportBattlesuits,
|
supportBattlesuits,
|
||||||
remembranceSigils,
|
remembranceSigils,
|
||||||
...(await getI18NProps(locale)),
|
...(await getI18NProps(locale)),
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ import {
|
|||||||
getBattlesuitById,
|
getBattlesuitById,
|
||||||
listBattlesuits,
|
listBattlesuits,
|
||||||
} from '../../../../server/data/honkai3rd/battlesuits'
|
} from '../../../../server/data/honkai3rd/battlesuits'
|
||||||
import { translate, useTranslation } from '../../../../lib/i18n'
|
import { useTranslation } from '../../../../lib/i18n'
|
||||||
import { useRouter } from 'next/router'
|
|
||||||
import { assetsBucketBaseUrl } from '../../../../lib/consts'
|
import { assetsBucketBaseUrl } from '../../../../lib/consts'
|
||||||
import { WeaponData } from '../../../../lib/honkai3rd/weapons'
|
import { WeaponData } from '../../../../lib/honkai3rd/weapons'
|
||||||
import { getWeaponMapByIds } from '../../../../server/data/honkai3rd/weapons'
|
import { getWeaponMapByIds } from '../../../../server/data/honkai3rd/weapons'
|
||||||
@@ -50,17 +49,10 @@ const BattlesuitShowPage = ({
|
|||||||
stigmataMap,
|
stigmataMap,
|
||||||
}: BattlesuitShowPageProps) => {
|
}: BattlesuitShowPageProps) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { locale } = useRouter()
|
|
||||||
|
|
||||||
const battlesuitName = translate(
|
|
||||||
locale,
|
|
||||||
{ ['ko-KR']: battlesuit.krName },
|
|
||||||
battlesuit.name
|
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box p={3}>
|
<Box p={3}>
|
||||||
<Heading as='h1'>{battlesuitName}</Heading>
|
<Heading as='h1'>{battlesuit.name}</Heading>
|
||||||
|
|
||||||
<Box mb={3}>
|
<Box mb={3}>
|
||||||
<Box
|
<Box
|
||||||
@@ -72,7 +64,7 @@ const BattlesuitShowPage = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Image
|
<Image
|
||||||
alt={battlesuitName}
|
alt={battlesuit.name}
|
||||||
src={`${assetsBucketBaseUrl}/honkai3rd/battlesuits/${battlesuit.id}.png`}
|
src={`${assetsBucketBaseUrl}/honkai3rd/battlesuits/${battlesuit.id}.png`}
|
||||||
width={400}
|
width={400}
|
||||||
height={400}
|
height={400}
|
||||||
@@ -178,44 +170,37 @@ const BattlesuitShowPage = ({
|
|||||||
<BattlesuitSkillGroupCard
|
<BattlesuitSkillGroupCard
|
||||||
heading={t('battlesuit-show.leader')}
|
heading={t('battlesuit-show.leader')}
|
||||||
skillGroup={battlesuit.leader}
|
skillGroup={battlesuit.leader}
|
||||||
locale={locale}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<BattlesuitSkillGroupCard
|
<BattlesuitSkillGroupCard
|
||||||
heading={t('battlesuit-show.passive')}
|
heading={t('battlesuit-show.passive')}
|
||||||
skillGroup={battlesuit.passive}
|
skillGroup={battlesuit.passive}
|
||||||
locale={locale}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<BattlesuitSkillGroupCard
|
<BattlesuitSkillGroupCard
|
||||||
heading={t('battlesuit-show.evasion')}
|
heading={t('battlesuit-show.evasion')}
|
||||||
skillGroup={battlesuit.evasion}
|
skillGroup={battlesuit.evasion}
|
||||||
locale={locale}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<BattlesuitSkillGroupCard
|
<BattlesuitSkillGroupCard
|
||||||
heading={t('battlesuit-show.special-attack')}
|
heading={t('battlesuit-show.special-attack')}
|
||||||
skillGroup={battlesuit.special}
|
skillGroup={battlesuit.special}
|
||||||
locale={locale}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<BattlesuitSkillGroupCard
|
<BattlesuitSkillGroupCard
|
||||||
heading={t('battlesuit-show.ultimate')}
|
heading={t('battlesuit-show.ultimate')}
|
||||||
skillGroup={battlesuit.ultimate}
|
skillGroup={battlesuit.ultimate}
|
||||||
locale={locale}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<BattlesuitSkillGroupCard
|
<BattlesuitSkillGroupCard
|
||||||
heading={t('battlesuit-show.basic-attack')}
|
heading={t('battlesuit-show.basic-attack')}
|
||||||
skillGroup={battlesuit.basic}
|
skillGroup={battlesuit.basic}
|
||||||
locale={locale}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{battlesuit.sp != null && (
|
{battlesuit.sp != null && (
|
||||||
<BattlesuitSkillGroupCard
|
<BattlesuitSkillGroupCard
|
||||||
heading={t('battlesuit-show.sp-skill')}
|
heading={t('battlesuit-show.sp-skill')}
|
||||||
skillGroup={battlesuit.sp}
|
skillGroup={battlesuit.sp}
|
||||||
locale={locale}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
@@ -228,7 +213,7 @@ export async function getStaticProps({
|
|||||||
params,
|
params,
|
||||||
locale,
|
locale,
|
||||||
}: NextPageContext & { params: { battlesuitId: string } }) {
|
}: NextPageContext & { params: { battlesuitId: string } }) {
|
||||||
const battlesuit = getBattlesuitById(params.battlesuitId)!
|
const battlesuit = getBattlesuitById(params.battlesuitId, locale)!
|
||||||
const { weaponIds, stigmataIds } = (battlesuit.equipment || []).reduce<{
|
const { weaponIds, stigmataIds } = (battlesuit.equipment || []).reduce<{
|
||||||
weaponIds: string[]
|
weaponIds: string[]
|
||||||
stigmataIds: string[]
|
stigmataIds: string[]
|
||||||
@@ -274,13 +259,11 @@ export async function getStaticPaths() {
|
|||||||
interface BattlesuitSkillGroupCardProps {
|
interface BattlesuitSkillGroupCardProps {
|
||||||
heading: string
|
heading: string
|
||||||
skillGroup: BattlesuitSkillGroup
|
skillGroup: BattlesuitSkillGroup
|
||||||
locale?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const BattlesuitSkillGroupCard = ({
|
const BattlesuitSkillGroupCard = ({
|
||||||
heading,
|
heading,
|
||||||
skillGroup,
|
skillGroup,
|
||||||
locale,
|
|
||||||
}: BattlesuitSkillGroupCardProps) => {
|
}: BattlesuitSkillGroupCardProps) => {
|
||||||
return (
|
return (
|
||||||
<Card mb={3}>
|
<Card mb={3}>
|
||||||
@@ -291,39 +274,21 @@ const BattlesuitSkillGroupCard = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Heading as='h2' mb={1}>
|
<Heading as='h2' mb={1}>
|
||||||
{translate(
|
{skillGroup.core.name}
|
||||||
locale,
|
|
||||||
{ 'ko-KR': skillGroup.core.krName },
|
|
||||||
skillGroup.core.name
|
|
||||||
)}
|
|
||||||
</Heading>
|
</Heading>
|
||||||
<SecondaryLabel>{heading}</SecondaryLabel>
|
<SecondaryLabel>{heading}</SecondaryLabel>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Paragraph p={2} sx={{ whiteSpace: 'pre-wrap', borderBottom: 'default' }}>
|
<Paragraph p={2} sx={{ whiteSpace: 'pre-wrap', borderBottom: 'default' }}>
|
||||||
{translate(
|
{skillGroup.core.description}
|
||||||
locale,
|
|
||||||
{ 'ko-KR': skillGroup.core.krDescription },
|
|
||||||
skillGroup.core.description
|
|
||||||
)}
|
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
|
|
||||||
{skillGroup.subskills.map((subskill) => {
|
{skillGroup.subskills.map((subskill) => {
|
||||||
const skillName = translate(
|
|
||||||
locale,
|
|
||||||
{ 'ko-KR': subskill.krName },
|
|
||||||
subskill.name
|
|
||||||
)
|
|
||||||
const skillDescription = translate(
|
|
||||||
locale,
|
|
||||||
{ 'ko-KR': subskill.krDescription },
|
|
||||||
subskill.description
|
|
||||||
)
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment key={subskill.name}>
|
<React.Fragment key={subskill.name}>
|
||||||
<Heading as='h3' p={2} m={0} sx={{ borderBottom: 'default' }}>
|
<Heading as='h3' p={2} m={0} sx={{ borderBottom: 'default' }}>
|
||||||
<Flex sx={{ alignItems: 'center' }}>
|
<Flex sx={{ alignItems: 'center' }}>
|
||||||
<Text>{skillName}</Text>
|
<Text>{subskill.name}</Text>
|
||||||
{subskill.requiredRank != null ? (
|
{subskill.requiredRank != null ? (
|
||||||
/^[0-9]/.test(subskill.requiredRank) ? (
|
/^[0-9]/.test(subskill.requiredRank) ? (
|
||||||
<Box
|
<Box
|
||||||
@@ -353,7 +318,7 @@ const BattlesuitSkillGroupCard = ({
|
|||||||
'&:last-child': { borderBottom: 'none' },
|
'&:last-child': { borderBottom: 'none' },
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{skillDescription}
|
{subskill.description}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -147,7 +147,8 @@ export async function getStaticProps({
|
|||||||
const battlesuitMap = getBattlesuitMapByIds(
|
const battlesuitMap = getBattlesuitMapByIds(
|
||||||
weapon != null && weapon.battlesuits != null
|
weapon != null && weapon.battlesuits != null
|
||||||
? weapon.battlesuits.map(({ id }) => id)
|
? weapon.battlesuits.map(({ id }) => id)
|
||||||
: []
|
: [],
|
||||||
|
locale
|
||||||
)
|
)
|
||||||
|
|
||||||
const weaponIds = []
|
const weaponIds = []
|
||||||
|
|||||||
@@ -57,11 +57,7 @@ const VersionShowPage = ({
|
|||||||
'versions.version'
|
'versions.version'
|
||||||
)} ${versionName} / ${t('versions.new-battlesuits')}: ${battlesuits
|
)} ${versionName} / ${t('versions.new-battlesuits')}: ${battlesuits
|
||||||
.map((battlesuit) => {
|
.map((battlesuit) => {
|
||||||
return translate(
|
return battlesuit.name
|
||||||
locale,
|
|
||||||
{ 'ko-KR': battlesuit.krName },
|
|
||||||
battlesuit.name
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
.join(',')} / ${t('versions.new-weapons')}: ${weapons
|
.join(',')} / ${t('versions.new-weapons')}: ${weapons
|
||||||
.map((weapon) => {
|
.map((weapon) => {
|
||||||
@@ -113,12 +109,6 @@ const VersionShowPage = ({
|
|||||||
</Heading>
|
</Heading>
|
||||||
<Box mb={3} sx={{ display: 'inline-block' }}>
|
<Box mb={3} sx={{ display: 'inline-block' }}>
|
||||||
{battlesuits.map((battlesuit) => {
|
{battlesuits.map((battlesuit) => {
|
||||||
const battlesuitName = translate(
|
|
||||||
locale,
|
|
||||||
{ 'ko-KR': battlesuit.krName },
|
|
||||||
battlesuit.name
|
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NextLink
|
<NextLink
|
||||||
key={battlesuit.id}
|
key={battlesuit.id}
|
||||||
@@ -130,10 +120,10 @@ const VersionShowPage = ({
|
|||||||
<SquareImageBox
|
<SquareImageBox
|
||||||
size={40}
|
size={40}
|
||||||
src={`${assetsBucketBaseUrl}/honkai3rd/battlesuits/portrait-${battlesuit.id}.png`}
|
src={`${assetsBucketBaseUrl}/honkai3rd/battlesuits/portrait-${battlesuit.id}.png`}
|
||||||
alt={`${battlesuitName}`}
|
alt={`${battlesuit.name}`}
|
||||||
mr={2}
|
mr={2}
|
||||||
/>
|
/>
|
||||||
<Text>{battlesuitName}</Text>
|
<Text>{battlesuit.name}</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Link>
|
</Link>
|
||||||
</NextLink>
|
</NextLink>
|
||||||
@@ -232,7 +222,7 @@ export async function getStaticProps({
|
|||||||
const versionData = getVersion(params.versionId)!
|
const versionData = getVersion(params.versionId)!
|
||||||
|
|
||||||
const battlesuits = versionData.newBattlesuits.map((battlesuitId) => {
|
const battlesuits = versionData.newBattlesuits.map((battlesuitId) => {
|
||||||
return getBattlesuitById(battlesuitId)
|
return getBattlesuitById(battlesuitId, locale)
|
||||||
})
|
})
|
||||||
const weapons = versionData.newWeapons.map((weaponId) => {
|
const weapons = versionData.newWeapons.map((weaponId) => {
|
||||||
return getWeaponById(weaponId)
|
return getWeaponById(weaponId)
|
||||||
|
|||||||
@@ -103,12 +103,6 @@ const VersionIndexPage = ({
|
|||||||
</Heading>
|
</Heading>
|
||||||
<Box mb={3} sx={{ display: 'inline-block' }}>
|
<Box mb={3} sx={{ display: 'inline-block' }}>
|
||||||
{currentVersionNewBattlesuits.map((battlesuit) => {
|
{currentVersionNewBattlesuits.map((battlesuit) => {
|
||||||
const battlesuitName = translate(
|
|
||||||
locale,
|
|
||||||
{ 'ko-KR': battlesuit.krName },
|
|
||||||
battlesuit.name
|
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NextLink
|
<NextLink
|
||||||
key={battlesuit.id}
|
key={battlesuit.id}
|
||||||
@@ -120,10 +114,10 @@ const VersionIndexPage = ({
|
|||||||
<SquareImageBox
|
<SquareImageBox
|
||||||
size={40}
|
size={40}
|
||||||
src={`${assetsBucketBaseUrl}/honkai3rd/battlesuits/portrait-${battlesuit.id}.png`}
|
src={`${assetsBucketBaseUrl}/honkai3rd/battlesuits/portrait-${battlesuit.id}.png`}
|
||||||
alt={`${battlesuitName}`}
|
alt={`${battlesuit.name}`}
|
||||||
mr={2}
|
mr={2}
|
||||||
/>
|
/>
|
||||||
<Text>{battlesuitName}</Text>
|
<Text>{battlesuit.name}</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Link>
|
</Link>
|
||||||
</NextLink>
|
</NextLink>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ const order = [
|
|||||||
'basic',
|
'basic',
|
||||||
'sp',
|
'sp',
|
||||||
'core',
|
'core',
|
||||||
|
'subskills',
|
||||||
'description',
|
'description',
|
||||||
'krDescription',
|
'krDescription',
|
||||||
'requiredRank',
|
'requiredRank',
|
||||||
|
|||||||
@@ -1,152 +1,67 @@
|
|||||||
import { readdirSync, readFileSync, readJsonFileSync } from '../fs'
|
import { BattlesuitData } from '../../../lib/honkai3rd/battlesuits'
|
||||||
import { compareVersion } from '../../../lib/string'
|
import fs from 'fs'
|
||||||
import {
|
import path from 'path'
|
||||||
BattlesuitData,
|
import yaml from 'yaml'
|
||||||
BattlesuitSkillGroup,
|
import { omit } from 'ramda'
|
||||||
} from '../../../lib/honkai3rd/battlesuits'
|
|
||||||
|
|
||||||
const battlesuitsFileNameList = readdirSync('honkai3rd/battlesuits')
|
let parsedData: any = null
|
||||||
const battlesuitDataList = battlesuitsFileNameList
|
|
||||||
.map((fileName) => {
|
|
||||||
const filePathname = 'honkai3rd/battlesuits/' + fileName
|
|
||||||
const data = readJsonFileSync(filePathname) as BattlesuitData
|
|
||||||
|
|
||||||
const krDataFilePath = `honkai3rd/ko-KR/battlesuits/${data.id}.md`
|
export function listBattlesuits(locale?: string): BattlesuitData[] {
|
||||||
try {
|
if (parsedData == null) {
|
||||||
const krData = parseSkillData(readFileSync(krDataFilePath).toString())
|
parsedData = yaml.parse(
|
||||||
|
fs
|
||||||
|
.readFileSync(
|
||||||
|
path.join(process.cwd(), 'data/honkai3rd/battlesuits.yaml')
|
||||||
|
)
|
||||||
|
.toString('utf-8')
|
||||||
|
)
|
||||||
|
}
|
||||||
|
const battlesuits = parsedData
|
||||||
|
|
||||||
data.krName = krData.name
|
const localized = (battlesuits as any[]).map((battlesuit) => {
|
||||||
assignKrDataToSkill(data.leader, krData.leader)
|
return {
|
||||||
assignKrDataToSkill(data.passive, krData.passive)
|
...omit(['krName', 'krDescription'], battlesuit),
|
||||||
assignKrDataToSkill(data.evasion, krData.evasion)
|
name: locale === 'ko-KR' ? battlesuit.krName : battlesuit.name,
|
||||||
assignKrDataToSkill(data.special, krData.special)
|
leader: localizeSkillGroup(battlesuit.leader),
|
||||||
assignKrDataToSkill(data.ultimate, krData.ultimate)
|
passive: localizeSkillGroup(battlesuit.passive),
|
||||||
assignKrDataToSkill(data.basic, krData.basic)
|
evasion: localizeSkillGroup(battlesuit.evasion),
|
||||||
if (data.sp != null && krData.sp != null) {
|
special: localizeSkillGroup(battlesuit.special),
|
||||||
assignKrDataToSkill(data.sp, krData.sp)
|
ultimate: localizeSkillGroup(battlesuit.ultimate),
|
||||||
}
|
basic: localizeSkillGroup(battlesuit.basic),
|
||||||
} catch (error) {
|
sp: battlesuit.sp != null ? localizeSkillGroup(battlesuit.sp) : null,
|
||||||
console.warn('Failed to read', krDataFilePath)
|
} as any
|
||||||
console.warn(error)
|
|
||||||
}
|
|
||||||
return data
|
|
||||||
})
|
})
|
||||||
.sort((a, b) => {
|
|
||||||
let compareResult = compareVersion(b.version || '0.0', a.version || '0.0')
|
return localized
|
||||||
if (compareResult !== 0) {
|
|
||||||
return compareResult
|
function localizeSkillGroup(skillGroup: any) {
|
||||||
|
return {
|
||||||
|
core: localizeSkill(skillGroup.core),
|
||||||
|
subskills: skillGroup.subskills.map((subskill: any) =>
|
||||||
|
localizeSkill(subskill)
|
||||||
|
),
|
||||||
}
|
}
|
||||||
compareResult = a.name
|
}
|
||||||
.replace(/ \(.\)/, '')
|
|
||||||
.localeCompare(b.name.replace(/ \(.\)/, ''))
|
|
||||||
|
|
||||||
return compareResult
|
function localizeSkill(skill: any) {
|
||||||
})
|
return {
|
||||||
const battlesuitMap = battlesuitDataList.reduce((map, stigmata) => {
|
...omit(['krName', 'krDescription'], skill),
|
||||||
map.set(stigmata.id, stigmata)
|
name: locale === 'ko-KR' ? skill.krName : skill.name,
|
||||||
return map
|
description: locale === 'ko-KR' ? skill.krDescription : skill.description,
|
||||||
}, new Map<string, BattlesuitData>())
|
}
|
||||||
|
}
|
||||||
export function listBattlesuits() {
|
|
||||||
return battlesuitDataList
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getBattlesuitById(id: string) {
|
export function getBattlesuitById(id: string, locale?: string) {
|
||||||
return battlesuitMap.get(id)
|
return listBattlesuits(locale).find((battlesuit) => battlesuit.id === id)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getBattlesuitMapByIds(idList: string[]) {
|
export function getBattlesuitMapByIds(idList: string[], locale?: string) {
|
||||||
return idList.reduce<{ [key: string]: BattlesuitData }>((map, id) => {
|
return idList.reduce<{ [key: string]: BattlesuitData }>((map, id) => {
|
||||||
const battlesuit = getBattlesuitById(id)
|
const battlesuit = getBattlesuitById(id, locale)
|
||||||
if (battlesuit != null) {
|
if (battlesuit != null) {
|
||||||
map[id] = battlesuit
|
map[id] = battlesuit
|
||||||
}
|
}
|
||||||
return map
|
return map
|
||||||
}, {})
|
}, {})
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseSkillData(rawData: string) {
|
|
||||||
const [
|
|
||||||
nameSection,
|
|
||||||
leaderSection,
|
|
||||||
passiveSection,
|
|
||||||
evasionSection,
|
|
||||||
specialSection,
|
|
||||||
ultimateSection,
|
|
||||||
basicSection,
|
|
||||||
spSection,
|
|
||||||
] = rawData.split('\n## ')
|
|
||||||
|
|
||||||
const name = nameSection.replace('#', '').trim()
|
|
||||||
|
|
||||||
return {
|
|
||||||
name,
|
|
||||||
leader: parseSkillSection(leaderSection),
|
|
||||||
passive: parseSkillSection(passiveSection),
|
|
||||||
evasion: parseSkillSection(evasionSection),
|
|
||||||
special: parseSkillSection(specialSection),
|
|
||||||
ultimate: parseSkillSection(ultimateSection),
|
|
||||||
basic: parseSkillSection(basicSection),
|
|
||||||
sp: spSection != null ? parseSkillSection(spSection) : undefined,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseSkillSection(rawData: string) {
|
|
||||||
const [coreSection, ...subskillSections] = rawData.split('\n### ')
|
|
||||||
|
|
||||||
const [coreName, ...descriptionLines] = coreSection.trim().split('\n')
|
|
||||||
|
|
||||||
return {
|
|
||||||
core: {
|
|
||||||
name: coreName,
|
|
||||||
description: descriptionLines.join('\n').trim(),
|
|
||||||
},
|
|
||||||
subskills: subskillSections.map((subskillSection) => {
|
|
||||||
const [subskillName, ...subskillDescriptionLines] = subskillSection
|
|
||||||
.trim()
|
|
||||||
.split('\n')
|
|
||||||
|
|
||||||
return {
|
|
||||||
name: subskillName,
|
|
||||||
description: subskillDescriptionLines.join('\n').trim(),
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function assignKrDataToSkill(
|
|
||||||
skillGroup: BattlesuitSkillGroup,
|
|
||||||
krDataSkillGroup: BattlesuitSkillGroup
|
|
||||||
) {
|
|
||||||
if (krDataSkillGroup == null || krDataSkillGroup.core == null) {
|
|
||||||
throw new Error(`No translation for ${skillGroup.core.name}`)
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
skillGroup.core.krName = krDataSkillGroup.core.name
|
|
||||||
skillGroup.core.krDescription = krDataSkillGroup.core.description.replace(
|
|
||||||
/\\\*/g,
|
|
||||||
'*'
|
|
||||||
)
|
|
||||||
} catch (error) {
|
|
||||||
throw new Error(
|
|
||||||
`Failed to assign ${skillGroup.core.name}(${(error as Error).message})`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
skillGroup.subskills.forEach((subskill, index) => {
|
|
||||||
try {
|
|
||||||
subskill.krName = krDataSkillGroup.subskills[index].name
|
|
||||||
subskill.krDescription = krDataSkillGroup.subskills[
|
|
||||||
index
|
|
||||||
].description.replace(/\\\*/g, '*')
|
|
||||||
} catch (error) {
|
|
||||||
if (krDataSkillGroup.subskills[index] == null) {
|
|
||||||
throw new Error(
|
|
||||||
`No translation for ${skillGroup.core.name} / ${subskill.name}`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
throw new Error(
|
|
||||||
`Failed to assign ${skillGroup.core.name}(${(error as Error).message})`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ export const krSignetGroupMap = signetGroups.reduce<{
|
|||||||
|
|
||||||
const name =
|
const name =
|
||||||
group.id === 'elysia'
|
group.id === 'elysia'
|
||||||
? `${getBattlesuitById(setType)!.krName} 전용 각인`
|
? `${getBattlesuitById(setType, 'ko-KR')!.name} 전용 각인`
|
||||||
: `${setType === 'nexus' ? '증폭 각인' : '일반 각인'}${
|
: `${setType === 'nexus' ? '증폭 각인' : '일반 각인'}${
|
||||||
setIndex != null ? ` ${setIndex}` : ''
|
setIndex != null ? ` ${setIndex}` : ''
|
||||||
}`
|
}`
|
||||||
@@ -115,7 +115,7 @@ export function getSignetGroupById(id: string, locale = 'en-US') {
|
|||||||
|
|
||||||
export function getSupportBattlesuits(locale?: string) {
|
export function getSupportBattlesuits(locale?: string) {
|
||||||
return supportBattlesuitIds.map<SupportBattlesuit>((battlesuitId) => {
|
return supportBattlesuitIds.map<SupportBattlesuit>((battlesuitId) => {
|
||||||
const battlesuit = getBattlesuitById(battlesuitId)!
|
const battlesuit = getBattlesuitById(battlesuitId, locale)!
|
||||||
const {
|
const {
|
||||||
skillName,
|
skillName,
|
||||||
description,
|
description,
|
||||||
@@ -138,7 +138,6 @@ export function getSupportBattlesuits(locale?: string) {
|
|||||||
.slice(2)
|
.slice(2)
|
||||||
.split('\n\n')
|
.split('\n\n')
|
||||||
|
|
||||||
localizedName = battlesuit.krName!
|
|
||||||
localizedSkillName = krSkillName
|
localizedSkillName = krSkillName
|
||||||
localizedDescription = krDescriptionLines.join('\n').trim()
|
localizedDescription = krDescriptionLines.join('\n').trim()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user