private void CheckIfDead() { if (_user.Valid == false) { return; } if (_user.Health_Current == 0 && chk_Assist.IsChecked == false) { _botstage = BotStage.Navigating; while (_user.Health_Current == 0) { Utilities.Keyboard.KeyBoardHelper.KeyUp(Keys.NumPad0); _user.Refresh(); Thread.Sleep(250); } if (_returntocamp.Waypoints.Count > 0) { _returntocamp.Start(); } else { _botstage = BotStage.Nothing; } } }
private void btn_Stop_Click(object sender, RoutedEventArgs e) { _botstage = BotStage.Nothing; _monsterdetection.Stop(); _navigation.Stop(); _returntocamp.Stop(); }
private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { _botstage = BotStage.Nothing; _monsterdetection.Stop(); _navigation.Stop(); _returntocamp.Stop(); Global.DisableBuffs = false; }
private void FightMonster() { _currentmonster.Refresh(); _user.Refresh(); if (_user.Health_Current == 0 || _user.TargetID != _currentmonster.ID) { _botstage = BotStage.Detection; _monsterdetection.Stop(); _navigation.Stop(); _returntocamp.Stop(); return; } _user.Heading = _user.Coordinate.AngleTo(_currentmonster.Coordinate); if (_aiFighter.IsRanged == false) { if (_user.Coordinate.Distance(_currentmonster.Coordinate) > 3) { Utilities.Keyboard.KeyBoardHelper.KeyDown(Keys.W); } else { Utilities.Keyboard.KeyBoardHelper.KeyUp(Keys.W); } } else { Utilities.Keyboard.KeyBoardHelper.KeyUp(Keys.W); } if (_currentmonster.Health_Current > 0) { _aiFighter.Fight(_user, _currentmonster, _recast); } else { _ignorelist.Clear(); _navigation.Resume(); _botstage = BotStage.Detection; } // Check if we should ignore the monster because it has not been claimed for a while.. // This typically happens if monster is out of line of sight. //if(_claimwatch.Elapsed.Seconds > 7 && _currentmonster.IsClaimed == false) //{ // _claimwatch.Stop(); // _ignorelist.Add(_currentmonster.ID); // _navigation.Resume(); // _botstage = BotStage.Detection; //} }
private void DetectMonster() { Character closestMonster = null; List <int> aggroList = _aggrohelper.GetAggroList(); // Check if we have aggro if (aggroList.Count > 0) { foreach (int aggroID in aggroList) { Character aggroMob = GetMonsterFromID(aggroID); if (aggroMob == null) { Debug.Print("Null monster in aggro detection\n"); continue; } if (aggroMob.Health_Percent > 0) { closestMonster = aggroMob; } } } // Make sure we do not have any aggro... if (closestMonster == null) { // Check if our Hp/Tp is OK if (CheckHealth()) { return; } // If our health is fine, check for the next closest montser. closestMonster = GetClosestMonster(); // If there is no monster nearby, exit out and try again. if (closestMonster == null) { return; } } //Debug.Print("Found Monster"); // We have a valid monster, so stop navigating and enable Fight mode! _navigation.Stop(); _currentmonster = closestMonster; _aiFighter.Reset(); _botstage = BotStage.Fighting; // Start timer to see if we have run into a problem claiming the monster. _claimwatch = new Stopwatch(); _claimwatch.Start(); }
private void DetectAssistMonsters() { Character closestMonster = null; List <Character> fate = new List <Character>(); List <Character> players = new List <Character>(); List <Character> monsters = new List <Character>(); MemoryFunctions.GetCharacters(monsters, fate, players, ref _user); monsters.AddRange(fate); if (chk_PVPMode.IsChecked == true) { monsters.AddRange(players); } //Garuda Helper foreach (Character monster in monsters) { if (monster.Health_Percent > 0 && monster.Health_Percent <= 100 && monster.Name.ToLower() == "satin plume") { monster.Target(); break; } } foreach (Character monster in monsters) { if (monster.Health_Percent > 0 && monster.Health_Percent <= 100 && monster.Name.ToLower() != "spiny plume" && _user.TargetID == monster.ID) { closestMonster = monster; break; } } // Make sure we do not have any aggro... if (closestMonster == null) { return; } _currentmonster = closestMonster; _aiFighter.Reset(); _botstage = BotStage.Fighting; // Start timer to see if we have run into a problem claiming the monster. _claimwatch = new Stopwatch(); _claimwatch.Start(); }
private void GatherSpot(Character user, Gathering currentSpot) { currentSpot.Refresh(); user.Refresh(); if (user.Health_Current == 0) { _botstage = BotStage.Nothing; _navigation.Stop(); return; } if (user.Coordinate.Distance(currentSpot.Coordinate) < 0.5) { user.Heading = user.Coordinate.AngleTo(currentSpot.Coordinate); Utilities.Keyboard.KeyBoardHelper.KeyDown(Keys.S); Thread.Sleep(150); Utilities.Keyboard.KeyBoardHelper.KeyUp(Keys.S); } // We are close enough.. stop running //Utilities.Keyboard.KeyBoardHelper.KeyUp(Keys.W); if (currentSpot.IsHidden == false) { Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.NumPad0); Thread.Sleep(350); } else { //_ignorelist.Clear(); _navigation.Resume(); _botstage = BotStage.Detection; } //// Check if we should ignore the monster because it has not been claimed for a while.. //// This typically happens if monster is out of line of sight. //if (_claimwatch.Elapsed.Seconds > 7 && currentSpot.IsClaimed == false) //{ // _claimwatch.Stop(); // _ignorelist.Add(currentSpot.ID); // _navigation.Resume(); // _botstage = BotStage.Detection; //} }
private bool CheckHealth() { if (_user == null) { return(false); } _user.Refresh(); if (_user.Health_Percent < 45 || _user.TP_Current < 250 || _user.Mana_Percent < 30) { _navigation.Stop(); _botstage = BotStage.Healing; return(true); } return(false); }
private void AssistMonster() { _currentmonster.Refresh(); _user.Refresh(); _user.Heading = _user.Coordinate.AngleTo(_currentmonster.Coordinate); if (_user.Health_Current == 0) { _botstage = BotStage.Detection; return; } if (Global.PauseInput) { _botstage = BotStage.Detection; return; } if (_currentmonster.Distance >= 30) { _botstage = BotStage.Detection; return; } if (_user.TargetID != _currentmonster.ID) { _botstage = BotStage.Detection; return; } if (_currentmonster.Health_Current > 0) { _aiFighter.Fight(_user, _currentmonster, _recast); } else { _botstage = BotStage.Detection; } }
private void PlayerRest() { if (_user == null) { return; } _user.Refresh(); List <int> aggroList = _aggrohelper.GetAggroList(); Boolean aggroFound = false; // Check if we have aggro if (aggroList.Count > 0) { foreach (int aggroID in aggroList) { Character aggroMob = GetMonsterFromID(aggroID); if (aggroMob == null) { continue; } if (aggroMob.Valid) { if (aggroMob.Health_Percent > 0) { aggroFound = true; break; } } } } if ((_user.Health_Percent > 95 && _user.TP_Current > 700 && _user.Mana_Percent > 95) || aggroFound) { _navigation.Resume(); _botstage = BotStage.Detection; } }
private void btn_Start_Click(object sender, RoutedEventArgs e) { if (_navigation.Waypoints.Count == 0 && chk_Assist.IsChecked == false) { MessageBox.Show("You do not have any waypoints loaded.", "Chocobot", MessageBoxButton.OK, MessageBoxImage.Warning); return; } _botstage = BotStage.Detection; if (chk_HasCure.IsChecked == true) { _aiFighter.HasCure = true; } if (chk_Assist.IsChecked == false) { _navigation.Start(); } _monsterdetection.Start(); }
public void DoWork() { try { List <Character> monsters = new List <Character>(); List <Character> fate = new List <Character>(); List <Character> players = new List <Character>(); List <Gathering> gathering = new List <Gathering>(); GatheringWindow uiWindow = new GatheringWindow(); long gathercount = 0; Character user = null; Gathering currentTarget = null; Stopwatch _claimwatch; byte lastPosition = 1; MemoryFunctions.GetCharacters(monsters, fate, players, ref user); MemoryFunctions.GetGathering(gathering); _botstage = BotStage.Detection; _navigation.Start(); _initial = true; while (true) { //Debug.Print(_botstage.ToString()); switch (_botstage) { case BotStage.Detection: currentTarget = FindClosestGatheringSpot(); if (currentTarget != null) { _navigation.Stop(); _botstage = BotStage.Initialize; // Start timer to see if we have run into a problem claiming the monster. _claimwatch = new Stopwatch(); _claimwatch.Start(); } break; case BotStage.Initialize: InitializeGatheringSpot(user, uiWindow, currentTarget); Debug.Print("Window open..."); uiWindow.Refresh(); Debug.Print("Items Found: " + uiWindow.Items.Count.ToString()); GatheringWindow.GatheringItems idealItem = null; bool found = false; foreach (string lstitem in SearchItems) { foreach (GatheringWindow.GatheringItems item in uiWindow.Items) { if (item.Name.ToLower().Contains(lstitem.ToLower())) { idealItem = item; found = true; break; } } if (found) { break; } } //foreach (GatheringWindow.GatheringItems item in uiWindow.Items) //{ // foreach (string lstitem in SearchItems) // { // if (item.Name.ToLower().Contains(lstitem.ToLower())) // { // idealItem = item; // found = true; // break; // } // } // if (found) // break; //} if (idealItem == null) { idealItem = uiWindow.Items.First(); } Thread.Sleep(1000); Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.NumPad6); Thread.Sleep(150); Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.NumPad6); Thread.Sleep(150); Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.NumPad6); Thread.Sleep(200); Debug.Print("Found Item: " + idealItem.Name + " Pos: " + idealItem.Position.ToString() + " " + found); int positionShift = idealItem.Position - lastPosition; Debug.Print("Shift: " + positionShift); for (int i = 1; i <= Math.Abs(positionShift); i++) { if (positionShift > 0) { Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.NumPad2); } else { Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.NumPad8); } Thread.Sleep(350); } lastPosition = idealItem.Position; if (_initial) { MessageBox.Show("Make sure your current selection is: " + idealItem.Name + "... Click OK to continue.", "Chocobot", MessageBoxButton.OK, MessageBoxImage.Information); _initial = false; } user.Refresh(); if (idealItem.Name.ToLower().Contains("shard") || idealItem.Name.ToLower().Contains("crystal") || idealItem.Name.ToLower().Contains("cluster")) { if (user.CurrentGP >= 400 && user.Level >= 20) { if (idealItem.Name.ToLower().Contains("fire")) { Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.Dash); } else if (idealItem.Name.ToLower().Contains("lightning")) { Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.D0); } else if (idealItem.Name.ToLower().Contains("water")) { Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.VK_OEM_PLUS); } else if (user.Level >= 30) { Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.D1); } Thread.Sleep(500); } } else { if (user.CurrentGP >= 100 && user.Level >= 15) { Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.D4); Thread.Sleep(500); } //if (user.CurrentGP >= 400 && user.Level >= 30) //{ // Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.D1); // Thread.Sleep(500); //} //if (user.CurrentGP >= 100 && user.Level >= 15) //{ // Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.D9); // Thread.Sleep(500); //} //user.Refresh(); //if (user.CurrentGP >= 250 && user.Level >= 10) //{ // Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.D7); // Thread.Sleep(500); //} } gathercount += 1; _botstage = BotStage.Gather; break; case BotStage.Gather: GatherSpot(user, currentTarget); break; } Thread.Sleep(250); } } catch (Exception) { _navigation.Stop(); throw; } }
private void btn_Start_Click(object sender, RoutedEventArgs e) { if(_navigation.Waypoints.Count == 0 && chk_Assist.IsChecked == false) { MessageBox.Show("You do not have any waypoints loaded.", "Chocobot", MessageBoxButton.OK, MessageBoxImage.Warning); return; } _botstage = BotStage.Detection; if (chk_HasCure.IsChecked == true) _aiFighter.HasCure = true; if(chk_Assist.IsChecked == false) _navigation.Start(); _monsterdetection.Start(); }
private bool CheckHealth() { if (_user == null) return false; _user.Refresh(); if (_user.Health_Percent < 45 || _user.TP_Current < 250 || _user.Mana_Percent < 30) { _navigation.Stop(); _botstage = BotStage.Healing; return true; } return false; }
private void DetectAssistMonsters() { Character closestMonster = null; List<Character> fate = new List<Character>(); List<Character> players = new List<Character>(); List<Character> monsters = new List<Character>(); MemoryFunctions.GetCharacters(monsters, fate, players, ref _user); monsters.AddRange(fate); if (chk_PVPMode.IsChecked == true) { monsters.AddRange(players); } //Garuda Helper foreach (Character monster in monsters) { if (monster.Health_Percent > 0 && monster.Health_Percent <= 100 && monster.Name.ToLower() == "satin plume") { monster.Target(); break; } } foreach (Character monster in monsters) { if (monster.Health_Percent > 0 && monster.Health_Percent <= 100 && monster.Name.ToLower() != "spiny plume" && _user.TargetID == monster.ID) { closestMonster = monster; break; } } // Make sure we do not have any aggro... if (closestMonster == null) { return; } _currentmonster = closestMonster; _aiFighter.Reset(); _botstage = BotStage.Fighting; // Start timer to see if we have run into a problem claiming the monster. _claimwatch = new Stopwatch(); _claimwatch.Start(); }
private void CheckIfDead() { if (_user.Valid == false) return; if (_user.Health_Current == 0 && chk_Assist.IsChecked == false) { _botstage = BotStage.Navigating; while (_user.Health_Current == 0) { Utilities.Keyboard.KeyBoardHelper.KeyUp(Keys.NumPad0); _user.Refresh(); Thread.Sleep(250); } if (_returntocamp.Waypoints.Count > 0) _returntocamp.Start(); else { _botstage = BotStage.Nothing; } } }
private void ReturnToCamp_Finished(object sender) { _botstage = BotStage.Detection; }
private void DetectMonster() { Character closestMonster = null; List<int> aggroList = _aggrohelper.GetAggroList(); // Check if we have aggro if (aggroList.Count > 0) { foreach(int aggroID in aggroList){ Character aggroMob = GetMonsterFromID(aggroID); if(aggroMob == null) { Debug.Print("Null monster in aggro detection\n"); continue; } if (aggroMob.Health_Percent > 0) closestMonster = aggroMob; } } // Make sure we do not have any aggro... if (closestMonster == null) { // Check if our Hp/Tp is OK if(CheckHealth()) return; // If our health is fine, check for the next closest montser. closestMonster = GetClosestMonster(); // If there is no monster nearby, exit out and try again. if (closestMonster == null) return; } //Debug.Print("Found Monster"); // We have a valid monster, so stop navigating and enable Fight mode! _navigation.Stop(); _currentmonster = closestMonster; _aiFighter.Reset(); _botstage = BotStage.Fighting; // Start timer to see if we have run into a problem claiming the monster. _claimwatch = new Stopwatch(); _claimwatch.Start(); }
private void PlayerRest() { if (_user == null) return; _user.Refresh(); List<int> aggroList = _aggrohelper.GetAggroList(); Boolean aggroFound = false; // Check if we have aggro if (aggroList.Count > 0) { foreach (int aggroID in aggroList) { Character aggroMob = GetMonsterFromID(aggroID); if (aggroMob == null) continue; if (aggroMob.Valid) if (aggroMob.Health_Percent > 0) { aggroFound = true; break; } } } if ((_user.Health_Percent > 95 && _user.TP_Current > 700 && _user.Mana_Percent > 95) || aggroFound) { _navigation.Resume(); _botstage = BotStage.Detection; } }
public void DoWork() { try { List<Character> monsters = new List<Character>(); List<Character> fate = new List<Character>(); List<Character> players = new List<Character>(); List<Gathering> gathering = new List<Gathering>(); GatheringWindow uiWindow = new GatheringWindow(); long gathercount = 0; Character user = null; Gathering currentTarget = null; Stopwatch _claimwatch; byte lastPosition = 1; MemoryFunctions.GetCharacters(monsters, fate, players, ref user); MemoryFunctions.GetGathering(gathering); _botstage = BotStage.Detection; _navigation.Start(); _initial = true; while (true) { //Debug.Print(_botstage.ToString()); switch (_botstage) { case BotStage.Detection: currentTarget = FindClosestGatheringSpot(); if (currentTarget != null) { _navigation.Stop(); _botstage = BotStage.Initialize; // Start timer to see if we have run into a problem claiming the monster. _claimwatch = new Stopwatch(); _claimwatch.Start(); } break; case BotStage.Initialize: InitializeGatheringSpot(user, uiWindow, currentTarget); Debug.Print("Window open..."); uiWindow.Refresh(); Debug.Print("Items Found: " + uiWindow.Items.Count.ToString()); GatheringWindow.GatheringItems idealItem = null; bool found = false; foreach (string lstitem in SearchItems) { foreach (GatheringWindow.GatheringItems item in uiWindow.Items) { if (item.Name.ToLower().Contains(lstitem.ToLower())) { idealItem = item; found = true; break; } } if (found) break; } //foreach (GatheringWindow.GatheringItems item in uiWindow.Items) //{ // foreach (string lstitem in SearchItems) // { // if (item.Name.ToLower().Contains(lstitem.ToLower())) // { // idealItem = item; // found = true; // break; // } // } // if (found) // break; //} if (idealItem == null) idealItem = uiWindow.Items.First(); Thread.Sleep(1000); Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.NumPad6); Thread.Sleep(150); Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.NumPad6); Thread.Sleep(150); Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.NumPad6); Thread.Sleep(200); Debug.Print("Found Item: " + idealItem.Name + " Pos: " + idealItem.Position.ToString() + " " + found); int positionShift = idealItem.Position - lastPosition; Debug.Print("Shift: " + positionShift); for (int i = 1; i <= Math.Abs(positionShift); i++) { if (positionShift > 0) Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.NumPad2); else Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.NumPad8); Thread.Sleep(350); } lastPosition = idealItem.Position; if (_initial) { MessageBox.Show("Make sure your current selection is: " + idealItem.Name + "... Click OK to continue.", "Chocobot", MessageBoxButton.OK, MessageBoxImage.Information); _initial = false; } user.Refresh(); if (idealItem.Name.ToLower().Contains("shard") || idealItem.Name.ToLower().Contains("crystal") || idealItem.Name.ToLower().Contains("cluster")) { if (user.CurrentGP >= 400 && user.Level >= 20) { if (idealItem.Name.ToLower().Contains("fire")) Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.Dash); else if (idealItem.Name.ToLower().Contains("lightning")) Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.D0); else if (idealItem.Name.ToLower().Contains("water")) Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.VK_OEM_PLUS); else if (user.Level >= 30) Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.D1); Thread.Sleep(500); } } else { if (user.CurrentGP >= 100 && user.Level >= 15) { Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.D4); Thread.Sleep(500); } //if (user.CurrentGP >= 400 && user.Level >= 30) //{ // Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.D1); // Thread.Sleep(500); //} //if (user.CurrentGP >= 100 && user.Level >= 15) //{ // Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.D9); // Thread.Sleep(500); //} //user.Refresh(); //if (user.CurrentGP >= 250 && user.Level >= 10) //{ // Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.D7); // Thread.Sleep(500); //} } gathercount += 1; _botstage = BotStage.Gather; break; case BotStage.Gather: GatherSpot(user, currentTarget); break; } Thread.Sleep(250); } } catch (Exception) { _navigation.Stop(); throw; } }