@modlock/modlock 0.1.79 → 0.1.81
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 +45 -0
- package/index.js +165 -2
- package/package.json +6 -6
- package/strays.d.ts +6 -0
package/host.gen.d.ts
CHANGED
|
@@ -102,6 +102,44 @@ export interface AbilityOptions {
|
|
|
102
102
|
*/
|
|
103
103
|
maxCharges?: number;
|
|
104
104
|
}
|
|
105
|
+
/** Modifier is one modifier an entity holds, as the game keeps it. */
|
|
106
|
+
export interface Modifier {
|
|
107
|
+
/**
|
|
108
|
+
* name is the modifier's name, such as modifier_citadel_knockdown, as
|
|
109
|
+
* GiveModifier and ReadModifierField name it. It is empty when the game
|
|
110
|
+
* keeps no readable name.
|
|
111
|
+
*/
|
|
112
|
+
readonly name: string;
|
|
113
|
+
/**
|
|
114
|
+
* className is the modifier's server class, such as
|
|
115
|
+
* CCitadel_Modifier_Knockdown, which ReadModifierField takes. Several
|
|
116
|
+
* names can share a class.
|
|
117
|
+
*/
|
|
118
|
+
readonly className: string;
|
|
119
|
+
/**
|
|
120
|
+
* caster is the handle of the entity that applied it, such as the hero
|
|
121
|
+
* whose ability did, or 0 when none did.
|
|
122
|
+
*/
|
|
123
|
+
readonly caster: number;
|
|
124
|
+
/**
|
|
125
|
+
* ability is the handle of the ability that applied it, or 0 when none did.
|
|
126
|
+
*/
|
|
127
|
+
readonly ability: number;
|
|
128
|
+
/** age is how many seconds ago the game created it. */
|
|
129
|
+
readonly age: number;
|
|
130
|
+
/**
|
|
131
|
+
* remaining is how many seconds it has left since it was last applied. It
|
|
132
|
+
* is absent for a modifier that lasts until something removes it.
|
|
133
|
+
*/
|
|
134
|
+
readonly remaining?: number;
|
|
135
|
+
/** stacks and maxStacks count its stacks, for a modifier that stacks. */
|
|
136
|
+
readonly stacks: number;
|
|
137
|
+
readonly maxStacks: number;
|
|
138
|
+
/** team is the team number it belongs to. */
|
|
139
|
+
readonly team: number;
|
|
140
|
+
/** disabled is true while the game keeps it without its effects. */
|
|
141
|
+
readonly disabled: boolean;
|
|
142
|
+
}
|
|
105
143
|
/** BuildCategory is one named group of a build's items. */
|
|
106
144
|
export interface BuildCategory {
|
|
107
145
|
/** name is the category's title. */
|
|
@@ -1897,6 +1935,13 @@ export declare function entityPosition(entity: number): EntityPlacement | undefi
|
|
|
1897
1935
|
* MODIFIER_STATE_PARRY_ACTIVE.
|
|
1898
1936
|
*/
|
|
1899
1937
|
export declare function modifierState(entity: number, state: string): boolean;
|
|
1938
|
+
/**
|
|
1939
|
+
* modifiers lists every modifier an entity holds, such as the stun a
|
|
1940
|
+
* hero's ultimate keeps on its target, with its name, class, caster,
|
|
1941
|
+
* ability, age, time left and stacks. An entity that holds none answers an
|
|
1942
|
+
* empty list.
|
|
1943
|
+
*/
|
|
1944
|
+
export declare function modifiers(entity: number): Modifier[];
|
|
1900
1945
|
/**
|
|
1901
1946
|
* holdModifierState holds a modifier state, such as
|
|
1902
1947
|
* MODIFIER_STATE_FRIENDLY_FIRE_ENABLED, on an entity while the mod runs, or
|
package/index.js
CHANGED
|
@@ -3933,6 +3933,133 @@ var ActiveResponse = /* @__PURE__ */ createMessageType(
|
|
|
3933
3933
|
}
|
|
3934
3934
|
}
|
|
3935
3935
|
);
|
|
3936
|
+
var ModifiersResponse = /* @__PURE__ */ createMessageType(
|
|
3937
|
+
"modlock.wasm.abilities.ModifiersResponse",
|
|
3938
|
+
() => [[1, "modifiers", 11, 1, Modifier.codec]],
|
|
3939
|
+
{
|
|
3940
|
+
decode: (r, end, m) => {
|
|
3941
|
+
while (r.pos < end) {
|
|
3942
|
+
const t = r.tag();
|
|
3943
|
+
if ((t & 7) === 4) return m;
|
|
3944
|
+
switch (t >>> 3) {
|
|
3945
|
+
case 1:
|
|
3946
|
+
;
|
|
3947
|
+
(m.modifiers ??= []).push(Modifier.decode(r, r.delimited(), {}));
|
|
3948
|
+
break;
|
|
3949
|
+
default:
|
|
3950
|
+
r.skip(t);
|
|
3951
|
+
}
|
|
3952
|
+
}
|
|
3953
|
+
return m;
|
|
3954
|
+
},
|
|
3955
|
+
encode: (m, w) => {
|
|
3956
|
+
{
|
|
3957
|
+
const a = m.modifiers;
|
|
3958
|
+
if (a != null) for (const e of a) Modifier.writeField(w, 1, e);
|
|
3959
|
+
}
|
|
3960
|
+
}
|
|
3961
|
+
}
|
|
3962
|
+
);
|
|
3963
|
+
var Modifier = /* @__PURE__ */ createMessageType(
|
|
3964
|
+
"modlock.wasm.abilities.Modifier",
|
|
3965
|
+
() => [
|
|
3966
|
+
[1, "name", 9],
|
|
3967
|
+
[2, "class_name", 9],
|
|
3968
|
+
[3, "caster", 13],
|
|
3969
|
+
[4, "ability", 13],
|
|
3970
|
+
[5, "age", 2],
|
|
3971
|
+
[6, "remaining", 2, 4],
|
|
3972
|
+
[7, "stacks", 5],
|
|
3973
|
+
[8, "max_stacks", 5],
|
|
3974
|
+
[9, "team", 13],
|
|
3975
|
+
[10, "disabled", 8]
|
|
3976
|
+
],
|
|
3977
|
+
{
|
|
3978
|
+
decode: (r, end, m) => {
|
|
3979
|
+
while (r.pos < end) {
|
|
3980
|
+
const t = r.tag();
|
|
3981
|
+
if ((t & 7) === 4) return m;
|
|
3982
|
+
switch (t >>> 3) {
|
|
3983
|
+
case 1:
|
|
3984
|
+
m.name = r.string();
|
|
3985
|
+
break;
|
|
3986
|
+
case 2:
|
|
3987
|
+
m.className = r.string();
|
|
3988
|
+
break;
|
|
3989
|
+
case 3:
|
|
3990
|
+
m.caster = r.uint32();
|
|
3991
|
+
break;
|
|
3992
|
+
case 4:
|
|
3993
|
+
m.ability = r.uint32();
|
|
3994
|
+
break;
|
|
3995
|
+
case 5:
|
|
3996
|
+
m.age = r.float();
|
|
3997
|
+
break;
|
|
3998
|
+
case 6:
|
|
3999
|
+
m.remaining = r.float();
|
|
4000
|
+
break;
|
|
4001
|
+
case 7:
|
|
4002
|
+
m.stacks = r.int32();
|
|
4003
|
+
break;
|
|
4004
|
+
case 8:
|
|
4005
|
+
m.maxStacks = r.int32();
|
|
4006
|
+
break;
|
|
4007
|
+
case 9:
|
|
4008
|
+
m.team = r.uint32();
|
|
4009
|
+
break;
|
|
4010
|
+
case 10:
|
|
4011
|
+
m.disabled = r.bool();
|
|
4012
|
+
break;
|
|
4013
|
+
default:
|
|
4014
|
+
r.skip(t);
|
|
4015
|
+
}
|
|
4016
|
+
}
|
|
4017
|
+
return m;
|
|
4018
|
+
},
|
|
4019
|
+
encode: (m, w) => {
|
|
4020
|
+
{
|
|
4021
|
+
const v = m.name;
|
|
4022
|
+
if (v) w.uint32(10).string(v);
|
|
4023
|
+
}
|
|
4024
|
+
{
|
|
4025
|
+
const v = m.className;
|
|
4026
|
+
if (v) w.uint32(18).string(v);
|
|
4027
|
+
}
|
|
4028
|
+
{
|
|
4029
|
+
const v = m.caster;
|
|
4030
|
+
if (v) w.uint32(24).uint32(v);
|
|
4031
|
+
}
|
|
4032
|
+
{
|
|
4033
|
+
const v = m.ability;
|
|
4034
|
+
if (v) w.uint32(32).uint32(v);
|
|
4035
|
+
}
|
|
4036
|
+
{
|
|
4037
|
+
const v = m.age;
|
|
4038
|
+
if (v != null && v !== 0) w.uint32(45).float(v);
|
|
4039
|
+
}
|
|
4040
|
+
{
|
|
4041
|
+
const v = m.remaining;
|
|
4042
|
+
if (v != null) w.uint32(53).float(v);
|
|
4043
|
+
}
|
|
4044
|
+
{
|
|
4045
|
+
const v = m.stacks;
|
|
4046
|
+
if (v) w.uint32(56).int32(v);
|
|
4047
|
+
}
|
|
4048
|
+
{
|
|
4049
|
+
const v = m.maxStacks;
|
|
4050
|
+
if (v) w.uint32(64).int32(v);
|
|
4051
|
+
}
|
|
4052
|
+
{
|
|
4053
|
+
const v = m.team;
|
|
4054
|
+
if (v) w.uint32(72).uint32(v);
|
|
4055
|
+
}
|
|
4056
|
+
{
|
|
4057
|
+
const v = m.disabled;
|
|
4058
|
+
if (v) w.uint32(80).bool(v);
|
|
4059
|
+
}
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
4062
|
+
);
|
|
3936
4063
|
var HoldModifierStateRequest = /* @__PURE__ */ createMessageType(
|
|
3937
4064
|
"modlock.wasm.abilities.HoldModifierStateRequest",
|
|
3938
4065
|
() => [
|
|
@@ -13128,6 +13255,20 @@ function toAbilityOptions(value) {
|
|
|
13128
13255
|
maxCharges: value.maxCharges === void 0 ? void 0 : int32(value.maxCharges)
|
|
13129
13256
|
};
|
|
13130
13257
|
}
|
|
13258
|
+
function fromModifier(message) {
|
|
13259
|
+
return {
|
|
13260
|
+
name: message.name ?? "",
|
|
13261
|
+
className: message.className ?? "",
|
|
13262
|
+
caster: message.caster ?? 0,
|
|
13263
|
+
ability: message.ability ?? 0,
|
|
13264
|
+
age: message.age ?? 0,
|
|
13265
|
+
remaining: message.remaining,
|
|
13266
|
+
stacks: message.stacks ?? 0,
|
|
13267
|
+
maxStacks: message.maxStacks ?? 0,
|
|
13268
|
+
team: message.team ?? 0,
|
|
13269
|
+
disabled: message.disabled ?? false
|
|
13270
|
+
};
|
|
13271
|
+
}
|
|
13131
13272
|
function fromBuildCategory(message) {
|
|
13132
13273
|
return {
|
|
13133
13274
|
name: message.name ?? "",
|
|
@@ -14345,6 +14486,12 @@ function modifierState(entity, state) {
|
|
|
14345
14486
|
const response = ActiveResponse.fromBinary(reply2);
|
|
14346
14487
|
return response.active ?? false;
|
|
14347
14488
|
}
|
|
14489
|
+
function modifiers(entity) {
|
|
14490
|
+
const reply2 = call("Modifiers", EntityRequest.toBinary({ entity }));
|
|
14491
|
+
if (reply2 === void 0) return [];
|
|
14492
|
+
const response = ModifiersResponse.fromBinary(reply2);
|
|
14493
|
+
return (response.modifiers ?? []).map((v) => fromModifier(v));
|
|
14494
|
+
}
|
|
14348
14495
|
function holdModifierState(entity, state, active) {
|
|
14349
14496
|
return call("HoldModifierState", HoldModifierStateRequest.toBinary({ entity, state, active })) !== void 0;
|
|
14350
14497
|
}
|
|
@@ -17509,6 +17656,12 @@ var strayBlow = 1e6;
|
|
|
17509
17656
|
var Strays = class {
|
|
17510
17657
|
/** since maps each stray pawn to when it was first seen with no player. */
|
|
17511
17658
|
since = /* @__PURE__ */ new Map();
|
|
17659
|
+
/**
|
|
17660
|
+
* gone holds the controller handles strays name that no longer resolve. A
|
|
17661
|
+
* handle carries its entity's serial, so it never resolves again, and each
|
|
17662
|
+
* failed read logs on the host: a sweep reads it once.
|
|
17663
|
+
*/
|
|
17664
|
+
gone = /* @__PURE__ */ new Set();
|
|
17512
17665
|
sweptAt = -Infinity;
|
|
17513
17666
|
/**
|
|
17514
17667
|
* sweep lays down each hero pawn that has belonged to no player for
|
|
@@ -17528,8 +17681,9 @@ var Strays = class {
|
|
|
17528
17681
|
}
|
|
17529
17682
|
}
|
|
17530
17683
|
const since = /* @__PURE__ */ new Map();
|
|
17684
|
+
const gone = /* @__PURE__ */ new Set();
|
|
17531
17685
|
for (const entity of findEntities("player")) {
|
|
17532
|
-
if (held.has(entity) || ownHero(entity)) {
|
|
17686
|
+
if (held.has(entity) || ownHero(entity, this.gone, gone)) {
|
|
17533
17687
|
continue;
|
|
17534
17688
|
}
|
|
17535
17689
|
const first = this.since.get(entity) ?? now4;
|
|
@@ -17539,9 +17693,10 @@ var Strays = class {
|
|
|
17539
17693
|
}
|
|
17540
17694
|
}
|
|
17541
17695
|
this.since = since;
|
|
17696
|
+
this.gone = gone;
|
|
17542
17697
|
}
|
|
17543
17698
|
};
|
|
17544
|
-
function ownHero(entity) {
|
|
17699
|
+
function ownHero(entity, known2, seen) {
|
|
17545
17700
|
const controller = readField(
|
|
17546
17701
|
entity,
|
|
17547
17702
|
"CBasePlayerPawn",
|
|
@@ -17551,6 +17706,10 @@ function ownHero(entity) {
|
|
|
17551
17706
|
if (typeof controller !== "number") {
|
|
17552
17707
|
return false;
|
|
17553
17708
|
}
|
|
17709
|
+
if (known2.has(controller)) {
|
|
17710
|
+
seen.add(controller);
|
|
17711
|
+
return false;
|
|
17712
|
+
}
|
|
17554
17713
|
const connected = readField(
|
|
17555
17714
|
controller,
|
|
17556
17715
|
"CBasePlayerController",
|
|
@@ -17566,6 +17725,9 @@ function ownHero(entity) {
|
|
|
17566
17725
|
"m_hHeroPawn",
|
|
17567
17726
|
"handle"
|
|
17568
17727
|
);
|
|
17728
|
+
if (connected === void 0 && hero === void 0) {
|
|
17729
|
+
seen.add(controller);
|
|
17730
|
+
}
|
|
17569
17731
|
return hero === entity;
|
|
17570
17732
|
}
|
|
17571
17733
|
function layDown(entity) {
|
|
@@ -19203,6 +19365,7 @@ export {
|
|
|
19203
19365
|
log2 as log,
|
|
19204
19366
|
matchClock,
|
|
19205
19367
|
modifierState,
|
|
19368
|
+
modifiers,
|
|
19206
19369
|
moveEntity,
|
|
19207
19370
|
nextMatch,
|
|
19208
19371
|
onChat,
|
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.81",
|
|
11
|
+
"@modlock/darwin-x64": "0.1.81",
|
|
12
|
+
"@modlock/linux-arm64": "0.1.81",
|
|
13
|
+
"@modlock/linux-x64": "0.1.81",
|
|
14
|
+
"@modlock/win32-x64": "0.1.81"
|
|
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.81"
|
|
24
24
|
}
|
package/strays.d.ts
CHANGED
|
@@ -7,6 +7,12 @@ export declare const strayGraceSeconds = 3;
|
|
|
7
7
|
export declare class Strays {
|
|
8
8
|
/** since maps each stray pawn to when it was first seen with no player. */
|
|
9
9
|
private since;
|
|
10
|
+
/**
|
|
11
|
+
* gone holds the controller handles strays name that no longer resolve. A
|
|
12
|
+
* handle carries its entity's serial, so it never resolves again, and each
|
|
13
|
+
* failed read logs on the host: a sweep reads it once.
|
|
14
|
+
*/
|
|
15
|
+
private gone;
|
|
10
16
|
private sweptAt;
|
|
11
17
|
/**
|
|
12
18
|
* sweep lays down each hero pawn that has belonged to no player for
|