using System;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using ArcheBuddy.Bot.Classes;
namespace Follower
{
public class LazyRaider : Core
{
public static string GetPluginAuthor()
{
return "nick1988";
}
public static string GetPluginVersion()
{
return "0.3.0";
}
public static string GetPluginDescription()
{
return "LazyRaider for StoneArrows";
}
public void UseSkillAndWait(string skillName, bool selfTarget = false)
{
//wait for cooldowns to finish first, before we try to cast skill
while (me.isCasting || me.isGlobalCooldown)
Thread.Sleep(50);
if (!UseSkill(skillName, true, selfTarget))
{
if (me.target != null && GetLastError() == LastError.NoLineOfSight)
{
//No line of sight, try come to target.
if (dist(me.target) <= 28)
ComeTo(me.target, 2);
else if (dist(me.target) <= 10)
ComeTo(me.target, 3);
else if (dist(me.target) < 20)
ComeTo(me.target, 8);
else
ComeTo(me.target, 8);
}
}
//wait for cooldown again, after we start cast skill
while (me.isCasting || me.isGlobalCooldown)
Thread.Sleep(50);
}
public void PluginRun()
{
while (true)
{
while (me.target == null)
// 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
{
Thread.Sleep(50);
}
while (me.target != null && isAttackable(me.target))
// once we have a target, and this target is attackable (so its no NPC) the bot will jump into this loop.
// this loops contains the "combat routine"
{
if (angle(me.target, me) > 45 && angle(me.target, me) < 315)
// making sure we are faceing the target. If not, we will turn towards it
{
TurnDirectly(me.target);
}
if (dist(me.target) <= 28 && skillCooldown("Endless Arrows") == 0)
if (skillCooldown("Endless Arrows") == 0)
{
UseSkillAndWait("Endless Arrows");
Log("Used: Endless Arrows");
Thread.Sleep(100);
}
while (me.target != null && !isAlive(me.target) && me.target.dropAvailable && isAlive())
// 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.
// if all this is true, we will move towards the target and get our loot.
{
if (me.dist(me.target) > 3)
ComeTo(me.target, 1);
PickupAllDrop(me.target);
}
// once we looted the target, and made sure its dead we will clear our target.
if (me.target != null && !isAlive(me.target) && !me.target.dropAvailable)
{
CancelTarget();
}
}
}
}
}
}