Repository navigation
Expand file tree
/
Copy pathglobal.d.ts
More file actions
325 lines (284 loc) · 8.76 KB
/
Copy pathglobal.d.ts
File metadata and controls
325 lines (284 loc) · 8.76 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
325
import { AnyMutableObject } from 'fvtt-types/utils'
import { ResourceTrackerTemplate } from 'module/resource-tracker/types.ts'
import { GurpsActor } from './module/actor/actor.js'
import { GurpsCombatant } from './module/combat/combatant.ts'
import { GurpsItem } from './module/item.js'
import { GurpsToken } from './module/token/gurps-token.ts'
import { ManeuverDetail, ManeuverVisibility, RangeStrategy, RollBasedOnManeuverPolicy } from 'module/combat/types.ts'
import { GurpsRange } from 'module/combat/ranges.js'
export {}
declare global {
interface GurpsAction {
type: string
sourceId?: string
orig?: string
calcOnly?: boolean
next?: GurpsAction
[key: string]: unknown
}
interface DamageData {
attacker?: string
dice?: string
damage?: number
damageType?: string
armorDivisor?: number
[key: string]: unknown
}
interface GURPSGlobal {
SYSTEM_NAME: 'gurps'
decode<T = unknown>(actor: GurpsActor, path: string): T
put<T>(list: Record<string, T>, obj: T, index?: number = -1): string
removeKey(actor: GurpsActor, key: string): void
performAction(
action: GurpsAction,
actor: Actor | GurpsActor | null,
event?: Event | null,
targets?: string[]
): Promise<boolean>
stopActions: boolean
ModifierBucket: {
setTempRangeMod(mod: number): void
addTempRangeMod(): void
addModifier(mod: string, label: string, options?: { situation?: string }): void
currentSum(): number
clear(): Promise<void>
refreshPosition(): void
refresh(): void
}
DamageTables: {
translate(damageType: string): string
woundModifiers: Record<
string,
{ label?: string; icon?: string; color?: string; multiplier?: number; resource?: boolean }
>
damageTypeMap: Record<string, string>
}
SSRT: {
getModifier(yards: number): number
}
rangeObject: GurpsRange
Maneuvers: {
get(id: string): { icon?: string } | undefined
getAll(): Record<string, { id: string; icon: string; label: string }>
}
ApplyDamageDialog: new (actor: GurpsActor, damageData: DamageData[], options?: object) => Application
DamageChat: {
_renderDamageChat(
app: { data: { flags: { transfer: string } }; flags: { gurps: { transfer: object } } },
html: JQuery,
msg: object
): Promise<void>
}
resolveDamageRoll: (
event: Event,
actor: GurpsActor,
otf: string,
overridetxt: string | null,
isGM: boolean,
isOtf?: boolean
) => Promise<void>
SJGProductMappings: Record<string, string>
actionFuncs: Record<
string,
(params: {
action: GurpsAction
actor: Actor | GurpsActor | null
event?: Event
targets?: string[]
originalOtf: string
calcOnly?: boolean
}) => Promise<{ target: number } | false> | { target: number } | false
>
}
var GURPS: GURPSGlobal
interface TotalPoints {
race?: string | number
ads?: string | number
attributes?: string | number
skills?: string | number
spells?: string | number
disads?: string | number
quirks?: string | number
}
interface EntityComponentBase {
name?: string
notes?: string
uuid?: string
contains?: NestedEntityRecord
collapsed?: NestedEntityRecord
}
interface NestedEntityRecord {
[key: string]: EntityComponentBase
}
interface ModifierComponent extends EntityComponentBase {
situation?: string
}
interface InlineEditConfig {
displaySelector: string
containerSelector: string
inputSelector: string
editingClass?: string
fieldType?: 'name' | 'tag'
onBlur?: (input: HTMLInputElement) => void
}
interface RowExpandConfig {
rowSelector: string
excludeSelectors?: string[]
expandedClass?: string
}
interface SectionCollapseConfig {
headerSelector: string
excludeSelectors?: string[]
collapsedClass?: string
}
interface ResourceResetConfig {
selector: string
resourcePath: string
maxPath: string
}
interface ContainerCollapseConfig {
tableSelector: string
rowSelector: string
excludeSelectors?: string[]
}
interface DropdownConfig {
dropdownSelector: string
toggleSelector: string
optionSelector: string
onSelect: (value: string) => Promise<void> | void
}
type EntityConstructorArgs = string[]
interface EntityComponentClass {
new (name?: string, ...args: never[]): EntityComponentBase
}
interface EntityConfiguration {
entityName: string
path: string
EntityClass: EntityComponentClass
editMethod: string
localeKey: string
displayProperty?: string
createArgs?: () => EntityConstructorArgs
}
interface ModifierConfiguration {
isReaction: boolean
}
type EntityConfigWithMethod = Omit<EntityConfiguration, 'editMethod' | 'createArgs'> & {
editMethod: (actor: GurpsActor, path: string, obj: EntityComponentBase) => Promise<void>
createArgs?: EntityConstructorArgs
}
interface DocumentClassConfig {
Actor: typeof GurpsActor
Item: typeof GurpsItem
Combatant: typeof GurpsCombatant
}
interface PlaceableObjectClassConfig {
Token: typeof GurpsToken
}
interface SettingConfig {
'gurps.bucket-position': 'left' | 'right'
'gurps.resource-tracker.manager': new (options?: any) => ResourceTracker.TemplateManager
'gurps.resource-tracker.templates': Record<string, ResourceTrackerTemplate>
'gurps.use-quick-rolls': AnyMutableObject
'gurps.combat.rangeStrategy': RangeStrategy
'gurps.combat.use-on-target': boolean
'gurps.combat.maneuver-visibility': ManeuverVisibility
'gurps.combat.maneuver-detail': ManeuverDetail
'gurps.combat.maneuver-updates-move': boolean
'gurps.combat.allow-roll-based-on-maneuver': RollBasedOnManeuverPolicy
'gurps.combat.use-size-modifier-difference-in-melee': boolean
'gurps.combat.initiative-formula': String
'gurps.show-confirmation-roll-dialog': boolean
'gurps.modify-dice-plus-adds': boolean
'gurps.pdf.basicset': String
'gurps.pdf.open-first': boolean
'gurps.use-foundry-items': boolean
// TODO: Deprecated settings.
'gurps.tracker-templates': new (options?: any) => Record<string, ResourceTrackerTemplate>
'gurps.basicsetpdf': String
'gurps.pdf-open-first': boolean
'gurps.portrait-hp-tinting': boolean
'gurps.automatic-encumbrance': boolean
}
interface DialogV2Config {
window?: { title?: string; resizable?: boolean }
content?: string
buttons?: Array<{
action?: string
label: string
icon?: string
callback?: (event: Event, button: HTMLButtonElement) => void
}>
}
interface NoteComponent extends EntityComponentBase {
notes?: string
title?: string
}
interface EquipmentComponent extends EntityComponentBase {
save?: boolean
itemid?: string
}
interface EquipmentInstance extends EquipmentComponent {
toItemData(actor: GurpsActor, path: string): Record<string, string | number | boolean | object>
_getGGAId(config: { name: string; type: string; generator: string }): string
}
interface GurpsActorSheetEditMethods {
editEquipment(actor: GurpsActor, path: string, obj: EntityComponentBase): Promise<void>
editNotes(actor: GurpsActor, path: string, obj: EntityComponentBase): Promise<void>
editModifier(actor: GurpsActor, path: string, obj: EntityComponentBase, isReaction: boolean): Promise<void>
}
interface GurpsActorSystem {
HP?: { value: number; max: number }
FP?: { value: number; max: number }
additionalresources?: {
qnotes?: string
}
skills?: NestedEntityRecord
ads?: NestedEntityRecord
melee?: NestedEntityRecord
ranged?: NestedEntityRecord
reactions?: Record<string, ModifierComponent>
conditionalmods?: Record<string, ModifierComponent>
totalpoints?: TotalPoints
equipment?: {
carried?: Record<string, EquipmentComponent>
other?: Record<string, EquipmentComponent>
}
notes?: Record<string, NoteComponent>
}
interface GurpsMoveMode {
mode: string
basic: string
enhanced: string
default: boolean
}
}
interface GurpsEffectFlags {
effect?: {
type?: string
pdfref?: string
}
name?: string
move?: string
defense?: string
fullturn?: boolean
}
declare global {
interface FlagConfig {
ActiveEffect: {
gurps?: GurpsEffectFlags
}
}
}
declare module '*/miscellaneous-settings.js' {
export const SYSTEM_NAME: 'gurps'
export const SETTING_USE_FOUNDRY_ITEMS: 'use-foundry-items'
export const SETTING_PORTRAIT_HP_TINTING: 'portrait-hp-tinting'
}
declare namespace foundry.applications.api {
class DialogV2 {
constructor(config: DialogV2Config)
render(options?: { force?: boolean }): Promise<DialogV2>
element: HTMLElement
}
}