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

Combo only UI redesign #2514

Merged
merged 25 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c14d9ce
Design I init
frzyc Oct 16, 2024
a4934cf
preset conditionals, bonusStats
frzyc Oct 16, 2024
9da979c
Merge remote-tracking branch 'origin/master' into combo_only_experiment
frzyc Oct 19, 2024
d7567c2
Merge and fix remote-tracking branch 'origin/master' into combo_only_…
frzyc Oct 21, 2024
a378041
futher fixes
frzyc Oct 21, 2024
f6230c0
cleanup
frzyc Oct 21, 2024
09291a8
add opt UI
frzyc Oct 22, 2024
5475336
Merge remote-tracking branch 'origin/master' into combo_only_experiment
frzyc Oct 23, 2024
77959d7
initial funneling of combo to solver
frzyc Oct 23, 2024
6e96317
Merge remote-tracking branch 'origin/master' into combo_only_experiment
frzyc Oct 24, 2024
4dec2e7
fix comment
frzyc Oct 24, 2024
337c3f9
fix tag data
frzyc Oct 24, 2024
ea5b323
clean up console logs
frzyc Oct 25, 2024
cbdbe7a
remove page-team/s
frzyc Oct 25, 2024
43bbf9c
rename of page-combo/s to page-team/s
frzyc Oct 25, 2024
8d21b8f
more cleanup
frzyc Oct 25, 2024
403808b
create sr-ui-db lib
frzyc Oct 26, 2024
5f78647
speeling + tag comparison
frzyc Oct 26, 2024
c20217b
some updates
frzyc Oct 26, 2024
de5f856
Merge branch 'master' into combo_only_experiment
frzyc Oct 26, 2024
b030d23
fixes and memoization
frzyc Oct 26, 2024
693e951
Merge remote-tracking branch 'origin/master' into combo_only_experiment
frzyc Oct 28, 2024
b746243
rename teammateDatum
frzyc Oct 30, 2024
0e952fd
Merge remote-tracking branch 'origin/master' into combo_only_experiment
frzyc Oct 30, 2024
c6fca35
reshuffle
frzyc Oct 30, 2024
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
14 changes: 14 additions & 0 deletions libs/common/util/src/lib/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,17 @@ export function handleMultiSelect<T>(allKeys: T[]) {
return [...new Set(toggleArr(arr, v))]
}
}

/**
* Shorten or pad an array to a certain length, with a default value.
* @param array
* @param length
* @param value
*/
export function pruneOrPadArray<T>(array: T[], length: number, value: T) {
if (array.length > length) {
array.splice(-1, length)
} else {
array.splice(-1, 0, ...new Array(length - array.length).fill(value))
}
}
frzyc marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion libs/common/util/src/lib/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const getObjectKeysRecursive = (obj: unknown): string[] =>

export function deepFreeze<T>(obj: T, layers = 5): T {
if (layers === 0) return obj
if (typeof obj === 'object')
if (obj && typeof obj === 'object')
Object.values(Object.freeze(obj)).forEach((o) => deepFreeze(o, layers--))
return obj
frzyc marked this conversation as resolved.
Show resolved Hide resolved
}
Expand Down
39 changes: 19 additions & 20 deletions libs/sr/consts/src/relic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,26 +125,25 @@ export const relicSubstatRollData: Record<
5: { low: 3, high: 4, numUpgrades: 5 },
} as const

