-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathmetadata.ts
More file actions
324 lines (292 loc) · 8.96 KB
/
metadata.ts
File metadata and controls
324 lines (292 loc) · 8.96 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
const stats = [
'Power',
'Precision',
'Toughness',
'Vitality',
'Ferocity',
'Condition Damage',
'Expertise',
'Concentration',
'Healing Power',
'Agony Resistance',
'Armor',
] as const;
export type StatName = (typeof stats)[number];
// added during the "buff" phase, so these cannot be "converted"
export const alternateStats = [
'Alternative Power',
'Alternative Precision',
'Alternative Ferocity',
] as const;
export const boons = [
'Aegis',
'Alacrity',
'Fury',
'Might',
'Protection',
'Quickness',
'Regeneration',
'Resistance',
'Resolution',
'Stability',
'Swiftness',
'Vigor',
] as const;
export type BoonName = (typeof boons)[number];
const boonDurations = boons.map((boon) => `${boon} Duration`) as `${BoonName} Duration`[];
// const conditions = [
// 'Bleeding',
// 'Blind',
// 'Burning',
// 'Chilled',
// 'Confusion',
// 'Crippled',
// 'Fear',
// 'Immobile',
// 'Poison',
// 'Slow',
// 'Taunt',
// 'Torment',
// 'Vulnerability',
// 'Weakness',
// ];
export const damagingConditions = [
'Bleeding',
'Burning',
'Confusion',
'Poison',
'Torment',
] as const;
export type DamagingConditionName = (typeof damagingConditions)[number];
const conditionDurations = damagingConditions.map(
(condition) => `${condition} Duration`,
) as `${DamagingConditionName} Duration`[];
const conditionCoefficients = damagingConditions.map(
(condition) => `${condition} Coefficient`,
) as `${DamagingConditionName} Coefficient`[];
const conditionDamages = damagingConditions.map(
(condition) => `Outgoing ${condition} Damage`,
) as `Outgoing ${DamagingConditionName} Damage`[];
export const percents = [
'Critical Chance',
'Boon Duration',
...boonDurations,
'Condition Duration',
'Condition Duration Uncapped',
...conditionDurations,
'Maximum Health',
'Outgoing Healing',
'Alternative Critical Chance',
'Phantasm Critical Chance',
'Clone Critical Chance',
] as const;
const coefficients = [
'Power Coefficient',
'NonCrit Power Coefficient',
'Power2 Coefficient',
...conditionCoefficients,
'Flat DPS',
'Siphon Coefficient',
'Siphon Base Coefficient',
] as const;
export const allDamageKeys = [
'Outgoing Strike Damage',
'Outgoing Condition Damage',
'Outgoing All Damage',
'Damage Reduction',
// 'Condition Damage Reduction',
'Outgoing Critical Damage',
...conditionDamages,
'Outgoing Alternative Damage',
'Outgoing Alternative Critical Damage',
'Outgoing Phantasm Damage',
'Outgoing Phantasm Critical Damage',
'Outgoing Siphon Damage',
] as const;
export type DamageKey = (typeof allDamageKeys)[number];
export const allDamageModes = ['add', 'mult', 'target', 'unknown'] as const;
export type DamageMode = (typeof allDamageModes)[number];
export const allAttributePointKeys = [...stats, ...alternateStats] as const;
export type AttributePointKey = (typeof allAttributePointKeys)[number];
export const allAttributePointModes = ['buff', 'converted', 'unknown'] as const;
export type AttributePointMode = (typeof allAttributePointModes)[number];
export const allAttributeCoefficientKeys = coefficients;
export type AttributeCoefficientKey = (typeof allAttributeCoefficientKeys)[number];
export const allAttributePercentKeys = percents;
export type AttributePercentKey = (typeof allAttributePercentKeys)[number];
export type AttributeKey = AttributePointKey | AttributeCoefficientKey | AttributePercentKey;
export const allConversionSourceKeys = stats;
export type ConversionSourceKey = (typeof allConversionSourceKeys)[number];
export const allConversionDestinationKeys = [...stats, ...percents, ...coefficients] as const;
export type ConversionDestinationKey = (typeof allConversionDestinationKeys)[number];
export const allConversionAfterBuffsSourceKeys = [
...stats,
'Critical Chance',
'Clone Critical Chance',
'Phantasm Critical Chance',
] as const;
export type ConversionAfterBuffsSourceKey = (typeof allConversionAfterBuffsSourceKeys)[number];
export const allConversionAfterBuffsDestinationKeys = [
...stats,
...percents,
...coefficients,
] as const;
export type ConversionAfterBuffsDestinationKey =
(typeof allConversionAfterBuffsDestinationKeys)[number];
// these values don't behave well if scaled up and down,
// so disallow them in modifiers with an amount key
export const damageKeysBlacklist = ['Damage Reduction'] as const;
export const attributePointKeysBlacklist = [
'Precision',
'Toughness',
'Expertise',
'Concentration',
] as const;
export const attributePercentKeysBlacklist = [
'Critical Chance',
'Boon Duration',
...boonDurations,
'Condition Duration',
...conditionDurations,
'Maximum Health',
] as const;
// stats which are not on the blacklist, but may be converted to something on the blacklist
export const mayBeConvertedToBlacklist = [
'Vitality', // magnanimous, weaver, harbinger, ranger, specter; exuberance rune
'Condition Damage', // toxic/lucent, scourge;
'Power', // toxic/lucent, scrapper, baelfire rune,
'Healing Power', // master, revenant
] as const;
export const exampleItem = `
- id: example
text: Example Item
subText: with hammer
minor: true
amountData:
label: '% uptime'
default: 50
quantityEntered: 100
modifiers:
damage:
Outgoing Strike Damage: [10%, mult]
Outgoing All Damage: [20%, add]
Outgoing Critical Damage: [20%, unknown]
Outgoing Burning Damage: [33%, unknown]
attributes:
Ferocity: [100, converted]
Healing Power: [30, buff]
Condition Damage: [60, converted]
Critical Chance: 20%
Quickness Duration: 10%
Torment Duration: 25%
Outgoing Healing: 5%
conversion:
Power: {Precision: 3%, Ferocity: 6%}
Expertise: {Toughness: 3%}
Outgoing Healing: {Healing Power: 0.006%}
gw2id: 1234
type: CommonEffect # gw2-ui component type (only used in buffs)
defaultEnabled: true`;
export const exampleModifiers = `damage:
Outgoing Strike Damage: [10%, mult]
Outgoing All Damage: [20%, add]
Outgoing Critical Damage: [20%, unknown]
Outgoing Burning Damage: [33%, unknown]
attributes:
Ferocity: [100, converted]
Healing Power: [30, buff]
Condition Damage: [60, converted]
Critical Chance: 20%
Quickness Duration: 10%
Torment Duration: 25%
Outgoing Healing: 5%
conversion:
Power: {Precision: 3%, Ferocity: 6%}
Expertise: {Toughness: 3%}
Outgoing Healing: {Healing Power: 0.006%}`;
export const exampleModifiersJson = `{
"damage": {
"Outgoing Strike Damage": [ "10%", "mult" ],
"Outgoing All Damage": [ "20%", "add" ],
"Outgoing Critical Damage": [ "20%", "unknown" ],
"Outgoing Burning Damage": [ "33%", "unknown" ]
},
"attributes": {
"Ferocity": [ 100, "converted" ],
"Healing Power": [ 30, "buff" ],
"Condition Damage": [ 60, "converted" ],
"Critical Chance": "20%",
"Quickness Duration": "10%",
"Torment Duration": "25%",
"Outgoing Healing": "5%"
},
"conversion": {
"Power": { "Precision": "3%", "Ferocity": "6%" },
"Expertise": { "Toughness": "3%" },
"Outgoing Healing": { "Healing Power": "0.006%" }
}
}`;
export type Percent = string;
export type DamageValue = [Percent, DamageMode] | [Percent, DamageMode, Percent, DamageMode];
export type DamageModifiers = Partial<Record<DamageKey, DamageValue>>;
export type AttributeModifiers = Partial<
Record<
AttributePointKey,
[number, AttributePointMode] | [number, AttributePointMode, number, AttributePointMode]
> &
Record<AttributePercentKey, Percent> &
Record<AttributeCoefficientKey, number>
>;
export type ConversionValue = Partial<Record<ConversionSourceKey, Percent>>;
export type ConversionModifers = Partial<Record<ConversionDestinationKey, ConversionValue>>;
export type ConversionAfterBuffsValue = Partial<Record<ConversionAfterBuffsSourceKey, Percent>>;
export type ConversionAfterBuffsModifers = Partial<
Record<ConversionAfterBuffsDestinationKey, ConversionAfterBuffsValue>
>;
export interface Modifiers {
damage?: DamageModifiers;
attributes?: AttributeModifiers;
conversion?: ConversionModifers;
conversionAfterBuffs?: ConversionAfterBuffsModifers;
}
export interface AmountData {
label: string;
default: number;
quantityEntered: number;
defaultInput?: string;
disableBlacklist?: boolean;
}
export interface ModifierItem {
id: string;
text?: string;
textOverride?: string;
subText?: string;
minor?: boolean;
amountData?: AmountData;
hasLifesteal?: boolean;
modifiers: Modifiers;
wvwModifiers?: Modifiers;
gw2id?: number;
displayIds?: number[];
priceIds?: number[];
defaultEnabled?: boolean;
type?:
| 'Boon'
| 'Trait'
| 'Skill'
| 'CommonEffect'
| 'Condition'
| 'Text'
| 'Item'
| 'Augmentation'
| 'Aura';
componentNameProp?: string;
temporaryBuff?: true | false | 'activeOutOfCombat';
}
export interface Section {
section: string;
id?: number;
note?: string;
items: ModifierItem[];
}
export type ModifierData = Section[];