Advertisement
kolton

DiabloHelper

Nov 5th, 2011
733
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function NTMain() {
  2.     Include("libs/common/NTCommon.ntl");
  3.     NTC_IncludeLibs();
  4.     NTC_IncludeConfig("NTBot/char_configs");
  5.     NT_LoadConfig();
  6.     NTSI_LoadNIPFiles("NTBot/item_configs");
  7.     NTA_Initialize();
  8.     Print(COLOR_3 + "Starting Diablo Script");
  9.    
  10.     if(!NTTM_CheckAct(4)){
  11.         NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
  12.         return;
  13.     }
  14.    
  15.     NTTMGR_TownManager();
  16.     NTTM_TownMove("portalspot");
  17.    
  18.     for (i = 0; i < 30; i += 1) {
  19.         if (NTC_InMyParty(NTConfig_Leader)) {
  20.             break;
  21.         }
  22.        
  23.         Delay(500);
  24.     }
  25.    
  26.     if (i === 30) {
  27.         Print("Leader not found.")
  28.         ExitGame();
  29.     }
  30.    
  31.     Print(COLOR_8 + "Waiting for leader's portal.");
  32.    
  33.     while (me.areaid !== 108) {
  34.         UsePortal(108, NTConfig_Leader);
  35.        
  36.         Delay(500);
  37.     }
  38.    
  39.     Print(COLOR_5 + "Precasting");
  40.     NTP_DoPrecast(true);
  41.     NTCS_ClearPosition(15, DistanceSort);
  42.    
  43.     if (!NTConfig_FastChaos) {
  44.         if (NTConfig_Entrance) {
  45.             NTCS_ClearPosition(30, EntranceSort);
  46.             NTM_MoveTo(108, 7790, 5544);
  47.             NTCS_ClearPosition(30, EntranceSort);
  48.            
  49.             var FrontToStarX = [7792,7794,7791,7777,7813,7769,7782,7802,7819,7768,7770,7791,7819, 7804];
  50.             var FrontToStarY = [5564,5529,5495,5486,5486,5445,5421,5421,5446,5390,5355,5355,5376, 5340];
  51.            
  52.             for (var i = 0; i < FrontToStarX.length; i += 1) {
  53.                 NTM_MoveTo(108, FrontToStarX[i], FrontToStarY[i]);
  54.                 NTCS_ClearPosition(35, EntranceSort);
  55.             }
  56.         }
  57.        
  58.         for (i = 0; i < 2; i += 1) {
  59.             NTM_MoveTo(108, 7784, 5310);
  60.             NTCS_ClearPosition(30, SealSort);
  61.             NTC_PingDelay(i < 1 ? 1000 : 10);
  62.         }
  63.        
  64.         NTP_DoPrecast(true);
  65.         NTCS_ClearPosition(30, SealSort);
  66.     }
  67.    
  68.     if (!NT_OpenSealsInt()) {
  69.         NTC_SendMsgToScript("NTBotGame.ntj", "NT_OpenSealsInt()");
  70.         return;
  71.     }
  72.    
  73.     NTM_MoveTo(108, 7792, 5291);
  74.     NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
  75.     Print(COLOR_8 + "Waiting for Diablo to spawn..");
  76.    
  77.     for (i = 0; i < 200; i += 1) {
  78.         if (GetUnit(NTC_UNIT_MONSTER, 243)) {
  79.             break;
  80.         }
  81.        
  82.         NTC_Delay(500);
  83.     }
  84.    
  85.     if (!NTA_KillMonster(243)) {
  86.         NTC_SendMsgToScript("NTBotGame.ntj", "NTA_KillMonster()");
  87.         return;
  88.     }
  89.    
  90.     NTSI_PickItems();
  91.    
  92.     NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
  93. }
  94.  
  95. function NT_OpenSealsInt() {
  96.     var _unit;
  97.     var _result;
  98.    
  99.     _unit = GetPresetUnits(108, NTC_UNIT_OBJECT, 396);
  100.    
  101.     if (!_unit) {
  102.         return false;
  103.     }
  104.    
  105.     if (_unit[0].roomy * 5 + _unit[0].y == 5275) {
  106.         _result = NT_OpenVizierSealInt(1);
  107.     } else {
  108.         _result = NT_OpenVizierSealInt(2);
  109.     }
  110.    
  111.     if (!NTConfig_FastChaos) {
  112.         NTP_DoPrecast(true);
  113.     }
  114.    
  115.     _unit = GetPresetUnits(108, NTC_UNIT_OBJECT, 394);
  116.    
  117.     if (_unit[0].roomx * 5 + _unit[0].x == 7773) {
  118.         _result = NT_OpenDeSeisSealInt(1);
  119.     } else {
  120.         _result = NT_OpenDeSeisSealInt(2);
  121.     }
  122.    
  123.     if (!_result) {
  124.         return false;
  125.     }
  126.    
  127.     if (!NTConfig_FastChaos) {
  128.         NTP_DoPrecast(true);
  129.         NTCS_ClearPosition(40, SealSortB);
  130.     }
  131.    
  132.     _unit = GetPresetUnits(108, NTC_UNIT_OBJECT, 392);
  133.    
  134.     if (!_unit) {
  135.         return false;
  136.     }
  137.    
  138.     if (_unit[0].roomx * 5 + _unit[0].x == 7893) {
  139.         _result = NT_OpenVenomSealInt(1);
  140.     } else {
  141.         _result = NT_OpenVenomSealInt(2);
  142.     }
  143.    
  144.     NTP_DoPrecast(true);
  145.    
  146.     return _result;
  147. }
  148.  
  149. function NT_OpenVizierSealInt(type) {
  150.     var i;
  151.    
  152.     if (!NTConfig_FastChaos) {
  153.         if (type === 1) {
  154.             var vx = [7767,7756,7744,7747,7750,7741,7729,7720,7720,7721,7719,7712,7700,7687,7676, 7666];//   |||   |||
  155.             var vy = [5292,5284,5275,5290,5303,5310,5314,5312,5301,5288,5273,5292,5294,5294,5292, 5307];//      |||
  156.         } else {
  157.             var vx = [7768,7755,7741,7733,7723,7714,7707,7680,7666, 7655];//   |||||||||
  158.             var vy = [5289,5295,5282,5291,5300,5282,5315,5310,5311, 5282];//   |||
  159.         }
  160.    
  161.         for (i = 0; i < vx.length; i += 1) {
  162.             NTM_MoveTo(108, vx[i], vy[i]);
  163.             NTCS_ClearPosition(30, SealSort);
  164.         }
  165.     }
  166.    
  167.     if (NTConfig_LeechSupport) {
  168.         if (type === 1) {
  169.             NTM_MoveTo(108, 7672, 5283);
  170.             NTCS_ClearPosition(25, DistanceSort);
  171.             NTM_MoveTo(108, 7649, 5269);
  172.             NTCS_ClearPosition(25, DistanceSort);
  173.         } else {
  174.             NTM_MoveTo(108, 7654, 5295);
  175.             NTCS_ClearPosition(25, DistanceSort);
  176.             NTM_MoveTo(108, 7647, 5274);
  177.             NTCS_ClearPosition(25, DistanceSort);
  178.         }
  179.     }
  180.    
  181.     if (!NT_OpenSealInt(395) || !NT_OpenSealInt(396)) {
  182.         return false;
  183.     }
  184.    
  185.     if (type == 1) {
  186.         NTM_MoveTo(108, 7691, 5292);
  187.     } else {
  188.         NTM_MoveTo(108, 7695, 5316);
  189.     }
  190.    
  191.     NTCS_Preattack(GetLocaleString(2851));
  192.     NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 306 : null);
  193.     NTA_KillMonster(GetLocaleString(2851)); // Grand Vizier of Chaos
  194.     NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 306 : null);
  195.    
  196.     if(NTConfig_IdInField){
  197.         NT_FieldID();
  198.     }
  199.    
  200.     return true;
  201. }
  202.  
  203. function NT_OpenDeSeisSealInt(type) {
  204.     var i, n;
  205.    
  206.     if (!NTConfig_FastChaos) {
  207.         if (type === 1) {
  208.             var sx = [7791,7783,7800,7809,7785,7773,7773,7776,7794,7811,7817,7815,7798]; // Shape of "2"
  209.             var sy = [5265,5256,5247,5232,5230,5222,5212,5194,5194,5193,5177,5157,5155];
  210.         } else {
  211.             var sx = [7786,7801,7786,7787,7810,7811,7810,7790,7774,7773,7794]; // shape of an "S" or "5"
  212.             var sy = [5263,5249,5245,5227,5233,5215,5198,5194,5181,5156,5154];
  213.         }
  214.        
  215.         for (var i = 0; i < sx.length; i += 1) {
  216.             NTM_MoveTo(108, sx[i], sy[i]);
  217.             NTCS_ClearPosition(30, type === 1 ? SealSort : SealSortB);
  218.         }
  219.     }
  220.    
  221.     if (NTConfig_LeechSupport) {
  222.         if (type === 1) {
  223.             NTM_MoveTo(108, 7794, 5155);
  224.             NTCS_ClearPosition(25, DistanceSort);
  225.             NTM_MoveTo(108, 7777, 5155);
  226.             NTCS_ClearPosition(25, DistanceSort);
  227.         } else {
  228.             NTM_MoveTo(108, 7785, 5154);
  229.             NTCS_ClearPosition(25, DistanceSort);
  230.             NTM_MoveTo(108, 7811, 5155);
  231.             NTCS_ClearPosition(25, DistanceSort);
  232.         }
  233.     }
  234.    
  235.     if (!NT_OpenSealInt(394)) {
  236.         return false;
  237.     }
  238.    
  239.     if (type == 1) {
  240.         NTM_MoveTo(108, 7797, 5201);
  241.        
  242.         for (i = 0; i < 3; i += 1) {
  243.             NTM_TeleportTo(7794, 5227);
  244.         }
  245.     } else {
  246.         NTM_MoveTo(108, 7798, 5186);
  247.     }
  248.    
  249.     NTCS_Preattack(GetLocaleString(2852));
  250.     NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 310 : null);
  251.     NTA_KillMonster(GetLocaleString(2852)); // Lord De Seis
  252.     NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 310 : null);
  253.    
  254.     if (NTConfig_IdInField) {
  255.         NT_FieldID();
  256.     }
  257.    
  258.     return NTM_MoveTo(108, 7800, 5255);
  259. }
  260.  
  261. function NT_OpenVenomSealInt(type) {
  262.     if (!NTConfig_FastChaos) {
  263.         if (type === 1) {
  264.             var IX = [7825,7827,7834,7845,7855,7852,7875,7896,7917]; // shape of a "t"
  265.             var IY = [5293,5276,5291,5315,5301,5278,5293,5295,5291];
  266.         } else {
  267.             var IX = [7822,7826,7832,7850,7868,7877,7891,7907,7927,7932]; // looks like a hook
  268.             var IY = [5297,5278,5307,5278,5297,5276,5276,5276,5279,5298];
  269.         }
  270.        
  271.         for (var i = 0; i < IX.length; i += 1) {
  272.             NTM_MoveTo(108, IX[i], IY[i]);
  273.             NTCS_ClearPosition(30, type === 1 ? SealSort : SealSortB);
  274.         }
  275.     }
  276.    
  277.     if (NTConfig_LeechSupport) {
  278.         if (type === 1) {
  279.             NTM_MoveTo(108, 7898, 5296);
  280.             NTCS_ClearPosition(25, DistanceSort);
  281.             NTM_MoveTo(108, 7892, 5321);
  282.             NTCS_ClearPosition(25, DistanceSort);
  283.         } else {
  284.             NTM_MoveTo(108, 7933, 5302);
  285.             NTCS_ClearPosition(25, DistanceSort);
  286.             NTM_MoveTo(108, 7909, 5313);
  287.             NTCS_ClearPosition(25, DistanceSort);
  288.         }
  289.     }
  290.    
  291.     if (!NT_OpenSealInt(393) || !NT_OpenSealInt(392)) {
  292.         return false;
  293.     }
  294.    
  295.     if (type === 1) {
  296.         type = 1; // temp
  297.     } else {
  298.         NTM_MoveTo(108, 7933, 5299);
  299.     }
  300.    
  301.     NTCS_Preattack(GetLocaleString(2853));
  302.     NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 362 : null);
  303.     NTA_KillMonster(GetLocaleString(2853)); // Infector of Souls
  304.     NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 362 : null);
  305.    
  306.     if(NTConfig_IdInField){
  307.         NT_FieldID();
  308.     }
  309.    
  310.     if (NTC_PutSkill(124, NTC_HAND_RIGHT)) {
  311.         NTC_PingDelay(1000);
  312.     }
  313.    
  314.     return true;
  315. }
  316.  
  317. function NT_OpenSealInt(classid) { // helper stands on top of a seal but doesn't open it
  318.     var i, seal;
  319.    
  320.     for (i = 0; i < 100; i += 1) {
  321.         NTM_MoveToPresetUnit(108, 2, classid, -3, -3);
  322.         NTA_ClearPosition();
  323.        
  324.         seal = NTC_FindUnit(NTC_UNIT_OBJECT, classid);
  325.        
  326.         if (!seal) {
  327.             return false;
  328.         }
  329.        
  330.         if (seal.mode) { // for pubbies
  331.             return true;
  332.         }
  333.        
  334.         NTC_Delay(400);
  335.     }
  336.    
  337.     return false;
  338. }
  339.  
  340. //
  341.  
  342. function NTA_MonsterStats(unit) {
  343.     this.name = unit.name;
  344.     this.x = unit.x;
  345.     this.y = unit.y;
  346.     this.gid = unit.gid;
  347.     this.classid = unit.classid;
  348.     this.spectype = unit.spectype;
  349. }
  350.  
  351. function DistanceSort(unitA, unitB) {
  352.     if (GetDistance(me.x, me.y, unitA.x, unitA.y) < GetDistance(me.x, me.y, unitB.x, unitB.y)) {
  353.         return -1;
  354.     }
  355.    
  356.     return 1;
  357. }
  358.  
  359. function EntranceSort(unitA, unitB) {
  360.     if (GetDistance(unitA.x, unitA.y, 7790, 5544) < GetDistance(unitB.x, unitB.y, 7790, 5544)) {
  361.         return -1;
  362.     }
  363.    
  364.     return 1;
  365. }
  366.  
  367. function SealSort(unitA, unitB) {  
  368.     if (GetDistance(unitA.x, unitA.y, 7784, 5310) < GetDistance(unitB.x, unitB.y, 7784, 5310)) {
  369.         return -1;
  370.     }
  371.    
  372.     return 1;
  373. }
  374.  
  375. function SealSortB(unitA, unitB) { 
  376.     if (GetDistance(unitA.x, unitA.y, 7800, 5255) < GetDistance(unitB.x, unitB.y, 7800, 5255)) {
  377.         return -1;
  378.     }
  379.    
  380.     return 1;
  381. }
  382.  
  383. function NTCS_Preattack(name) {
  384.     var i, n, target, pos, positions;
  385.    
  386.     target = NTC_FindUnit(1, name, 10);
  387.    
  388.     switch (me.classid) {
  389.         case 0:
  390.             break;
  391.         case 1:
  392.             break;
  393.         case 2:
  394.             break;
  395.         case 3:
  396.             if (!target) {
  397.                 return;
  398.             }
  399.            
  400.             positions = [[6, 11], [0, 8], [8, -1], [-9, 2], [0, -11], [8, -8]];
  401.            
  402.             for (i = 0; i < positions.length; i += 1) {
  403.                 if (CheckCollision(me.areaid, target.x + positions[i][0], target.y + positions[i][1], 1)) { // check if we can move there
  404.                     Print("Preattack position: " + positions[i][0] + " " + positions[i][1]);
  405.                
  406.                     NTM_MoveTo(108, target.x + positions[i][0], target.y + positions[i][1]);
  407.                     NTC_PutSkill(NTConfig_AttackSkill[2], NTC_HAND_RIGHT);
  408.                    
  409.                     for (n = 0; n < 8; n += 1) {
  410.                         NTC_CastSkill(NTConfig_AttackSkill[1], 2);
  411.                     }
  412.                    
  413.                     break;
  414.                 }
  415.             }
  416.            
  417.             break;
  418.         case 4:
  419.             if (!target || NTConfig_AttackSkill[0] < 0) {
  420.                 return;
  421.             }
  422.            
  423.             pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, 20, 4);
  424.            
  425.             if (pos) {
  426.                 NTM_MoveTo(108, pos[0], pos[1]);
  427.             }
  428.            
  429.             for (i = 0; i < 2; i += 1) {
  430.                 NTC_CastSkill(130, NTC_HAND_RIGHT);
  431.                 NTC_Delay(150);
  432.             }
  433.            
  434.             break;
  435.         case 5:
  436.             break;
  437.         case 6:
  438.             break;
  439.     }
  440. }
  441.  
  442. // general functions
  443.  
  444. function OpenStashes(range) {
  445.     var i, unit,
  446.         objects = [GetLocaleString(3274)],
  447.         orgx = me.x,
  448.         orgy = me.y;
  449.    
  450.     for (i = 0; i < objects.length; i += 1) {
  451.         unit = NTC_FindUnit(NTC_UNIT_OBJECT, objects[i]);
  452.        
  453.         if (unit) {
  454.             do {
  455.                 if (GetDistance(orgx, orgy, unit.x, unit.y) <= range) {
  456.                     if (NTC_OpenChest(unit)) {
  457.                         NTSI_PickItems();
  458.                     }
  459.                 }
  460.             } while (unit.GetNext());
  461.         }
  462.     }
  463. }
  464.  
  465. function NTT_CheckPotionSafe() {
  466.     var i, items, hpCheck, mpCheck;
  467.    
  468.     items = me.GetItems();
  469.    
  470.     if (NTConfig_BeltColType.indexOf("hp") > -1) {
  471.         for (i = 0; i < items.length; i += 1) {
  472.             if (!hpCheck && items[i].mode === 2 && items[i].code.indexOf("hp") > -1) {
  473.                 hpCheck = true;
  474.             }
  475.         }
  476.     } else {
  477.         hpCheck = true;
  478.     }
  479.    
  480.     if (NTConfig_BeltColType.indexOf("mp") > -1) {
  481.         for (i = 0; i < items.length; i += 1) {
  482.             if (!mpCheck && items[i].mode === 2 && items[i].code.indexOf("mp") > -1) {
  483.                 mpCheck = true;
  484.             }
  485.         }
  486.     } else {
  487.         mpCheck = true;
  488.     }
  489.    
  490.     return !(hpCheck && mpCheck);
  491. }
  492.  
  493. function NTA_Dodge(target, distance) {
  494.     var i, j, coordx, coordy, monster, count,
  495.         maxcount = 999,
  496.         coords = [],
  497.         goodCoords = [],
  498.         monList = [],
  499.         angles = [45, 90, 135, 180, 225, 270, 305, 360];
  500.  
  501.     for (i = 0; i < angles.length; i += 1) {
  502.         coordx = Math.round((Math.cos(angles[i] * Math.PI / 180)) * distance + target.x);
  503.         coordy = Math.round((Math.sin(angles[i] * Math.PI / 180)) * distance + target.y);
  504.        
  505.         if (CheckCollision(me.areaid, coordx, coordy, 1)) {
  506.             coords.push([coordx, coordy]);
  507.         }
  508.     }
  509.    
  510.     if (coords.length === 0) { // no valid positions - don't move
  511.         return true;
  512.     }
  513.    
  514.     coords.sort(NTA_SortRooms);
  515.    
  516.     monster = GetUnit(1);
  517.    
  518.     if (monster) {
  519.         do {
  520.             if (monster.hp > 0) {
  521.                 monList.push(new NTA_MonsterStats(target));
  522.             }
  523.         } while (monster.GetNext());
  524.     }
  525.    
  526.     for (i = 0; i < coords.length; i += 1) {
  527.         count = 0;
  528.        
  529.         for (j = 0; j < monList.length; j += 1) {
  530.             if (monList[j].hp > 0 && GetDistance(monList[j].x, monList[j].y, coords[i][0], coords[i][1]) < 10) {
  531.                 count += 1;
  532.             }
  533.         }
  534.        
  535.         if (count < maxcount) {
  536.             goodCoords = [coords[i][0], coords[i][1]];
  537.             maxcount = count;
  538.            
  539.             if (count === 0) {
  540.                 break;
  541.             }
  542.         }
  543.     }
  544.    
  545.     if (goodCoords.length > 0) { // just in case goodCoords is empty (shouldn't happen)
  546.         if (Math.abs(me.x - goodCoords[0]) < 3 && Math.abs(me.y - goodCoords[1]) < 3) { // close enough
  547.             return true;
  548.         }
  549.        
  550.         Say("!Dodge " + target.name);
  551.         NTM_MoveTo(me.areaid, goodCoords[0], goodCoords[1]);
  552.     }
  553.    
  554.     return true;
  555. }
  556.  
  557. function NTCS_ClearPosition(range, sortFunc, spectype, classid) {
  558.     var i, orgx, orgy, monList, skipList, target, result,
  559.         gidAttack = [],
  560.         dodgeIDs = [310, 362],
  561.         attackcount = 0;
  562.        
  563.     if (NTConfig_AttackSkill[1] < 0 || NTConfig_AttackSkill[3] < 0) {
  564.         return false;
  565.     }
  566.    
  567.     switch (arguments.length) {
  568.     case 0:
  569.         range = 20;
  570.     case 1:
  571.         sortFunc = DistanceSort;
  572.     case 2:
  573.         spectype = false;
  574.     case 3:
  575.         classid = false;
  576.         break;
  577.     }
  578.    
  579.     orgx = me.x;
  580.     orgy = me.y;
  581.     skipList = [];
  582.    
  583.     MainLoop : while (attackcount < 300) {
  584.         monList = [];
  585.         target = NTC_FindUnit(NTC_UNIT_MONSTER);
  586.        
  587.         if (target) {
  588.             do {
  589.                 if (skipList.indexOf(target.gid) < 0) {
  590.                     if (target.IsAttackable() && (!classid || target.classid === classid) && (!spectype || target.spectype & spectype)) {
  591.                         if (NTA_IsValidMonster(target)) {
  592.                             if (GetDistance(orgx, orgy, target.x, target.y) <= range) {
  593.                                 monList.push(new NTA_MonsterStats(target));
  594.                             }
  595.                            
  596.                             if ((me.classid === 1 || me.classid === 2 || me.classid === 6) && NTConfig_Dodge && GetDistance(me, target) < 7 && dodgeIDs.indexOf(target.classid) > -1) {
  597.                                 NTA_Dodge(target, target.spectype & 0xA ? _NTA_SkillRange[1] : _NTA_SkillRange[3]);
  598.                                 continue MainLoop;
  599.                             }
  600.                         }
  601.                     } else {
  602.                         skipList.push(target.gid);
  603.                     }
  604.                 }
  605.             } while (target.GetNext());
  606.         }
  607.        
  608.         if (monList.length === 0) {
  609.             break;
  610.         }
  611.        
  612.         monList.sort(sortFunc);
  613.        
  614.         target = NTC_FindUnit(NTC_UNIT_MONSTER, monList[0].gid);
  615.        
  616.         if (target && target.IsAttackable()) {
  617.             result = NTA_Attack(target, attackcount % 30 === 0);
  618.            
  619.             switch (result) {
  620.             case 1:
  621.                 skipList.push(target.gid);
  622.                 monList.shift();
  623.                 break;
  624.             case 2:
  625.             case 3:
  626.                 if(!gidAttack[target.gid]) {
  627.                     gidAttack[target.gid] = 0;
  628.                 }
  629.                
  630.                 gidAttack[target.gid] += 1;
  631.                
  632.                 if (gidAttack[target.gid] > NTConfig_LowMaxAttacks) {
  633.                     Print(COLOR_1 + " Skipping " + target.name);
  634.                     monList.shift();
  635.                     skipList.push(target.gid);
  636.                 }
  637.                
  638.                 attackcount += 1;
  639.                
  640.                 if (target.mode === 0 || target.mode === 12) {
  641.                     NTSI_FastPick();
  642.                 }
  643.                
  644.                 break;
  645.             default:
  646.                 return false;
  647.             }
  648.         } else {
  649.             monList.shift();
  650.         }
  651.     }
  652.    
  653.     switch (me.classid) {
  654.         case NTC_CHAR_CLASS_PALADIN:
  655.             if (attackcount > 2 && (parseInt(me.hp * 100/ me.hpmax) < NTConfig_UseRedemptionHP || parseInt(me.mp * 100 / me.mpmax) < NTConfig_UseRedemptionMP)) {
  656.                 if (NTC_PutSkill(124, NTC_HAND_RIGHT)) {
  657.                     NTC_PingDelay(1000);
  658.                 }
  659.             }
  660.            
  661.             break;
  662.         case NTC_CHAR_CLASS_NECROMANCER:
  663.             if (typeof(NTA_SkeletonArmy) === 'function') { // old summon code
  664.                 NTA_SkeletonArmy(NTConfig_SkeletonArmy);
  665.                 NTA_MageArmy(NTConfig_MageArmy);
  666.                 NTA_ReviveArmy(NTConfig_ReviveArmy);
  667.             } else {
  668.                 NTA_RaiseArmy(); // new summon code
  669.             }
  670.             break;
  671.         case NTC_CHAR_CLASS_SORCERESS:
  672.             if (me.GetState(30) === 0) {
  673.                 NTC_CastSkill(58, NTC_HAND_RIGHT);
  674.             }
  675.            
  676.             break;
  677.         case NTC_CHAR_CLASS_BARBARIAN:
  678.             if (attackcount > 0) {
  679.                 if (typeof(MWL_FindItem) === 'function') { // in case of using muddy's item find (like myself)
  680.                     MWL_FindItem(20);
  681.                 } else if (NTConfig_UseFindItem && !NTA_CheckForCloseMonsters(10)) {
  682.                     NTA_FindItem(NTConfig_FindItemRange);
  683.                 }
  684.             }
  685.            
  686.             break;
  687.     }
  688.    
  689.     if (attackcount > 0) {
  690.         NTSI_PickItems();
  691.     }
  692.    
  693.     if (NTConfig_OpenChest) {
  694.         OpenStashes(range);
  695.     }
  696.    
  697.     if (NTT_CheckMerc()) {
  698.         Print(COLOR_1 + " Merc died, going to town.");
  699.         NTTMGR_VisitTown();
  700.     }
  701.    
  702.     if (NTT_CheckPotionSafe()) {
  703.         Print(COLOR_1 + " Out of potions, going to town.");
  704.         NTTMGR_VisitTown();
  705.     }
  706.    
  707.     if (NTConfig_IdInField) {
  708.         if (!NTT_CheckSpace(NTConfig_FreeSpaceXY[0], NTConfig_FreeSpaceXY[1])) {
  709.             NT_FieldID();
  710.         }
  711.     }
  712.    
  713.     return true;
  714. }
  715.  
  716. function NTA_SortRooms(a, b) {
  717.     if (GetDistance(me.x, me.y, a[0], a[1]) < GetDistance(me.x, me.y, b[0], b[1])) {
  718.         return -1;
  719.     }
  720.    
  721.     return 1;
  722. }
  723.  
  724. function UsePortal(area, owner) {
  725.     var i, unit;
  726.    
  727.     unit = NTC_FindUnit(2, GetLocaleString(3226));
  728.    
  729.     if (unit) {
  730.         do {
  731.             if (unit.mode === 2 && unit.GetParent() === owner && (unit.subareaid === area || unit.subareaid === area + 256 || unit.subareaid === area + 768)) {
  732.                 for (i = 0; i < 50; i += 1) {
  733.                     if (i % 10 === 0) {
  734.                         NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, unit);
  735.                         NTC_Delay(250);
  736.                        
  737.                         if (me.areaid === area) {
  738.                             return true;
  739.                         }
  740.                     }
  741.                 }
  742.             }
  743.         } while (unit.GetNext());
  744.     }
  745.    
  746.     return false;
  747. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement