Advertisement
sibble

Untitled

Mar 31st, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 8.30 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. using ScriptDotNet2;
  8. using ScriptDotNet2.Data;
  9. using ScriptDotNet2.Model;
  10. using ScriptAPI;
  11.  
  12. namespace Combot
  13. {
  14.     /* 4 / 6 Chiv Cast Times
  15.      * Consecrate Weapon is 750ms
  16.      * Cleanse by Fire is 750
  17.      * Divine Fury is 750
  18.      * Close Wounds is 1350
  19.      * Remove Curse is 1350
  20.      *
  21.      * */
  22.  
  23.     public class Combat : Routine
  24.     {
  25.  
  26.         #region Constants
  27.         public static Creature Leader = new Creature(8439902);
  28.         static List<Creature> GroupList = new List<Creature>
  29.         {
  30.             new Creature(8439902), //Sadok
  31.             new Creature(37928828), //Splendora
  32.             new Creature(11914331), //Caithlyn
  33.             new Creature(13342484), //Sadok2
  34.             new Creature(39645748) //Auto Bot
  35.         };
  36.         static List<Creature> ActiveGroupList = new List<Creature>();
  37.         static List<Item> MooringLines = new List<Item> {
  38.             new Item(1097816179),
  39.             new Item(1097816198),
  40.             new Item(1097816200),
  41.             new Item(1097816189),
  42.             new Item(1097816188),
  43.             new Item(1097816211),
  44.             new Item(1097816195),
  45.             new Item(1097816181)
  46.         };
  47.         #endregion
  48.  
  49.         static void moveToLeader()
  50.         {
  51.             Stealth.Default.SetMoveThroughNPC(0);
  52.             Stealth.Default.MoveXY((ushort)Leader.X, (ushort)Leader.Y, true, 0, true);
  53.         }
  54.  
  55.         static void onBuff(object sender, Buff_DebuffSystemEventArgs e)
  56.         {
  57.             String buffstatus = (e.IsEnabled) ? "Turned On" : "Turned Off";
  58.             String outputString = String.Format("Buff ID:{0} has just {1}", e.AttributeId, buffstatus);
  59.  
  60.             Stealth.Default.AddToSystemJournal(outputString);
  61.  
  62.             throw new NotImplementedException();
  63.         }
  64.  
  65.         static void response(string message)
  66.         {
  67.             Console.WriteLine("[" + DateTime.Now + "] " + Self.Name + ": " + message);
  68.         }
  69.  
  70.         public static void routine()
  71.         {
  72.             /*
  73.             Stealth.Default.SetDress();
  74.  
  75.             Stealth.Default.Equip();
  76.             */
  77.  
  78.             //Console.WriteLin
  79.  
  80.             response("Combat routine started...");
  81.             while (Profile.IsConnected && !Stealth.Default.IsDead(Self.ID))
  82.             {
  83.                 #region Events
  84.                 //Stealth.Default.Buff_DebuffSystem += onBuff;
  85.                 Stealth.Default.UnicodeSpeech += onSpeech;
  86.                 Stealth.Default.PartyInvite += onInvite;
  87.                 #endregion Events
  88.  
  89.                 #region Position Check
  90.                 if (Leader.IsExists && Self.X != Leader.X || Self.Y != Leader.Y)
  91.                     moveToLeader();
  92.                 #endregion
  93.  
  94.                 #region Health Check
  95.                 //check if group member exists and sort them by lowest health first
  96.                 ActiveGroupList = GroupList.Where(x => x.IsExists).OrderBy(x => x.hpPerc).ToList();
  97.                 foreach (Creature GroupMember in ActiveGroupList)
  98.                 {
  99.                     if (GroupMember.IsExists)
  100.                         Heal.checkHealth(GroupMember);
  101.                 }
  102.                 #endregion
  103.  
  104.                 #region Revenant check
  105.                 Find.FindDistance = 4;
  106.                 List<Item> Revenants = Find.FindItems(400);
  107.                 Revenants = Revenants.Where(x => x.Name == "a revenant").ToList();
  108.                 foreach (Item Revenant in Revenants)
  109.                 {
  110.                     response("Casting Dispel Evil.");
  111.                     //keep trying until the bastard is gone!
  112.                     while (Revenant.IsExists)
  113.                     {
  114.                         Self.Cast("Dispel Evil");
  115.                         Script.Wait(750); //can't do anything while casting
  116.                     }
  117.                 }
  118.                 #endregion Revenant check
  119.  
  120.                 #region Attack routine
  121.                 Attack.checkAttack();
  122.                 #endregion
  123.  
  124.                 Script.Wait(500); //slow down program
  125.             }
  126.         }
  127.  
  128.         static void onSpeech(object sender, UnicodeSpeechEventArgs e)
  129.         {
  130.             if (e.SenderId == Leader.ID && e.Text == "boat")
  131.             {
  132.                 MooringLines = MooringLines.OrderBy(x => x.Distance).ToList();
  133.                 Item Result = new Item(MooringLines[0].ID);
  134.                 Result.Use();
  135.             }
  136.  
  137.             throw new NotImplementedException();
  138.         }
  139.  
  140.         static void onInvite(object sender, PartyInviteEventArgs e)
  141.         {
  142.             if (e.InviterId == Leader.ID)
  143.                 Stealth.Default.PartyAcceptInvite();
  144.             throw new NotImplementedException();
  145.         }
  146.     }
  147.  
  148.     public class Attack : Combat
  149.     {
  150.         static Creature AttackTarget = new Creature(Self.ID);
  151.         public static void response(string message)
  152.         {
  153.             Console.WriteLine("[" + DateTime.Now + "] " + Self.Name + ": " + message);
  154.         }
  155.  
  156.         public static void checkAttack()
  157.         {
  158.             AttackTarget = new Creature(12295117);
  159.  
  160.             if (AttackTarget.IsExists && AttackTarget.Distance < 3)
  161.                 Stealth.Default.Attack(AttackTarget.ID);
  162.             stamCheck();
  163.         }
  164.  
  165.         static void stamCheck()
  166.         {
  167.             if (Self.Stamina < Self.MaxStamina * .8)
  168.             {
  169.                 Self.Cast("Divine Fury");
  170.                 Script.Wait(750);
  171.             }
  172.         }
  173.  
  174.     }
  175.  
  176.     public class Heal : Combat
  177.     {
  178.         static Item bandages = Find.FindItem(3617, Self.Backpack.ID);
  179.         static bool bandaging = false;
  180.  
  181.         public static void response(string message)
  182.         {
  183.             Console.WriteLine("[" + DateTime.Now + "] " + Self.Name + ": " + message);
  184.         }
  185.         public static void checkHealth(Creature HealTarget)
  186.         {
  187.             Thread bandageThread = new Thread(() => bandage(HealTarget));
  188.  
  189.             if (HealTarget.IsExists)
  190.             {
  191.                 if (HealTarget.IsPoisoned)
  192.                     cleanse(HealTarget);
  193.                 if (HealTarget.hpPerc < 60)
  194.                     closeWounds(HealTarget);
  195.                 if (HealTarget.hpPerc > 60 && HealTarget.hpPerc < 85 && !bandaging && bandages != null)
  196.                     bandageThread.Start();
  197.             }
  198.         }
  199.  
  200.         static void closeWounds(Creature HealTarget)
  201.         {
  202.             if (HealTarget.Distance < 4 && Self.Mana > 7)
  203.             {
  204.                 Self.Cast("Close Wounds", HealTarget);
  205.                 response("casting Close Wounds on " + HealTarget.Name + ".");
  206.                 Script.Wait(1350);
  207.             }
  208.         }
  209.  
  210.         static void bandage(Creature HealTarget)
  211.         {
  212.             if (HealTarget.Distance < 2 && bandages != null)
  213.             {
  214.                 bandaging = true;
  215.                 bandages.Use();
  216.                 Stealth.Default.WaitTargetObject(HealTarget.ID);
  217.                 response("using bandage on " + HealTarget.Name + ".");
  218.                 Stealth.Default.WaitJournalLine(DateTime.Now, "You finish applying the bandages|You apply the bandages, but they barely help|You heal what little damage your patient had|You did not stay close enough to heal your patient|That is too far away", 15000);
  219.             }
  220.             bandaging = false;
  221.         }
  222.  
  223.         static void cleanse(Creature HealTarget)
  224.         {
  225.             Find.FindDistance = 10;
  226.             if (Self.Mana > 7)
  227.             {
  228.                 Self.Cast("Cleanse by Fire", HealTarget);
  229.                 response("casting Cleanse by Fire on " + HealTarget.Name + ".");
  230.                 Script.Wait(750);
  231.             }
  232.         }
  233.     }
  234.  
  235.     public class Group : Combat
  236.     {
  237.         public static void response(string message)
  238.         {
  239.             Console.WriteLine("[" + DateTime.Now + "] " + Self.Name + ": " + message);
  240.         }
  241.         static Group()
  242.         {
  243.             Console.WriteLine("Group was instantiated.");
  244.             if (Self.ID == 11914331)
  245.                 Leader = new Creature(8439902);
  246.             if (Self.ID == 39645748)
  247.                 Leader = new Creature(37928828);
  248.             if (Self.ID == 13342484)
  249.                 Leader = new Creature(11914331);
  250.         }
  251.  
  252.     }
  253. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement