@kingdomsconnected/types 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,6 +5,38 @@ declare global {
|
|
|
5
5
|
* Native events dispatched through `Events.on`. Each property is the exact callback argument tuple for that event.
|
|
6
6
|
*/
|
|
7
7
|
interface EventMap {
|
|
8
|
+
/**
|
|
9
|
+
* Dispatched once per session, when the local player can play: the session is established and the game has taken its own loading screen down. The game raises that moment itself -- it is its own gameplay-start signal, not a guess from timing.
|
|
10
|
+
*
|
|
11
|
+
* Resources are running long before this, so it is not the moment a resource may start listening; it is the moment the player is looking at the world. Put what the player should see on arrival here -- a welcome, a first page -- rather than in `resourceStart`, which runs behind the loading screen. The server raises its own `playerReady` for this player right after.
|
|
12
|
+
*/
|
|
13
|
+
playerReady: [player: Player];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Dispatched when the local player's XP on a track went up: after the server granted a gain and the game applied it, with its own multipliers. `xp` is what landed, in the game's own units.
|
|
17
|
+
*/
|
|
18
|
+
progressionXpGained: [track: string, xp: number];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Dispatched when a track of the local player's reaches a new level. `perkPoints` is what that track's tree now has unspent.
|
|
22
|
+
*/
|
|
23
|
+
progressionLevelUp: [track: string, level: number, perkPoints: number];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Dispatched when the local player gained a perk: learnt on the perk screen and granted by the server, given by a server resource, or granted by the game on its own.
|
|
27
|
+
*/
|
|
28
|
+
progressionPerkAdded: [perk: string];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Dispatched when the local player lost a perk.
|
|
32
|
+
*/
|
|
33
|
+
progressionPerkRemoved: [perk: string];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Dispatched when the server turned down a perk the local player confirmed on the perk screen. The game's own screen says nothing when that happens, so this is where a resource tells the player why.
|
|
37
|
+
*/
|
|
38
|
+
progressionPerkRefused: [perk: string, reason: "points" | "level" | "parent" | "exclusive" | "blocked" | "script" | "owned" | "hidden"];
|
|
39
|
+
|
|
8
40
|
/**
|
|
9
41
|
* Dispatched when this player starts or stops following a server quest in the game's journal, whichever way it happened: the track button, the game auto-tracking a quest that turns active, or the untrack that follows finishing or failing one. Local to this machine and raised before the server is told; the server raises its own `questTrackingChanged` when the report arrives. Repeats are filtered, so it only fires on an actual change. Handler promises are not awaited.
|
|
10
42
|
*/
|
|
@@ -320,6 +352,231 @@ declare global {
|
|
|
320
352
|
source: "server" | "native";
|
|
321
353
|
}
|
|
322
354
|
|
|
355
|
+
/**
|
|
356
|
+
* One skill or stat a player levels, as the game's own tables describe it.
|
|
357
|
+
*/
|
|
358
|
+
interface TrackInfo {
|
|
359
|
+
/**
|
|
360
|
+
* The name every progression verb takes, as the game's tables spell it: `weapon_sword`, `thievery`, `strength`.
|
|
361
|
+
*/
|
|
362
|
+
name: string;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Whether it is a skill or one of the stats the skills sit on.
|
|
366
|
+
*/
|
|
367
|
+
kind: "skill" | "stat";
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* The highest level the game lets it reach.
|
|
371
|
+
*/
|
|
372
|
+
cap: number;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* True for fencing alone: it is never earned, the game derives it from the five weapon skills, so XP handed to it is refused.
|
|
376
|
+
*/
|
|
377
|
+
induced: boolean;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* One perk, as the game's own perk tables describe it.
|
|
382
|
+
*/
|
|
383
|
+
interface PerkInfo {
|
|
384
|
+
/**
|
|
385
|
+
* The perk's `perk_name`, unique across the tables, and the spelling every perk verb takes alongside its GUID.
|
|
386
|
+
*/
|
|
387
|
+
name: string;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* The perk's GUID.
|
|
391
|
+
*/
|
|
392
|
+
id: string;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* The localisation key the perk screen shows, or empty for a perk it never shows.
|
|
396
|
+
*/
|
|
397
|
+
uiName: string;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* The track whose points pay for it: a track name, `main` for the main-level bank, or null for a perk no player's tree carries.
|
|
401
|
+
*/
|
|
402
|
+
track: string | null;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* The level that track has to reach before the perk can be learnt. 0 for none.
|
|
406
|
+
*/
|
|
407
|
+
level: number;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* The perk that has to be owned first, or null.
|
|
411
|
+
*/
|
|
412
|
+
parent: string | null;
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* `visible` perks are the ones on the perk screen and the only ones a player can learn; `hidden` ones appear once something grants them; `system` ones implement game features and are never shown.
|
|
416
|
+
*/
|
|
417
|
+
visibility: "system" | "hidden" | "visible" | "obsolete";
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* What the perk does when owned, from the game's side tables: `buff` (a real status effect), `script`, `technique` (a combat move), `ability`, `param` (rewrites a game rule), `companion` (the dog), `recipe`, `codex`. Empty for a perk that only gates others.
|
|
421
|
+
*/
|
|
422
|
+
kinds: string[];
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Whether the game grants it on its own once its requirements are met, rather than on the perk screen.
|
|
426
|
+
*/
|
|
427
|
+
autolearnable: boolean;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Where a player stands on one track.
|
|
432
|
+
*/
|
|
433
|
+
interface TrackProgress {
|
|
434
|
+
/**
|
|
435
|
+
* The level reached.
|
|
436
|
+
*/
|
|
437
|
+
level: number;
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* XP earned towards the next level, in the game's own units.
|
|
441
|
+
*/
|
|
442
|
+
xp: number;
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* XP the next level costs in total, from the start of this one. `xp / xpToNext` is the bar the character sheet draws.
|
|
446
|
+
*/
|
|
447
|
+
xpToNext: number;
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Unspent perk points in this track's tree.
|
|
451
|
+
*/
|
|
452
|
+
perkPoints: number;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* A player's level on every track, keyed by track name.
|
|
457
|
+
*/
|
|
458
|
+
interface TrackLevels {
|
|
459
|
+
/**
|
|
460
|
+
* The level reached.
|
|
461
|
+
*/
|
|
462
|
+
stealth: number;
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* The level reached.
|
|
466
|
+
*/
|
|
467
|
+
horse_riding: number;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* The level reached.
|
|
471
|
+
*/
|
|
472
|
+
fencing: number;
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* The level reached.
|
|
476
|
+
*/
|
|
477
|
+
thievery: number;
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* The level reached.
|
|
481
|
+
*/
|
|
482
|
+
alchemy: number;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* The level reached.
|
|
486
|
+
*/
|
|
487
|
+
craftsmanship: number;
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* The level reached.
|
|
491
|
+
*/
|
|
492
|
+
drinking: number;
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* The level reached.
|
|
496
|
+
*/
|
|
497
|
+
survival: number;
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* The level reached.
|
|
501
|
+
*/
|
|
502
|
+
weapon_sword: number;
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* The level reached.
|
|
506
|
+
*/
|
|
507
|
+
heavy_weapons: number;
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* The level reached.
|
|
511
|
+
*/
|
|
512
|
+
marksmanship: number;
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* The level reached.
|
|
516
|
+
*/
|
|
517
|
+
weapon_large: number;
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* The level reached.
|
|
521
|
+
*/
|
|
522
|
+
weapon_unarmed: number;
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* The level reached.
|
|
526
|
+
*/
|
|
527
|
+
scholarship: number;
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* The level reached.
|
|
531
|
+
*/
|
|
532
|
+
houndmaster: number;
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* The level reached.
|
|
536
|
+
*/
|
|
537
|
+
strength: number;
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* The level reached.
|
|
541
|
+
*/
|
|
542
|
+
agility: number;
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* The level reached.
|
|
546
|
+
*/
|
|
547
|
+
vitality: number;
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* The level reached.
|
|
551
|
+
*/
|
|
552
|
+
speech: number;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* The level reached.
|
|
556
|
+
*/
|
|
557
|
+
prestige: number;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Everything a server needs to put a player's progression back: plain JSON a resource can store however it likes. A player starts every session with a fresh character, so this is how progression outlives a disconnect.
|
|
562
|
+
*/
|
|
563
|
+
interface ProgressionSnapshot {
|
|
564
|
+
/**
|
|
565
|
+
* Level and XP into the next level, per track name.
|
|
566
|
+
*/
|
|
567
|
+
tracks: Record<string, { level: number; xp: number }>;
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Every perk owned, by name.
|
|
571
|
+
*/
|
|
572
|
+
perks: string[];
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Unspent points per tree: track names, and `main`.
|
|
576
|
+
*/
|
|
577
|
+
perkPoints: Record<string, number>;
|
|
578
|
+
}
|
|
579
|
+
|
|
323
580
|
/**
|
|
324
581
|
* A KCDC player this client can see, and the body they occupy.
|
|
325
582
|
*/
|
|
@@ -537,6 +794,21 @@ declare global {
|
|
|
537
794
|
*/
|
|
538
795
|
readonly equipment: string[];
|
|
539
796
|
|
|
797
|
+
/**
|
|
798
|
+
* The player's main level, the one the game derives from the stats. 0 until known.
|
|
799
|
+
*/
|
|
800
|
+
readonly level: number;
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* The level of every skill and stat, keyed by track name. The local player reads its own character; anyone else reads what the server last accepted from theirs, and all zero until it has.
|
|
804
|
+
*/
|
|
805
|
+
readonly levels: TrackLevels;
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* Every perk the player owns, by name -- the perk screen's and the hidden ones the game grants on its own.
|
|
809
|
+
*/
|
|
810
|
+
readonly perks: string[];
|
|
811
|
+
|
|
540
812
|
/**
|
|
541
813
|
* Whether this handle is the player sitting at this machine, rather than someone else's puppet.
|
|
542
814
|
*/
|
|
@@ -569,10 +841,57 @@ declare global {
|
|
|
569
841
|
* @returns The player's network entity ID, nickname, and whether they are the local player.
|
|
570
842
|
*/
|
|
571
843
|
toString(): string;
|
|
844
|
+
|
|
845
|
+
/**
|
|
846
|
+
* Where the local player stands on one track: level, XP towards the next one, and unspent perk points. Only the local player carries XP and points; for anyone else this is null.
|
|
847
|
+
* @param track A track name, from `Progression.tracks()`.
|
|
848
|
+
* @returns The progress, or null for any other player. Throws for a track name the tables do not carry.
|
|
849
|
+
*/
|
|
850
|
+
getTrack(track: string): TrackProgress | null;
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* Whether the player owns a perk.
|
|
854
|
+
* @param perk A perk's name or GUID.
|
|
855
|
+
* @returns True when they do; false for a perk they do not own, or a name the tables do not carry.
|
|
856
|
+
*/
|
|
857
|
+
hasPerk(perk: string): boolean;
|
|
572
858
|
}
|
|
573
859
|
|
|
574
860
|
interface Player extends BasePlayer {}
|
|
575
861
|
|
|
862
|
+
/**
|
|
863
|
+
* The game's skills, stats and perks. Read-only on the client: every change to a player's progression is the server's.
|
|
864
|
+
*/
|
|
865
|
+
const Progression: {
|
|
866
|
+
/**
|
|
867
|
+
* Every skill and stat a player levels: the fifteen skills the character sheet shows, then strength, agility, vitality, speech and prestige.
|
|
868
|
+
* @returns The tracks, in that order.
|
|
869
|
+
*/
|
|
870
|
+
tracks(): TrackInfo[];
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* Looks a perk up.
|
|
874
|
+
* @param query A perk's name, as the game's perk tables spell it, or its GUID.
|
|
875
|
+
* @returns What the tables say about it, or null for a name they do not carry.
|
|
876
|
+
*/
|
|
877
|
+
findPerk(query: string): PerkInfo | null;
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* Lists the game's perks: 945 of them, most of them hidden system perks. `Progression.perks({ visibleOnly: true })` is the perk screen.
|
|
881
|
+
* @param filter `track` keeps the perks one tree pays for -- a track name, or `main`; `visibleOnly` keeps the perks the perk screen shows.
|
|
882
|
+
* @returns The perks, sorted by name.
|
|
883
|
+
*/
|
|
884
|
+
perks(filter?: { track?: string; visibleOnly?: boolean }): PerkInfo[];
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* The total XP a track costs from level 0 to `level`, on the game's own curve: each level costs `base + diff * level`, with base and diff from the game's RPG tables.
|
|
888
|
+
* @param track A track name.
|
|
889
|
+
* @param level The level to reach.
|
|
890
|
+
* @returns The XP. Throws for a track name the tables do not carry.
|
|
891
|
+
*/
|
|
892
|
+
xpForLevel(track: string, level: number): number;
|
|
893
|
+
};
|
|
894
|
+
|
|
576
895
|
/**
|
|
577
896
|
* The game's own HUD messages, shown to the player at this machine. Nothing here is replicated: a message everyone should see is sent to everyone, and each client shows it. Every call returns false while there is no HUD, which is the case in the main menu and across a level load.
|
|
578
897
|
*/
|
|
@@ -3555,7 +3874,7 @@ declare global {
|
|
|
3555
3874
|
send(text: string): void;
|
|
3556
3875
|
|
|
3557
3876
|
/**
|
|
3558
|
-
* Changes visibility of the native chat overlay without opening its input field.
|
|
3877
|
+
* Changes visibility of the native chat overlay without opening its input field. Hidden, the overlay also stops opening on its key. The choice holds for the rest of the session and resets to visible on disconnect, so a resource that replaces the chat calls this once at startup.
|
|
3559
3878
|
* @param visible Whether the chat overlay is rendered.
|
|
3560
3879
|
*/
|
|
3561
3880
|
setUIVisible(visible: boolean): void;
|
|
@@ -3797,6 +4116,18 @@ declare global {
|
|
|
3797
4116
|
*/
|
|
3798
4117
|
getRange(): number;
|
|
3799
4118
|
|
|
4119
|
+
/**
|
|
4120
|
+
* Switches how far this player's voice carries. A request: the server paces it, decides the radius, and may move the player itself.
|
|
4121
|
+
* @param tier Voice tier: 0 whisper, 1 normal, 2 shout.
|
|
4122
|
+
*/
|
|
4123
|
+
setTier(tier: number): void;
|
|
4124
|
+
|
|
4125
|
+
/**
|
|
4126
|
+
* Reads the voice tier this player is on.
|
|
4127
|
+
* @returns 0 whisper, 1 normal, 2 shout.
|
|
4128
|
+
*/
|
|
4129
|
+
getTier(): number;
|
|
4130
|
+
|
|
3800
4131
|
/**
|
|
3801
4132
|
* Rebinds push-to-talk. Unknown key names throw.
|
|
3802
4133
|
* @param key Case-insensitive key name, using the same names as Key.bind.
|