/* * ConsiderAvoidAdds - Avoid Adds */ internal void ConsiderAvoidAdds(PUnit target) { bool petattacking = false; List <PUnit> closeUnits = ObjectManager.CheckForMobsAtLoc(target.Location, PveBehaviorSettings.SkipAddsDis + 5, false); if (closeUnits.Count == 0) { return; } PUnit closestAdd = GetClosestBesides(closeUnits, target); if (closestAdd == null) { return; } if (closestAdd.GUID == target.GUID) { return; } // Somebody is close enough to maybe jump in. If the monster is in front of us and close // enough, might be time to back it up. if (closestAdd.DistanceToSelf < Avoidaddsdistance) { Logging.Write("Possible add: " + closestAdd.Name + ": " + closestAdd.DistanceToSelf); _addBackup.Reset(); var futility = new Ticker(3000); closestAdd.Face(); MoveHelper.Backwards(true); if (ObjectManager.MyPlayer.HasLivePet) { petattacking = ObjectManager.MyPlayer.Pet.Target.IsValid; PetFollow.SendKey(); } while (!futility.IsReady) { Thread.Sleep(10); closestAdd.Face(); if (closestAdd.DistanceToSelf > Avoidaddsdistance + 6.0) // Slack space. { break; } } MoveHelper.Backwards(false); if (ObjectManager.MyPlayer.HasLivePet && petattacking) { PetAttackKey.SendKey(); } _addBackup.Reset(); } }
public override PullResult Pull(PUnit target) { //Logging.Debug("Pull started"); Buff(); PrePull(target); if (Behavior.UseAutoAttack) { target.InteractWithTarget(); } if (!MoveHelper.MoveToUnit(target, Behavior.PullDistance)) { return(PullResult.CouldNotPull); } if (Behavior.SendPet) { PetAttackKey.SendKey(); } foreach (Rule rule in Behavior.PullController.GetRules.Where(rule => rule.IsOk)) { target.Face(); rule.ExecuteAction(Behavior.GlobalCooldown); } // Logging.Debug("Pull done"); if (PPullBlackList.IsBlacklisted(target)) { return(PullResult.CouldNotPull); } return(PullResult.Success); }
public override void Combat(PUnit target) { if (Behavior.UseAutoAttack) { target.InteractWithTarget(); } if (Behavior.SendPet) { PetAttackKey.SendKey(); } //Logging.Debug("Combat started"); while (true) { try { if (target.DistanceToSelf > Behavior.CombatDistance) { MoveHelper.MoveToUnit(target, Behavior.CombatDistance); } } catch { } if (!ObjectManager.MyPlayer.IsValid || ObjectManager.MyPlayer.Target != target) { target.TargetHostile(); } if (PveBehaviorSettings.AvoidAddsCombat) { ConsiderAvoidAdds(target); } foreach (Rule rule in Behavior.CombatController.GetRules.Where(rule => rule.IsOk)) { if (target.IsValid && target.IsAlive) { if (!target.Location.IsFacing()) { target.Face(); } rule.ExecuteAction(Behavior.GlobalCooldown); break; } } Thread.Sleep(10); Application.DoEvents(); } }
private static void TrySpiritRess() { PUnit spirit = FindSpiritHealer(); if (spirit == null) { Thread.Sleep(8000); spirit = FindSpiritHealer(); if (spirit == null) { LazyHelpers.StopAll("Could not find spirit healer"); } } ApproachPosFlying.Approach(spirit.Location, 15); spirit.Face(); DoSpiritRess(spirit); }
/// <summary> /// Moves to the unit. /// </summary> /// <param name = "targetObject">The unit to approach.</param> /// <param name = "distance">The distance.</param> /// <returns>Returns true on sucess</returns> public static bool MoveToUnit(PUnit targetObject, double distance) { //Start by facing Location oldPos = ObjectManager.MyPlayer.Location; Forwards(false); var timer = new Ticker(1000 * 1.1); var timerWaypoint = new Ticker(1000 * 16); int stuck = 0; while (targetObject.DistanceToSelf > distance && !timerWaypoint.IsReady) { targetObject.Face(); Forwards(true); if (ObjectManager.MyPlayer.Location.GetDistanceTo(oldPos) > 1) { oldPos = ObjectManager.MyPlayer.Location; timer.Reset(); } Forwards(true); if (ObjectManager.MyPlayer.Location.GetDistanceTo(oldPos) < 1 && timer.IsReady) { if (stuck > 3) { return(false); } Logging.Write("[Move]I am stuck " + stuck); switch (stuck) { case 0: Forwards(false); Forwards(true); Thread.Sleep(50); Jump(); Thread.Sleep(800); break; case 1: Forwards(false); Forwards(true); StrafeLeft(true); Thread.Sleep(800); break; case 2: Forwards(false); Forwards(true); StrafeLeft(true); Thread.Sleep(800); break; case 3: Forwards(false); Forwards(true); StrafeRight(true); Thread.Sleep(800); break; } Thread.Sleep(200); stuck++; ReleaseKeys(); Thread.Sleep(500); timer.Reset(); } Thread.Sleep(10); } if (timerWaypoint.IsReady && targetObject.DistanceToSelf > distance) { Logging.Write("Approach: " + targetObject.Name + " failed"); Forwards(false); return(false); } Forwards(false); ReleaseKeys(); targetObject.Face(); return(true); }
private static void CombatThread() { try { Logging.Write("Started combat engine"); if (ObjectManager.MyPlayer.IsMounted && !ObjectManager.MyPlayer.TravelForm) { KeyHelper.SendKey("GMount"); } MoveHelper.ReleaseKeys(); if (DefendAgainst() == null) { Logging.Write("Pulling: " + Unit.Name + " " + Unit.GUID); MoveHelper.MoveToUnit(Unit, 30); if (!Unit.TargetHostile()) { if (ObjectManager.GetAttackers.Count == 0) { PPullBlackList.Blacklist(Unit, 800, true); } } Unit.Face(); MoveHelper.ReleaseKeys(); PullResult result = Pull(); Logging.Write("Pull result: " + result); if (result.Equals(PullResult.CouldNotPull)) { PPullBlackList.Blacklist(Unit, 800, true); return; } if (PPullBlackList.IsBlacklisted(Unit)) { return; } } else { Logging.Write("Got into combat with: " + Unit.Name); Unit.TargetHostile(); Unit.Face(); } Ticker combatTimeout; if (ObjectManager.MyPlayer.Level > 10) { combatTimeout = new Ticker(20 * 1000); } else { combatTimeout = new Ticker(40 * 1000); } while (!Unit.IsDead) { _combatLoopThread = new Thread(DoCombat) { IsBackground = true }; _combatLoopThread.Name = "DoCombat"; _combatLoopThread.SetApartmentState(ApartmentState.STA); _combatLoopThread.Start(); while (_combatLoopThread.IsAlive) { Thread.Sleep(50); if (!Langs.TrainingDummy(Unit.Name) && combatTimeout.IsReady && Unit.Health > 85) { Logging.Write("Combat took to long, bugged - blacklisting"); _combatResult = CombatResult.Bugged; if (!PBlackList.IsBlacklisted(Unit)) { PBlackList.Blacklist(Unit, 1200, false); } return; } } } } catch { } }
private void AZRUN() { BarMapper.MapBars(); KeyHelper.LoadKeys(); string BossName = "看门者克里克希尔"; List <string> EmName = new List <string>(); EmName.Add("看守者纳尔伊"); EmName.Add("看守者加什拉"); EmName.Add("看守者希尔希克"); List <int> MyBadBuff = new List <int>(); MyBadBuff.Add(52087); // 蛛网裹体 MyBadBuff.Add(52086); // 蛛网裹体 while (ObjectManager.MyPlayer.IsAlive) { // 循环开始 PUnit boss = new PUnit(0); Dictionary <string, PUnit> em = new Dictionary <string, PUnit>(); // 加buff if (!ObjectManager.MyPlayer.HasBuff("钢皮合剂")) { KeyHelper.SendLuaOverChat("/use 钢皮合剂"); } if (!ObjectManager.MyPlayer.HasBuff("坚韧")) { KeyHelper.SendLuaOverChat("/use 坚韧符文卷轴 II"); } // 找到怪的地址 int FoundCount = 0; em.Clear(); foreach (PUnit uu in ObjectManager.GetUnits) { if (uu.Name.Equals(BossName)) { boss = uu; FoundCount++; continue; } foreach (string ename in EmName) { if (uu.Name.Equals(ename)) { em.Add(ename, uu); FoundCount++; continue; } } } if (FoundCount < 4) { Logging.Write("找不到怪了"); return; } // 面对boss boss.Face(); // 开机能 if (!ObjectManager.MyPlayer.HasBuff("野性印记")) { BarMapper.CastSpell("野性印记"); } if (!ObjectManager.MyPlayer.HasBuff("猎豹形态")) { BarMapper.CastSpell("猎豹形态"); } Thread.Sleep(1000); // 定位一个 int killcount = 0; foreach (string ename in EmName) { PUnit emUnit = em[ename]; while (!emUnit.TargetGUID.Equals(ObjectManager.MyPlayer.GUID)) { KeyHelper.SendLuaOverChat("/target " + ename); BarMapper.CastSpell("精灵之火(野性)"); Thread.Sleep(100); } //Thread.Sleep(500); // 猛虎之怒 if (BarMapper.IsSpellReadyByName("猛虎之怒")) { BarMapper.CastSpell("猛虎之怒"); Thread.Sleep(10); } // 树皮术 if (BarMapper.IsSpellReadyByName("树皮术")) { BarMapper.CastSpell("树皮术"); Thread.Sleep(10); } // 等待怪过来 while (emUnit.Location.DistanceToSelf2D > 5) { if (killcount > 0) { BarMapper.CastSpell("横扫"); } } ; emUnit.Location.Face(); // 杀,直到怪死 int count = 0; Logging.Write("血量:" + emUnit.Health + " 怪物名称:" + emUnit.Name + " 是死是活:" + emUnit.IsAlive); int UHealth = 0; UHealth = emUnit.Health; while (UHealth == -1) { UHealth = emUnit.Health; } while (UHealth > 0) { Thread.Sleep(10); if (!ObjectManager.MyPlayer.IsCasting) { //调整朝向 if (!emUnit.Location.IsFacing(0.3f)) { emUnit.Location.Face(); } //Logging.Write("Count is " + count.ToString()); // 检查自己的buff while (ObjectManager.MyPlayer.HasBuff(MyBadBuff)) { } ; // 猛虎之怒 if (BarMapper.IsSpellReadyByName("猛虎之怒")) { BarMapper.CastSpell("猛虎之怒"); Thread.Sleep(10); } // 树皮术 if (BarMapper.IsSpellReadyByName("树皮术")) { BarMapper.CastSpell("树皮术"); Thread.Sleep(10); } // 凶猛撕咬--终结技 //if (count == 4 && BarMapper.IsSpellReadyByName("凶猛撕咬")) if (count > 4) { //BarMapper.CastSpell("凶猛撕咬"); KeyLowHelper.PressKey(MicrosoftVirtualKeys.LeftShift); KeyLowHelper.PressKey(MicrosoftVirtualKeys.key1); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.key1); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.LeftShift); Thread.Sleep(10); KeyLowHelper.PressKey(MicrosoftVirtualKeys.key3); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.key3); //Thread.Sleep(10); count = 0; } //// 裂伤 //if (BarMapper.IsSpellReadyByName("裂伤") && !emUnit.HasBuff("裂伤")) //{ // BarMapper.CastSpell("裂伤"); // Thread.Sleep(10); // count++; //} // 斜掠 if (BarMapper.IsSpellReadyByName("裂伤")) { //BarMapper.CastSpell("裂伤"); KeyLowHelper.PressKey(MicrosoftVirtualKeys.LeftShift); KeyLowHelper.PressKey(MicrosoftVirtualKeys.key1); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.key1); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.LeftShift); Thread.Sleep(10); KeyLowHelper.PressKey(MicrosoftVirtualKeys.key2); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.key2); count++; //Thread.Sleep(10); } Logging.Write("血量:" + emUnit.Health); } UHealth = emUnit.Health; while (UHealth == -1) { UHealth = emUnit.Health; if (UHealth == 0) { int HealthTry1 = emUnit.Health; int HealthTry2 = emUnit.Health; UHealth = (HealthTry1 >= HealthTry2 ? HealthTry1 : HealthTry2); } } if (ObjectManager.MyPlayer.IsDead) { return; } } killcount++; } while (ObjectManager.MyPlayer.HasBuff(MyBadBuff)) { } ; // 一直横扫,直到全死 //while (true) //{ // if (!ObjectManager.MyPlayer.HasBuff(MyBadBuff)) // { // if (BarMapper.IsSpellReadyByName("生存本能")) { BarMapper.CastSpell("生存本能"); } // if (ObjectManager.MyPlayer.IsDead) return; // break; // } //} //while (true) //{ // if (!ObjectManager.MyPlayer.HasBuff(MyBadBuff)) // { // if (BarMapper.IsSpellReadyByName("狂暴")) { BarMapper.CastSpell("狂暴"); } // if (ObjectManager.MyPlayer.IsDead) return; // break; // } //} KeyLowHelper.PressKey(MicrosoftVirtualKeys.LeftShift); KeyLowHelper.PressKey(MicrosoftVirtualKeys.key1); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.key1); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.LeftShift); Thread.Sleep(10); KeyLowHelper.PressKey(MicrosoftVirtualKeys.key4); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.key4); Thread.Sleep(10); KeyLowHelper.PressKey(MicrosoftVirtualKeys.key5); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.key5); //while (BarMapper.IsSpellReadyByName("狂暴")) { BarMapper.CastSpell("狂暴"); break; } // 加点血 while (ObjectManager.MyPlayer.Health < 30) { if (!ObjectManager.MyPlayer.HasBuff(MyBadBuff)) { if (BarMapper.IsSpellReadyByName("回春术")) { BarMapper.CastSpell("回春术"); break; } if (ObjectManager.MyPlayer.IsDead) { return; } } } while (ObjectManager.MyPlayer.Health < 30) { if (!ObjectManager.MyPlayer.HasBuff(MyBadBuff)) { if (BarMapper.IsSpellReadyByName("愈合")) { BarMapper.CastSpell("愈合"); break; } if (ObjectManager.MyPlayer.IsDead) { return; } } } while (!ObjectManager.MyPlayer.HasBuff("猎豹形态")) { if (!ObjectManager.MyPlayer.HasBuff(MyBadBuff)) { if (BarMapper.IsSpellReadyByName("猎豹形态")) { BarMapper.CastSpell("猎豹形态"); break; } if (ObjectManager.MyPlayer.IsDead) { return; } } } boss.Face(); while (true) { //ObjectManager.MyPlayer.IsInCombat Thread.Sleep(100); bool TargetME = false; PUnit emO = new PUnit(0); foreach (PUnit uu in ObjectManager.GetUnits) { if (uu.IsPlayer) { continue; } if (uu.Name.Equals(boss.Name)) { continue; } if (uu.TargetGUID.Equals(ObjectManager.MyPlayer.GUID)) { TargetME = true; emO = uu; break; } } if (!TargetME) { break; } emO.Face(); KeyLowHelper.PressKey(MicrosoftVirtualKeys.LeftShift); KeyLowHelper.PressKey(MicrosoftVirtualKeys.key5); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.key5); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.LeftShift); Thread.Sleep(10); KeyLowHelper.PressKey(MicrosoftVirtualKeys.key2); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.key2); Thread.Sleep(10); KeyLowHelper.PressKey(MicrosoftVirtualKeys.key4); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.key4); Thread.Sleep(10); KeyLowHelper.PressKey(MicrosoftVirtualKeys.LeftShift); KeyLowHelper.PressKey(MicrosoftVirtualKeys.key2); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.key2); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.LeftShift); Thread.Sleep(10); KeyLowHelper.PressKey(MicrosoftVirtualKeys.key5); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.key5); Thread.Sleep(10); //BarMapper.CastSpell("猛虎之怒"); //BarMapper.CastSpell("树皮术"); //BarMapper.CastSpell("横扫"); if (ObjectManager.MyPlayer.IsDead) { return; } } // 面对boss boss.Face(); // 召唤“打架赛车” KeyHelper.SendLuaOverChat("/use 蓝色打架赛车"); BarMapper.CastSpell("蓝色打架赛车"); Thread.Sleep(1000); PUnit djsc = new PUnit(0); bool FoundDJSC = false; while (!FoundDJSC) { foreach (PUnit uu in ObjectManager.GetUnits) { if (uu.Name.Contains("打架赛车")) { djsc = uu; FoundDJSC = true; } } if (ObjectManager.MyPlayer.IsDead) { return; } } Thread.Sleep(500); // 走到boss旁边,打架赛车Y不小于646 //while (djsc.Location.DistanceFromXY(boss.Location) > 6) string ddd = Convert.ToString(djsc.Location.Y); float PosY = djsc.Location.Y; while (PosY > 648 || PosY == 0) { KeyLowHelper.PressKey(MicrosoftVirtualKeys.Up); Thread.Sleep(100); PosY = djsc.Location.Y; ddd = ddd + Convert.ToString(PosY); if (ObjectManager.MyPlayer.IsDead) { return; } } KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.Up); Logging.Write(ddd); // 一直跳,直到boss消失 while (boss.Health > 0) { KeyLowHelper.PressKey(MicrosoftVirtualKeys.Space); Thread.Sleep(10); KeyLowHelper.ReleaseKey(MicrosoftVirtualKeys.Space); Thread.Sleep(500); if (ObjectManager.MyPlayer.IsDead) { return; } } while (ObjectManager.MyPlayer.IsInCombat) { } ; // 给自己加血 KeyHelper.SendLuaOverChat("/use 黄油面包卷"); Thread.Sleep(1000); while (ObjectManager.MyPlayer.HasBuff("进食") || ObjectManager.MyPlayer.Health < 100) { } ; while (ObjectManager.MyPlayer.Health < 100 && ObjectManager.MyPlayer.ManaPoints > 5590) { // 治疗之触 if (BarMapper.IsSpellReadyByName("治疗之触")) { BarMapper.CastSpell("治疗之触"); Thread.Sleep(100); } if (ObjectManager.MyPlayer.IsDead) { return; } } // 等待一段时间,直到boss重新出现 Thread.Sleep(1000); bool FoundBoss = false; while (!FoundBoss) { foreach (PUnit uu in ObjectManager.GetUnits) { if (uu.Name.Equals(BossName)) { FoundBoss = true; } } Thread.Sleep(200); if (ObjectManager.MyPlayer.IsDead) { return; } } // 猎豹形态 //BarMapper.CastSpell("猎豹形态"); //MessageBox.Show("OK"); // 每个小号跳一次 Process[] wcc = Process.GetProcessesByName("Wow"); foreach (Process proc in wcc) { KeyLowHelper.PressKey(proc.MainWindowHandle, MicrosoftVirtualKeys.Space); Thread.Sleep(10); KeyLowHelper.ReleaseKey(proc.MainWindowHandle, MicrosoftVirtualKeys.Space); Thread.Sleep(100); } while (ObjectManager.MyPlayer.Health < 100) { while (BarMapper.IsSpellReadyByName("生命之血")) { BarMapper.CastSpell("生命之血"); break; } if (ObjectManager.MyPlayer.ManaPoints > 5590) { // 治疗之触 if (BarMapper.IsSpellReadyByName("治疗之触")) { BarMapper.CastSpell("治疗之触"); Thread.Sleep(100); } } if (ObjectManager.MyPlayer.IsDead) { return; } } } }