Skip to content

Commit

Permalink
Merge branch 'master' into tc-opt
Browse files Browse the repository at this point in the history
  • Loading branch information
frzyc authored Dec 31, 2023
2 parents ef2b839 + 6e3ca46 commit 23b5887
Show file tree
Hide file tree
Showing 162 changed files with 5,152 additions and 1,155 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: New Beta Release
name: New Beta GO Release

on:
push:
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/beta-sro-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: New Beta SRO Release

on:
push:
branches:
- master

# Only allow the most recent run of beta release to complete, if multiple are queued.
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
call-deploy-frontend:
uses: ./.github/workflows/deploy-frontend.yml
with:
frontend_name: 'sr-frontend'
repo_full_name: ${{ github.repository }}
ref: ${{ github.ref }}
deployment_name: 'beta'
pr_repo: ${{ vars.PR_REPO }}
show_dev_components: true
secrets: inherit
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- uses: actions/checkout@v3
with:
persist-credentials: false
submodules: true
- uses: actions/setup-node@v3
with:
node-version: 18
Expand All @@ -34,6 +35,7 @@ jobs:
- uses: actions/checkout@v3
with:
persist-credentials: false
submodules: true
- uses: actions/setup-node@v3
with:
node-version: 18
Expand All @@ -52,6 +54,7 @@ jobs:
- uses: actions/checkout@v3
with:
persist-credentials: false
submodules: true
- uses: actions/setup-node@v3
with:
node-version: 18
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
with:
repository: ${{ inputs.repo_full_name }}
ref: ${{ inputs.ref }}
submodules: true
- uses: actions/setup-node@v3
with:
node-version: 18
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-node@v3
with:
node-version: 18
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@ Thumbs.db

# Next.js
.next

# nx
.nx/cache
8 changes: 8 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[submodule "libs/dm/GenshinData"]
path = libs/dm/GenshinData
url = https://gitlab.com/Dimbreath/AnimeGameData.git
shallow = true
[submodule "libs/sr-dm/StarRailData"]
path = libs/sr-dm/StarRailData
url = https://github.com/Dimbreath/StarRailData.git
shallow = true
2 changes: 2 additions & 0 deletions .nxignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
libs/sr-dm/StarRailData
!libs/dm/GenshinData.hash
libs/dm/GenshinData
!libs/sr-dm/StarRailData.hash
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/.yarn

/libs/dm/GenshinData
/libs/sr-dm/StarRailData
*_gen.json

/libs/gi-stats/Data
Expand All @@ -13,3 +14,6 @@
# generated from backend
apps/gi-backend/src/app/graphql_gen.ts
apps/gi-backend/src/app/schema_gen.graphql

# nx
/.nx/cache
Binary file not shown.
32 changes: 14 additions & 18 deletions apps/frontend/src/app/Components/Artifact/ArtifactTooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import {
artDisplayValue,
getMainStatDisplayStr,
} from '@genshin-optimizer/gi-util'
import type { RollColorKey } from '@genshin-optimizer/gi-ui'
import { IconStatDisplay } from '@genshin-optimizer/gi-ui'
import { getMainStatDisplayStr } from '@genshin-optimizer/gi-util'
import { iconInlineProps } from '@genshin-optimizer/svgicons'
import { clamp, unit } from '@genshin-optimizer/util'
import { clamp } from '@genshin-optimizer/util'
import { Box, Skeleton, Typography } from '@mui/material'
import { Suspense } from 'react'
import { useTranslation } from 'react-i18next'
import { getArtSheet } from '../../Data/Artifacts'
import Artifact from '../../Data/Artifacts/Artifact'
import KeyMap from '../../KeyMap'
import StatIcon from '../../KeyMap/StatIcon'
import type { ICachedArtifact, ICachedSubstat } from '../../Types/artifact'
import type { ICachedArtifact } from '../../Types/artifact'
import BootstrapTooltip from '../BootstrapTooltip'
import LocationName from '../Character/LocationName'
import SqBadge from '../SqBadge'
Expand Down Expand Up @@ -70,18 +69,15 @@ function ArtifactData({ art }: { art: ICachedArtifact }) {
</Typography>
<Box py={1}>
{substats.map(
(stat: ICachedSubstat) =>
!!stat.value && (
<Typography
key={stat.key}
color={`roll${clamp(stat.rolls.length, 1, 6)}.main`}
>
<StatIcon statKey={stat.key} iconProps={iconInlineProps} />{' '}
{tk(stat.key)}{' '}
<strong>{`+${artDisplayValue(stat.value, unit(stat.key))}${unit(
stat.key
)}`}</strong>
</Typography>
({ value, key, rolls }) =>
!!(value && key) && (
<IconStatDisplay
key={key}
statKey={key}
value={value}
color={`roll${clamp(rolls.length, 1, 6)}` as RollColorKey} //TODO: stat.rolls.length instead of 1
prefix="+"
/>
)
)}
</Box>
Expand Down
15 changes: 10 additions & 5 deletions apps/frontend/src/app/Data/Artifacts/SongOfDaysPast/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ const burst_dmgInc = { ...healing_dmgInc }
export const data: Data = dataObjForArtifactSheet(key, {
premod: {
heal_: set2,
normal_dmgInc,
charged_dmgInc,
plunging_dmgInc,
skill_dmgInc,
burst_dmgInc,
},
teamBuff: {
premod: {
normal_dmgInc,
charged_dmgInc,
plunging_dmgInc,
skill_dmgInc,
burst_dmgInc,
},
},
})

Expand All @@ -54,6 +58,7 @@ const sheet: IArtifactSheet = {
value: condHealing,
path: condHealingPath,
name: trm('condName'),
teamBuff: true,
states: objKeyMap(healingArr, (heal) => ({
name: `${heal}`,
fields: [
Expand Down
1 change: 1 addition & 0 deletions apps/frontend/src/app/Data/Characters/HuTao/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ const dmgFormulas = {
),
skill: {
dmg: dmgNode('atk', dm.skill.dmg, 'skill'),
atk,
},
burst: {
dmg: dmgNode('atk', dm.burst.dmg, 'burst'),
Expand Down
27 changes: 14 additions & 13 deletions apps/frontend/src/app/Formula/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import type {
SubstatKey,
} from '@genshin-optimizer/consts'
import { allElementWithPhyKeys } from '@genshin-optimizer/consts'
import { getMainStatDisplayValue } from '@genshin-optimizer/gi-util'
import { getMainStatValue } from '@genshin-optimizer/gi-util'
import {
crawlObject,
layeredAssignment,
objKeyMap,
objPathValue,
toDecimal,
} from '@genshin-optimizer/util'
import type { ICachedArtifact } from '../Types/artifact'
import type { ICachedCharacter } from '../Types/character'
Expand Down Expand Up @@ -66,24 +67,24 @@ function dataObjForArtifact(
art: ICachedArtifact,
mainStatAssumptionLevel = 0
): Data {
const mainStatVal = getMainStatDisplayValue(
const mainStatVal = getMainStatValue(
art.mainStatKey,
art.rarity,
Math.max(Math.min(mainStatAssumptionLevel, art.rarity * 4), art.level)
)
const stats: [ArtifactSetKey | MainStatKey | SubstatKey, number][] = []
stats.push([art.mainStatKey, mainStatVal])
art.substats.forEach(
({ key, accurateValue }) => key && stats.push([key, accurateValue])
({ key, accurateValue }) =>
key && stats.push([key, toDecimal(accurateValue, key)])
)
return {
art: {
...Object.fromEntries(
stats.map(([key, value]) =>
key.endsWith('_')
? [key, percent(value / 100)]
: [key, constant(value)]
)
stats.map(([key, value]) => [
key,
key.endsWith('_') ? percent(value) : constant(value),
])
),
[art.slotKey]: {
id: constant(art.id),
Expand Down Expand Up @@ -428,15 +429,15 @@ function compareInternal(data1: any | undefined, data2: any | undefined): any {
}
}

export type { NodeDisplay, UIData }
export {
compareDisplayUIData,
compareTeamBuffUIData,
computeUIData,
dataObjForArtifact,
dataObjForCharacter,
dataObjForWeapon,
mergeData,
computeUIData,
inferInfoMut,
mergeData,
uiDataForTeam,
compareTeamBuffUIData,
compareDisplayUIData,
}
export type { NodeDisplay, UIData }
2 changes: 1 addition & 1 deletion apps/frontend/src/app/PageArtifact/ArtifactEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export default function ArtifactEditor({
disableSlot = false,
}: ArtifactEditorProps) {
const queueRef = useRef(
new ScanningQueue(textsFromImage, process.env.NODE_ENV === 'development')
new ScanningQueue(textsFromImage, shouldShowDevComponents)
)
const queue = queueRef.current
const { t } = useTranslation('artifact')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
useTheme,
} from '@mui/material'
import { useCallback, useContext, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import CardDark from '../../../Components/Card/CardDark'
import CardLight from '../../../Components/Card/CardLight'
import ConditionalWrapper from '../../../Components/ConditionalWrapper'
Expand All @@ -33,22 +34,23 @@ const talentSpacing = {
}

export default function CharacterTalentPane() {
const { t } = useTranslation('sheet_gen')
const { character, characterSheet } = useContext(CharacterContext)
const { data } = useContext(DataContext)
const characterDispatch = useCharacterReducer(character.key)
const skillBurstList = [
['auto', 'Normal/Charged Attack'],
['skill', 'Elemental Skill'],
['burst', 'Elemental Burst'],
['auto', t('talents.auto')],
['skill', t('talents.skill')],
['burst', t('talents.burst')],
] as [TalentSheetElementKey, string][]
const passivesList: [
tKey: TalentSheetElementKey,
tText: string,
asc: number
][] = [
['passive1', 'Unlocked at Ascension 1', 1],
['passive2', 'Unlocked at Ascension 4', 4],
['passive3', 'Unlocked by Default', 0],
['passive1', t('unlockPassive1'), 1],
['passive2', t('unlockPassive2'), 4],
['passive3', t('unlockPassive3'), 0],
]
const ascension = data.get(input.asc).value
const constellation = data.get(input.constellation).value
Expand All @@ -60,20 +62,20 @@ export default function CharacterTalentPane() {
range(1, maxConstellationCount).map((i) => (
<SkillDisplayCard
talentKey={`constellation${i}` as TalentSheetElementKey}
subtitle={`Constellation Lv. ${i}`}
subtitle={t('constellationLvl', { level: i })}
onClickTitle={() =>
characterDispatch({
constellation: i === constellation ? i - 1 : i,
})
}
/>
)),
[constellation, characterDispatch]
[t, constellation, characterDispatch]
)
const constellationHeader = (
<DropdownButton
fullWidth
title={`Constellation Lv. ${constellation}`}
title={t('constellationLvl', { level: constellation })}
color="primary"
sx={{ borderRadius: 0 }}
>
Expand All @@ -88,7 +90,7 @@ export default function CharacterTalentPane() {
})
}
>
Constellation Lv. {i}
{t(`constellationLvl`, { level: i })}
</MenuItem>
))}
</DropdownButton>
Expand Down Expand Up @@ -126,7 +128,7 @@ export default function CharacterTalentPane() {
<Grid item {...talentSpacing}>
<SkillDisplayCard
talentKey="sprint"
subtitle="Alternative Sprint"
subtitle={t('talents.altSprint')}
/>
</Grid>
)}
Expand Down Expand Up @@ -210,6 +212,7 @@ function SkillDisplayCard({
subtitle,
onClickTitle,
}: SkillDisplayCardProps) {
const { t } = useTranslation('sheet_gen')
const {
character: { talent },
characterSheet,
Expand Down Expand Up @@ -242,7 +245,7 @@ function SkillDisplayCard({
header = (
<DropdownButton
fullWidth
title={`Talent Lv. ${level}`}
title={t('talentLvl', { level: level })}
color={levelBoost ? 'info' : 'primary'}
sx={{ borderRadius: 0 }}
>
Expand All @@ -253,7 +256,7 @@ function SkillDisplayCard({
disabled={talent[talentKey] === i}
onClick={() => setTalentLevel(talentKey, i)}
>
Talent Lv. {i + levelBoost}
{t('talentLvl', { level: i + levelBoost })}
</MenuItem>
))}
</DropdownButton>
Expand Down
Loading

0 comments on commit 23b5887

Please sign in to comment.