Skip to content

Commit

Permalink
feat: impl zenless 1.0 assets
Browse files Browse the repository at this point in the history
  • Loading branch information
lgou2w committed Jul 6, 2024
1 parent 6a4ff14 commit 66f8c04
Show file tree
Hide file tree
Showing 29 changed files with 79 additions and 8 deletions.
Binary file added src/assets/images/zzz/bangboo/54001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/bangboo/54002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/bangboo/54004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/bangboo/54005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/bangboo/54006.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/bangboo/54008.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/bangboo/54009.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/bangboo/54013.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/character/1021.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/character/1041.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/character/1091.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/character/1101.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/character/1141.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/character/1181.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/character/1191.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/character/1211.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/character/1241.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/weapon/14102.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/weapon/14104.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/weapon/14110.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/weapon/14114.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/weapon/14118.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/weapon/14119.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/weapon/14121.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/zzz/weapon/14124.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 16 additions & 4 deletions src/components/gacha/GachaItemView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface GachaItemViewProps {
facet: AccountFacet
name: string
id: string
isWeapon: boolean
itemType: string
rank: 3 | 4 | 5 | '3' | '4' | '5'
size: number
usedPity?: number
Expand All @@ -22,9 +22,9 @@ export interface GachaItemViewProps {
}

export default function GachaItemView (props: GachaItemViewProps) {
const { facet, name, id, isWeapon, rank, size, usedPity, restricted, time } = props
const { facet, name, id, itemType, rank, size, usedPity, restricted, time } = props

const category = isWeapon ? 'weapon' : 'character'
const category = ItemTypeCategoryMappings[itemType]
const icon = lookupAssetIcon(facet, category, id)

let src = icon?.[1]
Expand All @@ -42,6 +42,7 @@ export default function GachaItemView (props: GachaItemViewProps) {
data-facet={facet}
data-rank={rank}
data-restricted={restricted}
data-category={category}
title={title}
>
<img src={src} alt={name} />
Expand All @@ -51,6 +52,15 @@ export default function GachaItemView (props: GachaItemViewProps) {
)
}

const ItemTypeCategoryMappings: Record<string, 'character' | 'weapon' | 'bangboo'> = {
角色: 'character',
武器: 'weapon',
光锥: 'weapon',
代理人: 'character',
音擎: 'weapon',
邦布: 'bangboo'
}

function getRemoteResourceSrc (facet: AccountFacet, category: string, itemIdOrName: string) {
return `https://hoyo-gacha.lgou2w.com/static/${facet}/${category}/cutted/${itemIdOrName}.png`
}
Expand Down Expand Up @@ -89,7 +99,9 @@ const GachaItemViewSx: SxProps<Theme> = {
bottom: 0,
border: 1,
borderColor: 'rgba(255, 255, 255, 0.25)'
},
}
},
'&[data-facet="starrail"], &[data-facet="zzz"]': {
'&[data-rank="3"] > img': { backgroundImage: 'linear-gradient(#434e7e, #4d80c8)' },
'&[data-rank="4"] > img': { backgroundImage: 'linear-gradient(#4e4976, #9061d2)' },
'&[data-rank="5"] > img': { backgroundImage: 'linear-gradient(#986359, #d2ad70)' }
Expand Down
2 changes: 1 addition & 1 deletion src/components/gacha/analysis/GachaAnalysisHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function GachaAnalysisHistoryList ({ facet, value }: {
key={item.id}
name={item.name}
id={item.item_id || item.name}
isWeapon={item.item_type === '武器' || item.item_type === '光锥' || item.item_type === '音擎'}
itemType={item.item_type}
rank={5}
size={GachaAnalysisHistoryItemViewSize}
usedPity={item.usedPity}
Expand Down
63 changes: 61 additions & 2 deletions src/components/gacha/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,31 @@ import StarRailWeapon23025 from '@/assets/images/starrail/weapon/23025.png'
import StarRailWeapon23026 from '@/assets/images/starrail/weapon/23026.png'
import StarRailWeapon23027 from '@/assets/images/starrail/weapon/23027.png'
import StarRailWeapon23028 from '@/assets/images/starrail/weapon/23028.png'
import ZenlessCharacter1021 from '@/assets/images/zzz/character/1021.png'
import ZenlessCharacter1041 from '@/assets/images/zzz/character/1041.png'
import ZenlessCharacter1091 from '@/assets/images/zzz/character/1091.png'
import ZenlessCharacter1101 from '@/assets/images/zzz/character/1101.png'
import ZenlessCharacter1141 from '@/assets/images/zzz/character/1141.png'
import ZenlessCharacter1181 from '@/assets/images/zzz/character/1181.png'
import ZenlessCharacter1191 from '@/assets/images/zzz/character/1191.png'
import ZenlessCharacter1211 from '@/assets/images/zzz/character/1211.png'
import ZenlessCharacter1241 from '@/assets/images/zzz/character/1241.png'
import ZenlessWeapon14102 from '@/assets/images/zzz/weapon/14102.png'
import ZenlessWeapon14104 from '@/assets/images/zzz/weapon/14104.png'
import ZenlessWeapon14110 from '@/assets/images/zzz/weapon/14110.png'
import ZenlessWeapon14114 from '@/assets/images/zzz/weapon/14114.png'
import ZenlessWeapon14118 from '@/assets/images/zzz/weapon/14118.png'
import ZenlessWeapon14119 from '@/assets/images/zzz/weapon/14119.png'
import ZenlessWeapon14121 from '@/assets/images/zzz/weapon/14121.png'
import ZenlessWeapon14124 from '@/assets/images/zzz/weapon/14124.png'
import ZenlessBangboo54001 from '@/assets/images/zzz/bangboo/54001.png'
import ZenlessBangboo54002 from '@/assets/images/zzz/bangboo/54002.png'
import ZenlessBangboo54004 from '@/assets/images/zzz/bangboo/54004.png'
import ZenlessBangboo54005 from '@/assets/images/zzz/bangboo/54005.png'
import ZenlessBangboo54006 from '@/assets/images/zzz/bangboo/54006.png'
import ZenlessBangboo54008 from '@/assets/images/zzz/bangboo/54008.png'
import ZenlessBangboo54009 from '@/assets/images/zzz/bangboo/54009.png'
import ZenlessBangboo54013 from '@/assets/images/zzz/bangboo/54013.png'

// HACK: These static resources only contain five-star!

Expand Down Expand Up @@ -309,15 +334,49 @@ const StarRail = {
}
} as const

const Zenless = {
character: {
1021: [1021, ZenlessCharacter1021],
1041: [1041, ZenlessCharacter1041],
1091: [1091, ZenlessCharacter1091],
1101: [1101, ZenlessCharacter1101],
1141: [1141, ZenlessCharacter1141],
1181: [1181, ZenlessCharacter1181],
1191: [1191, ZenlessCharacter1191],
1211: [1211, ZenlessCharacter1211],
1241: [1241, ZenlessCharacter1241]
},
weapon: {
14102: [14102, ZenlessWeapon14102],
14104: [14104, ZenlessWeapon14104],
14110: [14110, ZenlessWeapon14110],
14114: [14114, ZenlessWeapon14114],
14118: [14118, ZenlessWeapon14118],
14119: [14119, ZenlessWeapon14119],
14121: [14121, ZenlessWeapon14121],
14124: [14124, ZenlessWeapon14124]
},
bangboo: {
54001: [54001, ZenlessBangboo54001],
54002: [54002, ZenlessBangboo54002],
54004: [54004, ZenlessBangboo54004],
54005: [54005, ZenlessBangboo54005],
54006: [54006, ZenlessBangboo54006],
54008: [54008, ZenlessBangboo54008],
54009: [54009, ZenlessBangboo54009],
54013: [54013, ZenlessBangboo54013]
}
} as const

const Assets = {
genshin: Genshin,
starrail: StarRail,
zzz: {} // TODO: wait a minute
zzz: Zenless
}

export function lookupAssetIcon (
facet: keyof typeof Assets,
category: 'character' | 'weapon',
category: 'character' | 'weapon' | 'bangboo',
nameOrId: string
): [number, string] | undefined {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand Down
2 changes: 1 addition & 1 deletion src/components/gacha/overview/GachaOverviewGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function GachaOverviewGridCard ({ facet, value, newbie }: {
key={lastGolden.id}
name={lastGolden.name}
id={lastGolden.item_id || lastGolden.name}
isWeapon={lastGolden.item_type === '武器' || lastGolden.item_type === '光锥' || lastGolden.item_type === '音擎'}
itemType={lastGolden.item_type}
rank={5}
size={72}
usedPity={lastGolden.usedPity}
Expand Down

0 comments on commit 66f8c04

Please sign in to comment.