Code:
case "/record":
{
if (Recording)
{
Recording = false;
ShowMessage("Finished Recording");
}
else
{
Recording = true;
ActivePath = new Paths();
ActivePath._Map = _Map;
ActivePath.Desc = "Custom";
ActivePath.ID = 0;
ActivePath.myPoints.Add(new MyPoint(0, MakeCoord(X, Y)));
ActivePoint = null;
ShowMessage("Recording path! Jump to add points");
}
if (Recording)
{
if (_autoHunter.Enabled)
{
_autoHunter.Enabled = false;
ShowMessage("Do not record while hunting! Stopped bot");
}
ushort PID = (ushort)(ActivePath.myPoints.Count);
ActivePath.myPoints.Add(new MyPoint(PID, MakeCoord(ToX, ToY)));
ShowMessage("added " + ToX + "," + ToY);
}
}
break;
Code:
public ushort pathX;
public ushort pathY;
public ushort ToX;
public ushort ToY;
private ushort _Map, _X, _Y;
Code:
public ushort X
{
get { return _X; }
set { PrevX = _X; _X = value; }// Form.OutX.Text = Convert.ToString(_X); }
}
public ushort Y
{
get { return _Y; }
set { PrevY = _Y; _Y = value; }// Form.OutY.Text = Convert.ToString(_Y); }
}
public bool Recording = false;
public Paths ActivePath = null;
public MyPoint ActivePoint = null;
public List<Coord> path = new List<Coord>();
public Coord To;
Code:
public List<PathFinderNode> _paths = new List<PathFinderNode>();
public ushort PrevX, PrevY;
public static int pathIndex = 9999999;
public static bool fimPath = true;
Code:
public static MyPoint SetPoint(ushort Id, Coord Where)
{
MyPoint P = new MyPoint(Id, Where);
return P;
}
public static Coord newCoord(ushort X, ushort Y)
{
Coord Z = new Coord();
Z.X = X;
Z.Y = Y;
return Z;
}
public static int Distance(ushort X, ushort Y, ushort ToX, ushort ToY)
{
int XDist = Math.Abs(X - ToX);
int YDist = Math.Abs(Y - ToY);
if (XDist > YDist)
return XDist;
else
return YDist;
}
public static bool VerificaDistancia(Client C, ushort toX, ushort toY)
{
int distan = Distance(C.X, C.Y, toX, toY);
int disMax = 17;
if (distan > disMax)
{
ushort novoX = C.X;
ushort novoY = C.Y;
Random r = new Random();
int imove = r.Next(5, disMax);
if (C.X < toX)
novoX = (ushort)(novoX + imove);
else
novoX = (ushort)(novoX - imove);
if (C.Y < toY)
novoY = (ushort)(novoY + imove);
else
novoY = (ushort)(novoY - imove);
}
return true;
}
public class Paths
{
public ushort ID;
public ushort _Map;
public string Desc;
public List<MyPoint> myPoints = new List<MyPoint>();
}
public static Coord MakeCoord(ushort X, ushort Y)
{
Coord Z = new Coord();
Z.X = X;
Z.Y = Y;
return Z;
}
public struct Coord
{
public ushort X, Y;
}
public class MyPoint
{
public Coord coord;
public ushort Id;
public MyPoint(ushort PID, Coord C)
{
Id = PID;
coord = C;
}
}
Code:
protected override void Update()
{
List<Entity> targets = Client.Screen.GetAllEntities()
.Where((e) =>
!e.IsPlayer &&
!e.Name.Contains("Guard") &&
e.Position.Distance(Client.Player.Position) < 18)
.OrderBy((e) => e.Position.Distance(Client.Player.Position))
.ToList();
if (targets.Count > 0)
{
Entity target = targets[0];
if ((ActivePath != null) && (targets == null))
{
ushort pathX;
ushort pathY;
if (pathIndex == 9999999)
pathIndex = ActivePath.myPoints.Count - 1;
pathX = ActivePath.myPoints[pathIndex].coord.X;
pathY = ActivePath.myPoints[pathIndex].coord.Y;
if (pathIndex >= ActivePath.myPoints.Count - 1)
fimPath = true;
if (pathIndex <= 1)
fimPath = false;
if (fimPath)
pathIndex--;
else
pathIndex++;
}
Client.Jump(target.Position);
Client.Attack(target.Id);
Client.RefreshPosition();
Thread.Sleep(800);
}
}
Code:
#region Public
public List<Coord> path = new List<Coord>();
public Paths ActivePath = null;
public static int pathIndex = 9999999;
public static bool fimPath = true;
public static MyPoint SetPoint(ushort Id, Coord Where)
{
MyPoint P = new MyPoint(Id, Where);
return P;
}
public static Coord newCoord(ushort X, ushort Y)
{
Coord Z = new Coord();
Z.X = X;
Z.Y = Y;
return Z;
}
public class Paths
{
public ushort Id;
public ushort MapId;
public string Desc;
public List<MyPoint> myPoints = new List<MyPoint>();
}
public static Coord MakeCoord(ushort X, ushort Y)
{
Coord Z = new Coord();
Z.X = X;
Z.Y = Y;
return Z;
}
public struct Coord
{
public ushort X, Y;
}
public class MyPoint
{
public Coord coord;
public ushort Id;
public MyPoint(ushort PTID, Coord C)
{
Id = PTID;
coord = C;
}
}
#endregion
Should I add a new class and take the first parts out and add them to a new class? I mean the stuff I added to Client.cs.






