protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(ret => Counter > 0, new Sequence( new Action(ret => TreeRoot.StatusText = "Finished!"), new WaitContinue(120, new Action(delegate { _isDone = true; return RunStatus.Success; })) )), new Decorator(ret => !MovedToTarget, new Sequence( new Decorator(ret => !me.IsIndoors && !me.Mounted && me.Level > 19, new Sequence( new Action(ret => TreeRoot.StatusText = "Mounting!"), new Action(ret => Styx.Logic.Mount.MountUp()) ) ), new DecoratorContinue(ret => Location.Distance(me.Location) <= 3, new Sequence( new Action(ret => TreeRoot.StatusText = "At Location, Waiting for Transport - " + ObjectID), new Action(ret => WoWMovement.MoveStop()), new Action(ret => MovedToTarget = true) ) ), new DecoratorContinue(ret => Location.Distance(me.Location) > 3, new Sequence( new Action(ret => TreeRoot.StatusText = "Moving To Location - X:" + Location.X + " Y: " + Location.Y + " Z: " + Location.Z), new Action(ret => Navigator.MoveTo(Location)), new Action(ret => Thread.Sleep(50)) )) )), new Decorator(ret => MovedToTarget && !MovedOnShip, new Sequence( new DecoratorContinue(ret => objectList.Count > 0, new Sequence( new DecoratorContinue(ret => transportLocation.Distance(me.Location) < 20, new Sequence( new Action(ret => TreeRoot.StatusText = "Transport is here, Moving onto"), new Action(ret => Thread.Sleep(3000)), new Action(ret => WoWMovement.ClickToMove(GetOnLocation)), new Action(ret => Thread.Sleep(500)), new Action(ret => OnShip = true) ) ), new DecoratorContinue(ret => (OnShip && ShipStandLocation.X > 0) && ShipStandLocation.Distance(me.Location) > 3, new Sequence( new Action(ret => TreeRoot.StatusText = "Moving To Stand Point"), new Action(ret => WoWMovement.ClickToMove(ShipStandLocation)), new Action(ret => Thread.Sleep(300)), new Action(ret => TreeRoot.StatusText = "Waiting On Transport To Reach Location"), new Action(ret => MovedOnShip = true) ) ), new DecoratorContinue(ret => OnShip && ShipStandLocation.X == 0, new Sequence( new Action(ret => TreeRoot.StatusText = "Waiting On Transport To Reach Location"), new Action(ret => MovedOnShip = true) )) )), new DecoratorContinue(ret => objectList.Count == 0, new Sequence( new Action(ret => TreeRoot.StatusText = "Waiting for Transport"), new Action(ret => Thread.Sleep(100)) )) )), new Decorator(ret => MovedOnShip, new Sequence( new DecoratorContinue(ret => transportLocation.Distance(EndLocation) <= 3, new Sequence( new DecoratorContinue(ret => GetOffLocation.Distance(me.Location) <= 3, new Sequence( new Action(ret => TreeRoot.StatusText = "At End Location"), new Action(ret => Counter++) ) ), new DecoratorContinue(ret => GetOffLocation.Distance(me.Location) > 3, new Sequence( new Action(ret => TreeRoot.StatusText = "Moving off Ship"), new Action(ret => WoWMovement.ClickToMove(GetOffLocation)), new Action(ret => Thread.Sleep(300)) )) )) )) ))); }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(ret => Counter >= 1, new Action(ret => _isDone = true)), new PrioritySelector( new Decorator(ret => !MovedToTarget, new Action(delegate { // using Styx.Logic.BehaviorTree; TreeRoot.GoalText = "Ship Behavior: Running"; TreeRoot.StatusText = "Moving To Dock"; if (DockLocation.Distance(me.Location) > 3) { Navigator.MoveTo(DockLocation); } else { MovedToTarget = true; return RunStatus.Success; } return RunStatus.Running; }) ), new Decorator(ret => MovedToTarget, new Action(delegate { objectList = ObjectManager.GetObjectsOfType <WoWGameObject>() .Where(u => u.Entry == ObjectID) .OrderBy(u => u.Distance).ToList(); TreeRoot.StatusText = "Waiting For Ship"; foreach (WoWGameObject value in objectList) { Tripper.Tools.Math.Matrix m = value.GetWorldMatrix(); WoWPoint matrixLocation = new WoWPoint(m.M41, m.M42, m.M43); //Logging.Write("" + matrixLocation.X + " " + matrixLocation.Y + " " + matrixLocation.Z); if (GetOffLocation.Distance(me.Location) < 3) { _isDone = true; return RunStatus.Success; } if (matrixLocation.Distance(me.Location) < 20 && !MovedOnShip) { TreeRoot.StatusText = "Moving Onto Ship"; Thread.Sleep(3000); WoWMovement.ClickToMove(GetOnLocation); MovedOnShip = true; } else if (MovedOnShip) { TreeRoot.StatusText = "On Ship, Waiting"; if (ShipStandLocation.X > 0) { WoWMovement.ClickToMove(ShipStandLocation); } if (matrixLocation.Distance(EndLocation) < 20) { TreeRoot.StatusText = "Moving Off Ship"; Thread.Sleep(3000); WoWMovement.ClickToMove(GetOffLocation); MovedOnShip = true; } } return RunStatus.Success; } return RunStatus.Running; }) ), new Action(ret => Logging.Write("")) ) ))); }