Advertisement
sibble

Untitled

Mar 26th, 2015
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 9.87 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3. using System.Drawing;
  4. using System.Windows.Forms;
  5. using ScriptDotNet2;
  6. using ScriptAPI;
  7.  
  8. namespace Combot
  9. {
  10.  
  11.     public class Status
  12.     {
  13.  
  14.     }
  15.  
  16.     public class Routine
  17.     {
  18.  
  19.         public static void setup()
  20.         {
  21.  
  22.             //wrists
  23.  
  24.         }
  25.  
  26.         public static void response(string message)
  27.         {
  28.             Console.WriteLine("[" + DateTime.Now + "] " + Self.Name + ": " + message);
  29.         }
  30.  
  31.         public static void init()
  32.         {
  33.  
  34.             //for now we're gona put each routine in its own thread
  35.  
  36.             Thread combatThread = new Thread(new ThreadStart(Combat.routine)); //start the combat routine
  37.             Thread lootThread = new Thread(new ThreadStart(Loot.routine));
  38.             Thread trainSkillsThread = new Thread(new ThreadStart(TrainSkill.routine));
  39.  
  40.             try
  41.             {
  42.                 combatThread.Start();
  43.                 lootThread.Start();
  44.                 //trainSkillsThread.Start();
  45.             }
  46.             catch (ThreadStateException)
  47.             {
  48.                 Console.WriteLine("ThreadStateException trying to restart.");
  49.                 Console.WriteLine("Expected since aborted threads cannot be restarted.");
  50.             }
  51.  
  52.         }
  53.  
  54.         static void Main(string[] args)
  55.         {
  56.  
  57.             //do exceptions later
  58.             if (!Profile.IsConnected)
  59.             {
  60.                 Console.WriteLine("Profile is not connected, exiting.");
  61.                 System.Environment.Exit(1);
  62.             }
  63.             else
  64.             {
  65.                 Console.WriteLine("Connected to Combot: " + Self.Name);
  66.             }
  67.  
  68.             Routine.setup();
  69.  
  70.             Routine.init();
  71.  
  72.             //add some try catches later
  73.             #region Exceptions
  74.             #endregion
  75.  
  76.         }
  77.     }
  78. }
  79.  
  80. using System;
  81. using System.Collections.Generic;
  82. using System.Linq;
  83. using System.Text;
  84. using System.Threading.Tasks;
  85. using ScriptDotNet2;
  86. using ScriptAPI;
  87.  
  88. namespace Combot
  89. {
  90.  
  91.     public class Combat : Routine
  92.     {
  93.  
  94.         //FOLLOW THE LEADER ROUTINE
  95.  
  96.         //IDS
  97.         //Sadok 8439902
  98.         //Splendora 37928828
  99.         //Caithlyn 11914331
  100.  
  101.         #region Constants
  102.         public static Creature Leader = new Creature(8439902);
  103.         public static DateTime timeCurseWeapon = DateTime.Now;
  104.         public static DateTime timeSpiritSpeak = DateTime.Now;
  105.         public static DateTime timeBandage = DateTime.Now;
  106.         public static TimeSpan durationSpiritSpeak = new TimeSpan();
  107.         public static TimeSpan durationBandage = new TimeSpan();
  108.         public static bool bandaging;
  109.         public static bool isBusy;
  110.         public static string message;
  111.         #endregion
  112.  
  113.         public static void bandage(Creature target)
  114.         {
  115.             durationBandage = DateTime.Now - timeBandage;
  116.             Item bandage = Find.FindItem(3617, Self.Backpack.ID);
  117.  
  118.             if (target.Distance < 2 && durationBandage.TotalSeconds > 3 && bandage.IsExists)
  119.             {
  120.                 bandage.Use();
  121.                 Stealth.Default.WaitTargetObject(Leader.ID);
  122.                 timeBandage = DateTime.Now;
  123.                 response("using bandage on " + target.Name + ".");
  124.             }
  125.             else
  126.                 response("could not use bandage on " + target.Name + ".");
  127.         }
  128.  
  129.         public static void heal(Creature target)
  130.         {
  131.             if (target.Distance < 4 && Self.Mana > 7)
  132.             {
  133.                 Self.Cast("Close Wounds", target);
  134.                 Script.Wait(500);
  135.                 response("casting Close Wounds on " + target.Name + ".");
  136.             }
  137.             else
  138.                 response("could not Close Wounds on " + target.Name + ".");
  139.         }
  140.  
  141.         public static void healSelf()
  142.         {
  143.             durationSpiritSpeak = DateTime.Now - timeSpiritSpeak;
  144.             if (durationSpiritSpeak.TotalSeconds > 3)
  145.             {
  146.                 Self.UseSkill("Spirit Speak");
  147.                 timeSpiritSpeak = DateTime.Now;
  148.                 response("using Spirit Speak.");
  149.             }
  150.             else
  151.                 response("too soon to use Spirit Speak.");
  152.  
  153.             //curse weapon when less than 70%
  154.  
  155.             /*  TURNED OFF FOR CORGUL * * *
  156.             TimeSpan duration = DateTime.Now - timeCurseWeapon;
  157.             if (Self.Life < (.7 * Self.MaxLife) && duration.TotalSeconds > 20)
  158.             {
  159.                 //if we're below 50% hp cast curse weapon
  160.                 Self.Cast("Curse Weapon");
  161.                 curseWeapon = DateTime.Now;
  162.             }
  163.             * * * * * * * * * * * * * * * */
  164.  
  165.         }
  166.  
  167.         public static void moveToLeader()
  168.         {
  169.             Stealth.Default.SetMoveThroughNPC(0);
  170.             while (Self.X != Leader.X || Self.Y != Leader.Y)
  171.             {
  172.                 response("moving to leader...");
  173.                 Stealth.Default.Step((Stealth.Default.CalcDir(Self.X, Self.Y, Leader.X, Leader.Y)), true);
  174.             }
  175.         }
  176.  
  177.         public static void routine()
  178.         {
  179.             response("Combat routine started...");
  180.             while (Profile.IsConnected && !Stealth.Default.IsDead(Self.ID))
  181.             {
  182.  
  183.                 #region Self Health Check
  184.                 if (Self.Life < Self.MaxLife * .8)
  185.                     healSelf();
  186.                 #endregion
  187.  
  188.                 #region Follow The Leader
  189.                 if (Leader.IsExists)
  190.                 {
  191.                     if (Self.X != Leader.X || Self.Y != Leader.Y)
  192.                         moveToLeader();
  193.                     if (Leader.hpPerc < 80)
  194.                         bandage(Leader);
  195.                     if (Leader.hpPerc < 50)
  196.                         heal(Leader);
  197.                 }
  198.                 #endregion
  199.  
  200.                 #region Leader Health Check
  201.                 //check to see if he is here
  202.                
  203.                 //keep healing until the person is up to 90%
  204.                 #endregion
  205.  
  206.                 #region Revenant check
  207.                 //check to see if there are revenant types around
  208.                 List<Item> RevenantType = Find.FindItems(400).OrderBy(s => s.Distance).ToList();
  209.  
  210.                 //remove the ones that aren't revenants
  211.                 RevenantType.RemoveAll(x => x.Name != "a revenant");
  212.                 RevenantType.RemoveAll(x => x.Distance <= 4);
  213.  
  214.                 //RevenantType.Remove
  215.                 foreach (Item revenant in RevenantType)
  216.                 {
  217.                     //loop through each type and check if it's a revenant
  218.                     if (revenant.Name == "a revenant" && revenant.Distance <= 4) //and if it's close enough to dispel
  219.                     {
  220.                         //keep trying until the bastard is gone!
  221.                         while (revenant.IsExists)
  222.                         {
  223.                             Console.WriteLine("Revenant found within range, casting Dispel Evil.");
  224.                             Self.Cast("Dispel Evil");
  225.                             Script.Wait(750);
  226.                         }
  227.                         Console.WriteLine("Whew, he's gone!");
  228.                     }
  229.                 }
  230.                 #endregion Revenant check
  231.             }
  232.             Script.Wait(250); //slow heart rate down...
  233.         }
  234.     }
  235. }
  236.  
  237. using System;
  238. using System.Collections.Generic;
  239. using System.Linq;
  240. using System.Text;
  241. using System.Threading.Tasks;
  242. using ScriptDotNet2;
  243. using ScriptAPI;
  244.  
  245. namespace Combot
  246. {
  247.     class TrainSkill : Routine
  248.     {
  249.         public static void routine()
  250.         {
  251.  
  252.             response("TrainSkill routine started...");
  253.             while (Profile.IsConnected && !Stealth.Default.IsDead(Self.ID))
  254.             {
  255.                 while (Self.Mana > 10)
  256.                 {
  257.                     Self.Cast("Divine Fury");
  258.                     Script.Wait(750);
  259.                 }
  260.  
  261.                 if (Self.Mana < 10)
  262.                 {
  263.                     Self.UseSkill("Meditation");
  264.                     Script.Wait(10000);
  265.                    
  266.                 }
  267.             }
  268.         }
  269.     }
  270. }
  271.  
  272.  
  273. using System;
  274. using System.Collections.Generic;
  275. using System.Linq;
  276. using ScriptDotNet2;
  277. using ScriptAPI;
  278.  
  279. namespace Combot
  280. {
  281.     using Combot;
  282.  
  283.     public class Loot : Routine
  284.     {
  285.         public static List<Item> CorpsesLooted;
  286.         public static List<Item> CorpsesToLoot;
  287.  
  288.  
  289.         public static void corpseHandler()
  290.         {
  291.             List<Item> Corpses = Find.FindItems(8198).ToList();
  292.             CorpsesToLoot = Corpses;
  293.  
  294.             if (Corpses != null && CorpsesLooted != null)
  295.             {
  296.                 CorpsesToLoot = Corpses.Except(CorpsesLooted).ToList();
  297.                 response("removing ones already checked.");
  298.             }
  299.  
  300.             if (CorpsesToLoot!=null)
  301.             {
  302.                 foreach (Item corpse in CorpsesToLoot)
  303.                     if (corpse.Distance < 2)
  304.                     {
  305.                         //Container x = c
  306.                         //Convert.ChangeType(corpse, typeof(Container));
  307.                         lootHandler(corpse);
  308.                     }
  309.                     else
  310.                         response("not close enough to corpse.");
  311.             }
  312.  
  313.         }
  314.  
  315.         public static void lootHandler(Item corpse)
  316.         {
  317.             corpse.Use();
  318.  
  319.             //open the container
  320.  
  321.             //put the loot in a list
  322.  
  323.             //check the list
  324.  
  325.             //loot list
  326.  
  327.             //add the corpse to the checked list
  328.             if (CorpsesLooted == null)
  329.                 CorpsesLooted = new List<Item>();
  330.  
  331.             CorpsesLooted.Add(corpse);
  332.         }
  333.  
  334.         public static void routine()
  335.         {
  336.             response("Loot routine started...");
  337.             while (Profile.IsConnected && !Stealth.Default.IsDead(Self.ID))
  338.                 corpseHandler();
  339.         }
  340.     }
  341. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement