Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading;
- using System.Drawing;
- using System.Windows.Forms;
- using ScriptDotNet2;
- using ScriptAPI;
- namespace Combot
- {
- public class Status
- {
- }
- public class Routine
- {
- public static void setup()
- {
- //wrists
- }
- public static void response(string message)
- {
- Console.WriteLine("[" + DateTime.Now + "] " + Self.Name + ": " + message);
- }
- public static void init()
- {
- //for now we're gona put each routine in its own thread
- Thread combatThread = new Thread(new ThreadStart(Combat.routine)); //start the combat routine
- Thread lootThread = new Thread(new ThreadStart(Loot.routine));
- Thread trainSkillsThread = new Thread(new ThreadStart(TrainSkill.routine));
- try
- {
- combatThread.Start();
- lootThread.Start();
- //trainSkillsThread.Start();
- }
- catch (ThreadStateException)
- {
- Console.WriteLine("ThreadStateException trying to restart.");
- Console.WriteLine("Expected since aborted threads cannot be restarted.");
- }
- }
- static void Main(string[] args)
- {
- //do exceptions later
- if (!Profile.IsConnected)
- {
- Console.WriteLine("Profile is not connected, exiting.");
- System.Environment.Exit(1);
- }
- else
- {
- Console.WriteLine("Connected to Combot: " + Self.Name);
- }
- Routine.setup();
- Routine.init();
- //add some try catches later
- #region Exceptions
- #endregion
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using ScriptDotNet2;
- using ScriptAPI;
- namespace Combot
- {
- public class Combat : Routine
- {
- //FOLLOW THE LEADER ROUTINE
- //IDS
- //Sadok 8439902
- //Splendora 37928828
- //Caithlyn 11914331
- #region Constants
- public static Creature Leader = new Creature(8439902);
- public static DateTime timeCurseWeapon = DateTime.Now;
- public static DateTime timeSpiritSpeak = DateTime.Now;
- public static DateTime timeBandage = DateTime.Now;
- public static TimeSpan durationSpiritSpeak = new TimeSpan();
- public static TimeSpan durationBandage = new TimeSpan();
- public static bool bandaging;
- public static bool isBusy;
- public static string message;
- #endregion
- public static void bandage(Creature target)
- {
- durationBandage = DateTime.Now - timeBandage;
- Item bandage = Find.FindItem(3617, Self.Backpack.ID);
- if (target.Distance < 2 && durationBandage.TotalSeconds > 3 && bandage.IsExists)
- {
- bandage.Use();
- Stealth.Default.WaitTargetObject(Leader.ID);
- timeBandage = DateTime.Now;
- response("using bandage on " + target.Name + ".");
- }
- else
- response("could not use bandage on " + target.Name + ".");
- }
- public static void heal(Creature target)
- {
- if (target.Distance < 4 && Self.Mana > 7)
- {
- Self.Cast("Close Wounds", target);
- Script.Wait(500);
- response("casting Close Wounds on " + target.Name + ".");
- }
- else
- response("could not Close Wounds on " + target.Name + ".");
- }
- public static void healSelf()
- {
- durationSpiritSpeak = DateTime.Now - timeSpiritSpeak;
- if (durationSpiritSpeak.TotalSeconds > 3)
- {
- Self.UseSkill("Spirit Speak");
- timeSpiritSpeak = DateTime.Now;
- response("using Spirit Speak.");
- }
- else
- response("too soon to use Spirit Speak.");
- //curse weapon when less than 70%
- /* TURNED OFF FOR CORGUL * * *
- TimeSpan duration = DateTime.Now - timeCurseWeapon;
- if (Self.Life < (.7 * Self.MaxLife) && duration.TotalSeconds > 20)
- {
- //if we're below 50% hp cast curse weapon
- Self.Cast("Curse Weapon");
- curseWeapon = DateTime.Now;
- }
- * * * * * * * * * * * * * * * */
- }
- public static void moveToLeader()
- {
- Stealth.Default.SetMoveThroughNPC(0);
- while (Self.X != Leader.X || Self.Y != Leader.Y)
- {
- response("moving to leader...");
- Stealth.Default.Step((Stealth.Default.CalcDir(Self.X, Self.Y, Leader.X, Leader.Y)), true);
- }
- }
- public static void routine()
- {
- response("Combat routine started...");
- while (Profile.IsConnected && !Stealth.Default.IsDead(Self.ID))
- {
- #region Self Health Check
- if (Self.Life < Self.MaxLife * .8)
- healSelf();
- #endregion
- #region Follow The Leader
- if (Leader.IsExists)
- {
- if (Self.X != Leader.X || Self.Y != Leader.Y)
- moveToLeader();
- if (Leader.hpPerc < 80)
- bandage(Leader);
- if (Leader.hpPerc < 50)
- heal(Leader);
- }
- #endregion
- #region Leader Health Check
- //check to see if he is here
- //keep healing until the person is up to 90%
- #endregion
- #region Revenant check
- //check to see if there are revenant types around
- List<Item> RevenantType = Find.FindItems(400).OrderBy(s => s.Distance).ToList();
- //remove the ones that aren't revenants
- RevenantType.RemoveAll(x => x.Name != "a revenant");
- RevenantType.RemoveAll(x => x.Distance <= 4);
- //RevenantType.Remove
- foreach (Item revenant in RevenantType)
- {
- //loop through each type and check if it's a revenant
- if (revenant.Name == "a revenant" && revenant.Distance <= 4) //and if it's close enough to dispel
- {
- //keep trying until the bastard is gone!
- while (revenant.IsExists)
- {
- Console.WriteLine("Revenant found within range, casting Dispel Evil.");
- Self.Cast("Dispel Evil");
- Script.Wait(750);
- }
- Console.WriteLine("Whew, he's gone!");
- }
- }
- #endregion Revenant check
- }
- Script.Wait(250); //slow heart rate down...
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using ScriptDotNet2;
- using ScriptAPI;
- namespace Combot
- {
- class TrainSkill : Routine
- {
- public static void routine()
- {
- response("TrainSkill routine started...");
- while (Profile.IsConnected && !Stealth.Default.IsDead(Self.ID))
- {
- while (Self.Mana > 10)
- {
- Self.Cast("Divine Fury");
- Script.Wait(750);
- }
- if (Self.Mana < 10)
- {
- Self.UseSkill("Meditation");
- Script.Wait(10000);
- }
- }
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using ScriptDotNet2;
- using ScriptAPI;
- namespace Combot
- {
- using Combot;
- public class Loot : Routine
- {
- public static List<Item> CorpsesLooted;
- public static List<Item> CorpsesToLoot;
- public static void corpseHandler()
- {
- List<Item> Corpses = Find.FindItems(8198).ToList();
- CorpsesToLoot = Corpses;
- if (Corpses != null && CorpsesLooted != null)
- {
- CorpsesToLoot = Corpses.Except(CorpsesLooted).ToList();
- response("removing ones already checked.");
- }
- if (CorpsesToLoot!=null)
- {
- foreach (Item corpse in CorpsesToLoot)
- if (corpse.Distance < 2)
- {
- //Container x = c
- //Convert.ChangeType(corpse, typeof(Container));
- lootHandler(corpse);
- }
- else
- response("not close enough to corpse.");
- }
- }
- public static void lootHandler(Item corpse)
- {
- corpse.Use();
- //open the container
- //put the loot in a list
- //check the list
- //loot list
- //add the corpse to the checked list
- if (CorpsesLooted == null)
- CorpsesLooted = new List<Item>();
- CorpsesLooted.Add(corpse);
- }
- public static void routine()
- {
- response("Loot routine started...");
- while (Profile.IsConnected && !Stealth.Default.IsDead(Self.ID))
- corpseHandler();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement