public void DoWork() { objectManager.PopulateList(); while (!halt) { if (pathing.Dead || magic.ReadFloat((uint)TbcOffsets.General.PlayerCorpseX) != 0)//Dead { if (profile.IsGhostSet) { timesDied++; statistics.Changed = true; if (!FirstPoint(ghostPoints, 1)) { endGhostPoints = FirstPoint(wayPoints, 2); } while (!halt && pathing.Dead) { if (!endGhostPoints) { endGhostPoints = NextPoint(ghostPoints, 1); } else { NextPoint(wayPoints, 2); } } } else { Halt(); } } else //Alive { endGhostPoints = false; if (profile.IsWaySet) { other.Regen(); if (!FirstPoint(wayPoints, 0)) { Halt(); } bool combat = false; while (!halt && !pathing.Dead) { if (sell > 0 && profile.IsSellSet) { FirstPoint(sellPoints, 0); while (sell > 0 && !pathing.Dead && !halt) { NextPoint(sellPoints, 3); if (point == sellPoints.Count - 1) { other.Interact(); } } } else { other.Regen(); if (combat && !pathing.Dead && settings.Linear) { NextPoint(wayPoints, 3); combat = false; } else if (combat && !pathing.Dead) { FirstPoint(wayPoints, 0); combat = false; } else if (!combat && !pathing.Dead) { combat = NextPoint(wayPoints, 0); } } } } else { Halt(); } } } keyboardSim.KeyUp(walk); keyboardSim.KeyUp(turnleft); keyboardSim.KeyUp(turnright); }
public bool NextPoint(List <float[]> points, int j) { if (sell == 2) { point--; } else { point++; } if (point == points.Count() && profile.Loop && (j == 0 || j == 3)) { if (sell == 0 || sell == -1) { point = 0; sellLoops++; loops++; statistics.Changed = true; if (sellLoops == settings.SellLoops) { sell = 1; } } else if (sell == 1) { sell = 2; point--; } } else if (point == points.Count() && !profile.Loop && (j == 0 || j == 3)) { Halt(); } else if (point == points.Count() && j == 1) { return(FirstPoint(wayPoints, 2)); } else if (point == -1 && sell == 2) { sell = 0; point = 0; sellLoops = 0; } float[] nextPoint; if (!halt && ((point < points.Count() && sell != 2) || (point > -1 && sell == 2))) { float startingX = magic.ReadFloat((uint)TbcOffsets.General.PlayerX); float startingY = magic.ReadFloat((uint)TbcOffsets.General.PlayerY); float startingZ = magic.ReadFloat((uint)TbcOffsets.General.PlayerZ); if ((!pathing.Dead || magic.ReadFloat((uint)TbcOffsets.General.PlayerCorpseX) == 0) && sell <= 0) { gathering.Search(startingX, startingY, startingZ); } nextPoint = points[point]; float deltaX = nextPoint[0] - startingX; float deltaY = nextPoint[1] - startingY; float deltaZ = nextPoint[2] - startingZ; if (j == 0 && sell == 0 || sell == -1) //Alive { bool combat; combat = pathing.WalkToPoint(nextPoint[0], nextPoint[1], nextPoint[2], false, startingX, startingY, startingZ); if (nextPoint[3] == 1 && !mount) { other.Mount(true); } else if (nextPoint[3] == 1 && mount) { other.Mount(false);; } return(combat); } else if (j == 1) //Dead, Ghostpoints { if (ghostpoint == nextPoint[3]) { pathing.WalkToPoint(nextPoint[0], nextPoint[1], nextPoint[2], true, startingX, startingY, startingZ); return(false); } else { return(FirstPoint(wayPoints, 2)); } } else if (j == 2) //Dead, Waypoints { pathing.WalkToPoint(nextPoint[0], nextPoint[1], nextPoint[2], true, startingX, startingY, startingZ); return(false); //test } else if (j == 3 || sell == 1 || sell == 2) //Alive, no combat { pathing.WalkToPoint(nextPoint[0], nextPoint[1], nextPoint[2], true, startingX, startingY, startingZ); if (nextPoint[3] == 1 && !mount) { other.Mount(true); } else if (nextPoint[3] == 1 && mount) { other.Mount(false); } return(false); } } return(false); }