Advertisement
kolton

Untitled

Nov 3rd, 2011
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.50 KB | None | 0 0
  1. var _leaderName = "kolx-a", // ~~~~EDIT THIS~~~~CaSe SeNsItIvE~~~~
  2. _attack = true, // ~~~~EDIT THIS~~~~true OR false~~~~
  3. _messages = true, // white 'say' messages
  4. _openContainers = true; // open chests/racks/barrels/stashes/etc.
  5.  
  6. /*
  7. * Follower by kolton
  8. * To initiate the follow sequence make a TP and send command "1".
  9. *
  10. * Commands:
  11. * Main commands:
  12. * 1 - take leader's tp from town / move to leader's town
  13. * 2 - take leader's tp to town
  14. * 3 - town manager
  15. * c - get corpse
  16. * p - pick items
  17. * s - toggle stop
  18. * <charname> s - toggle stop <charname>
  19. * Attack:
  20. * a - attack toggle for all
  21. * <charname> a - attack toggle for <charname>
  22. * aon - attack on for all
  23. * <charname> aon - attack on for <charname>
  24. * aoff - attack off for all
  25. * <charname> aoff - attack off for <charname>
  26. * Teleport: *** characters without teleport skill will ignore tele command ***
  27. * tele - toggle teleport for all
  28. * <charname> tele - toggle teleport for <charname>
  29. * tele on - teleport on for all
  30. * <charname> tele on - teleport on for <charname>
  31. * tele off - teleport off for all
  32. * <charname> tele off - teleport off for <charname>
  33. * Skills: *** refer to skills.txt ***
  34. * all skill <skillid> - change skill for all. refer to skills.txt
  35. * <charname> skill <skillid> - change skill for <charname>
  36. * <class> skill <skillid> - change skill for all characters of certain class *** any part of class name will do *** for example: "sorc skill 36", "zon skill 0", "din skill 106"
  37. * Auras: *** refer to skills.txt ***
  38. * all aura <skillid> - change aura for all paladins
  39. * <charname> aura <skillid> - change aura for <charname>
  40. * Town:
  41. * a2-5 - move to appropriate act (after quest) !NOTE: Disable 'no sound' or game will crash!
  42. * talk <npc name> - talk to a npc in town
  43. * Misc.
  44. * wp - all players activate a nearby wp
  45. * <charname> wp - <charname> activates a nearby wp
  46. * bo - barbarian precast
  47. * <charname> tp - make a TP. Needs a TP tome if not using custom libs.
  48. * reload - reload script. Use only in case of emergency, or after editing character config.
  49. * quit - exit game
  50. */
  51.  
  52. var i, _leader, _leaderUnit, _split, _sender, _msg, _piece, _skill, _msgtick, _result, _charClass, _unit, _busy, _stop,
  53. _task = "";
  54.  
  55. function NT_Follower() {
  56. addEventListener("chatmsg", ChatCommands);
  57.  
  58. switch (me.classid) {
  59. case 0:
  60. _charClass = "amazon";
  61. break;
  62. case 1:
  63. _charClass = "sorceress";
  64. break;
  65. case 2:
  66. _charClass = "necromancer";
  67. break;
  68. case 3:
  69. _charClass = "paladin";
  70. break;
  71. case 4:
  72. _charClass = "barbarian";
  73. break;
  74. case 5:
  75. _charClass = "druid";
  76. break;
  77. case 6:
  78. _charClass = "assassin";
  79. break;
  80. }
  81.  
  82. _leader = GetLeader(_leaderName);
  83.  
  84. if (!_leader) {
  85. say("Leader not found or improperly configured file.");
  86. NTC_Delay(1000);
  87. quit();
  88. } else {
  89. FL_Say("Leader found.");
  90. }
  91.  
  92. NTC_PingDelay(200);
  93.  
  94. while (!NTC_InMyParty(_leaderName)) {
  95. NTC_Delay(500);
  96. }
  97.  
  98. say(" Partied.");
  99. NTTM_TownMove("portalspot");
  100.  
  101. while (NTC_InTown()) {
  102. if (_task !== "") {
  103. break;
  104. }
  105.  
  106. NTC_Delay(50);
  107. }
  108.  
  109. say(" Initiate loop.");
  110.  
  111. //_leaderUnit = GetLeaderUnit(_leaderName);
  112. _msgtick = getTickCount();
  113.  
  114. // =============
  115. // = main loop =
  116. // =============
  117.  
  118. while (NTC_InMyParty(_leaderName)) {
  119. if (me.mode === 0 || me.mode === 17) {
  120. say(" Reviving...");
  121. me.revive();
  122. delay(2000);
  123.  
  124. if (NTTM_TownMove("portalspot")) {
  125. say(" I'M ALIVE!!!");
  126. }
  127. }
  128.  
  129. while (_stop) {
  130. NTC_Delay(200);
  131. }
  132.  
  133. if (!NTC_InTown()) {
  134. while (!_leaderUnit) {
  135. if (getTickCount() - _msgtick > 3000) {
  136. FL_Say("Leader unit not found!");
  137.  
  138. _msgtick = getTickCount();
  139. }
  140.  
  141. _leaderUnit = GetLeaderUnit(_leaderName);
  142.  
  143. delay(500);
  144. }
  145.  
  146. if (getDistance(me, _leaderUnit) <= 50) {
  147. NTM_GetCloserInt(_leaderUnit);
  148. }
  149.  
  150. if (_attack) {
  151. ClearPosition(20);
  152. }
  153.  
  154. if (_leader.area !== me.area && !NTC_InTown()) {
  155. while (_leader.area === 0) {
  156. delay(100);
  157. }
  158.  
  159. _result = CheckExit(_leader, _leader.area);
  160.  
  161. if (_result) {
  162. switch (_result) {
  163. case 1:
  164. FL_Say("Taking stairs.");
  165. delay(500);
  166. NTM_TakeStairs(_leader.area);
  167. break;
  168. case 2:
  169. FL_Say("Using portal.");
  170. delay(500);
  171. NTM_UsePortal(null, _leader.area, null);
  172. break;
  173. case 3:
  174. FL_Say("Taking waypoint.");
  175. delay(500);
  176. NTM_TakeWaypoint(_leader.area);
  177. break;
  178. case 4:
  179. FL_Say("Special transit.");
  180. break;
  181. }
  182.  
  183. while (me.area === 0) {
  184. delay(100);
  185. }
  186.  
  187. _leaderUnit = GetLeaderUnit(_leaderName);
  188. }
  189. }
  190. }
  191.  
  192. if (NTC_InTown()) {
  193. NTTM_TownMove("portalspot");
  194.  
  195. while (NTC_InTown()) {
  196. if (_task !== "") {
  197. break;
  198. }
  199.  
  200. NTC_Delay(50);
  201. }
  202. }
  203.  
  204. // =========
  205. // = tasks =
  206. // =========
  207.  
  208. switch (_task) {
  209. case "scatter":
  210. NTM_MoveTo(me.x + rand(-8, 8), me.y + rand(-8, 8));
  211. break;
  212. case "wp":
  213. case (me.name + " wp"):
  214. if (NTC_InTown()) {
  215. break;
  216. }
  217.  
  218. _unit = NTC_GetUnit(2, "Waypoint");
  219.  
  220. if (_unit) {
  221. for (i = 0; i < 20; i += 1) {
  222. if (i % 5 === 0) {
  223. if (NTM_GetCloserInt(_unit)) {
  224. _unit.interact();
  225. }
  226. }
  227.  
  228. if (i % 5 === 4) {
  229. NTM_MoveTo(_unit.x + 6, _unit.y + 6);
  230. }
  231.  
  232. NTC_Delay(400);
  233.  
  234. if (getUIFlag(0x14)) {
  235. NTC_Delay(500);
  236. say(" Got the WP.");
  237. break;
  238. }
  239. }
  240. }
  241.  
  242. if (!getUIFlag(0x14)) {
  243. say(" Failed to get the WP.");
  244. }
  245.  
  246. me.cancel();
  247.  
  248. break;
  249. case "c": // get corpse
  250. NTT_GetCorpses();
  251. break;
  252. case "p": // pick items
  253. say(" Picking items.");
  254. NTSI_PickItems();
  255.  
  256. if (_openContainers) {
  257. OpenContainers(20);
  258. }
  259.  
  260. break;
  261. case "1": // take leader's tp to outside of town / change act if leader is in another town
  262. if (NTC_InTown() && NTC_InTown(_leader) && CheckLeaderAct(_leader) !== me.act) {
  263. say(" Going to leader's town.");
  264. NTTM_CheckAct(CheckLeaderAct(_leader));
  265. NTTM_TownMove("portalspot");
  266. } else if (NTC_InTown()) {
  267. say(" Taking portal to outside.");
  268. NTTM_CheckAct(CheckLeaderAct(_leader));
  269. NTTM_TownMove("portalspot");
  270. NTM_UsePortal(null, null, _leaderName);
  271. ClearPosition(20);
  272.  
  273. while (!GetLeaderUnit(_leaderName)) {
  274. ClearPosition(10);
  275. NTC_Delay(200);
  276. }
  277. }
  278.  
  279. break;
  280. case "2": // take leader's tp to town
  281. if (!NTC_InTown()) {
  282. delay(150);
  283. say(" Going to town.");
  284. NTM_UsePortal(null, null, _leaderName);
  285. }
  286.  
  287. break;
  288. case "3": // town manager
  289. if (NTC_InTown()) {
  290. say(" Running town manager.");
  291. NTTMGR_TownManager();
  292. NTTM_TownMove("portalspot");
  293. say(" Ready.");
  294. }
  295.  
  296. break;
  297. case "bo": // barbarian precast
  298. if (me.classid === 4) {
  299. NTP_DoPrecast(true);
  300. }
  301.  
  302. break;
  303. case "a2": // change act
  304. case "a3":
  305. case "a4":
  306. case "a5":
  307. ChangeAct(parseInt(_task[1], 10));
  308. break;
  309. case (me.name + " tp"):
  310. if (NTC_InTown()) {
  311. FL_Say("I'm in town.");
  312. break;
  313. }
  314.  
  315. if (!NTM_MakeTP()) {
  316. FL_Say("Out of scrolls!");
  317. }
  318.  
  319. break;
  320. }
  321.  
  322. if (_task.indexOf("talk") > -1) {
  323. Talk(_task.split(" ")[1]);
  324. }
  325.  
  326. _task = "";
  327.  
  328. NTC_Delay(25);
  329. }
  330.  
  331. return true;
  332. }
  333.  
  334. function ChatCommands(nick, msg) {
  335. if (nick === _leaderName) {
  336. // ============
  337. // = triggers =
  338. // ============
  339.  
  340. switch (msg) {
  341. case "s": // stop toggle
  342. case (me.name + " s"): // individual stop toggle
  343. if (_stop) {
  344. _stop = false;
  345.  
  346. say(" resuming");
  347. } else {
  348. _stop = true;
  349.  
  350. say(" stopping");
  351. }
  352.  
  353. return;
  354. case "quit": // exit game
  355. say(" Good riddance.");
  356. delay(500);
  357. quit();
  358. return;
  359. case "tele":
  360. case (me.name + " tele"):
  361. if (NTC_CheckSkill(54)) {
  362. if (!NTConfig_Teleport) {
  363. NTConfig_Teleport = true;
  364.  
  365. say(" Teleport on");
  366. } else {
  367. NTConfig_Teleport = false;
  368.  
  369. say(" Teleport off");
  370. }
  371. }
  372.  
  373. return;
  374. case "tele off":
  375. case (me.name + " tele off"):
  376. if (NTC_CheckSkill(54)) {
  377. NTConfig_Teleport = true;
  378.  
  379. say(" Teleport on");
  380. }
  381.  
  382. return;
  383. case "tele on":
  384. case (me.name + " tele on"):
  385. if (NTC_CheckSkill(54)) {
  386. NTConfig_Teleport = true;
  387.  
  388. say(" Teleport off");
  389. }
  390.  
  391. return;
  392. case "a": // attack toggle for everyone
  393. case (me.name + " a"): // individual attack toggle
  394. if (_attack) {
  395. _attack = false;
  396.  
  397. say(" Attack off");
  398. } else {
  399. _attack = true;
  400.  
  401. say(" Attack on");
  402. }
  403.  
  404. return;
  405. case "aoff": // attack off for everyone
  406. case (me.name + " aoff"): // individual attack off
  407. delay(150);
  408.  
  409. _attack = false;
  410.  
  411. say(" Attack off");
  412. return;
  413. case "aon": // attack on for everyone
  414. case (me.name + " aon"): // individual attack off
  415. delay(150);
  416.  
  417. _attack = true;
  418.  
  419. say(" Attack on");
  420. return;
  421. }
  422.  
  423. if (msg.indexOf(" skill ") > -1) {
  424. _piece = msg.split(" ")[0];
  425.  
  426. if (_charClass.indexOf(_piece) > -1 || _piece === me.name || _piece === "all") {
  427. _skill = parseInt(msg.split(" ")[2], 10);
  428.  
  429. if (NTC_CheckSkill(_skill)) {
  430. say(" Attack skill is " + _skill);
  431. NTConfig_AttackSkill[1] = _skill;
  432. NTConfig_AttackSkill[3] = _skill;
  433. NTA_Initialize();
  434. } else {
  435. say(" I don't have that skill.");
  436. }
  437. }
  438.  
  439. return;
  440. }
  441.  
  442. if (me.classid === 3 && msg.indexOf(" aura ")) {
  443. _piece = msg.split(" ")[0];
  444.  
  445. if (_piece === me.name || _piece === "all") {
  446. _skill = parseInt(msg.split(" ")[2], 10);
  447.  
  448. if (NTC_CheckSkill(_skill)) {
  449. say(" Active aura is " + _skill);
  450. NTC_PutSkill(_skill, 0);
  451. NTConfig_AttackSkill[2] = _skill;
  452. NTConfig_AttackSkill[4] = _skill;
  453. NTA_Initialize();
  454. } else {
  455. say(" I don't have that aura.");
  456. }
  457. }
  458.  
  459. return;
  460. }
  461.  
  462. if (_task === "") {
  463. _task = msg;
  464. } else {
  465. say("I'm busy with " + _task);
  466. }
  467. }
  468. }
  469.  
  470. // ===================
  471. // === functions =====
  472. // ===================
  473.  
  474. function GetLeaderUnit(name) {
  475. var _unit = NTC_GetUnit(0);
  476.  
  477. if (_unit) {
  478. do {
  479. if (_unit.name === name) {
  480. return _unit;
  481. }
  482. } while (_unit.getNext());
  483. }
  484.  
  485. return false;
  486. }
  487.  
  488. function GetLeader(name) {
  489. var _party = getParty();
  490.  
  491. if (_party) {
  492. do {
  493. if (_party.name === name) {
  494. return _party;
  495. }
  496. } while (_party.getNext());
  497. }
  498.  
  499. return false;
  500. }
  501.  
  502. function CheckLeaderAct(leader) {
  503. if (leader.area <= 39) {
  504. return 1;
  505. } else if(leader.area >= 40 && leader.area <= 74) {
  506. return 2;
  507. } else if(leader.area >= 75 && leader.area <= 102) {
  508. return 3;
  509. } else if(leader.area >= 103 && leader.area <= 108) {
  510. return 4;
  511. }
  512.  
  513. return 5;
  514. }
  515.  
  516. function CheckExit(leader, area) {
  517. var i,
  518. _unit, //= getPresetUnits(me.area, NTC_UNIT_TILE),
  519. _exits = getArea().exits;
  520.  
  521. for (i = 0; i < _exits.length; i += 1) {
  522. if (_exits[i].target === area && _exits[i].type === 2) {
  523. return 1;
  524. }
  525. }
  526.  
  527. if (NTC_InTown(leader)) {
  528. _unit = NTM_GetWaypointInt();
  529.  
  530. if (_unit) {
  531. return 3;
  532. }
  533. }
  534.  
  535. _unit = NTC_GetUnit(NTC_UNIT_OBJECT, "Portal");
  536.  
  537. if (_unit) {
  538. do {
  539. if (_unit.objtype === area) {
  540. return 2;
  541. }
  542. } while (_unit.getNext());
  543. }
  544.  
  545. if((me.area === 74 && area === 54 || me.area === 54 && area === 74)) { // arcane portal
  546. NTM_TakeUnit(NTC_UNIT_OBJECT, 298);
  547. return 4;
  548. }
  549.  
  550. if (me.area >= 66 && me.area <= 72 && area === 73) { // duriel's wall
  551. NTM_TakeUnit(NTC_UNIT_OBJECT, 100);
  552. return 4;
  553. }
  554.  
  555. return 0;
  556. }
  557.  
  558. function FL_Say(msg) {
  559. if (_messages) {
  560. say(msg);
  561. }
  562.  
  563. return true;
  564. }
  565.  
  566. function Talk(name) {
  567. if (!NTC_InTown()) {
  568. say(" I'm not in town!");
  569. return false;
  570. }
  571.  
  572. if (name) {
  573. name = name.toLowerCase();
  574. } else {
  575. say(" No NPC name given.");
  576. return false;
  577. }
  578.  
  579. var npc, names;
  580.  
  581. switch (me.act) {
  582. case 1:
  583. names = ["gheed", "charsi", "akara", "kashya", "cain", "warriv"];
  584. break;
  585. case 2:
  586. names = ["fara", "lysander", "greiz", "elzix", "jehryn", "meshif", "drognan", "atma", "cain"];
  587. break;
  588. case 3:
  589. names = ["alkor", "asheara", "ormus", "hratli", "cain"];
  590. break;
  591. case 4:
  592. names = ["halbu", "tyrael", "jamella", "cain"];
  593. break;
  594. case 5:
  595. names = ["larzuk", "malah", "qual-kehk", "anya", "nihlathak", "cain"];
  596. break;
  597. }
  598.  
  599. if (names.indexOf(name) < 0) {
  600. say(" Invalid NPC.");
  601. return false;
  602. }
  603.  
  604. if (!NTTM_TownMove(name === "jehryn" ? "palace" : name)) {
  605. NTTM_TownMove("portalspot");
  606. say(" Failed to move to town spot.");
  607. return false;
  608. }
  609.  
  610. npc = NTC_GetUnit(1);
  611.  
  612. if (npc) {
  613. do {
  614. if (npc.name.replace(/ /g, "").toLowerCase().indexOf(name) > -1) {
  615. if (NTT_DoInteract(npc)) {
  616. me.cancel();
  617. }
  618.  
  619. NTTM_TownMove("portalspot");
  620. say(" Done talking.");
  621. return true;
  622. }
  623. } while (npc.getNext());
  624. }
  625.  
  626. say(" NPC not found.");
  627. NTTM_TownMove("portalspot");
  628.  
  629. return false;
  630. }
  631.  
  632. function ChangeAct(act) {
  633. var npc, portal, preArea;
  634.  
  635. preArea = me.area;
  636.  
  637. switch (act) {
  638. case 2:
  639. if (me.area >= 40) {
  640. break;
  641. }
  642.  
  643. NTTM_TownMove("warriv");
  644.  
  645. npc = NTC_GetUnit(1, 155);
  646.  
  647. if (npc) {
  648. if (NTT_DoInteract(npc)) {
  649. npc.useMenu(0x0D36);
  650. }
  651. }
  652.  
  653. break;
  654. case 3:
  655. if (me.area >= 75) {
  656. break;
  657. }
  658.  
  659. NTTM_TownMove("palace");
  660.  
  661. npc = NTC_GetUnit(1, 201);
  662.  
  663. if (npc) {
  664. if (NTT_DoInteract(npc)) {
  665. me.cancel();
  666. }
  667. }
  668.  
  669. NTTM_TownMove("meshif");
  670.  
  671. npc = NTC_GetUnit(1, 210);
  672.  
  673. if (npc) {
  674. if (NTT_DoInteract(npc)) {
  675. npc.useMenu(0x0D38);
  676. }
  677. }
  678.  
  679. break;
  680. case 4:
  681. if (me.area >= 103) {
  682. break;
  683. }
  684.  
  685. if (NTC_InTown()) {
  686. NTTM_TownMove("cain");
  687.  
  688. npc = NTC_GetUnit(1, 245);
  689.  
  690. if (npc) {
  691. if (NTT_DoInteract(npc)) {
  692. me.cancel();
  693. }
  694. }
  695.  
  696. NTTM_TownMove("portalspot");
  697. }
  698.  
  699. if (me.area !== 102) {
  700. NTM_UsePortal(null, 102, null);
  701. }
  702.  
  703. target = NTC_GetUnit(2, 342);
  704.  
  705. NTM_MoveTo(target.x - 3, target.y - 1);
  706. NTM_TakeUnit(NTC_UNIT_OBJECT, 342);
  707.  
  708. break;
  709. case 5:
  710. if (me.area >= 109) {
  711. break;
  712. }
  713.  
  714. NTTM_TownMove("tyrael");
  715.  
  716. npc = NTC_GetUnit(1, 367);
  717.  
  718. if(npc) {
  719. if (NTT_DoInteract(npc)) {
  720. me.cancel();
  721. }
  722.  
  723. NTM_TakeUnit(2, 566);
  724. }
  725.  
  726. break;
  727. }
  728.  
  729. NTC_PingDelay(2000);
  730.  
  731. while (!me.area) {
  732. NTC_Delay(500);
  733. }
  734.  
  735. if (me.area === preArea) {
  736. me.cancel();
  737. NTTM_TownMove("portalspot");
  738. FL_Say("Act change failed.");
  739.  
  740. return;
  741. }
  742.  
  743. NTTM_TownMove("portalspot");
  744. FL_Say("Act change successful.");
  745.  
  746. if (act === 2) {
  747. say("Don't forget to talk to Drognan after getting the Viper Amulet!");
  748. }
  749. }
  750.  
  751. function ClearPosition(range) {
  752. var i, orgx, orgy, monList, skipList, target, result,
  753. tele = NTC_CheckSkill(54),
  754. attackcount = 0;
  755.  
  756. if (NTConfig_AttackSkill[1] < 0 || NTConfig_AttackSkill[3] < 0) {
  757. print("ΓΏc1Set your attacks, noob!");
  758. return false;
  759. }
  760.  
  761. if (!arguments.length) {
  762. range = 20;
  763. }
  764.  
  765. orgx = me.x;
  766. orgy = me.y;
  767. skipList = [];
  768.  
  769. MainLoop : while (_attack && attackcount < 300) {
  770. if (me.mode === 0 || me.mode === 17) {
  771. return false;
  772. }
  773.  
  774. if (attackcount % 5 === 0) { // testing
  775. monList = [];
  776. target = NTC_GetUnit(NTC_UNIT_MONSTER, null, MODE_ALIVE);
  777.  
  778. if (target) {
  779. do {
  780. if (skipList.indexOf(target.gid) === -1 && getDistance(orgx, orgy, target.x, target.y) <= range && NTA_IsValidTarget(target)) {
  781. monList.push(copyUnit(target));
  782. }
  783. } while (target.getNext());
  784. }
  785. }
  786.  
  787. if (monList.length === 0) {
  788. break;
  789. }
  790.  
  791. monList.sort(SortMonsters);
  792.  
  793. target = monList[0];
  794.  
  795. if (NTA_IsValidTarget(target) && (!checkCollision(me, target, 0x1) || tele)) {
  796. result = NTA_Attack(target, attackcount % 30 === 0);
  797.  
  798. switch (result) {
  799. case 1:
  800. skipList.push(target.gid);
  801. monList.shift();
  802. break;
  803. case 2:
  804. case 3:
  805. attackcount += 1;
  806. break;
  807. default:
  808. return false;
  809. }
  810. } else {
  811. skipList.push(target.gid);
  812. monList.shift();
  813. }
  814. }
  815.  
  816. if (attackcount > 0) {
  817. switch (me.classid) {
  818. case 2:
  819. NTA_RaiseArmy();
  820. break;
  821. }
  822.  
  823. NTT_ClearBelt();
  824. PickPotions(range);
  825.  
  826. NTP_DoPrecast(false);
  827. }
  828.  
  829. return true;
  830. }
  831.  
  832. function SortMonsters(unitA, unitB) {
  833. var monID = [58, 59, 60, 61, 62, 101, 102, 103, 104, 105, 229, 278, 279, 280, 281, 282, 312, 645, 646, 647, 667, 668, 669, 670];
  834.  
  835. if (monID.indexOf(unitA.classid) > -1) {
  836. return -1;
  837. } else if (getDistance(me.x, me.y, unitA.x, unitA.y) < getDistance(me.x, me.y, unitB.x, unitB.y)) {
  838. return -1;
  839. }
  840.  
  841. return 1;
  842. }
  843.  
  844. function PickPotions(range) {
  845. var i, item, itemList, classid, name;
  846.  
  847. item = NTC_GetUnit(4);
  848.  
  849. if (!item) {
  850. return false;
  851. }
  852.  
  853. itemList = [];
  854.  
  855. do {
  856. if ((item.mode === 3 || item.mode === 5) && item.itemType >= 76 && item.itemType <= 78 && getDistance(me.x, me.y, item.x, item.y) <= range) {
  857. if (NTSI_CheckItem(item)) {
  858. itemList.push(copyUnit(item));
  859. }
  860. }
  861. } while (item.getNext());
  862.  
  863. while (itemList.length > 0) {
  864. //itemList.sort(NTSI_SortItems);
  865.  
  866. item = itemList.shift();
  867. classid = item.classid;
  868. name = item.name;
  869.  
  870. if (item && !NTSI_IsLimitedItemInt(item) && NTSI_PickUpItemInt(item)) {
  871. switch(classid) {
  872. case 515: // Rejuvenation Potion
  873. case 516: // Full Rejuvenation Potion
  874. print("Picked up "+ NTC_ItemQualityToD2Color[9] + name);
  875. break;
  876. case 587: // Minor Healing Potion
  877. case 588: // Light Healing Potion
  878. case 589: // Healing Potion
  879. case 590: // Greater Healing Potion
  880. case 591: // Super Healing Potion
  881. print("Picked up "+ NTC_ItemQualityToD2Color[10] + name);
  882. break;
  883. case 592: // Minor Mana Potion
  884. case 593: // Light Mana Potion
  885. case 594: // Mana Potion
  886. case 595: // Greater Mana Potion
  887. case 596: // Super Mana Potion
  888. print("Picked up "+ NTC_ItemQualityToD2Color[4] + name);
  889. break;
  890. }
  891. }
  892. }
  893.  
  894. return true;
  895. }
  896.  
  897. function OpenContainers(range) {
  898. var i, strings, unit, orgX, orgY;
  899.  
  900. orgX = me.x;
  901. orgY = me.y;
  902. strings = ["chest", "LargeUrn", "Chest3", "Urn"];
  903.  
  904. for (i = 0; i < strings.length; i += 1) {
  905. unit = NTC_GetUnit(2, strings[i]);
  906.  
  907. if (unit) {
  908. do {
  909. if (getDistance(orgX, orgY, unit.x, unit.y) <= range && !checkCollision(me, unit, 0x1) && NTC_OpenChest(unit)) {
  910. NTSI_PickItems();
  911. }
  912. } while (unit.getNext());
  913. }
  914. }
  915. }
  916.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement