-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy pathState.ts
More file actions
126 lines (109 loc) · 2.97 KB
/
Copy pathState.ts
File metadata and controls
126 lines (109 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import { PartialDeep } from 'type-fest';
import { Player } from '@/types/Player';
import { Monster } from '@/types/Monster';
import UserIssueType from '@/enums/UserIssueType';
import { DetailEntry } from '@/lib/CalcDetails';
export interface UserIssue {
type: UserIssueType;
message: string;
loadout?: string;
}
/**
* UI-specific toggled behaviour and state.
*/
export interface UI {
showPreferencesModal: boolean;
showShareModal: boolean;
username: string;
isDefensiveReductionsExpanded: boolean;
}
/**
* User preferences that we store in the user's localStorage. You should not add any keys here that shouldn't be
* saved locally and persist between sessions.
*/
export interface Preferences {
manualMode: boolean;
rememberUsername: boolean;
showHitDistribution: boolean;
showLoadoutComparison: boolean;
showTtkComparison: boolean;
showNPCVersusPlayerResults: boolean;
hitDistsHideZeros: boolean; // legacy name
hitDistShowSpec: boolean;
resultsExpanded: boolean;
debug?: {
itemIdsExpanded?: boolean;
calcDetailsExpanded?: boolean;
specDetailsExpanded?: boolean;
npcDetailsExpanded?: boolean;
}
}
export interface ChartEntry {
name: string | number,
[k: string]: string | number,
}
export interface ChartAnnotation {
value: number,
label: string
}
/**
* The result of running the calculator on a specific player loadout.
*/
export interface CalculatedLoadout {
userIssues?: UserIssue[],
}
export interface PlayerVsNPCCalculatedLoadout extends CalculatedLoadout {
details?: DetailEntry[],
specDetails?: DetailEntry[],
// Player vs NPC metrics
npcDefRoll?: number,
maxHit?: number,
expectedHit?: number,
maxAttackRoll?: number,
accuracy?: number,
dps?: number,
ttk?: number,
hitDist?: ChartEntry[],
ttkDist?: Map<number, number>,
specAccuracy?: number,
specMaxHit?: number,
specExpected?: number,
specMomentDps?: number,
specFullDps?: number,
specHitDist?: ChartEntry[],
}
// NPC vs Player metrics
export interface NPCVsPlayerCalculatedLoadout extends CalculatedLoadout {
npcDetails?: DetailEntry[],
playerDefRoll?: number,
npcMaxAttackRoll?: number,
npcMaxHit?: number,
npcDps?: number,
npcAccuracy?: number,
avgDmgTaken?: number,
}
export interface Calculator {
loadouts: (PlayerVsNPCCalculatedLoadout & NPCVsPlayerCalculatedLoadout)[]
}
/**
* This is the state that can be exported and imported (through shortlinks).
* If you change the schema here without taking precautions, you **will** break existing shortlinks.
*/
export interface ImportableData {
loadouts: PartialDeep<Player>[];
selectedLoadout: number;
monster: Monster;
}
/**
* The interface for the global app state, which includes not only the import(ed|able) data, but also the UI state,
* and the user's preferences.
*/
export interface State extends ImportableData {
ui: UI;
prefs: Preferences;
calc: Calculator;
/**
* All monsters that a player can fight.
*/
availableMonsters: Omit<Monster, 'inputs'>[];
}