mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: united duel data
This commit is contained in:
1 parent
da767213cb
commit
7e92f8ac50
23 files changed
+249
-249
No files matched your search
+43
-1
@@ -1,7 +1,43 @@
|
||||
import { produce } from 'immer';
|
||||
import { create } from 'zustand';
|
||||
import { subscribeWithSelector } from 'zustand/middleware';
|
||||
import { DuelMember } from './tankopedia';
|
||||
import {
|
||||
EngineDefinition,
|
||||
GunDefinition,
|
||||
ShellDefinition,
|
||||
TankDefinition,
|
||||
TrackDefinition,
|
||||
TurretDefinition,
|
||||
} from '../core/blitzkrieg/tankDefinitions';
|
||||
|
||||
type EquipmentMatrixItem = -1 | 0 | 1;
|
||||
type EquipmentMatrixRow = [
|
||||
EquipmentMatrixItem,
|
||||
EquipmentMatrixItem,
|
||||
EquipmentMatrixItem,
|
||||
];
|
||||
export type EquipmentMatrix = [
|
||||
EquipmentMatrixRow,
|
||||
EquipmentMatrixRow,
|
||||
EquipmentMatrixRow,
|
||||
];
|
||||
|
||||
export interface DuelMember {
|
||||
tank: TankDefinition;
|
||||
engine: EngineDefinition;
|
||||
turret: TurretDefinition;
|
||||
gun: GunDefinition;
|
||||
shell: ShellDefinition;
|
||||
track: TrackDefinition;
|
||||
equipment: EquipmentMatrix;
|
||||
pitch: number;
|
||||
yaw: number;
|
||||
consumables: number[];
|
||||
crewMastery: number;
|
||||
provisions: number[];
|
||||
camouflage: boolean;
|
||||
cooldownBooster: number;
|
||||
}
|
||||
|
||||
export interface Duel {
|
||||
assigned: boolean;
|
||||
@@ -18,3 +54,9 @@ export const useDuel = create<Duel>()(
|
||||
export function mutateDuel(recipe: (draft: Duel) => void) {
|
||||
useDuel.setState(produce(recipe));
|
||||
}
|
||||
|
||||
export const genericDefaultEquipmentMatrix: EquipmentMatrix = [
|
||||
[1, 1, -1],
|
||||
[0, 0, 0],
|
||||
[0, 0, 0],
|
||||
];
|
||||
@@ -5,28 +5,13 @@ import { create } from 'zustand';
|
||||
import { persist, subscribeWithSelector } from 'zustand/middleware';
|
||||
import { ENVIRONMENTS } from '../app/tools/tankopedia/[id]/components/Lighting';
|
||||
import { TankType, TreeType } from '../components/Tanks';
|
||||
import {
|
||||
EngineDefinition,
|
||||
GunDefinition,
|
||||
ShellDefinition,
|
||||
TankDefinition,
|
||||
Tier,
|
||||
TrackDefinition,
|
||||
TurretDefinition,
|
||||
} from '../core/blitzkrieg/tankDefinitions';
|
||||
import { Tier } from '../core/blitzkrieg/tankDefinitions';
|
||||
|
||||
export type TankopediaSortBy = keyof typeof SORT_NAMES;
|
||||
export type TankopediaSortDirection = 'ascending' | 'descending';
|
||||
export type TankopediaTestTankDisplay = 'include' | 'exclude' | 'only';
|
||||
export type TankopediaMode = 'model' | 'armor';
|
||||
export interface DuelMember {
|
||||
tank: TankDefinition;
|
||||
engine: EngineDefinition;
|
||||
turret: TurretDefinition;
|
||||
gun: GunDefinition;
|
||||
shell: ShellDefinition;
|
||||
track: TrackDefinition;
|
||||
}
|
||||
|
||||
interface TankopediaPersistent {
|
||||
model: {
|
||||
visual: {
|
||||
@@ -50,24 +35,10 @@ interface TankopediaPersistent {
|
||||
test: TankopediaTestTankDisplay;
|
||||
page: number;
|
||||
};
|
||||
mode: TankopediaMode;
|
||||
}
|
||||
|
||||
export type EquipmentMatrix = (-1 | 0 | 1)[][];
|
||||
|
||||
interface TankopediaTemporary {
|
||||
model: {
|
||||
pose: {
|
||||
yaw: number;
|
||||
pitch: number;
|
||||
};
|
||||
};
|
||||
equipmentMatrix: EquipmentMatrix;
|
||||
mode: TankopediaMode;
|
||||
consumables: number[];
|
||||
crewMastery: number;
|
||||
provisions: number[];
|
||||
camouflage: boolean;
|
||||
cooldownBooster: number;
|
||||
shot?: Shot;
|
||||
}
|
||||
|
||||
@@ -152,31 +123,14 @@ export const useTankopediaPersistent = create<TankopediaPersistent>()(
|
||||
test: 'include',
|
||||
page: 0,
|
||||
},
|
||||
mode: 'model',
|
||||
})),
|
||||
{ name: 'tankopedia', merge },
|
||||
),
|
||||
);
|
||||
|
||||
export const useTankopediaTemporary = create<TankopediaTemporary>()(
|
||||
subscribeWithSelector<TankopediaTemporary>(() => ({
|
||||
model: {
|
||||
pose: {
|
||||
yaw: 0,
|
||||
pitch: 0,
|
||||
},
|
||||
},
|
||||
equipmentMatrix: [
|
||||
[0, 0, 0],
|
||||
[0, 0, 0],
|
||||
[0, 0, 0],
|
||||
],
|
||||
crewMastery: 1,
|
||||
mode: 'model',
|
||||
consumables: [],
|
||||
provisions: [],
|
||||
camouflage: true,
|
||||
cooldownBooster: 0,
|
||||
})),
|
||||
subscribeWithSelector<TankopediaTemporary>(() => ({})),
|
||||
);
|
||||
|
||||
export default function mutateTankopediaPersistent(
|
||||
|
||||
Reference in new issue
Block a user