Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Character Material generation #2360

Merged
merged 3 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 32 additions & 10 deletions libs/gi/dm/src/dm/character/AvatarPromoteExcelConfigData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ type AvatarPromoteExcelConfigData = {
promoteAudio: string //"",
promoteLevel: number //1,
scoinCost?: number //20000,
costItems: Array<{
id: number //104161,
count: number //1
}>
costItems: Array<
| {
id: number //104161,
count: number //1
}
| Record<string, never>
>
// [
// {
// "id": number//104161,
Expand Down Expand Up @@ -54,19 +57,38 @@ type AvatarPromoteExcelConfigData = {
const ascensionSrc = JSON.parse(
readDMJSON('ExcelBinOutput/AvatarPromoteExcelConfigData.json')
) as AvatarPromoteExcelConfigData[]
export type AscensionData = {
[AvatarPromoteId: number]: {
props: { [key: string]: number }
}[]
}

export type AscensionRecord = {
props: { [key: string]: number }
scoinCost: number
costItems: Array<
| {
id: number
count: number
}
| Record<string, never>
nguyentvan7 marked this conversation as resolved.
Show resolved Hide resolved
>
promoteLevel: number
}[]
export type AscensionData = Record<number, AscensionRecord>

const ascensionData = {} as AscensionData
ascensionSrc.forEach((asc) => {
const { avatarPromoteId, promoteLevel = 0, addProps } = asc
const {
avatarPromoteId,
promoteLevel = 0,
addProps,
scoinCost,
costItems,
} = asc
if (!ascensionData[avatarPromoteId]) ascensionData[avatarPromoteId] = []
ascensionData[avatarPromoteId][promoteLevel] = {
props: Object.fromEntries(
addProps.map(({ propType, value = 0 }) => [propTypeMap[propType], value])
),
scoinCost: scoinCost ?? 0,
costItems,
promoteLevel,
}
})

Expand Down
8 changes: 7 additions & 1 deletion libs/gi/dm/src/dm/character/ProudSkillExcelConfigData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { readDMJSON } from '../../util'

type CostItem = {
id: number
count: number
}

export type ProudSkillExcelConfigData = {
proudSkillId: number //342101,
proudSkillGroupId: number //3421,
Expand All @@ -9,13 +14,14 @@ export type ProudSkillExcelConfigData = {
descTextMapHash: number //59436107,
unlockDescTextMapHash: number //4234322242,
icon: string //"UI_Talent_S_Noel_05",
costItems: object[]
costItems: CostItem[]
// [
// {},
// {},
// {},
// {}
// ],
coinCost?: number
filterConds: string[]
// [
// "TALENT_FILTER_NONE",
Expand Down
18 changes: 18 additions & 0 deletions libs/gi/mats/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
7 changes: 7 additions & 0 deletions libs/gi/mats/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# gi-mats

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test gi-mats` to execute the unit tests via [Jest](https://jestjs.io).
9 changes: 9 additions & 0 deletions libs/gi/mats/executors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"executors": {
"gen-mats": {
"implementation": "./src/executors/gen-mats/executor",
"schema": "./src/executors/gen-mats/schema.json",
"description": "gen-mats executor"
}
}
}
11 changes: 11 additions & 0 deletions libs/gi/mats/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable */
export default {
displayName: 'gi-mats',
preset: '../../../jest.preset.js',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../../coverage/libs/gi/mats',
}
6 changes: 6 additions & 0 deletions libs/gi/mats/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@genshin-optimizer/gi/mats",
"version": "0.0.1",
"type": "commonjs",
"executors": "./executors.json"
}
13 changes: 13 additions & 0 deletions libs/gi/mats/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "gi-mats",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/gi/mats/src",
"projectType": "library",
"tags": [],
"targets": {
"gen-file": {
"executor": "@genshin-optimizer/gi/mats:gen-mats",
"outputs": ["{projectRoot}/src/allCharacterMats_gen.json"]
}
}
}
Loading
Loading