>((map, skill) => {
- map.set(skill.row.toString(), skill)
- return map
- }, new ListMap())
-
- return [...rowSkillListMap.values()]
- }, [elf.skills])
- return (
-
- {elf.fullName}
-
-
-
-
-
- {elf.tags.map(tag => {
- return (
-
-
-
- )
- })}
-
-
-
- Ult CD: {elf.ultSkillCd} / Ult SP Cost: {elf.ultSkillCost}
-
-
-
- Skills
-
- {skillRows.map((row, index) => {
- return (
-
- {row.map(skill => {
- return (
-
-
-
-
-
-
-
- {skill.name}
-
- {/* {skill.id} */}
- ({skill.skillType})
-
-
-
- {formatSubSkillInfo(skill)}
-
-
- )
- })}
-
- )
- })}
-
- )
-}
-
-export default ElfShowPage
-
-export async function getStaticProps({ locale, params }: NextPageContext & { params: { elfId: string } }) {
- const elf = loadElfData(params.elfId)
-
- return {
- props: { elf }
- }
-}
-
-export async function getStaticPaths() {
- const elfCatalog = loadElfCatalog()
-
- return {
- paths: elfCatalog.map(catalogItem => {
- return {
- params: { elfId: catalogItem.id }
- }
- }),
- fallback: false
- }
-}
diff --git a/src/pages/honkai3rd/v2/elfs/index.tsx b/src/pages/honkai3rd/v2/elfs/index.tsx
deleted file mode 100644
index d47398a7..00000000
--- a/src/pages/honkai3rd/v2/elfs/index.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-/** @jsxImportSource theme-ui */
-import { Box, Card } from '@theme-ui/components'
-import { NextPageContext } from 'next'
-import { Flex, Link } from 'theme-ui'
-import { ElfCatalogItem } from '../../../../lib/v2/data/types'
-import { loadElfCatalog } from '../../../../lib/v2/server/loadData'
-import RarityBar from '../../../../components/v2/RarityBar'
-import ElfIcon from '../../../../components/v2/ElfIcon'
-
-interface ElfListPageProps {
- elfs: ElfCatalogItem[]
-}
-
-const ElfListPage = ({ elfs }: ElfListPageProps) => {
- return (
-
- Elfs
-
- {elfs
- .sort((a, b) => {
- const aId = getId(a.id)
- const bId = getId(b.id)
- return bId - aId
-
- function getId(id: string): number {
- return parseInt(id)
- }
- })
- .map(elf => {
- return (
-
-
-
-
-
-
-
-
- {elf.fullName}
-
-
-
-
- )
- })}
-
-
- )
-}
-
-export default ElfListPage
-
-export async function getStaticProps({ locale }: NextPageContext) {
- const elfs = loadElfCatalog()
-
- return {
- props: { elfs }
- }
-}
diff --git a/src/pages/honkai3rd/v2/index.tsx b/src/pages/honkai3rd/v2/index.tsx
deleted file mode 100644
index ef76a851..00000000
--- a/src/pages/honkai3rd/v2/index.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import Link from 'next/link'
-import { Box } from 'theme-ui'
-
-const HomePage = () => {
- return (
-
-
V2 Pre
-
- Battlesuits
-
-
- Weapons
-
-
- Stigmata
-
-
- StigmataSets
-
-
- Elfs
-
-
- Elysian Realm
-
-
- )
-}
-
-export default HomePage
diff --git a/src/pages/honkai3rd/v2/stigmata/index.tsx b/src/pages/honkai3rd/v2/stigmata/index.tsx
deleted file mode 100644
index 3ae1f349..00000000
--- a/src/pages/honkai3rd/v2/stigmata/index.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-/** @jsxImportSource theme-ui */
-import { Box, Card, Heading } from '@theme-ui/components'
-import { NextPageContext } from 'next'
-import { Flex, Link } from 'theme-ui'
-
-import { StigmataCatalogItem } from '../../../../lib/v2/data/types'
-import { loadStigmataCatalog } from '../../../../lib/v2/server/loadData'
-import StigmaIcon from '../../../../components/v2/StigmaIcon'
-import Honkai3rdLayout from '../../../../components/layouts/Honkai3rdLayout'
-import { getI18NProps } from '../../../../server/i18n'
-
-interface StigmataListPageProps {
- stigmataCatalog: StigmataCatalogItem[]
-}
-
-const StigmataListPage = ({ stigmataCatalog }: StigmataListPageProps) => {
- return (
-
-
- Stigmata (Single)
-
-
- {stigmataCatalog
- .filter(filterStigmata)
- .sort(sortStigmata)
- .map(stigma => {
- return (
-
-
-
-
-
-
-
- {stigma.name}
-
- {/* {stigma.id} */}
-
-
-
- )
- })}
-
-
-
- )
-}
-
-export default StigmataListPage
-
-export async function getStaticProps({ locale }: NextPageContext) {
- const stigmataCatalog = loadStigmataCatalog()
-
- return {
- props: { stigmataCatalog, ...(await getI18NProps(locale)) }
- }
-}
-
-function filterStigmata(weapon: StigmataCatalogItem) {
- return true
-}
-
-function sortStigmata(a: StigmataCatalogItem, b: StigmataCatalogItem) {
- let aId = parseInt(a.id)
-
- let bId = parseInt(b.id)
-
- return bId - aId
-}
diff --git a/src/pages/honkai3rd/v2/weapons/[weaponId].tsx b/src/pages/honkai3rd/v2/weapons/[weaponId].tsx
deleted file mode 100644
index b9683a1e..00000000
--- a/src/pages/honkai3rd/v2/weapons/[weaponId].tsx
+++ /dev/null
@@ -1,133 +0,0 @@
-import { NextPageContext } from 'next'
-import { Box, Card, Flex, Heading } from 'theme-ui'
-import FormattedText from '../../../../components/v2/FormattedText'
-import { formatSubSkillInfo, replaceNewLine } from '../../../../lib/v2/data/formatText'
-import { loadWeaponCatalog, loadWeaponData } from '../../../../lib/v2/server/loadData'
-import { RootWeaponData } from '../../../../lib/v2/data/types'
-import { Fragment } from 'react'
-import { getWeaponTypeLabel } from '../../../../lib/v2/data/text'
-import WeaponTypeIcon from '../../../../components/v2/WeaponTypeIcon'
-import WeaponIcon from '../../../../components/v2/WeaponIcon'
-import Honkai3rdLayout from '../../../../components/layouts/Honkai3rdLayout'
-import Head from '../../../../components/atoms/Head'
-import { useTranslation } from 'next-i18next'
-import { getI18NProps } from '../../../../server/i18n'
-import Breadcrumb from '../../../../components/organisms/Breadcrumb'
-
-interface WeaponShowPageProps {
- rootWeapon: RootWeaponData
-}
-
-const WeaponShowPage = ({ rootWeapon }: WeaponShowPageProps) => {
- const { t } = useTranslation()
- const weapon = rootWeapon.weapons[rootWeapon.weapons.length - 1]
-
- const weaponTypeLabel = getWeaponTypeLabel(weapon.type)
- const atk = Math.floor(weapon.attackBase + weapon.attackAdd * (weapon.maxLv - 1))
- const crt = Math.floor(weapon.criticalBase + weapon.criticalAdd * (weapon.maxLv - 1))
-
- return (
-
-
-
-
-
- {weapon.name}
-
-
-
-
-
-
- {replaceNewLine(weapon.description)}
-
-
- {getWeaponTypeLabel(weapon.type)}
-
-
- ATK : {atk} / CRT : {crt} (at Max Lv {weapon.maxLv})
-
-
-
- Skills
-
- {weapon.skills.map(skill => {
- return (
-
-
-
- {skill.name}
-
-
-
-
- {formatSubSkillInfo({
- info: skill.info,
- maxLv: weapon.maxLv,
- paramBase1: skill.param1,
- paramBase2: skill.param2,
- paramBase3: skill.param3,
- paramAdd1: skill.param1Add,
- paramAdd2: skill.param2Add,
- paramAdd3: skill.param3Add
- })}
-
-
-
- )
- })}
-
- {/* {JSON.stringify(weapon, null, 2)} */}
-
-
- )
-}
-
-export default WeaponShowPage
-
-export async function getStaticProps({ locale, params }: NextPageContext & { params: { weaponId: string } }) {
- const rootWeapon = loadWeaponData(params.weaponId)
-
- return {
- props: { rootWeapon, ...(await getI18NProps(locale)) }
- }
-}
-
-export async function getStaticPaths() {
- const weaponCatalog = loadWeaponCatalog()
-
- return {
- paths: weaponCatalog.map(catalogItem => {
- return {
- params: { weaponId: catalogItem.id }
- }
- }),
- fallback: false
- }
-}
diff --git a/src/pages/honkai3rd/v2/weapons/index.tsx b/src/pages/honkai3rd/v2/weapons/index.tsx
deleted file mode 100644
index 6fb926c9..00000000
--- a/src/pages/honkai3rd/v2/weapons/index.tsx
+++ /dev/null
@@ -1,146 +0,0 @@
-/** @jsxImportSource theme-ui */
-import { Box, Card } from '@theme-ui/components'
-import { NextPageContext } from 'next'
-import { Flex, Heading, Link } from 'theme-ui'
-import { loadWeaponCatalog } from '../../../../lib/v2/server/loadData'
-import { WeaponCatalogItem } from '../../../../lib/v2/data/types'
-import WeaponIcon from '../../../../components/v2/WeaponIcon'
-import Head from '../../../../components/atoms/Head'
-import Honkai3rdLayout from '../../../../components/layouts/Honkai3rdLayout'
-import { useTranslation } from 'next-i18next'
-import { getI18NProps } from '../../../../server/i18n'
-import Breadcrumb from '../../../../components/organisms/Breadcrumb'
-
-interface WeaponListPageProps {
- weaponCatalog: WeaponCatalogItem[]
-}
-
-const WeaponListPage = ({ weaponCatalog }: WeaponListPageProps) => {
- const { t } = useTranslation()
- return (
-
-
-
-
- {t('common.weapons')}
-
- {weaponCatalog
- .filter(filterWeapons)
- .sort(sortWeapons)
- .map(weapon => {
- return (
-
-
-
-
-
-
-
- {weapon.name}
-
- {/* {weapon.id} */}
-
-
-
- )
- })}
-
-
-
- )
-}
-
-export default WeaponListPage
-
-export async function getStaticProps({ locale }: NextPageContext) {
- const weaponCatalog = loadWeaponCatalog()
-
- return {
- props: { weaponCatalog, ...(await getI18NProps(locale)) }
- }
-}
-
-function filterWeapons(weapon: WeaponCatalogItem) {
- // Valid weapons
- // 24XXX EX Weapons
- // 21XXX Sprit Weapon
- // 19XXX Alloy Weapons
- // 10XXX Regular Weapons
-
- // Event Weapon?
- if (weapon.id.startsWith('18') && weapon.id.length === 5) {
- return false
- }
- // Test Data?
- if (weapon.id.startsWith('1023') && weapon.id.length === 6) {
- return false
- }
- // Unreleased(Number looks good but lacking info)
- switch (weapon.id) {
- case '24000': // 2nd relic alpha
- case '24040': // Removed 7 Thunders
- case '24034': // PE Temp Lance
- case '24024': // keqing ex
- case '20765': // ?
- case '10243': // No Name
- case '10219': // ?
- case '10179': // ?
- return false
- }
-
- // Divine Keys
- switch (weapon.id) {
- case '20000': // Taixuan Sword
- case '10248': // Abyss Flower
- case '10267': // Eden's star anti entropy
- case '10263': // 7 Thunders
- case '10247': // Abyss
- case '10235': // Fenghuang pistols
- case '10234': // Fenghuang fists
- case '10223': // Eden twin stars
- case '10212': // Pledge of Sakura
- case '10211': // Pledge of Judah
- case '10209': // Might of an utu
- case '10199': // Cleaver of Shamash
- case '10163': // Shamash pistols
- // The below don't have duplicated data
- // case '10180': // Eden's star
- // case '10169': // Taxiuan fists
- // case '10158': // Jizo Mitama
- return false
- }
-
- return true
-}
-
-function sortWeapons(a: WeaponCatalogItem, b: WeaponCatalogItem) {
- let aId = parseInt(a.id)
-
- const aTypeOrder = aId > 21000 && aId < 22000 ? 2 : aId > 19000 && aId < 20000 ? 1 : 0
-
- let bId = parseInt(b.id)
- const bTypeOrder = bId > 21000 && bId < 22000 ? 2 : bId > 19000 && bId < 20000 ? 1 : 0
- if (aTypeOrder !== bTypeOrder) {
- return aTypeOrder - bTypeOrder
- }
-
- return bId - aId
-}
diff --git a/src/pages/honkai3rd/versions/[versionId].tsx b/src/pages/honkai3rd/versions/[versionId].tsx
deleted file mode 100644
index 2c02ae17..00000000
--- a/src/pages/honkai3rd/versions/[versionId].tsx
+++ /dev/null
@@ -1,264 +0,0 @@
-/** @jsxImportSource theme-ui */
-import { Box, Heading, Flex, Text, Paragraph } from '@theme-ui/components'
-import { NextPageContext } from 'next'
-import Breadcrumb from '../../../components/organisms/Breadcrumb'
-import GanttChart from '../../../components/organisms/GanttChart'
-import {
- getVersion,
- listVersionData,
-} from '../../../server/data/honkai3rd/versions'
-import { format as formatDate } from 'date-fns'
-import { getBattlesuitById } from '../../../server/data/honkai3rd/battlesuits'
-import SquareImageBox from '../../../components/atoms/SquareImageBox'
-import { getWeaponById } from '../../../server/data/honkai3rd/weapons'
-import ScrollContainer from 'react-indiana-drag-scroll'
-import { addDateToDateString, getDateString } from '../../../lib/string'
-import { BattlesuitData } from '../../../lib/honkai3rd/battlesuits'
-import { WeaponData } from '../../../lib/honkai3rd/weapons'
-import { VersionData } from '../../../lib/honkai3rd/versions'
-import { generateI18NPaths, getI18NProps } from '../../../server/i18n'
-import { useTranslation } from '../../../lib/i18n'
-import Head from '../../../components/atoms/Head'
-import PageLink from '../../../components/atoms/PageLink'
-import { assetsBucketBaseUrl } from '../../../lib/consts'
-import Honkai3rdLayout from '../../../components/layouts/Honkai3rdLayout'
-import { useEffect, useState } from 'react'
-import BossTable from '../../../components/organisms/BossTable'
-import StigmataSetCard from '../../../components/molecules/StigmataSetCard'
-import WeaponCard from '../../../components/molecules/WeaponCard'
-import BattlesuitCard from '../../../components/molecules/BattlesuitCard'
-import { getStigmataSetBySetId } from '../../../server/data/honkai3rd/stigmata'
-import { StigmataSet } from '../../../lib/honkai3rd/stigmata'
-
-interface VersionShowPageProps {
- versionData: VersionData
- battlesuits: BattlesuitData[]
- weapons: WeaponData[]
- stigmataSets: StigmataSet[]
-}
-
-const VersionShowPage = ({
- versionData,
- battlesuits,
- weapons,
- stigmataSets,
-}: VersionShowPageProps) => {
- const { t } = useTranslation()
- const [today, setToday] = useState(null)
- useEffect(() => {
- setToday(new Date(getDateString(new Date())))
- }, [])
- return (
-
- {
- return battlesuit.name
- })
- .join(',')} / ${t('versions.new-weapons')}: ${weapons
- .map((weapon) => {
- return weapon.name
- })
- .join(',')}`}
- canonicalHref={`/honkai3rd/versions/${versionData.version}`}
- />
-
-
-
-
-
- {versionData.previousVersion != null && (
-
- {t('versions.previous')} (v{versionData.previousVersion})
-
- )}
- {versionData.nextVersion != null && (
-
- {t('versions.next')} (v{versionData.nextVersion})
-
- )}
-
-
- v{versionData.version} : {versionData.name}
-
-
- {formatDate(new Date(versionData.duration[0]), 'PP')} -{' '}
- {versionData.duration[1] != null
- ? formatDate(new Date(versionData.duration[1]), 'PP')
- : ''}
-
-
-
-
- {t('versions.new-battlesuits')}
-
-
- {battlesuits.map((battlesuit) => {
- return (
-
- )
- })}
-
-
-
- {t('versions.new-weapons')}
-
-
- {weapons.map((weapon) => {
- return
- })}
-
-
-
- {t('versions.new-stigmata-sets')}
-
-
- {stigmataSets.map((stigmataSet) => {
- return (
-
- )
- })}
-
-
-
-
- {t('versions.weekly-bosses')}
-
-
-
-
-
-
-
- {t('versions.supply-events')}
-
-
-
- {
- const imgSrc = getIconSrcFromItem(supplyEventData.featured[0])
- return {
- id: `${supplyEventData.duration[0]}/${supplyEventData.duration[1]}/${supplyEventData.name}`,
- label: (
-
- {!supplyEventData.verified && (
- ❓
- )}
- {imgSrc != null && (
-
- )}
- {supplyEventData.name}
-
- ),
- duration: supplyEventData.duration,
- row: supplyEventData.track,
- }
- })}
- today={today}
- startDate={versionData.duration[0]}
- endDate={
- versionData.duration[1] != null
- ? versionData.duration[1]
- : addDateToDateString(versionData.duration[0], {
- weeks: 6,
- })
- }
- />
-
-
- {t('versions.supply-events-disclaimer')}
-
-
-
- )
-}
-
-export default VersionShowPage
-
-export async function getStaticProps({
- params,
- locale,
-}: NextPageContext & { params: { versionId: string } }) {
- const versionData = getVersion(params.versionId, locale)!
-
- const battlesuits = versionData.newBattlesuits.map((battlesuitId) => {
- return getBattlesuitById(battlesuitId, locale)
- })
- const weapons = versionData.newWeapons.map((weaponId) => {
- return getWeaponById(weaponId, locale)
- })
- const stigmataSets = versionData.newStigmataSets.map((stigmataSetId) => {
- return getStigmataSetBySetId(stigmataSetId, locale)
- })
-
- return {
- props: {
- versionData,
- battlesuits,
- weapons,
- stigmataSets,
- ...(await getI18NProps(locale)),
- },
- }
-}
-
-export async function getStaticPaths() {
- return {
- paths: generateI18NPaths(
- listVersionData().map((versionData) => {
- return {
- params: {
- versionId: versionData.version.toString(),
- },
- }
- })
- ),
- fallback: false,
- }
-}
-
-function getIconSrcFromItem(item: { type: string; id: string }): string | null {
- switch (item.type) {
- case 'battlesuit':
- return `${assetsBucketBaseUrl}/honkai3rd/battlesuits/portrait-${item.id}.png`
- case 'weapon':
- return `${assetsBucketBaseUrl}/honkai3rd/weapons/${item.id}.png`
- case 'stigmata':
- return `${assetsBucketBaseUrl}/honkai3rd/stigmata/icon-${item.id}.png`
- case 'elf':
- return `${assetsBucketBaseUrl}/honkai3rd/elfs/icon-${item.id}.png`
- case 'outfit':
- return `${assetsBucketBaseUrl}/honkai3rd/outfits/portrait-${item.id}.webp`
- }
- return null
-}
diff --git a/src/pages/honkai3rd/versions/index.tsx b/src/pages/honkai3rd/versions/index.tsx
deleted file mode 100644
index 53a2795e..00000000
--- a/src/pages/honkai3rd/versions/index.tsx
+++ /dev/null
@@ -1,86 +0,0 @@
-/** @jsxImportSource theme-ui */
-import { Box, Heading, Link } from '@theme-ui/components'
-import NextLink from 'next/link'
-import Breadcrumb from '../../../components/organisms/Breadcrumb'
-import { listVersionData } from '../../../server/data/honkai3rd/versions'
-import { format as formatDate } from 'date-fns'
-import { BattlesuitData } from '../../../lib/honkai3rd/battlesuits'
-import { WeaponData } from '../../../lib/honkai3rd/weapons'
-import { VersionData } from '../../../lib/honkai3rd/versions'
-import { getI18NProps } from '../../../server/i18n'
-import { NextPageContext } from 'next'
-import { useTranslation } from '../../../lib/i18n'
-import Head from '../../../components/atoms/Head'
-import Honkai3rdLayout from '../../../components/layouts/Honkai3rdLayout'
-import { StigmataSet } from '../../../lib/honkai3rd/stigmata'
-
-interface VersionIndexPageProps {
- versionDataList: VersionData[]
- currentVersionData: VersionData
- currentVersionNewBattlesuits: BattlesuitData[]
- currentVersionNewWeapons: WeaponData[]
- currentVersionNewStigmataSets: StigmataSet[]
-}
-
-const VersionIndexPage = ({ versionDataList }: VersionIndexPageProps) => {
- const { t } = useTranslation()
-
- return (
-
-
-
-
-
-
-
- {t('versions.versions')}
-
-
- {versionDataList.map((versionData) => {
- return (
-
-
-
-
- {versionData.version} : {versionData.name} (
- {formatDate(new Date(versionData.duration[0]), 'PP')} -{' '}
- {versionData.duration[1] != null
- ? formatDate(new Date(versionData.duration[1]), 'PP')
- : ''}
- )
-
-
-
-
- )
- })}
-
-
-
- )
-}
-
-export async function getStaticProps({ locale }: NextPageContext) {
- return {
- props: {
- versionDataList: listVersionData(locale),
- ...(await getI18NProps(locale)),
- },
- }
-}
-
-export default VersionIndexPage
diff --git a/src/pages/honkai3rd/weapons/[weaponId].tsx b/src/pages/honkai3rd/weapons/[weaponId].tsx
index 18a49492..19f7d356 100644
--- a/src/pages/honkai3rd/weapons/[weaponId].tsx
+++ b/src/pages/honkai3rd/weapons/[weaponId].tsx
@@ -1,32 +1,30 @@
-/** @jsxImportSource theme-ui */
-import { Flex, Box, Card, Heading, Paragraph } from '@theme-ui/components'
import { NextPageContext } from 'next'
-import SquareImageBox from '../../../components/atoms/SquareImageBox'
-import Breadcrumb from '../../../components/organisms/Breadcrumb'
-import { weaponCategories, WeaponData } from '../../../lib/honkai3rd/weapons'
-import { generateI18NPaths, getI18NProps } from '../../../server/i18n'
-import { getWeaponById, getWeaponMapByIds, listWeapons } from '../../../server/data/honkai3rd/weapons'
-import { useTranslation } from '../../../lib/i18n'
-import Head from '../../../components/atoms/Head'
-import PageLink from '../../../components/atoms/PageLink'
-import { assetsBucketBaseUrl } from '../../../lib/consts'
+import { Box, Card, Flex, Heading } from 'theme-ui'
+import FormattedText from '../../../components/v2/FormattedText'
+import { formatSubSkillInfo, replaceNewLine } from '../../../lib/v2/data/formatText'
+import { loadWeaponCatalog, loadWeaponData } from '../../../lib/v2/server/loadData'
+import { RootWeaponData } from '../../../lib/v2/data/types'
+import { Fragment } from 'react'
+import { getWeaponTypeLabel } from '../../../lib/v2/data/text'
+import WeaponTypeIcon from '../../../components/v2/WeaponTypeIcon'
+import WeaponIcon from '../../../components/v2/WeaponIcon'
import Honkai3rdLayout from '../../../components/layouts/Honkai3rdLayout'
-import { getBattlesuitMapByIds } from '../../../server/data/honkai3rd/battlesuits'
-import { BattlesuitData } from '../../../lib/honkai3rd/battlesuits'
-import BattlesuitCard from '../../../components/molecules/BattlesuitCard'
-import WeaponCard from '../../../components/molecules/WeaponCard'
+import Head from '../../../components/atoms/Head'
+import { useTranslation } from 'next-i18next'
+import { getI18NProps } from '../../../server/i18n'
+import Breadcrumb from '../../../components/organisms/Breadcrumb'
interface WeaponShowPageProps {
- weapon: WeaponData
- battlesuitMap: { [key: string]: BattlesuitData }
- weaponMap: { [key: string]: WeaponData }
+ rootWeapon: RootWeaponData
}
-const WeaponShowPage = ({ weapon, battlesuitMap, weaponMap }: WeaponShowPageProps) => {
+const WeaponShowPage = ({ rootWeapon }: WeaponShowPageProps) => {
const { t } = useTranslation()
+ const weapon = rootWeapon.weapons[rootWeapon.weapons.length - 1]
- const weaponCategoryName = t(`weapons-show.${weapon.category}`)
- const weaponCategory = weaponCategories.find(category => category.value === weapon.category)
+ const weaponTypeLabel = getWeaponTypeLabel(weapon.type)
+ const atk = Math.floor(weapon.attackBase + weapon.attackAdd * (weapon.maxLv - 1))
+ const crt = Math.floor(weapon.criticalBase + weapon.criticalAdd * (weapon.maxLv - 1))
return (
@@ -34,112 +32,78 @@ const WeaponShowPage = ({ weapon, battlesuitMap, weaponMap }: WeaponShowPageProp
title={`${weapon.name} - ${t('common.honkai-3rd')} - ${t('common.abyss-lab')}`}
description={`${t('common.honkai-3rd')} ${t('weapons-show.weapon')} / ${'⭐'.repeat(
weapon.rarity
- )} / ${weaponCategoryName} / ATK : ${weapon.atk} / CRT : ${weapon.crt}`}
- canonicalHref={`/honkai3rd/weapons/${weapon.id}`}
+ )} / ${weaponTypeLabel} / ATK : ${atk} / CRT : ${crt}`}
+ canonicalHref={`/honkai3rd/v2/weapons/${weapon.id}`}
/>
-
-
+
{weapon.name}
-
+
-
-
-
- {weaponCategory != null && (
-
- )}
- {weaponCategoryName}
-
-
+ {replaceNewLine(weapon.description)}
+
+
+ {getWeaponTypeLabel(weapon.type)}
+
+
+ ATK : {atk} / CRT : {crt} (at Max Lv {weapon.maxLv})
-
- {'⭐'.repeat(weapon.rarity)}
-
-
- ATK : {weapon.atk} / CRT : {weapon.crt}
-
- {weapon.battlesuits != null && weapon.battlesuits.length > 0 && (
-
- {t('weapons-show.best-on')}
- {weapon.battlesuits.map(({ id: battlesuitId }) => {
- return
- })}
-
- )}
- {weapon.priWeapon != null && (
-
- {t('weapons-show.pri-weapon')}
-
-
- )}
- {weapon.originalWeapons != null && weapon.originalWeapons.length > 0 && (
-
- {t('weapons-show.original-weapon')}
- {weapon.originalWeapons.map(originalWeaponId => {
- return
- })}
-
- )}
- {/* {weapon.sources != null && (
-
- {t('weapons-show.sources')}
- {weapon.sources
- .sort((a, b) => a.type.localeCompare(b.type))
- .map((source) => {
- return
- })}
-
- )} */}
-
+ Skills
+
{weapon.skills.map(skill => {
return (
-
-
- {skill.name}
-
-
+
+
+ {skill.name}
+
+
+
- {skill.description}
-
-
+
+ {formatSubSkillInfo({
+ info: skill.info,
+ maxLv: weapon.maxLv,
+ paramBase1: skill.param1,
+ paramBase2: skill.param2,
+ paramBase3: skill.param3,
+ paramAdd1: skill.param1Add,
+ paramAdd2: skill.param2Add,
+ paramAdd3: skill.param3Add
+ })}
+
+
+
)
})}
-
+
+ {/* {JSON.stringify(weapon, null, 2)} */}
)
@@ -147,43 +111,23 @@ const WeaponShowPage = ({ weapon, battlesuitMap, weaponMap }: WeaponShowPageProp
export default WeaponShowPage
-export async function getStaticProps({ params, locale }: NextPageContext & { params: { weaponId: string } }) {
- const weapon = getWeaponById(params.weaponId, locale)
- const battlesuitMap = getBattlesuitMapByIds(
- weapon != null && weapon.battlesuits != null ? weapon.battlesuits.map(({ id }) => id) : [],
- locale
- )
-
- const weaponIds = []
- if (weapon != null) {
- if (weapon.priWeapon != null) {
- weaponIds.push(weapon.priWeapon)
- }
- if (weapon.originalWeapons != null) {
- weaponIds.push(...weapon.originalWeapons)
- }
- }
- const weaponMap = getWeaponMapByIds(weaponIds, locale)
+export async function getStaticProps({ locale, params }: NextPageContext & { params: { weaponId: string } }) {
+ const rootWeapon = loadWeaponData(params.weaponId)
return {
- props: {
- weapon,
- battlesuitMap,
- weaponMap,
- ...(await getI18NProps(locale))
- }
+ props: { rootWeapon, ...(await getI18NProps(locale)) }
}
}
export async function getStaticPaths() {
+ const weaponCatalog = loadWeaponCatalog()
+
return {
- paths: generateI18NPaths(
- listWeapons().map(weapon => {
- return {
- params: { weaponId: weapon.id }
- }
- })
- ),
+ paths: weaponCatalog.map(catalogItem => {
+ return {
+ params: { weaponId: catalogItem.id }
+ }
+ }),
fallback: false
}
}
diff --git a/src/pages/honkai3rd/weapons/index.tsx b/src/pages/honkai3rd/weapons/index.tsx
index 6f45aff8..168cb62e 100644
--- a/src/pages/honkai3rd/weapons/index.tsx
+++ b/src/pages/honkai3rd/weapons/index.tsx
@@ -1,90 +1,68 @@
/** @jsxImportSource theme-ui */
-import { Box, Heading, Flex } from '@theme-ui/components'
-import Breadcrumb from '../../../components/organisms/Breadcrumb'
-import { listWeapons } from '../../../server/data/honkai3rd/weapons'
-import { pick } from 'ramda'
-import { useMemo } from 'react'
-import FilterButton from '../../../components/atoms/FilterButton'
-import { useRouter } from 'next/router'
-import { weaponCategories, WeaponData } from '../../../lib/honkai3rd/weapons'
-import WeaponCard from '../../../components/molecules/WeaponCard'
-import { getI18NProps } from '../../../server/i18n'
+import { Box, Card } from '@theme-ui/components'
import { NextPageContext } from 'next'
-import { useTranslation, translate } from '../../../lib/i18n'
+import { Flex, Heading, Link } from 'theme-ui'
+import { loadWeaponCatalog } from '../../../lib/v2/server/loadData'
+import { WeaponCatalogItem } from '../../../lib/v2/data/types'
+import WeaponIcon from '../../../components/v2/WeaponIcon'
import Head from '../../../components/atoms/Head'
import Honkai3rdLayout from '../../../components/layouts/Honkai3rdLayout'
-
-type WeaponListItemData = Pick
+import { useTranslation } from 'next-i18next'
+import { getI18NProps } from '../../../server/i18n'
+import Breadcrumb from '../../../components/organisms/Breadcrumb'
interface WeaponListPageProps {
- weaponDataList: WeaponListItemData[]
+ weaponCatalog: WeaponCatalogItem[]
}
-const weaponFilterOptions = [{ value: 'all', label: 'All', krLabel: '전체', icon: undefined }, ...weaponCategories]
-
-const WeaponListPage = ({ weaponDataList }: WeaponListPageProps) => {
- const { query, locale } = useRouter()
+const WeaponListPage = ({ weaponCatalog }: WeaponListPageProps) => {
const { t } = useTranslation()
-
- const categoryFilter = useMemo(() => {
- if (query.category == null) {
- return 'all'
- }
-
- return typeof query.category === 'string' ? query.category : query.category[0]
- }, [query])
-
- const weaponList = useMemo(() => {
- return weaponDataList.map(weapon => {
- const hidden = isWeaponHidden(weapon, categoryFilter)
- return
- })
- }, [weaponDataList, categoryFilter])
-
return (
-
-
+
+
-
-
-
-
- {t('weapons-list.weapons')}
-
- {t('weapons-list.filter-by-category')}
-
- {weaponFilterOptions.map(({ value, label, krLabel, icon }) => {
- return (
-
- )
- })}
-
-
-
- {weaponList}
-
-
+ {t('common.weapons')}
+
+ {weaponCatalog
+ .filter(filterWeapons)
+ .sort(sortWeapons)
+ .map(weapon => {
+ return (
+
+
+
+
+
+
+
+ {weapon.name}
+
+ {/* {weapon.id} */}
+
+
+
+ )
+ })}
+
)
@@ -93,32 +71,76 @@ const WeaponListPage = ({ weaponDataList }: WeaponListPageProps) => {
export default WeaponListPage
export async function getStaticProps({ locale }: NextPageContext) {
+ const weaponCatalog = loadWeaponCatalog()
+
return {
- props: {
- weaponDataList: listWeapons(locale).map(weapon => {
- return pick(['name', 'id', 'rarity', 'category'], weapon)
- }),
- ...(await getI18NProps(locale))
- }
+ props: { weaponCatalog, ...(await getI18NProps(locale)) }
}
}
-function isWeaponHidden(weapon: WeaponListItemData, filter: string): boolean {
- switch (filter) {
- case 'pistol':
- case 'katana':
- case 'cannon':
- case 'greatsword':
- case 'cross':
- case 'gauntlet':
- case 'scythe':
- case 'lance':
- case 'bow':
- case 'chakram':
- case 'javelin':
- return weapon.category !== filter
- default:
- case 'all':
+function filterWeapons(weapon: WeaponCatalogItem) {
+ // Valid weapons
+ // 24XXX EX Weapons
+ // 21XXX Sprit Weapon
+ // 19XXX Alloy Weapons
+ // 10XXX Regular Weapons
+
+ // Event Weapon?
+ if (weapon.id.startsWith('18') && weapon.id.length === 5) {
+ return false
+ }
+ // Test Data?
+ if (weapon.id.startsWith('1023') && weapon.id.length === 6) {
+ return false
+ }
+ // Unreleased(Number looks good but lacking info)
+ switch (weapon.id) {
+ case '24000': // 2nd relic alpha
+ case '24040': // Removed 7 Thunders
+ case '24034': // PE Temp Lance
+ case '24024': // keqing ex
+ case '20765': // ?
+ case '10243': // No Name
+ case '10219': // ?
+ case '10179': // ?
return false
}
+
+ // Divine Keys
+ switch (weapon.id) {
+ case '20000': // Taixuan Sword
+ case '10248': // Abyss Flower
+ case '10267': // Eden's star anti entropy
+ case '10263': // 7 Thunders
+ case '10247': // Abyss
+ case '10235': // Fenghuang pistols
+ case '10234': // Fenghuang fists
+ case '10223': // Eden twin stars
+ case '10212': // Pledge of Sakura
+ case '10211': // Pledge of Judah
+ case '10209': // Might of an utu
+ case '10199': // Cleaver of Shamash
+ case '10163': // Shamash pistols
+ // The below don't have duplicated data
+ // case '10180': // Eden's star
+ // case '10169': // Taxiuan fists
+ // case '10158': // Jizo Mitama
+ return false
+ }
+
+ return true
+}
+
+function sortWeapons(a: WeaponCatalogItem, b: WeaponCatalogItem) {
+ let aId = parseInt(a.id)
+
+ const aTypeOrder = aId > 21000 && aId < 22000 ? 2 : aId > 19000 && aId < 20000 ? 1 : 0
+
+ let bId = parseInt(b.id)
+ const bTypeOrder = bId > 21000 && bId < 22000 ? 2 : bId > 19000 && bId < 20000 ? 1 : 0
+ if (aTypeOrder !== bTypeOrder) {
+ return aTypeOrder - bTypeOrder
+ }
+
+ return bId - aId
}