Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.63 KB | None | 0 0
  1. import { ArrayExtensions, Color, EventsSDK, Game, Hero, MenuManager, RendererSDK, Utils, Vector2, Vector3, ParticlesSDK } from "wrapper/Imports";
  2. let {
  3. MenuFactory
  4. } = MenuManager;
  5. const menu = MenuFactory("TinkerCombo"),
  6. active = menu.AddToggle("Active"),
  7. ezKill = menu.AddToggle("Check for EZ Kill"),
  8. comboToggle = menu.AddCheckBox("Clamp combo key"),
  9. comboKey = menu.AddKeybind("Combo Key"),
  10. harrasKey = menu.AddKeybind("Harras Key"),
  11. cursorRadius = menu.AddSlider("Nearest cursor radius", 200, 100, 1000),
  12. popLinkV = menu.AddCheckBox("Pop Linken"),
  13. popLinkItems = menu.AddListBox("Pop Linken with", ["Pop with Dagon", "Scythe of Vyse", "Nullifier"]),
  14. bmcheck = menu.AddCheckBox("Check BlaidMail"),
  15. soulRing = menu.AddCheckBox("Enable SoulRing"),
  16. blinkV = menu.AddCheckBox("Enable Blink"),
  17. blinkRadius = menu.AddSlider("Blink distance from enemy", 200, 0, 800),
  18. abils = menu.AddListBox("Active abilities", ["Laser", "Heat-Seeking Missile", "March of the Machines", "Rearm"]),
  19. items = menu.AddListBox("Active items", ["Scythe of Vyse", "Ethereal Blade", "Dagon", "Nullifier", "Shiva"]),
  20. drawable = menu.AddTree("Drawable"),
  21. heroMenu = menu.AddTree("Hero Specifics"),
  22. amReflect = heroMenu.AddCheckBox("Enabled Pop AM Reflect"),
  23. amReflectItems = heroMenu.AddListBox("Pop AM Reflect", ["Pop with Dagon"]),
  24. drawTargetParticle = drawable.AddCheckBox("Draw line to target"),
  25. heatShot = drawable.AddCheckBox("Draw heatseeking shot indicator"),
  26. drawStatus = drawable.AddCheckBox("Draw status"),
  27. statusPosX = drawable.AddSlider("Position X (%)", 19, 0, 100),
  28. statusPosY = drawable.AddSlider("Position Y (%)", 4, 0, 100),
  29. textSize = drawable.AddSlider("Text size", 15, 10, 30),
  30. FarPredict = 390,
  31. DoubleMFRootedPredict = 610,
  32. DoubleMFUnrootedPredict = 750,
  33. mods = ["modifier_winter_wyvern_winters_curse", "modifier_item_lotus_orb_active", "modifier_medusa_stone_gaze_stone", "modifier_oracle_fates_edict"],
  34. CloseInPredict = 300;
  35. let tinker,
  36. nearest,
  37. target,
  38. heroes = [],
  39. targetParticle,
  40. comboKeyPress = false,
  41. laser,
  42. heat,
  43. march,
  44. rearm,
  45. nullifier,
  46. hex,
  47. eblade,
  48. dagon,
  49. shiva,
  50. soulring,
  51. blink,
  52. debuffed = false,
  53. IsEZKillable = false,
  54. heatenemy,
  55. currentheat,
  56. heatparticle,
  57. lastCheckTime;
  58. comboKey.OnExecute(val => {
  59. return comboKeyPress = val;
  60. });
  61. EventsSDK.on("GameStarted", hero => {
  62. if (hero.m_pBaseEntity instanceof C_DOTA_Unit_Hero_Tinker) {
  63. tinker = hero;
  64. getAbils();
  65. }
  66. });
  67. EventsSDK.on("EntityDestroyed", ent => {
  68. if (ent instanceof Hero) {
  69. ArrayExtensions.arrayRemove(heroes, ent);
  70. }
  71. });
  72. EventsSDK.on("EntityCreated", npc => {
  73. if (npc instanceof Hero && npc.IsEnemy() && !npc.IsIllusion) {
  74. heroes.push(npc);
  75. }
  76. });
  77. EventsSDK.on("GameEnded", () => {
  78. tinker = undefined;
  79. heroes = [];
  80. nearest = undefined;
  81. target = undefined;
  82. comboKeyPress = false;
  83. laser = undefined;
  84. heat = undefined;
  85. march = undefined;
  86. rearm = undefined;
  87. nullifier = undefined;
  88. hex = undefined;
  89. eblade = undefined;
  90. dagon = undefined;
  91. shiva = undefined;
  92. soulring = undefined;
  93. blink = undefined;
  94. debuffed = false;
  95. IsEZKillable = false;
  96. lastCheckTime = undefined;
  97.  
  98. if (targetParticle !== undefined) {
  99. ParticlesSDK.Destroy(targetParticle, true);
  100. targetParticle = undefined;
  101. }
  102.  
  103. if (heatparticle !== undefined) {
  104. ParticlesSDK.Destroy(heatparticle, true);
  105. heatparticle = undefined;
  106. currentheat = undefined;
  107. heatenemy = undefined;
  108. }
  109. });
  110. EventsSDK.on("Tick", () => {
  111. if (!active.value || !Game.IsInGame || Game.IsPaused || tinker === undefined || !tinker.IsAlive) {
  112. return;
  113. }
  114.  
  115. if (!comboToggle.value && comboKeyPress) {
  116. if (target !== undefined) {
  117. target = undefined;
  118. } else if (nearest !== undefined) {
  119. target = nearest;
  120. }
  121.  
  122. comboKeyPress = false;
  123. } else if (comboToggle.value && comboKey.IsPressed) {
  124. target = nearest;
  125. } else if (comboToggle.value && !comboKey.IsPressed) {
  126. target = undefined;
  127. }
  128.  
  129. if (target !== undefined) {
  130. if (!target.IsAlive) {
  131. target = undefined;
  132. }
  133.  
  134. if (tinker.CanAttack(target)) {
  135. tinker.AttackTarget(target);
  136. }
  137.  
  138. if (checkMods() && !target.IsMagicImmune) {
  139. getAbils();
  140. getItems();
  141. debuffed = IsDebuffed();
  142.  
  143. if (amReflect.value && target.Name === "npc_dota_hero_antimage" && !target.ModifiersBook.HasAnyBuffByNames(["modifier_silver_edge_debuff", "modifier_viper_nethertoxin"]) && target.GetAbilityByName("antimage_spell_shield").IsReady) {
  144.  
  145. if (popLink(dagon, amReflectItems.selected_flags[4])) {
  146. return;
  147. }
  148.  
  149. return;
  150. }
  151.  
  152. if (popLinkV.value && target.HasLinkenAtTime()) {
  153. if (popLink(nullifier, popLinkItems.selected_flags[0])) {
  154. return;
  155. }
  156.  
  157. if (popLink(hex, popLinkItems.selected_flags[3])) {
  158. return;
  159. }
  160.  
  161. if (popLink(dagon, popLinkItems.selected_flags[5])) {
  162. return;
  163. }
  164.  
  165. return;
  166. }
  167.  
  168. if (!target.IsStunned && !target.IsHexed) {
  169. if (useItem(hex, items.selected_flags[1])) {
  170. return;
  171. }
  172. }
  173.  
  174. if (tinker.IsInRange(target, 700) && !target.ModifiersBook.HasAnyBuffByNames(["modifier_teleporting"])) {
  175. IsEZKillable = killCheck();
  176. }
  177.  
  178. if (useBlink() || aeonDispelling() || castAbility(laser, abils.selected_flags[0]) || castAbility(heat, abils.selected_flags[1]) || useItem(eblade, items.selected_flags[2]) || castAbility(march, abils.selected_flags[2]) || castAbility(rearm, abils.selected_flags[3]) || useItem(dagon, items.selected_flags[4]) || useItem(shiva, items.selected_flags[7])) {
  179. return;
  180. }
  181.  
  182. if (!target.ModifiersBook.HasAnyBuffByNames(["modifier_item_nullifier_mute"]) && !target.IsHexed) {
  183. const item = target.GetItemByName("item_aeon_disk");
  184.  
  185. if (item !== undefined && !item.IsReady && useItem(nullifier, items.selected_flags[8])) {
  186. return;
  187. } else if (item === undefined && useItem(nullifier, items.selected_flags[8])) {
  188. return;
  189. }
  190.  
  191. return;
  192. }
  193. }
  194. }
  195.  
  196. if (harrasKey.IsPressed) {
  197. if (nearest !== undefined) {
  198. if (tinker.CanAttack(nearest)) {
  199. tinker.AttackTarget(nearest);
  200. }
  201.  
  202. if (!checkMods(true) || nearest.IsMagicImmune) {
  203. return;
  204. }
  205.  
  206. getAbils();
  207.  
  208. if (castAbility(heat, abils.selected_flags[1], true)) {
  209. return;
  210. }
  211. }
  212. }
  213. });
  214.  
  215. function aeonDispelling() {
  216. if (nullifier !== undefined && nullifier.IsReady) {
  217. const buff = target.ModifiersBook.GetBuffByName("modifier_item_aeon_disk_buff"),
  218. aeon = target.GetItemByName("item_aeon_disk");
  219.  
  220. if (aeon !== undefined && (target.HPPercent < (aeon.GetSpecialValue("health_threshold_pct") + 3) * 0.01 || buff !== undefined)) {
  221. tinker.CastTarget(nullifier, target);
  222. return true;
  223. }
  224. }
  225.  
  226. return false;
  227. }
  228.  
  229. function killCheck() {
  230. if (!ezKill.value) {
  231. return false;
  232. }
  233.  
  234. if (Game.GameTime < lastCheckTime + 4) {
  235. return IsEZKillable;
  236. }
  237.  
  238. const int = tinker.TotalIntelligence;
  239. let amp = tinker.SpellAmplification + tinker.GetTalentValue("special_bonus_unique_tinker_3") * -0.01,
  240. reqMana = 0,
  241. damage = 0;
  242.  
  243. /*if (seal && seal.IsReady && abils.selected_flags[3]) {
  244. amp += seal.GetSpecialValue("resist_debuff") * -0.01;
  245. reqMana += seal.ManaCost;
  246. }*/
  247.  
  248. if (eblade && eblade.IsReady && items.selected_flags[2]) {
  249. amp += eblade.GetSpecialValue("ethereal_damage_bonus") * -0.01;
  250. reqMana += eblade.ManaCost;
  251. damage += eblade.GetSpecialValue("blast_damage_base") + eblade.GetSpecialValue("blast_agility_multiplier") * int;
  252. }
  253.  
  254. if (dagon && dagon.IsReady && items.selected_flags[4]) {
  255. reqMana += dagon.ManaCost;
  256. damage += dagon.GetSpecialValue("dagon");
  257. }
  258.  
  259. if (laser && laser.IsReady && abils.selected_flags[0]) {
  260. const mult = laser.CooldownLenght <= 2 ? 2 : 1;
  261. damage += (laser.GetSpecialValue("laser_damage") + laser.GetSpecialValue("int_multiplier") * int) * mult;
  262. reqMana += laser.ManaCost * mult;
  263. }
  264.  
  265. if (heat && heat.IsReady && abils.selected_flags[1]) {
  266. damage += heat.GetSpecialValue("damage");
  267. reqMana += heat.ManaCost;
  268. }
  269.  
  270. damage *= 1 + amp - target.MagicDamageResist * 0.01;
  271.  
  272. if (reqMana < tinker.Mana && target.HP <= damage) {
  273. lastCheckTime = Game.GameTime;
  274. return true;
  275. }
  276.  
  277. return false;
  278. }
  279.  
  280. function useItem(item, val) {
  281. if (item !== undefined && val && item.IsReady && tinker.IsInRange(target, item.CastRange)) {
  282. if (item === shiva) {
  283. tinker.CastNoTarget(item);
  284. return true;
  285. }
  286.  
  287. if (item === dagon && debuffed) {
  288. tinker.CastTarget(item, target);
  289. return true;
  290. }
  291.  
  292. /*if (item === veil) {
  293. sky.CastPosition(item, target.NetworkPosition);
  294. return true;
  295. }*/
  296.  
  297. if (item !== dagon) {
  298. tinker.CastTarget(item, target);
  299. return true;
  300. }
  301. }
  302.  
  303. return false;
  304. }
  305.  
  306. function castAbility(ability, val, near = false) {
  307. if (ability !== undefined && val && ability.IsReady) {
  308. if (ability === heat) {
  309. tinker.CastNoTarget(ability);
  310. return true;
  311. }
  312.  
  313. if (ability === rearm) {
  314. /*if (debuffed && !IsEZKillable) {
  315. CastNoTarget(ability);
  316. return true;
  317. }*/
  318. tinker.CastNoTarget(ability);
  319. return true;
  320.  
  321. /*if (ability === march) {
  322. tinker.CastNoTarget(ability)
  323. if (soulRing.value && soulring !== undefined && soulring.IsReady) {
  324. tinker.CastNoTarget(soulring);
  325. return;
  326. }
  327. return true;
  328. } */
  329.  
  330. } else {
  331. let trgt = near ? nearest : target;
  332. tinker.CastTarget(ability, trgt);
  333. return true;
  334. }
  335. }
  336.  
  337. return false;
  338. }
  339.  
  340. /*function CastToPrediction(near = false) {
  341. let trgt = near ? nearest : target;
  342.  
  343. if (trgt.ModifiersBook.HasAnyBuffByNames(["modifier_rune_haste"])) {
  344. if (trgt.IsRooted) {
  345. tinker.CastPosition(flare, IsFront(CloseInPredict, near));
  346. } else return;
  347. }
  348.  
  349. if (trgt.IsHexed || trgt.IsRooted) {
  350. sky.CastPosition(flare, IsFront(CloseInPredict, near));
  351. return;
  352. }
  353.  
  354. sky.CastPosition(flare, IsFront(FarPredict, near));
  355. }
  356.  
  357. function IsFront(delay, near = false) {
  358. let trgt = near ? nearest : target,
  359. adjusment = 0;
  360.  
  361. if (delay === 610) {
  362. adjusment = 300;
  363. } else adjusment = trgt.IdealSpeed;
  364.  
  365. return trgt.InFront(delay / 1000 * adjusment);
  366. }*/
  367.  
  368. function useBlink() {
  369. if (blinkV.value && blink !== undefined && blink.IsReady) {
  370. if (target.IsInRange(tinker, 600)) {
  371. return false;
  372. }
  373.  
  374. let castRange = blink.GetSpecialValue("blink_range") + tinker.CastRangeBonus,
  375. distance = target.NetworkPosition.Subtract(tinker.NetworkPosition),
  376. disToTarget = tinker.Distance(target);
  377. distance.SetZ(0);
  378. distance.Normalize();
  379.  
  380. if (disToTarget > castRange) {
  381. let di = disToTarget - castRange,
  382. minus = 0;
  383.  
  384. if (di < blinkRadius.value) {
  385. minus = blinkRadius.value - di;
  386. }
  387.  
  388. distance.ScaleTo(castRange - 1 - minus);
  389. } else {
  390. distance.ScaleTo(disToTarget - blinkRadius.value - 1);
  391. }
  392.  
  393. tinker.CastPosition(blink, tinker.NetworkPosition.Add(distance));
  394. return true;
  395. }
  396.  
  397. return false;
  398. }
  399.  
  400. function getAbils() {
  401. laser = tinker.GetAbilityByName("tinker_laser");
  402. heat = tinker.GetAbilityByName("tinker_heat_seeking_missile");
  403. march = tinker.GetAbilityByName("tinker_march_of_the_machines");
  404. rearm = tinker.GetAbilityByName("tinker_rearm");
  405. }
  406.  
  407. function getItems() {
  408. nullifier = tinker.GetItemByName("item_nullifier");
  409. hex = tinker.GetItemByName("item_sheepstick");
  410. eblade = tinker.GetItemByName("item_ethereal_blade");
  411. dagon = tinker.GetItemByName(/item_dagon/);
  412. shiva = tinker.GetItemByName("item_shivas_guard");
  413. soulring = tinker.GetItemByName("item_soul_ring");
  414. blink = tinker.GetItemByName("item_blink");
  415. }
  416.  
  417. function IsDebuffed() {
  418.  
  419. if (eblade && eblade.IsReady && items.selected_flags[2] && target.ModifiersBook.HasBuffByName("modifier_item_ethereal_blade_slow")) {
  420. return false;
  421. }
  422.  
  423. if (march && march.IsReady && target.ModifiersBook.HasBuffByName("modifier_tinker_march_of_the_machines")) {
  424. return false;
  425. }
  426.  
  427. if (heat && heat.IsReady && target.ModifiersBook.HasBuffByName("modifier_tinker_heat_seeking_missile_slow")) {
  428. return false;
  429. }
  430.  
  431. /*if(rearm && rearm.IsReady && target.ModifiersBook.HasBuffByName("modifier_tinker_rearm")) {
  432. return false;
  433. }*/
  434.  
  435.  
  436. return true;
  437. }
  438.  
  439. function checkMods(near = false) {
  440. let trgt = near ? nearest : target;
  441.  
  442. if (trgt === undefined) {
  443. return false;
  444. }
  445.  
  446. if (bmcheck.value && trgt.ModifiersBook.HasAnyBuffByNames(["modifier_item_blade_mail_reflect"])) {
  447. return false;
  448. }
  449.  
  450. if (trgt.ModifiersBook.HasAnyBuffByNames(mods)) {
  451. return false;
  452. }
  453.  
  454. return true;
  455. }
  456.  
  457. function popLink(item, val) {
  458. if (val && item !== undefined && item.IsReady) {
  459. tinker.CastTarget(item, target, false, false);
  460. return true;
  461. }
  462.  
  463. return false;
  464. }
  465.  
  466. EventsSDK.on("Update", cmd => {
  467. if (!active.value || !Game.IsInGame || Game.IsPaused || tinker === undefined || !tinker.IsAlive) {
  468. return;
  469. }
  470. let Me = LocalPlayer.Hero;
  471. if (Me.ModifiersBook.HasBuffByName(("modifier_tinker_rearm"))) //{
  472. return;
  473. //}
  474. let _a = heroes;
  475.  
  476. let _f = hero => {
  477. return hero.Distance(Utils.CursorWorldVec) <= cursorRadius.value && hero.IsAlive;
  478. };
  479.  
  480. let _r = [];
  481.  
  482. for (let _i = _a.length; _i--;) {
  483. if (_f(_a[_i], _i, _a)) {
  484. _r.push(_a[_i]);
  485. }
  486. }
  487.  
  488. nearest = ArrayExtensions.orderBy(_r, ent => {
  489. return ent.Distance(Utils.CursorWorldVec);
  490. })[0];
  491.  
  492. if (heatShot.value && heat !== undefined) {
  493. let _a2 = heroes;
  494.  
  495. let _f2 = hero => {
  496. return hero.Distance(tinker) <= heat.CastRange && hero.IsAlive && hero.IsVisible;
  497. };
  498.  
  499. let _r2 = [];
  500.  
  501. for (let _i2 = _a2.length; _i2--;) {
  502. if (_f2(_a2[_i2], _i2, _a2)) {
  503. _r2.push(_a2[_i2]);
  504. }
  505. }
  506.  
  507. heatenemy = ArrayExtensions.orderBy(_r2, ent => {
  508. return ent.Distance(tinker);
  509. })[0];
  510. }
  511. });
  512. EventsSDK.on("Draw", () => {
  513. if (!active.value || !Game.IsInGame || Game.IsPaused || tinker === undefined || !tinker.IsAlive) {
  514. return;
  515. }
  516.  
  517. if (drawTargetParticle.value) {
  518. if (targetParticle === undefined && (nearest !== undefined || target !== undefined)) {
  519. targetParticle = ParticlesSDK.Create("particles/ui_mouseactions/range_finder_tower_aoe.vpcf", ParticleAttachment_t.PATTACH_ABSORIGIN, nearest);
  520. }
  521.  
  522. if (targetParticle !== undefined) {
  523. if (nearest === undefined && target === undefined) {
  524. ParticlesSDK.Destroy(targetParticle, true);
  525. targetParticle = undefined;
  526. } else {
  527. ParticlesSDK.SetControlPoint(targetParticle, 2, tinker.Position);
  528. ParticlesSDK.SetControlPoint(targetParticle, 6, new Vector3(1));
  529. ParticlesSDK.SetControlPoint(targetParticle, 7, (target || nearest).Position);
  530. }
  531. }
  532. }
  533.  
  534. if (heatShot.value) {
  535. if (!heat.IsReady || heatenemy === undefined && heatparticle !== undefined || currentheat !== heatenemy && heatparticle !== undefined) {
  536. if (heatparticle !== undefined) {
  537. ParticlesSDK.Destroy(heatparticle, true);
  538. }
  539.  
  540. heatparticle = undefined;
  541. currentheat = heatenemy;
  542. }
  543.  
  544. if (heatparticle === undefined && heatenemy !== undefined && heat.IsReady) {
  545. heatparticle = ParticlesSDK.Create("particles/units/heroes/hero_tinker/tinker_heat_seeking_missile.vpcf", ParticleAttachment_t.PATTACH_CUSTOMORIGIN);
  546. }
  547.  
  548. if (heatparticle !== undefined && heat.IsReady) {
  549. const pos = heatenemy.Position;
  550. pos.AddScalarZ(310);
  551. ParticlesSDK.SetControlPoint(heatparticle, 0, pos);
  552. ParticlesSDK.SetControlPoint(heatparticle, 1, pos);
  553. ParticlesSDK.SetControlPoint(heatparticle, 2, new Vector3(heatenemy.IdealSpeed));
  554. }
  555. }
  556.  
  557. if (drawStatus.value) {
  558. let text = ["TinkerCombo", `Current target: ${target !== undefined ? target.Name : "none"}`];
  559. const wSize = RendererSDK.WindowSize;
  560. let _a3 = text;
  561.  
  562. let _f3 = (val, i) => {
  563. RendererSDK.Text(val, new Vector2(wSize.x / 100 * statusPosX.value, wSize.y / 100 * statusPosY.value + i * textSize.value), new Color(255, 255, 255, 255), "Radiance", textSize.value);
  564. };
  565.  
  566. for (let _i3 = _a3.length; _i3--;) {
  567. _f3(_a3[_i3], _i3, _a3);
  568. }
  569. }
  570. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement