warscript 0.0.1-dev.e561d29 → 0.0.1-dev.e698bed
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/attributes.d.ts +1 -0
- package/attributes.lua +9 -0
- package/core/types/frame.lua +24 -21
- package/core/types/player.d.ts +16 -0
- package/core/types/player.lua +60 -15
- package/core/types/playerCamera.d.ts +2 -0
- package/core/types/playerCamera.lua +123 -5
- package/core/types/tileCell.d.ts +11 -1
- package/core/types/tileCell.lua +97 -0
- package/core/types/timer.d.ts +3 -2
- package/core/types/timer.lua +22 -2
- package/decl/native.d.ts +2 -2
- package/engine/behavior.d.ts +10 -1
- package/engine/behavior.lua +141 -65
- package/engine/behaviour/ability/apply-buff.lua +12 -4
- package/engine/behaviour/ability/remove-buffs.d.ts +9 -0
- package/engine/behaviour/ability/remove-buffs.lua +21 -0
- package/engine/behaviour/ability/restore-mana.d.ts +1 -1
- package/engine/behaviour/ability/restore-mana.lua +6 -6
- package/engine/behaviour/unit/stun-immunity.d.ts +8 -4
- package/engine/behaviour/unit/stun-immunity.lua +12 -3
- package/engine/behaviour/unit.d.ts +15 -5
- package/engine/behaviour/unit.lua +116 -22
- package/engine/buff.d.ts +10 -4
- package/engine/buff.lua +119 -84
- package/engine/internal/ability.d.ts +3 -1
- package/engine/internal/ability.lua +26 -9
- package/engine/internal/item+owner.lua +12 -6
- package/engine/internal/item.d.ts +13 -15
- package/engine/internal/item.lua +63 -49
- package/engine/internal/misc/frame-coordinates.d.ts +2 -0
- package/engine/internal/misc/frame-coordinates.lua +21 -0
- package/engine/internal/misc/get-terrain-z.d.ts +2 -0
- package/engine/internal/misc/get-terrain-z.lua +11 -0
- package/engine/internal/misc/player-local-handle.d.ts +2 -0
- package/engine/internal/misc/player-local-handle.lua +5 -0
- package/engine/internal/unit/ability.d.ts +14 -14
- package/engine/internal/unit/ability.lua +72 -45
- package/engine/internal/unit/fly-height.d.ts +7 -0
- package/engine/internal/unit/fly-height.lua +20 -0
- package/engine/internal/unit/main-selected.lua +12 -27
- package/engine/internal/unit/scale.d.ts +7 -0
- package/engine/internal/unit/scale.lua +20 -0
- package/engine/internal/unit+ability.lua +10 -1
- package/engine/internal/unit-missile-launch.lua +44 -20
- package/engine/internal/unit.d.ts +16 -13
- package/engine/internal/unit.lua +102 -81
- package/engine/local-client.d.ts +2 -0
- package/engine/local-client.lua +30 -0
- package/engine/object-data/entry/ability-type.lua +4 -1
- package/engine/object-data/entry/unit-type.d.ts +4 -0
- package/engine/object-data/entry/unit-type.lua +76 -32
- package/engine/object-field/ability.d.ts +3 -3
- package/engine/object-field/ability.lua +7 -6
- package/engine/object-field/unit.d.ts +13 -1
- package/engine/object-field/unit.lua +57 -0
- package/engine/object-field.d.ts +9 -3
- package/engine/object-field.lua +204 -115
- package/engine/random.d.ts +9 -0
- package/engine/random.lua +13 -0
- package/engine/standard/fields/ability.d.ts +2 -2
- package/engine/standard/fields/ability.lua +2 -2
- package/engine/standard/fields/unit.d.ts +3 -1
- package/engine/standard/fields/unit.lua +4 -0
- package/engine/synchronization.d.ts +11 -0
- package/engine/synchronization.lua +77 -0
- package/engine/text-tag.d.ts +1 -1
- package/engine/text-tag.lua +92 -17
- package/engine/unit.d.ts +2 -0
- package/engine/unit.lua +2 -0
- package/net/socket.lua +1 -1
- package/objutil/buff.lua +1 -1
- package/package.json +2 -2
- package/patch-lualib.lua +1 -1
- package/utility/arrays.d.ts +1 -0
- package/utility/arrays.lua +8 -0
- package/utility/callback-array.d.ts +17 -0
- package/utility/callback-array.lua +61 -0
- package/utility/functions.d.ts +2 -0
- package/utility/functions.lua +7 -0
- package/utility/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +19 -1
- package/utility/lua-maps.d.ts +11 -2
- package/utility/lua-maps.lua +33 -2
- package/utility/lua-sets.d.ts +1 -0
- package/utility/lua-sets.lua +4 -0
- package/utility/types.d.ts +3 -0
|
@@ -232,6 +232,19 @@ ____exports.getOrderIdByAbilityTypeId = function(abilityTypeId)
|
|
|
232
232
|
local parentTypeId = availableFields[abilityTypeId]
|
|
233
233
|
return order2orderId(orders[____type(parentTypeId) == "number" and parentTypeId or abilityTypeId] or "")
|
|
234
234
|
end
|
|
235
|
+
---
|
|
236
|
+
-- @internal For use by internal systems only.
|
|
237
|
+
____exports.abilityTypeHasField = function(abilityTypeId, field)
|
|
238
|
+
field = ____type(field) == "number" and field or getHandleId(field)
|
|
239
|
+
if commonFields[field] then
|
|
240
|
+
return true
|
|
241
|
+
end
|
|
242
|
+
local id = availableFields[abilityTypeId]
|
|
243
|
+
if ____type(id) == "number" then
|
|
244
|
+
id = availableFields[id]
|
|
245
|
+
end
|
|
246
|
+
return not not (id and id[field])
|
|
247
|
+
end
|
|
235
248
|
____exports.Ability = __TS__Class()
|
|
236
249
|
local Ability = ____exports.Ability
|
|
237
250
|
Ability.name = "Ability"
|
|
@@ -247,15 +260,7 @@ function Ability.prototype.getSnapshot(self)
|
|
|
247
260
|
return nil
|
|
248
261
|
end
|
|
249
262
|
function Ability.prototype.hasField(self, field)
|
|
250
|
-
|
|
251
|
-
if commonFields[field] then
|
|
252
|
-
return true
|
|
253
|
-
end
|
|
254
|
-
local id = availableFields[self.typeId]
|
|
255
|
-
if ____type(id) == "number" then
|
|
256
|
-
id = availableFields[id]
|
|
257
|
-
end
|
|
258
|
-
return not not (id and id[field])
|
|
263
|
+
return ____exports.abilityTypeHasField(self.typeId, field)
|
|
259
264
|
end
|
|
260
265
|
function Ability.prototype.getField(self, field, level)
|
|
261
266
|
local fieldType = match(
|
|
@@ -420,6 +425,12 @@ end
|
|
|
420
425
|
function UnitAbility.prototype.interruptCast(self)
|
|
421
426
|
self.owner:interruptCast(self.typeId)
|
|
422
427
|
end
|
|
428
|
+
function UnitAbility.prototype.onDestroy(self)
|
|
429
|
+
if self.owner.state ~= 2 then
|
|
430
|
+
self.owner:removeAbility(self.typeId)
|
|
431
|
+
end
|
|
432
|
+
return UnitAbility.____super.prototype.onDestroy(self)
|
|
433
|
+
end
|
|
423
434
|
__TS__SetDescriptor(
|
|
424
435
|
UnitAbility.prototype,
|
|
425
436
|
"isDisabled",
|
|
@@ -512,6 +523,12 @@ function ItemAbility.prototype.interruptCast(self)
|
|
|
512
523
|
setItemBooleanField(handle, ITEM_BF_ACTIVELY_USED, true)
|
|
513
524
|
end
|
|
514
525
|
end
|
|
526
|
+
function ItemAbility.prototype.onDestroy(self)
|
|
527
|
+
if self.owner.state ~= 2 then
|
|
528
|
+
self.owner:removeAbility(self.typeId)
|
|
529
|
+
end
|
|
530
|
+
return ItemAbility.____super.prototype.onDestroy(self)
|
|
531
|
+
end
|
|
515
532
|
__TS__SetDescriptor(
|
|
516
533
|
ItemAbility.prototype,
|
|
517
534
|
"level",
|
|
@@ -6,12 +6,18 @@ local Item = ____item.Item
|
|
|
6
6
|
local ____unit = require("engine.internal.unit")
|
|
7
7
|
local Unit = ____unit.Unit
|
|
8
8
|
local ownerByItem = setmetatable({}, {__mode = "kv"})
|
|
9
|
-
Unit.itemPickedUpEvent:addListener(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
Unit.itemPickedUpEvent:addListener(
|
|
10
|
+
4,
|
|
11
|
+
function(unit, item)
|
|
12
|
+
ownerByItem[item] = unit
|
|
13
|
+
end
|
|
14
|
+
)
|
|
15
|
+
Unit.itemDroppedEvent:addListener(
|
|
16
|
+
4,
|
|
17
|
+
function(unit, item)
|
|
18
|
+
ownerByItem[item] = nil
|
|
19
|
+
end
|
|
20
|
+
)
|
|
15
21
|
__TS__ObjectDefineProperty(
|
|
16
22
|
Item.prototype,
|
|
17
23
|
"owner",
|
|
@@ -8,12 +8,10 @@ import { AbilityTypeId } from "../object-data/entry/ability-type";
|
|
|
8
8
|
import type { ItemTypeId } from "../object-data/entry/item-type";
|
|
9
9
|
type DefenseType = 0 | 1 | 2 | 3 | 4 | 5;
|
|
10
10
|
declare const enum ItemPropertyKey {
|
|
11
|
-
ABILITIES = 100
|
|
12
|
-
LUA_INDEX_BY_ABILITY_TYPE_ID = 101
|
|
11
|
+
ABILITIES = 100
|
|
13
12
|
}
|
|
14
13
|
export declare class Item extends Handle<jitem> {
|
|
15
14
|
private readonly [ItemPropertyKey.ABILITIES];
|
|
16
|
-
private readonly [ItemPropertyKey.LUA_INDEX_BY_ABILITY_TYPE_ID];
|
|
17
15
|
constructor(handle: jitem);
|
|
18
16
|
protected onDestroy(): HandleDestructor;
|
|
19
17
|
static create<T extends Item>(this: typeof Item & (new (handle: jitem) => T), id: number, x: number, y: number, skinId?: number): T;
|
|
@@ -30,22 +28,22 @@ export declare class Item extends Handle<jitem> {
|
|
|
30
28
|
get extendedTooltip(): string;
|
|
31
29
|
set iconPath(v: string);
|
|
32
30
|
get iconPath(): string;
|
|
33
|
-
set
|
|
34
|
-
get
|
|
35
|
-
set
|
|
36
|
-
get
|
|
37
|
-
set
|
|
38
|
-
get
|
|
39
|
-
set
|
|
40
|
-
get
|
|
41
|
-
set
|
|
42
|
-
get
|
|
31
|
+
set dropsOnDeath(dropsOnDeath: boolean);
|
|
32
|
+
get dropsOnDeath(): boolean;
|
|
33
|
+
set canBeDropped(canBeDropped: boolean);
|
|
34
|
+
get canBeDropped(): boolean;
|
|
35
|
+
set canBeSold(canBeSold: boolean);
|
|
36
|
+
get canBeSold(): boolean;
|
|
37
|
+
set perishes(perishes: boolean);
|
|
38
|
+
get perishes(): boolean;
|
|
39
|
+
set isPowerUp(isPowerUp: boolean);
|
|
40
|
+
get isPowerUp(): boolean;
|
|
43
41
|
get isAlive(): boolean;
|
|
44
42
|
get isDead(): boolean;
|
|
45
43
|
set isInvulnerable(isInvulnerable: boolean);
|
|
46
44
|
get isInvulnerable(): boolean;
|
|
47
|
-
set
|
|
48
|
-
get
|
|
45
|
+
set isActivelyUsed(isActivelyUsed: boolean);
|
|
46
|
+
get isActivelyUsed(): boolean;
|
|
49
47
|
set visible(v: boolean);
|
|
50
48
|
get visible(): boolean;
|
|
51
49
|
set level(v: number);
|
package/engine/internal/item.lua
CHANGED
|
@@ -46,9 +46,18 @@ local getItemY = GetItemY
|
|
|
46
46
|
local getItemCharges = GetItemCharges
|
|
47
47
|
local setItemCharges = SetItemCharges
|
|
48
48
|
local unitRemoveAbility = UnitRemoveAbility
|
|
49
|
+
local unitRemoveItem = UnitRemoveItem
|
|
49
50
|
local unitUseItem = UnitUseItem
|
|
50
51
|
local unitUseItemPoint = UnitUseItemPoint
|
|
51
52
|
local unitUseItemTarget = UnitUseItemTarget
|
|
53
|
+
local setItemDropOnDeath = SetItemDropOnDeath
|
|
54
|
+
local setItemDroppable = SetItemDroppable
|
|
55
|
+
local setItemPawnable = SetItemPawnable
|
|
56
|
+
local isItemPawnable = IsItemPawnable
|
|
57
|
+
local getItemIntegerField = BlzGetItemIntegerField
|
|
58
|
+
local setItemBooleanField = BlzSetItemBooleanField
|
|
59
|
+
local getItemBooleanField = BlzGetItemBooleanField
|
|
60
|
+
local tableRemove = table.remove
|
|
52
61
|
_G.SetItemCharges = function(whichItem, charges)
|
|
53
62
|
setItemCharges(whichItem, charges)
|
|
54
63
|
invoke(
|
|
@@ -56,9 +65,6 @@ _G.SetItemCharges = function(whichItem, charges)
|
|
|
56
65
|
____exports.Item:of(whichItem)
|
|
57
66
|
)
|
|
58
67
|
end
|
|
59
|
-
local getItemIntegerField = BlzGetItemIntegerField
|
|
60
|
-
local setItemBooleanField = BlzSetItemBooleanField
|
|
61
|
-
local getItemBooleanField = BlzGetItemBooleanField
|
|
62
68
|
invoke = Event.invoke
|
|
63
69
|
local enumRect = Rect:create(0, 0, 0, 0).handle
|
|
64
70
|
---
|
|
@@ -137,15 +143,13 @@ Item.name = "Item"
|
|
|
137
143
|
__TS__ClassExtends(Item, Handle)
|
|
138
144
|
function Item.prototype.____constructor(self, handle)
|
|
139
145
|
Handle.prototype.____constructor(self, handle)
|
|
140
|
-
|
|
141
|
-
self[100] = abilities
|
|
142
|
-
local luaIndexByAbilityTypeId = {}
|
|
143
|
-
for i = 1, #abilities do
|
|
144
|
-
luaIndexByAbilityTypeId[abilities[i].typeId] = i
|
|
145
|
-
end
|
|
146
|
-
self[101] = luaIndexByAbilityTypeId
|
|
146
|
+
self[100] = doAbilityAction(handle, getItemAbilities, self)
|
|
147
147
|
end
|
|
148
148
|
function Item.prototype.onDestroy(self)
|
|
149
|
+
local owner = self.owner
|
|
150
|
+
if owner ~= nil then
|
|
151
|
+
unitRemoveItem(owner.handle, self.handle)
|
|
152
|
+
end
|
|
149
153
|
local abilities = self[100]
|
|
150
154
|
for i = 1, #abilities do
|
|
151
155
|
abilities[i]:destroy()
|
|
@@ -191,33 +195,32 @@ function Item.prototype.addAbility(self, abilityTypeId)
|
|
|
191
195
|
if nativeAbility ~= nil then
|
|
192
196
|
local ability = ItemAbility:of(nativeAbility, abilityTypeId, self)
|
|
193
197
|
local abilities = self[100]
|
|
194
|
-
|
|
195
|
-
abilities[luaIndex] = ability
|
|
196
|
-
self[101][abilityTypeId] = luaIndex
|
|
198
|
+
abilities[#abilities + 1] = ability
|
|
197
199
|
return ability
|
|
198
200
|
end
|
|
199
201
|
return nil
|
|
200
202
|
end
|
|
201
203
|
function Item.prototype.removeAbility(self, abilityTypeId)
|
|
202
|
-
local
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
for j = luaIndex, abilityTypeIdsLength do
|
|
210
|
-
abilities[j] = abilities[j + 1]
|
|
204
|
+
local abilities = self[100]
|
|
205
|
+
for i = 1, #abilities do
|
|
206
|
+
if abilities[i].typeId == abilityTypeId then
|
|
207
|
+
local ability = abilities[i]
|
|
208
|
+
tableRemove(abilities, i)
|
|
209
|
+
ability:destroy()
|
|
210
|
+
return true
|
|
211
211
|
end
|
|
212
212
|
end
|
|
213
|
-
return
|
|
213
|
+
return doAbilityAction(self.handle, itemRemoveAbility, abilityTypeId)
|
|
214
214
|
end
|
|
215
215
|
function Item.prototype.hasAbility(self, abilityTypeId)
|
|
216
|
-
return self
|
|
216
|
+
return doAbilityAction(self.handle, getItemAbility, abilityTypeId) ~= nil
|
|
217
217
|
end
|
|
218
218
|
function Item.prototype.getAbility(self, abilityTypeId)
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
return ItemAbility:of(
|
|
220
|
+
doAbilityAction(self.handle, getItemAbility, abilityTypeId),
|
|
221
|
+
abilityTypeId,
|
|
222
|
+
self
|
|
223
|
+
)
|
|
221
224
|
end
|
|
222
225
|
function Item.getInRange(self, x, y, range)
|
|
223
226
|
targetCollection = {}
|
|
@@ -329,65 +332,68 @@ __TS__SetDescriptor(
|
|
|
329
332
|
)
|
|
330
333
|
__TS__SetDescriptor(
|
|
331
334
|
Item.prototype,
|
|
332
|
-
"
|
|
335
|
+
"dropsOnDeath",
|
|
333
336
|
{
|
|
334
337
|
get = function(self)
|
|
335
|
-
return
|
|
338
|
+
return getItemBooleanField(self.handle, ITEM_BF_DROPPED_WHEN_CARRIER_DIES)
|
|
336
339
|
end,
|
|
337
|
-
set = function(self,
|
|
338
|
-
|
|
340
|
+
set = function(self, dropsOnDeath)
|
|
341
|
+
setItemDropOnDeath(self.handle, dropsOnDeath)
|
|
339
342
|
end
|
|
340
343
|
},
|
|
341
344
|
true
|
|
342
345
|
)
|
|
343
346
|
__TS__SetDescriptor(
|
|
344
347
|
Item.prototype,
|
|
345
|
-
"
|
|
348
|
+
"canBeDropped",
|
|
346
349
|
{
|
|
347
350
|
get = function(self)
|
|
348
|
-
return
|
|
351
|
+
return getItemBooleanField(self.handle, ITEM_BF_CAN_BE_DROPPED)
|
|
349
352
|
end,
|
|
350
|
-
set = function(self,
|
|
351
|
-
|
|
353
|
+
set = function(self, canBeDropped)
|
|
354
|
+
setItemDroppable(self.handle, canBeDropped)
|
|
352
355
|
end
|
|
353
356
|
},
|
|
354
357
|
true
|
|
355
358
|
)
|
|
356
359
|
__TS__SetDescriptor(
|
|
357
360
|
Item.prototype,
|
|
358
|
-
"
|
|
361
|
+
"canBeSold",
|
|
359
362
|
{
|
|
360
363
|
get = function(self)
|
|
361
|
-
return
|
|
364
|
+
return isItemPawnable(self.handle)
|
|
362
365
|
end,
|
|
363
|
-
set = function(self,
|
|
364
|
-
|
|
366
|
+
set = function(self, canBeSold)
|
|
367
|
+
setItemPawnable(self.handle, canBeSold)
|
|
365
368
|
end
|
|
366
369
|
},
|
|
367
370
|
true
|
|
368
371
|
)
|
|
369
372
|
__TS__SetDescriptor(
|
|
370
373
|
Item.prototype,
|
|
371
|
-
"
|
|
374
|
+
"perishes",
|
|
372
375
|
{
|
|
373
376
|
get = function(self)
|
|
374
377
|
return getItemBooleanField(self.handle, ITEM_BF_PERISHABLE)
|
|
375
378
|
end,
|
|
376
|
-
set = function(self,
|
|
377
|
-
|
|
379
|
+
set = function(self, perishes)
|
|
380
|
+
local handle = self.handle
|
|
381
|
+
local powerUp = isItemPowerup(handle)
|
|
382
|
+
setItemBooleanField(handle, ITEM_BF_PERISHABLE, perishes)
|
|
383
|
+
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, powerUp)
|
|
378
384
|
end
|
|
379
385
|
},
|
|
380
386
|
true
|
|
381
387
|
)
|
|
382
388
|
__TS__SetDescriptor(
|
|
383
389
|
Item.prototype,
|
|
384
|
-
"
|
|
390
|
+
"isPowerUp",
|
|
385
391
|
{
|
|
386
392
|
get = function(self)
|
|
387
393
|
return isItemPowerup(self.handle)
|
|
388
394
|
end,
|
|
389
|
-
set = function(self,
|
|
390
|
-
setItemBooleanField(self.handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED,
|
|
395
|
+
set = function(self, isPowerUp)
|
|
396
|
+
setItemBooleanField(self.handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, isPowerUp)
|
|
391
397
|
end
|
|
392
398
|
},
|
|
393
399
|
true
|
|
@@ -423,16 +429,24 @@ __TS__SetDescriptor(
|
|
|
423
429
|
)
|
|
424
430
|
__TS__SetDescriptor(
|
|
425
431
|
Item.prototype,
|
|
426
|
-
"
|
|
432
|
+
"isActivelyUsed",
|
|
427
433
|
{
|
|
428
434
|
get = function(self)
|
|
429
435
|
return getItemBooleanField(self.handle, ITEM_BF_ACTIVELY_USED)
|
|
430
436
|
end,
|
|
431
|
-
set = function(self,
|
|
437
|
+
set = function(self, isActivelyUsed)
|
|
432
438
|
local handle = self.handle
|
|
433
|
-
local
|
|
434
|
-
|
|
435
|
-
|
|
439
|
+
local powerUp = isItemPowerup(handle)
|
|
440
|
+
local perishes = getItemBooleanField(handle, ITEM_BF_PERISHABLE)
|
|
441
|
+
local dropsOnDeath = getItemBooleanField(handle, ITEM_BF_DROPPED_WHEN_CARRIER_DIES)
|
|
442
|
+
local canBeDropped = getItemBooleanField(handle, ITEM_BF_CAN_BE_DROPPED)
|
|
443
|
+
local canBeSold = isItemPawnable(handle)
|
|
444
|
+
setItemBooleanField(handle, ITEM_BF_ACTIVELY_USED, isActivelyUsed)
|
|
445
|
+
setItemPawnable(handle, canBeSold)
|
|
446
|
+
setItemDroppable(handle, canBeDropped)
|
|
447
|
+
setItemDropOnDeath(handle, dropsOnDeath)
|
|
448
|
+
setItemBooleanField(handle, ITEM_BF_PERISHABLE, perishes)
|
|
449
|
+
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, powerUp)
|
|
436
450
|
end
|
|
437
451
|
},
|
|
438
452
|
true
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local getLocalClientWidth = BlzGetLocalClientWidth
|
|
3
|
+
local getLocalClientHeight = BlzGetLocalClientHeight
|
|
4
|
+
---
|
|
5
|
+
-- @internal For use by internal systems only.
|
|
6
|
+
____exports.getFrameMinXMaxX = function()
|
|
7
|
+
local w = getLocalClientWidth()
|
|
8
|
+
local h = getLocalClientHeight()
|
|
9
|
+
local width4by3 = (w - h / 600 * 800) / 2
|
|
10
|
+
local pxtodpi = 0.6 / h
|
|
11
|
+
local minX = -width4by3 * pxtodpi
|
|
12
|
+
local maxX = minX + w * pxtodpi
|
|
13
|
+
return minX, maxX
|
|
14
|
+
end
|
|
15
|
+
---
|
|
16
|
+
-- @internal For use by internal systems only.
|
|
17
|
+
____exports.FRAME_MIN_Y = 0
|
|
18
|
+
---
|
|
19
|
+
-- @internal For use by internal systems only.
|
|
20
|
+
____exports.FRAME_MAX_Y = 0.6
|
|
21
|
+
return ____exports
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local getLocationZ = GetLocationZ
|
|
3
|
+
local moveLocation = MoveLocation
|
|
4
|
+
local location = Location(0, 0)
|
|
5
|
+
---
|
|
6
|
+
-- @internal For use by internal systems only.
|
|
7
|
+
____exports.getTerrainZ = function(x, y)
|
|
8
|
+
moveLocation(location, x, y)
|
|
9
|
+
return getLocationZ(location)
|
|
10
|
+
end
|
|
11
|
+
return ____exports
|
|
@@ -133,55 +133,55 @@ declare module "../unit" {
|
|
|
133
133
|
}
|
|
134
134
|
declare module "../unit" {
|
|
135
135
|
namespace Unit {
|
|
136
|
-
const
|
|
136
|
+
const abilityChannelingFinishEvent: DispatchingEvent<[Unit, Ability]>;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
declare module "../unit" {
|
|
140
140
|
namespace Unit {
|
|
141
|
-
const
|
|
141
|
+
const abilityStopEvent: DispatchingEvent<[Unit, Ability]>;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
declare module "../unit" {
|
|
145
145
|
namespace Unit {
|
|
146
|
-
const
|
|
146
|
+
const abilityCommandEvent: {
|
|
147
|
+
readonly [abilityTypeId: number]: {
|
|
148
|
+
readonly [orderTypeStringId: string]: Event<[Unit, Ability, string]>;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
147
151
|
}
|
|
148
152
|
}
|
|
149
153
|
declare module "../unit" {
|
|
150
154
|
namespace Unit {
|
|
151
|
-
const
|
|
155
|
+
const abilityImpactEvent: DispatchingEvent<[Unit, Ability]>;
|
|
152
156
|
}
|
|
153
157
|
}
|
|
154
158
|
declare module "../unit" {
|
|
155
159
|
namespace Unit {
|
|
156
|
-
const
|
|
160
|
+
const abilityWidgetTargetImpactEvent: DispatchingEvent<[Unit, Ability, Widget]>;
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
163
|
declare module "../unit" {
|
|
160
164
|
namespace Unit {
|
|
161
|
-
const
|
|
165
|
+
const abilityUnitTargetImpactEvent: DispatchingEvent<[Unit, Ability, Unit]>;
|
|
162
166
|
}
|
|
163
167
|
}
|
|
164
168
|
declare module "../unit" {
|
|
165
169
|
namespace Unit {
|
|
166
|
-
const
|
|
170
|
+
const abilityItemTargetImpactEvent: DispatchingEvent<[Unit, Ability, Item]>;
|
|
167
171
|
}
|
|
168
172
|
}
|
|
169
173
|
declare module "../unit" {
|
|
170
174
|
namespace Unit {
|
|
171
|
-
const
|
|
175
|
+
const abilityDestructibleTargetImpactEvent: DispatchingEvent<[Unit, Ability, Destructable]>;
|
|
172
176
|
}
|
|
173
177
|
}
|
|
174
178
|
declare module "../unit" {
|
|
175
179
|
namespace Unit {
|
|
176
|
-
const
|
|
180
|
+
const abilityPointTargetImpactEvent: DispatchingEvent<[Unit, Ability, number, number]>;
|
|
177
181
|
}
|
|
178
182
|
}
|
|
179
183
|
declare module "../unit" {
|
|
180
184
|
namespace Unit {
|
|
181
|
-
const
|
|
182
|
-
readonly [abilityTypeId: number]: {
|
|
183
|
-
readonly [orderTypeStringId: string]: Event<[Unit, Ability, string]>;
|
|
184
|
-
};
|
|
185
|
-
};
|
|
185
|
+
const abilityNoTargetImpactEvent: DispatchingEvent<[Unit, Ability]>;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
@@ -22,7 +22,12 @@ local checkNotNull = ____preconditions.checkNotNull
|
|
|
22
22
|
local ____lazy = require("utility.lazy")
|
|
23
23
|
local lazyRecord = ____lazy.lazyRecord
|
|
24
24
|
local ____timer = require("core.types.timer")
|
|
25
|
+
local consumeZeroTimerCallback = ____timer.consumeZeroTimerCallback
|
|
25
26
|
local Timer = ____timer.Timer
|
|
27
|
+
local ____lua_2Dsets = require("utility.lua-sets")
|
|
28
|
+
local luaSetOf = ____lua_2Dsets.luaSetOf
|
|
29
|
+
local ____attributes = require("attributes")
|
|
30
|
+
local attribute = ____attributes.attribute
|
|
26
31
|
local eventInvoke = Event.invoke
|
|
27
32
|
local condition = Condition
|
|
28
33
|
local createTrigger = CreateTrigger
|
|
@@ -347,10 +352,65 @@ rawset(
|
|
|
347
352
|
extractAbilityTypeId
|
|
348
353
|
)
|
|
349
354
|
)
|
|
355
|
+
local internalAbilityChannelingFinishEvent = __TS__New(UnitTriggerEvent, EVENT_PLAYER_UNIT_SPELL_FINISH, collectUnitAbilityEventParameters)
|
|
356
|
+
rawset(
|
|
357
|
+
Unit,
|
|
358
|
+
"abilityChannelingFinishEvent",
|
|
359
|
+
createDispatchingEvent(internalAbilityChannelingFinishEvent, extractAbilityTypeId)
|
|
360
|
+
)
|
|
361
|
+
local internalAbilityStopEvent = __TS__New(UnitTriggerEvent, EVENT_PLAYER_UNIT_SPELL_ENDCAST, collectUnitAbilityEventParameters)
|
|
362
|
+
rawset(
|
|
363
|
+
Unit,
|
|
364
|
+
"abilityStopEvent",
|
|
365
|
+
createDispatchingEvent(internalAbilityStopEvent, extractAbilityTypeId)
|
|
366
|
+
)
|
|
367
|
+
rawset(
|
|
368
|
+
Unit,
|
|
369
|
+
"abilityCommandEvent",
|
|
370
|
+
lazyRecord(function(abilityTypeId)
|
|
371
|
+
return lazyRecord(function(orderTypeStringId)
|
|
372
|
+
return __TS__New(
|
|
373
|
+
InitializingEvent,
|
|
374
|
+
function(event)
|
|
375
|
+
local trigger = createTrigger()
|
|
376
|
+
triggerRegisterCommandEvent(trigger, abilityTypeId, orderTypeStringId)
|
|
377
|
+
triggerAddCondition(
|
|
378
|
+
trigger,
|
|
379
|
+
condition(function()
|
|
380
|
+
local unit = Unit:of(getTriggerUnit())
|
|
381
|
+
if unit ~= nil then
|
|
382
|
+
local ability = unit:getAbility(abilityTypeId)
|
|
383
|
+
if ability ~= nil then
|
|
384
|
+
eventInvoke(event, unit, ability, orderTypeStringId)
|
|
385
|
+
end
|
|
386
|
+
end
|
|
387
|
+
end)
|
|
388
|
+
)
|
|
389
|
+
end
|
|
390
|
+
)
|
|
391
|
+
end)
|
|
392
|
+
end)
|
|
393
|
+
)
|
|
350
394
|
local internalAbilityImpactEvent = __TS__New(Event)
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
395
|
+
local impactCallbackIdAttribute = attribute()
|
|
396
|
+
local function invokeImpactEvent(unit, ability, ...)
|
|
397
|
+
ability[impactCallbackIdAttribute] = nil
|
|
398
|
+
eventInvoke(internalAbilityImpactEvent, unit, ability, ...)
|
|
399
|
+
end
|
|
400
|
+
internalAbilityChannelingStartEvent:addListener(
|
|
401
|
+
999999,
|
|
402
|
+
function(unit, ability, ...)
|
|
403
|
+
ability[impactCallbackIdAttribute] = Timer:run(invokeImpactEvent, unit, ability, ...)
|
|
404
|
+
end
|
|
405
|
+
)
|
|
406
|
+
local function consumeImpactCallback(_, ability)
|
|
407
|
+
local impactCallbackId = ability[impactCallbackIdAttribute]
|
|
408
|
+
if impactCallbackId ~= nil then
|
|
409
|
+
consumeZeroTimerCallback(impactCallbackId)
|
|
410
|
+
end
|
|
411
|
+
end
|
|
412
|
+
internalAbilityChannelingFinishEvent:addListener(999999, consumeImpactCallback)
|
|
413
|
+
internalAbilityStopEvent:addListener(999999, consumeImpactCallback)
|
|
354
414
|
rawset(
|
|
355
415
|
Unit,
|
|
356
416
|
"abilityImpactEvent",
|
|
@@ -407,47 +467,14 @@ rawset(
|
|
|
407
467
|
extractAbilityTypeId
|
|
408
468
|
)
|
|
409
469
|
)
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
Unit,
|
|
420
|
-
"abilityStopEvent",
|
|
421
|
-
createDispatchingEvent(
|
|
422
|
-
__TS__New(UnitTriggerEvent, EVENT_PLAYER_UNIT_SPELL_ENDCAST, collectUnitAbilityEventParameters),
|
|
423
|
-
extractAbilityTypeId
|
|
424
|
-
)
|
|
425
|
-
)
|
|
426
|
-
rawset(
|
|
427
|
-
Unit,
|
|
428
|
-
"abilityCommandEvent",
|
|
429
|
-
lazyRecord(function(abilityTypeId)
|
|
430
|
-
return lazyRecord(function(orderTypeStringId)
|
|
431
|
-
return __TS__New(
|
|
432
|
-
InitializingEvent,
|
|
433
|
-
function(event)
|
|
434
|
-
local trigger = createTrigger()
|
|
435
|
-
triggerRegisterCommandEvent(trigger, abilityTypeId, orderTypeStringId)
|
|
436
|
-
triggerAddCondition(
|
|
437
|
-
trigger,
|
|
438
|
-
condition(function()
|
|
439
|
-
local unit = Unit:of(getTriggerUnit())
|
|
440
|
-
if unit ~= nil then
|
|
441
|
-
local ability = unit:getAbilityById(abilityTypeId)
|
|
442
|
-
if ability ~= nil then
|
|
443
|
-
eventInvoke(event, unit, ability, orderTypeStringId)
|
|
444
|
-
end
|
|
445
|
-
end
|
|
446
|
-
end)
|
|
447
|
-
)
|
|
448
|
-
end
|
|
449
|
-
)
|
|
450
|
-
end)
|
|
451
|
-
end)
|
|
470
|
+
local spellEffectOnlyAbilityTypeIds = luaSetOf(fourCC("AAns"))
|
|
471
|
+
internalAbilityChannelingStartEvent:addListener(
|
|
472
|
+
-999999,
|
|
473
|
+
function(unit, ability)
|
|
474
|
+
if spellEffectOnlyAbilityTypeIds[ability.parentTypeId] ~= nil then
|
|
475
|
+
eventInvoke(internalAbilityChannelingFinishEvent, unit, ability)
|
|
476
|
+
eventInvoke(internalAbilityStopEvent, unit, ability)
|
|
477
|
+
end
|
|
478
|
+
end
|
|
452
479
|
)
|
|
453
480
|
return ____exports
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local ____unit = require("engine.internal.unit")
|
|
5
|
+
local Unit = ____unit.Unit
|
|
6
|
+
local ____unit = require("engine.standard.fields.unit")
|
|
7
|
+
local FLY_HEIGHT_UNIT_FLOAT_FIELD = ____unit.FLY_HEIGHT_UNIT_FLOAT_FIELD
|
|
8
|
+
__TS__ObjectDefineProperty(
|
|
9
|
+
Unit.prototype,
|
|
10
|
+
"flyHeight",
|
|
11
|
+
{
|
|
12
|
+
get = function(self)
|
|
13
|
+
return FLY_HEIGHT_UNIT_FLOAT_FIELD:getValue(self)
|
|
14
|
+
end,
|
|
15
|
+
set = function(self, value)
|
|
16
|
+
FLY_HEIGHT_UNIT_FLOAT_FIELD:setValue(self, value)
|
|
17
|
+
end
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
return ____exports
|