public override void DoInitialize() { AddMessage("Our thread priority is " + Thread.CurrentThread.Priority.ToString()); //argh, we need to make sure patrol area has a valid GetCurrentTarget, and if //we arent going to use SetClosest then we need to do this the long way //sets patrolarea internal iterator so it wont throw an exception //the next time we try and move PatrolArea patrolarea = GetPatrolArea(); patrolarea.FindClosest(MovementDirection.Forward); //to avoid answering questions too often, lets make sure the user //has set things up correctly. string msg = ""; if (profile.GetString("PatrolArea") == "") { msg += "You do not have a Patrol Area selected.\n"; } if (patrolarea != null && patrolarea.NumWaypoints == 0) { msg += "You do not have any waypoints in your selected Patrol Area\n"; } if ( profile.GetString("Scout.FightRangedBowQ") == "" || profile.GetString("Scout.FightRangedBowKey") == "" || profile.GetString("Scout.SlashNormalQ") == "" || profile.GetString("Scout.SlashNormalKey") == "" || profile.GetString("Scout.FightMeleeWeaponQ") == "" || profile.GetString("Scout.FightMeleeWeaponKey") == "" ) { msg += "You must set up your fight keys before fighting.\n"; } if (msg != "") { msg += "\nFix these problems and press Resume"; MessageBox.Show(msg); bPaused = true; return; } Interaction.AppActivate(_ak.GameProcess); AddMessage("Starting bot"); Thread.Sleep(1000); //Are we dead? if (_ak.IsPlayerDead) { Action = BotAction.DiedReleaseAndRun; return; } Action = BotAction.CheckAgro; ActionQueue.Enqueue(BotAction.Rest); ActionQueue.Enqueue(BotAction.FindTarget); }
public override void DoInitialize() { AddMessage("Our thread priority is " + Thread.CurrentThread.Priority.ToString()); //argh, we need to make sure patrol area has a valid GetCurrentTarget, and if //we arent going to use SetClosest then we need to do this the long way //sets patrolarea internal iterator so it wont throw an exception //the next time we try and move PatrolArea patrolarea = GetPatrolArea(); patrolarea.FindClosest(MovementDirection.Forward); //to avoid answering questions too often, lets make sure the user //has set things up correctly. string msg = ""; if (profile.GetString("PatrolArea") == "") { msg += "You do not have a Patrol Area selected.\n"; } if (patrolarea != null && patrolarea.NumWaypoints == 0) { msg += "You do not have any waypoints in your selected Patrol Area\n"; } if ( profile.GetString("Necro.FightRangedLTQ") == "" || profile.GetString("Necro.FightRangedLTKey") == "" || profile.GetString("Necro.FightRangedPTQ") == "" || profile.GetString("Necro.FightRangedPTKey") == "" || profile.GetString("Necro.FightMeleePTQ") == "" || profile.GetString("Necro.FightMeleePTKey") == "" || profile.GetString("Necro.FightFPQ") == "" || profile.GetString("Necro.FightFPKey") == "" ) { msg += "You must set up your fight spell keys before fighting.\n"; } if (msg != "") { msg += "\nFix these problems and press Resume"; MessageBox.Show(msg); bPaused = true; return; } Interaction.AppActivate(_ak.GameProcess); AddMessage("Starting bot"); Thread.Sleep(1000); //Are we dead? if (_ak.IsPlayerDead) { Action = BotAction.DiedReleaseAndRun; return; } if (petID < 1 || !_ak.get_DoesObjectExist(petID)) { CastPet(); //we want to do this in a new thread so it can sleep without sleeping //the code the delegate that waits for the pet packet. It didnt work //most of the time if it was in the same thread // System.Threading.Thread tPet = new Thread(new ThreadStart(CastPet)); // tPet.Start(); //start the castPet thread // tPet.Priority = ThreadPriority.BelowNormal; // Thread.Sleep(0); //yield so the thread really starts // tPet.Join(); //wait for that thread to finish } Action = BotAction.CheckAgro; ActionQueue.Enqueue(BotAction.Protect); ActionQueue.Enqueue(BotAction.CheckBuffs); ActionQueue.Enqueue(BotAction.Rest); ActionQueue.Enqueue(BotAction.FindTarget); }