warcraft-3-w3ts-utils 0.1.7 → 0.1.9

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.
Files changed (83) hide show
  1. package/dist/index.lua +13 -0
  2. package/dist/lua_modules/w3ts/globals/index.lua +23 -0
  3. package/dist/lua_modules/w3ts/globals/order.lua +2 -0
  4. package/dist/lua_modules/w3ts/handles/camera.lua +348 -0
  5. package/dist/lua_modules/w3ts/handles/destructable.lua +237 -0
  6. package/dist/lua_modules/w3ts/handles/dialog.lua +161 -0
  7. package/dist/lua_modules/w3ts/handles/effect.lua +198 -0
  8. package/dist/lua_modules/w3ts/handles/fogmodifier.lua +76 -0
  9. package/dist/lua_modules/w3ts/handles/force.lua +105 -0
  10. package/dist/lua_modules/w3ts/handles/frame.lua +417 -0
  11. package/dist/lua_modules/w3ts/handles/gamecache.lua +132 -0
  12. package/dist/lua_modules/w3ts/handles/group.lua +215 -0
  13. package/dist/lua_modules/w3ts/handles/handle.lua +38 -0
  14. package/dist/lua_modules/w3ts/handles/image.lua +105 -0
  15. package/dist/lua_modules/w3ts/handles/index.lua +226 -0
  16. package/dist/lua_modules/w3ts/handles/item.lua +375 -0
  17. package/dist/lua_modules/w3ts/handles/leaderboard.lua +211 -0
  18. package/dist/lua_modules/w3ts/handles/multiboard.lua +193 -0
  19. package/dist/lua_modules/w3ts/handles/player.lua +311 -0
  20. package/dist/lua_modules/w3ts/handles/point.lua +80 -0
  21. package/dist/lua_modules/w3ts/handles/quest.lua +176 -0
  22. package/dist/lua_modules/w3ts/handles/rect.lua +129 -0
  23. package/dist/lua_modules/w3ts/handles/region.lua +72 -0
  24. package/dist/lua_modules/w3ts/handles/sound.lua +174 -0
  25. package/dist/lua_modules/w3ts/handles/texttag.lua +97 -0
  26. package/dist/lua_modules/w3ts/handles/timer.lua +83 -0
  27. package/dist/lua_modules/w3ts/handles/timerdialog.lua +86 -0
  28. package/dist/lua_modules/w3ts/handles/trigger.lua +265 -0
  29. package/dist/lua_modules/w3ts/handles/ubersplat.lua +84 -0
  30. package/dist/lua_modules/w3ts/handles/unit.lua +1330 -0
  31. package/dist/lua_modules/w3ts/handles/weathereffect.lua +42 -0
  32. package/dist/lua_modules/w3ts/handles/widget.lua +53 -0
  33. package/dist/lua_modules/w3ts/hooks/index.lua +52 -0
  34. package/dist/lua_modules/w3ts/index.lua +36 -0
  35. package/dist/lua_modules/w3ts/system/base64.lua +108 -0
  36. package/dist/lua_modules/w3ts/system/binaryreader.lua +74 -0
  37. package/dist/lua_modules/w3ts/system/binarywriter.lua +88 -0
  38. package/dist/lua_modules/w3ts/system/file.lua +88 -0
  39. package/dist/lua_modules/w3ts/system/gametime.lua +27 -0
  40. package/dist/lua_modules/w3ts/system/host.lua +104 -0
  41. package/dist/lua_modules/w3ts/system/index.lua +58 -0
  42. package/dist/lua_modules/w3ts/system/sync.lua +239 -0
  43. package/dist/lua_modules/w3ts/utils/color.lua +189 -0
  44. package/dist/lua_modules/w3ts/utils/index.lua +38 -0
  45. package/dist/lualib_bundle.lua +2733 -0
  46. package/dist/package.json +41 -0
  47. package/dist/utils/abilities.lua +107 -0
  48. package/dist/utils/camera.lua +46 -0
  49. package/dist/utils/chat-command.lua +30 -0
  50. package/dist/utils/color.lua +41 -0
  51. package/dist/utils/index.lua +125 -0
  52. package/dist/utils/item.d.ts +14 -1
  53. package/dist/utils/item.lua +179 -0
  54. package/dist/utils/math.lua +17 -0
  55. package/dist/utils/minimapIcons.lua +28 -0
  56. package/dist/utils/misc.lua +143 -0
  57. package/dist/utils/physics.lua +161 -0
  58. package/dist/utils/players.d.ts +0 -1
  59. package/dist/utils/players.lua +233 -0
  60. package/dist/utils/point.lua +60 -0
  61. package/dist/utils/quests.lua +47 -0
  62. package/dist/utils/textTag.lua +110 -0
  63. package/dist/utils/timer.lua +21 -0
  64. package/dist/utils/units.lua +102 -0
  65. package/package.json +4 -6
  66. package/dist/index.js +0 -18
  67. package/dist/utils/abilities.js +0 -125
  68. package/dist/utils/camera.js +0 -37
  69. package/dist/utils/chat-command.js +0 -22
  70. package/dist/utils/color.js +0 -141
  71. package/dist/utils/index.js +0 -32
  72. package/dist/utils/item.js +0 -124
  73. package/dist/utils/math.js +0 -17
  74. package/dist/utils/minimapIcons.js +0 -27
  75. package/dist/utils/misc.js +0 -175
  76. package/dist/utils/physics.js +0 -194
  77. package/dist/utils/players.js +0 -189
  78. package/dist/utils/point.js +0 -74
  79. package/dist/utils/quests.js +0 -30
  80. package/dist/utils/textTag.js +0 -72
  81. package/dist/utils/timer.js +0 -16
  82. package/dist/utils/units.js +0 -81
  83. package/tsconfig.json +0 -40
@@ -0,0 +1,1330 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__Class = ____lualib.__TS__Class
3
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
+ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
5
+ local __TS__ObjectAssign = ____lualib.__TS__ObjectAssign
6
+ local __TS__StringSubstr = ____lualib.__TS__StringSubstr
7
+ local ____exports = {}
8
+ local ____destructable = require("lua_modules.w3ts.handles.destructable")
9
+ local Destructable = ____destructable.Destructable
10
+ local ____handle = require("lua_modules.w3ts.handles.handle")
11
+ local Handle = ____handle.Handle
12
+ local ____item = require("lua_modules.w3ts.handles.item")
13
+ local Item = ____item.Item
14
+ local ____player = require("lua_modules.w3ts.handles.player")
15
+ local MapPlayer = ____player.MapPlayer
16
+ local ____point = require("lua_modules.w3ts.handles.point")
17
+ local Point = ____point.Point
18
+ local ____widget = require("lua_modules.w3ts.handles.widget")
19
+ local Widget = ____widget.Widget
20
+ ____exports.Unit = __TS__Class()
21
+ local Unit = ____exports.Unit
22
+ Unit.name = "Unit"
23
+ __TS__ClassExtends(Unit, Widget)
24
+ function Unit.prototype.____constructor(self, owner, unitId, x, y, face, skinId)
25
+ if Handle:initFromHandle() == true then
26
+ Widget.prototype.____constructor(self)
27
+ return
28
+ end
29
+ if face == nil then
30
+ face = bj_UNIT_FACING
31
+ end
32
+ local ____temp_0
33
+ if skinId == nil then
34
+ ____temp_0 = CreateUnit(
35
+ owner.handle,
36
+ unitId,
37
+ x,
38
+ y,
39
+ face
40
+ )
41
+ else
42
+ ____temp_0 = BlzCreateUnitWithSkin(
43
+ owner.handle,
44
+ unitId,
45
+ x,
46
+ y,
47
+ face,
48
+ skinId
49
+ )
50
+ end
51
+ local handle = ____temp_0
52
+ if handle == nil then
53
+ error("w3ts failed to create unit handle.", 3)
54
+ end
55
+ Widget.prototype.____constructor(self, handle)
56
+ end
57
+ __TS__SetDescriptor(
58
+ Unit.prototype,
59
+ "acquireRange",
60
+ {
61
+ get = function(self)
62
+ return GetUnitAcquireRange(self.handle)
63
+ end,
64
+ set = function(self, value)
65
+ SetUnitAcquireRange(self.handle, value)
66
+ end
67
+ },
68
+ true
69
+ )
70
+ __TS__SetDescriptor(
71
+ Unit.prototype,
72
+ "agility",
73
+ {
74
+ get = function(self)
75
+ return GetHeroAgi(self.handle, false)
76
+ end,
77
+ set = function(self, value)
78
+ SetHeroAgi(self.handle, value, true)
79
+ end
80
+ },
81
+ true
82
+ )
83
+ __TS__SetDescriptor(
84
+ Unit.prototype,
85
+ "armor",
86
+ {
87
+ get = function(self)
88
+ return BlzGetUnitArmor(self.handle)
89
+ end,
90
+ set = function(self, armorAmount)
91
+ BlzSetUnitArmor(self.handle, armorAmount)
92
+ end
93
+ },
94
+ true
95
+ )
96
+ __TS__SetDescriptor(
97
+ Unit.prototype,
98
+ "canSleep",
99
+ {
100
+ get = function(self)
101
+ return UnitCanSleep(self.handle)
102
+ end,
103
+ set = function(self, flag)
104
+ UnitAddSleep(self.handle, flag)
105
+ end
106
+ },
107
+ true
108
+ )
109
+ __TS__SetDescriptor(
110
+ Unit.prototype,
111
+ "collisionSize",
112
+ {get = function(self)
113
+ return BlzGetUnitCollisionSize(self.handle)
114
+ end},
115
+ true
116
+ )
117
+ __TS__SetDescriptor(
118
+ Unit.prototype,
119
+ "color",
120
+ {set = function(self, whichColor)
121
+ SetUnitColor(self.handle, whichColor)
122
+ end},
123
+ true
124
+ )
125
+ __TS__SetDescriptor(
126
+ Unit.prototype,
127
+ "currentOrder",
128
+ {get = function(self)
129
+ return GetUnitCurrentOrder(self.handle)
130
+ end},
131
+ true
132
+ )
133
+ __TS__SetDescriptor(
134
+ Unit.prototype,
135
+ "defaultAcquireRange",
136
+ {get = function(self)
137
+ return GetUnitDefaultAcquireRange(self.handle)
138
+ end},
139
+ true
140
+ )
141
+ __TS__SetDescriptor(
142
+ Unit.prototype,
143
+ "defaultFlyHeight",
144
+ {get = function(self)
145
+ return GetUnitDefaultFlyHeight(self.handle)
146
+ end},
147
+ true
148
+ )
149
+ __TS__SetDescriptor(
150
+ Unit.prototype,
151
+ "defaultMoveSpeed",
152
+ {get = function(self)
153
+ return GetUnitDefaultMoveSpeed(self.handle)
154
+ end},
155
+ true
156
+ )
157
+ __TS__SetDescriptor(
158
+ Unit.prototype,
159
+ "defaultPropWindow",
160
+ {get = function(self)
161
+ return GetUnitDefaultPropWindow(self.handle)
162
+ end},
163
+ true
164
+ )
165
+ __TS__SetDescriptor(
166
+ Unit.prototype,
167
+ "defaultTurnSpeed",
168
+ {get = function(self)
169
+ return GetUnitDefaultTurnSpeed(self.handle)
170
+ end},
171
+ true
172
+ )
173
+ __TS__SetDescriptor(
174
+ Unit.prototype,
175
+ "experience",
176
+ {
177
+ get = function(self)
178
+ return GetHeroXP(self.handle)
179
+ end,
180
+ set = function(self, newXpVal)
181
+ SetHeroXP(self.handle, newXpVal, true)
182
+ end
183
+ },
184
+ true
185
+ )
186
+ __TS__SetDescriptor(
187
+ Unit.prototype,
188
+ "facing",
189
+ {
190
+ get = function(self)
191
+ return GetUnitFacing(self.handle)
192
+ end,
193
+ set = function(self, value)
194
+ SetUnitFacing(self.handle, value)
195
+ end
196
+ },
197
+ true
198
+ )
199
+ __TS__SetDescriptor(
200
+ Unit.prototype,
201
+ "foodMade",
202
+ {get = function(self)
203
+ return GetUnitFoodMade(self.handle)
204
+ end},
205
+ true
206
+ )
207
+ __TS__SetDescriptor(
208
+ Unit.prototype,
209
+ "foodUsed",
210
+ {get = function(self)
211
+ return GetUnitFoodUsed(self.handle)
212
+ end},
213
+ true
214
+ )
215
+ __TS__SetDescriptor(
216
+ Unit.prototype,
217
+ "ignoreAlarmToggled",
218
+ {get = function(self)
219
+ return UnitIgnoreAlarmToggled(self.handle)
220
+ end},
221
+ true
222
+ )
223
+ __TS__SetDescriptor(
224
+ Unit.prototype,
225
+ "intelligence",
226
+ {
227
+ get = function(self)
228
+ return GetHeroInt(self.handle, false)
229
+ end,
230
+ set = function(self, value)
231
+ SetHeroInt(self.handle, value, true)
232
+ end
233
+ },
234
+ true
235
+ )
236
+ __TS__SetDescriptor(
237
+ Unit.prototype,
238
+ "inventorySize",
239
+ {get = function(self)
240
+ return UnitInventorySize(self.handle)
241
+ end},
242
+ true
243
+ )
244
+ __TS__SetDescriptor(
245
+ Unit.prototype,
246
+ "invulnerable",
247
+ {
248
+ get = function(self)
249
+ return BlzIsUnitInvulnerable(self.handle)
250
+ end,
251
+ set = function(self, flag)
252
+ SetUnitInvulnerable(self.handle, flag)
253
+ end
254
+ },
255
+ true
256
+ )
257
+ __TS__SetDescriptor(
258
+ Unit.prototype,
259
+ "level",
260
+ {get = function(self)
261
+ return GetUnitLevel(self.handle)
262
+ end},
263
+ true
264
+ )
265
+ __TS__SetDescriptor(
266
+ Unit.prototype,
267
+ "localZ",
268
+ {get = function(self)
269
+ return BlzGetLocalUnitZ(self.handle)
270
+ end},
271
+ true
272
+ )
273
+ __TS__SetDescriptor(
274
+ Unit.prototype,
275
+ "mana",
276
+ {
277
+ get = function(self)
278
+ return self:getState(UNIT_STATE_MANA)
279
+ end,
280
+ set = function(self, value)
281
+ self:setState(UNIT_STATE_MANA, value)
282
+ end
283
+ },
284
+ true
285
+ )
286
+ __TS__SetDescriptor(
287
+ Unit.prototype,
288
+ "maxLife",
289
+ {
290
+ get = function(self)
291
+ return BlzGetUnitMaxHP(self.handle)
292
+ end,
293
+ set = function(self, value)
294
+ BlzSetUnitMaxHP(self.handle, value)
295
+ end
296
+ },
297
+ true
298
+ )
299
+ __TS__SetDescriptor(
300
+ Unit.prototype,
301
+ "maxMana",
302
+ {
303
+ get = function(self)
304
+ return BlzGetUnitMaxMana(self.handle)
305
+ end,
306
+ set = function(self, value)
307
+ BlzSetUnitMaxMana(self.handle, value)
308
+ end
309
+ },
310
+ true
311
+ )
312
+ __TS__SetDescriptor(
313
+ Unit.prototype,
314
+ "moveSpeed",
315
+ {
316
+ get = function(self)
317
+ return GetUnitMoveSpeed(self.handle)
318
+ end,
319
+ set = function(self, value)
320
+ SetUnitMoveSpeed(self.handle, value)
321
+ end
322
+ },
323
+ true
324
+ )
325
+ __TS__SetDescriptor(
326
+ Unit.prototype,
327
+ "name",
328
+ {
329
+ get = function(self)
330
+ return GetUnitName(self.handle) or ""
331
+ end,
332
+ set = function(self, value)
333
+ BlzSetUnitName(self.handle, value)
334
+ end
335
+ },
336
+ true
337
+ )
338
+ __TS__SetDescriptor(
339
+ Unit.prototype,
340
+ "nameProper",
341
+ {
342
+ get = function(self)
343
+ return GetHeroProperName(self.handle) or ""
344
+ end,
345
+ set = function(self, value)
346
+ BlzSetHeroProperName(self.handle, value)
347
+ end
348
+ },
349
+ true
350
+ )
351
+ __TS__SetDescriptor(
352
+ Unit.prototype,
353
+ "owner",
354
+ {
355
+ get = function(self)
356
+ return MapPlayer:fromHandle(GetOwningPlayer(self.handle))
357
+ end,
358
+ set = function(self, whichPlayer)
359
+ SetUnitOwner(self.handle, whichPlayer.handle, true)
360
+ end
361
+ },
362
+ true
363
+ )
364
+ __TS__SetDescriptor(
365
+ Unit.prototype,
366
+ "paused",
367
+ {
368
+ get = function(self)
369
+ return IsUnitPaused(self.handle)
370
+ end,
371
+ set = function(self, flag)
372
+ PauseUnit(self.handle, flag)
373
+ end
374
+ },
375
+ true
376
+ )
377
+ __TS__SetDescriptor(
378
+ Unit.prototype,
379
+ "point",
380
+ {
381
+ get = function(self)
382
+ return Point:fromHandle(GetUnitLoc(self.handle))
383
+ end,
384
+ set = function(self, whichPoint)
385
+ SetUnitPositionLoc(self.handle, whichPoint.handle)
386
+ end
387
+ },
388
+ true
389
+ )
390
+ __TS__SetDescriptor(
391
+ Unit.prototype,
392
+ "pointValue",
393
+ {get = function(self)
394
+ return GetUnitPointValue(self.handle)
395
+ end},
396
+ true
397
+ )
398
+ __TS__SetDescriptor(
399
+ Unit.prototype,
400
+ "propWindow",
401
+ {
402
+ get = function(self)
403
+ return GetUnitPropWindow(self.handle)
404
+ end,
405
+ set = function(self, newPropWindowAngle)
406
+ SetUnitPropWindow(self.handle, newPropWindowAngle)
407
+ end
408
+ },
409
+ true
410
+ )
411
+ __TS__SetDescriptor(
412
+ Unit.prototype,
413
+ "race",
414
+ {get = function(self)
415
+ return GetUnitRace(self.handle)
416
+ end},
417
+ true
418
+ )
419
+ __TS__SetDescriptor(
420
+ Unit.prototype,
421
+ "rallyDestructable",
422
+ {get = function(self)
423
+ return Destructable:fromHandle(GetUnitRallyDestructable(self.handle))
424
+ end},
425
+ true
426
+ )
427
+ __TS__SetDescriptor(
428
+ Unit.prototype,
429
+ "rallyPoint",
430
+ {get = function(self)
431
+ return Point:fromHandle(GetUnitRallyPoint(self.handle))
432
+ end},
433
+ true
434
+ )
435
+ __TS__SetDescriptor(
436
+ Unit.prototype,
437
+ "rallyUnit",
438
+ {get = function(self)
439
+ return ____exports.Unit:fromHandle(GetUnitRallyUnit(self.handle))
440
+ end},
441
+ true
442
+ )
443
+ __TS__SetDescriptor(
444
+ Unit.prototype,
445
+ "resourceAmount",
446
+ {
447
+ get = function(self)
448
+ return GetResourceAmount(self.handle)
449
+ end,
450
+ set = function(self, amount)
451
+ SetResourceAmount(self.handle, amount)
452
+ end
453
+ },
454
+ true
455
+ )
456
+ __TS__SetDescriptor(
457
+ Unit.prototype,
458
+ "selectable",
459
+ {get = function(self)
460
+ return BlzIsUnitSelectable(self.handle)
461
+ end},
462
+ true
463
+ )
464
+ __TS__SetDescriptor(
465
+ Unit.prototype,
466
+ "selectionScale",
467
+ {
468
+ get = function(self)
469
+ local result = self:getField(UNIT_RF_SELECTION_SCALE)
470
+ return type(result) == "number" and result or 0
471
+ end,
472
+ set = function(self, scale)
473
+ self:setField(UNIT_RF_SELECTION_SCALE, scale)
474
+ end
475
+ },
476
+ true
477
+ )
478
+ __TS__SetDescriptor(
479
+ Unit.prototype,
480
+ "show",
481
+ {
482
+ get = function(self)
483
+ return not IsUnitHidden(self.handle)
484
+ end,
485
+ set = function(self, flag)
486
+ ShowUnit(self.handle, flag)
487
+ end
488
+ },
489
+ true
490
+ )
491
+ __TS__SetDescriptor(
492
+ Unit.prototype,
493
+ "skin",
494
+ {
495
+ get = function(self)
496
+ return BlzGetUnitSkin(self.handle)
497
+ end,
498
+ set = function(self, skinId)
499
+ BlzSetUnitSkin(self.handle, skinId)
500
+ end
501
+ },
502
+ true
503
+ )
504
+ __TS__SetDescriptor(
505
+ Unit.prototype,
506
+ "skillPoints",
507
+ {
508
+ get = function(self)
509
+ return GetHeroSkillPoints(self.handle)
510
+ end,
511
+ set = function(self, skillPointDelta)
512
+ UnitModifySkillPoints(self.handle, skillPointDelta)
513
+ end
514
+ },
515
+ true
516
+ )
517
+ __TS__SetDescriptor(
518
+ Unit.prototype,
519
+ "sleeping",
520
+ {get = function(self)
521
+ return UnitIsSleeping(self.handle)
522
+ end},
523
+ true
524
+ )
525
+ __TS__SetDescriptor(
526
+ Unit.prototype,
527
+ "strength",
528
+ {
529
+ get = function(self)
530
+ return GetHeroStr(self.handle, false)
531
+ end,
532
+ set = function(self, value)
533
+ SetHeroStr(self.handle, value, true)
534
+ end
535
+ },
536
+ true
537
+ )
538
+ __TS__SetDescriptor(
539
+ Unit.prototype,
540
+ "turnSpeed",
541
+ {
542
+ get = function(self)
543
+ return GetUnitTurnSpeed(self.handle)
544
+ end,
545
+ set = function(self, value)
546
+ SetUnitTurnSpeed(self.handle, value)
547
+ end
548
+ },
549
+ true
550
+ )
551
+ __TS__SetDescriptor(
552
+ Unit.prototype,
553
+ "typeId",
554
+ {get = function(self)
555
+ return GetUnitTypeId(self.handle)
556
+ end},
557
+ true
558
+ )
559
+ __TS__SetDescriptor(
560
+ Unit.prototype,
561
+ "userData",
562
+ {
563
+ get = function(self)
564
+ return GetUnitUserData(self.handle)
565
+ end,
566
+ set = function(self, value)
567
+ SetUnitUserData(self.handle, value)
568
+ end
569
+ },
570
+ true
571
+ )
572
+ __TS__SetDescriptor(
573
+ Unit.prototype,
574
+ "waygateActive",
575
+ {
576
+ get = function(self)
577
+ return WaygateIsActive(self.handle)
578
+ end,
579
+ set = function(self, flag)
580
+ WaygateActivate(self.handle, flag)
581
+ end
582
+ },
583
+ true
584
+ )
585
+ __TS__SetDescriptor(
586
+ Unit.prototype,
587
+ "x",
588
+ {
589
+ get = function(self)
590
+ return GetUnitX(self.handle)
591
+ end,
592
+ set = function(self, value)
593
+ SetUnitX(self.handle, value)
594
+ end
595
+ },
596
+ true
597
+ )
598
+ __TS__SetDescriptor(
599
+ Unit.prototype,
600
+ "y",
601
+ {
602
+ get = function(self)
603
+ return GetUnitY(self.handle)
604
+ end,
605
+ set = function(self, value)
606
+ SetUnitY(self.handle, value)
607
+ end
608
+ },
609
+ true
610
+ )
611
+ __TS__SetDescriptor(
612
+ Unit.prototype,
613
+ "z",
614
+ {get = function(self)
615
+ return BlzGetUnitZ(self.handle)
616
+ end},
617
+ true
618
+ )
619
+ function Unit.create(self, owner, unitId, x, y, face, skinId)
620
+ if face == nil then
621
+ face = bj_UNIT_FACING
622
+ end
623
+ local ____temp_1
624
+ if skinId == nil then
625
+ ____temp_1 = CreateUnit(
626
+ owner.handle,
627
+ unitId,
628
+ x,
629
+ y,
630
+ face
631
+ )
632
+ else
633
+ ____temp_1 = BlzCreateUnitWithSkin(
634
+ owner.handle,
635
+ unitId,
636
+ x,
637
+ y,
638
+ face,
639
+ skinId
640
+ )
641
+ end
642
+ local handle = ____temp_1
643
+ if handle then
644
+ local obj = self:getObject(handle)
645
+ local values = {}
646
+ values.handle = handle
647
+ return __TS__ObjectAssign(obj, values)
648
+ end
649
+ return nil
650
+ end
651
+ function Unit.prototype.addAbility(self, abilityId)
652
+ return UnitAddAbility(self.handle, abilityId)
653
+ end
654
+ function Unit.prototype.addAnimationProps(self, animProperties, add)
655
+ AddUnitAnimationProperties(self.handle, animProperties, add)
656
+ end
657
+ function Unit.prototype.addExperience(self, xpToAdd, showEyeCandy)
658
+ AddHeroXP(self.handle, xpToAdd, showEyeCandy)
659
+ end
660
+ function Unit.prototype.addIndicator(self, red, blue, green, alpha)
661
+ UnitAddIndicator(
662
+ self.handle,
663
+ red,
664
+ blue,
665
+ green,
666
+ alpha
667
+ )
668
+ end
669
+ function Unit.prototype.addItem(self, whichItem)
670
+ return UnitAddItem(self.handle, whichItem.handle)
671
+ end
672
+ function Unit.prototype.addItemById(self, itemId)
673
+ return Item:fromHandle(UnitAddItemById(self.handle, itemId))
674
+ end
675
+ function Unit.prototype.addItemToSlotById(self, itemId, itemSlot)
676
+ return UnitAddItemToSlotById(self.handle, itemId, itemSlot)
677
+ end
678
+ function Unit.prototype.addItemToStock(self, itemId, currentStock, stockMax)
679
+ AddItemToStock(self.handle, itemId, currentStock, stockMax)
680
+ end
681
+ function Unit.prototype.addResourceAmount(self, amount)
682
+ AddResourceAmount(self.handle, amount)
683
+ end
684
+ function Unit.prototype.addSleepPerm(self, add)
685
+ UnitAddSleepPerm(self.handle, add)
686
+ end
687
+ function Unit.prototype.addType(self, whichUnitType)
688
+ return UnitAddType(self.handle, whichUnitType)
689
+ end
690
+ function Unit.prototype.addUnitToStock(self, unitId, currentStock, stockMax)
691
+ AddUnitToStock(self.handle, unitId, currentStock, stockMax)
692
+ end
693
+ function Unit.prototype.applyTimedLife(self, buffId, duration)
694
+ UnitApplyTimedLife(self.handle, buffId, duration)
695
+ end
696
+ function Unit.prototype.attachSound(self, sound)
697
+ AttachSoundToUnit(sound.handle, self.handle)
698
+ end
699
+ function Unit.prototype.cancelTimedLife(self)
700
+ BlzUnitCancelTimedLife(self.handle)
701
+ end
702
+ function Unit.prototype.canSleepPerm(self)
703
+ return UnitCanSleepPerm(self.handle)
704
+ end
705
+ function Unit.prototype.countBuffs(self, removePositive, removeNegative, magic, physical, timedLife, aura, autoDispel)
706
+ return UnitCountBuffsEx(
707
+ self.handle,
708
+ removePositive,
709
+ removeNegative,
710
+ magic,
711
+ physical,
712
+ timedLife,
713
+ aura,
714
+ autoDispel
715
+ )
716
+ end
717
+ function Unit.prototype.damageAt(self, delay, radius, x, y, amount, attack, ranged, attackType, damageType, weaponType)
718
+ return UnitDamagePoint(
719
+ self.handle,
720
+ delay,
721
+ radius,
722
+ x,
723
+ y,
724
+ amount,
725
+ attack,
726
+ ranged,
727
+ attackType,
728
+ damageType,
729
+ weaponType
730
+ )
731
+ end
732
+ function Unit.prototype.damageTarget(self, target, amount, attack, ranged, attackType, damageType, weaponType)
733
+ return UnitDamageTarget(
734
+ self.handle,
735
+ target,
736
+ amount,
737
+ attack,
738
+ ranged,
739
+ attackType,
740
+ damageType,
741
+ weaponType
742
+ )
743
+ end
744
+ function Unit.prototype.decAbilityLevel(self, abilCode)
745
+ return DecUnitAbilityLevel(self.handle, abilCode)
746
+ end
747
+ function Unit.prototype.destroy(self)
748
+ RemoveUnit(self.handle)
749
+ end
750
+ function Unit.prototype.disableAbility(self, abilId, flag, hideUI)
751
+ BlzUnitDisableAbility(self.handle, abilId, flag, hideUI)
752
+ end
753
+ function Unit.prototype.dropItem(self, whichItem, x, y)
754
+ return UnitDropItemPoint(self.handle, whichItem.handle, x, y)
755
+ end
756
+ function Unit.prototype.dropItemFromSlot(self, whichItem, slot)
757
+ return UnitDropItemSlot(self.handle, whichItem.handle, slot)
758
+ end
759
+ function Unit.prototype.dropItemTarget(self, whichItem, target)
760
+ return UnitDropItemTarget(self.handle, whichItem.handle, target.handle)
761
+ end
762
+ function Unit.prototype.endAbilityCooldown(self, abilCode)
763
+ BlzEndUnitAbilityCooldown(self.handle, abilCode)
764
+ end
765
+ function Unit.prototype.getAbility(self, abilId)
766
+ return BlzGetUnitAbility(self.handle, abilId)
767
+ end
768
+ function Unit.prototype.getAbilityByIndex(self, index)
769
+ return BlzGetUnitAbilityByIndex(self.handle, index)
770
+ end
771
+ function Unit.prototype.getAbilityCooldown(self, abilId, level)
772
+ return BlzGetUnitAbilityCooldown(self.handle, abilId, level)
773
+ end
774
+ function Unit.prototype.getAbilityCooldownRemaining(self, abilId)
775
+ return BlzGetUnitAbilityCooldownRemaining(self.handle, abilId)
776
+ end
777
+ function Unit.prototype.getAbilityLevel(self, abilCode)
778
+ return GetUnitAbilityLevel(self.handle, abilCode)
779
+ end
780
+ function Unit.prototype.getAbilityManaCost(self, abilId, level)
781
+ return BlzGetUnitAbilityManaCost(self.handle, abilId, level)
782
+ end
783
+ function Unit.prototype.getAgility(self, includeBonuses)
784
+ return GetHeroAgi(self.handle, includeBonuses)
785
+ end
786
+ function Unit.prototype.getAttackCooldown(self, weaponIndex)
787
+ return BlzGetUnitAttackCooldown(self.handle, weaponIndex)
788
+ end
789
+ function Unit.prototype.getBaseDamage(self, weaponIndex)
790
+ return BlzGetUnitBaseDamage(self.handle, weaponIndex)
791
+ end
792
+ function Unit.prototype.getDiceNumber(self, weaponIndex)
793
+ return BlzGetUnitDiceNumber(self.handle, weaponIndex)
794
+ end
795
+ function Unit.prototype.getDiceSides(self, weaponIndex)
796
+ return BlzGetUnitDiceSides(self.handle, weaponIndex)
797
+ end
798
+ function Unit.prototype.getField(self, field)
799
+ local fieldType = __TS__StringSubstr(
800
+ tostring(field),
801
+ 0,
802
+ (string.find(
803
+ tostring(field),
804
+ ":",
805
+ nil,
806
+ true
807
+ ) or 0) - 1
808
+ )
809
+ repeat
810
+ local ____switch128 = fieldType
811
+ local ____cond128 = ____switch128 == "unitbooleanfield"
812
+ if ____cond128 then
813
+ do
814
+ local fieldBool = field
815
+ return BlzGetUnitBooleanField(self.handle, fieldBool)
816
+ end
817
+ end
818
+ ____cond128 = ____cond128 or ____switch128 == "unitintegerfield"
819
+ if ____cond128 then
820
+ do
821
+ local fieldInt = field
822
+ return BlzGetUnitIntegerField(self.handle, fieldInt)
823
+ end
824
+ end
825
+ ____cond128 = ____cond128 or ____switch128 == "unitrealfield"
826
+ if ____cond128 then
827
+ do
828
+ local fieldReal = field
829
+ return BlzGetUnitRealField(self.handle, fieldReal)
830
+ end
831
+ end
832
+ ____cond128 = ____cond128 or ____switch128 == "unitstringfield"
833
+ if ____cond128 then
834
+ do
835
+ local fieldString = field
836
+ return BlzGetUnitStringField(self.handle, fieldString)
837
+ end
838
+ end
839
+ do
840
+ return 0
841
+ end
842
+ until true
843
+ end
844
+ function Unit.prototype.getflyHeight(self)
845
+ return GetUnitFlyHeight(self.handle)
846
+ end
847
+ function Unit.prototype.getHeroLevel(self)
848
+ return GetHeroLevel(self.handle)
849
+ end
850
+ function Unit.prototype.getIgnoreAlarm(self, flag)
851
+ return UnitIgnoreAlarm(self.handle, flag)
852
+ end
853
+ function Unit.prototype.getIntelligence(self, includeBonuses)
854
+ return GetHeroInt(self.handle, includeBonuses)
855
+ end
856
+ function Unit.prototype.getItemInSlot(self, slot)
857
+ return Item:fromHandle(UnitItemInSlot(self.handle, slot))
858
+ end
859
+ function Unit.prototype.getState(self, whichUnitState)
860
+ return GetUnitState(self.handle, whichUnitState)
861
+ end
862
+ function Unit.prototype.getStrength(self, includeBonuses)
863
+ return GetHeroStr(self.handle, includeBonuses)
864
+ end
865
+ function Unit.prototype.hasBuffs(self, removePositive, removeNegative, magic, physical, timedLife, aura, autoDispel)
866
+ return UnitHasBuffsEx(
867
+ self.handle,
868
+ removePositive,
869
+ removeNegative,
870
+ magic,
871
+ physical,
872
+ timedLife,
873
+ aura,
874
+ autoDispel
875
+ )
876
+ end
877
+ function Unit.prototype.hasItem(self, whichItem)
878
+ return UnitHasItem(self.handle, whichItem.handle)
879
+ end
880
+ function Unit.prototype.hideAbility(self, abilId, flag)
881
+ BlzUnitHideAbility(self.handle, abilId, flag)
882
+ end
883
+ function Unit.prototype.incAbilityLevel(self, abilCode)
884
+ return IncUnitAbilityLevel(self.handle, abilCode)
885
+ end
886
+ function Unit.prototype.inForce(self, whichForce)
887
+ return IsUnitInForce(self.handle, whichForce.handle)
888
+ end
889
+ function Unit.prototype.inGroup(self, whichGroup)
890
+ return IsUnitInGroup(self.handle, whichGroup.handle)
891
+ end
892
+ function Unit.prototype.inRange(self, x, y, distance)
893
+ return IsUnitInRangeXY(self.handle, x, y, distance)
894
+ end
895
+ function Unit.prototype.inRangeOfPoint(self, whichPoint, distance)
896
+ return IsUnitInRangeLoc(self.handle, whichPoint.handle, distance)
897
+ end
898
+ function Unit.prototype.inRangeOfUnit(self, otherUnit, distance)
899
+ return IsUnitInRange(self.handle, otherUnit.handle, distance)
900
+ end
901
+ function Unit.prototype.interruptAttack(self)
902
+ BlzUnitInterruptAttack(self.handle)
903
+ end
904
+ function Unit.prototype.inTransport(self, whichTransport)
905
+ return IsUnitInTransport(self.handle, whichTransport.handle)
906
+ end
907
+ function Unit.prototype.isAlive(self)
908
+ return UnitAlive(self.handle)
909
+ end
910
+ function Unit.prototype.isAlly(self, whichPlayer)
911
+ return IsUnitAlly(self.handle, whichPlayer.handle)
912
+ end
913
+ function Unit.prototype.isEnemy(self, whichPlayer)
914
+ return IsUnitEnemy(self.handle, whichPlayer.handle)
915
+ end
916
+ function Unit.prototype.isExperienceSuspended(self)
917
+ return IsSuspendedXP(self.handle)
918
+ end
919
+ function Unit.prototype.isFogged(self, whichPlayer)
920
+ return IsUnitFogged(self.handle, whichPlayer.handle)
921
+ end
922
+ function Unit.prototype.isHero(self)
923
+ return IsHeroUnitId(self.typeId)
924
+ end
925
+ function Unit.prototype.isIllusion(self)
926
+ return IsUnitIllusion(self.handle)
927
+ end
928
+ function Unit.prototype.isLoaded(self)
929
+ return IsUnitLoaded(self.handle)
930
+ end
931
+ function Unit.prototype.isMasked(self, whichPlayer)
932
+ return IsUnitMasked(self.handle, whichPlayer.handle)
933
+ end
934
+ function Unit.prototype.isSelected(self, whichPlayer)
935
+ return IsUnitSelected(self.handle, whichPlayer.handle)
936
+ end
937
+ function Unit.prototype.issueBuildOrder(self, unit, x, y)
938
+ local ____temp_2
939
+ if type(unit) == "string" then
940
+ ____temp_2 = IssueBuildOrder(self.handle, unit, x, y)
941
+ else
942
+ ____temp_2 = IssueBuildOrderById(self.handle, unit, x, y)
943
+ end
944
+ return ____temp_2
945
+ end
946
+ function Unit.prototype.issueImmediateOrder(self, order)
947
+ local ____temp_3
948
+ if type(order) == "string" then
949
+ ____temp_3 = IssueImmediateOrder(self.handle, order)
950
+ else
951
+ ____temp_3 = IssueImmediateOrderById(self.handle, order)
952
+ end
953
+ return ____temp_3
954
+ end
955
+ function Unit.prototype.issueInstantOrderAt(self, order, x, y, instantTargetWidget)
956
+ local ____temp_4
957
+ if type(order) == "string" then
958
+ ____temp_4 = IssueInstantPointOrder(
959
+ self.handle,
960
+ order,
961
+ x,
962
+ y,
963
+ instantTargetWidget.handle
964
+ )
965
+ else
966
+ ____temp_4 = IssueInstantPointOrderById(
967
+ self.handle,
968
+ order,
969
+ x,
970
+ y,
971
+ instantTargetWidget.handle
972
+ )
973
+ end
974
+ return ____temp_4
975
+ end
976
+ function Unit.prototype.issueInstantTargetOrder(self, order, targetWidget, instantTargetWidget)
977
+ local ____temp_5
978
+ if type(order) == "string" then
979
+ ____temp_5 = IssueInstantTargetOrder(self.handle, order, targetWidget.handle, instantTargetWidget.handle)
980
+ else
981
+ ____temp_5 = IssueInstantTargetOrderById(self.handle, order, targetWidget.handle, instantTargetWidget.handle)
982
+ end
983
+ return ____temp_5
984
+ end
985
+ function Unit.prototype.issueOrderAt(self, order, x, y)
986
+ local ____temp_6
987
+ if type(order) == "string" then
988
+ ____temp_6 = IssuePointOrder(self.handle, order, x, y)
989
+ else
990
+ ____temp_6 = IssuePointOrderById(self.handle, order, x, y)
991
+ end
992
+ return ____temp_6
993
+ end
994
+ function Unit.prototype.issuePointOrder(self, order, whichPoint)
995
+ local ____temp_7
996
+ if type(order) == "string" then
997
+ ____temp_7 = IssuePointOrderLoc(self.handle, order, whichPoint.handle)
998
+ else
999
+ ____temp_7 = IssuePointOrderByIdLoc(self.handle, order, whichPoint.handle)
1000
+ end
1001
+ return ____temp_7
1002
+ end
1003
+ function Unit.prototype.issueTargetOrder(self, order, targetWidget)
1004
+ local ____temp_8
1005
+ if type(order) == "string" then
1006
+ ____temp_8 = IssueTargetOrder(self.handle, order, targetWidget.handle)
1007
+ else
1008
+ ____temp_8 = IssueTargetOrderById(self.handle, order, targetWidget.handle)
1009
+ end
1010
+ return ____temp_8
1011
+ end
1012
+ function Unit.prototype.isUnit(self, whichSpecifiedUnit)
1013
+ return IsUnit(self.handle, whichSpecifiedUnit.handle)
1014
+ end
1015
+ function Unit.prototype.isUnitType(self, whichUnitType)
1016
+ return IsUnitType(self.handle, whichUnitType)
1017
+ end
1018
+ function Unit.prototype.isVisible(self, whichPlayer)
1019
+ return IsUnitVisible(self.handle, whichPlayer.handle)
1020
+ end
1021
+ function Unit.prototype.kill(self)
1022
+ KillUnit(self.handle)
1023
+ end
1024
+ function Unit.prototype.lookAt(self, whichBone, lookAtTarget, offsetX, offsetY, offsetZ)
1025
+ SetUnitLookAt(
1026
+ self.handle,
1027
+ whichBone,
1028
+ lookAtTarget.handle,
1029
+ offsetX,
1030
+ offsetY,
1031
+ offsetZ
1032
+ )
1033
+ end
1034
+ function Unit.prototype.makeAbilityPermanent(self, permanent, abilityId)
1035
+ UnitMakeAbilityPermanent(self.handle, permanent, abilityId)
1036
+ end
1037
+ function Unit.prototype.modifySkillPoints(self, skillPointDelta)
1038
+ return UnitModifySkillPoints(self.handle, skillPointDelta)
1039
+ end
1040
+ function Unit.prototype.pauseEx(self, flag)
1041
+ BlzPauseUnitEx(self.handle, flag)
1042
+ end
1043
+ function Unit.prototype.pauseTimedLife(self, flag)
1044
+ UnitPauseTimedLife(self.handle, flag)
1045
+ end
1046
+ function Unit.prototype.queueAnimation(self, whichAnimation)
1047
+ QueueUnitAnimation(self.handle, whichAnimation)
1048
+ end
1049
+ function Unit.prototype.recycleGuardPosition(self)
1050
+ RecycleGuardPosition(self.handle)
1051
+ end
1052
+ function Unit.prototype.removeAbility(self, abilityId)
1053
+ return UnitRemoveAbility(self.handle, abilityId)
1054
+ end
1055
+ function Unit.prototype.removeBuffs(self, removePositive, removeNegative)
1056
+ UnitRemoveBuffs(self.handle, removePositive, removeNegative)
1057
+ end
1058
+ function Unit.prototype.removeBuffsEx(self, removePositive, removeNegative, magic, physical, timedLife, aura, autoDispel)
1059
+ UnitRemoveBuffsEx(
1060
+ self.handle,
1061
+ removePositive,
1062
+ removeNegative,
1063
+ magic,
1064
+ physical,
1065
+ timedLife,
1066
+ aura,
1067
+ autoDispel
1068
+ )
1069
+ end
1070
+ function Unit.prototype.removeGuardPosition(self)
1071
+ RemoveGuardPosition(self.handle)
1072
+ end
1073
+ function Unit.prototype.removeItem(self, whichItem)
1074
+ UnitRemoveItem(self.handle, whichItem.handle)
1075
+ end
1076
+ function Unit.prototype.removeItemFromSlot(self, itemSlot)
1077
+ return Item:fromHandle(UnitRemoveItemFromSlot(self.handle, itemSlot))
1078
+ end
1079
+ function Unit.prototype.removeItemFromStock(self, itemId)
1080
+ RemoveItemFromStock(self.handle, itemId)
1081
+ end
1082
+ function Unit.prototype.removeType(self, whichUnitType)
1083
+ return UnitAddType(self.handle, whichUnitType)
1084
+ end
1085
+ function Unit.prototype.removeUnitFromStock(self, itemId)
1086
+ RemoveUnitFromStock(self.handle, itemId)
1087
+ end
1088
+ function Unit.prototype.resetCooldown(self)
1089
+ UnitResetCooldown(self.handle)
1090
+ end
1091
+ function Unit.prototype.resetLookAt(self)
1092
+ ResetUnitLookAt(self.handle)
1093
+ end
1094
+ function Unit.prototype.revive(self, x, y, doEyecandy)
1095
+ return ReviveHero(self.handle, x, y, doEyecandy)
1096
+ end
1097
+ function Unit.prototype.reviveAtPoint(self, whichPoint, doEyecandy)
1098
+ return ReviveHeroLoc(self.handle, whichPoint.handle, doEyecandy)
1099
+ end
1100
+ function Unit.prototype.select(self, flag)
1101
+ SelectUnit(self.handle, flag)
1102
+ end
1103
+ function Unit.prototype.selectSkill(self, abilCode)
1104
+ SelectHeroSkill(self.handle, abilCode)
1105
+ end
1106
+ function Unit.prototype.setAbilityCooldown(self, abilId, level, cooldown)
1107
+ BlzSetUnitAbilityCooldown(self.handle, abilId, level, cooldown)
1108
+ end
1109
+ function Unit.prototype.setAbilityLevel(self, abilCode, level)
1110
+ return SetUnitAbilityLevel(self.handle, abilCode, level)
1111
+ end
1112
+ function Unit.prototype.setAbilityManaCost(self, abilId, level, manaCost)
1113
+ BlzSetUnitAbilityManaCost(self.handle, abilId, level, manaCost)
1114
+ end
1115
+ function Unit.prototype.setAgility(self, value, permanent)
1116
+ SetHeroAgi(self.handle, value, permanent)
1117
+ end
1118
+ function Unit.prototype.setAnimation(self, whichAnimation)
1119
+ if type(whichAnimation) == "string" then
1120
+ SetUnitAnimation(self.handle, whichAnimation)
1121
+ else
1122
+ SetUnitAnimationByIndex(self.handle, whichAnimation)
1123
+ end
1124
+ end
1125
+ function Unit.prototype.setAnimationWithRarity(self, whichAnimation, rarity)
1126
+ SetUnitAnimationWithRarity(self.handle, whichAnimation, rarity)
1127
+ end
1128
+ function Unit.prototype.setAttackCooldown(self, cooldown, weaponIndex)
1129
+ BlzSetUnitAttackCooldown(self.handle, cooldown, weaponIndex)
1130
+ end
1131
+ function Unit.prototype.setBaseDamage(self, baseDamage, weaponIndex)
1132
+ BlzSetUnitBaseDamage(self.handle, baseDamage, weaponIndex)
1133
+ end
1134
+ function Unit.prototype.setBlendTime(self, timeScale)
1135
+ SetUnitBlendTime(self.handle, timeScale)
1136
+ end
1137
+ function Unit.prototype.setConstructionProgress(self, constructionPercentage)
1138
+ UnitSetConstructionProgress(self.handle, constructionPercentage)
1139
+ end
1140
+ function Unit.prototype.setCreepGuard(self, creepGuard)
1141
+ SetUnitCreepGuard(self.handle, creepGuard)
1142
+ end
1143
+ function Unit.prototype.setDiceNumber(self, diceNumber, weaponIndex)
1144
+ BlzSetUnitDiceNumber(self.handle, diceNumber, weaponIndex)
1145
+ end
1146
+ function Unit.prototype.setDiceSides(self, diceSides, weaponIndex)
1147
+ BlzSetUnitDiceSides(self.handle, diceSides, weaponIndex)
1148
+ end
1149
+ function Unit.prototype.setExperience(self, newXpVal, showEyeCandy)
1150
+ SetHeroXP(self.handle, newXpVal, showEyeCandy)
1151
+ end
1152
+ function Unit.prototype.setExploded(self, exploded)
1153
+ SetUnitExploded(self.handle, exploded)
1154
+ end
1155
+ function Unit.prototype.setFacingEx(self, facingAngle)
1156
+ BlzSetUnitFacingEx(self.handle, facingAngle)
1157
+ end
1158
+ function Unit.prototype.setField(self, field, value)
1159
+ local fieldType = __TS__StringSubstr(
1160
+ tostring(field),
1161
+ 0,
1162
+ (string.find(
1163
+ tostring(field),
1164
+ ":",
1165
+ nil,
1166
+ true
1167
+ ) or 0) - 1
1168
+ )
1169
+ if fieldType == "unitbooleanfield" and type(value) == "boolean" then
1170
+ return BlzSetUnitBooleanField(self.handle, field, value)
1171
+ end
1172
+ if fieldType == "unitintegerfield" and type(value) == "number" then
1173
+ return BlzSetUnitIntegerField(self.handle, field, value)
1174
+ end
1175
+ if fieldType == "unitrealfield" and type(value) == "number" then
1176
+ return BlzSetUnitRealField(self.handle, field, value)
1177
+ end
1178
+ if fieldType == "unitstringfield" and type(value) == "string" then
1179
+ return BlzSetUnitStringField(self.handle, field, value)
1180
+ end
1181
+ return false
1182
+ end
1183
+ function Unit.prototype.setflyHeight(self, value, rate)
1184
+ SetUnitFlyHeight(self.handle, value, rate)
1185
+ end
1186
+ function Unit.prototype.setHeroLevel(self, level, showEyeCandy)
1187
+ SetHeroLevel(self.handle, level, showEyeCandy)
1188
+ end
1189
+ function Unit.prototype.setIntelligence(self, value, permanent)
1190
+ SetHeroInt(self.handle, value, permanent)
1191
+ end
1192
+ function Unit.prototype.setItemTypeSlots(self, slots)
1193
+ SetItemTypeSlots(self.handle, slots)
1194
+ end
1195
+ function Unit.prototype.setOwner(self, whichPlayer, changeColor)
1196
+ if changeColor == nil then
1197
+ changeColor = true
1198
+ end
1199
+ SetUnitOwner(self.handle, whichPlayer.handle, changeColor)
1200
+ end
1201
+ function Unit.prototype.getOwner(self)
1202
+ return MapPlayer:fromHandle(GetOwningPlayer(self.handle))
1203
+ end
1204
+ function Unit.prototype.setPoint(self, point)
1205
+ SetUnitPositionLoc(self.handle, point.handle)
1206
+ end
1207
+ function Unit.prototype.getPoint(self)
1208
+ return Point:fromHandle(GetUnitLoc(self.handle))
1209
+ end
1210
+ function Unit.prototype.setPathing(self, flag)
1211
+ SetUnitPathing(self.handle, flag)
1212
+ end
1213
+ function Unit.prototype.setPosition(self, x, y)
1214
+ SetUnitPosition(self.handle, x, y)
1215
+ end
1216
+ function Unit.prototype.setRescuable(self, byWhichPlayer, flag)
1217
+ SetUnitRescuable(self.handle, byWhichPlayer.handle, flag)
1218
+ end
1219
+ function Unit.prototype.setRescueRange(self, range)
1220
+ SetUnitRescueRange(self.handle, range)
1221
+ end
1222
+ function Unit.prototype.setScale(self, scaleX, scaleY, scaleZ)
1223
+ SetUnitScale(self.handle, scaleX, scaleY, scaleZ)
1224
+ end
1225
+ function Unit.prototype.setState(self, whichUnitState, newVal)
1226
+ SetUnitState(self.handle, whichUnitState, newVal)
1227
+ end
1228
+ function Unit.prototype.setStrength(self, value, permanent)
1229
+ SetHeroStr(self.handle, value, permanent)
1230
+ end
1231
+ function Unit.prototype.setTimeScale(self, timeScale)
1232
+ SetUnitTimeScale(self.handle, timeScale)
1233
+ end
1234
+ function Unit.prototype.setUnitAttackCooldown(self, cooldown, weaponIndex)
1235
+ BlzSetUnitAttackCooldown(self.handle, cooldown, weaponIndex)
1236
+ end
1237
+ function Unit.prototype.setUnitTypeSlots(self, slots)
1238
+ SetUnitTypeSlots(self.handle, slots)
1239
+ end
1240
+ function Unit.prototype.setUpgradeProgress(self, upgradePercentage)
1241
+ UnitSetUpgradeProgress(self.handle, upgradePercentage)
1242
+ end
1243
+ function Unit.prototype.setUseAltIcon(self, flag)
1244
+ UnitSetUsesAltIcon(self.handle, flag)
1245
+ end
1246
+ function Unit.prototype.setUseFood(self, useFood)
1247
+ SetUnitUseFood(self.handle, useFood)
1248
+ end
1249
+ function Unit.prototype.setVertexColor(self, red, green, blue, alpha)
1250
+ SetUnitVertexColor(
1251
+ self.handle,
1252
+ red,
1253
+ green,
1254
+ blue,
1255
+ alpha
1256
+ )
1257
+ end
1258
+ function Unit.prototype.shareVision(self, whichPlayer, share)
1259
+ UnitShareVision(self.handle, whichPlayer.handle, share)
1260
+ end
1261
+ function Unit.prototype.showTeamGlow(self, show)
1262
+ BlzShowUnitTeamGlow(self.handle, show)
1263
+ end
1264
+ function Unit.prototype.startAbilityCooldown(self, abilCode, cooldown)
1265
+ BlzStartUnitAbilityCooldown(self.handle, abilCode, cooldown)
1266
+ end
1267
+ function Unit.prototype.stripLevels(self, howManyLevels)
1268
+ return UnitStripHeroLevel(self.handle, howManyLevels)
1269
+ end
1270
+ function Unit.prototype.suspendDecay(self, suspend)
1271
+ UnitSuspendDecay(self.handle, suspend)
1272
+ end
1273
+ function Unit.prototype.suspendExperience(self, flag)
1274
+ SuspendHeroXP(self.handle, flag)
1275
+ end
1276
+ function Unit.prototype.useItem(self, whichItem)
1277
+ return UnitUseItem(self.handle, whichItem.handle)
1278
+ end
1279
+ function Unit.prototype.useItemAt(self, whichItem, x, y)
1280
+ return UnitUseItemPoint(self.handle, whichItem.handle, x, y)
1281
+ end
1282
+ function Unit.prototype.useItemTarget(self, whichItem, target)
1283
+ return UnitUseItemTarget(self.handle, whichItem.handle, target.handle)
1284
+ end
1285
+ function Unit.prototype.wakeUp(self)
1286
+ UnitWakeUp(self.handle)
1287
+ end
1288
+ function Unit.prototype.waygateGetDestinationX(self)
1289
+ return WaygateGetDestinationX(self.handle)
1290
+ end
1291
+ function Unit.prototype.waygateGetDestinationY(self)
1292
+ return WaygateGetDestinationY(self.handle)
1293
+ end
1294
+ function Unit.prototype.waygateSetDestination(self, x, y)
1295
+ WaygateSetDestination(self.handle, x, y)
1296
+ end
1297
+ function Unit.foodMadeByType(self, unitId)
1298
+ return GetFoodMade(unitId)
1299
+ end
1300
+ function Unit.foodUsedByType(self, unitId)
1301
+ return GetFoodUsed(unitId)
1302
+ end
1303
+ function Unit.fromEnum(self)
1304
+ return self:fromHandle(GetEnumUnit())
1305
+ end
1306
+ function Unit.fromEvent(self)
1307
+ return self:fromHandle(GetTriggerUnit())
1308
+ end
1309
+ function Unit.fromFilter(self)
1310
+ return self:fromHandle(GetFilterUnit())
1311
+ end
1312
+ function Unit.fromHandle(self, handle)
1313
+ local ____handle_9
1314
+ if handle then
1315
+ ____handle_9 = self:getObject(handle)
1316
+ else
1317
+ ____handle_9 = nil
1318
+ end
1319
+ return ____handle_9
1320
+ end
1321
+ function Unit.getPointValueByType(self, unitType)
1322
+ return GetUnitPointValueByType(unitType)
1323
+ end
1324
+ function Unit.isUnitIdHero(self, unitId)
1325
+ return IsHeroUnitId(unitId)
1326
+ end
1327
+ function Unit.isUnitIdType(self, unitId, whichUnitType)
1328
+ return IsUnitIdType(unitId, whichUnitType)
1329
+ end
1330
+ return ____exports