Advertisement
DraculaxAOE

townmanager

Jun 1st, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 49.07 KB | None | 0 0
  1. var _NTTMGR_BuyPots;
  2. var _NTTMGR_BuyTP;
  3. var _NTTMGR_BuyID;// id in field add
  4. var _NTTMGR_BuyKey;
  5. var _NTTMGR_DoHeal;
  6. var _NTTMGR_DoID;
  7. var _NTTMGR_DoRepair;
  8. var _NTTMGR_DoRevive;
  9. var _NTTMGR_RemoveCurse;
  10. var _NTTMGR_Simple;
  11. var _NTTMGR_BuyArrows = false;
  12. var ammyreq = Math.abs(Math.floor(me.GetStat(12) / 2)-90) * 2;
  13. var muleScripts = ("AutoMulingSystem1.2.ntj", "AutoMulingSystemLeecher1.2.ntj");
  14. var MuleAccount = "";
  15.  
  16. function NTTMGR_TownManager(simple, ranged)
  17. {
  18. while(me.areaid == 0){
  19. NTC_Delay(200);
  20. }
  21. NTC_SwapWeapons(0);
  22. var _cubing;
  23.  
  24. if(arguments.length < 2)
  25. ranged = false;
  26.  
  27. if(arguments.length < 1)
  28. simple = false;
  29.  
  30. NTT_ClearBelt();
  31. NT_CheckInventorypots();
  32. NTT_CleanPotions();
  33. NTTMGR_TossScrolls();
  34.  
  35. _NTTMGR_BuyPotsInt = NTT_CheckBelt();
  36. _NTTMGR_BuyPots = NTConfig_CheckPotsTown ? NTT_NeedPots(true) : NTT_CheckBelt();
  37.  
  38. _NTTMGR_BuyID = (NTConfig_IdInField && NTTMGR_CheckScrolls(0) < 20);// id in field add
  39.  
  40. _NTTMGR_BuyTP = (NTTMGR_CheckScrolls(1) < 8);
  41. _NTTMGR_BuyKey = ((NTConfig_OpenChest || NTConfig_OpenChestsInArea || NTConfig_OpenHallsSuperChests || NTConfig_UseKeysForPlaceHolder) && NTTMGR_CheckKeys() < 6);
  42. _NTTMGR_DoHeal = NTT_CheckHeal();
  43. _NTTMGR_DoID = NTT_CheckUnids();
  44. _NTTMGR_DoRepair = NTT_CheckRepair(NTConfig_Repair);
  45. _NTTMGR_DoRevive = NTT_CheckMerc();
  46. _NTTMGR_RemoveCurse = NTTMGR_CheckCurse(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
  47. _NTTMGR_Simple = simple;
  48. _NTTMGR_BuyArrows = ranged;
  49.  
  50. NTCU_InitCubing();
  51.  
  52. if(_NTTMGR_BuyArrows) {
  53. // check if we need ammo or not. If we have 350 already then set _NTTMGR_BuyArrows false
  54. NTT_TossAmmo();
  55. }
  56.  
  57. switch(me.act)
  58. {
  59. case 1:
  60. if(NTConfig_IdentAtCain && _NTTMGR_DoID && NTTMGR_SkipCainAct())
  61. NTTMGR_VisitCain(simple);
  62.  
  63. _NTTMGR_DoHeal = NTT_CheckHeal(); // put these vars here to reset them after doing cain else it does them again ending with extra pots in inv
  64. _NTTMGR_RemoveCurse = NTTMGR_CheckCurse(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
  65. _NTTMGR_DoID = NTT_CheckUnids();
  66. _NTTMGR_BuyPots = NTConfig_CheckPotsTown ? NTT_NeedPots(true) : NTT_CheckBelt();
  67.  
  68. _NTTMGR_BuyID = (NTConfig_IdInField && NTTMGR_CheckScrolls(0) < 20);// id in field add
  69.  
  70. _NTTMGR_BuyTP = (NTTMGR_CheckScrolls(1) < 8);
  71. _NTTMGR_BuyKey = ((NTConfig_OpenChest || NTConfig_OpenChestsInArea || NTConfig_OpenHallsSuperChests || NTConfig_UseKeysForPlaceHolder) && NTTMGR_CheckKeys() < 6);
  72.  
  73. if(_NTTMGR_DoHeal || _NTTMGR_RemoveCurse || _NTTMGR_DoID || _NTTMGR_BuyPots || _NTTMGR_BuyTP || _NTTMGR_BuyID || _NTTMGR_BuyKey) {
  74. NTTMGR_VisitAkara();
  75. }
  76.  
  77. _cubing = (!simple && (NTCU_CheckCubing() || NTRW_CheckRunewords()));
  78.  
  79. if(_cubing || NTT_CheckInventory())
  80. NTTMGR_VisitStash(_cubing);
  81.  
  82. if(_NTTMGR_DoRevive)
  83. NTTMGR_VisitKashya();
  84.  
  85. if(_NTTMGR_DoRepair || _NTTMGR_BuyArrows)
  86. NTTMGR_VisitCharsi();
  87. NTTM_GCCheckAmu();
  88. if(!simple && NTConfig_Gamble && NTC_MyGold() > NTConfig_GambleStartGold)
  89. {
  90. NTTMGR_VisitGheed();
  91.  
  92. _cubing = (!simple && (NTCU_CheckCubing() || NTRW_CheckRunewords()));
  93.  
  94. if(_cubing || NTT_CheckInventory())
  95. NTTMGR_VisitStash(_cubing);
  96. }
  97. break;
  98.  
  99. case 2:
  100. if(NTConfig_IdentAtCain && _NTTMGR_DoID && NTTMGR_SkipCainAct())
  101. NTTMGR_VisitCain(simple);
  102.  
  103. _NTTMGR_DoHeal = NTT_CheckHeal();
  104. _NTTMGR_RemoveCurse = NTTMGR_CheckCurse(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
  105. _NTTMGR_DoID = NTT_CheckUnids();
  106. _NTTMGR_BuyPots = NTConfig_CheckPotsTown ? NTT_NeedPots(true) : NTT_CheckBelt();
  107.  
  108. _NTTMGR_BuyID = (NTConfig_IdInField && NTTMGR_CheckScrolls(0) < 20);// id in field add
  109.  
  110. _NTTMGR_BuyTP = (NTTMGR_CheckScrolls(1) < 8);
  111. _NTTMGR_BuyKey = ((NTConfig_OpenChest || NTConfig_OpenChestsInArea || NTConfig_OpenHallsSuperChests || NTConfig_UseKeysForPlaceHolder) && NTTMGR_CheckKeys() < 6);
  112.  
  113. if(_NTTMGR_DoHeal || _NTTMGR_RemoveCurse || _NTTMGR_DoRepair || _NTTMGR_BuyArrows)
  114. NTTMGR_VisitFara();
  115. if(_NTTMGR_BuyPots || _NTTMGR_BuyTP || _NTTMGR_BuyID || _NTTMGR_DoID)
  116. NTTMGR_VisitDrognan();
  117. if(_NTTMGR_BuyKey)
  118. NTTMGR_VisitLysander();
  119.  
  120. _cubing = (!simple && (NTCU_CheckCubing() || NTRW_CheckRunewords()));
  121.  
  122. if(_cubing || NTT_CheckInventory())
  123. NTTMGR_VisitStash(_cubing);
  124. if(_NTTMGR_DoRevive)
  125. NTTMGR_VisitGreiz();
  126. NTTM_GCCheckAmu();
  127. if(!simple && NTConfig_Gamble && NTC_MyGold() > NTConfig_GambleStartGold)
  128. {
  129. NTTMGR_VisitElzix();
  130.  
  131. _cubing = (!simple && (NTCU_CheckCubing() || NTRW_CheckRunewords()));
  132.  
  133. if(_cubing || NTT_CheckInventory())
  134. NTTMGR_VisitStash(_cubing);
  135. }
  136. break;
  137.  
  138. case 3:
  139. if(NTConfig_IdentAtCain && _NTTMGR_DoID && NTTMGR_SkipCainAct())
  140. NTTMGR_VisitCain(simple);
  141.  
  142. _NTTMGR_DoHeal = NTT_CheckHeal();
  143. _NTTMGR_RemoveCurse = NTTMGR_CheckCurse(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
  144. _NTTMGR_DoID = NTT_CheckUnids();
  145. _NTTMGR_BuyPots = NTConfig_CheckPotsTown ? NTT_NeedPots(true) : NTT_CheckBelt();
  146.  
  147. _NTTMGR_BuyID = (NTConfig_IdInField && NTTMGR_CheckScrolls(0) < 20);// id in field add
  148.  
  149. _NTTMGR_BuyTP = (NTTMGR_CheckScrolls(1) < 8);
  150. _NTTMGR_BuyKey = ((NTConfig_OpenChest || NTConfig_OpenChestsInArea || NTConfig_OpenHallsSuperChests || NTConfig_UseKeysForPlaceHolder) && NTTMGR_CheckKeys() < 6);
  151.  
  152. if(_NTTMGR_DoHeal || _NTTMGR_RemoveCurse || _NTTMGR_DoID || _NTTMGR_BuyTP || _NTTMGR_BuyID || _NTTMGR_BuyPots)
  153. NTTMGR_VisitOrmus();
  154.  
  155. _cubing = (!simple && (NTCU_CheckCubing() || NTRW_CheckRunewords()));
  156.  
  157. if(_cubing || NTT_CheckInventory())
  158. NTTMGR_VisitStash(_cubing);
  159. if(_NTTMGR_DoRevive)
  160. NTTMGR_VisitAsheara();
  161. if(_NTTMGR_DoRepair || _NTTMGR_BuyKey || _NTTMGR_BuyArrows)
  162. NTTMGR_VisitHratli();
  163. NTTM_GCCheckAmu();
  164. // if(!simple && NTConfig_Gamble && NTC_MyGold() > NTConfig_GambleStartGold)
  165. // {
  166. // NTTMGR_VisitAlkor();
  167. //
  168. // _cubing = (!simple && (NTCU_CheckCubing() || NTRW_CheckRunewords()));
  169. //
  170. // if(_cubing || NTT_CheckInventory())
  171. // NTTMGR_VisitStash(_cubing);
  172. // }
  173. break;
  174.  
  175. case 4:
  176. if(NTConfig_IdentAtCain && _NTTMGR_DoID && NTTMGR_SkipCainAct())
  177. NTTMGR_VisitCain(simple);
  178.  
  179. _NTTMGR_DoHeal = NTT_CheckHeal();
  180. _NTTMGR_RemoveCurse = NTTMGR_CheckCurse(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
  181. _NTTMGR_DoID = NTT_CheckUnids();
  182. _NTTMGR_BuyPots = NTConfig_CheckPotsTown ? NTT_NeedPots(true) : NTT_CheckBelt();
  183.  
  184. _NTTMGR_BuyID = (NTConfig_IdInField && NTTMGR_CheckScrolls(0) < 20);// id in field add
  185.  
  186. _NTTMGR_BuyTP = (NTTMGR_CheckScrolls(1) < 8);
  187. _NTTMGR_BuyKey = ((NTConfig_OpenChest || NTConfig_OpenChestsInArea || NTConfig_OpenHallsSuperChests || NTConfig_UseKeysForPlaceHolder) && NTTMGR_CheckKeys() < 6);
  188.  
  189. if(_NTTMGR_DoHeal || _NTTMGR_RemoveCurse || _NTTMGR_DoID || _NTTMGR_BuyTP || _NTTMGR_BuyID || _NTTMGR_BuyKey || _NTTMGR_BuyPots)
  190. NTTMGR_VisitJamella(false);
  191. if(_NTTMGR_DoRepair || _NTTMGR_BuyArrows)
  192. NTTMGR_VisitHalbu();
  193.  
  194. _cubing = (!simple && (NTCU_CheckCubing() || NTRW_CheckRunewords()));
  195.  
  196. if(_cubing || NTT_CheckInventory())
  197. NTTMGR_VisitStash(_cubing);
  198. if(_NTTMGR_DoRevive)
  199. NTTMGR_VisitTyrael();
  200. NTTM_GCCheckAmu();
  201. if(!simple && NTConfig_Gamble && NTC_MyGold() > NTConfig_GambleStartGold)
  202. {
  203. NTTMGR_VisitJamella(true);
  204.  
  205. _cubing = (!simple && (NTCU_CheckCubing() || NTRW_CheckRunewords()));
  206.  
  207. if(_cubing || NTT_CheckInventory())
  208. NTTMGR_VisitStash(_cubing);
  209. }
  210. break;
  211.  
  212. case 5:
  213. if(NTConfig_IdentAtCain && _NTTMGR_DoID && NTTMGR_SkipCainAct())
  214. NTTMGR_VisitCain(simple);
  215.  
  216. _NTTMGR_DoHeal = NTT_CheckHeal();
  217. _NTTMGR_RemoveCurse = NTTMGR_CheckCurse(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
  218. _NTTMGR_DoID = NTT_CheckUnids();
  219. _NTTMGR_BuyPots = NTConfig_CheckPotsTown ? NTT_NeedPots(true) : NTT_CheckBelt();
  220.  
  221. _NTTMGR_BuyID = (NTConfig_IdInField && NTTMGR_CheckScrolls(0) < 20);// id in field add
  222.  
  223. _NTTMGR_BuyTP = (NTTMGR_CheckScrolls(1) < 8);
  224. _NTTMGR_BuyKey = ((NTConfig_OpenChest || NTConfig_OpenChestsInArea || NTConfig_OpenHallsSuperChests || NTConfig_UseKeysForPlaceHolder) && NTTMGR_CheckKeys() < 6);
  225.  
  226. if(_NTTMGR_DoHeal || _NTTMGR_RemoveCurse || _NTTMGR_DoID || _NTTMGR_BuyTP || _NTTMGR_BuyID || _NTTMGR_BuyKey || _NTTMGR_BuyPots)
  227. NTTMGR_VisitMalah();
  228.  
  229. _cubing = (!simple && (NTCU_CheckCubing() || NTRW_CheckRunewords()));
  230.  
  231. if(_cubing || NTT_CheckInventory())
  232. NTTMGR_VisitStash(_cubing);
  233. if(_NTTMGR_DoRepair || _NTTMGR_BuyArrows)
  234. NTTMGR_VisitLarzuk();
  235. if(_NTTMGR_DoRevive)
  236. NTTMGR_VisitQualKehk();
  237. NTTM_GCCheckAmu();
  238. if(!simple && NTConfig_Gamble && NTC_MyGold() > NTConfig_GambleStartGold)
  239. {
  240. NTTMGR_VisitAnya();
  241.  
  242. _cubing = (!simple && (NTCU_CheckCubing() || NTRW_CheckRunewords()));
  243.  
  244. if(_cubing || NTT_CheckInventory())
  245. NTTMGR_VisitStash(_cubing);
  246. }
  247. break;
  248. }
  249.  
  250. if (NTConfig_AutoMule && NTMU_CheckMuleStash() < NTConfig_MuleStash && NTT_CheckMuleInventory() < NTConfig_MuleInv && !statusSet()) {
  251. if(muleScriptRunning()) {
  252. NT_File("AMS/MuleStatus/" + me.account + "_charstatus.txt", 1, "Main");
  253. NT_File("AMS/MuleStatus/" + me.account + "_mulingstatus.txt", 1, "true");
  254. NTC_SendLogToOOG(NTC_LOG_COMMON, 'Automuling triggered.' + COLOR_2 + 'Stash Capacity is ' + COLOR_4 + NTMU_CheckMuleStash() + COLOR_2 + ' Inventory Capacity is ' + COLOR_4 + NTT_CheckMuleInventory());
  255. Delay(500);
  256. if(!NTConfig_FinishRun) {
  257. NTC_SendMsgToScript("NTBotGame.ntj", "QuitGame");
  258. Delay(500);
  259. }
  260. else {
  261. NTC_SendLogToOOG(NTC_LOG_COMMON, COLOR_7 + 'Finishing run before muling');
  262. }
  263. }
  264. else {
  265. NTC_SendLogToOOG(NTC_LOG_COMMON, 'Automuling requires the AutoMulingSystem entry points!');
  266. Delay(200);
  267. NTC_SendLogToOOG(NTC_LOG_COMMON, 'If this is not set as entry point, either set NTConfig_AutoMule to false, or use the AutoMulingSystem entry point!');
  268. }
  269. }
  270.  
  271. if (NTConfig_StopIfStashInventoryFull && !NTConfig_AutoMule && NTMU_CheckMuleStash() < 4 && NTT_CheckMuleInventory() < NTConfig_FreeRowsQuit)
  272. {
  273. NTC_SendLogToOOG(NTC_LOG_COMMON, COLOR_1 + 'Paused - Stash & Inventory full');
  274. while(true){
  275. // Print("!Inventory & Stash Full");
  276. Delay(10000);
  277. }
  278. }
  279.  
  280. if(NTConfig_PickupFreeGold){NTTMGR_FreeGold();}
  281. else { Delay(10); }
  282. }
  283.  
  284. function NTTMGR_FreeGold()
  285. {
  286. CheckForGoldWho = ["akara", "fara", "ormus", "jamella", "malah"];
  287. if((me.GetStat(14) + me.GetStat(15)) != ((me.GetStat(12) * 10000) + 2500000)){
  288. switch(me.act){
  289. case 1:
  290. if(!NTTM_TownMove(CheckForGoldWho[0])) {
  291. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
  292. return;
  293. }
  294. NTSI_PickItems();
  295. break;
  296. case 2:
  297. if(!NTTM_TownMove(CheckForGoldWho[1])) {
  298. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
  299. return;
  300. }
  301. NTSI_PickItems();
  302. break;
  303. case 3:
  304. if(!NTTM_TownMove(CheckForGoldWho[2])) {
  305. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
  306. return;
  307. }
  308. NTSI_PickItems();
  309. break;
  310. case 4:
  311. if(!NTTM_TownMove(CheckForGoldWho[3])) {
  312. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
  313. return;
  314. }
  315. NTSI_PickItems();
  316. break;
  317. case 5:
  318. if(!NTTM_TownMove(CheckForGoldWho[4])) {
  319. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
  320. return;
  321. }
  322. NTSI_PickItems();
  323. break;
  324. default:
  325. break;
  326. } return;
  327. }
  328. }
  329.  
  330. function NTTMGR_VisitTown(ranged)
  331. {
  332.  
  333. if(arguments.length < 1)
  334. ranged = false;
  335.  
  336. var _prearea = me.areaid;
  337.  
  338. if(!NTTM_CheckAct())
  339. return false;
  340.  
  341. NTTMGR_TownManager(true, ranged);
  342.  
  343. if(!NTTM_TownMove("portalspot", true))
  344. return false;
  345.  
  346. if(me.classid == NTC_CHAR_CLASS_ASSASSIN && NTConfig_UseFade)
  347. NTC_CastSkill(267, NTC_HAND_RIGHT);
  348.  
  349. if(!NTM_UsePortal("BluePortal", _prearea))
  350. return false;
  351.  
  352. if(NTConfig_PublicMode)
  353. NTM_MakeTP();
  354.  
  355. return true;
  356. }
  357.  
  358. function NTTMGR_VisitStash(cubing)
  359. {
  360. var _stash;
  361.  
  362. NTTM_TownMove("stash");
  363.  
  364. _stash = NTC_FindUnit(NTC_UNIT_OBJECT, NTC_UNIT_STASH, 5);
  365.  
  366. if(_stash)
  367. {
  368. if(NTT_DoInteract(_stash))
  369. {
  370. if(NTConfig_MakeRunewords)
  371. NTRW_MakeRuneword();
  372.  
  373. NTT_ManageStash();
  374.  
  375. if(cubing)
  376. {
  377. NTCU_DoCubing();
  378.  
  379. if(NTT_DoInteract(_stash))
  380. NTT_ManageStash();
  381.  
  382. me.Cancel(1);
  383. NTT_ClearInventory();
  384. }
  385. else
  386. me.Cancel(1);
  387. }
  388. }
  389. }
  390.  
  391. function NTTMGR_VisitAkara()
  392. {
  393. var _npc;
  394.  
  395. NTTM_TownMove("akara");
  396.  
  397. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_AKARA, 5);
  398.  
  399. if(_npc)
  400. {
  401. if(NTT_DoInteract(_npc))
  402. {
  403. if(_NTTMGR_DoID || _NTTMGR_BuyPotsInt || _NTTMGR_BuyTP || _NTTMGR_BuyID || _NTTMGR_BuyKey)
  404. {
  405. if(NTT_DoTrade(_npc))
  406. {
  407. if(_NTTMGR_BuyPotsInt)
  408. NTT_FillBelt(_npc);
  409. NTT_FillTome(_npc);
  410. NTT_FillTome(_npc, 1);
  411. if(_NTTMGR_BuyKey)
  412. NTT_FillKey(_npc);
  413. if(_NTTMGR_DoID)
  414. NTTMGR_IDItems(_npc);
  415. }
  416. }
  417.  
  418. me.Cancel(1);
  419. }
  420. }
  421. }
  422.  
  423. function NTTMGR_VisitKashya()
  424. {
  425. var _npc;
  426.  
  427. NTTM_TownMove("kashya");
  428.  
  429. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_KASHYA, 5);
  430.  
  431. if(_npc)
  432. {
  433. if(NTT_DoInteract(_npc))
  434. {
  435. NTT_ReviveMerc();
  436. me.Cancel(1);
  437. }
  438. }
  439. }
  440.  
  441. function NTTMGR_VisitCharsi()
  442. {
  443. var _npc;
  444.  
  445. NTTM_TownMove("charsi");
  446.  
  447. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_CHARSI, 5);
  448.  
  449. if(_npc)
  450. {
  451. if(NTT_DoInteract(_npc))
  452. {
  453. if(_NTTMGR_DoRepair || _NTTMGR_BuyArrows)
  454. {
  455. if(NTT_DoTrade(_npc))
  456. {
  457. if(_NTTMGR_DoRepair)
  458. NTT_RepairItems(_npc);
  459. if(_NTTMGR_BuyArrows)
  460. NTT_FillArrows(_npc);
  461. }
  462. me.Cancel(1);
  463. }
  464. }
  465. }
  466. }
  467. function NTTMGR_VisitGheed()
  468. {
  469. var _npc;
  470.  
  471. NTTM_TownMove("gheed");
  472.  
  473. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_GHEED, 5);
  474. if (me.classid == 6)
  475. NTC_PutSkill(0, NTC_HAND_RIGHT);
  476. if(_npc)
  477. {
  478. while(NTC_MyGold() > NTConfig_GambleStopGold)
  479. {
  480. if(NTT_DoInteract(_npc))
  481. {
  482. if(NTT_DoTrade(_npc, 1))
  483. NTT_GambleIt(_npc);
  484.  
  485. me.Cancel(1);
  486. }
  487. else
  488. break;
  489. }
  490. }
  491. }
  492.  
  493. function NTTMGR_VisitFara()
  494. {
  495. var _npc;
  496.  
  497. NTTM_TownMove("fara");
  498.  
  499. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_FARA, 5);
  500.  
  501. if(_npc)
  502. {
  503. if(NTT_DoInteract(_npc))
  504. {
  505. if(_NTTMGR_DoRepair || _NTTMGR_BuyArrows)
  506. {
  507. if(NTT_DoTrade(_npc))
  508. {
  509. if(_NTTMGR_DoRepair)
  510. NTT_RepairItems(_npc);
  511. if(_NTTMGR_BuyArrows)
  512. NTT_FillArrows(_npc);
  513. }
  514. }
  515.  
  516. me.Cancel(1);
  517. }
  518. }
  519. }
  520.  
  521. function NTTMGR_VisitDrognan()
  522. {
  523. var _npc;
  524.  
  525. NTTM_TownMove("drognan");
  526.  
  527. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_DROGNAN, 5);
  528.  
  529. if(_npc)
  530. {
  531. if(NTT_DoInteract(_npc))
  532. {
  533. if(NTT_DoTrade(_npc))
  534. {
  535. if(_NTTMGR_BuyPotsInt)
  536. NTT_FillBelt(_npc);
  537. NTT_FillTome(_npc);
  538. NTT_FillTome(_npc, 1);
  539. if(_NTTMGR_DoID)
  540. NTTMGR_IDItems(_npc);
  541. }
  542.  
  543. me.Cancel(1);
  544. }
  545. }
  546. }
  547.  
  548. function NTTMGR_VisitLysander()
  549. {
  550. var _npc;
  551.  
  552. NTTM_TownMove("lysander");
  553.  
  554. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_LYSANDER, 5);
  555.  
  556. if(_npc)
  557. {
  558. if(NTT_DoInteract(_npc))
  559. {
  560. if(NTT_DoTrade(_npc))
  561. NTT_FillKey(_npc);
  562.  
  563. me.Cancel(1);
  564. }
  565. }
  566. }
  567.  
  568. function NTTMGR_VisitGreiz()
  569. {
  570. var _npc;
  571.  
  572. NTTM_TownMove("greiz");
  573.  
  574. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_GREIZ, 5);
  575.  
  576. if(_npc)
  577. {
  578. if(NTT_DoInteract(_npc))
  579. {
  580. NTT_ReviveMerc();
  581. me.Cancel(1);
  582. }
  583. }
  584. }
  585.  
  586. function NTTMGR_VisitElzix()
  587. {
  588. var _npc;
  589.  
  590. NTTM_TownMove("elzix");
  591.  
  592. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_ELZIX, 5);
  593. if (me.classid == 6)
  594. NTC_PutSkill(0, NTC_HAND_RIGHT);
  595.  
  596. if(_npc)
  597. {
  598. while(NTC_MyGold() > NTConfig_GambleStopGold)
  599. {
  600. if(NTT_DoInteract(_npc))
  601. {
  602. if(NTT_DoTrade(_npc, 1))
  603. NTT_GambleIt(_npc);
  604.  
  605. me.Cancel(1);
  606. }
  607. else
  608. break;
  609. }
  610. }
  611. }
  612.  
  613. function NTTMGR_VisitOrmus()
  614. {
  615. var _npc;
  616.  
  617. NTTM_TownMove("ormus");
  618.  
  619. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_ORMUS, 5);
  620.  
  621. if(_npc)
  622. {
  623. if(NTT_DoInteract(_npc))
  624. {
  625. if(_NTTMGR_DoID || _NTTMGR_BuyPotsInt || _NTTMGR_BuyTP || _NTTMGR_BuyID)
  626. {
  627. if(NTT_DoTrade(_npc))
  628. {
  629. if(_NTTMGR_BuyPotsInt)
  630. NTT_FillBelt(_npc);
  631. NTT_FillTome(_npc);
  632. NTT_FillTome(_npc, 1);
  633. if(_NTTMGR_DoID)
  634. NTTMGR_IDItems(_npc);
  635. }
  636. }
  637.  
  638. me.Cancel(1);
  639. }
  640. }
  641. }
  642.  
  643. function NTTMGR_VisitAsheara()
  644. {
  645. var _npc;
  646.  
  647. NTTM_TownMove("asheara");
  648.  
  649. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_ASHEARA, 5);
  650.  
  651. if(_npc)
  652. {
  653. if(NTT_DoInteract(_npc))
  654. {
  655. NTT_ReviveMerc();
  656. me.Cancel(1);
  657. }
  658. }
  659. }
  660.  
  661. function NTTMGR_VisitHratli()
  662. {
  663. var _npc;
  664.  
  665. NTTM_TownMove("hratli");
  666.  
  667. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_HRATLI, 5);
  668.  
  669. if(_npc)
  670. {
  671. if(NTT_DoInteract(_npc))
  672. {
  673. if(NTT_DoTrade(_npc))
  674. {
  675. if(_NTTMGR_DoRepair)
  676. NTT_RepairItems(_npc);
  677. if(_NTTMGR_BuyKey)
  678. NTT_FillKey(_npc);
  679. if(_NTTMGR_BuyArrows)
  680. NTT_FillArrows(_npc);
  681. }
  682.  
  683. me.Cancel(1);
  684. }
  685. }
  686. }
  687. function NTTMGR_VisitAlkor()
  688. {
  689. var _npc;
  690.  
  691. NTTM_TownMove("alkor");
  692.  
  693. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_ALKOR, 5);
  694. if (me.classid == 6)
  695. NTC_PutSkill(0, NTC_HAND_RIGHT);
  696.  
  697. if(_npc)
  698. {
  699. while(NTC_MyGold() > NTConfig_GambleStopGold)
  700. {
  701. if(NTT_DoInteract(_npc))
  702. {
  703. if(NTT_DoTrade(_npc, 1))
  704. NTT_GambleIt(_npc);
  705.  
  706. me.Cancel(1);
  707. }
  708. else
  709. break;
  710. }
  711. }
  712. }
  713.  
  714. function NTTMGR_VisitJamella(gamble)
  715. {
  716. var _npc;
  717.  
  718. var myy = me.y;
  719. var myx = me.x;
  720. if(myx > 5040 && myx < 5060 && myy < 5060 && myy > 5040)
  721. {
  722. NTM_MoveTo(me.areaid, 5041, 5036);
  723. }
  724.  
  725. NTTM_TownMove("jamella");
  726.  
  727. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_JAMELLA, 5);
  728. if (me.classid == 6)
  729. NTC_PutSkill(0, NTC_HAND_RIGHT);
  730.  
  731. if(_npc)
  732. {
  733. if(gamble)
  734. {
  735. while(NTC_MyGold() > NTConfig_GambleStopGold)
  736. {
  737. if(NTT_DoInteract(_npc))
  738. {
  739. if(NTT_DoTrade(_npc, 1))
  740. NTT_GambleIt(_npc);
  741.  
  742. me.Cancel(1);
  743. }
  744. else
  745. break;
  746. }
  747. }
  748. else
  749. {
  750. if(NTT_DoInteract(_npc))
  751. {
  752. if(_NTTMGR_DoID || _NTTMGR_BuyPotsInt || _NTTMGR_BuyTP || _NTTMGR_BuyID || _NTTMGR_BuyKey)
  753. {
  754. if(NTT_DoTrade(_npc))
  755. {
  756. if(_NTTMGR_BuyPotsInt)
  757. NTT_FillBelt(_npc);
  758. NTT_FillTome(_npc);
  759. NTT_FillTome(_npc, 1);
  760. if(_NTTMGR_BuyKey)
  761. NTT_FillKey(_npc);
  762. if(_NTTMGR_DoID)
  763. NTTMGR_IDItems(_npc);
  764. }
  765. }
  766.  
  767. me.Cancel(1);
  768. }
  769. }
  770. }
  771. }
  772.  
  773. function NTTMGR_VisitHalbu()
  774. {
  775. var _npc;
  776.  
  777. NTTM_TownMove("halbu");
  778.  
  779. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_HALBU, 5);
  780.  
  781. if(_npc)
  782. {
  783. if(NTT_DoInteract(_npc))
  784. {
  785. if(_NTTMGR_DoRepair || _NTTMGR_BuyArrows)
  786. {
  787. if(NTT_DoTrade(_npc))
  788. {
  789. if(_NTTMGR_DoRepair)
  790. NTT_RepairItems(_npc);
  791. if(_NTTMGR_BuyArrows)
  792. NTT_FillArrows(_npc);
  793. }
  794. me.Cancel(1);
  795. }
  796. }
  797. }
  798. }
  799.  
  800. function NTTMGR_VisitTyrael()
  801. {
  802. var _npc;
  803.  
  804. NTTM_TownMove("tyrael");
  805.  
  806. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_TYRAEL_ACT_4, 5);
  807.  
  808. if(_npc)
  809. {
  810. if(NTT_DoInteract(_npc))
  811. {
  812. NTT_ReviveMerc();
  813. me.Cancel(1);
  814. }
  815. }
  816. }
  817.  
  818. function NTTMGR_VisitMalah()
  819. {
  820. var _npc;
  821.  
  822. NTTM_TownMove("malah");
  823.  
  824. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_MALAH, 5);
  825.  
  826. if(_npc)
  827. {
  828. if(NTT_DoInteract(_npc))
  829. {
  830. if(_NTTMGR_DoID || _NTTMGR_BuyPotsInt || _NTTMGR_BuyTP || _NTTMGR_BuyID || _NTTMGR_BuyKey)
  831. {
  832. if(NTT_DoTrade(_npc))
  833. {
  834. if(_NTTMGR_BuyPotsInt)
  835. NTT_FillBelt(_npc);
  836. NTT_FillTome(_npc);
  837. NTT_FillTome(_npc, 1);
  838. if(_NTTMGR_BuyKey)
  839. NTT_FillKey(_npc);
  840. if(_NTTMGR_DoID)
  841. NTTMGR_IDItems(_npc);
  842. }
  843. }
  844.  
  845. me.Cancel(1);
  846. }
  847. }
  848. }
  849.  
  850. function NTTMGR_VisitLarzuk()
  851. {
  852. var _npc;
  853.  
  854. NTTM_TownMove("larzuk");
  855.  
  856. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_LARZUK, 5);
  857.  
  858. if(_npc)
  859. {
  860. if(NTT_DoInteract(_npc))
  861. {
  862. if(NTT_DoTrade(_npc))
  863. {
  864. if(_NTTMGR_DoRepair || _NTTMGR_BuyArrows)
  865. {
  866. if(_NTTMGR_DoRepair)
  867. NTT_RepairItems(_npc);
  868. if(_NTTMGR_BuyArrows)
  869. NTT_FillArrows(_npc);
  870. }
  871. }
  872.  
  873. me.Cancel(1);
  874. }
  875. }
  876. }
  877. function NTTMGR_VisitQualKehk()
  878. {
  879. var _npc;
  880.  
  881. NTTM_TownMove("qual-kehk");
  882.  
  883. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_QUALKEHK, 5);
  884.  
  885. if(_npc)
  886. {
  887. if(NTT_DoInteract(_npc))
  888. {
  889. NTT_ReviveMerc();
  890. me.Cancel(1);
  891. }
  892. }
  893. }
  894.  
  895. function NTTMGR_VisitAnya()
  896. {
  897. var _npc;
  898.  
  899. NTTM_TownMove("anya");
  900.  
  901. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_ANYA_TOWN, 5);
  902. if (me.classid == 6)
  903. NTC_PutSkill(0, NTC_HAND_RIGHT);
  904.  
  905. if(_npc)
  906. {
  907. while(NTC_MyGold() > NTConfig_GambleStopGold)
  908. {
  909. if(NTT_DoInteract(_npc))
  910. {
  911. if(NTT_DoTrade(_npc, 1))
  912. NTT_GambleIt(_npc);
  913.  
  914. me.Cancel(1);
  915. }
  916. else
  917. break;
  918. }
  919. }
  920. }
  921.  
  922. function NTTMGR_CheckScrolls(scrolltype)
  923. {
  924. var _tome = NTT_GetTome(scrolltype);
  925.  
  926. if(_tome)
  927. return _tome.GetStat(70);
  928.  
  929. return 0;
  930. }
  931. function NTTMGR_CheckKeys()
  932. {
  933. var _key;
  934.  
  935. if(me.classid == NTC_CHAR_CLASS_ASSASSIN)
  936. return 12;
  937.  
  938. _key = NTT_GetKey();
  939.  
  940. if(_key)
  941. return _key.GetStat(70);
  942.  
  943. return 0;
  944. }
  945.  
  946. function NTTMGR_IDItems(npc)
  947. {
  948. Include("libs/common/NTItemlogger.ntl");
  949. var _location;
  950.  
  951. var _tome, _scroll;
  952. var _result;
  953. var _resultArray = new Array();
  954. var _items = NTT_GetUnidItems();
  955. var _keys;
  956. var _npckeys;
  957.  
  958. if(!_items || _items.length < 1)
  959. return;
  960.  
  961. _tome = NTT_GetTome();
  962.  
  963. if(_tome && _tome.GetStat(70) < _items.length)
  964. NTT_FillTome(npc);
  965.  
  966. for(var i = 0 ; i < _items.length ; i++)
  967. {
  968.  
  969. var _isEthereal = ((_items[i].itemflag & 0x400000) == 0x400000);
  970. _location = NTC_GetLocation(_NTTMGR_Simple);
  971. resultArray = NTSI_CheckItem(_items[i]);
  972. result = resultArray[0];
  973. switch(result)
  974. {
  975. case 1:
  976. if(_items[i].itemflag & 0x10) {// second half of repeating item log fix
  977. if(NTConfig_LogSoldItems && NTConfig_UseXMLItemlog) {
  978. if(NTConfig_IndependantLog) {
  979. NTI_WriteILog(_items[i], me, _isEthereal, 12);
  980. } else {
  981. NTI_WriteLog(_items[i], me, _isEthereal, 12);
  982. }
  983. }
  984. NTC_SendLogToOOG(NTC_LOG_ITEM, COLOR_2 + "Kept: " + NTC_ItemQualityToMGRColor[_items[i].quality] + _items[i].name.split("\n")[0]+ ";" + _items[i].itemdesc + COLOR_2 + "\n iLvl: " + _items[i].itemlevel + COLOR_2 + "\n Area: " + _location+ "\n" + COLOR_2 +resultArray[1]+", "+resultArray[2]);
  985. }
  986. case 2:
  987. break;
  988. case -1:
  989. if(_tome)
  990. _result = NTT_IdItem(_tome, _items[i]);
  991. else
  992. {
  993. _scroll = NTT_GetScroll();
  994.  
  995. if(!_scroll)
  996. {
  997. NTT_BuyScrolls(npc);
  998. _scroll = NTT_GetScroll();
  999. }
  1000.  
  1001. _result = NTT_IdItem(_scroll, _items[i]);
  1002. }
  1003.  
  1004. if(_result)
  1005. {
  1006. resultArray = NTSI_CheckItem(_items[i]);
  1007. result = resultArray[0];
  1008. switch(result)
  1009. {
  1010. case 1:
  1011. if(_items[i].itemflag & 0x10){ // second half of repeating item log fix
  1012. if(NTConfig_LogSoldItems && NTConfig_UseXMLItemlog && _items[i].quality >= NTConfig_LogItemQuality) {
  1013. if(NTConfig_IndependantLog) {
  1014. NTI_WriteILog(_items[i], me, _isEthereal, 12);
  1015. } else {
  1016. NTI_WriteLog(_items[i], me, _isEthereal, 12);
  1017. }
  1018. }
  1019.  
  1020. NTC_SendLogToOOG(NTC_LOG_ITEM, COLOR_2 + "Kept: " + NTC_ItemQualityToMGRColor[_items[i].quality] + _items[i].name.split("\n")[0]+ ";" + _items[i].itemdesc + COLOR_2 + "\n iLvl: " + _items[i].itemlevel + COLOR_2 + "\n Area: " + _location+ "\n" + COLOR_2 +resultArray[1]+", "+resultArray[2]);
  1021. }
  1022. case 2:
  1023. break;
  1024. default:
  1025. if(NTConfig_LogSoldItems && NTConfig_UseXMLItemlog && _items[i].quality >= NTConfig_LogItemQuality) {
  1026. if(NTConfig_IndependantLog) {
  1027. NTI_WriteILog(_items[i], me, _isEthereal, 13);
  1028. } else {
  1029. NTI_WriteLog(_items[i], me, _isEthereal, 13);
  1030. }
  1031. }
  1032.  
  1033. if(NTConfig_LogSoldItemQuality != 0 && _items[i].quality >= NTConfig_LogSoldItemQuality) {
  1034. NTC_SendLogToOOG(NTC_LOG_ITEM, COLOR_1 +"Sold: " + NTC_ItemQualityToMGRColor[_items[i].quality] + _items[i].name.split("\n")[0]+ ";" + _items[i].itemdesc + COLOR_2 + "\n iLvl: " + _items[i].itemlevel + COLOR_2 + "\n Area: " + _location);
  1035. }
  1036. NTT_ShopItem(_items[i], npc, 1);
  1037. break;
  1038. }
  1039. }
  1040. else
  1041. {
  1042. if(NTConfig_LogSoldItems && NTConfig_UseXMLItemlog && _items[i].quality >= NTConfig_LogItemQuality) {
  1043. if(NTConfig_IndependantLog) {
  1044. NTI_WriteILog(_items[i], me, _isEthereal, 13);
  1045. } else {
  1046. NTI_WriteLog(_items[i], me, _isEthereal, 13);
  1047. }
  1048. }
  1049. if(NTConfig_LogSoldItemQuality != 0 && _items[i].quality >= NTConfig_LogSoldItemQuality) {
  1050. NTC_SendLogToOOG(NTC_LOG_ITEM, COLOR_1 + "Sold: " + NTC_ItemQualityToMGRColor[_items[i].quality] + _items[i].name.split("\n")[0]+ ";" + _items[i].itemdesc + COLOR_2 + "\n iLvl: " + _items[i].itemlevel + COLOR_2 + "\n Area: " + _location);
  1051. }
  1052. NTT_ShopItem(_items[i], npc, 1);
  1053. }
  1054.  
  1055. break;
  1056. }
  1057. }
  1058. if(NTConfig_UseKeysForPlaceHolder || NTConfig_OpenChest || NTConfig_OpenChestsInArea || NTConfig_OpenHallsSuperChests){
  1059. _npckeys = npc.GetItems(543);
  1060. _keys = me.GetItems(543);
  1061. if(_keys.length < 1 && _npckeys.length > 0) {
  1062. NTT_ShopItem(_npckeys[0], npc, 2);
  1063. }
  1064. }
  1065. }
  1066.  
  1067. // mask - 02=Poison. 04=Amplify Damage. 08=Weaken. 10=Iron Maiden, 20=Decrepify. 40=Lower Resist. 80=Blood Mana.
  1068. function NTTMGR_CheckCurse(selfmask, mercmask, print)
  1069. {
  1070. if(arguments.length < 3) { var print = false }
  1071. if((selfmask.indexOf("02") != -1) && me.GetState(2)) {
  1072. if(print) { Print("I need to cure " + COLOR_1 + "Poison!") }
  1073. return true;
  1074. }
  1075. if((selfmask.indexOf("04") != -1) && me.GetState(9)) {
  1076. if(print) { Print("I need to cure " + COLOR_1 + "Amplify Damage!") }
  1077. return true;
  1078. }
  1079. if((selfmask.indexOf("08") != -1) && me.GetState(19)) {
  1080. if(print) { Print("I need to cure " + COLOR_1 + "Weaken!") }
  1081. return true;
  1082. }
  1083. if((selfmask.indexOf("10") != -1) && me.GetState(55)) {
  1084. if(print) { Print("I need to cure " + COLOR_1 + "Iron Maiden!") }
  1085. return true;
  1086. }
  1087. if((selfmask.indexOf("20") != -1) && me.GetState(60)) {
  1088. if(print) { Print("I need to cure " + COLOR_1 + "Decrepify") }
  1089. return true;
  1090. }
  1091. if((selfmask.indexOf("40") != -1) && me.GetState(61)) {
  1092. if(print) { Print("I need to cure " + COLOR_1 + "Lower Resists!") }
  1093. return true;
  1094. }
  1095. if((selfmask.indexOf("80") != -1) && me.GetState(114)) {
  1096. if(print) { Print("I need to cure " + COLOR_1 + "Blood Mana!") }
  1097. return true;
  1098. }
  1099. var _merc = NTC_GetMerc();
  1100. if(_merc) {
  1101. if((mercmask.indexOf("02") != -1) && _merc.GetState(2)) {
  1102. if(print) { Print("I need to cure " + COLOR_2 + "my Merc's " + COLOR_1 + "Poison!") }
  1103. return true;
  1104. }
  1105. if((mercmask.indexOf("04") != -1) && _merc.GetState(9)) {
  1106. if(print) { Print("I need to cure " + COLOR_2 + "my Merc's " + COLOR_1 + "Amplify Damage!") }
  1107. return true;
  1108. }
  1109. if((mercmask.indexOf("08") != -1) && _merc.GetState(19)) {
  1110. if(print) { Print("I need to cure " + COLOR_2 + "my Merc's " + COLOR_1 + "Weaken!") }
  1111. return true;
  1112. }
  1113. if((mercmask.indexOf("10") != -1) && _merc.GetState(55)) {
  1114. if(print) { Print("I need to cure " + COLOR_2 + "my Merc's " + COLOR_1 + "Iron Maiden!") }
  1115. return true;
  1116. }
  1117. if((mercmask.indexOf("20") != -1) && _merc.GetState(60)) {
  1118. if(print) { Print("I need to cure " + COLOR_2 + "my Merc's " + COLOR_1 + "Decrepify!") }
  1119. return true;
  1120. }
  1121. if((mercmask.indexOf("40") != -1) && _merc.GetState(61)) {
  1122. if(print) { Print("I need to cure " + COLOR_2 + "my Merc's " + COLOR_1 + "Lower Resists!") }
  1123. return true;
  1124. }
  1125. }
  1126. return false;
  1127. }
  1128.  
  1129. // self - 0x01 : Potion
  1130. // merc - 0x01 : Death
  1131. // common - 0x02 : Poison, 0x04 : Amplify Damage, 0x08 : Weaken, 0x10 : Iron Maiden, 0x20 : Decrepify, 0x40 : Lower Resist
  1132. function NTTMGR_CheckSafe(selfmask, mercmask)
  1133. {
  1134. if((mercmask.indexOf("01") != -1) && NTT_CheckMerc()) {
  1135. Print("The Merc is dead!");
  1136. NTU_MercDeathLog();
  1137. //return NTTMGR_VisitTown();
  1138. return true;
  1139. }
  1140. else if((selfmask.indexOf("01") != -1) && NTT_NeedPots()) {
  1141. Print("I need some more potions!");
  1142. //return NTTMGR_VisitTown();
  1143. return true;
  1144. }
  1145. else if(NTTMGR_CheckCurse(selfmask, mercmask)) {
  1146. //return NTTMGR_VisitTown();
  1147. return true;
  1148. } else {
  1149. return false;
  1150. }
  1151. }
  1152.  
  1153. function NTTMGR_SkipCainAct() {
  1154.  
  1155. //var _presentact = me.act
  1156. if(NTConfig_DontCainAct.indexOf(me.act) > -1)
  1157. return false;
  1158. else
  1159. return true;
  1160. }
  1161.  
  1162. function NTTMGR_CheckUnidsGotStashed()
  1163. {
  1164. var _unidcount = 0;
  1165. var _items = me.GetItems();
  1166.  
  1167. if(!_items)
  1168. return _unidcount;
  1169.  
  1170. for(var i = 0 ; i < _items.length ; i++)
  1171. {
  1172. if(_items[i].mode == 0 && _items[i].itemloc == 0 && !(_items[i].itemflag&0x10))
  1173.  
  1174. var _value = NTSI_CheckItem(_items[i])[0];
  1175.  
  1176. if(_value == 1)
  1177. _unidcount++;
  1178. }
  1179. return _unidcount;
  1180. }
  1181.  
  1182. function NTTMGR_VisitCain(check){
  1183.  
  1184. var _location;//edit for PickIt Location by Jinnay
  1185. var _npc;
  1186. var result;
  1187. var _items = me.GetItems();
  1188. var _uniditems = new Array();
  1189. var _dropitems = new Array();
  1190. var _itemlist = new Array();
  1191. var resultArray = new Array();
  1192.  
  1193. for(var i = 0 ; i < _items.length ; i++){
  1194.  
  1195. if(_items[i].mode == 0 && _items[i].itemloc == 0 && !(_items[i].itemflag&0x10)){
  1196.  
  1197. var _value = NTSI_CheckItem(_items[i])[0];
  1198. var _isEthereal = ((_items[i].itemflag & 0x400000) == 0x400000);
  1199.  
  1200. if(_value == 1){// checking for unid kept items here and stash it before we go to cain
  1201. if(_items[i].quality >= 4 && _items[i].itemtype != 4 && (_items[i].itemtype < 76 || _items[i].itemtype > 81)){
  1202. NTTM_TownMove("stash");
  1203. var _stash = NTC_FindUnit(NTC_UNIT_OBJECT, NTC_UNIT_STASH, 5);
  1204. if(_stash){
  1205. if(NTT_DoInteract(_stash)){
  1206. NTTM_StashGold(); // stashgold every time
  1207. NTT_ManageStash(_items[i]);
  1208. //if(NTConfig_UseXMLItemlog) { if(NTConfig_IndependantLog) { NTI_WriteILog(_items[i], me, _isEthereal, 12); } else { NTI_WriteLog(_items[i], me, _isEthereal, 12); } }
  1209. }
  1210. }
  1211. }
  1212.  
  1213. //_cubing = (!check && (NTCU_CheckCubing() || NTRW_CheckRunewords()));
  1214.  
  1215. //if(_cubing || NTT_CheckInventory()){
  1216.  
  1217. if(NTT_CheckInventory()){
  1218. //if(NTConfig_MakeRunewords)
  1219. //NTRW_MakeRuneword();
  1220. //NTT_ManageStash();
  1221. //NTCU_DoCubing();
  1222. if(NTT_DoInteract(_stash)){
  1223. NTTM_StashGold(); // stashgold every time
  1224. NTT_ManageStash();
  1225. }
  1226. me.Cancel(1);
  1227. //NTT_ClearInventory();
  1228. }
  1229.  
  1230. me.Cancel(1);
  1231. }
  1232. else // else push it into the to be id'd array
  1233. _uniditems.push(_items[i]);
  1234. }
  1235. }
  1236.  
  1237. if(NTTMGR_CheckUnidsGotStashed() > 0 && !NTConfig_AlwaysUseCain){ // if we have something to be kept unid and it won't fit in stash, and not always use cain, abort and do normal id function
  1238. Print(COLOR_1 + "That is not suppose to get identified...skipping cain.....");
  1239. return;
  1240. }
  1241.  
  1242. if(_uniditems.length > 0){ // if we have something to be id still, go to cain and id
  1243.  
  1244. NTTM_TownMove("cain");
  1245. _npc = NTC_FindUnit(NTC_UNIT_NPC, GetLocaleString(2890), 5);
  1246.  
  1247. if(!_npc)
  1248. return false;
  1249.  
  1250. if(_npc){
  1251. NTM_MoveTo(me.areaid, _npc.x, _npc.y);
  1252. if(NTT_DoInteract(_npc)){
  1253. for(var i = 0 ; i < 4 ; i++){
  1254. if((i % 4) == 0)
  1255. me.SelectNPCMenu(0x0FB4);
  1256. NTC_Delay(250);
  1257. }
  1258. me.Cancel(1);
  1259. }
  1260.  
  1261. }
  1262.  
  1263. for(var i =0 ; i < _uniditems.length ; i++){ // now we check if the items, now id, are to be kept or sold and push them into the appropriate array
  1264.  
  1265. resultArray = NTSI_CheckItem(_uniditems[i]);
  1266. result = resultArray[0];
  1267. switch(result){
  1268. case 1:
  1269. _itemlist.push(_uniditems[i]);
  1270. break;
  1271. case 2:
  1272. break;
  1273. case 0:
  1274. _dropitems.push(_uniditems[i]);
  1275. break;
  1276. }
  1277. }
  1278. }
  1279.  
  1280. //_cubing = (!check && (NTCU_CheckCubing() || NTRW_CheckRunewords()));
  1281.  
  1282. //if(NTTM_CheckToStash() || _cubing){ // check to see if there is anything to stash and if there is stash them
  1283. if(NTTM_CheckToStash()){ // check to see if there is anything to stash and if there is stash them
  1284. NTTM_TownMove("stash");
  1285. var _stash = NTC_FindUnit(NTC_UNIT_OBJECT, NTC_UNIT_STASH, 5);
  1286.  
  1287. if(_stash){
  1288. NTT_DoInteract(_stash);
  1289. NTTM_StashGold(); // stashgold every time
  1290. }
  1291.  
  1292. if(_itemlist.length > 0){
  1293. for(var i = 0; i < _itemlist.length; i++){ // this puts items into stash and logs them
  1294. if(_itemlist[i].quality >= 4){
  1295. _location = NTC_GetLocation(_NTTMGR_Simple);
  1296. if(NTConfig_UseXMLItemlog) {
  1297. if(NTConfig_IndependantLog) {
  1298. NTI_WriteILog(_itemlist[i], me, _isEthereal, 12); } else { NTI_WriteLog(_itemlist[i], me, _isEthereal, 12); }
  1299. }
  1300. NTC_SendLogToOOG(NTC_LOG_ITEM, COLOR_2 + "Kept: " + NTC_ItemQualityToMGRColor[_itemlist[i].quality] + _itemlist[i].name.split("\n")[0]+ ";" + _itemlist[i].itemdesc + COLOR_2 + "\n iLvl: " + _itemlist[i].itemlevel + COLOR_2 + "\n Area: " + _location+ "\n" + COLOR_2 +resultArray[1]+", "+resultArray[2]);
  1301. }
  1302. NTT_ManageStash(_itemlist[i])
  1303. }
  1304. }
  1305.  
  1306. if(NTT_CheckInventory())
  1307. NTT_ManageStash();
  1308.  
  1309. /*if(_cubing){// probably take out the inventory check...but maybe just leave it there
  1310.  
  1311. if(NTConfig_MakeRunewords)
  1312. NTRW_MakeRuneword();
  1313.  
  1314. NTT_ManageStash();
  1315. NTCU_DoCubing();
  1316.  
  1317. if(NTT_DoInteract(_stash)){// might be able to take this out also
  1318. NTTM_StashGold(); // stashgold every time
  1319. NTT_ManageStash();
  1320. }
  1321. me.Cancel(1);
  1322. }*/
  1323. me.Cancel(1);
  1324. }
  1325.  
  1326. if((_dropitems.length > 0 && !NTConfig_DropCainItems) || (_dropitems.length > 0 && NTC_MyGold() <= NTConfig_PocketChange)){ // this will sell instead of dropping items
  1327. switch(me.act){
  1328.  
  1329. case 1: // sell to akara
  1330. var _npc;
  1331.  
  1332. NTTM_TownMove("akara");
  1333. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_AKARA, 5);
  1334.  
  1335. if(_npc){
  1336. if(NTT_DoInteract(_npc)){
  1337. NTT_DoTrade(_npc, 1)
  1338. for(var i = 0; i < _dropitems.length; i++){ // going to sell here
  1339. if(NTConfig_LogSoldItemQuality != 0 && _dropitems[i].quality >= NTConfig_LogSoldItemQuality){
  1340. _location = NTC_GetLocation(_NTTMGR_Simple);
  1341. if(NTConfig_LogSoldItems && NTConfig_UseXMLItemlog && _dropitems[i].quality >= NTConfig_LogItemQuality) {
  1342. if(NTConfig_IndependantLog) {
  1343. NTI_WriteILog(_dropitems[i], me, _isEthereal, 13);
  1344. }
  1345. else{
  1346. NTI_WriteLog(_dropitems[i], me, _isEthereal, 13);
  1347. }
  1348. }
  1349. NTC_SendLogToOOG(NTC_LOG_ITEM, COLOR_1 + "Sold: " + NTC_ItemQualityToMGRColor[_dropitems[i].quality] + _dropitems[i].name.split("\n")[0]+ ";" + _dropitems[i].itemdesc + COLOR_2 + "\n iLvl: " + _dropitems[i].itemlevel + COLOR_2 + "\n Area: " + _location);
  1350. }
  1351. NTT_ShopItem(_dropitems[i], _npc, 1);
  1352. }
  1353. if(_NTTMGR_BuyPotsInt || _NTTMGR_BuyTP || _NTTMGR_BuyID || _NTTMGR_BuyKey){
  1354. if(_NTTMGR_BuyPotsInt)
  1355. NTT_FillBelt(_npc);
  1356. NTT_FillTome(_npc);
  1357. NTT_FillTome(_npc, 1);
  1358. if(_NTTMGR_BuyKey)
  1359. NTT_FillKey(_npc);
  1360. }
  1361. me.Cancel(1);
  1362. }
  1363. }
  1364. break;
  1365.  
  1366. case 2: //sell to farah or drognan
  1367. var _npc;
  1368. var _buy = false;
  1369.  
  1370. if(_NTTMGR_DoHeal || _NTTMGR_RemoveCurse || _NTTMGR_DoRepair || _NTTMGR_BuyArrows){
  1371. NTTM_TownMove("fara");
  1372. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_FARA, 5);
  1373. }
  1374. else if((_NTTMGR_BuyPots || _NTTMGR_BuyTP) || _NTTMGR_BuyID){
  1375. NTTM_TownMove("drognan");
  1376. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_DROGNAN, 5);
  1377. _buy = true;
  1378. }
  1379. else
  1380. {
  1381. NTTM_TownMove("fara");
  1382. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_FARA, 5);
  1383. }
  1384. if(_npc){
  1385. if(NTT_DoInteract(_npc)){
  1386. NTT_DoTrade(_npc, 1)
  1387. for(var i = 0; i < _dropitems.length; i++){ // going to sell here
  1388. _location = NTC_GetLocation(_NTTMGR_Simple);
  1389.  
  1390. if(NTConfig_LogSoldItems && NTConfig_UseXMLItemlog && _dropitems[i].quality >= NTConfig_LogItemQuality) {
  1391. if(NTConfig_IndependantLog) {
  1392. NTI_WriteILog(_dropitems[i], me, _isEthereal, 13);
  1393. }
  1394. else {
  1395. NTI_WriteLog(_dropitems[i], me, _isEthereal, 13);
  1396. }
  1397. }
  1398. if(NTConfig_LogSoldItemQuality != 0 && _dropitems[i].quality >= NTConfig_LogSoldItemQuality){
  1399. NTC_SendLogToOOG(NTC_LOG_ITEM, COLOR_1 + "Sold: " + NTC_ItemQualityToMGRColor[_dropitems[i].quality] + _dropitems[i].name.split("\n")[0]+ ";" + _dropitems[i].itemdesc + COLOR_2 + "\n iLvl: " + _dropitems[i].itemlevel + COLOR_2 + "\n Area: " + _location);
  1400. }
  1401. NTT_ShopItem(_dropitems[i], _npc, 1);
  1402. }
  1403. if(_buy && (_NTTMGR_DoID || _NTTMGR_BuyPotsInt || _NTTMGR_BuyTP || _NTTMGR_BuyID || _NTTMGR_BuyKey)){
  1404. if(_NTTMGR_BuyPotsInt)
  1405. NTT_FillBelt(_npc);
  1406. NTT_FillTome(_npc);
  1407. NTT_FillTome(_npc, 1);
  1408. }
  1409. me.Cancel(1);
  1410. }
  1411. }
  1412. break;
  1413.  
  1414. case 3: // sell to ormus
  1415. var _npc;
  1416.  
  1417. NTTM_TownMove("ormus");
  1418. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_ORMUS, 5);
  1419.  
  1420. if(_npc){
  1421. if(NTT_DoInteract(_npc)){
  1422. NTT_DoTrade(_npc, 1)
  1423. for(var i = 0; i < _dropitems.length; i++){
  1424. _location = NTC_GetLocation(_NTTMGR_Simple);
  1425. if(NTConfig_LogSoldItems && NTConfig_UseXMLItemlog && _dropitems[i].quality >= NTConfig_LogItemQuality) {
  1426. if(NTConfig_IndependantLog) {
  1427. NTI_WriteILog(_dropitems[i], me, _isEthereal, 13);
  1428. }
  1429. else {
  1430. NTI_WriteLog(_dropitems[i], me, _isEthereal, 13);
  1431. }
  1432. }
  1433. if(NTConfig_LogSoldItemQuality != 0 && _dropitems[i].quality >= NTConfig_LogSoldItemQuality){
  1434. NTC_SendLogToOOG(NTC_LOG_ITEM, COLOR_1 + "Sold: " + NTC_ItemQualityToMGRColor[_dropitems[i].quality] + _dropitems[i].name.split("\n")[0]+ ";" + _dropitems[i].itemdesc + COLOR_2 + "\n iLvl: " + _dropitems[i].itemlevel + COLOR_2 + "\n Area: " + _location);
  1435. }
  1436. NTT_ShopItem(_dropitems[i], _npc, 1);
  1437. }
  1438. if(_NTTMGR_BuyPotsInt || _NTTMGR_BuyTP || _NTTMGR_BuyID){
  1439. if(_NTTMGR_BuyPotsInt)
  1440. NTT_FillBelt(_npc);
  1441. NTT_FillTome(_npc);
  1442. NTT_FillTome(_npc, 1);
  1443. }
  1444. me.Cancel(1);
  1445. }
  1446. }
  1447. break;
  1448.  
  1449. case 4:
  1450. var _npc;
  1451.  
  1452. NTTM_TownMove("jamella");
  1453. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_JAMELLA, 5);
  1454.  
  1455. if(_npc){
  1456. if(NTT_DoInteract(_npc)) {
  1457. NTT_DoTrade(_npc)
  1458. for(var i = 0; i < _dropitems.length; i++) {
  1459. _location = NTC_GetLocation(_NTTMGR_Simple);
  1460.  
  1461. if(NTConfig_LogSoldItems && NTConfig_UseXMLItemlog && _dropitems[i].quality >= NTConfig_LogItemQuality) {
  1462. if(NTConfig_IndependantLog) {
  1463. NTI_WriteILog(_dropitems[i], me, _isEthereal, 13);
  1464. }
  1465. else {
  1466. NTI_WriteLog(_dropitems[i], me, _isEthereal, 13);
  1467. }
  1468. }
  1469. if(NTConfig_LogSoldItemQuality != 0 && _dropitems[i].quality >= NTConfig_LogSoldItemQuality) {
  1470. NTC_SendLogToOOG(NTC_LOG_ITEM, COLOR_1 + "Sold: " + NTC_ItemQualityToMGRColor[_dropitems[i].quality] + _dropitems[i].name.split("\n")[0]+ ";" + _dropitems[i].itemdesc + COLOR_2 + "\n iLvl: " + _dropitems[i].itemlevel + COLOR_2 + "\n Area: " + _location);
  1471. }
  1472.  
  1473. NTT_ShopItem(_dropitems[i], _npc, 1);
  1474. }
  1475. if(_NTTMGR_BuyPotsInt || _NTTMGR_BuyTP || _NTTMGR_BuyID || _NTTMGR_BuyKey) {
  1476. if(_NTTMGR_BuyPotsInt)
  1477. NTT_FillBelt(_npc);
  1478. NTT_FillTome(_npc);
  1479. NTT_FillTome(_npc, 1);
  1480. if(_NTTMGR_BuyKey)
  1481. NTT_FillKey(_npc);
  1482. }
  1483. me.Cancel(1);
  1484. }
  1485. }
  1486. break;
  1487.  
  1488. case 5: // sell to malah
  1489. var _npc;
  1490.  
  1491. NTTM_TownMove("malah");
  1492. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_MALAH, 5);
  1493.  
  1494. if(_npc){
  1495. if(NTT_DoInteract(_npc)){
  1496. NTT_DoTrade(_npc, 1)
  1497. for(var i = 0; i < _dropitems.length; i++) {
  1498.  
  1499. _location = NTC_GetLocation(_NTTMGR_Simple);
  1500.  
  1501. if(NTConfig_LogSoldItems && NTConfig_UseXMLItemlog && _dropitems[i].quality >= NTConfig_LogItemQuality) {
  1502. if(NTConfig_IndependantLog) {
  1503. NTI_WriteILog(_dropitems[i], me, _isEthereal, 13);
  1504. }
  1505. else {
  1506. NTI_WriteLog(_dropitems[i], me, _isEthereal, 13);
  1507. }
  1508. }
  1509. if(NTConfig_LogSoldItemQuality != 0 && _dropitems[i].quality >= NTConfig_LogSoldItemQuality) {
  1510. NTC_SendLogToOOG(NTC_LOG_ITEM, COLOR_1 + "Sold: " + NTC_ItemQualityToMGRColor[_dropitems[i].quality] + _dropitems[i].name.split("\n")[0]+ ";" + _dropitems[i].itemdesc + COLOR_2 + "\n iLvl: " + _dropitems[i].itemlevel + COLOR_2 + "\n Area: " + _location);
  1511. }
  1512. NTT_ShopItem(_dropitems[i], _npc, 1);
  1513. }
  1514. if(_NTTMGR_BuyTP || _NTTMGR_BuyID || _NTTMGR_BuyKey || _NTTMGR_BuyPotsInt) {
  1515. if(_NTTMGR_BuyPotsInt)
  1516. NTT_FillBelt(_npc);
  1517. NTT_FillTome(_npc);
  1518. NTT_FillTome(_npc, 1);
  1519. if(_NTTMGR_BuyKey)
  1520. NTT_FillKey(_npc);
  1521. }
  1522. me.Cancel(1);
  1523. }
  1524. }
  1525. break;
  1526. }
  1527. }
  1528. else if(_dropitems.length > 0 && NTConfig_DropCainItems){ // defualt value will just drop
  1529. SetUIState(0x01, true);
  1530. for(var i = 0; i < _dropitems.length; i++){
  1531. _location = NTC_GetLocation(_NTTMGR_Simple);
  1532.  
  1533. if (NTConfig_LogIgnoredItems && _dropitems[i].quality >= NTConfig_LogItemQuality && NTConfig_UseXMLItemlog) {
  1534. if(NTConfig_IndependantLog) {
  1535. NTI_WriteILog(_dropitems[i], me, _isEthereal, 14);
  1536. }
  1537. else {
  1538. NTI_WriteLog(_dropitems[i], me, _isEthereal, 14);
  1539. }
  1540. }
  1541. if(NTConfig_LogSoldItemQuality != 0 && _dropitems[i].quality >= NTConfig_LogSoldItemQuality) {
  1542. NTC_SendLogToOOG(NTC_LOG_ITEM, COLOR_1 + "Dropped: " + NTC_ItemQualityToMGRColor[_dropitems[i].quality] + _dropitems[i].name.split("\n")[0]+ ";" + _dropitems[i].itemdesc + COLOR_2 + "\n iLvl: " + _dropitems[i].itemlevel + COLOR_2 + "\n Area: " + _location);
  1543. }
  1544. if(NTConfig_AnnounceDroppedItems){
  1545. Print(COLOR_5 + NTC_RandomSelect(NTConfig_dropMessages) + " " + _dropitems[i].name.split("\n")[0]);
  1546. Delay(100);
  1547. }
  1548. NTT_DropItem(_dropitems[i])
  1549. }
  1550. }
  1551. if(GetUIState(0x01))
  1552. me.Cancel(1);
  1553.  
  1554. NTT_ClearInventory();
  1555. return;
  1556. }
  1557.  
  1558. function NTTM_StashGold(){
  1559. if(!NTC_StashGoldFull() && NTC_MyGoldCarry() > 0){
  1560. var _mygold = NTC_MyGoldCarry();
  1561. Gold(3, _mygold);
  1562. for(i = 0 ; i < 2 ; i++){
  1563. NTC_Delay(500);
  1564. if(_mygold > NTC_MyGoldCarry())
  1565. break;
  1566. }
  1567. }
  1568. }
  1569.  
  1570. function NTTM_CheckToStash(){
  1571. _checkItems = me.GetItems();
  1572. if(!_checkItems)
  1573. return false;
  1574. for(var i = 0 ; i < _checkItems.length ; i++){
  1575. if(_checkItems[i].mode == 0 && _checkItems[i].itemloc == 0 && NTConfig_Columns[_checkItems[i].y][_checkItems[i].x] > 0
  1576. && NTSI_CheckItem(_checkItems[i])[0])
  1577. return true;
  1578. }
  1579. return false;
  1580. }
  1581.  
  1582. function NTTM_GCCheckAmu(){
  1583. if(me.GetStat(12) < 88)
  1584. return;
  1585. if(!NTTM_GCHaveAmu() && NTC_MyGold() > NTConfig_GCAmuGold && NTTM_GCCheckIfCrafting() && NTConfig_GC){
  1586. switch(me.act){
  1587. case 1: NTTM_GCVisitGheed();
  1588. break;
  1589. case 2: NTTM_GCVisitElzix();
  1590. break;
  1591. case 3: NTTM_GCVisitAlkor();
  1592. break;
  1593. case 4: NTTM_GCVisitJamella();
  1594. break;
  1595. case 5: NTTM_GCVisitAnya();
  1596. break;
  1597. }
  1598. }
  1599.  
  1600. function NTTM_GCVisitGheed()
  1601. {
  1602. var _npc;
  1603.  
  1604. NTTM_TownMove("gheed");
  1605.  
  1606. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_GHEED, 5);
  1607.  
  1608. if(_npc)
  1609. {
  1610. while(!NTTM_GCHaveAmu()){
  1611. if(NTT_DoInteract(_npc))
  1612. {
  1613. if(NTT_DoTrade(_npc, 1))
  1614. NTTM_GCGambleCraft(_npc);
  1615.  
  1616. me.Cancel(1);
  1617. }
  1618. else
  1619. break;
  1620. }
  1621. }
  1622. }
  1623.  
  1624. function NTTM_GCVisitElzix()
  1625. {
  1626. var _npc;
  1627.  
  1628. NTTM_TownMove("elzix");
  1629.  
  1630. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_ELZIX, 5);
  1631.  
  1632. if(_npc)
  1633. {
  1634. while(!NTTM_GCHaveAmu()){
  1635. if(NTT_DoInteract(_npc))
  1636. {
  1637. if(NTT_DoTrade(_npc, 1))
  1638. NTTM_GCGambleCraft(_npc);
  1639.  
  1640. me.Cancel(1);
  1641. }
  1642. else
  1643. break;
  1644. }
  1645. }
  1646. }
  1647.  
  1648. function NTTM_GCVisitAlkor()
  1649. {
  1650. var _npc;
  1651.  
  1652. NTTM_TownMove("alkor");
  1653.  
  1654. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_ALKOR, 5);
  1655.  
  1656. if(_npc)
  1657. {
  1658. while(!NTTM_GCHaveAmu()){
  1659. if(NTT_DoInteract(_npc))
  1660. {
  1661. if(NTT_DoTrade(_npc, 1))
  1662. NTTM_GCGambleCraft(_npc);
  1663.  
  1664. me.Cancel(1);
  1665. }
  1666. else
  1667. break;
  1668. }
  1669. }
  1670. }
  1671.  
  1672.  
  1673. function NTTM_GCVisitJamella()
  1674. {
  1675. var _npc;
  1676.  
  1677. NTTM_TownMove("jamella");
  1678.  
  1679. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_JAMELLA, 5);
  1680.  
  1681. if(_npc)
  1682. {
  1683. while(!NTTM_GCHaveAmu()){
  1684. if(NTT_DoInteract(_npc))
  1685. {
  1686. if(NTT_DoTrade(_npc, 1))
  1687. NTTM_GCGambleCraft(_npc);
  1688.  
  1689. me.Cancel(1);
  1690. }
  1691. else
  1692. break;
  1693. }
  1694. }
  1695. }
  1696.  
  1697.  
  1698. function NTTM_GCVisitAnya()
  1699. {
  1700. var _npc;
  1701.  
  1702. NTTM_TownMove("anya");
  1703.  
  1704. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_ANYA_TOWN, 5);
  1705.  
  1706. if(_npc)
  1707. {
  1708. while(!NTTM_GCHaveAmu()){
  1709. if(NTT_DoInteract(_npc))
  1710. {
  1711. if(NTT_DoTrade(_npc, 1))
  1712. NTTM_GCGambleCraft(_npc);
  1713.  
  1714. me.Cancel(1);
  1715. }
  1716. else
  1717. break;
  1718. }
  1719. }
  1720. }
  1721. }
  1722.  
  1723. function NTTM_GCHaveAmu(){
  1724. var _items;
  1725. var i;
  1726.  
  1727. _items = me.GetItems();
  1728.  
  1729. if(!_items)
  1730. return false;
  1731.  
  1732. for(i = 0 ; i < _items.length ; i++)
  1733. {
  1734. if(_items[i].itemlevel >= ammyreq){
  1735. if(_items[i].classid == 520 && _items[i].quality == 4 && _items[i].mode == 0)
  1736. return true;
  1737. }
  1738. }
  1739. return false;
  1740. }
  1741.  
  1742. function NTTM_GCGambleCraft(npc){
  1743. var _items, _newitem;
  1744.  
  1745. if(!npc)
  1746. return false;
  1747.  
  1748. if(!GetUIState(0x0C))
  1749. return false;
  1750.  
  1751. _items = npc.GetItems();
  1752.  
  1753. if(!_items)
  1754. return false;
  1755.  
  1756. for(var i = 0 ; i < _items.length ; i++){
  1757.  
  1758. if(_items[i].classid == 520)
  1759. {
  1760. if(NTT_CheckSpace(_items[i].xsize, _items[i].ysize))
  1761. {
  1762. NTT_GetOldItemsInt();
  1763.  
  1764. if(NTT_ShopItem(_items[i], npc, 2))
  1765. _newitem = NTT_GetGambledItemInt();
  1766. else
  1767. return false;
  1768.  
  1769. if(_newitem)
  1770. {
  1771. while(!(_newitem.itemflag&0x10))
  1772. NTC_Delay(100);
  1773. if(ammyreq < 90)
  1774. ammyreq = 90;
  1775. if(_newitem.itemlevel >= ammyreq && _newitem.quality == 4){
  1776. me.Cancel(1);
  1777. NTTM_TownMove("stash");
  1778. _stash = NTC_FindUnit(NTC_UNIT_OBJECT, NTC_UNIT_STASH, 5);
  1779. if(_stash)
  1780. {
  1781. if(NTT_DoInteract(_stash))
  1782. NTT_ManageStash(_newitem);
  1783. }
  1784. return false;
  1785. }else{
  1786. NTT_ShopItem(_newitem, npc, 1);
  1787. }
  1788. }
  1789. }
  1790. }
  1791. }
  1792. me.Cancel(1);
  1793. return true;
  1794. }
  1795.  
  1796. function NTTM_GCCheckIfCrafting(){
  1797. for(i = 0 ; i < NTConfig_CubingItem.length ; i++)
  1798. {
  1799. if(NTConfig_CubingItem[i][1] == 520)
  1800. return true;
  1801. }
  1802. return false;
  1803. }
  1804.  
  1805. function NTMU_CheckMuleStash() {
  1806.  
  1807. var i, x, y;
  1808. var itemsStash;
  1809. var StashHeight = (me.gametype == 0) ? 4 : 8;
  1810.  
  1811. if(arguments.length == 0) { PrintToScreen = false; }
  1812.  
  1813. var _stashspace = new Array(StashHeight);
  1814.  
  1815. for(y = 0 ; y < StashHeight ; y++) {
  1816. _stashspace[y] = new Array(6);
  1817. }
  1818.  
  1819. for(y = 0 ; y < StashHeight ; y++) {
  1820.  
  1821. for(x = 0 ; x < 6 ; x++) {
  1822. _stashspace[y][x] = 0;
  1823. }
  1824. }
  1825.  
  1826. itemsStash = me.GetItems();
  1827.  
  1828. if(!itemsStash) {
  1829. return false;
  1830. }
  1831. //var totalFreeSpace;
  1832. var totalUsedSpace = 0;
  1833. for(i = 0 ; i < itemsStash.length ; i++) {
  1834.  
  1835. if(itemsStash[i].mode == 0 && itemsStash[i].itemloc == 4) {
  1836.  
  1837. if(itemsStash[i].classid == 549) { // id's where the cube is
  1838.  
  1839. for(y = 0 ; y < itemsStash[i].ysize ; y++) {
  1840. for(x = 0 ; x < itemsStash[i].xsize ; x++) {
  1841. _stashspace[y+itemsStash[i].y][x+itemsStash[i].x] = 2;
  1842. totalUsedSpace++
  1843. }
  1844. }
  1845. } else {
  1846.  
  1847. for(y = 0 ; y < itemsStash[i].ysize ; y++) {
  1848. for(x = 0 ; x < itemsStash[i].xsize ; x++) {
  1849. _stashspace[y+itemsStash[i].y][x+itemsStash[i].x] = 1;
  1850. totalUsedSpace++
  1851. }
  1852. }
  1853. }
  1854. }
  1855. }
  1856. var totalFreeSpace = (48 - totalUsedSpace);
  1857. return totalFreeSpace;
  1858. }
  1859.  
  1860. function NTT_CheckMuleInventory()
  1861. {
  1862. var x, y;
  1863. var _items;
  1864.  
  1865. _itemlist = new Array();
  1866. _ignorestring = _NTT_IgnoredItems.join();
  1867.  
  1868. _invspace = new Array(4);
  1869. _invspace[0] = new Array(10);
  1870. _invspace[1] = new Array(10);
  1871. _invspace[2] = new Array(10);
  1872. _invspace[3] = new Array(10);
  1873.  
  1874. for(y = 0 ; y < 4 ; y++)
  1875. {
  1876. for(x = 0 ; x < 10 ; x++)
  1877. _invspace[y][x] = 0;
  1878. }
  1879.  
  1880. _items = me.GetItems();
  1881.  
  1882. if(!_items)
  1883. return false;
  1884.  
  1885. for(var i = 0 ; i < _items.length ; i++)
  1886. {
  1887. if(_items[i].mode == 0 && _items[i].itemloc == 0)
  1888. {
  1889. if(NTConfig_Columns[_items[i].y][_items[i].x] > 0)
  1890. _itemlist.push(_items[i].code);
  1891.  
  1892. for(y = 0 ; y < _items[i].ysize ; y++)
  1893. {
  1894. for(x = 0 ; x < _items[i].xsize ; x++)
  1895. _invspace[y+_items[i].y][x+_items[i].x] = 1;
  1896. }
  1897. }
  1898. }
  1899.  
  1900. _freecolss = new Array(10);
  1901.  
  1902. for(x = 0 ; x < 10 ; x++)
  1903. _freecolss[x] = 0;
  1904.  
  1905. for(x = 0 ; x < 10 ; x++)
  1906. {
  1907. for(y = 0 ; y < 4 ; y++)
  1908. {
  1909. if(_invspace[y][x] == 1)
  1910. {
  1911. _freecolss[x] = 1;
  1912. break;
  1913. }
  1914. }
  1915. }
  1916.  
  1917. _numfreecolss = 0;
  1918.  
  1919. for(x = 0 ; x < 10 ; x++)
  1920. {
  1921. if(_freecolss[x] == 0)
  1922. _numfreecolss++;
  1923. }
  1924.  
  1925. return _numfreecolss;
  1926. }
  1927.  
  1928. function muleScriptRunning()
  1929. {
  1930. for(var i = 0; i < muleScripts.length; i++) {
  1931. var _script = NTC_FindScript(muleScripts[i]);
  1932. if(_script && _script.running) {
  1933. return true;
  1934. }
  1935. }
  1936. }
  1937.  
  1938. function statusSet()
  1939. {
  1940. var status = NT_File("AMS/MuleStatus/" + me.account + "_mulingstatus.txt", 0);
  1941. if(status == "true") {
  1942. return true;
  1943. } else {
  1944. return false;
  1945. }
  1946. }
  1947.  
  1948. function NTTMGR_TossScrolls(){
  1949. var tptome = me.GetItems(518);
  1950. var idtome = me.GetItems(519);
  1951. var _items = me.GetItems();
  1952. if(!_items)
  1953. return;
  1954.  
  1955. for(var g = 0; g < _items.length; g++){
  1956. if((_items[g].classid == 529 && tptome) || (_items[g].classid == 530 && idtome)){
  1957. if(_items[g].mode == 0 && _items[g].itemloc == 0 && NTConfig_Columns[_items[g].y][_items[g].x] > 0 ){
  1958. if(!GetUIState(0x01)){SetUIState(0x01, true);}
  1959. NTT_DropItem(_items[g]);
  1960. }
  1961. }
  1962. }
  1963. if(GetUIState(0x01)){me.Cancel(1);}
  1964. return;
  1965. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement