Guest User

Untitled

a guest
Apr 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function NTMain(){
  2.  
  3.     Include("libs/common/NTCommon.ntl");
  4.     NTC_IncludeLibs();
  5.     NTC_IncludeConfig("NTBot/char_configs");
  6.  
  7.     NT_LoadConfig();
  8.     NTSI_LoadNIPFiles("NTBot/item_configs");
  9.  
  10.     NTA_Initialize();
  11.    
  12.     if(!NTTM_CheckAct()){
  13.         NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
  14.         return;
  15.     }
  16.     NTTMGR_TownManager();
  17.     if(!NTTM_TownMove("waypoint")){
  18.         NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
  19.         return;
  20.     }
  21.     if(!NTM_TakeWaypoint(3)){
  22.         NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeWaypoint()");
  23.         return;
  24.     }
  25.     NTP_DoPrecast(true);
  26.     if(!NTM_MoveToPresetUnit(17, NTC_UNIT_TILE, 7, 8, 0)){
  27.         NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveToPresetUnit()");
  28.         return;
  29.     }
  30.     if(NTConfig_KillBloodRaven) {
  31.         if(NTConfig_OpenChestsInArea && NTU_DontOpenAreas()){
  32.             OpenChestsInArea();  
  33.         }
  34.         NTA_KillMonster(GetLocaleString(3111));
  35.         if(NTConfig_ClearPosition){
  36.             NTA_ClearPosition();
  37.         }
  38.         NTSI_PickItems();  
  39.         if(NTConfig_OpenChestsInArea && NTU_DontOpenAreas()){
  40.             OpenChestsInArea();
  41.         }
  42.     }
  43.     if(NTConfig_ClearMausoleum){    
  44.         if(!NTM_MoveToStair(me.areaid, 19)){
  45.             NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveToStair()");
  46.             return;
  47.         }
  48.         if(!NTM_TakeStair(19)){
  49.             NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeStair()");
  50.             return;
  51.         }
  52.         NTP_DoPrecast();
  53.         if(NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe)){
  54.             NTTMGR_VisitTown();
  55.         }
  56.         if(NTConfig_OpenChest){
  57.             if(!NTM_MoveToPresetUnit4(me.areaid, NTC_UNIT_OBJECT, 397))
  58.             Print("Error going to the chest.");
  59.             var _chest;
  60.             _chest = NTC_FindUnit(NTC_UNIT_OBJECT, GetLocaleString(3260));
  61.             if(_chest){
  62.                 if(NTM_MoveTo(_chest.areaid, _chest.x+1, _chest.y)){
  63.                     if(NTC_OpenChest(_chest))
  64.                     NTSI_PickItems();
  65.                 }
  66.             }
  67.         }      
  68.         if(!NTA_ClearLevel()){
  69.             NTC_SendMsgToScript("NTBotGame.ntj", "NTA_ClearLevel()");
  70.             return;
  71.         }    
  72.         if(NTConfig_OpenChestsInArea && NTU_DontOpenAreas()){
  73.             OpenChestsInArea();
  74.         }
  75.         if(!NTM_MoveToStair(me.areaid, 17)){
  76.             NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveToStair()");
  77.             return;
  78.         }    
  79.         if(!NTM_TakeStair(17)){
  80.             NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeStair()");
  81.             return;
  82.         }
  83.     }
  84.     if(NTConfig_ClearCrypt){   
  85.         if(!NTM_MoveToStair(me.areaid, 18)){
  86.             NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveToStair()");
  87.             return;
  88.         }
  89.         if(!NTM_TakeStair(18)){
  90.             NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeStair()");
  91.             return;
  92.         }
  93.         NTP_DoPrecast();
  94.         if(NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe)){
  95.             NTTMGR_VisitTown();
  96.         }
  97.         if(NTConfig_OpenChest){      
  98.             if(!NTM_MoveToPresetUnit4(me.areaid, NTC_UNIT_OBJECT, 397))
  99.             Print("Error going to the chest.");
  100.             var _chest;
  101.             _chest = NTC_FindUnit(NTC_UNIT_OBJECT, GetLocaleString(3260));
  102.             if(_chest){
  103.          
  104.                 if(NTM_MoveTo(_chest.areaid, _chest.x+1, _chest.y)){
  105.                     if(NTC_OpenChest(_chest))
  106.                     NTSI_PickItems();
  107.                 }
  108.             }
  109.         }      
  110.         if(!NTA_ClearLevel()){
  111.             NTC_SendMsgToScript("NTBotGame.ntj", "NTA_ClearLevel()");
  112.             return;
  113.         }
  114.         if(NTConfig_OpenChestsInArea && NTU_DontOpenAreas())
  115.             OpenChestsInArea();
  116.     }
  117.     NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
  118. }
  119.  
  120. function NTM_MoveToPresetUnit4(areaid, unittype, classid, offsetx, offsety, clearpath){ // Edit
  121.     var i, _unit;
  122.     if(arguments.length < 4){
  123.         offsetx = 0;
  124.         offsety = 0;
  125.     }
  126.     if(arguments.length < 6)
  127.         clearpath = false;
  128.     _unit = GetPresetUnits(areaid, unittype);
  129.     if(!_unit)
  130.         return false;
  131.     for(i = 0 ; i < _unit.length ; i++){
  132.         if(_unit[i].id == classid)
  133.             return NTM_MoveTo(areaid, _unit[i].roomx*5+_unit[i].x+offsetx, _unit[i].roomy*5+_unit[i].y+offsety, 2, clearpath);
  134.     }
  135.     NTC_PingDelay(200);
  136.     _unit = GetPresetUnits(areaid, unittype);
  137.     if(!_unit)
  138.         return false;
  139.     for(i = 0 ; i < _unit.length ; i++){
  140.         if(_unit[i].id == classid)
  141.             return NTM_MoveTo(areaid, _unit[i].roomx*5+_unit[i].x+offsetx, _unit[i].roomy*5+_unit[i].y+offsety, 2, clearpath);
  142.     }
  143.     return false;
  144. }
Add Comment
Please, Sign In to add comment