protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(ret => (Counter > 0 && !FireUntilFinished) || (Me.QuestLog.GetQuestById((uint)QuestId) != null && Me.QuestLog.GetQuestById((uint)QuestId).IsCompleted), new Sequence( new Action(ret => TreeRoot.StatusText = "Finished!"), new WaitContinue(120, new Action(delegate { _isBehaviorDone = true; return RunStatus.Success; })) )), new Decorator(ret => !_isInitialized && VehicleType == 2, new Action(ret => ParsePaths())), new Decorator(c => !InVehicle && NpcVehicleList.Count == 0, new Action(c => { Navigator.MoveTo(StartPoint); TreeRoot.StatusText = "Moving To Vehicle Location - " + " Yards Away: " + StartPoint.Distance(Me.Location); return RunStatus.Success; }) ), new Decorator(c => !InVehicle && NpcVehicleList.Count > 0, new Action(c => { if (!NpcVehicleList[0].WithinInteractRange) { Navigator.MoveTo(NpcVehicleList[0].Location); TreeRoot.StatusText = "Moving To Vehicle - " + NpcVehicleList[0].Name + " Yards Away: " + NpcVehicleList[0].Location.Distance(Me.Location); } else { Flightor.MountHelper.Dismount(); NpcVehicleList[0].Interact(); PreviousLocation = Me.Location; } return RunStatus.Success; }) ), new Decorator(c => InVehicle && VehicleType == 0, new Action(c => { if (_vehicle == null) { _vehicle = VehicleList[0]; } if (_vehicle.Location.Distance(FirePoint) <= 5) { TreeRoot.StatusText = "Firing Vehicle - " + _vehicle.Name + " Using Spell Index: " + AttackButton + " Height: " + FireHeight; WoWMovement.ClickToMove(TargetPoint); Thread.Sleep(500); WoWMovement.MoveStop(); using (new FrameLock()) { Lua.DoString("VehicleAimRequestNormAngle(0.{0})", FireHeight); Lua.DoString("CastPetAction({0})", AttackButton); Counter++; return RunStatus.Success; } } if (_vehicle.Location.Distance(FirePoint) > 5) { TreeRoot.StatusText = "Moving To FireLocation - Yards Away: " + FirePoint.Distance(_vehicle.Location); WoWMovement.ClickToMove(MoveToLocation); _vehicle.Target(); } return RunStatus.Success; })), new Decorator(c => InVehicle && VehicleType == 1, new Action(c => { if (_vehicle == null) { _vehicle = VehicleList[0]; } if (NpcAttackList.Count > 1) { TreeRoot.StatusText = "Moving to Assult - " + NpcAttackList[0].Name + " Using Spell Index: " + AttackButton; if (_vehicle.Location.Distance(NpcAttackList[0].Location) > 20) { WoWMovement.ClickToMove(NpcAttackList[0].Location); if (Me.CurrentTarget != NpcAttackList[0]) { NpcAttackList[0].Target(); } return RunStatus.Success; } Lua.DoString("VehicleAimRequestNormAngle(0.{0})", FireHeight); Lua.DoString("CastPetAction({0})", AttackButton); Counter++; Thread.Sleep(1000); return RunStatus.Success; } if (_vehicle.Location.Distance(StartObjectivePoint) > 5) { TreeRoot.StatusText = "Moving To Start Location - Yards Away: " + StartObjectivePoint.Distance(Me.Location); bool testfly = StyxWoW.Me.MovementInfo.CanFly; Logging.Write("" + testfly); Flightor.MoveTo(StartObjectivePoint); // WoWMovement.ClickToMove(StartObjectivePoint); _vehicle.Target(); } return RunStatus.Success; })), new Decorator(c => InVehicle && VehicleType == 2, new Action(c => { if (_vehicle == null && VehicleList[0] != null) { _vehicle = VehicleList[0]; } if ((Counter > 0 && !FireUntilFinished) || (Me.QuestLog.GetQuestById((uint)QuestId) != null && Me.QuestLog.GetQuestById((uint)QuestId).IsCompleted)) { if (EndPoint.Distance(Me.Location) > 20) { Flightor.MoveTo(EndPoint); //return RunStatus.Running; } return RunStatus.Success; } if (PathCircle.Count == 0) { //Counter++; ParsePaths(); // return RunStatus.Running; } if (PathCircle.Peek().Distance(Me.Location) > 5) { Flightor.MoveTo(PathCircle.Peek()); // return RunStatus.Running; } WoWMovement.MoveStop(); Thread.Sleep(400); if (NpcAttackList[0] != null) { WoWMovement.ClickToMove(NpcAttackList[0].Location); } WoWMovement.MoveStop(); Thread.Sleep(400); Lua.DoString("CastPetAction({0})", AttackButton); WoWMovement.MoveStop(); PathCircle.Dequeue(); return RunStatus.Success; })) ))); }
private async Task <bool> TypeOneVehicleBehavior() { while (Me.IsAlive) { if (_vehicle == null || !_vehicle.IsValid) { _vehicle = VehicleList.FirstOrDefault(); } if (NpcAttackList.Count > 1) { TreeRoot.StatusText = "Moving to Assault - " + NpcAttackList[0].SafeName + " Using Spell Index: " + AttackButton; if (_vehicle.Location.Distance(NpcAttackList[0].Location) > 20) { var testfly = Flightor.CanFly; if (testfly) { Flightor.MoveTo(NpcAttackList[0].Location); } else { TreeRoot.StatusText = "CAUTION - USING CTM!!!"; WoWMovement.ClickToMove(NpcAttackList[0].Location); } if (Me.CurrentTarget != NpcAttackList[0]) { NpcAttackList[0].Target(); } return(true); } Lua.DoString("VehicleAimRequestNormAngle(0.{0})", FireHeight); Lua.DoString("CastPetAction({0})", AttackButton); Counter++; await Coroutine.Sleep(1000); return(true); } if (_vehicle.Location.Distance(StartObjectivePoint) > 5) { TreeRoot.StatusText = "Moving To Start Location - Yards Away: " + StartObjectivePoint.Distance(Me.Location); var testfly = Flightor.CanFly; if (testfly) { Flightor.MoveTo(StartObjectivePoint); } else { TreeRoot.StatusText = "CAUTION - USING CTM!!!"; WoWMovement.ClickToMove(StartObjectivePoint); } if (StyxWoW.Me.CurrentTarget != _vehicle) { _vehicle.Target(); } } await Coroutine.Yield(); } return(false); }