DraculaxAOE

NTCommon.ntl

Nov 5th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.55 KB | None | 0 0
  1. Include("libs/common/NTColorConverter.ntl");
  2. // Public D2BS constants
  3. Include("NTBot/char_configs/NTConfig__Global.ntl");
  4. // Character Class
  5. const NTC_CHAR_CLASS_AMAZON = 0;
  6. const NTC_CHAR_CLASS_SORCERESS = 1;
  7. const NTC_CHAR_CLASS_NECROMANCER = 2;
  8. const NTC_CHAR_CLASS_PALADIN = 3;
  9. const NTC_CHAR_CLASS_BARBARIAN = 4;
  10. const NTC_CHAR_CLASS_DRUID = 5;
  11. const NTC_CHAR_CLASS_ASSASSIN = 6;
  12.  
  13. // Act 1 NPCs
  14. const NTC_NPC_ID_AKARA = 148;
  15. const NTC_NPC_ID_WARRIV_ACT_1 = 155;
  16. const NTC_NPC_ID_CHARSI = 154;
  17. const NTC_NPC_ID_GHEED = 147;
  18. const NTC_NPC_ID_KASHYA = 150;
  19. const NTC_NPC_ID_CAIN_TRISTRAM = 146;
  20. const NTC_NPC_ID_CAIN_ACT_1 = 244;
  21.  
  22. // Act 2 NPCs
  23. const NTC_NPC_ID_FARA = 178;
  24. const NTC_NPC_ID_LYSANDER = 202;
  25. const NTC_NPC_ID_GREIZ = 198;
  26. const NTC_NPC_ID_ELZIX = 199;
  27. const NTC_NPC_ID_MESHIF_ACT_2 = 210;
  28. const NTC_NPC_ID_DROGNAN = 177;
  29. const NTC_NPC_ID_ATMA = 176;
  30. const NTC_NPC_ID_WARRIV_ACT_2 = 175;
  31. const NTC_NPC_ID_CAIN_ACT_2 = 245;
  32. const NTC_NPC_ID_JERHYN = 201;
  33. const NTC_NPC_ID_TYRAEL_ACT_2 = 251;
  34.  
  35. // Act 3 NPCs
  36. const NTC_NPC_ID_MESHIF_ACT_3 = 264;
  37. const NTC_NPC_ID_CAIN_ACT_3 = 246;
  38. const NTC_NPC_ID_ALKOR = 254;
  39. const NTC_NPC_ID_ASHEARA = 252;
  40. const NTC_NPC_ID_ORMUS = 255;
  41. const NTC_NPC_ID_HRATLI = 253;
  42.  
  43. // Act 4 NPCs
  44. const NTC_NPC_ID_CAIN_ACT_4 = 265;
  45. const NTC_NPC_ID_HALBU = 257;
  46. const NTC_NPC_ID_TYRAEL_ACT_4 = 367;
  47. const NTC_NPC_ID_JAMELLA = 405;
  48.  
  49. // Act 5 NPCs
  50. const NTC_NPC_ID_CAIN_ACT_5 = 520;
  51. const NTC_NPC_ID_TYRAEL_ACT_5 = 521;
  52. const NTC_NPC_ID_LARZUK = 511;
  53. const NTC_NPC_ID_ANYA_FROZEN_RIVER = 558;
  54. const NTC_NPC_ID_ANYA_TOWN = 512;
  55. const NTC_NPC_ID_MALAH = 513;
  56. const NTC_NPC_ID_QUALKEHK = 515;
  57. const NTC_NPC_ID_NIHLATHAK_TOWN = 514;
  58. const NTC_NPC_ID_NIHLATHAK_HALLS_OF_VAUGHT = 526;
  59.  
  60. // UNIT types
  61. const NTC_UNIT_PLAYER = 0;
  62. const NTC_UNIT_NPC = 1;
  63. const NTC_UNIT_MERC = NTC_UNIT_NPC;
  64. const NTC_UNIT_MONSTER = NTC_UNIT_NPC;
  65. const NTC_UNIT_OBJECT = 2;
  66. const NTC_UNIT_MISSILE = 3;
  67. const NTC_UNIT_ITEM = 4;
  68. const NTC_UNIT_TILE = 5;
  69. const NTC_UNIT_STASH = 267;
  70. const NTC_UNIT_CUBE = 549;
  71.  
  72. const NTC_AREA_ID_ACT_1 = 1;
  73. const NTC_AREA_ID_ACT_2 = 40;
  74. const NTC_AREA_ID_ACT_3 = 75;
  75. const NTC_AREA_ID_ACT_4 = 103;
  76. const NTC_AREA_ID_ACT_5 = 109;
  77.  
  78. // COLOR types
  79. const NTC_COLOR_BASE_WHITE = 0;
  80. const NTC_COLOR_BASE_RED = 1;
  81. const NTC_COLOR_BASE_GREEN = 2;
  82. const NTC_COLOR_BASE_BLUE = 3;
  83. const NTC_COLOR_BASE_GOLD = 4;
  84. const NTC_COLOR_BASE_GRAY = 5;
  85. const NTC_COLOR_BASE_BLACK = 6;
  86. const NTC_COLOR_BASE_GOLD2 = 7;
  87. const NTC_COLOR_BASE_ORANGE = 8;
  88. const NTC_COLOR_BASE_YELLOW = 9;
  89.  
  90. const NTC_HAND_RIGHT = 0;
  91. const NTC_HAND_LEFT = 1;
  92.  
  93. const NTC_CLICK_LDOWN = 0;
  94. const NTC_CLICK_LHOLD = 1;
  95. const NTC_CLICK_LUP = 2;
  96. const NTC_CLICK_RDOWN = 3;
  97. const NTC_CLICK_RHOLD = 4;
  98. const NTC_CLICK_RUP = 5;
  99.  
  100. const NTC_SHIFT_NONE = 0;
  101. const NTC_SHIFT_HOLD = 1;
  102.  
  103. const NTC_LOG_COMMON = 0;
  104. const NTC_LOG_ITEM = 1;
  105.  
  106. const NTC_DELAY_FRAME = 40;
  107.  
  108. var NTC_ItemQualityToName = new Array(9);
  109. NTC_ItemQualityToName[0] = "None";
  110. NTC_ItemQualityToName[1] = "Low Quality";
  111. NTC_ItemQualityToName[2] = "Normal";
  112. NTC_ItemQualityToName[3] = "Superior";
  113. NTC_ItemQualityToName[4] = "Magic";
  114. NTC_ItemQualityToName[5] = "Set";
  115. NTC_ItemQualityToName[6] = "Rare";
  116. NTC_ItemQualityToName[7] = "Unique";
  117. NTC_ItemQualityToName[8] = "Crafted";
  118.  
  119. var NTC_ItemQualityToD2Color = new Array(11);
  120. NTC_ItemQualityToD2Color[0] = COLOR_0;
  121. NTC_ItemQualityToD2Color[1] = COLOR_0;
  122. NTC_ItemQualityToD2Color[2] = COLOR_0;
  123. NTC_ItemQualityToD2Color[3] = COLOR_0;
  124. NTC_ItemQualityToD2Color[4] = COLOR_3;
  125. NTC_ItemQualityToD2Color[5] = COLOR_2;
  126. NTC_ItemQualityToD2Color[6] = COLOR_9;
  127. NTC_ItemQualityToD2Color[7] = COLOR_4;
  128. NTC_ItemQualityToD2Color[8] = COLOR_8;
  129. NTC_ItemQualityToD2Color[9] = COLOR_11;
  130. NTC_ItemQualityToD2Color[10] = COLOR_1;
  131.  
  132. var NTC_ItemQualityToMGRColor = new Array(9);
  133. NTC_ItemQualityToMGRColor[0] = COLOR_6;
  134. NTC_ItemQualityToMGRColor[1] = COLOR_6;
  135. NTC_ItemQualityToMGRColor[2] = COLOR_6;
  136. NTC_ItemQualityToMGRColor[3] = COLOR_6;
  137. NTC_ItemQualityToMGRColor[4] = COLOR_3;
  138. NTC_ItemQualityToMGRColor[5] = COLOR_2;
  139. NTC_ItemQualityToMGRColor[6] = COLOR_9;
  140. NTC_ItemQualityToMGRColor[7] = COLOR_4;
  141. NTC_ItemQualityToMGRColor[8] = COLOR_8;
  142.  
  143. // *** Global vars ***
  144. var isBusyChest = false;
  145. var isBusyOpenChestsInAreaNear = false;
  146.  
  147. function NTC_IncludeConfig(filepath, createCharConfigsOverride)
  148. {
  149.  
  150. var _configname;
  151. var _fullconfigname;
  152. var _shortconfigname;
  153. var _configfile;
  154. var _customcharconfig;
  155. var _defaultcharconfig;
  156.  
  157. if(arguments.length > 1)
  158. createCharConfigs = createCharConfigsOverride;
  159.  
  160. switch(me.classid)
  161. {
  162. case NTC_CHAR_CLASS_AMAZON:
  163. _fullconfigname = "NTConfig_Amazon_" + me.charname + ".ntl";
  164. _shortconfigname = "NTConfig_Amazon.ntl";
  165. break;
  166. case NTC_CHAR_CLASS_SORCERESS:
  167. _fullconfigname = "NTConfig_Sorceress_" + me.charname + ".ntl";
  168. _shortconfigname = "NTConfig_Sorceress.ntl";
  169. break;
  170. case NTC_CHAR_CLASS_NECROMANCER:
  171. _fullconfigname = "NTConfig_Necromancer_" + me.charname + ".ntl";
  172. _shortconfigname = "NTConfig_Necromancer.ntl";
  173. break;
  174. case NTC_CHAR_CLASS_PALADIN:
  175. _fullconfigname = "NTConfig_Paladin_" + me.charname + ".ntl";
  176. _shortconfigname = "NTConfig_Paladin.ntl";
  177. break;
  178. case NTC_CHAR_CLASS_BARBARIAN:
  179. _fullconfigname = "NTConfig_Barbarian_" + me.charname + ".ntl";
  180. _shortconfigname = "NTConfig_Barbarian.ntl";
  181. break;
  182. case NTC_CHAR_CLASS_DRUID:
  183. _fullconfigname = "NTConfig_Druid_" + me.charname + ".ntl";
  184. _shortconfigname = "NTConfig_Druid.ntl";
  185. break;
  186. case NTC_CHAR_CLASS_ASSASSIN:
  187. _fullconfigname = "NTConfig_Assassin_" + me.charname + ".ntl";
  188. _shortconfigname = "NTConfig_Assassin.ntl";
  189. break;
  190. }
  191.  
  192. switch(filepath) {
  193. case "NTBot/char_configs":
  194. {
  195. _configname = _fullconfigname;
  196. _configfile = FileOpen(filepath + "/" + _fullconfigname, 0);
  197. if(_configfile) //Char config exists - Good
  198. _configfile.Close();
  199. else if(createCharConfigs && filepath == "NTBot/char_configs") {
  200. createCharConfigs = false;
  201. _customcharconfig = FileOpen("NTBot/char_configs/" + _fullconfigname, 1);
  202. _defaultcharconfig = FileOpen("NTBot/char_configs/" + _shortconfigname, 0);
  203. while(!_defaultcharconfig.eof) {
  204. _customcharconfig.WriteLine(_defaultcharconfig.ReadLine());
  205. }
  206. _customcharconfig.Close();
  207. _defaultcharconfig.Close();
  208. while(me.ingame) {
  209. Print(COLOR_14 + "===========================================================");
  210. Print(COLOR_14 + "================> " + COLOR_2 + "Auto Character Config Creation Complete" + COLOR_14 + "<================");
  211. Print(COLOR_14 + "===========================================================");
  212. Print(COLOR_14 + "=============> " + COLOR_2 + "Press Stop on Manager & Edit Character Config" + COLOR_14 + " <=============");
  213. Print(COLOR_14 + "===========================================================");
  214. Delay(Random(8000,11000))
  215. }
  216. }
  217. else {
  218. _configname = _shortconfigname;
  219. if(filepath == "NTBot/char_configs/") {
  220. Print(COLOR_14 + "===========================================================");
  221. Print(COLOR_14 + "=====> " + COLOR_3 + "DEFAULT CONFIG LOADED " + COLOR_14 + " <=====");
  222. Print(COLOR_14 + "===========================================================");
  223. }
  224. }
  225. }
  226. break;
  227. case "NTRush/rush_configs":
  228. {
  229. _configname = _fullconfigname;
  230. _configfile = FileOpen(filepath + "/" + _fullconfigname, 0);
  231. if(_configfile) //Char config exists - Good
  232. _configfile.Close();
  233. else if(createCharConfigs && filepath == "NTRush/rush_configs") {
  234. createCharConfigs = false;
  235. _customcharconfig = FileOpen(filepath + "/" + _fullconfigname, 1);
  236. _defaultcharconfig = FileOpen(filepath + "/" + _shortconfigname, 0);
  237. while(!_defaultcharconfig.eof) {
  238. _customcharconfig.WriteLine(_defaultcharconfig.ReadLine());
  239. }
  240. _customcharconfig.Close();
  241. _defaultcharconfig.Close();
  242. while(me.ingame) {
  243. Print(COLOR_14 + "===========================================================");
  244. Print(COLOR_14 + "================> " + COLOR_2 + "Auto Character Config Creation Complete" + COLOR_14 + "<================");
  245. Print(COLOR_14 + "===========================================================");
  246. Print(COLOR_14 + "=============> " + COLOR_2 + "Press Stop on Manager & Edit Character Config" + COLOR_14 + " <=============");
  247. Print(COLOR_14 + "===========================================================");
  248. Delay(Random(8000,11000))
  249. }
  250. }
  251. else {
  252. _configname = _shortconfigname;
  253. if(filepath == "NTRush/rush_configs") {
  254. Print(COLOR_14 + "===========================================================");
  255. Print(COLOR_14 + "=====> " + COLOR_3 + "DEFAULT RUSH CONFIG LOADED " + COLOR_14 + " <=====");
  256. Print(COLOR_14 + "===========================================================");
  257. }
  258. }
  259. }
  260. break;
  261. case "NTMap/char_configs":
  262. {
  263. _configname = _fullconfigname;
  264. _configfile = FileOpen(filepath + "/" + _fullconfigname, 0);
  265. if(_configfile) //Char config exists - Good
  266. _configfile.Close();
  267. else if(createCharConfigs && filepath == "NTMap/char_configs") {
  268. createCharConfigs = false;
  269. _customcharconfig = FileOpen(filepath + "/" + _fullconfigname, 1);
  270. _defaultcharconfig = FileOpen(filepath + "/" + _shortconfigname, 0);
  271. while(!_defaultcharconfig.eof) {
  272. _customcharconfig.WriteLine(_defaultcharconfig.ReadLine());
  273. }
  274. _customcharconfig.Close();
  275. _defaultcharconfig.Close();
  276. while(me.ingame) {
  277. Print(COLOR_14 + "===========================================================");
  278. Print(COLOR_14 + "================> " + COLOR_2 + "Auto Character Config Creation Complete" + COLOR_14 + "<================");
  279. Print(COLOR_14 + "===========================================================");
  280. Print(COLOR_14 + "=============> " + COLOR_2 + "Press Stop on Manager & Edit Character Config" + COLOR_14 + " <=============");
  281. Print(COLOR_14 + "===========================================================");
  282. Delay(Random(8000,11000))
  283. }
  284. }
  285. else {
  286. _configname = _shortconfigname;
  287. if(filepath == "NTMap/char_configs") {
  288. Print(COLOR_14 + "===========================================================");
  289. Print(COLOR_14 + "=====> " + COLOR_3 + "DEFAULT MAP CONFIG LOADED " + COLOR_14 + " <=====");
  290. Print(COLOR_14 + "===========================================================");
  291. }
  292. }
  293. }
  294. break;
  295. }
  296. Include(filepath + "/NTConfig.ntl");
  297. Include(filepath + "/" + _configname);
  298. }
  299.  
  300. function NTC_IncludeLibs()
  301. {
  302. Include("libs/common/NTAttack.ntl");
  303. Include("libs/common/NTCubing.ntl");
  304. Include("libs/common/NTItemParser.ntl");
  305. Include("libs/common/NTMove.ntl");
  306. Include("libs/common/NTPrecast.ntl");
  307. Include("libs/common/NTSnagIt.ntl");
  308. Include("libs/common/NTTown.ntl");
  309. Include("libs/common/NTTownManager.ntl");
  310. Include("libs/common/NTTownMove.ntl");
  311. Include("libs/common/MyCatchShrine.ntl");
  312. Include("libs/common/NTUtilities.ntl");
  313. Include("libs/common/NTTools.ntl");
  314. Include("libs/common/NTRunewords.ntl");
  315. Include("libs/common/LazyManCoding.ntl");
  316. //Include("libs/common/NTVoyage.ntl");
  317. Include("libs/common/NTItemlogger.ntl");
  318. Include("libs/common/NTColorConverter.ntl");
  319.  
  320.  
  321. switch (me.classid) {
  322. case NTC_CHAR_CLASS_AMAZON:
  323. Include("libs/common/NTAttackAmazon.ntl");
  324. break;
  325. case NTC_CHAR_CLASS_ASSASSIN:
  326. Include("libs/common/NTAttackAssassin.ntl");
  327. break;
  328. case NTC_CHAR_CLASS_BARBARIAN:
  329. Include("libs/common/NTAttackBarbarian.ntl");
  330. break;
  331. case NTC_CHAR_CLASS_DRUID:
  332. Include("libs/common/NTAttackDruid.ntl");
  333. break;
  334. case NTC_CHAR_CLASS_NECROMANCER:
  335. Include("libs/common/NTAttackNecromancer.ntl");
  336. break;
  337. case NTC_CHAR_CLASS_PALADIN:
  338. Include("libs/common/NTAttackPaladin.ntl");
  339. break;
  340. case NTC_CHAR_CLASS_SORCERESS:
  341. Include("libs/common/NTAttackSorceress.ntl");
  342. break;
  343. }
  344. }
  345.  
  346. function NTC_CastSkill(skillid, usehand, x, y)
  347. {
  348. var _hand;
  349. var _shift;
  350.  
  351. if(arguments.length < 1)
  352. return false;
  353.  
  354. if(arguments.length == 1)
  355. {
  356. _hand = NTC_CLICK_RDOWN;
  357. _shift = NTC_SHIFT_NONE;
  358. usehand = NTC_HAND_RIGHT;
  359. }
  360. else
  361. {
  362. if(usehand == NTC_HAND_RIGHT)
  363. {
  364. _hand = NTC_CLICK_RDOWN;
  365. _shift = NTC_SHIFT_NONE;
  366. }
  367. else if(usehand == NTC_HAND_LEFT)
  368. {
  369. _hand = NTC_CLICK_LDOWN;
  370. _shift = NTC_SHIFT_NONE;
  371. }
  372. else
  373. {
  374. _hand = NTC_CLICK_LDOWN;
  375. _shift = NTC_SHIFT_HOLD;
  376. usehand = NTC_HAND_LEFT;
  377. }
  378. }
  379.  
  380. if(NTC_PutSkill(skillid, usehand))
  381. {
  382. var i, n;
  383. var _mode;
  384.  
  385. if(!NTC_ClearCursor())
  386. return false;
  387.  
  388. for(i = 0 ; i < 5 ; i++)
  389. {
  390. switch(arguments.length)
  391. {
  392. case 1:
  393. case 2:
  394. ClickMap(_hand, _shift, me.x, me.y);
  395. break;
  396. case 3:
  397. if(!ClickMap(_hand, _shift, x))
  398. {
  399. NTC_Delay(NTC_DELAY_FRAME);
  400. return false;
  401. }
  402. break;
  403. default:
  404. ClickMap(_hand, _shift, x, y);
  405. break;
  406. }
  407.  
  408. for(n = 0 ; n < 4 ; n++)
  409. {
  410. NTC_Delay(NTC_DELAY_FRAME);
  411.  
  412. _mode = me.mode;
  413. if(_mode == 7 || _mode == 8 || (_mode >= 10 && _mode <= 16) || _mode == 18)
  414. {
  415. NTC_Delay(NTC_DELAY_FRAME);
  416. break;
  417. }
  418. }
  419.  
  420. ClickMap(_hand+2, NTC_SHIFT_NONE, null);
  421.  
  422. if(n < 4)
  423. {
  424. for(i = 0 ; i < 100 ; i++)
  425. {
  426. NTC_Delay(20);
  427.  
  428. if(me.mode != _mode)
  429. break;
  430. }
  431.  
  432. return true;
  433. }
  434.  
  435. NTC_Delay(NTC_DELAY_FRAME);
  436. }
  437. }
  438.  
  439. return false;
  440. }
  441.  
  442. function NTC_PutSkill(skillid, hand)
  443. {
  444. if(me.GetSkill(hand) == skillid)
  445. return true;
  446.  
  447. if(GetBaseStat("skills.txt", skillid, 182))
  448. return false;
  449.  
  450. if(NTC_GetSkillLevel(skillid) < 1)
  451. return false;
  452.  
  453. return me.SetSkill(skillid, hand);
  454. }
  455.  
  456. function NTC_GetSkillLevel(skillid)
  457. {
  458. var _level = me.GetSkill(skillid, true);
  459.  
  460. if(_level != null)
  461. return _level;
  462.  
  463. return 0;
  464. }
  465.  
  466. function NTC_SwapWeapons(switchto)
  467. {
  468. if(arguments.length > 0 && me.weaponstab == switchto)
  469. return true;
  470.  
  471. NTC_PingDelay(200);
  472.  
  473. if(!NTC_WaitIdleMode())
  474. return false;
  475.  
  476. return me.SwapWeapons();
  477. }
  478.  
  479. function NTC_DoClick(button, shift, x, y)
  480. {
  481. if(arguments.length < 2)
  482. return false;
  483.  
  484. if(button != NTC_CLICK_LDOWN)
  485. button = NTC_CLICK_RDOWN;
  486.  
  487. switch(arguments.length)
  488. {
  489. case 2:
  490. ClickMap(button, shift, me.x, me.y);
  491. break;
  492. case 3:
  493. if(!ClickMap(button, shift, x))
  494. return false;
  495. break;
  496. default:
  497. ClickMap(button, shift, x, y);
  498. break;
  499. }
  500.  
  501. NTC_Delay(200);
  502.  
  503. ClickMap(button+2, NTC_SHIFT_NONE, null);
  504.  
  505. return true;
  506. }
  507.  
  508. function NTC_MyGold()
  509. {
  510. return me.GetStat(14) + me.GetStat(15);
  511. }
  512.  
  513. function NTC_MyGoldCarry()
  514. {
  515. return me.GetStat(14);
  516. }
  517.  
  518. function NTC_StashGoldFull() //1.13 fix
  519. {
  520. return (me.GetStat(15) == 2500000);
  521. }
  522.  
  523. function NTC_CharGoldFull()
  524. {
  525. return (me.GetStat(14) >= (me.GetStat(12)*10000));
  526. }
  527.  
  528. function NTC_CheckOwner(object, ownername)
  529. {
  530. var _owner;
  531.  
  532. if(!object)
  533. return false;
  534.  
  535. _owner = object.GetParent();
  536. if(!_owner)
  537. return false;
  538.  
  539. if(arguments.length < 2)
  540. {
  541. if(_owner == me.name || _owner.name == me.name)
  542. return true;
  543. }
  544. else
  545. {
  546. if(_owner == ownername || _owner.name == ownername)
  547. return true;
  548. }
  549.  
  550. return false;
  551. }
  552.  
  553. function NTC_ItemToCursor(item)
  554. {
  555. if(me.itemoncursor)
  556. return true;
  557.  
  558. for(var i = 0 ; i < 80 ; i++)
  559. {
  560. if((i % 40) == 0)
  561. me.ClickItem(0, item);
  562.  
  563. NTC_Delay(100);
  564.  
  565. if(me.itemoncursor)
  566. {
  567. NTC_PingDelay(200);
  568.  
  569. return true;
  570. }
  571. }
  572.  
  573. return false;
  574. }
  575.  
  576. function NTC_ClearCursor()
  577. {
  578. if(!me.itemoncursor)
  579. return true;
  580.  
  581. for(var i = 0 ; i < 40 ; i++)
  582. {
  583. if((i % 20) == 0)
  584. NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE);
  585.  
  586. NTC_Delay(100);
  587.  
  588. if(!me.itemoncursor)
  589. return true;
  590. }
  591.  
  592. return false;
  593. }
  594.  
  595. function NTC_GetMerc()
  596. {
  597. var _merc;
  598.  
  599. _merc = me.GetMerc();
  600.  
  601. if(_merc)
  602. {
  603. if(_merc.hp > 0 && _merc.mode != 0 && _merc.mode != 12)
  604. return _merc;
  605. }
  606.  
  607. return null;
  608. }
  609.  
  610. function NTC_GetSpecialChest()
  611. {
  612. var _chest;
  613.  
  614. _chest = NTC_FindUnit(NTC_UNIT_OBJECT, GetLocaleString(3260));
  615.  
  616. if(_chest)
  617. {
  618. do
  619. {
  620. switch(_chest.classid)
  621. {
  622. case 354:
  623. case 355:
  624. case 356:
  625. case 397:
  626. case 405:
  627. case 406:
  628. case 407:
  629. case 455:
  630. return _chest;
  631. }
  632. } while(_chest.GetNext());
  633. }
  634.  
  635. return null;
  636. }
  637.  
  638. function NTC_OpenChest(chest)
  639. {
  640. var ChestHere;
  641.  
  642. //Check for Busy State
  643. if(isBusyChest){
  644. // Print(COLOR_1 + "BUSY CHEST!");
  645. return false;
  646. }
  647. else{
  648. // Print(COLOR_2 + "CHEST NOW!");
  649. isBusyChest = true;
  650. }
  651.  
  652. if(!chest){
  653. isBusyChest = false;
  654. return false;
  655. }
  656.  
  657. if(NTConfig_Chestids.indexOf(chest.classid) <= -1){
  658. isBusyChest = false;
  659. return false;
  660. }
  661.  
  662. if(chest.mode > 0){
  663. isBusyChest = false;
  664. return false;
  665. }
  666.  
  667. for(var i = 0 ; i < 20 ; i++)
  668. {
  669. NTC_Delay(200);//Minimum delay for looping
  670.  
  671. if((i % 10) == 0)
  672. {
  673. if(GetDistance(me, chest) > 2){
  674. NTM_MoveTo(chest.areaid, chest.x+Random(-1, 1), chest.y+Random(-1, 1));//Can this deal with Coffins???
  675. NTC_Delay(200);
  676. }
  677.  
  678. ChestHere = NTC_FindUnit(NTC_UNIT_OBJECT, chest.gid);//Use unique internal id
  679. if(ChestHere){
  680. if(NTConfig_Chestids.indexOf(ChestHere.classid) > -1 && ChestHere.mode == 0){
  681. NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, ChestHere);
  682. NTC_PingDelay(200);//Need to wait for the items to show up, depending on Ping
  683. }
  684. }
  685. else if(!ChestHere){
  686. isBusyChest = false;
  687. return false;
  688. }
  689. }
  690.  
  691. if(ChestHere.mode > 0){
  692. isBusyChest = false;
  693. return true;
  694. }
  695. }
  696.  
  697. isBusyChest = false;
  698. return false;
  699. }
  700.  
  701. function NTC_Delay(amount, random)
  702. {
  703. if(arguments.length < 2)
  704. Delay(amount);
  705. else
  706. Delay(amount+Random(0, random));
  707. }
  708.  
  709. function NTC_PingDelay(amount)
  710. {
  711. var _currentping = me.ping;
  712.  
  713. if(_currentping > 100)
  714. _currentping -= 100;
  715. else
  716. _currentping = 0;
  717.  
  718. NTC_Delay(amount+_currentping);
  719. }
  720.  
  721. function NTC_InTown(who)
  722. {
  723. var _areaid;
  724.  
  725. if(arguments.length < 1)
  726. who = me;
  727.  
  728. while(who.areaid == 0)
  729. NTC_Delay(NTC_DELAY_FRAME);
  730.  
  731. _areaid = who.areaid;
  732.  
  733. return (_areaid == NTC_AREA_ID_ACT_1 || _areaid == NTC_AREA_ID_ACT_2 || _areaid == NTC_AREA_ID_ACT_3 || _areaid == NTC_AREA_ID_ACT_4 || _areaid == NTC_AREA_ID_ACT_5);
  734. }
  735.  
  736. function NTC_InMyParty(playerName)
  737. {
  738. var _player;
  739. var _myPartyId;
  740.  
  741. _player = GetPlayerUnit();
  742.  
  743. if(_player)
  744. {
  745. _myPartyId = _player.partyid;
  746.  
  747. if(_myPartyId != 65535)
  748. {
  749. do
  750. {
  751. if (playerName === undefined) {
  752. if(_player.name != me.name && _myPartyId == _player.partyid) {
  753. return true;
  754. }
  755. } else if (playerName !== undefined) {
  756. if(_player.name == playerName && _myPartyId == _player.partyid) {
  757. return true;
  758. }
  759. }
  760. } while(_player.GetNext());
  761. }
  762. }
  763.  
  764. return false;
  765. }
  766.  
  767. function NTC_FindUnit(unittype, search, retry)
  768. {
  769. var _unit;
  770.  
  771. switch(arguments.length)
  772. {
  773. case 0:
  774. return null;
  775. case 1:
  776. search = null;
  777. case 2:
  778. retry = 0;
  779. break;
  780. }
  781.  
  782. for(var i = 0 ; i <= retry ; i++)
  783. {
  784. _unit = GetUnit(unittype, search);
  785.  
  786. if(_unit)
  787. return _unit;
  788.  
  789. if(i < retry)
  790. NTC_Delay(200);
  791. }
  792.  
  793. return null;
  794. }
  795.  
  796. function NTC_GetBeltSize()
  797. {
  798. var _items = me.GetItems();
  799.  
  800. if(!_items)
  801. return 1;
  802.  
  803. for(var i = 0 ; i < _items.length ; i++)
  804. {
  805. if(_items[i].mode == 1 && _items[i].itemloc == 8)
  806. {
  807. if(_items[i].classid == 344 || _items[i].classid == 345)
  808. return 2;
  809. else if(_items[i].classid == 346 || _items[i].classid == 347)
  810. return 3;
  811.  
  812. return 4;
  813. }
  814. }
  815.  
  816. return 1;
  817. }
  818.  
  819. function NTC_FindScript(scriptname)
  820. {
  821. var _script;
  822. var _scriptpath;
  823.  
  824. if(scriptname == undefined){ // added for leave with leader mod
  825. return false;
  826. }
  827.  
  828. _script = GetScript();
  829.  
  830. if(_script)
  831. {
  832. do
  833. {
  834. _scriptpath = _script.name.toLowerCase();
  835.  
  836. if(_scriptpath.indexOf(scriptname.toLowerCase()) != -1)
  837. return _script;
  838. } while(_script.GetNext());
  839. }
  840.  
  841. return null;
  842. }
  843.  
  844. function NTC_SendMsgToScript(scriptname, msg)
  845. {
  846. var _script = NTC_FindScript(scriptname);
  847. if(_script)
  848. return _script.Send(msg);
  849.  
  850. return false;
  851. }
  852.  
  853. function NTC_StopScript(scriptname)
  854. {
  855. var _script = NTC_FindScript(scriptname);
  856.  
  857. if(_script)
  858. return _script.Stop();
  859.  
  860. return false;
  861. }
  862.  
  863. function NTC_WaitIdleMode()
  864. {
  865. var _mode;
  866.  
  867. for(var i = 0 ; i < 25 ; i++)
  868. {
  869. _mode = me.mode;
  870.  
  871. if((_mode >= 1 && _mode <= 3) || _mode == 5 || _mode == 6)
  872. return true;
  873.  
  874. NTC_Delay(NTC_DELAY_FRAME);
  875. }
  876.  
  877. return false;
  878. }
  879.  
  880. function NTC_SendLogToOOG(type, logString)
  881. {
  882. return SendCopyData("D2NT Manager", null, 9<<16|type, logString);
  883. }
  884.  
  885.  
  886. function NTC_LogCurScript(script)
  887. {
  888. var _file = new Array();
  889. var _hfile = FileOpen(me.account + "_scripts.txt", 2);
  890. if(!_hfile)
  891. return false;
  892.  
  893. while(line = _hfile.ReadLine())
  894. _file.push(line);
  895.  
  896. _hfile.Close();
  897.  
  898. var _hfile = FileOpen(me.account + "_scripts.txt", 1);
  899. if(!_hfile)
  900. return false;
  901.  
  902. if(_file.length > 0)
  903. _hfile.WriteLine(_file.pop())
  904.  
  905. _hfile.WriteLine(script);
  906. _hfile.Close();
  907. }
  908.  
  909. function NTC_GetScript(index)
  910. {
  911. var _script;
  912.  
  913. if(arguments.length < 1)
  914. index = false;
  915.  
  916. var _hfile = FileOpen(me.account + "_scripts.txt", 2);
  917. if(!_hfile)
  918. return false;
  919.  
  920. _script = _hfile.ReadLine();
  921. if(index)
  922. _script = _hfile.ReadLine();
  923.  
  924. _hfile.Close();
  925.  
  926. return _script;
  927. }
  928.  
  929. function OpenChestsInArea() {
  930. //var ChestIds = [104, 105, 106, 107, 5, 6, 87, 92, 143, 140, 141, 144, 146, 147, 148, 176, 177, 181, 183, 198, 240, 241, 242, 243, 329, 330, 331, 332, 333, 334, 335, 336, 354, 355, 356, 371, 387, 389, 390, 391, 397, 405, 406, 407, 413, 420, 424, 425, 430, 431, 432, 433, 454, 455, 501, 502, 504, 505, 580, 581]
  931. var ChestLocs =[];
  932. var ChestIdstest = [];
  933. var unit = GetPresetUnits(me.areaid);
  934. if(unit){
  935. for (var j = 0; j < unit.length; j++){
  936. for (var c = 0; c < NTConfig_Chestids.length; c++){
  937. if (NTConfig_Chestids[c] == unit[j].id){
  938. ChestLocs.push([unit[j].roomx*5+unit[j].x,unit[j].roomy*5+unit[j].y])
  939. ChestIdstest.push(unit[j].id)
  940. }
  941. }
  942. }
  943. }
  944.  
  945. while(ChestLocs.length > 0){
  946. ChestLocs.sort(SortRoomInt);
  947. var _room = ChestLocs.shift();
  948. var _id = ChestIdstest.shift();
  949. NTM_MoveTo(me.areaid, _room[0], _room[1]);
  950. var chest = NTC_FindUnit(NTC_UNIT_OBJECT);
  951. if(chest){
  952. do{
  953. if(GetDistance(me.x,me.y,chest.x,chest.y)<3){
  954. if(NTC_OpenChest(chest)){
  955. if(NTConfig_CheckChestid)
  956. Print(COLOR_17 + chest.name + " = " + chest.classid);
  957. }
  958. NTSI_PickItems();
  959. }
  960. }while(chest.GetNext());
  961. }
  962. }
  963. }
  964.  
  965. function SortRoomInt(a, b) {
  966. if(GetDistance(me.x, me.y, a[0], a[1]) < GetDistance(me.x, me.y, b[0], b[1]))
  967. return -1;
  968.  
  969. return 1;
  970. }
  971.  
  972. function addSeparatorsNF(nStr, inD, outD, sep)
  973. {
  974. nStr += '';
  975. var dpos = nStr.indexOf(inD);
  976. var nStrEnd = '';
  977. if (dpos != -1) {
  978. nStrEnd = outD + nStr.substring(dpos + 1, nStr.length);
  979. nStr = nStr.substring(0, dpos);
  980. }
  981. var rgx = /(\d+)(\d{3})/;
  982. while (rgx.test(nStr)) {
  983. nStr = nStr.replace(rgx, '$1' + sep + '$2');
  984. }
  985. return nStr + nStrEnd;
  986. }
  987.  
  988. function NTC_RemoveLag(target, delay, count)
  989. {
  990. if (arguments.length < 2) delay = 700;
  991. if (arguments.length < 3) count = 0;
  992.  
  993. NTM_MoveTo(me.areaid, me.x + Random(-10, 10), me.y + Random(-10, 10));
  994.  
  995. me.Cancel(0);
  996. Delay(delay);
  997.  
  998. if (GetUIState(0x09))
  999. NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, target || me);
  1000.  
  1001. Delay(delay);
  1002.  
  1003. me.Cancel(1);
  1004. }
  1005.  
  1006. function OpenSpecialChestsInArea() {
  1007. var ChestIds = [354, 355, 356, 397, 405, 406, 407, 455]
  1008. var ChestLocs =[];
  1009. var ChestIdstest = [];
  1010. var unit = GetPresetUnits(me.areaid);
  1011. if(unit){
  1012. for (var j = 0; j < unit.length; j++){
  1013. for (var c = 0; c < ChestIds.length; c++){
  1014. if (ChestIds[c] == unit[j].id){
  1015. ChestLocs.push([unit[j].roomx*5+unit[j].x,unit[j].roomy*5+unit[j].y])
  1016. ChestIdstest.push(unit[j].id)
  1017. }
  1018. }
  1019. }
  1020. }
  1021.  
  1022. while(ChestLocs.length > 0){
  1023. ChestLocs.sort(SortRoomInt);
  1024. var _room = ChestLocs.shift();
  1025. var _id = ChestIdstest.shift();
  1026. NTM_MoveTo(me.areaid, _room[0], _room[1]);
  1027. var chest = NTC_FindUnit(NTC_UNIT_OBJECT, GetLocaleString(3260))
  1028. if(chest){
  1029. do{
  1030. if(GetDistance(me.x,me.y,chest.x,chest.y)<3){
  1031. if(NTC_OpenChest(chest)){
  1032. if(NTConfig_CheckChestid)
  1033. Print(COLOR_17 + chest.name + " = " + chest.classid);
  1034. }
  1035. NTSI_PickItems();
  1036. }
  1037. }while(chest.GetNext());
  1038. }
  1039. }
  1040. }
  1041.  
  1042. function NTC_OpenChestsInAreaNear(_orgx, _orgy, range)//Credit for original function to muddy waters modded by stairbuilder
  1043. {
  1044. //Check for Busy State
  1045. if(isBusyOpenChestsInAreaNear){
  1046. // Print(COLOR_1 + "BUSY CHESTINAREA!");
  1047. return false;
  1048. }
  1049. else{
  1050. // Print(COLOR_2 + "CHESTINAREA NOW!");
  1051. isBusyOpenChestsInAreaNear = true;
  1052. }
  1053.  
  1054. var _orgx, _orgy, _chest, _dist, _mindist, _minIndex;
  1055. _chest = NTC_FindUnit(NTC_UNIT_OBJECT);
  1056. _lootableChests = [];
  1057. var _NTL_ChestSkipList = [];
  1058. if(_chest)
  1059. {
  1060. do
  1061. {
  1062. if(_chest.mode == 0 && GetDistance(_orgx, _orgy, _chest.x, _chest.y) < range && (NTConfig_Chestids.indexOf(_chest.classid) > -1) &&_chest.name != GetLocaleString(5386) && _NTL_ChestSkipList.indexOf(_chest.gid) == -1)
  1063. _lootableChests.push(new Lootable(_chest.x, _chest.y, _chest.gid));
  1064. } while(_chest.GetNext());
  1065.  
  1066. for(var i = 0; i < _lootableChests.length; i++)
  1067. {
  1068. _mindist = 1E3;
  1069. _minIndex = -1;
  1070.  
  1071. for(var j = 0; j < _lootableChests.length; j++)
  1072. {
  1073. if(!_lootableChests[j].looted)
  1074. {
  1075. _dist = GetDistance(me.x, me.y, _lootableChests[j].x, _lootableChests[j].y);
  1076.  
  1077. if(_dist < _mindist)
  1078. {
  1079. _mindist = _dist;
  1080. _minIndex = j;
  1081. }
  1082. }
  1083. }
  1084.  
  1085. if(_minIndex > -1)
  1086. {
  1087. _chest = NTC_FindUnit(NTC_UNIT_OBJECT, _lootableChests[_minIndex].gid);
  1088.  
  1089. if(_chest)
  1090. {
  1091. if(NTC_GetSkillLevel(43)){//Use Telekinesis to open chests if possible
  1092. NTC_CastSkill(43, NTC_HAND_RIGHT, _chest);
  1093. if(NTConfig_CheckChestid){
  1094. Print(COLOR_17 + _chest.name + " = " + _chest.classid);
  1095. }
  1096. NTC_PingDelay(200);
  1097. if (me.areaid == 93){
  1098. NTSI_PickItems();//In Bazaar Sewer Level 2 Bot uses larger search range for chests
  1099. }
  1100. }
  1101. else if(NTC_OpenChest(_chest)){
  1102. if(NTConfig_CheckChestid){
  1103. Print(COLOR_17 + _chest.name + " = " + _chest.classid);
  1104. }
  1105. if (me.areaid == 93){
  1106. NTSI_PickItems();//In Bazaar Sewer Level 2 Bot uses larger search range for chests
  1107. }
  1108. }
  1109. _NTL_ChestSkipList.push(_chest.gid);
  1110. }
  1111.  
  1112. _lootableChests[_minIndex].looted = true;
  1113. }
  1114. else
  1115. break;
  1116. }
  1117.  
  1118. if (me.areaid != 93){
  1119. NTSI_PickItems();//If not in Bazaar Sewer Level 2, open all chests nearby then snag
  1120. }
  1121.  
  1122. isBusyOpenChestsInAreaNear = false;
  1123. return true;
  1124. }
  1125.  
  1126. isBusyOpenChestsInAreaNear = false;
  1127. return false;
  1128. }
  1129.  
  1130. function Lootable(x, y, gid)
  1131. {
  1132. this.gid = gid;
  1133. this.x = x;
  1134. this.y = y;
  1135. this.looted = false;
  1136. }
  1137.  
  1138. function GoWestFromLutGholein(){
  1139. if(me.areaid == 40){
  1140. _warriv = NTC_FindUnit(NTC_UNIT_NPC, 175, 5);
  1141. if(_warriv && GetDistance(me.x,me.y,_warriv.x,_warriv.y)<20){
  1142. NTM_MoveTo(me.areaid, _warriv.x, _warriv.y);
  1143. if(NTT_DoInteract(_warriv))
  1144. if(NTT_DoInteract(_warriv)){
  1145. for(var i = 0 ; i < 4 ; i++){
  1146. if((i % 4) == 0)
  1147. me.SelectNPCMenu(0x0D37);
  1148. NTC_Delay(500);
  1149. } me.Cancel(1);
  1150. }
  1151. }
  1152. } return;
  1153. }
  1154.  
  1155. function NTC_CheckPlayer(leader){
  1156. var _player = GetPlayerUnit();
  1157. while(_player.GetNext()){
  1158. if(_player.name == leader){
  1159. _leaderareaid = _player.areaid;
  1160. return true;
  1161. }
  1162. }
  1163. return false;
  1164. }
  1165.  
  1166. function NTC_FindMonster(classid, spectype)
  1167. {
  1168. var _monster;
  1169.  
  1170. if(arguments.length < 1)
  1171. return false;
  1172.  
  1173. if(arguments.length < 2)
  1174. spectype = 0;
  1175.  
  1176. for(var i = 0 ; i < 2 ; i++)
  1177. {
  1178. _monster = GetUnit(NTC_UNIT_MONSTER, classid);
  1179.  
  1180. if(_monster)
  1181. {
  1182. if(spectype)
  1183. {
  1184. do
  1185. {
  1186. if(_monster.spectype & spectype)
  1187. return _monster;
  1188. } while(_monster.GetNext());
  1189. }
  1190. else
  1191. return _monster;
  1192. }
  1193.  
  1194. if(i < 1)
  1195. NTC_PingDelay(200);
  1196. }
  1197.  
  1198. return false;
  1199. }
  1200.  
  1201. function NTC_GetUnit(unittype, classid)
  1202. {
  1203. var _unit;
  1204.  
  1205. for(var i = 0 ; i < 2 ; i++)
  1206. {
  1207. if(arguments.length < 2)
  1208. _unit = GetUnit(unittype);
  1209. else
  1210. _unit = GetUnit(unittype, classid);
  1211.  
  1212. if(_unit)
  1213. return _unit;
  1214.  
  1215. if(i < 1)
  1216. NTC_PingDelay(200);
  1217. }
  1218.  
  1219. return false;
  1220. }
  1221.  
  1222. function NTC_LogPrintSimple(filepath, mesg){ // Fixed redundancy..
  1223. var date = new Date().toLocaleFormat("<%a, %b %d, %H:%M>");
  1224. var logfile = FileOpen(filepath, 2); // opens file
  1225.  
  1226. logfile.WriteLine(date + " " + mesg );
  1227. logfile.Close();
  1228. }
  1229.  
  1230. function NTC_NextGameSayererer(){
  1231. var _MyGame = me.gamename;
  1232. var _MyEval;
  1233. var _MyIncrease;
  1234. if (_MyGame.indexOf("-") != -1) { var _MyNewGame = _MyGame.substring(_MyGame.lastIndexOf("-") + 1, _MyGame.length); }
  1235. else {
  1236. var _MyNewGameName = "a random game name";
  1237. return _MyNewGameName;
  1238. }
  1239. if(_MyNewGame != 99) { _MyEval = (parseFloat(_MyNewGame,10)+1); } else { _MyEval = "00"; }
  1240. if(_MyEval < 10 && _MyEval != 00) { _MyIncrease = "0" + _MyEval; } else { _MyIncrease = _MyEval; }
  1241. var _MyNewGameName = _MyGame.substring(0, _MyGame.lastIndexOf("-"));
  1242. if(DebugToLogs){ NTU_LogPrint("logs/testlog/"+me.charname+"-GameName.txt", " current game is[" + me.gamename + "] " + " NEW GAME WILL BE [" + mYfINAL + "] ");
  1243. }
  1244. return _MyNewGameName + "-" + _MyIncrease;
  1245. }
  1246.  
  1247. function NTC_CancelOut(delay){
  1248. if(arguments.length < 1) { delay = 1e2; }
  1249. Delay(delay);
  1250. me.Cancel(0);
  1251. Delay(delay);
  1252. me.Cancel(1);
  1253. Delay(delay);
  1254. }
  1255.  
  1256. function NT_File(path, mode, msg, delay) { //big thanks to all the koreans out there
  1257. var _msg = "";
  1258. var _line = "";
  1259. var _fileHandle;
  1260. var _isFileCheck = false;
  1261.  
  1262. if (arguments.length < 3) { msg = ""; }
  1263. if (arguments.length < 4) { delay = (mode > 0) ? 5 : 2; }
  1264.  
  1265. while (delay--) {
  1266. if (mode == 2 && !_isFileCheck) {
  1267. _fileHandle = FileOpen(path, 0);
  1268. if (!_fileHandle)
  1269. _fileHandle = FileOpen(path, 1);
  1270.  
  1271. if (_fileHandle)
  1272. _fileHandle.Close();
  1273.  
  1274. _isFileCheck = true;
  1275. }
  1276.  
  1277. _fileHandle = FileOpen(path, mode);
  1278. if (_fileHandle)
  1279. break;
  1280.  
  1281. if (delay)
  1282. Delay(200);
  1283. }
  1284.  
  1285. if (_fileHandle) {
  1286. if (mode == 0) {
  1287. while (!_fileHandle.eof) {
  1288. _line = _fileHandle.ReadLine();
  1289. if (_line || !_fileHandle.eof)
  1290. _msg += _line + msg;
  1291. }
  1292. }
  1293. else if (msg)
  1294. _fileHandle.WriteLine(msg);
  1295.  
  1296. _fileHandle.Close();
  1297. }
  1298.  
  1299. return _msg;
  1300. }
  1301.  
  1302. function NTC_LogLocation(script)
  1303. {
  1304. var _hfile = FileOpen("logs/loc/" + me.charname + "_LocInfo.txt", 1);
  1305. if(!_hfile) {
  1306. var _this = "Rogue Encampment";
  1307. return _this;
  1308. }
  1309.  
  1310. _hfile.WriteLine(script);
  1311. _hfile.Close();
  1312.  
  1313. }
  1314.  
  1315. function NTC_GetLocation(index)
  1316. {
  1317. var _script;
  1318.  
  1319. if(arguments.length < 1)
  1320. index = false;
  1321.  
  1322. var _hfile = FileOpen("logs/loc/" + me.charname + "_LocInfo.txt", 0);
  1323. if(!_hfile) {
  1324. var _this = "Rogue Encampment";
  1325. return _this;
  1326. }
  1327.  
  1328. _script = _hfile.ReadLine();
  1329. _hfile.Close();
  1330.  
  1331. return _script;
  1332. }
  1333.  
  1334. function NTC_CancelMenus() { // more koreans
  1335. while (GetUIState(0x01) || GetUIState(0x08) || GetUIState(0x0C) || GetUIState(0x0F) || GetUIState(0x14) ||
  1336. GetUIState(0x17) || GetUIState(0x19) || GetUIState(0x1A) || GetUIState(0x24)){
  1337.  
  1338. for (var i = 0; i < 40; i++){
  1339. if ((i % 20) == 0){
  1340. me.Cancel(1);
  1341. }
  1342. Delay(100);
  1343. if (!GetUIState(0x01) && !GetUIState(0x08) && !GetUIState(0x0C) && !GetUIState(0x0F) && !GetUIState(0x14) &&
  1344. !GetUIState(0x17) && !GetUIState(0x19) && !GetUIState(0x1A) && !GetUIState(0x24)){
  1345.  
  1346. NTC_PingDelay(300);
  1347. break;
  1348. }
  1349. }
  1350. }
  1351. }
  1352.  
  1353. function NTC_StopScriptLeecher(){
  1354. _script = NTC_FindScript(NTConfig_Script[CurScriptIndex]);
  1355. if(_script){
  1356. if(_script.running){
  1357. _script.Stop();
  1358. NTC_Delay(150);
  1359. ClickMap(NTC_CLICK_LUP, NTC_SHIFT_NONE, null);
  1360. }
  1361. }
  1362. return;
  1363. }
  1364.  
  1365. function NTC_PrintPossibleLeaders()
  1366. {
  1367. var _player;
  1368. var _myPartyId;
  1369.  
  1370. _player = GetPlayerUnit();
  1371.  
  1372. if(_player)
  1373. {
  1374. do
  1375. {
  1376. if( _player.name == me.name)
  1377. continue;
  1378. NTC_LogPrintSimple("logs/namelog/"+me.charname+"-leaderName.txt", _player.name);
  1379. } while(_player.GetNext());
  1380. }
  1381. return false;
  1382. }
  1383.  
  1384. function NTC_TimeKeeper(Message){ // actually more for use as an anti drop
  1385. var time = 0;
  1386. var idleTime;
  1387. while(1){
  1388. Delay(1000);
  1389. time++;
  1390. if(time){
  1391. var hours = parseInt((time/3600), 10)
  1392. var minutes = parseInt((time - (parseInt((hours * 3600), 10))) / 60);
  1393. var seconds = parseInt((time), 10) - parseInt(((hours * 3600) + (minutes * 60)), 10)
  1394. idleTime = hours + "h " + minutes + "m " + seconds +"s"
  1395. }
  1396. Print(COLOR_5 + Message + idleTime );
  1397. }
  1398. }
  1399.  
  1400. function NTC_PickSpecialItem(_item) {
  1401. var groundItem = NTC_FindUnit(NTC_UNIT_ITEM, _item, 2); // may want to change the 10 to smaller #
  1402. var theTorch;
  1403. if(!groundItem) { // we are going to assume that if item is not on ground we have it
  1404. return true;
  1405. }
  1406. if(groundItem && groundItem.classid == 604){
  1407. do{
  1408. if(groundItem.quality == 7){ // check to make sure that the LC is in fact a torch
  1409. theTorch = groundItem;
  1410. break;
  1411. }
  1412. } while(_portal.GetNext());
  1413. for(var i = 0 ; i < 10 ; i++){
  1414. if(theTorch.mode == 3 || theTorch.mode == 5){
  1415. if(NTC_PickUpItemIntSpecial(theTorch)){
  1416. Delay(10);
  1417. }
  1418. else{
  1419. NTA_ClearPosition(10, false);
  1420. }
  1421. }
  1422. if(theTorch.mode != 3 && theTorch.mode != 5){
  1423. var _parent;
  1424. NTC_PingDelay(100);
  1425. _parent = theTorch.GetParent();
  1426. if(_parent && _parent.gid == me.gid){
  1427. var _area = GetArea();
  1428. Print(COLOR_8 + "Picked up " + COLOR_4 + "HellFireTorch");
  1429. return true;
  1430. }
  1431. else{
  1432. return false;
  1433. }
  1434. }
  1435. Delay(250)
  1436. }
  1437. }
  1438. else if(groundItem){
  1439. for(var i = 0 ; i < 10 ; i++){
  1440. if(groundItem.mode == 3 || groundItem.mode == 5){
  1441. if(NTC_PickUpItemIntSpecial(groundItem)){
  1442. Delay(10);
  1443. }
  1444. else{
  1445. NTA_ClearPosition(10, false);
  1446. }
  1447. }
  1448. if(groundItem.mode != 3 && groundItem.mode != 5){
  1449. var _parent;
  1450. NTC_PingDelay(100);
  1451. _parent = groundItem.GetParent();
  1452. if(_parent && _parent.gid == me.gid){
  1453. var _area = GetArea();
  1454. Print(COLOR_4 + "Picked up " + COLOR_8 + groundItem.name.split("\n")[0])
  1455. if(groundItem.classid >= 650 && groundItem.classid <= 652){
  1456. NTC_SendLogToOOG(NTC_LOG_ITEM, COLOR_2 + " Kept: " + COLOR_8 + groundItem.name.split("\n")[0]+ ";" + groundItem.itemdesc + "\n" + COLOR_2 + "iLvl: " + groundItem.itemlevel + "\n" + COLOR_2 + "Area: " +_area.name);
  1457. }
  1458. else{
  1459. NTC_SendLogToOOG(NTC_LOG_ITEM, COLOR_2 + " Kept: " + NTC_ItemQualityToMGRColor[groundItem.quality] + groundItem.name.split("\n")[0]+ ";" + groundItem.itemdesc + "\n" + COLOR_2 + "iLvl: " + groundItem.itemlevel + "\n" + COLOR_2 + "Area: " +_area.name);
  1460. }
  1461. return true;
  1462. }
  1463. else{
  1464. return false;
  1465. }
  1466. }
  1467. Delay(250)
  1468. }
  1469. }
  1470. return false;
  1471. }
  1472.  
  1473. function NTC_PickUpItemIntSpecial(snagitem){
  1474. var i;
  1475. var _classid;
  1476. _classid = snagitem.classid;
  1477. for(i = 0 ; i < 40 ; i++){
  1478. if((i % 10) == 0 && (snagitem.mode == 3 || snagitem.mode == 5)){
  1479. if(GetDistance(me, snagitem) > 3)
  1480. NTM_MoveTo(snagitem.areaid, snagitem.x, snagitem.y);
  1481. if(NTC_ClearCursor())
  1482. NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, snagitem);
  1483. }
  1484. NTC_Delay(NTC_DELAY_FRAME);
  1485. if(snagitem.mode != 3 && snagitem.mode != 5){
  1486. var _parent;
  1487. NTC_PingDelay(100);
  1488. _parent = snagitem.GetParent();
  1489. return (_parent && _parent.gid == me.gid);
  1490. }
  1491. }
  1492. return false;
  1493. }
  1494.  
  1495.  
  1496. function NTC_PrintRandomColor(){
  1497. var possibleColors =
  1498. [
  1499. COLOR_0,
  1500. COLOR_1,
  1501. COLOR_2,
  1502. COLOR_3,
  1503. COLOR_4,
  1504. COLOR_5,
  1505. //COLOR_6,
  1506. COLOR_7,
  1507. COLOR_8,
  1508. COLOR_9,
  1509. COLOR_10,
  1510. COLOR_11,
  1511. //COLOR_12,
  1512. COLOR_13,
  1513. COLOR_14,
  1514. COLOR_15,
  1515. COLOR_16,
  1516. COLOR_17,
  1517. COLOR_18,
  1518. COLOR_19,
  1519. COLOR_20,
  1520. //COLOR_21,
  1521. //COLOR_22,
  1522. //COLOR_23,
  1523. //COLOR_24,
  1524. COLOR_25,
  1525. ]
  1526. var randomColor = possibleColors[Math.floor(Math.random()*possibleColors.length)]
  1527. return randomColor;
  1528. }
  1529.  
  1530. function NTC_RandomSelect(varArray){ // this uses the array as an arguement to make it universal for other uses
  1531. var randomReturn = varArray[Math.floor(Math.random() * varArray.length)];
  1532. return randomReturn;
  1533. }
  1534.  
  1535.  
  1536. function NTC_TPGuard(radius)
  1537. {
  1538. NTA_ClearPosition(radius)
  1539. NTM_GetCloserInt(NTM_FindCorrectPortalInt(true, me.name))
  1540. NTC_Delay(500);
  1541. }
  1542.  
  1543.  
  1544. function NTC_IsQuesterIn(area, name)
  1545. {
  1546. var _player;
  1547. var _myPartyId;
  1548. var _area;
  1549.  
  1550. _player = GetPlayerUnit();
  1551. _myPartyId = _player.partyid;
  1552.  
  1553. if(arguments.length < 1)
  1554. _area = me.areaid
  1555. if(arguments.length > 0)
  1556. _area = area;
  1557.  
  1558. do
  1559. {
  1560. if(_player.areaid == _area && _myPartyId == _player.partyid)
  1561. {
  1562. if(!name)
  1563. return true;
  1564. else if(_player.name == name)
  1565. return true;
  1566. }
  1567.  
  1568. NTC_Delay(100);
  1569.  
  1570. } while(_player.GetNext());
  1571.  
  1572. return false;
  1573. }
  1574.  
  1575. function NTC_IsQuesterOut(area)
  1576. {
  1577. var _player;
  1578. var _myPartyId;
  1579.  
  1580. _player = GetPlayerUnit();
  1581. _myPartyId = _player.partyid;
  1582.  
  1583. if(arguments.length < 1)
  1584. _area = me.areaid;
  1585. else
  1586. _area = area;
  1587.  
  1588. do
  1589. {
  1590. if(_player.areaid == _area && _myPartyId == _player.partyid)
  1591. return false;
  1592.  
  1593. NTC_Delay(100);
  1594.  
  1595. } while(_player.GetNext());
  1596.  
  1597. return true;
  1598. }
  1599.  
  1600. function NTC_IsGroupInAct(act)
  1601. {
  1602. var _player;
  1603. var _myPartyId;
  1604. var questeract;
  1605.  
  1606. _player = GetPlayerUnit();
  1607. _myPartyId = _player.partyid;
  1608.  
  1609. do
  1610. {
  1611. if(_player.areaid <= 39)
  1612. questeract = 1;
  1613. else if(_player.areaid >= 40 && _player.areaid <= 74)
  1614. questeract = 2;
  1615. else if(_player.areaid >= 75 && _player.areaid <= 102)
  1616. questeract = 3;
  1617. else if(_player.areaid >=103 && _player.areaid <= 108)
  1618. questeract = 4;
  1619. else
  1620. questeract = 5;
  1621.  
  1622. if(questeract < act && _myPartyId == _player.partyid && _player.name != me.charname)
  1623. return false;
  1624.  
  1625. NTC_Delay(100);
  1626.  
  1627. } while(_player.GetNext());
  1628.  
  1629. return true;
  1630. }
  1631.  
  1632. function NTC_GetNextGame() {
  1633. function Pad(num) {
  1634. if (num < 10) {
  1635. num = 0 + "" + num;
  1636. }
  1637.  
  1638. return num;
  1639. }
  1640.  
  1641. var i, result, number,
  1642. game = me.gamename;
  1643.  
  1644. for (i = game.length - 1; i > -1; i -= 1) {
  1645. if (isNaN(game[i])) {
  1646. break;
  1647. }
  1648. }
  1649.  
  1650. result = game.substring(0, i + 1);
  1651. number = parseInt(game.substring(i + 1), 10) === 99 ? 0 : (parseInt(game.substring(i + 1), 10) + 1); // 99 correction
  1652. result += Pad(number);
  1653.  
  1654. return result;
  1655. }
  1656.  
  1657.  
  1658. // this is a simple info storage that returns the areaid from a wp id
  1659. var NTC_WPIdToAreaId = [];
  1660. NTC_WPIdToAreaId[0] = 1;
  1661. NTC_WPIdToAreaId[1] = 3;
  1662. NTC_WPIdToAreaId[2] = 4;
  1663. NTC_WPIdToAreaId[3] = 5;
  1664. NTC_WPIdToAreaId[4] = 6;
  1665. NTC_WPIdToAreaId[5] = 27;
  1666. NTC_WPIdToAreaId[6] = 29;
  1667. NTC_WPIdToAreaId[7] = 32;
  1668. NTC_WPIdToAreaId[8] = 35;
  1669. NTC_WPIdToAreaId[9] = 40;
  1670. NTC_WPIdToAreaId[10] = 48;
  1671. NTC_WPIdToAreaId[11] = 42;
  1672. NTC_WPIdToAreaId[12] = 57;
  1673. NTC_WPIdToAreaId[13] = 43;
  1674. NTC_WPIdToAreaId[14] = 44;
  1675. NTC_WPIdToAreaId[15] = 52;
  1676. NTC_WPIdToAreaId[16] = 74;
  1677. NTC_WPIdToAreaId[17] = 46;
  1678. NTC_WPIdToAreaId[18] = 75;
  1679. NTC_WPIdToAreaId[19] = 76;
  1680. NTC_WPIdToAreaId[20] = 77;
  1681. NTC_WPIdToAreaId[21] = 78;
  1682. NTC_WPIdToAreaId[22] = 79;
  1683. NTC_WPIdToAreaId[23] = 80;
  1684. NTC_WPIdToAreaId[24] = 81;
  1685. NTC_WPIdToAreaId[25] = 83;
  1686. NTC_WPIdToAreaId[26] = 101;
  1687. NTC_WPIdToAreaId[27] = 103;
  1688. NTC_WPIdToAreaId[28] = 106;
  1689. NTC_WPIdToAreaId[29] = 107;
  1690. NTC_WPIdToAreaId[30] = 109;
  1691. NTC_WPIdToAreaId[31] = 111;
  1692. NTC_WPIdToAreaId[32] = 112;
  1693. NTC_WPIdToAreaId[33] = 113;
  1694. NTC_WPIdToAreaId[34] = 115;
  1695. NTC_WPIdToAreaId[35] = 123;
  1696. NTC_WPIdToAreaId[36] = 117;
  1697. NTC_WPIdToAreaId[37] = 118;
  1698. NTC_WPIdToAreaId[38] = 129;
Add Comment
Please, Sign In to add comment