export const relicSlotToMainStatKeys: Record<RelicSlotKey, RelicMainStatKey[]> =
{
head: ['hp'],
hands: ['atk'],
body: ['hp_', 'atk_', 'def_', 'eff_', 'heal_', 'crit_', 'crit_dmg_'],
feet: ['hp_', 'atk_', 'def_', 'spd'],
sphere: [
'hp_',
'atk_',
'def_',
'physical_dmg_',
'fire_dmg_',
'ice_dmg_',
'wind_dmg_',
'lightning_dmg_',
'quantum_dmg_',
'imaginary_dmg_',
],
rope: ['hp_', 'atk_', 'def_', 'brEffect_', 'enerRegen_'],
}
export const relicSlotToMainStatKeys = {
head: ['hp'],
hands: ['atk'],
body: ['hp_', 'atk_', 'def_', 'eff_', 'heal_', 'crit_', 'crit_dmg_'],
feet: ['hp_', 'atk_', 'def_', 'spd'],
sphere: [
'hp_',
'atk_',
'def_',
'physical_dmg_',
'fire_dmg_',
'ice_dmg_',
'wind_dmg_',
'lightning_dmg_',
'quantum_dmg_',
'imaginary_dmg_',
],
rope: ['hp_', 'atk_', 'def_', 'brEffect_', 'enerRegen_'],
} as const

export const allRelicMainSubStatKeys = Array.from(
new Set([...allRelicSubStatKeys, ...allRelicMainStatKeys] as const)
Expand Down
241 changes: 0 additions & 241 deletions libs/sr/db/src/Database/DataManagers/LoadoutDataManager.ts

This file was deleted.

20 changes: 5 additions & 15 deletions libs/sr/db/src/Database/DataManagers/OptConfigDataManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ import {
objKeyMap,
validateArr,
} from '@genshin-optimizer/common/util'
import type {
CharacterKey,
RelicMainStatKey,
RelicSlotKey,
} from '@genshin-optimizer/sr/consts'
import type { CharacterKey, RelicSlotKey } from '@genshin-optimizer/sr/consts'
import {
allCharacterKeys,
allRelicSetKeys,
Expand Down Expand Up @@ -53,18 +49,17 @@ export interface OptConfig {
relicSetExclusion: RelicSetExclusion
statFilters: StatFilters
mainStatKeys: {
body: RelicMainStatKey[]
feet: RelicMainStatKey[]
sphere: RelicMainStatKey[]
rope: RelicMainStatKey[]
body: (typeof relicSlotToMainStatKeys)['body'][number][]
feet: (typeof relicSlotToMainStatKeys)['feet'][number][]
sphere: (typeof relicSlotToMainStatKeys)['sphere'][number][]
rope: (typeof relicSlotToMainStatKeys)['rope'][number][]
head?: never
hands?: never
}
excludedLocations: CharacterKey[]
allowLocationsState: AllowLocationsState
relicExclusion: string[]
useExcludedRelics: boolean
optimizationTarget?: Tag
mainStatAssumptionLevel: number
allowPartial: boolean
maxBuildsToShow: number
Expand Down Expand Up @@ -96,7 +91,6 @@ export class OptConfigDataManager extends DataManager<
useExcludedRelics,
statFilters,
mainStatKeys,
optimizationTarget,
mainStatAssumptionLevel,
excludedLocations,
allowLocationsState,
Expand Down Expand Up @@ -139,8 +133,6 @@ export class OptConfigDataManager extends DataManager<
})
}

if (optimizationTarget && !validateTag(optimizationTarget))
optimizationTarget = undefined
if (
typeof mainStatAssumptionLevel !== 'number' ||
mainStatAssumptionLevel < 0 ||
Expand Down Expand Up @@ -210,7 +202,6 @@ export class OptConfigDataManager extends DataManager<
useExcludedRelics,
statFilters,
mainStatKeys,
optimizationTarget,
mainStatAssumptionLevel,
excludedLocations,
allowLocationsState,
Expand Down Expand Up @@ -269,7 +260,6 @@ const initialBuildSettings: OptConfig = deepFreeze({
sphere: relicSlotToMainStatKeys.sphere,
rope: relicSlotToMainStatKeys.rope,
},
optimizationTarget: undefined,
mainStatAssumptionLevel: 0,
excludedLocations: [],
allowLocationsState: 'unequippedOnly',
Expand Down
Loading
Loading