Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //cmd vars - do NOT touch
  2.     var _MyDT_PreMessage = "";
  3.     var _sealpos = 0;
  4.     var safex;
  5.     var safey;
  6.     var prevx;
  7.     var prevy;
  8. //leader var, will be in char config, maybe
  9.     var leader = "SzClassic-Pala";
  10.  
  11. function NTMain() {
  12.     Include("libs/common/NTCommon.ntl");
  13.     NTC_IncludeLibs();
  14.     NTC_IncludeConfig("NTBot/char_configs");
  15.  
  16.     NT_LoadConfig();
  17.     NTSI_LoadNIPFiles("NTBot/item_configs");
  18.  
  19.     NTA_Initialize();
  20.    
  21.         RegisterEvent(EVENT_GAMEMSG, NT_GameMsgEvents);
  22.    
  23.     if(!NTTM_CheckAct()) {
  24.         NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
  25.         return;
  26.     }
  27.    
  28.     NTC_Delay(1000);
  29.    
  30.     if(!NTTM_CheckAct(4)) {
  31.         NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
  32.         return;
  33.     }
  34.    
  35.     RegisterEvent(EVENT_GAMEMSG, quitfunc);
  36.    
  37.     TD_File("NTBot/bots/TeamD.txt", 1);
  38.    
  39.     if(me.classid == 1) {
  40.         if(!NTTM_CheckAct(1)) {
  41.             NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
  42.             return;
  43.         }
  44.        
  45.         if(NTConfig_DelayStart)
  46.             NTC_Delay(20000);
  47.        
  48.         Print("Loading sorc function");
  49.         NTTMGR_TownManager();  
  50.         TD_Sorcfunc();
  51.     }
  52.    
  53.     if(me.classid == 3) {
  54.         Print("Loading hammer function");
  55.         NTTMGR_TownManager();
  56.         NTTM_TownMove("portalspot");
  57.        
  58.         while(1) {
  59.             TD_TeamCommands();
  60.             Delay(200);
  61.         }
  62.     }
  63.    
  64.     if(me.classid == 4) {
  65.         Print("Loading barb function");
  66.         NTTMGR_TownManager();  
  67.         NTTM_TownMove("portalspot");
  68.        
  69.         while(1) {
  70.             TD_TeamCommands();
  71.             Delay(200);
  72.         }
  73.     }
  74.    
  75.     NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
  76. }
  77.  
  78. function TD_Sorcfunc() { //work in progress!
  79.     NTC_Delay(500);
  80.    
  81.     if(!NTTM_TownMove("waypoint")) {
  82.         NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
  83.         return;
  84.     }
  85.    
  86.     if(!NTM_TakeWaypoint(107)) {
  87.         NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeWaypoint()");
  88.         return;
  89.     }
  90.    
  91.     NTC_Delay(500);
  92.     NTM_MoveTo(me.areaid, me.x+5, me.y);
  93.     for(var i = 0 ; i < 5 ; i++) {
  94.         if(NTM_MakeTP())
  95.             break;
  96.     }
  97.     NTC_Delay(1000);
  98.     TD_File("NTBot/bots/TeamD.txt", 1, ".bo");
  99.    
  100.     while(!me.GetState(32))
  101.         NTC_Delay(500);
  102.  
  103.     NTP_DoPrecast(true);
  104.        
  105.     if(!TD_MoveTo(108, 7802, 5591)) { //urdars! and svs!
  106.         NTC_SendMsgToScript("NTBotGame.ntj", "TD_MoveTo()");
  107.         return;
  108.     }
  109.  
  110.     if(TD_DetectLayout(1) == 1) {
  111.         TD_MoveTo(me.areaid, 7701, 5299);
  112.         TD_Deploy(7681, 5299, 0, 0, 15, 15);
  113.         for(var i = 0 ; i < 5 ; i++) {
  114.             if(NTM_MakeTP())
  115.                 break;
  116.         }
  117.     } else {
  118.         TD_MoveTo(me.areaid, 7700, 5313);
  119.         TD_Deploy(7680, 5313, 15, 15, 0, 0);
  120.         for(var i = 0 ; i < 5 ; i++) {
  121.             if(NTM_MakeTP())
  122.                 break;
  123.         }
  124.     }
  125.    
  126.     TD_File("NTBot/bots/TeamD.txt", 1, ".s1"); //vizier
  127.    
  128.     if(!TD_VizierSeal()){
  129.         NTC_SendMsgToScript("NTBotGame.ntj", "Seal opening");
  130.         return;
  131.     }
  132.     if(TD_DetectLayout(1) == 1)  
  133.         TD_MoveTo(me.areaid, 7701, 5299);
  134.         else
  135.         TD_MoveTo(me.areaid, 7700, 5313);
  136.  
  137.         NTTM_CheckAct();
  138.     while(!TD_IsPlayerOut(108)) {
  139.         //NTA_KillMonster(GetLocaleString(2851));
  140.  
  141.         //NTM_MoveTo(me.areaid, safex, safey);
  142.  
  143.         //NTTM_CheckAct();  
  144.         Delay(500);
  145.     }
  146.    
  147.     NTM_UsePortal("BluePortal", 108, "gdfIII");
  148.    
  149.     if(!NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe))
  150.     {
  151.         NTC_SendMsgToScript("NTBotGame.ntj", "NTTMGR_CheckSafe()");
  152.         return;
  153.     }
  154.    
  155.     NTP_DoPrecast(true);
  156.    
  157.     if(TD_DetectLayout(3) == 1) {
  158.         TD_MoveTo(me.areaid, 7900, 5291);
  159.         TD_Deploy(7920, 5291, 15, 15, 0, 0);
  160.         for(var i = 0 ; i < 5 ; i++) {
  161.             if(NTM_MakeTP())
  162.                 break;
  163.         }
  164.     } else {
  165.         TD_MoveTo(me.areaid, 7910, 5278);
  166.         TD_Deploy(7930, 5278, 0, 15, 15, 0);
  167.         for(var i = 0 ; i < 5 ; i++) {
  168.             if(NTM_MakeTP())
  169.                 break;
  170.         }
  171.     }
  172.  
  173.     TD_File("NTBot/bots/TeamD.txt", 1, ".s3"); //infector
  174.  
  175.     if(!TD_InfectorSeal()){
  176.         NTC_SendMsgToScript("NTBotGame.ntj", "Seal opening");
  177.         return;
  178.     }
  179.    
  180.     if(TD_DetectLayout(3) == 1)
  181.         TD_MoveTo(me.areaid, 7900, 5291);
  182.        
  183.     else
  184.         TD_MoveTo(me.areaid, 7910, 5278);
  185.    
  186.    
  187.     NTTM_CheckAct();
  188.    
  189.     while(!TD_IsPlayerOut(108)) {
  190.         //NTA_KillMonster(GetLocaleString(2853));
  191.         //NTM_MoveTo(me.areaid, safex, safey);
  192.         Delay(500);
  193.     }
  194.    
  195.     NTM_UsePortal("BluePortal", 107, "gdfIII");
  196.    
  197.     if(!NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe))
  198.     {
  199.         NTC_SendMsgToScript("NTBotGame.ntj", "NTTMGR_CheckSafe()");
  200.         return;
  201.     }
  202.    
  203.     NTP_DoPrecast(true);
  204.    
  205.     if(TD_DetectLayout(2) == 1) {
  206.         TD_MoveTo(me.areaid, 7776, 5230);
  207.         TD_Deploy(7776, 5220, 0, 0, 15, 15);
  208.         for(var i = 0 ; i < 5 ; i++) {
  209.             if(NTM_MakeTP())
  210.                 break;
  211.         }
  212.     } else {
  213.         TD_MoveTo(me.areaid, 7779, 5200);
  214.         TD_Deploy(7779, 5180, 0, 0, 15, 15);
  215.         for(var i = 0 ; i < 5 ; i++) {
  216.             if(NTM_MakeTP())
  217.                 break;
  218.         }
  219.     }
  220.    
  221.     TD_File("NTBot/bots/TeamD.txt", 1, ".s2"); //de seis
  222.  
  223.     if(!TD_DeSeisSeal()){
  224.         NTC_SendMsgToScript("NTBotGame.ntj", "Seal opening");
  225.         return;
  226.     }
  227.    
  228.     if(TD_DetectLayout(2) == 1)
  229.         TD_MoveTo(me.areaid, 7776, 5230);
  230.     else
  231.         TD_MoveTo(me.areaid, 7779, 5200);
  232.  
  233.     NTTM_CheckAct();
  234.    
  235.     while(!TD_IsPlayerOut()) {
  236.         //NTA_KillMonster(GetLocaleString(2852));
  237.         //NTM_MoveTo(me.areaid, safex, safey);
  238.         Delay(500);
  239.     }
  240.    
  241.     NTM_UsePortal("BluePortal", 107, "gdfIII");
  242.    
  243.     if(!NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe))
  244.     {
  245.         NTC_SendMsgToScript("NTBotGame.ntj", "NTTMGR_CheckSafe()");
  246.         return;
  247.     }
  248.    
  249.     NTP_DoPrecast(true);
  250.    
  251.     if(!NTM_MoveTo(me.areaid, 7792, 5292)) {
  252.         NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveTo()");
  253.         return;
  254.     }
  255.  
  256.     NTM_MakeTP();
  257.    
  258.     TD_File("NTBot/bots/TeamD.txt", 1, ".d");
  259.    
  260.     NTC_FindUnit(NTC_UNIT_MONSTER, 243, 100);
  261.     if(!NTA_KillMonster(243)) {
  262.         NTSI_PickItems();
  263.         NTC_SendMsgToScript("NTBotGame.ntj", "NTA_KillMonster()");
  264.         return;
  265.     }
  266.     NTSI_PickItems();
  267.    
  268.     //anything else?
  269. }
  270.  
  271. //--internal functions--
  272.  
  273. function quitfunc(msg, type) { //quit when leader leaves game
  274.     if(msg.indexOf("gdfIII") != -1 && (msg.indexOf("weaken") != -1 || msg.indexOf("timeout") != -1)) { //if leader quits
  275.     //if(msg.indexOf("weaken") != -1 || msg.indexOf("timeout") != -1) { //if anyone quits
  276.         NTC_Delay(500);
  277.         ExitGame();
  278.     }
  279. }
  280.  
  281. function TD_Preattack(classid, extrahammers) { //extra hammers = hammers cast after the seal boss is spawned
  282.     NTC_PutSkill(NTConfig_AttackSkill[4], NTC_HAND_RIGHT);
  283.     while(!NTC_FindUnit(NTC_UNIT_MONSTER, classid))
  284.         NTC_CastSkill(NTConfig_AttackSkill[3], 2);
  285.     for(var i = 0 ; i < extrahammers ; i++) {
  286.         NTC_CastSkill(NTConfig_AttackSkill[3], 2);
  287.     }
  288. }
  289.  
  290. function TD_VizierSeal() { //vizier
  291.     for(var i = 0 ; i < 5 ; i++){
  292.         NTM_MoveToPresetUnit(me.areaid, 2, 395);
  293.         var _seal = NTC_FindUnit(NTC_UNIT_OBJECT, 395, 5);
  294.         NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _seal);
  295.        
  296.         NTC_Delay(350);
  297.        
  298.         if(_seal.mode <= 0)
  299.             NTM_MoveTo(me.areaid, safex, safey);
  300.         else
  301.             break;
  302.            
  303.         NTC_Delay(250);
  304.        
  305.         if(i == 4 && _seal.mode <= 0)
  306.             return false;
  307.     }
  308.     for(i = 0 ; i < 5 ; i++){
  309.         NTM_MoveToPresetUnit(me.areaid, 2, 396);
  310.         _seal = NTC_FindUnit(NTC_UNIT_OBJECT, 396, 5);
  311.         NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _seal);
  312.        
  313.         NTC_Delay(350);
  314.        
  315.         if(_seal.mode <= 0)
  316.             NTM_MoveTo(me.areaid, safex, safey);
  317.         else
  318.             break;
  319.            
  320.         NTC_Delay(250);
  321.        
  322.         if(i == 4 && _seal.mode <= 0)
  323.             return false;
  324.     }
  325.     return true;
  326. }
  327.  
  328. function TD_DeSeisSeal(){ //de seis
  329.     for(var i = 0 ; i < 5 ; i++){
  330.         NTM_MoveToPresetUnit(me.areaid, 2, 394);
  331.         _seal = NTC_FindUnit(NTC_UNIT_OBJECT, 394, 5);
  332.         NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _seal);
  333.        
  334.         NTC_Delay(350);
  335.        
  336.         if(_seal.mode <= 0)
  337.             NTM_MoveTo(me.areaid, safex, safey);
  338.         else
  339.             break;
  340.            
  341.         NTC_Delay(250);
  342.        
  343.         if(i == 4 && _seal.mode <= 0)
  344.             return false;
  345.     }
  346.     return true;
  347. }
  348.  
  349. function TD_InfectorSeal() { //infector
  350.     for(var i = 0 ; i < 5 ; i++){
  351.         NTM_MoveToPresetUnit(me.areaid, 2, 393);
  352.         _seal = NTC_FindUnit(NTC_UNIT_OBJECT, 393, 5);
  353.         NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _seal);
  354.    
  355.         NTC_Delay(350);
  356.    
  357.         if(_seal.mode <= 0)
  358.             NTM_MoveTo(me.areaid, safex, safey);
  359.         else
  360.             break;
  361.            
  362.         NTC_Delay(250);
  363.        
  364.         if(i == 4 && _seal.mode <= 0)
  365.             return false;
  366.     }
  367.     for(i = 0 ; i < 5 ; i++){
  368.         NTM_MoveToPresetUnit(me.areaid, 2, 392);
  369.         _seal = NTC_FindUnit(NTC_UNIT_OBJECT, 392, 5);
  370.         NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _seal);
  371.        
  372.         NTC_Delay(350);
  373.    
  374.         if(_seal.mode <= 0)
  375.             NTM_MoveTo(me.areaid, safex, safey);
  376.         else
  377.             break;
  378.            
  379.         NTC_Delay(250);
  380.        
  381.         if(i == 4 && _seal.mode <= 0)
  382.             return false;
  383.     }
  384.     return true;
  385. }
  386.  
  387. function TD_TeamCommands() {
  388.     var _msg = TD_File("NTBot/bots/TeamD.txt", 0);
  389.     if (_msg && _msg != _MyDT_PreMessage) {    
  390.         _MyDT_PreMessage = _msg;
  391.  
  392.         switch (_msg.substring(_msg.indexOf("/") + 1)) {
  393.         case ".bo":
  394.             if(me.classid == 3) { //Hammerdin
  395.                 NTM_UsePortal("BluePortal", 107, "gdfIII");
  396.                 NTC_Delay(500);
  397.                
  398.                
  399.                 while(!me.GetState(32))
  400.                     NTC_Delay(500);
  401.                 NTP_DoPrecast(true);
  402.                 if(!NTM_UsePortal("BluePortal", 103, "gdfIII")) //or make my own?
  403.                     NTTM_CheckAct();
  404.             }
  405.             if(me.classid == 4) { //Barb
  406.                 NTM_UsePortal("BluePortal", 107, "gdfIII");
  407.                 NTP_DoPrecast(true);
  408.                 while(!me.GetState(32))
  409.                     NTP_DoPrecast(true);
  410.                 if(!NTM_UsePortal("BluePortal", 103, "gdfIII")) //or make my own?
  411.                     NTTM_CheckAct();
  412.             }
  413.            
  414.             break;
  415.         case ".s1": //vizier
  416.             if(me.classid == 3) { //Hammerdin
  417.                 NTM_UsePortal("BluePortal", 108, "gdfIII");
  418.  
  419.                
  420.                 TD_Preattack(GetLocaleString(2851), 10);
  421.                 TD_KillMonster(GetLocaleString(2851));
  422.                 NTA_ClearPosition(5);
  423.                 NTSI_PickItems();
  424.  
  425.                 if(!NTM_UsePortal("BluePortal", 103, "gdfIII")) //or make my own?
  426.                     NTTM_CheckAct();
  427.                 NTP_DoPrecast(true);
  428.             }
  429.             if(me.classid == 4) { //Barb
  430.                 NTM_UsePortal("BluePortal", 108, "gdfIII");
  431.                 //for(var i = 0 ; i < 3 ; i++) {
  432.                     NTC_CastSkill(130, NTC_HAND_RIGHT);
  433.                 //  Delay(300);
  434.                 //}
  435.                 NTP_DoPrecast(true);
  436.                 if(!NTM_UsePortal("BluePortal", 103, "gdfIII")) //or make my own?
  437.                     NTTM_CheckAct();
  438.             }
  439.            
  440.             break;
  441.         case ".s2": //de seis
  442.             if(me.classid == 3) { //Hammerdin
  443.                 NTM_UsePortal("BluePortal", 108, "gdfIII");
  444.                
  445.                 TD_Preattack(GetLocaleString(2852), 10);
  446.                 TD_KillMonster(GetLocaleString(2852));
  447.                 NTA_ClearPosition(10);
  448.                 NTSI_PickItems();
  449.                
  450.                 if(!NTM_UsePortal("BluePortal", 103, "gdfIII")) //or make my own?
  451.                     NTTM_CheckAct();
  452.                 NTP_DoPrecast(true);
  453.             }
  454.             if(me.classid == 4) { //Barb
  455.                 NTM_UsePortal("BluePortal", 108, "gdfIII");
  456.                 for(var i = 0 ; i < 3 ; i++) {
  457.                     NTC_CastSkill(130, NTC_HAND_RIGHT);
  458.                     Delay(300);
  459.                 }
  460.                 NTP_DoPrecast(true);
  461.                 if(!NTM_UsePortal("BluePortal", 103, "gdfIII")) //or make my own?
  462.                     NTTM_CheckAct();
  463.             }
  464.            
  465.             break;
  466.         case ".s3": //infector
  467.             if(me.classid == 3) { //Hammerdin
  468.                 NTM_UsePortal("BluePortal", 108, "gdfIII");
  469.                
  470.  
  471.                 TD_Preattack(GetLocaleString(2853), 10);
  472.                 TD_KillMonster(GetLocaleString(2853));
  473.                 NTA_ClearPosition(10);
  474.                 NTSI_PickItems();
  475.                
  476.                 if(!NTM_UsePortal("BluePortal", 103, "gdfIII")) //or make my own?
  477.                     NTTM_CheckAct();
  478.                 NTP_DoPrecast(true);
  479.             }      
  480.             if(me.classid == 4) { //Barb
  481.                 NTM_UsePortal("BluePortal", 108, "gdfIII");
  482.                 //for(var i = 0 ; i < 1 ; i++) {
  483.                     NTC_CastSkill(130, NTC_HAND_RIGHT);
  484.                 //  Delay(300);
  485.                 //}
  486.                 NTP_DoPrecast(true);
  487.                 if(!NTM_UsePortal("BluePortal", 103, "gdfIII")) //or make my own?
  488.                     NTTM_CheckAct();
  489.             }
  490.            
  491.             break;
  492.         case ".d":
  493.             if(me.classid == 3) { //Hammerdin
  494.                     NTM_UsePortal("BluePortal", 108, "gdfIII");
  495.  
  496.                 var _diablo = NTC_FindUnit(NTC_UNIT_MONSTER, 243)
  497.                 while(_diablo && _diablo.hp > 0)
  498.                     NTC_Delay(500);
  499.                     NTSI_PickItems();
  500.             }
  501.             if(me.classid == 4) { //Barb
  502.                 NTM_UsePortal("BluePortal", 108, "gdfIII");
  503.                 NTP_DoPrecast(true);
  504.                
  505.                 //do something until diablo dies
  506.                
  507.                 var _diablo = NTC_FindUnit(NTC_UNIT_MONSTER, 243)
  508.                 while(_diablo && _diablo.hp > 0)
  509.                     NTC_Delay(500);
  510.             }
  511.            
  512.             break;
  513.         case ".u": //urdars! and svs!
  514.             if(me.classid == 3) { //Hammerdin
  515.                 NTM_UsePortal("BluePortal", 108, "gdfIII");
  516.  
  517.                 if(NTC_FindUnit(NTC_UNIT_MONSTER, 362))
  518.                     TD_Preattack(362, 5);
  519.                 else if(NTC_FindUnit(NTC_UNIT_MONSTER, 189))
  520.                     TD_Preattack(189, 5);
  521.                 NTA_ClearPosition(15);
  522.                 NTSI_PickItems();
  523.  
  524.                 if(!NTM_UsePortal("BluePortal", 103, "gdfIII")) //or make my own?
  525.                     NTTM_CheckAct();
  526.                 NTP_DoPrecast(true);
  527.             }
  528.             if(me.classid == 4) { //Barb - ADD SOMETHING EVENTUALLY
  529.                 //Say("Kolton you lazy bastard!");
  530.                 NTC_Delay(250);
  531.             }
  532.            
  533.             break;
  534.  
  535.         }
  536.     }
  537. }
  538.  
  539. function TD_DetectLayout(seal) {
  540.     switch(seal) {
  541.     case 1:
  542.         _sealpos = GetPresetUnits(me.areaid, NTC_UNIT_OBJECT);
  543.         for(var i = 0 ; i < _sealpos.length ; i++) {
  544.             if(_sealpos[i].id == 396) {
  545.                 if(_sealpos[i].roomy*5 + _sealpos[i].y == 5275)
  546.                     return 1;
  547.                 else
  548.                     return 2;
  549.  
  550.                 break;
  551.             }
  552.         }
  553.         break;
  554.     case 2:
  555.         _sealpos = GetPresetUnits(me.areaid, NTC_UNIT_OBJECT);
  556.         for(i = 0 ; i < _sealpos.length ; i++) {
  557.             if(_sealpos[i].id == 394) {
  558.                 if(_sealpos[i].roomx*5 + _sealpos[i].x == 7773)
  559.                     return 1;
  560.                 else
  561.                     return 2;
  562.  
  563.                 break;
  564.             }
  565.         }
  566.         break; 
  567.     case 3:
  568.         _sealpos = GetPresetUnits(me.areaid, NTC_UNIT_OBJECT);
  569.         for(i = 0 ; i < _sealpos.length ; i++) {
  570.             if(_sealpos[i].id == 392) {
  571.                 if(_sealpos[i].roomx*5 + _sealpos[i].x == 7893)
  572.                     return 1;
  573.                 else
  574.                     return 2;
  575.  
  576.                 break;
  577.             }
  578.         }
  579.         break;
  580.     }
  581. }
  582.  
  583. function TD_IsPlayerOut(area) { //function by Thursty
  584.     var _player;
  585.     var _myPartyId;
  586.  
  587.     _player = GetPlayerUnit();
  588.     _myPartyId = _player.partyid;
  589.  
  590.     if(arguments.length < 1)
  591.         _area = me.areaid;
  592.     else
  593.         _area = area;
  594.  
  595.     do {
  596.         if(_player.areaid == _area && _myPartyId == _player.partyid)
  597.             return false;
  598.  
  599.         NTC_Delay(100);
  600.  
  601.     } while(_player.GetNext());
  602.    
  603.     return true;   
  604. }
  605.  
  606. function TD_File(path, mode, msg, delay) { //big thanks to all the koreans out there
  607.     var _msg  = "";
  608.     var _line = "";
  609.     var _fileHandle;
  610.     var _isFileCheck = false;
  611.  
  612.     if (arguments.length < 3) msg   = "";
  613.     if (arguments.length < 4) delay = (mode > 0) ? 5 : 2;
  614.  
  615.     while (delay--) {
  616.         if (mode == 2 && !_isFileCheck) {
  617.             _fileHandle = FileOpen(path, 0);
  618.             if (!_fileHandle)
  619.                 _fileHandle = FileOpen(path, 1);
  620.  
  621.             if (_fileHandle)
  622.                 _fileHandle.Close();
  623.  
  624.             _isFileCheck = true;
  625.         }
  626.  
  627.         _fileHandle = FileOpen(path, mode);
  628.         if (_fileHandle)
  629.             break;
  630.  
  631.         if (delay)
  632.             Delay(200);
  633.     }
  634.  
  635.     if (_fileHandle) {
  636.         if (mode == 0) {
  637.             while (!_fileHandle.eof) {
  638.                 _line = _fileHandle.ReadLine();
  639.                 if (_line || !_fileHandle.eof)
  640.                     _msg += _line + msg;
  641.             }
  642.         }
  643.         else if (msg)
  644.             _fileHandle.WriteLine(msg);
  645.  
  646.         _fileHandle.Close();
  647.     }
  648.  
  649.     return _msg;
  650. }
  651.  
  652. function TD_MoveTo(areaid, x, y, retry, clearpath)
  653. {
  654.     var i, n;
  655.     var _teleport;
  656.     var _path;
  657.     var _retry = 0;
  658.  
  659.     if(x == me.x && y == me.y)
  660.         return true;
  661.  
  662.     if(arguments.length < 4)
  663.         retry = 3;
  664.  
  665.     if(arguments.length < 5)
  666.         clearpath = false;
  667.  
  668.     if(NTC_InTown() || NTC_GetSkillLevel(54) < 1)
  669.         _teleport = false;
  670.     else
  671.         _teleport = true;
  672.  
  673.     _path = GetPath(areaid, me.x, me.y, x, y, _teleport);
  674.  
  675.     if(!_path)
  676.         return false;
  677.  
  678.     for(i = 0 ; i < _path.length ; i++)
  679.     {
  680.         for(n = 0 ; n < 2 ; n++)
  681.         {
  682.             if(_teleport)
  683.             {
  684.                 if(NTM_TeleportTo(_path[i][0], _path[i][1])){
  685.                     if(TDConfig_FindUrdarsAndVenoms)
  686.                         TD_FindUrdar();
  687.                         break;
  688.                 }
  689.             }
  690.             else
  691.             {
  692.                 if(NTM_WalkTo(_path[i][0], _path[i][1]))
  693.                     break;
  694.             }
  695.         }
  696.        
  697.         if(n < 2)
  698.         {  
  699.             if(clearpath)
  700.             {
  701.                 if(!NTA_ClearPosition(20, true, 2))
  702.                     return false;
  703.  
  704.                 NTP_DoPrecast(false);
  705.  
  706.                 NTM_MoveTo(me.areaid, _path[i][0], _path[i][1], 1);
  707.             }
  708.         }
  709.         else if(_retry < retry)
  710.         {
  711.             _path = GetPath(areaid, me.x, me.y, x, y, _teleport);
  712.  
  713.             if(!_path)
  714.                 return false;
  715.  
  716.             i = -1;
  717.             _retry++;
  718.         }
  719.         else
  720.             return false;
  721.     }
  722.  
  723.     return true;
  724. }
  725.  
  726. function TD_FindUrdar(){
  727.     var _urdar = NTC_FindUnit(NTC_UNIT_MONSTER, 189);
  728.     var _sv = NTC_FindUnit(NTC_UNIT_MONSTER, 362);
  729.  
  730.     if(_urdar){
  731.         do{
  732.             if (_urdar.classid == 189 && (_urdar.spectype == 9 || _urdar.spectype == 17) && _urdar.mode != 0 && _urdar.hp > 0 && _urdar.mode != 12 && _urdar.IsAttackable()){
  733.                 NTC_SendLogToOOG(NTC_LOG_COMMON, "ÿc8Killing Urdars!"); //COMMENT THIS LINE IF TESTING IS SUCCESSFUL
  734.  
  735.                 //NTM_MoveTo(me.areaid, _urdar.x, _urdar.y);
  736.                 TD_Deploy(_urdar.x, _urdar.y, 20, 20, 0, 20);
  737.  
  738.                 for(var i = 0 ; i < 5 ; i++) {
  739.                     if(NTM_MakeTP())
  740.                         break;
  741.                 }
  742.  
  743.                 TD_File("NTBot/bots/TeamD.txt", 1, ".u");
  744.  
  745.                 NTA_ClearPosition(12);
  746.                
  747.                 while(!TD_IsPlayerOut()) {
  748.                     NTA_ClearPosition();
  749.                     NTSI_PickItems();
  750.                 }
  751.  
  752.                 TD_File("NTBot/bots/TeamD.txt", 1, "bla");
  753.                
  754.                 NTC_Delay(250);
  755.                 break;
  756.             }
  757.         } while(_urdar.GetNext());
  758.     }
  759.     else if(_sv){
  760.         do{
  761.             if (_sv.classid == 362 && (_sv.spectype == 9 || _sv.spectype == 17) && _sv.mode != 0 && _sv.hp > 0 && _sv.mode != 12 && _sv.IsAttackable()){
  762.                 NTC_SendLogToOOG(NTC_LOG_COMMON, "ÿc8Killing Super Venoms!"); //COMMENT THIS LINE IF TESTING IS SUCCESSFUL
  763.  
  764.                 //NTM_MoveTo(me.areaid, _sv.x, _sv.y);
  765.                 TD_Deploy(_sv.x, _sv.y, 20, 20, 0, 20);
  766.  
  767.                 for(var i = 0 ; i < 5 ; i++) {
  768.                     if(NTM_MakeTP())
  769.                         break;
  770.                 }
  771.  
  772.                 prevx = me.x;
  773.                 prevy = me.y;
  774.  
  775.                 TD_File("NTBot/bots/TeamD.txt", 1, ".u");
  776.  
  777.                 NTA_ClearPosition(15);
  778.  
  779.                 while(!TD_IsPlayerOut()) {
  780.                     NTA_ClearPosition();
  781.                     NTSI_PickItems();
  782.                     NTM_MoveTo(me.areaid, prevx, prevy);
  783.                 }
  784.  
  785.                 TD_File("NTBot/bots/TeamD.txt", 1, "bla");
  786.  
  787.                 NTC_Delay(250);
  788.                 break;
  789.             }
  790.         } while(_sv.GetNext());
  791.     }
  792. }
  793.  
  794. function TD_Deploy(x, y, plusx, minusx, plusy, minusy) { //you can build up to 5 positions (x-shaped), center position is x, y; rest are +/- offsets
  795.     var _monster = NTC_FindUnit(NTC_UNIT_MONSTER);
  796.     var num = [0, 0, 0, 0, 0];
  797.     var firstnum = 100;
  798.    
  799.     if(!_monster)
  800.         return NTM_MoveTo(me.areaid, x, y);
  801.    
  802.     do {
  803.         if(GetDistance(_monster.x, _monster.y, x, y) <= 15)
  804.             if(_monster.classid != 306)
  805.                 num[0]++;
  806.         if(GetDistance(_monster.x, _monster.y, x + plusx, y) <= 15)
  807.             if(_monster.classid != 306)
  808.                 num[1]++;
  809.         if(GetDistance(_monster.x, _monster.y, x - minusx, y) <= 15)
  810.             if(_monster.classid != 306)
  811.                 num[2]++;
  812.         if(GetDistance(_monster.x, _monster.y, x, y + plusy) <= 15)
  813.             if(_monster.classid != 306)
  814.                 num[3]++;
  815.         if(GetDistance(_monster.x, _monster.y, x, y - minusy) <= 15)
  816.             if(_monster.classid != 306)
  817.                 num[4]++;
  818.     }while(_monster.GetNext())
  819.    
  820.     for(var i = 0 ; i < num.length ; i++) {
  821.         //Print("ÿc1" + num[i] + " ÿc:monsters at position ÿc;" + i); //doesn't count storm casters as of v0.8
  822.         if(num[i] < firstnum)
  823.             firstnum = num[i];
  824.     }
  825.  
  826.     if(firstnum == num[0]) {
  827.         safex = x;
  828.         safey = y;
  829.         NTM_MoveTo(me.areaid, x, y);
  830.     }
  831.     else if(firstnum == num[1]) {
  832.         safex = x + plusx;
  833.         safey = y;
  834.         NTM_MoveTo(me.areaid, x + plusx, y);
  835.     }
  836.     else if(firstnum == num[2]) {
  837.         safex = x - minusx;
  838.         safey = y;
  839.         NTM_MoveTo(me.areaid, x - minusx, y);
  840.     }
  841.     else if(firstnum == num[3]) {
  842.         safex = x;
  843.         safey = y + plusy;
  844.         NTM_MoveTo(me.areaid, x, y + plusy);
  845.     }
  846.     else if(firstnum == num[4]) {
  847.         safex = x;
  848.         safey = y - minusy;
  849.         NTM_MoveTo(me.areaid, x, y - minusy);
  850.     }
  851. }
  852.  
  853. function TD_KillMonster(classid)
  854. {
  855.     var _target;
  856.  
  857.     if(NTConfig_AttackSkill[1] < 1)
  858.         return false;
  859.  
  860.     _target = NTC_FindUnit(NTC_UNIT_MONSTER, classid, 5);
  861.  
  862.     if(!_target)
  863.         return false;
  864.  
  865.     if(_target.IsAttackable())
  866.     {
  867.         var _attackcount = 0;
  868.  
  869.         while(_attackcount < 300 && NTA_IsValidMonster(_target))
  870.         {
  871.             if(NTA_Attack(_target, (_attackcount%30) == 0) < 2)
  872.                 break;
  873.            
  874.             if((_attackcount%10) == 5)
  875.                 NTM_MoveTo(me.areaid, _target.x+5, _target.y);
  876.             else if((_attackcount%10) == 0)
  877.                 NTM_MoveTo(me.areaid, _target.x, _target.y+5);
  878.            
  879.             _attackcount++;
  880.         }
  881.     }
  882.  
  883.     return (_target.hp <= 0 || _target.mode == 0 || _target.mode == 12);
  884. }
  885.  
  886. function NT_GameMsgEvents(msg, type){
  887.    
  888.     if(type == 0 && msg.indexOf(_leader) != -1){
  889.         _msg = msg;
  890.     }
  891.  
  892.     else if(type == 4 && (msg.indexOf("weaken") != -1) && (msg.indexOf(_leader) != -1)) {
  893.         NTC_Delay(750);
  894.         ExitGame();
  895.     }
  896. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement