Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 18th, 2010 | Syntax: JavaScript | Size: 6.56 KB | Hits: 53 | Expires: Never
Copy text to clipboard
  1. // default.dbj gets executed upon gamejoin
  2.  
  3. var sh = null;
  4.  
  5. js_strict(true);
  6. function main()
  7. {
  8.  
  9.    
  10. sendCopyData(null, "OOG", 0,me.classid+" classid");
  11. while(!me.area ) {
  12.  sendCopyData(null, "OOG", 0,"pregame delay");
  13.   delay(100);
  14. }
  15.  
  16. var NT_StartTime= getTickCount();
  17.  
  18. //print ("me.getItemNew.length "+i.length)
  19. //var a = new Object();        
  20.  //a = new NpcGetItem(me,null,null,null);
  21.        
  22.         if(me.itemoncursor){ // checks to see if you have a merc weapon on cursor puts it on merc it can else stops
  23.                 var item = getUnit(100);
  24.                 if (item){                     
  25.                         if (item.bodylocation ==4 && item.getFlag(0x4000000)){
  26.                                 var merc = me.getMerc();
  27.                                 if (merc){
  28.                                         var mercItems = merc.getItems();
  29.                                         var hasWep = false;
  30.                                         for(var i = 0 ; i < mercItems.length ; i++){
  31.                                                 if (mercItems[i].bodylocation ==4)
  32.                                                         hasWep= true;                                          
  33.                                         }
  34.                                         if (!hasWep){
  35.                                                 print("trying to reset merc weapon");
  36.                                                 clickItem(4, 4);
  37.                                                 delay(1000);
  38.                                         }
  39.                                 }
  40.                                 if(me.itemoncursor){
  41.                                         print("item on curor runeword wep stopping")
  42.                                         sendCopyData(null, "OOG", 0,"Stop Me");
  43.                                         var a =getScript();    
  44.                                         do{                            
  45.                                                 if(a.name == "default.dbj")     {                      
  46.                                                         a.stop();                              
  47.                                                         break;
  48.                                                 }
  49.                                         }while(a.getNext());
  50.                                 }
  51.                
  52.                         }
  53.                 }
  54.         } //end item on cursor check
  55.  
  56.    print("ÿc9NTBot by Bobite rev: 219");
  57.    sendCopyData(null, "OOG", 0,"In Game");
  58.  
  59. dumpInventory();
  60.        
  61.      
  62.  
  63. addEventListener("itemdrop", dropHandler);
  64. addEventListener("itemaction",dropHandlerNew);
  65. addEventListener("keyup", KeyHandler);
  66. //addEventListener("copydata",ScriptMsg);
  67. //addEventListener("chatcmd", GameMSG);
  68. addEventListener("gamemsg", GameMSG);
  69. include("common/HookedControls.dbl");
  70.    include("common/NTCommon.dbl");
  71.      include("itemlogger.dbl");
  72.    NTC_IncludeConfig();
  73.    NTC_IncludeLibs();
  74.  
  75.    NT_LoadConfig();
  76.    NTSI_LoadNIPFiles();
  77.  sendCopyData(null, "OOG", 0,"Info "+NTAR_Areas[me.area]);
  78.    if(NTConfig_StartDelay > 0);
  79.       NTC_Delay(NTConfig_StartDelay);
  80.        
  81.         NTA_Initialize();
  82.         NTT_GetCorpses();
  83.         NTSI_PickItems();
  84.    
  85.    if(NTConfig_Script.length > 0)
  86.    {
  87.     //Script::CompileFile("yourscript.dbj")->Run();
  88.       NTC_Include("bots/NTLoader.dbl");
  89.  if(NTConfig_Script[0] !="SimonSays"){
  90.      NTT_ClearInventory();
  91.      NTT_ClearBelt();
  92. }
  93.       load("tools/NTToolsThread.dbj");
  94.  
  95.      NTC_Delay(500);
  96.          
  97.        
  98.       NT_Loader();
  99.  
  100.    }
  101. sendCopyData(null, "OOG", 0,"Quit:Full Run" );
  102.    NTC_Delay(500);
  103.  
  104.         if(NT_MinGameTime){
  105.                 if(getTickCount()-NT_StartTime < NT_MinGameTime *1000){
  106.                         me.overhead ("Stalling for "+parseInt(((NT_StartTime + ( NT_MinGameTime *1000))-getTickCount())/1000)+ " Seconds");
  107.                         NTTM_CheckAct()        
  108.                         NTTMGR_TownManager();
  109.                         while (getTickCount()-NT_StartTime < NT_MinGameTime *1000){
  110.                                 me.overhead ("Stalling for "+parseInt(((NT_StartTime + ( NT_MinGameTime *1000))-getTickCount())/1000)+ " Seconds");
  111.                                 NTC_Delay(1000);
  112.                         }
  113.                 }              
  114.         }
  115.    
  116.    quit();
  117. }
  118.  
  119.  
  120. function dropHandler(id,code,x,y,mode)
  121. {
  122.  //sendCopyData(null, "OOG", 0,"Drop: "+id);
  123.         for (var i=0 ;  i < Bob_ItemList.length ; i++){
  124.         if (Bob_ItemList[i]==id) return true; //aready there
  125.         }
  126.         Bob_ItemList.push(id);//,code,x,y,mode);
  127.         return true;
  128.  }
  129. function dropHandlerNew(id,mode,code,global)
  130. {
  131. //print("itemaction id:"+id +" mode: "+mode + " code: "+code +" global "+ global);
  132.  if (mode == 0 || mode == 2 || mode == 3){
  133. //  sendCopyData(null, "OOG", 0,"Drop: "+id);
  134.         for (var i=0 ;  i < Bob_ItemList.length ; i++){
  135.         if (Bob_ItemList[i]==id) return true; //aready there
  136.         }
  137.         Bob_ItemList.push(id);//,code,x,y,mode);
  138.         return true;
  139.  }
  140.  return true;
  141. }
  142. function KeyHandler(key,arg2)
  143. {
  144. sendCopyData(null, "OOG", 0,"key press: "+key);
  145.         if (key==19){
  146.                 if (getTickCount()-NT_LastPause>200){
  147.                         NT_Pause = !NT_Pause;
  148.                         NT_LastPause=getTickCount();
  149.                         if (NT_Pause){
  150.                                 print("ÿc;Pausing Bot...(Press 'Pause' again to resume)");
  151.                                 me.overhead("Pausing Bot...(Press 'Pause' again to resume)");
  152.                         } else{
  153.                                 print("ÿc2Resuming Bot...");
  154.                                 me.overhead("Resuming Bot...");
  155.                         }      
  156.                 }
  157.         }
  158. if (key == 123) { //f12
  159.     me.overhead("Reavealing " + NTAR_Areas[me.area]);
  160.     print("Reavealing " + NTAR_Areas[me.area]);
  161.     RevealArea(me.area);
  162. }
  163.         if (key==122) { //f11
  164.         var _target = NTC_GetUnit(0);
  165.  
  166.                 if(_target)
  167.                 {
  168.                 sendCopyData(null, "OOG", 0,"ShowInventory" );
  169.                         do
  170.                         {
  171.                                 var items=_target.getItems();
  172.                                 if(items){
  173.                                         for(var i = 0 ; i < items.length ; i++)
  174.                                         {
  175.                                         sendCopyData(null, "OOG", 0,"dump "+_target.name+" " +items[i].toSource());
  176.                                         }
  177.                                 }
  178.                         } while(_target.getNext());
  179.                         sendCopyData(null, "OOG", 0,"ShowInventoryEnd" );
  180.                 }
  181.         }
  182.         if(key ==120){//f9
  183.         print("x: "+me.x+" y: "+me.y)
  184.         var unit = getPresetUnits(me.area);
  185.                 if(unit){
  186.                 for (var j = 0; j < unit.length; j++)
  187.                         sendCopyData(null, "OOG", 0,"preset id "+unit[j].id+" x: "+(unit[j].roomx*5+unit[j].x)+" y: "+(unit[j].roomy*5+unit[j].y)+" Dist" +getDistance(me.x,me.y,unit[j].roomx*5+unit[j].x,unit[j].roomy*5+unit[j].y));
  188.                 }
  189.         }
  190.        
  191.                         if(key ==107){
  192.         var _OSC = "ÿc!X:ÿc< "+me.x+ "                  " +"ÿc!Y:ÿc< "+me.y
  193.         print(_OSC)
  194.         for (var n = 0; n < 5; n++) {
  195.         me.overhead(_OSC);
  196.         }
  197.         }
  198.        
  199.          if(typeof(scriptKeyHandler) == 'function')
  200.                 scriptKeyHandler(key)
  201.         //sendCopyData(null, me.windowtitle, 0,"Woohooo" );
  202.        
  203.         //var a =getScript();
  204.         //do{
  205.         //      print("script name:"+a.name+" running :"+a.running);
  206.         //}while(a.getNext);
  207.        
  208. return true;
  209. }
  210. function GameMSG(str1,str2)
  211. {
  212. sendCopyData(null, "OOG", 0,str1+":"+str2 );
  213. print(str1);
  214. return true;
  215. }
  216.  
  217. function ScriptMsg(mode,mes){
  218.         print("Default recived:"+mes);
  219. }
  220. function keepAlive(){
  221.  
  222. }
  223. function rnd(min,max){ //keeping up with d2bs 1.5
  224. if(typeof(rand) == 'function')
  225.         return rand(min,max);
  226. else   
  227.         return Math.floor(Math.random()*(max-min)+1)+min;
  228. }
  229. function RevealArea(area)
  230.         {
  231.                 if(area in revealedAreas)
  232.                         return;
  233.                 revealedAreas.push(area);
  234.                 var room = getRoom(area);
  235.                 var roomsRevealed = [];
  236.                 do {
  237.                         if(room == undefined || room.area != area)
  238.                                 return; // exit when we've finished with the rooms for this area
  239.                         if([room.x, room.y] in roomsRevealed)
  240.                         {
  241.                                 roomsRevealed.push([room.x, room.y]);
  242.                                 room.getNext();
  243.                         }
  244.                         else
  245.                        
  246.                                         room.reveal(true);
  247.                 } while(room.getNext());
  248.         }
  249. function dumpInventory()
  250. {
  251.         var items=me.getItems();
  252.         if(items){
  253.                 sendCopyData(null, "OOG", 0,"dump_Start "+me.name +"@" +me.account);
  254.                 for(var i = 0 ; i < items.length ; i++)
  255.                 {
  256.                         sendCopyData(null, "OOG", 0,"dump " +items[i].toSource());
  257.                 }
  258.                 sendCopyData(null, "OOG", 0,"dump_End "+me.name +"@" +me.account);
  259.         }
  260. }