nick_1988

DaggerSpell

Sep 25th, 2014
931
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.49 KB | None | 0 0
  1. using System;
  2. using System.Drawing;
  3. using System.Windows.Forms;
  4. using System.Threading;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using ArcheBuddy.Bot.Classes;
  8.  
  9. namespace LazyRaider
  10. {
  11.     public class LazyRaider : Core
  12.     {
  13.         public static string GetPluginAuthor()
  14.         {
  15.             return "nick1988";
  16.         }
  17.  
  18.         public static string GetPluginVersion()
  19.         {
  20.             return "0.1.0";
  21.         }
  22.  
  23.         public static string GetPluginDescription()
  24.         {
  25.             return "LazyRaider for Daggerspell";
  26.         }
  27.         public void UseSkillAndWait(string skillName, bool selfTarget = false)
  28.         {
  29.             //wait for cooldowns to finish first, before we try to cast skill
  30.             while (me.isCasting || me.isGlobalCooldown)
  31.                 Thread.Sleep(50);
  32.             if (!UseSkill(skillName, true, selfTarget))
  33.             {
  34.                 if (me.target != null && GetLastError() == LastError.NoLineOfSight)
  35.                 {
  36.                     //No line of sight, try come to target.
  37.                     if (dist(me.target) <= 5)
  38.                         ComeTo(me.target, 2);
  39.                     else if (dist(me.target) <= 10)
  40.                         ComeTo(me.target, 3);
  41.                     else if (dist(me.target) < 20)
  42.                         ComeTo(me.target, 8);
  43.                     else
  44.                         ComeTo(me.target, 8);
  45.                 }
  46.             }
  47.             //wait for cooldown again, after we start cast skill
  48.             while (me.isCasting || me.isGlobalCooldown)
  49.                 Thread.Sleep(50);
  50.         }
  51.  
  52.         public void PluginRun()
  53.         {
  54.             while (true)
  55.             {
  56.                 while (me.target == null)
  57.                 // while we have no target, this loop will make the bot do nothing, and he will check back every 50ms, to see if we have a target
  58.                 {
  59.                     Thread.Sleep(50);
  60.                 }
  61.  
  62.                 while (me.target != null && isAttackable(me.target))
  63.                 // once we have a target, and this target is attackable (so its no NPC) the bot will jump into this loop.
  64.                 // this loops contains the "combat routine"
  65.                 {
  66.                     if (angle(me.target, me) > 45 && angle(me.target, me) < 315)
  67.                     // making sure we are faceing the target. If not, we will turn towards it
  68.                     {
  69.                         TurnDirectly(me.target);
  70.                     }
  71.                     if (dist(me.target) >= 21)
  72.                     {
  73.                         ComeTo(me.target, 19);
  74.                     }
  75.                     if (skillCooldown("Insulating Lens") == 0)
  76.                     // Casting "insulating lens", if its not on cooldown
  77.                     {
  78.                         UseSkillAndWait("Insulating Lens", true);
  79.                         Log("Used: Insulating Lens - Now immunte to damage for a while");
  80.                         Thread.Sleep(100);
  81.                     }
  82.                     if (skillCooldown("Magic Circle") == 0 && dist(me.target) <= 20 && hpp(me.target) >= 20)
  83.                     //casting "magic circle", if its not on cooldown and if we are within 20m of the target.
  84.                     //this way we make sure, that we are in range of the target and won't leave the magic circle and loose the buff.
  85.                     {
  86.                         UseSkillAndWait("Magic Circle");
  87.                         Log("Used: Magic Circle - Damage boost activated");
  88.                         Thread.Sleep(100);
  89.                     }
  90.                     if (hpp(me) <= 25 && skillCooldown("Banshee Wail") == 0)
  91.                     {
  92.                         UseSkillAndWait("Banshee Wail");
  93.                         Thread.Sleep(100);
  94.                         Log("Used: Banshee Wail - Defense CC");
  95.                         if (hpp(me.target) <= 20 && skillCooldown("Envervate") == 0)
  96.                         {
  97.                             UseSkillAndWait("Enervate");
  98.                             Thread.Sleep(50);
  99.                             if (skillCooldown("Earthen Grip") == 0)
  100.                             {
  101.                                 UseSkillAndWait("Earthen Grip");
  102.                             }
  103.                         }
  104.                         else
  105.                         {
  106.                             Thread.Sleep(1900);
  107.                         }
  108.  
  109.                     }
  110.                     if (skillCooldown("Freezing Arrow") != 0 && hpp(me) <= 75 && skillCooldown("Enervate") == 0 && skillCooldown("Magic Circle") >= 1)
  111.                     // if "freezing arrow" is on CD and our hp is below 75% we look for the cd of "enervate" if its available we will cast it.
  112.                     // since eneverate will give us an "+xxx life" on a hit of "Earthen Grip" we will us it as well, to regain some life.
  113.                     {
  114.                         UseSkillAndWait("Enervate");
  115.                         Thread.Sleep(100);
  116.                         UseSkillAndWait("Earthen Grip");
  117.                         Thread.Sleep(100);
  118.                         Log("Used: Enervate + Earthen Grip (Combo) - SelfHeal activated");
  119.                     }
  120.                     if (skillCooldown("Freezing Arrow") == 0 && skillCooldown("Magic Circle") >= 1)
  121.                     // casting "freezing arrow" if not on cd
  122.                     {
  123.                         UseSkillAndWait("Freezing Arrow");
  124.                         Log("Used: Freezing Arrow");
  125.                         Thread.Sleep(100);
  126.                     }
  127.                     if (skillCooldown("Freezing Arrow") != 0 && mpp(me) <= 25 && skillCooldown("Enervate") == 0 && skillCooldown("Magic Circle") >= 1)
  128.                     // if our "freezing arrow" is on cooldown, and our mp is below or at 25%, we will also look for enervate cd.
  129.                     // if the cd is 0, we will cast enervate. This will cause our flamebolts to regenerate mana, when hitting the affected target
  130.                     {
  131.                         UseSkillAndWait("Enervate");
  132.                         Log("Used: Enervate - Mana regeneration for Flamebold activated");
  133.                         Thread.Sleep(100);
  134.                     }
  135.                     if (skillCooldown("Freezing Arrow") != 0 && hpp(me) > 60 && skillCooldown("Magic Circle") >= 1)
  136.                     // if "freezing arrow" is on CD and our HP is above 60%, we use flamebolt
  137.                     {
  138.                         for (int i = 0; i < 2; i++)
  139.                             UseSkillAndWait("Flamebolt");
  140.                         Log("Used: Flamebolt - PewPewPew");
  141.                     }
  142.  
  143.                     while (me.target != null && !isAlive(me.target) && me.target.dropAvailable && isAlive())
  144.                     // we check if we have a target, then check if this target is NOT alive. Then we look if its lootable  and finaly whether we are alive or not.
  145.                     // if all this is true, we will move towards the target and get our loot.
  146.                     {
  147.                         if (me.dist(me.target) > 3)
  148.                             ComeTo(me.target, 1);
  149.                         PickupAllDrop(me.target);
  150.                     }
  151.  
  152.                     // once we looted the target, and made sure its dead we will clear our target.
  153.                     if (me.target != null && !isAlive(me.target) && !me.target.dropAvailable)
  154.                     {
  155.                         CancelTarget();
  156.                     }
  157.                 }
  158.             }
  159.         }
  160.     }
  161. }
Advertisement
Add Comment
Please, Sign In to add comment