New version out there: https://www.thebuddyforum.com/arche...haslassistant-mob-grinder-hasla-features.html
Last edited:
using System;
using System.Windows.Forms;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
using ArcheBuddy.Bot.Classes;
namespace Hasla
{
public class Hasla : Core
{
// EDIT THIS - the plugin's settings
const double _COMBAT_RANGE = 24; // how close bot should move to a mob before using skills
public static string GetPluginAuthor()
{
return "Karls";
}
public static string GetPluginVersion()
{
return "1.0";
}
public static string GetPluginDescription()
{
return "HaslaGrinder: Assisting you for Hasla Weapon Grind";
}
List<Creature> team;
public Creature GetBestNearestMob(Zone zone)
{
try
{
foreach (var obj in getCreatures())
{
if (obj.type == BotTypes.Npc && isAttackable(obj) && (obj.firstHitter == null || obj.firstHitter == me || team.Contains(obj.firstHitter))
&& isAlive(obj) && (zone.ObjInZone(obj) || me.dist(obj) < _COMBAT_RANGE)
&& (hpp(obj) == 100 || obj.aggroTarget == me || team.Contains(obj.aggroTarget)))
{
return obj;
}
}
}
catch { }
return null;
}
public void UseSkillAndWait(string skillName, bool selfTarget = false)
{
if (getSkill(skillName) == null)
return;
while (me.isCasting || me.isGlobalCooldown)
Thread.Sleep(50);
if (skillCooldown(skillName) > 0)
return;
if (!UseSkill(skillName, true, selfTarget))
{
if (me.target != null && GetLastError() == LastError.NoLineOfSight)
{
if (dist(me.target) <= 5)
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);
}
}
while (me.isCasting || me.isGlobalCooldown)
Thread.Sleep(50);
}
public void PlayDead()
{
while (me.isCasting || me.isGlobalCooldown)
Thread.Sleep(50);
UseSkill("Play Dead", false, true);
Thread.Sleep(2000);
while (getAggroMobs().Count == 0 && (mpp() < 95 || hpp() < 95))
Thread.Sleep(100);
MoveForward(true);
Thread.Sleep(250);
MoveForward(false);
Log("Regen done");
}
public void LootThread()
{
try
{
BlockClientDice(true);
while (true)
{
foreach (var item in me.getDiceItems())
{
bool doRoll = false;
// Always roll on purses and random drops
if (item.name.EndsWith("Coinpurse") || item.name.StartsWith("Unidentified"))
doRoll = true;
else if(item.name == "Faded Conviction Token")
doRoll = GetGroupStatus("Conviction (Staff)");
else if (item.name == "Faded Courage Token")
doRoll = GetGroupStatus("Courage (Bow)");
else if (item.name == "Faded Compassion Token")
doRoll = GetGroupStatus("Compassion (Heal)");
else if (item.name == "Faded Fortitude Token")
doRoll = GetGroupStatus("Fortitude (Shield)");
else if (item.name == "Faded Honor Token")
doRoll = GetGroupStatus("Honor (1H)");
else if (item.name == "Faded Loyalty Token")
doRoll = GetGroupStatus("Loyalty (2H)");
else if (item.name == "Faded Sacrifice Token")
doRoll = GetGroupStatus("Sacrifice (Lute)");
item.Dice(doRoll);
if(doRoll)
Log("Rolling on : " + item.name);
else
Log("Passing on : " + item.name);
Thread.Sleep(500);
}
Thread.Sleep(1000);
}
}
finally
{
BlockClientDice(false);
}
}
public void RefreshTeam()
{
team = new List<Creature>();
foreach (var t in getPartyMembers())
team.Add(t.obj);
}
public void PluginRun()
{
DelAllGroupStatus();
new Task(() => { LootThread(); }).Start();
RoundZone zone = new RoundZone(me.X, me.Y, 40);
SetGroupStatus("Farm mobs ON", true);
SetGroupStatus("Courage (Bow)", false);
SetGroupStatus("Compassion (Heal)", false);
SetGroupStatus("Conviction (Staff)", false);
SetGroupStatus("Fortitude (Shield)", false);
SetGroupStatus("Honor (1H)", false);
SetGroupStatus("Loyalty (2H)", false);
SetGroupStatus("Sacrifice (Lute)", false);
Log("Starting Hasla Assistant");
Creature bestMob = null;
RefreshTeam();
while (true)
{
if (GetGroupStatus("Farm mobs ON") && isAlive())
{
if (GetGroupStatus("Farm mobs ON"))
{
if (getAggroMobs().Count == 0)
{
// EDIT THIS - Change to your buffs or delete it
// rebuff
if (buffTime("Insulating Lens (Rank 5)") == 0 && skillCooldown("Insulating Lens") == 0)
UseSkillAndWait("Insulating Lens", true);
if (buffTime("Hummingbird Ditty (Rank 3)") == 0 && skillCooldown("Hummingbird Ditty") == 0)
UseSkillAndWait("Hummingbird Ditty", true);
}
if (((mpp() > 40 && hpp() > 75) || getAggroMobs().Count > 0))
{
bestMob = GetBestNearestMob(zone);
}
if (bestMob != null)
{
try
{
while (bestMob != null && isAlive(bestMob) && isExists(bestMob) && GetGroupStatus("Farm mobs ON") && isAlive())
{
if (bestMob.firstHitter != null && bestMob.firstHitter != me && !team.Contains(bestMob.firstHitter))
{
bestMob = null;
break;
}
if (bestMob.firstHitter == null && getAggroMobs().Count > 0 && bestMob != GetBestNearestMob(zone))
bestMob = GetBestNearestMob(zone);
if (me.target != bestMob)
SetTarget(bestMob);
if (angle(bestMob, me) > 45 && angle(bestMob, me) < 315)
TurnDirectly(bestMob);
var distToMob = me.dist(bestMob);
if (isAlive(bestMob))
{
if (distToMob > _COMBAT_RANGE)
{
ComeTo(me.target, _COMBAT_RANGE - 1);
{
UseSkillAndWait("Flamebolt");
}
}
}
Thread.Sleep(10);
}
bestMob = null;
RefreshTeam();
}
catch { }
}
}
}
Thread.Sleep(10);
}
}
}
}
so this is my edit, but for some reason it won't use skills?
All I want to use is firebolt. Any help?Thanks!
var distToMob = me.dist(bestMob);
if (isAlive(bestMob))
{
if (distToMob > _COMBAT_RANGE)
{
ComeTo(me.target, _COMBAT_RANGE - 1);
{
UseSkillAndWait("Flamebolt");
}
}
}
var distToMob = me.dist(bestMob);
if (isAlive(bestMob))
{
if (distToMob > _COMBAT_RANGE)
{
ComeTo(me.target, _COMBAT_RANGE - 1);
}
else
{
UseSkillAndWait("Flamebolt");
}
}
how can i make this atk without move?
RoundZone zone = new RoundZone(me.X, me.Y, 40);