Advertisement
jonatious

NTHCommands

Nov 23rd, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 11.67 KB | None | 0 0
  1. /*///////////////////////////////////////////////////////////////
  2. Author:  DysfunctionaI @ BlizzHackers, DysfunctionaI @ D2JSP
  3. /////////////////////////////////////////////////////////////////
  4.  
  5. This is the command file, where you may edit or make new commands.
  6. Potential commands are limitless, but I have written up most of
  7. the more useful ones here. Adding commands became really popular
  8. in my last release, so I decided to make it easier for people to
  9. write their own commands.
  10.  
  11.  
  12. The layout is simple. You get two variables to work with:
  13.  
  14. 'command' is the command that the leader typed
  15. 'variable' is the payload (if any), which comes after a command
  16.  
  17.  
  18. Example:
  19.  
  20. The leader types "-dropgold 500"
  21. The 'command' would be 'dropgold'
  22. The 'variable' would be '500'
  23.  
  24. Example 2:
  25.  
  26. The leader types "-walk"
  27. The 'command' would be 'walk'
  28. The 'variable' would be 'undefined'
  29.  
  30.  
  31. You may also use the functions available in the NTHelperBot.ntj
  32. script. Not all of them will work with your custom commands
  33. perfectly, so check them out before using them. If they don't fit
  34. your needs, I advise against editing the function, and instead,
  35. just writing a new one here, because your edits could easily break
  36. the bot.
  37.  
  38. Don't forget to put return; at the end of your commands.
  39.  
  40.  
  41. //////////////////////////////////////////////////////////////////
  42. Have fun! Command section below!
  43. ////////////////////////////////////////////////////////////////*/
  44.  
  45.  
  46. function NTH_Commands(command, variable)
  47. {
  48.     /////////////////
  49.     // town
  50.     /////////////////
  51.    
  52.     if(command == "town")
  53.     {
  54.         if(NTC_InTown())
  55.         {
  56.             NTH_Say("Doing town stuff");
  57.            
  58.             NTTMGR_TownManager();
  59.            
  60.             NTTM_TownMove("portalspot");
  61.         }
  62.         else
  63.             NTH_Say("I'm not in town!");
  64.            
  65.         return;
  66.     }
  67.    
  68.     /////////////////
  69.     // tp
  70.     /////////////////
  71.    
  72.     if(command == "tp")
  73.     {
  74.         NTH_Say("Taking your TP");
  75.         if(NTC_InTown())
  76.         {
  77.             NTTM_TownMove("portalspot");
  78.            
  79.             NTH_UsePortal(_leadername);
  80.            
  81.             while(!NTH_GetLeader())
  82.             {
  83.                 if(_attack)
  84.                     NTH_ClearPosition(true);
  85.                    
  86.                 Delay(500);
  87.             }
  88.         }
  89.         else
  90.         {
  91.             NTH_UsePortal(_leadername);
  92.             while(!NTH_GetLeader())
  93.                 Delay(500);
  94.         }
  95.        
  96.         return;
  97.     }
  98.     ///////////////////////////
  99.     //// gold  //////////////
  100.     ///////////////////
  101.    
  102.     if(command == "gold")
  103.     {
  104.     _gold = me.GetStat(14);
  105.     if(variable != "")
  106.     {
  107.         if( parseInt(variable) <= 50000 && parseInt(variable) >= 1 )
  108.         {
  109.             if(parseInt(variable) <= _gold)
  110.             {
  111.                 Gold(0, parseInt(variable))
  112.             }
  113.             else
  114.             {
  115.                 Say("Sorry, I am out of gold!");
  116.             }
  117.             NTC_Delay(3);
  118.         }
  119.         else
  120.         {
  121.             Say("Invalid variable.  Valid range is 1-10000.");
  122.         }
  123.     }
  124.     else
  125.     {
  126.         Say("Invalid variable.  Valid range is 1-10000.");
  127.     }
  128. }
  129.  
  130.    
  131.     /////////////////
  132.     // safe
  133.     /////////////////
  134.    
  135.     if(command == "safe")
  136.     {
  137.         if(NTC_InTown())
  138.         {
  139.             NTTM_TownMove("portalspot");
  140.            
  141.             if(NTH_UsePortal(_leadername))
  142.                 NTT_GetCorpses();
  143.            
  144.             while(!NTH_GetLeader())
  145.             {
  146.                 if(_attack)
  147.                     NTH_ClearPosition(true);
  148.                
  149.                 Delay(500);
  150.             }
  151.         }
  152.        
  153.         return;
  154.     }
  155.    
  156.     /////////////////
  157.     // precast
  158.     /////////////////
  159.    
  160.     if(command == "precast")
  161.     {
  162.         NTP_DoPrecast(true);
  163.        
  164.         return;
  165.     }
  166.    
  167.     /////////////////
  168.     // goto
  169.     /////////////////
  170.    
  171.     if(command == "goto")
  172.     {
  173.     if(variable == 'trist')
  174.         {
  175.             if(!NTTM_CheckAct(1))
  176.             {
  177.                 NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
  178.                 return;
  179.             }
  180.             NTTMGR_TownManager();
  181.             NTTM_TownMove("waypoint");
  182.             NTM_TakeWaypoint(4);
  183.             if(!NTM_MoveToPresetUnit(me.areaid, NTC_UNIT_MONSTER, 737, 10, 10, false))
  184.             {
  185.                 NTM_MakeTP();
  186.                 Say("Failed to move to unit");
  187.                 //Delay(7500);
  188.                 //NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveToPresetUnit()");
  189.                 return;
  190.             }
  191.             NTA_ClearPosition( 20 );
  192.             NTM_MakeTP();
  193.         }
  194.         else
  195.         if(me.areaid === parseInt(variable))
  196.         {
  197.             if(parseInt(msg3) >= 0 && parseInt(msg4) >= 0)
  198.             {
  199.                 Say("Moving to: " + msg3 + ", " + msg4);
  200.                 if(!NTM_MoveTo(parseInt(variable), parseInt(msg3), parseInt(msg4)))
  201.                 {
  202.                     Say("!Failed to move");
  203.                 }
  204.             }
  205.         }
  206.     return;
  207.     }
  208.    
  209.     /////////////////
  210.     // come
  211.     /////////////////
  212.    
  213.     if(command == "come")
  214.     {
  215.         _stay = false;
  216.         NTH_Say("I'll follow you");
  217.            
  218.         ClickMap(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _leader.x, _leader.y);
  219.         ClickMap(NTC_CLICK_LUP, NTC_SHIFT_NONE, null);
  220.        
  221.         return;
  222.     }
  223.    
  224.     /////////////////
  225.     // stay
  226.     /////////////////
  227.    
  228.     if(command == "stay")
  229.     {
  230.         NTH_Say("I'll stay here");
  231.         _stay = true;
  232.        
  233.         return;
  234.     }
  235.    
  236.     /////////////////
  237.     // pick
  238.     /////////////////
  239.    
  240.     if(command == "pick")
  241.     {
  242.         NTH_Say("Picking up items");
  243.        
  244.         NTH_PickItems();
  245.        
  246.         return;
  247.     }
  248.    
  249.     /////////////////
  250.     // body
  251.     /////////////////
  252.    
  253.     if(command == "body")
  254.     {
  255.         NTH_Say("Getting my body");
  256.        
  257.         NTT_GetCorpses();
  258.        
  259.         return;
  260.     }
  261.    
  262.     /////////////////
  263.     // help
  264.     /////////////////
  265.    
  266.     if(command == "help")
  267.     {
  268.         NTH_Say("stay | come | attack on/off | tp | maketp | safe | aura (name) | wp | talk | shrine | town | precast | pick | body | verbal | gold");
  269.         return;
  270.     }
  271.    
  272.     /////////////////
  273.     // maketp
  274.     /////////////////
  275.    
  276.     if(command == "maketp")
  277.     {
  278.         if(!NTC_InTown())
  279.         {
  280.             if(NTM_MakeTP())
  281.                 NTH_Say("TP up");
  282.             else
  283.                 NTH_Say("I don't have any TPs!");
  284.         }
  285.         else
  286.             NTH_Say("I can't TP here!");
  287.        
  288.         return;
  289.     }
  290.    
  291.     /////////////////
  292.     // verbal
  293.     /////////////////
  294.    
  295.     if(command == "verbal")
  296.     {
  297.         if(variable == undefined || (variable != "on" && variable != "off"))
  298.         {
  299.             if(_verbal)
  300.                 Say("Verbal messages ON");
  301.             else
  302.                 Say("/w "+_leadername+" Verbal messages are OFF");
  303.            
  304.             Delay(50);
  305.         }
  306.         else
  307.         {
  308.             if(variable == "on")
  309.             {
  310.                 _verbal = true;
  311.                
  312.                 NTH_Say("Verbal messages ON");
  313.             }
  314.             else
  315.             {
  316.                 _verbal = false;
  317.                
  318.                 Say("/w "+_leadername+" Verbal messages OFF");
  319.             }
  320.         }
  321.        
  322.         return;
  323.     }
  324.    
  325.     /////////////////
  326.     // attack
  327.     /////////////////
  328.    
  329.     if(command == "attack")
  330.     {
  331.         if(variable == undefined || (variable != "on" && variable != "off"))
  332.         {
  333.             if(_attack)
  334.                 NTH_Say("Attack is ON");
  335.             else
  336.                 NTH_Say("Attack is OFF");
  337.         }
  338.         else
  339.         {
  340.             if(variable == "on")
  341.             {
  342.                 _attack = true;
  343.                
  344.                 NTH_Say("I'll attack at will");
  345.             }
  346.             else
  347.             {
  348.                 _attack = false;
  349.                
  350.                 NTH_Say("I won't attack anymore");
  351.             }
  352.         }
  353.        
  354.         return;
  355.     }
  356.    
  357.     /////////////////
  358.     // shrine
  359.     /////////////////
  360.    
  361.     if(command == "shrine")
  362.     {
  363.         _target = NTC_FindUnit(NTC_UNIT_OBJECT, "shrine");
  364.  
  365.         if(!_target)
  366.             _target = NTC_FindUnit(NTC_UNIT_OBJECT, "well");
  367.        
  368.         if(_target)
  369.         {
  370.             do
  371.             {
  372.                 if(GetDistance(_leader.x, _leader.y, _target.x, _target.y) < 15)
  373.                     break;
  374.             } while(_target.GetNext());
  375.            
  376.             if(GetDistance(_leader.x, _leader.y, _target.x, _target.y) < 15)
  377.             {
  378.                 NTH_Say("Grabbing shrine");
  379.                
  380.                 if(GetDistance(me.x, me.y, _target.x, _target.y) > 3)
  381.                     NTH_MoveTo(_target.areaid, _target.x+5, _target.y+5, 10);
  382.                    
  383.                 NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _target);
  384.                    
  385.                 Delay(500);
  386.             }
  387.             else
  388.                 NTH_Say("Which shrine?");
  389.         }
  390.         else
  391.             NTH_Say("I don't see a shrine!");
  392.        
  393.         return;
  394.     }
  395.    
  396.     /////////////////
  397.     // talk
  398.     /////////////////
  399.    
  400.     if(command == "talk")
  401.     {
  402.         if(!NTC_InTown())
  403.         {
  404.             NTH_Say("No one to talk to out here!");
  405.             return;
  406.         }
  407.        
  408.         var _npc = false;
  409.         var _target = NTC_FindUnit(NTC_UNIT_NPC);
  410.        
  411.         if(_target)
  412.         {
  413.             do
  414.             {
  415.                 if(_target.classid > 6 && _target.name != "an evil force" && GetDistance(_leader.x, _leader.y, _target.x, _target.y) < 10)
  416.                 {
  417.                     var _npc = true;
  418.                    
  419.                     NTH_Say("I'll talk to "+_target.name);
  420.                     /*
  421.                     if(NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _target))
  422.                     {
  423.                         Delay(1000);
  424.                        
  425.                         if(_target.classid == 155) // Warriv A1
  426.                             me.SelectNPCMenu(0x0D36);
  427.                         else if(_target.classid == 155) // Warriv A2
  428.                             me.SelectNPCMenu(0x0D37);
  429.                         else if(_target.classid == 210) // Meshif A2
  430.                             me.SelectNPCMenu(0x0D38);
  431.                         else if(_target.classid == 264) // Meshif A3
  432.                             me.SelectNPCMenu(0x0D39);
  433.                         else if(_target.classid == 367) // Tyrael A4
  434.                             me.SelectNPCMenu(0x58D2);
  435.                         else
  436.                         {
  437.                             me.SelectNPCMenu(0x0000);
  438.                             me.Cancel(0);
  439.                             me.Cancel(1);
  440.                         }
  441.                        
  442.                         while(!NTH_GetLeader())
  443.                             Delay(500);
  444.                     }
  445.                     else
  446.                     {
  447.                         Delay(1000);
  448.                         NTH_Say("I had a problem talking to that NPC...");
  449.                     }*/
  450.                    
  451.                     break;
  452.                 }
  453.             } while(_target.GetNext());
  454.            
  455.             if(!_npc)
  456.                 NTH_Say("Show me what NPC to talk to!");
  457.  
  458.             return;
  459.         }
  460.        
  461.         return;
  462.     }
  463.    
  464.     /////////////////
  465.     // aura
  466.     /////////////////
  467.    
  468.     if(command == "aura")
  469.     {
  470.         if(me.classid != NTC_CHAR_CLASS_PALADIN)
  471.             return;
  472.        
  473.         var _aura = 0;
  474.        
  475.         if(variable == "prayer" || variable == "pray")
  476.             _aura = 99;
  477.         else if(variable == "cleansing" || variable == "clean")
  478.             _aura = 109;
  479.         else if(variable == "med" || variable == "meditation")
  480.             _aura = 120;
  481.         else if(variable == "vigor" || variable == "vig")
  482.             _aura = 115;
  483.         else if(variable == "salv" || variable == "salvation")
  484.             _aura = 125;
  485.         else if(variable == "might")
  486.             _aura = 98;
  487.         else if(variable == "conc" || variable == "concentration")
  488.             _aura = 113;
  489.         else if(variable == "fana" || variable == "fanaticism")
  490.             _aura = 122;
  491.         else if(variable == "convic" || variable == "conviction")
  492.             _aura = 123;
  493.        
  494.         if(_aura)
  495.         {
  496.             if(NTC_GetSkillLevel(_aura))
  497.             {
  498.                 NTH_Say("OK, I'll use that aura");
  499.                 NTC_PutSkill(_aura, NTC_HAND_RIGHT);
  500.                 NTConfig_AttackSkill[2] = _aura;
  501.                 NTConfig_AttackSkill[4] = _aura;
  502.             }
  503.             else
  504.                 NTH_Say("I don't have that aura!");
  505.         }
  506.         else
  507.             NTH_Say("I don't recognize that aura!");
  508.        
  509.         return;
  510.     }
  511.    
  512.     /////////////////
  513.     // wp
  514.     /////////////////
  515.    
  516.     if(command == "wp")
  517.     {
  518.         _target;
  519.         var _wp = null;
  520.  
  521.         switch(me.areaid)
  522.         {
  523.             case 3:
  524.                 _wp = 119;
  525.                     break;
  526.             case 4:
  527.                 _wp = 119;
  528.                     break;
  529.             case 5:
  530.                 _wp = 119;
  531.                     break;
  532.             case 6:
  533.                 _wp = 119;
  534.                     break;
  535.             case 27:
  536.                 _wp = 119;
  537.                     break;
  538.             case 29:
  539.                 _wp = 157;
  540.                     break;
  541.             case 32:
  542.                 _wp = 119;
  543.                     break;
  544.             case 35:
  545.                 _wp = 157;
  546.                     break;
  547.             case 42:
  548.                 _wp = 156;
  549.                     break;
  550.             case 43:
  551.                 _wp = 156;
  552.                     break;
  553.             case 44:
  554.                 _wp = 156;
  555.                     break;
  556.             case 46:
  557.                 _wp = 402;
  558.                     break;
  559.             case 48:
  560.                 _wp = 323;
  561.                     break;
  562.             case 52:
  563.                 _wp = 288;
  564.                     break;
  565.             case 57:
  566.                 _wp = 156;
  567.                     break;
  568.             case 74:
  569.                 _wp = 402;
  570.                     break;
  571.             case 76:
  572.                 _wp = 237;
  573.                     break;
  574.             case 77:
  575.                 _wp = 237;
  576.                     break;
  577.             case 78:
  578.                 _wp = 237;
  579.                     break;
  580.             case 79:
  581.                 _wp = 237;
  582.                     break;
  583.             case 80:
  584.                 _wp = 237;
  585.                     break;
  586.             case 81:
  587.                 _wp = 237;
  588.                     break;
  589.             case 83:
  590.                 _wp = 237;
  591.                     break;
  592.             case 101:
  593.                 _wp = 324;
  594.                     break;
  595.             case 106:
  596.                 _wp = 238;
  597.                     break;
  598.             case 107:
  599.                 _wp = 238;
  600.                     break;
  601.             case 111:
  602.                 _wp = 496;
  603.                     break;
  604.             case 112:
  605.                 _wp = 496;
  606.                     break;
  607.             case 113:
  608.                 _wp = 511;
  609.                     break;
  610.             case 115:
  611.                 _wp = 511;
  612.                     break;
  613.             case 117:
  614.                 _wp = 496;
  615.                     break;
  616.             case 118:
  617.                 _wp = 511;
  618.                     break;
  619.             case 129:
  620.                 _wp = 494;
  621.                     break; 
  622.         }
  623.        
  624.         if(_wp != null)
  625.         {
  626.             NTH_Say("Grabbing waypoint");
  627.            
  628.             NTM_MoveToPresetUnit(me.areaid, NTC_UNIT_OBJECT, _wp, 1, 1);
  629.  
  630.             _target = NTC_FindUnit(NTC_UNIT_OBJECT, _wp);
  631.  
  632.             if(_target)
  633.             {
  634.                 if(GetDistance(me, _target) > 2)
  635.                     NTM_MoveTo(_target.areaid, _target.x+1, _target.y);
  636.  
  637.                 Delay(500);
  638.                
  639.                 NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _target);
  640.                
  641.                 Delay(1000);
  642.                
  643.                 me.Cancel(1);
  644.             }
  645.         }
  646.         else
  647.             NTH_Say("There's no waypoint here!");
  648.        
  649.         return;
  650.     }
  651. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement