public override void Fight(Character user, Character monster, Recast recast) { base.Fight(user, monster, recast); if (_valid == false) return; UIWindow ui = new UIWindow(); ui.RefreshPointers(); if (ui.GetActiveWindowName() == "chatlog") return; recast.Refresh(); _scriptingObject.Cooldowns = recast; _scriptingObject.CurrentMonster = monster; _scriptingObject.CurrentUser = user; //Debug.Print("Fighting"); try { var res = _host.Execute("Fight();"); if (res != null) Console.WriteLine(" = " + res.ToString()); } catch (System.Exception ex) { Console.WriteLine(ex.Message); } }
private void WhmCureMode() { Recast recast = new Recast(); int curePotency = int.Parse(txt_CurePotency.Text); int cure2Potency = int.Parse(txt_Cure2Potency.Text); int hurtPlayers = 0; Character tank = null, tank2 = null; List<Character> monsters = new List<Character>(); List<Character> fate = new List<Character>(); List<Character> players = new List<Character>(); List<Character> npcs = new List<Character>(); List<Character> damagedTargets = new List<Character>(); List<Character> deadTargets = new List<Character>(); Character statusAilment = null; MemoryFunctions.GetCharacters(monsters, fate, players, ref _user); MemoryFunctions.GetNPCs(npcs); _hotkeys.QuickRefreshAbilities(); if (_user.ContainsStatusEffect(292, 0, false)) return; players.AddRange(npcs); List<Character> targets = (from player in players from target in _targets where player.Name.ToLower() == target.ToLower() select player).ToList(); targets = targets.Distinct().ToList(); if (_user.Health_Current == 0) return; recast.Refresh(); if (_hotkeys[SHROUD].PercentReady == 100 && _user.Mana_Percent <= 70 && chk_WHMMode.IsChecked == true) // Shroud { _hotkeys[SHROUD].UseAbility(); } if (_hotkeys[SHROUD].PercentReady == 100) { AggroHelper ah = new AggroHelper(); List<Tuple<int, byte>> aggro = ah.GetAggroListWithEmnity(); foreach(Tuple<int, byte> a in aggro) { // Check if hate level is above 95% if(a.Item2 >= 95) { // Check if the monster has less than 95% life. Character aggroMob = MemoryFunctions.GetCharacterFromID(a.Item1); if(aggroMob == null) { continue; } if (aggroMob.Health_Percent <= 90 && aggroMob.Health_Percent >= 1 && aggroMob.Name.ToLower().Contains("plume") == false) { Debug.Print("Hate Detected: " + a.Item2.ToString() + " " + aggroMob.Name + "\n"); _hotkeys[SHROUD].UseAbility(); } } } } foreach (Character target in targets) { target.Refresh(); if (target.Name == txt_Tank.Text && target.ContainsStatusEffect(432, 0, false) == false) tank = target; if (target.Name == txt_Tank2.Text && target.ContainsStatusEffect(432, 0, false) == false) tank2 = target; if(target.Valid == false) continue; if (target.ContainsStatusEffect(292, 0, false)) continue; if (target.ContainsStatusEffect(432, 0, false)) // Leviathan debuff continue; if (target.DistanceFrom(_user) >= 30) continue; if (target.Health_Current == 0) { deadTargets.Add(target); continue; } int healthMissing = target.Health_Max - target.Health_Current; if (healthMissing >= curePotency || target.Health_Percent < 70) { damagedTargets.Add(target); hurtPlayers++; } foreach (var item in lst_StatusEffects.Items) { if (target.ContainsStatusEffect(Int32.Parse(item.ToString()), 0, false) && target.ContainsStatusEffect(292, 0, false) == false) statusAilment = target; } } if (chk_SwiftcastRaiseAll.IsChecked == true) { deadTargets.Clear(); deadTargets.AddRange(from player in players where player.Valid where !player.ContainsStatusEffect(292, 0, false) where !(player.DistanceFrom(_user) >= 30) where player.Health_Current == 0 select player); } damagedTargets = damagedTargets.Distinct().ToList(); // Raise Tanks and Healers first deadTargets.Sort((a, b) => a.JobPriority.CompareTo(b.JobPriority)); // Check if tank needs healing first if(chk_TankPriority.IsChecked == true) { // Check who is main tank atm. if (tank != null && tank2 != null) { Character tank1Target = MemoryFunctions.GetCharacterFromID(tank.TargetID); Character tank2Target = MemoryFunctions.GetCharacterFromID(tank2.TargetID); Character highestHp = null; if (tank2Target != null) { highestHp = tank2Target; } if (tank1Target != null) { highestHp = tank1Target; } if (tank2Target != null && highestHp != null) { if (tank2Target.Health_Max > highestHp.Health_Max) highestHp = tank2Target; } if (highestHp != null) { Character monstersTarget = MemoryFunctions.GetCharacterFromID(highestHp.TargetID); if (monstersTarget != null) if (monstersTarget.Name == tank2.Name) { Character ph = tank; tank = tank2; tank2 = ph; } } } if (tank != null) this.Title = "Main Tank: " + tank.Name; if (CheckTankHealth(tank, deadTargets, recast, damagedTargets)) return; if (CheckTankHealth(tank2, deadTargets, recast, damagedTargets)) return; } if (_user.IsMoving || MemoryFunctions.GetGroundCursor() > 0) { if (_spellCastTimer != null) { _spellCastTimer.Stop(); _spellCastTimer = null; } _spellCast = false; if (tank != null) { if (tank.ContainsStatusEffect(158, _user.ID, true, (float) 2.5) == false && _hotkeys[REGEN].PercentReady == 100 && tank.Health_Percent != 100) { tank.Target(); _hotkeys[REGEN].UseAbility(); return; } } if (damagedTargets.Count > 0) { damagedTargets.Sort((a, b) => a.Health_Percent.CompareTo(b.Health_Percent)); damagedTargets.First().Target(); } return; } double avgMissingHealth = 0; if(damagedTargets.Count > 0) avgMissingHealth = damagedTargets.Average(a => (a.Health_Max - a.Health_Current)); if ((chk_SwiftcastRaise.IsChecked == true || chk_SwiftcastRaiseAll.IsChecked == true) && deadTargets.Count > 0 && _hotkeys[SWIFTCAST].PercentReady == 100 && recast.WeaponSpecials.Count == 0 && _user.Mana_Current >= 798) { deadTargets.First().Target(); Thread.Sleep(150); if (ForceSwiftcast()) return; Thread.Sleep(150); _hotkeys[RAISE].UseAbility(); _hotkeys[RAISE].UseAbility(); _hotkeys[RAISE].UseAbility(); Thread.Sleep(50); _hotkeys[RAISE].UseAbility(); Thread.Sleep(150); } else if (damagedTargets.Count > 0) { damagedTargets.Sort((a,b) => a.Health_Percent.CompareTo(b.Health_Percent)); damagedTargets.First().Target(); Thread.Sleep(100); recast.Refresh(); // Benediction Check if(chk_TankPriority.IsChecked == false) { if (damagedTargets.First().Health_Percent <= 30 && _hotkeys[BENEDICTION].PercentReady == 100) { _hotkeys[BENEDICTION].UseAbility(); _spellCastTimer = new Stopwatch(); _spellCastTimer.Reset(); _spellCastTimer.Start(); _spellCast = true; return; } } if (recast.WeaponSpecials.Count == 0) { if (_spellCast) { _spellCastTimer = new Stopwatch(); _spellCastTimer.Reset(); _spellCastTimer.Start(); _spellCast = false; } // Make sure we are not spamming spells too quickly. if (_spellCastTimer != null) { if (_spellCastTimer.ElapsedMilliseconds <= _castWaitTime) { return; } _spellCastTimer.Stop(); _spellCastTimer = null; } recast.Refresh(); Stopwatch timeout = new Stopwatch(); timeout.Reset(); timeout.Start(); //Debug.Print("Casting..."); bool useAoe = _hotkeys[MEDICA].TimeSinceLastUse.TotalSeconds > 6 && _hotkeys[MEDICA2].TimeSinceLastUse.TotalSeconds > 6 && _hotkeys[CURE3].TimeSinceLastUse.TotalSeconds > 6; while (recast.WeaponSpecials.Count == 0) { UIWindow ui = new UIWindow(); ui.RefreshPointers(); if (ui.GetActiveWindowName() == "chatlog") return; if(timeout.ElapsedMilliseconds > 1000) { _spellCast = false; break; } Whm_AI(hurtPlayers, damagedTargets, cure2Potency, useAoe); recast.Refresh(); _hotkeys.QuickRefreshAbilities(); _spellCast = true; } } else { if (damagedTargets.Count > 2 && avgMissingHealth > curePotency) { if (_hotkeys[PRESENCEOFMIND].PercentReady == 100 && _user.ContainsStatusEffect(159, 0, false) == false) { _hotkeys[PRESENCEOFMIND].UseAbility(); } else if (_hotkeys[DIVINESEAL].PercentReady == 100 && _user.ContainsStatusEffect(157, 0, false) == false) { _hotkeys[DIVINESEAL].UseAbility(); } } } } else if (statusAilment != null) { statusAilment.Target(); _hotkeys[ESUNA].UseAbility(); } }
private bool ForceSwiftcast() { Stopwatch timeout = new Stopwatch(); timeout.Reset(); timeout.Start(); while (_hotkeys[SWIFTCAST].PercentReady == 100) { UIWindow ui = new UIWindow(); ui.RefreshPointers(); if (ui.GetActiveWindowName() == "chatlog") return false; if (timeout.ElapsedMilliseconds > 5000) { break; } _hotkeys[SWIFTCAST].UseAbility(); _hotkeys.QuickRefreshAbilities(); } return false; }
private void thread_TargetMonitor_Tick(object sender, EventArgs e) { UIWindow ui = new UIWindow(); ui.RefreshPointers(); if (ui.GetActiveWindowName() == "chatlog") return; if (chk_CureAll.IsChecked == true){ RefreshAllPlayers(); } else { if(_user.Job == JOB.WHM) WhmCureMode(); else ScholarCureMode(); } }
public override void Fight(Character user, Character monster, Recast recast) { base.Fight(user, monster, recast); bool ignoreDOT = false; Hotkeys hotkeys = new Hotkeys(); hotkeys.RefreshAbilities(); if (hotkeys[STRAIGHTSHOT].InRange == 0) return; UIWindow ui = new UIWindow(); ui.RefreshPointers(); // if (ui.GetActiveWindowName() == "chatlog") // return; monster.Target(); recast.Refresh(2.1); user.Refresh(); if (user.ContainsStatusEffect2(451, (float) 3.5)) { Debug.Print("Cursed Voice"); SoundModule.PlayAsyncSound("cursedVoice.wav"); while (user.ContainsStatusEffect(451, 0, false)) { Thread.Sleep(100); } Thread.Sleep(200); user.Refresh(); } if (monster.Name.ToLower().Contains("renaud")) return; // Stop for turn 6 ability if (monster.UsingAbilityID == 1949) { //Utilities.Keyboard.KeyBoardHelper.Ctrl(Keys.D6); return; } List<Character> nearMobs = monster.MonstersNear(100.0); // Blight Turn 6 if (nearMobs.Any(mob => mob.UsingAbilityID == 1949)) { //Utilities.Keyboard.KeyBoardHelper.Ctrl(Keys.D6); return; } // Turn 7 Petrification if (nearMobs.Any(mob => mob.UsingAbilityID == 1979)) { SoundModule.PlayAsyncSound("petrification.wav"); //Utilities.Keyboard.KeyBoardHelper.Ctrl(Keys.D6); return; } if (nearMobs.Any(mob => mob.UsingAbilityID == 1969)) { SoundModule.PlayAsyncSound("petrification.wav"); //Utilities.Keyboard.KeyBoardHelper.Ctrl(Keys.D6); return; } if (user.ContainsStatusEffect(452, 0, false)) { SoundModule.PlayAsyncSound("Shriek.wav"); } //if (nearMobs.Any(mob => mob.UsingAbilityID == 1967)) //{ // if (user.ContainsStatusEffect(452, 0, false)) // { // SoundModule.PlayAsyncSound("Shriek.wav"); // } // else // { // SoundModule.PlayAsyncSound("Shriek2.wav"); // } //} if (MemoryFunctions.GetGroundCursor() > 0) return; foreach (string mobToIgnore in _ignoreDOTMobs) { if (monster.Name.ToLower().Contains(mobToIgnore.ToLower()) && monster.Name.ToLower().Contains("gaoler") == false) { ignoreDOT = true; } } if (MemoryFunctions.GetMapID() == 364 && monster.Name.Contains("Good King") == false) ignoreDOT = true; if (hotkeys[INTERNALRELEASE].PercentReady >= 99 && user.Level >= 26 && Global.DisableBuffs == false && user.TP_Current >= 40 && hotkeys[HEAVYSHOT].PercentReady <= 78) { //MemoryFunctions.ForceAction(INTERNALRELEASE, 21, MemoryFunctions.ActionType.Ability); hotkeys[INTERNALRELEASE].UseAbility(); } else if (recast.WeaponSpecials.Count == 0) { if ((user.ContainsStatusEffect(130, 0, false, (float) 3.0) == false || user.ContainsStatusEffect(122, 0, false)) && user.Level >= 2 && user.TP_Current >= 70) { //MemoryFunctions.ForceAction(STRAIGHTSHOT, 20, MemoryFunctions.ActionType.WS); hotkeys[STRAIGHTSHOT].UseAbility(); } else if (monster.ContainsStatusEffect(124, user.ID, true, (float) 2.5) == false && user.Level >= 6 && user.TP_Current >= 100 && ignoreDOT == false && monster.StatusEffects().Count < 29) { //MemoryFunctions.ForceAction(VENOMOUSBITE, 20, MemoryFunctions.ActionType.WS); hotkeys[VENOMOUSBITE].UseAbility(); } else if (monster.ContainsStatusEffect(129, user.ID, true, (float) 2.5) == false && user.Level >= 30 && user.TP_Current >= 100 && monster.StatusEffects().Count < 29 && (ignoreDOT == false || monster.Name.ToLower().Contains("infernal nail"))) { //MemoryFunctions.ForceAction(WINDBITE, 20, MemoryFunctions.ActionType.WS); hotkeys[WINDBITE].UseAbility(); } else if (hotkeys[HAYMAKER].Highlighted && user.Level >= 10 && user.TP_Current >= 40) { //MemoryFunctions.ForceAction(HAYMAKER, 20, MemoryFunctions.ActionType.WS); hotkeys[HAYMAKER].UseAbility(); } else if (user.TP_Current >= 60) { //MemoryFunctions.ForceAction(HEAVYSHOT, 20, MemoryFunctions.ActionType.WS); hotkeys[HEAVYSHOT].UseAbility(); } } else if (hotkeys[INVIGORATE].PercentReady >= 100 && user.Level >= 4 && user.TP_Current <= 550 && hotkeys[HEAVYSHOT].PercentReady <= 78) { //MemoryFunctions.ForceAction(INVIGORATE, 20, MemoryFunctions.ActionType.Ability); hotkeys[INVIGORATE].UseAbility(); } else if (hotkeys[RAGINGSTRIKES].PercentReady >= 100 && user.Level >= 4 && Global.DisableBuffs == false && hotkeys[HEAVYSHOT].PercentReady <= 78) { //MemoryFunctions.ForceAction(RAGINGSTRIKES, 19, MemoryFunctions.ActionType.Ability); hotkeys[RAGINGSTRIKES].UseAbility(); } else if (hotkeys[BLOODFORBLOOD].PercentReady >= 100 && user.Level >= 38 && monster.Name.Contains("Twintania") == false && monster.Name.Contains("Conflagration") == false && Global.DisableBuffs == false && hotkeys[HEAVYSHOT].PercentReady <= 78) // && user.ContainsStatusEffect(125, 0, false) == false { //MemoryFunctions.ForceAction(BLOODFORBLOOD, 20, MemoryFunctions.ActionType.Ability); hotkeys[BLOODFORBLOOD].UseAbility(); } else if ( hotkeys[BLOODFORBLOOD].PercentReady >= 100 && user.Level >= 38 && monster.Name.Contains("Twintania") && monster.Health_Percent <= 55 && Global.DisableBuffs == false && hotkeys[HEAVYSHOT].PercentReady <= 78) // && user.ContainsStatusEffect(125, 0, false) == false { //MemoryFunctions.ForceAction(BLOODFORBLOOD, 20, MemoryFunctions.ActionType.Ability); hotkeys[BLOODFORBLOOD].UseAbility(); } else if (hotkeys[HAWKSEYE].PercentReady >= 100 && user.Level >= 26 && Global.DisableBuffs == false && hotkeys[HEAVYSHOT].PercentReady <= 78) { //MemoryFunctions.ForceAction(HAWKSEYE, 15, MemoryFunctions.ActionType.Ability); hotkeys[HAWKSEYE].UseAbility(); } else if (hotkeys[BARRAGE].PercentReady >= 100 && user.Level >= 38 && monster.Name.Contains("Twintania") == false && monster.Name.Contains("Conflagration") == false && Global.DisableBuffs == false && hotkeys[HEAVYSHOT].PercentReady <= 78) { //MemoryFunctions.ForceAction(BARRAGE, 12, MemoryFunctions.ActionType.Ability); hotkeys[BARRAGE].UseAbility(); } else if (hotkeys[BARRAGE].PercentReady >= 100 && user.Level >= 38 && monster.Name.Contains("Twintania") && monster.Health_Percent <= 55 && Global.DisableBuffs == false && hotkeys[HEAVYSHOT].PercentReady <= 78) { //MemoryFunctions.ForceAction(BARRAGE, 12, MemoryFunctions.ActionType.Ability); hotkeys[BARRAGE].UseAbility(); } else if (hotkeys[BLOODLETTER].PercentReady >= 99 && user.Level >= 12 && hotkeys[HEAVYSHOT].PercentReady <= 78) { //MemoryFunctions.ForceAction(BLOODLETTER, 16, MemoryFunctions.ActionType.Ability); hotkeys[BLOODLETTER].UseAbility(); } else if (monster.Health_Percent <= 20 && hotkeys[MISERYSEND].PercentReady >= 99 && user.Level >= 8 && hotkeys[HEAVYSHOT].PercentReady <= 78) { //MemoryFunctions.ForceAction(MISERYSEND, 16, MemoryFunctions.ActionType.Ability); hotkeys[MISERYSEND].UseAbility(); } else if ( hotkeys[BLUNTARROW].PercentReady >= 99 && user.Level >= 42 && Global.StunBotOpen == false && hotkeys[HEAVYSHOT].PercentReady <= 78) { //MemoryFunctions.ForceAction(BLUNTARROW, 16, MemoryFunctions.ActionType.Ability); hotkeys[BLUNTARROW].UseAbility(); } }