@modlock/modlock 0.1.83 → 0.1.85
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.
- package/host.gen.d.ts +94 -0
- package/index.d.ts +28 -4
- package/index.js +381 -21
- package/package.json +6 -6
package/host.gen.d.ts
CHANGED
|
@@ -422,6 +422,70 @@ export interface ModifierFiredEvent {
|
|
|
422
422
|
*/
|
|
423
423
|
readonly ability: number;
|
|
424
424
|
}
|
|
425
|
+
/**
|
|
426
|
+
* HealEvent reports health an ability, item or lifesteal restored at once to
|
|
427
|
+
* a hero or unit. Regeneration reports none, including what abilities such as
|
|
428
|
+
* Siphon Life restore as regeneration, and neither do Modlock's own heal and
|
|
429
|
+
* a heal at full health.
|
|
430
|
+
*/
|
|
431
|
+
export interface HealEvent {
|
|
432
|
+
/** target is the entity healed. */
|
|
433
|
+
readonly target: number;
|
|
434
|
+
/**
|
|
435
|
+
* targetPlayer is the slot of the player whose hero was healed, or -1 for
|
|
436
|
+
* a unit.
|
|
437
|
+
*/
|
|
438
|
+
readonly targetPlayer: Player;
|
|
439
|
+
/**
|
|
440
|
+
* healer is the entity the heal came from, or zero when the game names
|
|
441
|
+
* none.
|
|
442
|
+
*/
|
|
443
|
+
readonly healer: number;
|
|
444
|
+
/**
|
|
445
|
+
* healerPlayer is the slot of the player whose hero the healer is, or -1.
|
|
446
|
+
*/
|
|
447
|
+
readonly healerPlayer: Player;
|
|
448
|
+
/** ability is the ability or item that healed, or zero. */
|
|
449
|
+
readonly ability: number;
|
|
450
|
+
/** applied is the health the heal restored. */
|
|
451
|
+
readonly applied: number;
|
|
452
|
+
/**
|
|
453
|
+
* requested is the heal's whole amount; it exceeds applied when the target
|
|
454
|
+
* reached full health.
|
|
455
|
+
*/
|
|
456
|
+
readonly requested: number;
|
|
457
|
+
}
|
|
458
|
+
/** LevelEvent reports a hero reaching a new level. */
|
|
459
|
+
export interface LevelEvent {
|
|
460
|
+
/** hero is the hero's entity. */
|
|
461
|
+
readonly hero: number;
|
|
462
|
+
/** player is the slot of the player whose hero it is, or -1. */
|
|
463
|
+
readonly player: Player;
|
|
464
|
+
/** level is the hero's new level. */
|
|
465
|
+
readonly level: number;
|
|
466
|
+
}
|
|
467
|
+
/** MeleeEvent reports one melee swing as the game resolves it. */
|
|
468
|
+
export interface MeleeEvent {
|
|
469
|
+
/** attacker is the hero or unit that swung. */
|
|
470
|
+
readonly attacker: number;
|
|
471
|
+
/** attackerPlayer is the slot of the player whose hero swung, or -1. */
|
|
472
|
+
readonly attackerPlayer: Player;
|
|
473
|
+
/** heavy is true for a charged swing and false for a light one. */
|
|
474
|
+
readonly heavy: boolean;
|
|
475
|
+
/** hits are the entities the swing struck, empty for a miss. */
|
|
476
|
+
readonly hits: number[];
|
|
477
|
+
}
|
|
478
|
+
/** ParryEvent reports a parry that caught a melee swing. */
|
|
479
|
+
export interface ParryEvent {
|
|
480
|
+
/** parrier is the hero that parried. */
|
|
481
|
+
readonly parrier: number;
|
|
482
|
+
/** player is the slot of the player whose hero parried, or -1. */
|
|
483
|
+
readonly player: Player;
|
|
484
|
+
/** attacker is the hero or unit whose swing was caught. */
|
|
485
|
+
readonly attacker: number;
|
|
486
|
+
/** attackerPlayer is the slot of the player whose hero swung, or -1. */
|
|
487
|
+
readonly attackerPlayer: Player;
|
|
488
|
+
}
|
|
425
489
|
/**
|
|
426
490
|
* SoundOptions shape one sound; the zero value plays it to every player as
|
|
427
491
|
* the game made it.
|
|
@@ -1401,6 +1465,16 @@ export interface StartResult {
|
|
|
1401
1465
|
* kills asks for a Killed event after each hit that kills a hero or unit.
|
|
1402
1466
|
*/
|
|
1403
1467
|
kills: boolean;
|
|
1468
|
+
/** heals asks for a Healed event after each heal. */
|
|
1469
|
+
heals: boolean;
|
|
1470
|
+
/** levels asks for a LevelChanged event as each hero reaches a new level. */
|
|
1471
|
+
levels: boolean;
|
|
1472
|
+
/** melees asks for a Melee event after each melee swing. */
|
|
1473
|
+
melees: boolean;
|
|
1474
|
+
/**
|
|
1475
|
+
* parries asks for a Parried event after each parry that catches a swing.
|
|
1476
|
+
*/
|
|
1477
|
+
parries: boolean;
|
|
1404
1478
|
}
|
|
1405
1479
|
/** FrameEvent identifies one server frame. */
|
|
1406
1480
|
export interface FrameEvent {
|
|
@@ -2330,6 +2404,26 @@ export interface ModHandlers {
|
|
|
2330
2404
|
* next frame.
|
|
2331
2405
|
*/
|
|
2332
2406
|
modifierFired(event: ModifierFiredEvent): void;
|
|
2407
|
+
/**
|
|
2408
|
+
* healed reports one heal, while the mod asked for heals, before the next
|
|
2409
|
+
* frame.
|
|
2410
|
+
*/
|
|
2411
|
+
healed(event: HealEvent): void;
|
|
2412
|
+
/**
|
|
2413
|
+
* levelChanged reports one hero reaching a new level, while the mod asked
|
|
2414
|
+
* for levels, before the next frame.
|
|
2415
|
+
*/
|
|
2416
|
+
levelChanged(event: LevelEvent): void;
|
|
2417
|
+
/**
|
|
2418
|
+
* melee reports one melee swing, while the mod asked for melees, before the
|
|
2419
|
+
* next frame.
|
|
2420
|
+
*/
|
|
2421
|
+
melee(event: MeleeEvent): void;
|
|
2422
|
+
/**
|
|
2423
|
+
* parried reports one parry that caught a swing, while the mod asked for
|
|
2424
|
+
* parries, before the next frame.
|
|
2425
|
+
*/
|
|
2426
|
+
parried(event: ParryEvent): void;
|
|
2333
2427
|
/**
|
|
2334
2428
|
* input reports one player's presses of watched buttons, before the next
|
|
2335
2429
|
* frame. A block in place still withholds them from the hero.
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference path="./globals.d.ts" />
|
|
2
|
-
import { type AbilityCastEvent, type KillEvent, type DamageEvent, type ChatEvent, type DamagedEvent, type DamageResult, type FrameEvent, type ImpactEvent, type LandedEvent, type LaunchEvent, type ModifierFiredEvent, type Pawn, Player, type PlayerJoinedEvent, type PlayerLeftEvent } from './host.gen.js';
|
|
2
|
+
import { type AbilityCastEvent, type KillEvent, type DamageEvent, type ChatEvent, type DamagedEvent, type DamageResult, type FrameEvent, type HealEvent, type ImpactEvent, type LandedEvent, type LaunchEvent, type LevelEvent, type MeleeEvent, type ModifierFiredEvent, type ParryEvent, type Pawn, Player, type PlayerJoinedEvent, type PlayerLeftEvent } from './host.gen.js';
|
|
3
3
|
export * as vector from './vector.js';
|
|
4
4
|
export { Buttons, Layers } from './bits.js';
|
|
5
5
|
export { after, every, sequence, type Timer } from './timer.js';
|
|
@@ -79,10 +79,10 @@ export declare function onPlayerJoin(handler: (joined: PlayerJoinedEvent) => voi
|
|
|
79
79
|
export declare function onPlayerLeave(handler: (left: PlayerLeftEvent) => void): void;
|
|
80
80
|
/**
|
|
81
81
|
* onSpawn calls handler each time a player's hero enters play: their first
|
|
82
|
-
* hero after joining,
|
|
82
|
+
* hero after joining, and each respawn. The
|
|
83
83
|
* player has a hero to move, equip and read from then on, which onPlayerJoin
|
|
84
|
-
* does not promise. The library
|
|
85
|
-
*
|
|
84
|
+
* does not promise. The library hears it from the game's PLAYER_RESPAWNED
|
|
85
|
+
* event, before the frame handlers run.
|
|
86
86
|
*/
|
|
87
87
|
export declare function onSpawn(handler: (player: Player, pawn: Pawn) => void): void;
|
|
88
88
|
/** Seating is the hero and team seat gives one player. */
|
|
@@ -171,6 +171,30 @@ export declare function onKill(handler: (kill: KillEvent) => void): void;
|
|
|
171
171
|
* the moment the cast takes effect.
|
|
172
172
|
*/
|
|
173
173
|
export declare function onAbilityCast(handler: (cast: AbilityCastEvent) => void): void;
|
|
174
|
+
/**
|
|
175
|
+
* onHeal calls handler after each heal, before the next frame: health a hero
|
|
176
|
+
* or unit regained at once from an ability, an item or lifesteal. Regeneration
|
|
177
|
+
* calls nothing, including what abilities such as Siphon Life restore as
|
|
178
|
+
* regeneration, and neither do the mod's own heal and a heal at full health.
|
|
179
|
+
* The heal names the entity healed, the healer and ability when the game
|
|
180
|
+
* names them, and the player of each: a slot of -1 is a unit's, or no one's.
|
|
181
|
+
*/
|
|
182
|
+
export declare function onHeal(handler: (heal: HealEvent) => void): void;
|
|
183
|
+
/**
|
|
184
|
+
* onLevelChange calls handler as each hero reaches a new level, before the
|
|
185
|
+
* next frame.
|
|
186
|
+
*/
|
|
187
|
+
export declare function onLevelChange(handler: (change: LevelEvent) => void): void;
|
|
188
|
+
/**
|
|
189
|
+
* onMelee calls handler after each melee swing, before the next frame, with
|
|
190
|
+
* whether it was heavy and the entities it struck, none for a miss.
|
|
191
|
+
*/
|
|
192
|
+
export declare function onMelee(handler: (swing: MeleeEvent) => void): void;
|
|
193
|
+
/**
|
|
194
|
+
* onParry calls handler after each parry that catches a melee swing, before
|
|
195
|
+
* the next frame, naming the hero that parried and the attacker it caught.
|
|
196
|
+
*/
|
|
197
|
+
export declare function onParry(handler: (parry: ParryEvent) => void): void;
|
|
174
198
|
/**
|
|
175
199
|
* onModifierEvent calls handler each time the game fires the modifier event
|
|
176
200
|
* with this EModifierEvent name, such as ABILITY_CAST_STARTED, PARRY_SUCCESS
|
package/index.js
CHANGED
|
@@ -2818,7 +2818,11 @@ var StartResult = /* @__PURE__ */ createMessageType(
|
|
|
2818
2818
|
[5, "joins", 8],
|
|
2819
2819
|
[6, "casts", 8],
|
|
2820
2820
|
[7, "modifier_events", 9, 1],
|
|
2821
|
-
[8, "kills", 8]
|
|
2821
|
+
[8, "kills", 8],
|
|
2822
|
+
[9, "heals", 8],
|
|
2823
|
+
[10, "levels", 8],
|
|
2824
|
+
[11, "melees", 8],
|
|
2825
|
+
[12, "parries", 8]
|
|
2822
2826
|
],
|
|
2823
2827
|
{
|
|
2824
2828
|
decode: (r, end, m) => {
|
|
@@ -2851,6 +2855,18 @@ var StartResult = /* @__PURE__ */ createMessageType(
|
|
|
2851
2855
|
case 8:
|
|
2852
2856
|
m.kills = r.bool();
|
|
2853
2857
|
break;
|
|
2858
|
+
case 9:
|
|
2859
|
+
m.heals = r.bool();
|
|
2860
|
+
break;
|
|
2861
|
+
case 10:
|
|
2862
|
+
m.levels = r.bool();
|
|
2863
|
+
break;
|
|
2864
|
+
case 11:
|
|
2865
|
+
m.melees = r.bool();
|
|
2866
|
+
break;
|
|
2867
|
+
case 12:
|
|
2868
|
+
m.parries = r.bool();
|
|
2869
|
+
break;
|
|
2854
2870
|
default:
|
|
2855
2871
|
r.skip(t);
|
|
2856
2872
|
}
|
|
@@ -2890,6 +2906,22 @@ var StartResult = /* @__PURE__ */ createMessageType(
|
|
|
2890
2906
|
const v = m.kills;
|
|
2891
2907
|
if (v) w.uint32(64).bool(v);
|
|
2892
2908
|
}
|
|
2909
|
+
{
|
|
2910
|
+
const v = m.heals;
|
|
2911
|
+
if (v) w.uint32(72).bool(v);
|
|
2912
|
+
}
|
|
2913
|
+
{
|
|
2914
|
+
const v = m.levels;
|
|
2915
|
+
if (v) w.uint32(80).bool(v);
|
|
2916
|
+
}
|
|
2917
|
+
{
|
|
2918
|
+
const v = m.melees;
|
|
2919
|
+
if (v) w.uint32(88).bool(v);
|
|
2920
|
+
}
|
|
2921
|
+
{
|
|
2922
|
+
const v = m.parries;
|
|
2923
|
+
if (v) w.uint32(96).bool(v);
|
|
2924
|
+
}
|
|
2893
2925
|
}
|
|
2894
2926
|
}
|
|
2895
2927
|
);
|
|
@@ -5175,6 +5207,235 @@ var ModifierFiredEvent = /* @__PURE__ */ createMessageType(
|
|
|
5175
5207
|
}
|
|
5176
5208
|
}
|
|
5177
5209
|
);
|
|
5210
|
+
var HealEvent = /* @__PURE__ */ createMessageType(
|
|
5211
|
+
"modlock.wasm.combat.HealEvent",
|
|
5212
|
+
() => [
|
|
5213
|
+
[1, "target", 13],
|
|
5214
|
+
[2, "target_player", 5],
|
|
5215
|
+
[3, "healer", 13],
|
|
5216
|
+
[4, "healer_player", 5],
|
|
5217
|
+
[5, "ability", 13],
|
|
5218
|
+
[6, "applied", 5],
|
|
5219
|
+
[7, "requested", 5]
|
|
5220
|
+
],
|
|
5221
|
+
{
|
|
5222
|
+
decode: (r, end, m) => {
|
|
5223
|
+
while (r.pos < end) {
|
|
5224
|
+
const t = r.tag();
|
|
5225
|
+
if ((t & 7) === 4) return m;
|
|
5226
|
+
switch (t >>> 3) {
|
|
5227
|
+
case 1:
|
|
5228
|
+
m.target = r.uint32();
|
|
5229
|
+
break;
|
|
5230
|
+
case 2:
|
|
5231
|
+
m.targetPlayer = r.int32();
|
|
5232
|
+
break;
|
|
5233
|
+
case 3:
|
|
5234
|
+
m.healer = r.uint32();
|
|
5235
|
+
break;
|
|
5236
|
+
case 4:
|
|
5237
|
+
m.healerPlayer = r.int32();
|
|
5238
|
+
break;
|
|
5239
|
+
case 5:
|
|
5240
|
+
m.ability = r.uint32();
|
|
5241
|
+
break;
|
|
5242
|
+
case 6:
|
|
5243
|
+
m.applied = r.int32();
|
|
5244
|
+
break;
|
|
5245
|
+
case 7:
|
|
5246
|
+
m.requested = r.int32();
|
|
5247
|
+
break;
|
|
5248
|
+
default:
|
|
5249
|
+
r.skip(t);
|
|
5250
|
+
}
|
|
5251
|
+
}
|
|
5252
|
+
return m;
|
|
5253
|
+
},
|
|
5254
|
+
encode: (m, w) => {
|
|
5255
|
+
{
|
|
5256
|
+
const v = m.target;
|
|
5257
|
+
if (v) w.uint32(8).uint32(v);
|
|
5258
|
+
}
|
|
5259
|
+
{
|
|
5260
|
+
const v = m.targetPlayer;
|
|
5261
|
+
if (v) w.uint32(16).int32(v);
|
|
5262
|
+
}
|
|
5263
|
+
{
|
|
5264
|
+
const v = m.healer;
|
|
5265
|
+
if (v) w.uint32(24).uint32(v);
|
|
5266
|
+
}
|
|
5267
|
+
{
|
|
5268
|
+
const v = m.healerPlayer;
|
|
5269
|
+
if (v) w.uint32(32).int32(v);
|
|
5270
|
+
}
|
|
5271
|
+
{
|
|
5272
|
+
const v = m.ability;
|
|
5273
|
+
if (v) w.uint32(40).uint32(v);
|
|
5274
|
+
}
|
|
5275
|
+
{
|
|
5276
|
+
const v = m.applied;
|
|
5277
|
+
if (v) w.uint32(48).int32(v);
|
|
5278
|
+
}
|
|
5279
|
+
{
|
|
5280
|
+
const v = m.requested;
|
|
5281
|
+
if (v) w.uint32(56).int32(v);
|
|
5282
|
+
}
|
|
5283
|
+
}
|
|
5284
|
+
}
|
|
5285
|
+
);
|
|
5286
|
+
var LevelEvent = /* @__PURE__ */ createMessageType(
|
|
5287
|
+
"modlock.wasm.combat.LevelEvent",
|
|
5288
|
+
() => [
|
|
5289
|
+
[1, "hero", 13],
|
|
5290
|
+
[2, "player", 5],
|
|
5291
|
+
[3, "level", 5]
|
|
5292
|
+
],
|
|
5293
|
+
{
|
|
5294
|
+
decode: (r, end, m) => {
|
|
5295
|
+
while (r.pos < end) {
|
|
5296
|
+
const t = r.tag();
|
|
5297
|
+
if ((t & 7) === 4) return m;
|
|
5298
|
+
switch (t >>> 3) {
|
|
5299
|
+
case 1:
|
|
5300
|
+
m.hero = r.uint32();
|
|
5301
|
+
break;
|
|
5302
|
+
case 2:
|
|
5303
|
+
m.player = r.int32();
|
|
5304
|
+
break;
|
|
5305
|
+
case 3:
|
|
5306
|
+
m.level = r.int32();
|
|
5307
|
+
break;
|
|
5308
|
+
default:
|
|
5309
|
+
r.skip(t);
|
|
5310
|
+
}
|
|
5311
|
+
}
|
|
5312
|
+
return m;
|
|
5313
|
+
},
|
|
5314
|
+
encode: (m, w) => {
|
|
5315
|
+
{
|
|
5316
|
+
const v = m.hero;
|
|
5317
|
+
if (v) w.uint32(8).uint32(v);
|
|
5318
|
+
}
|
|
5319
|
+
{
|
|
5320
|
+
const v = m.player;
|
|
5321
|
+
if (v) w.uint32(16).int32(v);
|
|
5322
|
+
}
|
|
5323
|
+
{
|
|
5324
|
+
const v = m.level;
|
|
5325
|
+
if (v) w.uint32(24).int32(v);
|
|
5326
|
+
}
|
|
5327
|
+
}
|
|
5328
|
+
}
|
|
5329
|
+
);
|
|
5330
|
+
var MeleeEvent = /* @__PURE__ */ createMessageType(
|
|
5331
|
+
"modlock.wasm.combat.MeleeEvent",
|
|
5332
|
+
() => [
|
|
5333
|
+
[1, "attacker", 13],
|
|
5334
|
+
[2, "attacker_player", 5],
|
|
5335
|
+
[3, "heavy", 8],
|
|
5336
|
+
[4, "hits", 13, 3]
|
|
5337
|
+
],
|
|
5338
|
+
{
|
|
5339
|
+
decode: (r, end, m) => {
|
|
5340
|
+
while (r.pos < end) {
|
|
5341
|
+
const t = r.tag();
|
|
5342
|
+
if ((t & 7) === 4) return m;
|
|
5343
|
+
switch (t >>> 3) {
|
|
5344
|
+
case 1:
|
|
5345
|
+
m.attacker = r.uint32();
|
|
5346
|
+
break;
|
|
5347
|
+
case 2:
|
|
5348
|
+
m.attackerPlayer = r.int32();
|
|
5349
|
+
break;
|
|
5350
|
+
case 3:
|
|
5351
|
+
m.heavy = r.bool();
|
|
5352
|
+
break;
|
|
5353
|
+
case 4:
|
|
5354
|
+
for (const e = r.run(t), a = m.hits ??= []; r.pos < e; )
|
|
5355
|
+
a.push(r.uint32());
|
|
5356
|
+
break;
|
|
5357
|
+
default:
|
|
5358
|
+
r.skip(t);
|
|
5359
|
+
}
|
|
5360
|
+
}
|
|
5361
|
+
return m;
|
|
5362
|
+
},
|
|
5363
|
+
encode: (m, w) => {
|
|
5364
|
+
{
|
|
5365
|
+
const v = m.attacker;
|
|
5366
|
+
if (v) w.uint32(8).uint32(v);
|
|
5367
|
+
}
|
|
5368
|
+
{
|
|
5369
|
+
const v = m.attackerPlayer;
|
|
5370
|
+
if (v) w.uint32(16).int32(v);
|
|
5371
|
+
}
|
|
5372
|
+
{
|
|
5373
|
+
const v = m.heavy;
|
|
5374
|
+
if (v) w.uint32(24).bool(v);
|
|
5375
|
+
}
|
|
5376
|
+
{
|
|
5377
|
+
const a = m.hits;
|
|
5378
|
+
if (a != null && a.length > 0) {
|
|
5379
|
+
const s = w.uint32(34).fork();
|
|
5380
|
+
for (const e of a) w.uint32(e);
|
|
5381
|
+
w.join(s);
|
|
5382
|
+
}
|
|
5383
|
+
}
|
|
5384
|
+
}
|
|
5385
|
+
}
|
|
5386
|
+
);
|
|
5387
|
+
var ParryEvent = /* @__PURE__ */ createMessageType(
|
|
5388
|
+
"modlock.wasm.combat.ParryEvent",
|
|
5389
|
+
() => [
|
|
5390
|
+
[1, "parrier", 13],
|
|
5391
|
+
[2, "player", 5],
|
|
5392
|
+
[3, "attacker", 13],
|
|
5393
|
+
[4, "attacker_player", 5]
|
|
5394
|
+
],
|
|
5395
|
+
{
|
|
5396
|
+
decode: (r, end, m) => {
|
|
5397
|
+
while (r.pos < end) {
|
|
5398
|
+
const t = r.tag();
|
|
5399
|
+
if ((t & 7) === 4) return m;
|
|
5400
|
+
switch (t >>> 3) {
|
|
5401
|
+
case 1:
|
|
5402
|
+
m.parrier = r.uint32();
|
|
5403
|
+
break;
|
|
5404
|
+
case 2:
|
|
5405
|
+
m.player = r.int32();
|
|
5406
|
+
break;
|
|
5407
|
+
case 3:
|
|
5408
|
+
m.attacker = r.uint32();
|
|
5409
|
+
break;
|
|
5410
|
+
case 4:
|
|
5411
|
+
m.attackerPlayer = r.int32();
|
|
5412
|
+
break;
|
|
5413
|
+
default:
|
|
5414
|
+
r.skip(t);
|
|
5415
|
+
}
|
|
5416
|
+
}
|
|
5417
|
+
return m;
|
|
5418
|
+
},
|
|
5419
|
+
encode: (m, w) => {
|
|
5420
|
+
{
|
|
5421
|
+
const v = m.parrier;
|
|
5422
|
+
if (v) w.uint32(8).uint32(v);
|
|
5423
|
+
}
|
|
5424
|
+
{
|
|
5425
|
+
const v = m.player;
|
|
5426
|
+
if (v) w.uint32(16).int32(v);
|
|
5427
|
+
}
|
|
5428
|
+
{
|
|
5429
|
+
const v = m.attacker;
|
|
5430
|
+
if (v) w.uint32(24).uint32(v);
|
|
5431
|
+
}
|
|
5432
|
+
{
|
|
5433
|
+
const v = m.attackerPlayer;
|
|
5434
|
+
if (v) w.uint32(32).int32(v);
|
|
5435
|
+
}
|
|
5436
|
+
}
|
|
5437
|
+
}
|
|
5438
|
+
);
|
|
5178
5439
|
|
|
5179
5440
|
// src/wasm/effects/effects.pb.ts
|
|
5180
5441
|
var ScreenEffect_Enum = /* @__PURE__ */ createEnumType(
|
|
@@ -13607,6 +13868,40 @@ function fromModifierFiredEvent(message) {
|
|
|
13607
13868
|
ability: message.ability ?? 0
|
|
13608
13869
|
};
|
|
13609
13870
|
}
|
|
13871
|
+
function fromHealEvent(message) {
|
|
13872
|
+
return {
|
|
13873
|
+
target: message.target ?? 0,
|
|
13874
|
+
targetPlayer: Player.of(message.targetPlayer ?? 0),
|
|
13875
|
+
healer: message.healer ?? 0,
|
|
13876
|
+
healerPlayer: Player.of(message.healerPlayer ?? 0),
|
|
13877
|
+
ability: message.ability ?? 0,
|
|
13878
|
+
applied: message.applied ?? 0,
|
|
13879
|
+
requested: message.requested ?? 0
|
|
13880
|
+
};
|
|
13881
|
+
}
|
|
13882
|
+
function fromLevelEvent(message) {
|
|
13883
|
+
return {
|
|
13884
|
+
hero: message.hero ?? 0,
|
|
13885
|
+
player: Player.of(message.player ?? 0),
|
|
13886
|
+
level: message.level ?? 0
|
|
13887
|
+
};
|
|
13888
|
+
}
|
|
13889
|
+
function fromMeleeEvent(message) {
|
|
13890
|
+
return {
|
|
13891
|
+
attacker: message.attacker ?? 0,
|
|
13892
|
+
attackerPlayer: Player.of(message.attackerPlayer ?? 0),
|
|
13893
|
+
heavy: message.heavy ?? false,
|
|
13894
|
+
hits: message.hits ?? []
|
|
13895
|
+
};
|
|
13896
|
+
}
|
|
13897
|
+
function fromParryEvent(message) {
|
|
13898
|
+
return {
|
|
13899
|
+
parrier: message.parrier ?? 0,
|
|
13900
|
+
player: Player.of(message.player ?? 0),
|
|
13901
|
+
attacker: message.attacker ?? 0,
|
|
13902
|
+
attackerPlayer: Player.of(message.attackerPlayer ?? 0)
|
|
13903
|
+
};
|
|
13904
|
+
}
|
|
13610
13905
|
function toSoundOptions(value) {
|
|
13611
13906
|
return {
|
|
13612
13907
|
volume: value.volume,
|
|
@@ -14024,7 +14319,11 @@ function toStartResult(value) {
|
|
|
14024
14319
|
joins: value.joins,
|
|
14025
14320
|
casts: value.casts,
|
|
14026
14321
|
modifierEvents: value.modifierEvents?.slice(),
|
|
14027
|
-
kills: value.kills
|
|
14322
|
+
kills: value.kills,
|
|
14323
|
+
heals: value.heals,
|
|
14324
|
+
levels: value.levels,
|
|
14325
|
+
melees: value.melees,
|
|
14326
|
+
parries: value.parries
|
|
14028
14327
|
};
|
|
14029
14328
|
}
|
|
14030
14329
|
function fromFrameEvent(message) {
|
|
@@ -14968,6 +15267,18 @@ function serveMod(handlers2, bytes) {
|
|
|
14968
15267
|
case "ModifierFired":
|
|
14969
15268
|
handlers2.modifierFired(fromModifierFiredEvent(ModifierFiredEvent.fromBinary(input2)));
|
|
14970
15269
|
return reply();
|
|
15270
|
+
case "Healed":
|
|
15271
|
+
handlers2.healed(fromHealEvent(HealEvent.fromBinary(input2)));
|
|
15272
|
+
return reply();
|
|
15273
|
+
case "LevelChanged":
|
|
15274
|
+
handlers2.levelChanged(fromLevelEvent(LevelEvent.fromBinary(input2)));
|
|
15275
|
+
return reply();
|
|
15276
|
+
case "Melee":
|
|
15277
|
+
handlers2.melee(fromMeleeEvent(MeleeEvent.fromBinary(input2)));
|
|
15278
|
+
return reply();
|
|
15279
|
+
case "Parried":
|
|
15280
|
+
handlers2.parried(fromParryEvent(ParryEvent.fromBinary(input2)));
|
|
15281
|
+
return reply();
|
|
14971
15282
|
case "Input":
|
|
14972
15283
|
handlers2.input(fromInputEvent(InputEvent.fromBinary(input2)));
|
|
14973
15284
|
return reply();
|
|
@@ -19306,7 +19617,9 @@ function onPlayerLeave(handler) {
|
|
|
19306
19617
|
function onSpawn(handler) {
|
|
19307
19618
|
spawns.push(handler);
|
|
19308
19619
|
}
|
|
19309
|
-
var
|
|
19620
|
+
var respawnedEvent = "PLAYER_RESPAWNED";
|
|
19621
|
+
var frameCount = 0;
|
|
19622
|
+
var spawnedAt = /* @__PURE__ */ new Map();
|
|
19310
19623
|
var seated = /* @__PURE__ */ new Map();
|
|
19311
19624
|
var respawnDelay;
|
|
19312
19625
|
var unseated = {};
|
|
@@ -19359,21 +19672,18 @@ function setRespawnDelay(seconds) {
|
|
|
19359
19672
|
}
|
|
19360
19673
|
startSeating();
|
|
19361
19674
|
}
|
|
19362
|
-
function
|
|
19363
|
-
const
|
|
19364
|
-
|
|
19365
|
-
|
|
19366
|
-
|
|
19367
|
-
|
|
19368
|
-
|
|
19369
|
-
|
|
19370
|
-
|
|
19371
|
-
|
|
19372
|
-
|
|
19373
|
-
}
|
|
19374
|
-
}
|
|
19675
|
+
function respawned(player) {
|
|
19676
|
+
const pawn = player.slot < 0 ? void 0 : player.pawn();
|
|
19677
|
+
if (pawn === void 0 || pawn.hero === 0 || pawn.health <= 0) {
|
|
19678
|
+
return;
|
|
19679
|
+
}
|
|
19680
|
+
if (spawnedAt.get(player.slot) === frameCount) {
|
|
19681
|
+
return;
|
|
19682
|
+
}
|
|
19683
|
+
spawnedAt.set(player.slot, frameCount);
|
|
19684
|
+
for (const handler of spawns) {
|
|
19685
|
+
handler(player, pawn);
|
|
19375
19686
|
}
|
|
19376
|
-
spawned = present;
|
|
19377
19687
|
}
|
|
19378
19688
|
function onFrame(handler) {
|
|
19379
19689
|
frames.push(handler);
|
|
@@ -19402,6 +19712,18 @@ function onKill(handler) {
|
|
|
19402
19712
|
function onAbilityCast(handler) {
|
|
19403
19713
|
abilityCasts.push(handler);
|
|
19404
19714
|
}
|
|
19715
|
+
function onHeal(handler) {
|
|
19716
|
+
heals.push(handler);
|
|
19717
|
+
}
|
|
19718
|
+
function onLevelChange(handler) {
|
|
19719
|
+
levels.push(handler);
|
|
19720
|
+
}
|
|
19721
|
+
function onMelee(handler) {
|
|
19722
|
+
melees.push(handler);
|
|
19723
|
+
}
|
|
19724
|
+
function onParry(handler) {
|
|
19725
|
+
parries.push(handler);
|
|
19726
|
+
}
|
|
19405
19727
|
function onModifierEvent(name, handler) {
|
|
19406
19728
|
const handlers2 = modifierEvents.get(name) ?? [];
|
|
19407
19729
|
handlers2.push(handler);
|
|
@@ -19443,6 +19765,10 @@ var damages = [];
|
|
|
19443
19765
|
var damageds = [];
|
|
19444
19766
|
var kills = [];
|
|
19445
19767
|
var abilityCasts = [];
|
|
19768
|
+
var heals = [];
|
|
19769
|
+
var levels = [];
|
|
19770
|
+
var melees = [];
|
|
19771
|
+
var parries = [];
|
|
19446
19772
|
var modifierEvents = /* @__PURE__ */ new Map();
|
|
19447
19773
|
var launches = [];
|
|
19448
19774
|
var impacts = [];
|
|
@@ -19461,16 +19787,23 @@ var handlers = {
|
|
|
19461
19787
|
joins: joins.length !== 0 || leaves.length !== 0,
|
|
19462
19788
|
casts: abilityCasts.length !== 0,
|
|
19463
19789
|
kills: kills.length !== 0,
|
|
19464
|
-
|
|
19790
|
+
heals: heals.length !== 0,
|
|
19791
|
+
levels: levels.length !== 0,
|
|
19792
|
+
melees: melees.length !== 0,
|
|
19793
|
+
parries: parries.length !== 0,
|
|
19794
|
+
modifierEvents: [
|
|
19795
|
+
.../* @__PURE__ */ new Set([
|
|
19796
|
+
...modifierEvents.keys(),
|
|
19797
|
+
...spawns.length !== 0 ? [respawnedEvent] : []
|
|
19798
|
+
])
|
|
19799
|
+
]
|
|
19465
19800
|
};
|
|
19466
19801
|
},
|
|
19467
19802
|
frame(event) {
|
|
19468
19803
|
tick(event.timeSeconds);
|
|
19469
19804
|
advance(event.timeSeconds);
|
|
19470
19805
|
advancePuppets(event.timeSeconds);
|
|
19471
|
-
|
|
19472
|
-
watchSpawns();
|
|
19473
|
-
}
|
|
19806
|
+
frameCount++;
|
|
19474
19807
|
for (const handler of frames) {
|
|
19475
19808
|
handler(event);
|
|
19476
19809
|
}
|
|
@@ -19539,7 +19872,30 @@ var handlers = {
|
|
|
19539
19872
|
handler(event);
|
|
19540
19873
|
}
|
|
19541
19874
|
},
|
|
19875
|
+
healed(event) {
|
|
19876
|
+
for (const handler of heals) {
|
|
19877
|
+
handler(event);
|
|
19878
|
+
}
|
|
19879
|
+
},
|
|
19880
|
+
levelChanged(event) {
|
|
19881
|
+
for (const handler of levels) {
|
|
19882
|
+
handler(event);
|
|
19883
|
+
}
|
|
19884
|
+
},
|
|
19885
|
+
melee(event) {
|
|
19886
|
+
for (const handler of melees) {
|
|
19887
|
+
handler(event);
|
|
19888
|
+
}
|
|
19889
|
+
},
|
|
19890
|
+
parried(event) {
|
|
19891
|
+
for (const handler of parries) {
|
|
19892
|
+
handler(event);
|
|
19893
|
+
}
|
|
19894
|
+
},
|
|
19542
19895
|
modifierFired(event) {
|
|
19896
|
+
if (event.name === respawnedEvent && spawns.length !== 0) {
|
|
19897
|
+
respawned(event.player);
|
|
19898
|
+
}
|
|
19543
19899
|
for (const handler of modifierEvents.get(event.name) ?? []) {
|
|
19544
19900
|
handler(event);
|
|
19545
19901
|
}
|
|
@@ -19710,13 +20066,17 @@ export {
|
|
|
19710
20066
|
onDamage,
|
|
19711
20067
|
onDamaged,
|
|
19712
20068
|
onFrame,
|
|
20069
|
+
onHeal,
|
|
19713
20070
|
onImpact,
|
|
19714
20071
|
onInput,
|
|
19715
20072
|
onKill,
|
|
19716
20073
|
onLanded,
|
|
19717
20074
|
onLaunch,
|
|
20075
|
+
onLevelChange,
|
|
20076
|
+
onMelee,
|
|
19718
20077
|
onModifierEvent,
|
|
19719
20078
|
onNpcsRestored,
|
|
20079
|
+
onParry,
|
|
19720
20080
|
onPlayerJoin,
|
|
19721
20081
|
onPlayerLeave,
|
|
19722
20082
|
onRestored,
|
package/package.json
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"name": "@modlock/modlock",
|
|
9
9
|
"optionalDependencies": {
|
|
10
|
-
"@modlock/darwin-arm64": "0.1.
|
|
11
|
-
"@modlock/darwin-x64": "0.1.
|
|
12
|
-
"@modlock/linux-arm64": "0.1.
|
|
13
|
-
"@modlock/linux-x64": "0.1.
|
|
14
|
-
"@modlock/win32-x64": "0.1.
|
|
10
|
+
"@modlock/darwin-arm64": "0.1.85",
|
|
11
|
+
"@modlock/darwin-x64": "0.1.85",
|
|
12
|
+
"@modlock/linux-arm64": "0.1.85",
|
|
13
|
+
"@modlock/linux-x64": "0.1.85",
|
|
14
|
+
"@modlock/win32-x64": "0.1.85"
|
|
15
15
|
},
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"type": "module",
|
|
22
22
|
"types": "index.d.ts",
|
|
23
|
-
"version": "0.1.
|
|
23
|
+
"version": "0.1.85"
|
|
24
24
|
}
|