Abstract pathfind class.
Inheritance: MonoBehaviour
Exemplo n.º 1
0
	// Use this for initialization
	void Start () {
		navigator = GetComponent<Navigator>();
		if(navigator){
			navigator.autoRamble = false;
			navigator.moveToDestinationIfNotZero = true;
		}
	}
Exemplo n.º 2
0
        public void NavigatingToUnrecognizedRouteThrows()
        {
            Resolver.Setup(x => x.MatchRouteToPath(It.IsAny<RouteValueDictionary>())).Returns(PathMatch.Failure(null, "Boogedyboo"));

			var navigator = new Navigator(Factory.Object, null, "magellan", Resolver.Object, () => NavigationService.Object);
            Assert.Throws<UnroutableRequestException>(() => navigator.Navigate(new { Foo = "bar"}));
        }
Exemplo n.º 3
0
        public void CanCreateNavigator()
        {
            var grid = Substitute.For<IGrid>();
            var navigator = new Navigator(grid);

            Assert.NotNull(navigator);
        }
 public void TestInitialize()
 {
     var fixture = new Fixture();
     factories = Substitute.For<Factories>();
     navigator = Substitute.For<Navigator>();
     stateProvider = Substitute.For<StateProvider>();
     facade = Substitute.For<ReplacementBuilderAndSugarEstimatorFacade>();
     clipboard = Substitute.For<Clipboard>();
     messageDialog = Substitute.For<MessageDialog>();
     navigation = new InsulinEditingViewModel.Navigation();
     CreateSut();
     insulin = fixture.Create<Insulin>();
     insulin.InitializeCircumstances(new List<Guid>());
     insulin.SetOwner(factories);
     sugar = new Sugar();
     sugar.SetOwner(factories);
     factories.InsulinCircumstances.Returns(fixture.CreateMany<InsulinCircumstance>().ToList());
     factories.CreateSugar().Returns(sugar);
     settings = new Settings { MaxBolus = 5 };
     factories.Settings.Returns(settings);
     meal = fixture.Create<Meal>();
     factories.Finder.FindMealByInsulin(insulin).Returns(meal);
     factories.Finder.FindInsulinById(insulin.Id).Returns(insulin);
     var replacementAndEstimatedSugars = new ReplacementAndEstimatedSugars();
     replacementAndEstimatedSugars.EstimatedSugars = new List<Sugar>();
     replacementAndEstimatedSugars.Replacement
         = new Replacement { InsulinTotal = new Insulin(), Items = new List<ReplacementItem>() };
     facade.GetReplacementAndEstimatedSugars(Arg.Any<Meal>(), Arg.Any<Insulin>(), Arg.Any<Sugar>())
             .Returns(replacementAndEstimatedSugars);
     factories.MealNames.Returns(new List<MealName>());
     stateProvider.State.Returns(new Dictionary<string, object>());
 }
Exemplo n.º 5
0
 void Awake()
 {
     sfx = AudioManager.instance;
     navigator = Navigator.instance;
     sfx.Play("Audio/Bgm/Scenes/GameOver", 0, 1f, true);
     sfx.Fade("Audio/Bgm/Scenes/GameOver", 0.25f, 0.5f);
 }
Exemplo n.º 6
0
    void Start()
    {
        navigator = Navigator.instance;
        sfx = AudioManager.instance;

        sfx.Play("Audio/Bgm/Music/Alone", 0.5f, 1f, true);
    }
Exemplo n.º 7
0
 void Awake()
 {
     senses = GetComponent<Senses>();
     nav = GetComponent<Navigator>();
     body = GetComponent<Body>();
     renderer.material.color = Species;
 }
Exemplo n.º 8
0
        public void NavigatingToUnrecognizedPathThrows()
        {
            Resolver.Setup(x => x.MatchPathToRoute(It.IsAny<string>())).Returns(RouteMatch.Failure(null, "Boogedyboo"));

			var navigator = new Navigator(Factory.Object, null, "magellan", Resolver.Object, () => NavigationService.Object);
            Assert.Throws<UnroutableRequestException>(() => navigator.Navigate(new Uri("magellan://patients/list")));
        }
Exemplo n.º 9
0
 public XamarinApp()
 {
     app = new App();
     var navigationPage = new NavigationPage(app.BootPage().Page);
     MainPage = navigationPage;
     var nav = new Navigator(navigationPage.Navigation);
     app.SetupAsyncActions(nav, new ServiceAPI());
 }
Exemplo n.º 10
0
 public async void Explore2()
 {
     var cache = new LocalCacheService();
     var navigator = new Navigator(cache);
     var result = await navigator.Explore(Player.P1, Progress, 103, 1, Card.TQ, Card.TA, Card.T8);
     Console.WriteLine(result);
     Console.WriteLine();
     Console.WriteLine(result.Session);
 }
Exemplo n.º 11
0
        public void GoingOffTheGridToTheRightWrapsToTheLeft()
        {
            var grid = Substitute.For<IGrid>();
            var navigator = new Navigator(grid);
            grid.Width.Returns(5);
            grid.Height.Returns(5);

            var pos = navigator.Wrap(new Position(6, 2));

            Assert.Equal(new Position(1, 2), pos);
        }
Exemplo n.º 12
0
        public void GoingOffTheGridToTheTopWrapsToTheBottom()
        {
            var grid = Substitute.For<IGrid>();
            var navigator = new Navigator(grid);
            grid.Width.Returns(5);
            grid.Height.Returns(5);

            var pos = navigator.Wrap(new Position(2, 5));

            Assert.Equal(new Position(2, 0), pos);
        }
Exemplo n.º 13
0
    public EnemyAI(Enemy user)
    {
        this.user = user;
        satNav = user.gameObject.GetComponent<Navigator>();

        animator = user.GetComponentInChildren<Animator>();
        transform = user.transform;

        animator.SetFloat("Speed", 0f);
        satNav.ChangeNodeDist = 0.3f;
        satNav.SlowToStopDist = user.attackRange;
    }
Exemplo n.º 14
0
 /// <summary>
 /// Gets the singleton instance of <see cref="INavigator"/>.
 /// </summary>
 /// <returns></returns>
 public static INavigator GetNavigator()
 {
     if(_navigator==null)
     {
         lock (_syncObject)
         {
             if (_navigator == null)
             {
                 _navigator = new Navigator();
             }
         }
     }
     return _navigator;
 }
 public ReplacementItemViewModel(ReplacementItem replacementItem, Factories factories,
     IList<InsulinCircumstanceViewModel> allCircumstances, IEnumerable<MealNameViewModel> names,
     MealNameViewModel defaultName, Navigator navigator, Action save, Action<IList<PatternViewModel>> showAlternatives)
 {
     ReplacementItem = replacementItem;
     Func<Pattern, bool, PatternViewModel> createPatternViewModel = (pattern, hasAlternatives) =>
         new PatternViewModel(pattern, factories, allCircumstances: allCircumstances,
             hasAlternatives: hasAlternatives, names: names, defaultName: defaultName, navigator: navigator,
             save: save, showAlternatives: ShowAlternatives);
     Pattern = createPatternViewModel(replacementItem.Pattern, replacementItem.Alternatives.Any());
     Alternatives = replacementItem.Alternatives
         .Select(pattern => createPatternViewModel(pattern, false))
         .ToList();
     this.showAlternatives = showAlternatives;
 }
Exemplo n.º 16
0
        private static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var win = new WinDesigner();
            var nav = new Navigator();

            var frc = new FlowRuntimeConfiguration()
                            .AddStreamsFrom("npantarhei.interviz.root.flow", Assembly.GetExecutingAssembly())
                            .AddFunc<Tuple<string, string>[], Tuple<string, string>>("combine_sources", AssemblyResourceAdapter.Combine_sources)
                            .AddFunc<string, Tuple<Image, NodeMap>>("compile_dot_source", GraphVizAdapter.Compile_graph)
                            .AddFunc<string[], string>("compile_flow_to_dot_source", FlowCompiler.Compile_to_dot_source)
                            .AddAction<Tuple<string, string>>("display_flow", win.Display_flow).MakeSync()
                            .AddAction<Tuple<string[], int>>("display_flownames", win.Display_flownames).MakeSync()
                            .AddAction<Tuple<Image, NodeMap>>("display_graph", win.Display_graph).MakeSync()
                            .AddFunc<string[], string>("extract_filename_from_commandline", _ => _[0])
                            .AddFunc<Tuple<string[], int>, Tuple<string[], Tuple<string[], int>>>("extract_flownames", FlowCompiler.Extract_flownames)
                            .AddAction<Tuple<string[], string>>("extend_history", nav.Extend_history)
                            .AddFunc<Tuple<string[], string>, int>("find_flow_headline", FlowCompiler.Find_flow_headline)
                            .AddFunc<string, Tuple<Assembly, string[]>>("find_flow_resources", AssemblyResourceAdapter.Find_flow_resources)
                            .AddFunc<string, Tuple<string, string>>("load_flow_from_file", filename => new Tuple<string, string>(filename, File.ReadAllText(filename)))
                            .AddFunc<Tuple<Assembly, string[]>, Tuple<string, string>[]>("load_sources_from_resources", AssemblyResourceAdapter.Load_soures_from_resources)
                            .AddAction<int>("move_cursor_to_flow_header", win.Move_cursor_to_flow_header).MakeSync()
                            .AddAction<string[], Tuple<string[], string>>("navigate_backward_in_flow", nav.Navigate_backward)
                            .AddAction<string[], Tuple<string[], string>>("navigate_forward_in_flow", nav.Navigate_forward)
                            .AddAction<Tuple<string, string>>("save_flow", _ => File.WriteAllText(_.Item1, _.Item2))
                            .AddFunc<Tuple<string[], int>, string[]>("select_current_flow", FlowCompiler.Select_flow_by_line)
                            .AddFunc<Tuple<string[], Tuple<string[], int>>, Tuple<string[], int>>("select_flowname", FlowCompiler.Select_flowname)
                            .AddOperation(new Throttle("throttle_redrawings"));

            using (var fr = new FlowRuntime(frc)) {
                fr.Message += Console.WriteLine;
                fr.UnhandledException += ex => MessageBox.Show(ex.ToString());

                win.Redraw += fr.CreateEventProcessor<Tuple<string[], int>>(".redraw");
                win.Load_flow_from_textfile += fr.CreateEventProcessor<string>(".loadFromTextfile");
                win.Load_flow_from_assembly += fr.CreateEventProcessor<string>(".loadFromAssembly");
                win.Save_flow += fr.CreateEventProcessor<Tuple<string, string>>(".save");
                win.Jump_to_flow += fr.CreateEventProcessor<Tuple<string[], string>>(".jump_to_flow");
                win.Navigate_backward += fr.CreateEventProcessor<string[]>(".navigate_backward");
                win.Navigate_forward += fr.CreateEventProcessor<string[]>(".navigate_forward");

                fr.Process(".run", args);

                Application.Run(win);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Resources.MergedDictionaries.Add(new DeviceResources());

            var rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                rootFrame = new Frame();
                rootFrame.Navigated += OnNavigated;

                // Place the frame in the current Window

                OnInitializeRunner();

                Initialized = true;

                RunnerOptions.Current.TerminateAfterExecution = TerminateAfterExecution;
                RunnerOptions.Current.AutoStart = AutoStart;

                var nav = new Navigator(rootFrame);

                var runner = new DeviceRunner(testAssemblies, nav, new ResultListener(Writer));
                var hvm = new HomeViewModel(nav, runner);

                nav.NavigateTo(NavigationPage.Home, hvm);

              

                Window.Current.Content = rootFrame;
            }

            // Ensure the current window is active
            Window.Current.Activate();
            // Hook up the default Back handler
            SystemNavigationManager.GetForCurrentView().BackRequested += (s, args) =>
            {
                if (rootFrame.CanGoBack)
                {
                    args.Handled = true;
                    rootFrame.GoBack();
                }
            };
        }
Exemplo n.º 18
0
        public void SetUp()
        {
            _action = x => x.Title = "Test";
            _viewModel = new MockViewModel();
            var navigation = new Mock<INavigation>();
            var page = new Mock<IPage>();

            page.Setup(x => x.Navigation).Returns(navigation.Object);

            navigation.Setup(x => x.PopAsync()).ReturnsAsync(new Page { BindingContext = new MockViewModel()});
            navigation.Setup(x => x.PopModalAsync()).ReturnsAsync(new Page { BindingContext = new MockViewModel()});
            navigation.Setup(x => x.PopToRootAsync());

            var viewFactory = new Mock<IViewFactory>();
            viewFactory.Setup(x => x.Resolve<MockViewModel>(out _viewModel, _action)).Returns(new MockView());

            _navigator = new Navigator(page.Object, viewFactory.Object);
        }
Exemplo n.º 19
0
        public void NavigateToRouteResolvesRightController()
        {
            var controller1 = new Mock<IController>();
            var controller2 = new Mock<IController>();
            var controllers = new ControllerFactory();
            controllers.Register("C1", () => controller1.Object);
            controllers.Register("C2", () => controller2.Object);
            var routes = new ControllerRouteCatalog(controllers);
            routes.MapRoute("search/{action}", new { controller = "C1" });
            routes.MapRoute("patients/{action}", new { controller = "C2" });

			var navigator = new Navigator(Factory.Object, null, "magellan", new RouteResolver(routes), () => NavigationService.Object);

            navigator.Navigate(new { controller = "C2", action = "foo" });
            controller2.Verify(x => x.Execute(It.IsAny<ControllerContext>()));

            navigator.Navigate(new { controller = "C1", action = "foo" });
            controller1.Verify(x => x.Execute(It.IsAny<ControllerContext>()));
        }
Exemplo n.º 20
0
        public async void Explore3()
        {
            var cache = new RedisCacheService();
            //var cache = new LocalCacheService();
            //var cache = new SimCacheService();
            var navigator = new Navigator(cache);
            for (int i = 15; i < 100; i++)
            {
                var game = navigator.PrepareGame(Player.P1, 103+i);

                Console.WriteLine("----------------------------------------------------------------------");
                Console.WriteLine(i);
                Console.WriteLine("----------------------------------------------------------------------");
                var result = await navigator.Explore(game, Progress);
                //Console.WriteLine(result);
                //Console.WriteLine();
                //Console.WriteLine(result.Session);
            }
        }
Exemplo n.º 21
0
 public PatternViewModel(Pattern pattern, Factories factories,
     IList<InsulinCircumstanceViewModel> allCircumstances, bool hasAlternatives,
     IEnumerable<MealNameViewModel> names, MealNameViewModel defaultName, Navigator navigator, Action save,
     Action showAlternatives)
 {
     Pattern = pattern;
     Match = new MealItemViewModel(pattern.Match, factories);
     From = new MealViewModel(pattern.From, factories);
     From.Names = names;
     From.DefaultName = defaultName;
     Insulin = new InsulinViewModel(pattern.Insulin, factories, allCircumstances: allCircumstances);
     Before = new SugarViewModel(pattern.Before, factories);
     After = pattern.After
         .Select(sugar => new SugarViewModel(sugar, factories))
         .ToList();
     For = new MealItemViewModel(pattern.For, factories);
     HasAlternatives = hasAlternatives;
     this.navigator = navigator;
     this.save = save;
     this.showAlternatives = showAlternatives;
 }
Exemplo n.º 22
0
        public async void Explore()
        {
            var cache = new RedisCacheService();
            //var cache = new SimCacheService();
            //var cache = new LocalCacheService();
            var navigator = new Navigator(cache);
            var game = navigator.PrepareGame(Player.P1, 103);

            var result = await navigator.Explore(game, Progress);
            Console.WriteLine(result);
            Console.WriteLine();
            Console.WriteLine(result.Session);

            var game2 = game.MakeTurn(Card.TQ);

            var result2 = await navigator.Explore(game2, Progress);
            Console.WriteLine(result2);
            Console.WriteLine();
            Console.WriteLine(result2.Session);

        }
Exemplo n.º 23
0
 private void InputPaneHiding(InputPane sender, InputPaneVisibilityEventArgs e)
 {
     Navigator.KeyboardClosed();
 }
Exemplo n.º 24
0
 /// <summary>
 /// Creates the navigator.
 /// </summary>
 /// <param name="section">
 /// The section.
 /// </param>
 /// <param name="id">
 /// The id.
 /// </param>
 /// <param name="count">
 /// The count.
 /// </param>
 private void CreateNavigator(Section section, string id, int count)
 {
     Assert.ArgumentNotNull(section, "section");
     Assert.ArgumentNotNull(id, "id");
     Navigator navigator = new Navigator();
     section.Controls.Add(navigator);
     navigator.ID = id;
     navigator.Offset = 0;
     navigator.Count = count;
     navigator.PageSize = this.PageSize;
 }
Exemplo n.º 25
0
 public override void Choose(Navigator navigator)
 {
     navigator.GoToInsulinEditing(Id);
 }
Exemplo n.º 26
0
 public void RegisterSoftware()
 {
     Navigator.GetInstance().Navigate((Form)_workerView, new RegisterAssetsForm(Enums.EAssets.Software));
 }
        }                                                              // No next sibling

        public override bool MoveToFirstChild(Navigator n)
        {
            return(GoToFirstChild(n, Cast(n).CustomAttributes, Cast(n).MainModule.Types));
        }
        /// <summary>
        /// Action to be executd for calculating indicator
        /// </summary>
        /// <returns>for future usage. Must be ignored at this time.</returns>
        protected override bool TrueAction()
        {
// Validate
            int size = _chartPanel._chartX.RecordCount;

            if (size == 0)
            {
                return(false);
            }

            int paramInt1 = ParamInt(1);

            if (paramInt1 < 1 || paramInt1 > size / 2)
            {
                ProcessError("Invalid Periods for indicator " + FullName, IndicatorErrorType.ShowErrorMessage);
                return(false);
            }

            int paramInt2 = ParamInt(2);

            if (paramInt2 < 1)
            {
                ProcessError("Invalid Bar History for indicator " + FullName, IndicatorErrorType.ShowErrorMessage);
                return(false);
            }

            int paramInt3 = ParamInt(3);

            if (paramInt3 < 0)
            {
                ProcessError("Invalid Standard Deviations for indicator " + FullName, IndicatorErrorType.ShowErrorMessage);
                return(false);
            }

            // Get the data
            string paramStr0 = ParamStr(0);
            Field  pSource   = SeriesToField("Source", paramStr0, size);

            if (!EnsureField(pSource, paramStr0))
            {
                return(false);
            }

            Navigator pNav = new Navigator();
            Recordset pRS  = new Recordset();

            pRS.AddField(pSource);
            pNav.Recordset_ = pRS;

            // Calculate the indicator
            Index     ta   = new Index();
            Recordset pInd = ta.HistoricalVolatility(pNav, pSource, paramInt1, paramInt2, paramInt3, FullName);


            // Output the indicator values
            Clear();
            for (int n = 0; n < size; ++n)
            {
                AppendValue(DM.GetTimeStampByIndex(n), n < paramInt1 ? null : pInd.Value(FullName, n + 1));
            }

            return(_calculateResult = PostCalculate());
        }
 private static AssemblyDefinition Cast(Navigator n)
 {
     return((AssemblyDefinition)n.Current);
 }
Exemplo n.º 30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VisualizationContainer"/> class.
 /// </summary>
 public VisualizationContainer()
 {
     this.navigator = new Navigator();
     this.panels    = new ObservableCollection <VisualizationPanel>();
     this.InitNew();
 }
Exemplo n.º 31
0
        /// <summary>
        /// Process a dialog key in a manner appropriate for the view.
        /// </summary>
        /// <param name="keyData">Key data.</param>
        /// <returns>True if the key eaten; otherwise false.</returns>
        public override bool ProcessDialogKey(Keys keyData)
        {
            // Find out which modifier keys are being pressed
            bool shift   = ((keyData & Keys.Shift) == Keys.Shift);
            bool control = ((keyData & Keys.Control) == Keys.Control);

            // Extract just the key and not modifier keys
            Keys keyCode = (keyData & Keys.KeyCode);

            // There must be a selected page before any action can occur
            if (Navigator.SelectedPage != null)
            {
                switch (keyCode)
                {
                case Keys.Up:
                case Keys.Down:
                case Keys.Left:
                case Keys.Right:
                    // Using a navigation key when the selected button has focus
                    if (HasFocus && _selectedButton.HasFocus)
                    {
                        // Shift focus to the currently selected page
                        if (Navigator.SelectedPage != null)
                        {
                            // Remove focus from the selected button
                            _selectedButton.HasFocus = false;

                            // We should have a stack view for the page
                            if (_pageStackLookup.ContainsKey(Navigator.SelectedPage))
                            {
                                // Get the associated view element for the page
                                ViewDrawNavCheckButtonBase checkButton = _pageStackLookup[Navigator.SelectedPage];

                                // Focus is in the check button
                                checkButton.HasFocus = true;
                            }

                            // Need to repaint to show the change
                            Navigator.PerformNeedPaint(true);
                            return(true);
                        }
                    }
                    break;

                case Keys.Space:
                case Keys.Enter:
                    if (HasFocus)
                    {
                        // If the mini button does not have focus, give it focus
                        if (!_selectedButton.HasFocus)
                        {
                            // Remove focus from the selected button
                            _selectedButton.HasFocus = true;

                            // Shift focus from the currently selected page
                            if (Navigator.SelectedPage != null)
                            {
                                // We should have a stack view for the page
                                if (_pageStackLookup.ContainsKey(Navigator.SelectedPage))
                                {
                                    // Get the associated view element for the page
                                    ViewDrawNavCheckButtonBase checkButton = _pageStackLookup[Navigator.SelectedPage];

                                    // Focus is not longer on the check button
                                    checkButton.HasFocus = false;
                                }
                            }

                            // Need to repaint to show the change
                            Navigator.PerformNeedPaint(true);

                            return(true);
                        }
                        else
                        {
                            // Mini button has focus, press the button
                            _selectedButton.PerformClick();
                        }
                    }
                    break;
                }
            }

            // Let the base class perform additional testing
            return(base.ProcessDialogKey(keyData));
        }
Exemplo n.º 32
0
 private void NaviagteToHome()
 {
     Navigator.NavigateTo(RedirectTo);
 }
Exemplo n.º 33
0
 internal void InsertExcludedNamespace()
 {
     InsertExcludedNamespace(Input !.Navigator.GetAttribute(Input.Atoms.ExcludeResultPrefixes, Input.Atoms.UriXsl));
 }
Exemplo n.º 34
0
 internal void InsertExtensionNamespace()
 {
     InsertExtensionNamespace(Input !.Navigator.GetAttribute(Input.Atoms.ExtensionElementPrefixes, Input.Atoms.UriXsl));
 }
 public override void Remove(Navigator n)
 {
     throw new NotSupportedException("Cannot remove the assembly itself");
 }
Exemplo n.º 36
0
 public ItemCopyer(IPersister persister, Navigator navigator)
 {
     this.persister = persister;
     this.navigator = navigator;
 }
 // Use this for initialization
 void Start()
 {
     navigator = GetComponent<Navigator>();
     player = GetComponent<Player>();
 }
Exemplo n.º 38
0
 protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
 {
     base.OnNavigatingFrom(e);
     CloseAll();
     Navigator.GetForCurrentView().Handlers.Remove(this);
 }
        /// <summary>
        /// Action to be executd for calculating indicator
        /// </summary>
        /// <returns>for future usage. Must be ignored at this time.</returns>
        protected override bool TrueAction()
        {
// Validate
            int size = _chartPanel._chartX.RecordCount;

            if (size == 0)
            {
                return(false);
            }

            int paramInt1 = ParamInt(1);

            if (paramInt1 < 1 || paramInt1 > size / 2)
            {
                ProcessError("Invalid Periods for indicator " + FullName, IndicatorErrorType.ShowErrorMessage);
                return(false);
            }


            // Get the data
            string paramStr0 = ParamStr(0);
            Field  pOpen     = SeriesToField("Open", paramStr0 + ".open", size);

            if (!EnsureField(pOpen, paramStr0 + ".open"))
            {
                return(false);
            }
            Field pHigh = SeriesToField("High", paramStr0 + ".high", size);

            if (!EnsureField(pHigh, paramStr0 + ".high"))
            {
                return(false);
            }
            Field pLow = SeriesToField("Low", paramStr0 + ".low", size);

            if (!EnsureField(pLow, paramStr0 + ".low"))
            {
                return(false);
            }
            Field pClose = SeriesToField("Close", paramStr0 + ".close", size);

            if (!EnsureField(pClose, paramStr0 + ".close"))
            {
                return(false);
            }

            Navigator pNav = new Navigator();
            Recordset pRS  = new Recordset();

            pRS.AddField(pOpen);
            pRS.AddField(pHigh);
            pRS.AddField(pLow);
            pRS.AddField(pClose);

            pNav.Recordset_ = pRS;


            // Calculate the indicator
            Index     ta   = new Index();
            Recordset pInd = ta.CommodityChannelIndex(pNav, pRS, paramInt1, FullName);


            // Output the indicator values
            Clear();
            for (int n = 0; n < size; ++n)
            {
                AppendValue(DM.GetTimeStampByIndex(n), n < paramInt1 * 1.8 ? null : pInd.Value(FullName, n + 1));
            }

            return(_calculateResult = PostCalculate());
        }
Exemplo n.º 40
0
        public Composite CreateBehavior_KillGnome()
        {
            WoWUnit attackTarget = null;

            return(new Decorator(r => !Me.IsQuestComplete(QuestId) && Query.IsInVehicle(),
                                 new PrioritySelector(ctx => attackTarget = GetAttackTarget(),
                                                      new Decorator(ctx => attackTarget != null,
                                                                    new PrioritySelector(
                                                                        new ActionFail(ctx => _stuckTimer.Reset()),
                                                                        new ActionSetActivity("Moving to Attack"),
                                                                        new Decorator(ctx => Me.CurrentTargetGuid != attackTarget.Guid,
                                                                                      new ActionFail(ctx => attackTarget.Target())),
                                                                        new Decorator(ctx => !WoWMovement.ActiveMover.IsSafelyFacing(attackTarget, 30),
                                                                                      new ActionFail(ctx => attackTarget.Face())),

                                                                        // cast 'Incinerate' ability on melee range target.
                                                                        new Decorator(
                                                                            ctx => Me.Location.DistanceSqr(attackTarget.Location) <= 15 * 15,
                                                                            new PrioritySelector(
                                                                                new Decorator(
                                                                                    ctx => Me.Location.DistanceSqr(attackTarget.Location) <= 15 * 15 && (Me.IsMoving || Me.CharmedUnit.IsMoving),
                                                                                    new ActionFail(ctx => WoWMovement.ClickToMove(Me.CharmedUnit.Location))),
                                                                                new Action(ctx => Lua.DoString("CastPetAction(1)")))),
                                                                        new Decorator(ctx => Me.Location.DistanceSqr(attackTarget.Location) > 15 * 15,
                                                                                      new Action(ctx => Navigator.MoveTo(attackTarget.Location))))),
                                                      new Decorator(
                                                          ctx => attackTarget == null,
                                                          new PrioritySelector(
                                                              new Decorator(
                                                                  ctx => Me.Location.DistanceSqr(_waitPoint) > 10 * 10,
                                                                  new PrioritySelector(
                                                                      // can't set path precision so I'll just handle it directly...
                                                                      // the IronShredder takes wide turns so needs a higher path precision than normal
                                                                      new Decorator(
                                                                          ctx =>
            {
                var nav = Navigator.NavigationProvider as MeshNavigator;
                if (nav == null)
                {
                    return false;
                }
                if (nav.CurrentMovePath == null || nav.CurrentMovePath.Index >= nav.CurrentMovePath.Path.Points.Length)
                {
                    return false;
                }
                WoWPoint point = nav.CurrentMovePath.Path.Points[nav.CurrentMovePath.Index];
                return point.DistanceSqr(Me.Location) < 6 * 6;
            },
                                                                          new Action(ctx => ((MeshNavigator)Navigator.NavigationProvider).CurrentMovePath.Index++)),

                                                                      CreateBehavior_Antistuck(),

                                                                      new Action(ctx => Navigator.MoveTo(_waitPoint)))),
                                                              new ActionSetActivity("No viable targets, waiting."))),
                                                      new ActionAlwaysSucceed())));
        }
Exemplo n.º 41
0
    /// <summary>
    /// 
    /// 1. Initialize variable.
    /// 2. Initalize behavior list. Sort the behavior from higher to lower priorty.
    /// 
    /// Offspring should call InitAI() at Awake() 
    /// </summary>
    public override void InitAI()
    {
        this.Unit = GetComponent<Unit>();
        controller = GetComponent<CharacterController>();
        navigator = GetComponent<Navigator>();

        //initialize the alternate behavior condition data
        foreach(AIBehavior behavior in Behaviors)
        {
            behavior.InitBehavior();
            behaviorDict.Add(behavior.Name, behavior);
        }
    }
 public override bool MoveToNext(Navigator n)
 {
     return(false);
 }                                                              // No next sibling
Exemplo n.º 43
0
 public Rover(Grid grid)
 {
     _grid     = grid;
     Navigator = new Navigator(new Rotator(), new MoveActions(), grid);
 }
 public override void Remove(Navigator n)
 {
     ((ICustomAttributeProvider)n.Parent).CustomAttributes.Remove(Cast(n));
 }
Exemplo n.º 45
0
 public void Logout()
 {
     Navigator.GetInstance().Navigate((Form)_workerView, new LoginForm());
 }
Exemplo n.º 46
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new PrioritySelector(
                                     // done with QB?
                                     new Decorator(ret => IsQuestComplete(),
                                                   new PrioritySelector(
                                                       new Decorator(ret => Location.Distance(Me.Location) > 3,
                                                                     new Action(ret => Navigator.MoveTo(Location))),
                                                       new Decorator(ret => !HasAura(Me, 82924) && 1000 < _bombWait.ElapsedMilliseconds && _bombWait.ElapsedMilliseconds > 12000,
                                                                     new Action(ret => _isBehaviorDone = true)),
                                                       new Action(delegate
            {
                TreeRoot.StatusText = "Waiting for Living Bomb - " + Location;
                if (!_bombWait.IsRunning)
                {
                    _bombWait.Start();
                }
            })
                                                       )
                                                   ),
                                     // move to safe spot initially
                                     new Decorator(ret => !_moveToCoordYet,
                                                   new PrioritySelector(
                                                       new Decorator(ret => Location.Distance(Me.Location) < 3,
                                                                     new Action(ret => _moveToCoordYet = true)),
                                                       new Sequence(
                                                           new Action(delegate { TreeRoot.StatusText = "Move to start - " + Location; }),
                                                           new Action(ret => Navigator.MoveTo(Location)))
                                                       )
                                                   ),
                                     // have current mob
                                     new Decorator(ret => Mob != null,
                                                   new PrioritySelector(

                                                       // target quest mob
                                                       new Decorator(ret => Mob != null && Mob != Me.CurrentTarget,
                                                                     new Action(ret => (Mob as WoWUnit).Target())),

                                                       // need to move ( timer or aura )
                                                       new Decorator(ret => _castTime.ElapsedMilliseconds > 5000 || HasAura(Mob as WoWUnit, AuraId),
                                                                     new PrioritySelector(
                                                                         // if at safe spot then wait
                                                                         new Decorator(ret => Location.Distance(Me.Location) < 3,
                                                                                       new Action(delegate
            {
                if (!HasAura(Mob as WoWUnit, AuraId))
                {
                    TreeRoot.StatusText = "Wait to see - " + Mob.Name;
                }
                else
                {
                    TreeRoot.StatusText = "Wait till clear - " + Mob.Name;
                    _castTime.Reset();                               // clear timer now that we see aura
                }
            })),
                                                                         new Action(delegate
            {
                TreeRoot.StatusText = "Move away to - " + Location;
                Navigator.MoveTo(Location);
            }))
                                                                     ),

                                                       // need to attack
                                                       new PrioritySelector(
                                                           new Decorator(ret => Mob.Distance > Range,
                                                                         new Action(delegate
            {
                TreeRoot.StatusText = "Moving in - " + Mob.Name;
                Navigator.MoveTo(WoWMovement.CalculatePointFrom(Mob.Location, (float)(Range - 1)));
            })),
                                                           new Decorator(ret => Me.IsMoving,
                                                                         new Action(delegate
            {
                WoWMovement.MoveStop();
                StyxWoW.SleepForLagDuration();
            })),
                                                           new Decorator(ret => _castTime.IsRunning,
                                                                         new Action(ret => 0)),
                                                           new Action(delegate
            {
                TreeRoot.StatusText = "Using item on - " + Mob.Name;
                (Mob as WoWUnit).Target();

                if (Item == null)
                {
                    LogMessage("fatal", "Could not locate ItemId({0}) in inventory.", ItemId);
                    return;
                }

                WoWMovement.Face(Mob.Guid);

                Item.UseContainerItem();
                _castTime.Start();
                StyxWoW.SleepForLagDuration();
            })
                                                           )
                                                       )
                                                   )
                                     )
                             ));
        }
Exemplo n.º 47
0
 public void TestInitialize()
 {
     factories = new FactoriesImpl();
     factories.StorageCreator = new StorageCreatorStub();
     productListing = new ProductListingViewModel(factories,
         new BackgroundWorkerSyncFactory());
     mealItemEditing = new MealItemEditingViewModel();
     sut = CreateSut(factories, productListing: productListing, mealItemEditing: mealItemEditing);
     navigation = new MainViewModel.Navigation();
     sut.Init(navigation);
     var stateProvider = Substitute.For<StateProvider>();
     stateProvider.State.Returns(new Dictionary<string, object>());
     sut.StateProvider = stateProvider;
     navigator = Substitute.For<Navigator>();
 }
Exemplo n.º 48
0
 public override void OnStart(object param)
 {
     Navigator.NavigateDirectly("Main View");
 }
Exemplo n.º 49
0
 public Composite CreateBehavior_GetIn()
 {
     return(new Decorator(r => !Query.IsInVehicle() && !Me.IsActuallyInCombat,
                          new PrioritySelector(
                              new Decorator(r => Clarissa != null,
                                            new Sequence(
                                                new Action(r => Clarissa.Interact()),
                                                new Sleep(400),
                                                new Action(ret => Lua.DoString("SelectGossipOption(1,\"gossip\", true)")),
                                                new Sleep(2000))),
                              new Decorator(r => Clarissa == null, new Action(r => Navigator.MoveTo(_startPoint))))));
 }
 public void SetUp()
 {
     this.driver    = DriverSingletonProvider.GetDriver();
     this.navigator = new Navigator(driver);
 }
Exemplo n.º 51
0
 private void GoBack()
 {
     Navigator.NavigateTo(PageNames.StudentCollectionView);
 }
Exemplo n.º 52
0
	// Use this for initialization
	void Start () {
		navigator = GetComponent<Navigator>();
	}
Exemplo n.º 53
0
 private void CustomKeyboardHandler(object sender, InputPaneVisibilityEventArgs e)
 {
     Navigator.KeyboardOpen();
 }
        private async Task <bool> ScareSpiders()
        {
            // if not in a turret than move to one and interact with it
            if (!Query.IsInVehicle())
            {
                var mustang = GetMustang();
                if (mustang == null)
                {
                    QBCLog.Warning("No mustang was found nearby");
                    return(false);
                }

                TreeRoot.StatusText = "Moving To Mustang";
                if (mustang.DistanceSqr > 5 * 5)
                {
                    return((await CommonCoroutines.MoveTo(mustang.Location)).IsSuccessful());
                }

                await CommonCoroutines.LandAndDismount();

                QBCLog.Info("Interacting with Mustang");
                mustang.Interact();
                return(true);
            }

            // Find the nearest spider and if none exist then move to the spawn location
            if (!Query.IsViable(_currentTarget) || !_currentTarget.IsAlive)
            {
                _currentTarget = ObjectManager.GetObjectsOfType <WoWUnit>()
                                 .Where(u => u.IsAlive && u.Entry == 44284 && !Blacklist.Contains(u, BlacklistFlags.Interact))
                                 .OrderBy(u => u.DistanceSqr).FirstOrDefault();

                if (_currentTarget == null)
                {
                    if (!Navigator.AtLocation(_spiderSpawnLocation))
                    {
                        return((await CommonCoroutines.MoveTo(_spiderSpawnLocation)).IsSuccessful());
                    }
                    TreeRoot.StatusText = "Waiting for spiders to spawn";
                    return(true);
                }
                _noMoveBlacklistTimer.Reset();
                _blacklistTimer.Reset();
                QBCLog.Info("Locked on a new target. Distance {0}", _currentTarget.Distance);
            }

            TreeRoot.StatusText = "Scaring spider towards lumber mill";

            var moveToPoint = WoWMathHelper.CalculatePointFrom(_lumberMillLocation, _currentTarget.Location, -6);

            if (moveToPoint.DistanceSquared((WoWMovement.ActiveMover ?? StyxWoW.Me).Location) > 4 * 4)
            {
                return((await CommonCoroutines.MoveTo(moveToPoint)).IsSuccessful());
            }

            // spider not moving? blacklist and find a new target.
            if (_noMoveBlacklistTimer.ElapsedMilliseconds > 20000 && _currentTarget.Location.DistanceSquared(_spiderScareLoc) < 10 * 10)
            {
                Blacklist.Add(_currentTarget, BlacklistFlags.Interact, TimeSpan.FromMinutes(3), "Spider is not moving");
                _currentTarget = null;
            }
            else if (_blacklistTimer.IsFinished)
            {
                Blacklist.Add(_currentTarget, BlacklistFlags.Interact, TimeSpan.FromMinutes(3), "Took too long");
                _currentTarget = null;
            }
            else if (!_currentTarget.HasAura("Fear"))
            {
                await CommonCoroutines.StopMoving();

                Me.SetFacing(_lumberMillLocation);
                await CommonCoroutines.SleepForLagDuration();

                await Coroutine.Sleep(200);

                if (!_noMoveBlacklistTimer.IsRunning || _currentTarget.Location.DistanceSquared(_spiderScareLoc) >= 10 * 10)
                {
                    _noMoveBlacklistTimer.Restart();
                    _spiderScareLoc = _currentTarget.Location;
                }
                Lua.DoString("CastSpellByID(83605)");
                await Coroutine.Wait(3000, () => Query.IsViable(_currentTarget) && _currentTarget.HasAura("Fear"));
            }

            return(true);
        }
Exemplo n.º 55
0
    void Start()
    {
        thisTransform = transform;
        startPosition = thisTransform.position;
        attacker = GetComponent<Attacker>();
        attacker.OnTargetLeaveRange += targetLeftRange;
        attacker.OnTargetInRange += targetInRange;
        attacker.OnTargetDeath += targetDied;
        attacker.OnBeginAttacking += startedAttacking;
        attacker.OnActualAttack += attack;

        navigator = GetComponent<Navigator>();
        navigator.OnWalking += walking;
        navigator.OnStartWalk += startWalking;
        navigator.OnStopWalk += stopWalking;

        life = GetComponent<Life>();
        life.OnBeingAttacked += wasAttacked;
        StartCoroutine("prowl");
        //StartCoroutine(repeatHurt());

        lineOfSight = (Instantiate(lineOfSightPrefab) as GameObject).GetComponent<LineRenderer>();
        lineOfSight.gameObject.SetActiveRecursively(false);
    }
Exemplo n.º 56
0
        internal RunStatus TargetMoveTo(CacheObject obj)
        {
            #region DebugInfo
            if (Bot.Settings.Debug.DebugStatusBar)
            {
                string Action = "[Move-";
                switch (obj.targetType.Value)
                {
                case TargetType.Avoidance:
                    Action += "Avoid] ";
                    break;

                case TargetType.Fleeing:
                    Action += "Flee] ";
                    break;

                case TargetType.Backtrack:
                    Action += "BackTrack] ";
                    break;

                case TargetType.LineOfSight:
                    Action += "LOS] ";
                    break;

                case TargetType.Unit:
                    if (Bot.NavigationCache.groupRunningBehavior && Bot.NavigationCache.groupingCurrentUnit != null && Bot.NavigationCache.groupingCurrentUnit == obj)
                    {
                        Action += "Grouping] ";
                    }
                    else
                    {
                        Action += "Combat] ";
                    }

                    break;

                case TargetType.Item:
                case TargetType.Gold:
                case TargetType.Globe:
                    Action += "Pickup] ";
                    break;

                case TargetType.Interactable:
                    Action += "Interact] ";
                    break;

                case TargetType.Container:
                    Action += "Open] ";
                    break;

                case TargetType.Destructible:
                case TargetType.Barricade:
                    Action += "Destroy] ";
                    break;

                case TargetType.Shrine:
                    Action += "Click] ";
                    break;
                }
                Bot.Targeting.Handler.UpdateStatusText(Action);
            }
            #endregion

            // Are we currently incapacitated? If so then wait...
            if (Bot.Character.Data.bIsIncapacitated || Bot.Character.Data.bIsRooted)
            {
                return(RunStatus.Running);
            }

            //Ignore skip ahead cache for LOS movements..
            if (Bot.Settings.Debug.SkipAhead && obj.targetType.Value != TargetType.LineOfSight)
            {
                SkipAheadCache.RecordSkipAheadCachePoint();
            }

            // Some stuff to avoid spamming usepower EVERY loop, and also to detect stucks/staying in one place for too long
            bool bForceNewMovement = false;

            //Herbfunk: Added this to prevent stucks attempting to move to a target blocked. (Case: 3 champs behind a wall, within range but could not engage due to being on the other side.)
            #region Non Movement Counter Reached
            if (NonMovementCounter > Bot.Settings.Plugin.MovementNonMovementCount)
            {
                Logger.Write(LogLevel.Movement, "non movement counter reached {0}", NonMovementCounter);

                if (obj.Actortype.HasValue && obj.Actortype.Value.HasFlag(ActorType.Item))
                {
                    if (NonMovementCounter > 250)
                    {
                        //Are we stuck?
                        if (!Navigation.MGP.CanStandAt(Bot.Character.Data.Position))
                        {
                            Logger.DBLog.InfoFormat("Character is stuck inside non-standable location.. attempting townportal cast..");
                            ZetaDia.Me.UseTownPortal();
                            NonMovementCounter = 0;
                            return(RunStatus.Running);
                        }
                    }


                    //Check if we can walk to this location from current location..
                    if (!Navigation.CanRayCast(Bot.Character.Data.Position, CurrentTargetLocation, UseSearchGridProvider: true))
                    {
                        obj.RequiresLOSCheck = true;
                        obj.BlacklistLoops   = 50;

                        Logger.Write(LogLevel.Movement, "Ignoring Item {0} -- due to RayCast Failure!", obj.InternalName);

                        Bot.Targeting.Cache.bForceTargetUpdate = true;
                        return(RunStatus.Running);
                    }
                }
                else if (ObjectCache.CheckTargetTypeFlag(obj.targetType.Value, TargetType.LineOfSight | TargetType.Backtrack))
                {
                    Logger.Write(LogLevel.Movement, "Line of Sight Movement Stalled!");

                    Bot.NavigationCache.LOSmovementObject  = null;
                    Bot.Targeting.Cache.bForceTargetUpdate = true;
                    NonMovementCounter = 0;
                    // Reset the emergency loop counter and return success
                    return(RunStatus.Running);
                }
                else
                {
                    Logger.Write(LogLevel.Movement, "Ignoring obj {0} ", obj.InternalName + " _ SNO:" + obj.SNOID);
                    obj.BlacklistLoops   = 50;
                    obj.RequiresLOSCheck = true;
                    Bot.Targeting.Cache.bForceTargetUpdate = true;
                    NonMovementCounter = 0;

                    // Reset the emergency loop counter and return success
                    return(RunStatus.Running);
                }
            }
            #endregion

            //update misc movement info (rotation, state, flags, etc)
            Bot.NavigationCache.RefreshMovementCache();

            //Do a priority check for nearby obstacle objects.
            Bot.NavigationCache.ObstaclePrioritizeCheck(15f);

            #region Evaluate Last Action

            // Position didn't change last update.. check if we are stuck!
            if (DateTime.Now.Subtract(lastPositionChange).TotalMilliseconds > 150 &&
                (!Bot.NavigationCache.IsMoving || Bot.NavigationCache.currentMovementState == MovementState.WalkingInPlace || Bot.NavigationCache.currentMovementState.Equals(MovementState.None)))
            {
                bForceNewMovement = true;
                if (DateTime.Now.Subtract(LastMovementDuringCombat).TotalMilliseconds >= 250)
                {
                    LastMovementDuringCombat = DateTime.Now;
                    BlockedMovementCounter++;

                    // Tell target finder to prioritize close-combat targets incase we were bodyblocked
                    #region TargetingPriortize
                    switch (BlockedMovementCounter)
                    {
                    case 2:
                    case 3:
                        if (Bot.NavigationCache.groupRunningBehavior)
                        {
                            Logger.Write(LogLevel.Movement, "Grouping Behavior stopped due to blocking counter");

                            Bot.NavigationCache.GroupingFinishBehavior();
                            Bot.NavigationCache.groupingSuspendedDate = DateTime.Now.AddMilliseconds(4000);
                            Bot.Targeting.Cache.bForceTargetUpdate    = true;
                            return(RunStatus.Running);
                        }

                        if (!ObjectCache.CheckTargetTypeFlag(obj.targetType.Value, TargetType.AvoidanceMovements))
                        {
                            //Finally try raycasting to see if navigation is possible..
                            if (obj.Actortype.HasValue &&
                                (obj.Actortype.Value == ActorType.Gizmo || obj.Actortype.Value == ActorType.Monster))
                            {
                                Vector3 hitTest;
                                // No raycast available, try and force-ignore this for a little while, and blacklist for a few seconds
                                if (Navigator.Raycast(Bot.Character.Data.Position, obj.Position, out hitTest))
                                {
                                    if (hitTest != Vector3.Zero)
                                    {
                                        obj.RequiresLOSCheck = true;
                                        obj.BlacklistLoops   = 10;
                                        Logger.Write(LogLevel.Movement, "Ignoring object " + obj.InternalName + " due to not moving and raycast failure!", true);

                                        Bot.Targeting.Cache.bForceTargetUpdate = true;
                                        return(RunStatus.Running);
                                    }
                                }
                            }
                            else if (obj.targetType.Value == TargetType.Item)
                            {
                                obj.BlacklistLoops = 10;
                                Bot.Targeting.Cache.bForceTargetUpdate = true;
                            }
                        }
                        else
                        {
                            if (!Navigation.CanRayCast(Bot.Character.Data.Position, CurrentTargetLocation, NavCellFlags.AllowWalk))
                            {
                                Logger.Write(LogLevel.Movement, "Cannot continue with avoidance movement due to raycast failure!");
                                BlockedMovementCounter = 0;

                                Bot.NavigationCache.CurrentGPArea.BlacklistLastSafespot();
                                Bot.NavigationCache.vlastSafeSpot      = Vector3.Zero;
                                Bot.Targeting.Cache.bForceTargetUpdate = true;
                                return(RunStatus.Running);
                            }
                        }
                        break;
                    }
                    #endregion

                    return(RunStatus.Running);
                }
            }
            else
            {
                // Movement has been made, so count the time last moved!
                LastMovementDuringCombat = DateTime.Now;
            }
            #endregion

            // See if we want to ACTUALLY move, or are just waiting for the last move command...
            if (!bForceNewMovement && IsAlreadyMoving && CurrentTargetLocation == LastTargetLocation && DateTime.Now.Subtract(LastMovementCommand).TotalMilliseconds <= 100)
            {
                return(RunStatus.Running);
            }

            // If we're doing avoidance, globes or backtracking, try to use special abilities to move quicker
            #region SpecialMovementChecks
            if (ObjectCache.CheckTargetTypeFlag(obj.targetType.Value, Bot.Settings.Combat.CombatMovementTargetTypes))
            {
                Skill   MovementPower;
                Vector3 MovementVector = Bot.Character.Class.FindCombatMovementPower(out MovementPower, obj.Position);
                if (MovementVector != Vector3.Zero)
                {
                    ZetaDia.Me.UsePower(MovementPower.Power, MovementVector, Bot.Character.Data.iCurrentWorldID, -1);
                    MovementPower.OnSuccessfullyUsed();

                    // Store the current destination for comparison incase of changes next loop
                    LastTargetLocation = CurrentTargetLocation;
                    // Reset total body-block count, since we should have moved
                    //if (DateTime.Now.Subtract(Bot.Targeting.Cache.Environment.lastForcedKeepCloseRange).TotalMilliseconds>=2000)
                    BlockedMovementCounter = 0;

                    return(RunStatus.Running);
                }

                //Special Whirlwind Code
                if (Bot.Character.Class.AC == ActorClass.Barbarian && Bot.Character.Class.HotBar.HotbarPowers.Contains(SNOPower.Barbarian_Whirlwind))
                {
                    // Whirlwind against everything within range (except backtrack points)
                    if (Bot.Character.Data.dCurrentEnergy >= 10 &&
                        Bot.Targeting.Cache.Environment.iAnythingWithinRange[(int)RangeIntervals.Range_20] >= 1 &&
                        obj.DistanceFromTarget <= 12f &&
                        (!Bot.Character.Class.HotBar.HotbarPowers.Contains(SNOPower.Barbarian_Sprint) || Bot.Character.Class.HotBar.HasBuff(SNOPower.Barbarian_Sprint)) &&
                        (ObjectCache.CheckTargetTypeFlag(obj.targetType.Value, TargetType.AvoidanceMovements | TargetType.Gold | TargetType.Globe) == false) &&
                        (obj.targetType.Value != TargetType.Unit ||
                         (obj.targetType.Value == TargetType.Unit && !obj.IsTreasureGoblin &&
                          (!Bot.Settings.Class.bSelectiveWhirlwind ||
                           Bot.Targeting.Cache.Environment.bAnyNonWWIgnoreMobsInRange ||
                           !CacheIDLookup.hashActorSNOWhirlwindIgnore.Contains(obj.SNOID)))))
                    {
                        // Special code to prevent whirlwind double-spam, this helps save fury
                        bool bUseThisLoop = SNOPower.Barbarian_Whirlwind != Bot.Character.Class.LastUsedAbility.Power;
                        if (!bUseThisLoop)
                        {
                            if (Bot.Character.Class.Abilities[SNOPower.Barbarian_Whirlwind].LastUsedMilliseconds >= 200)
                            {
                                bUseThisLoop = true;
                            }
                        }
                        if (bUseThisLoop)
                        {
                            ZetaDia.Me.UsePower(SNOPower.Barbarian_Whirlwind, CurrentTargetLocation, Bot.Character.Data.iCurrentWorldID);
                            Bot.Character.Class.Abilities[SNOPower.Barbarian_Whirlwind].OnSuccessfullyUsed();
                        }
                        // Store the current destination for comparison incase of changes next loop
                        LastTargetLocation     = CurrentTargetLocation;
                        BlockedMovementCounter = 0;
                        return(RunStatus.Running);
                    }
                }
            }
            #endregion


            // Now for the actual movement request stuff
            IsAlreadyMoving = true;
            UseTargetMovement(obj, bForceNewMovement);

            // Store the current destination for comparison incase of changes next loop
            LastMovementAttempted = DateTime.Now;
            LastTargetLocation    = CurrentTargetLocation;

            //Check if we moved at least 5f..
            if (LastPlayerLocation.Distance(Bot.Character.Data.Position) <= 5f)
            {
                NonMovementCounter++;
            }
            else
            {
                NonMovementCounter     = 0;
                BlockedMovementCounter = 0;
            }

            //store player location
            LastPlayerLocation = Bot.Character.Data.Position;

            return(RunStatus.Running);
        }
 public void TestInitialize()
 {
     factories = Substitute.For<Factories>();
     factories.InsulinCircumstances.Returns(new List<InsulinCircumstance>());
     factories.MealNames.Returns(new List<MealName>());
     factories.Insulins.Returns(new List<Insulin>());
     factories.Sugars.Returns(new List<Sugar>());
     factories.Meals.Returns(new List<Meal>());
     factories.Settings.Returns(new Settings());
     sugarEditing = Substitute.For<SugarEditingViewModel>();
     sut = new JournalViewModel(factories, new BackgroundWorkerSyncFactory(), sugarEditing);
     stateProvider = Substitute.For<StateProvider>();
     stateProvider.State.Returns(new Dictionary<string, object>());
     sut.StateProvider = stateProvider;
     navigator = Substitute.For<Navigator>();
     sut.Navigator = navigator;
 }
Exemplo n.º 58
0
        protected override RunStatus Run(object context)
        {
            WoWPoint      mboxLoc = BotPoi.Current.Location;
            WoWGameObject mailbox = ObjectManager.GetObjectsOfType <WoWGameObject>().
                                    FirstOrDefault(m => m.SubType == WoWGameObjectType.Mailbox &&
                                                   m.Location.Distance(mboxLoc) < 10);
            WoWPoint loc = mailbox != null ? mailbox.Location : mboxLoc;

            if (_me.Location.Distance(loc) > 4)
            {
                if (AutoAngler.Instance.MySettings.Fly)
                {
                    Flightor.MoveTo(WoWMathHelper.CalculatePointFrom(_me.Location, loc, 3));
                }
                else
                {
                    if (!StyxWoW.Me.Mounted && Mount.ShouldMount(loc) && Mount.CanMount())
                    {
                        Mount.MountUp(() => loc);
                    }
                    Navigator.MoveTo(WoWMathHelper.CalculatePointFrom(_me.Location, loc, 4));
                }
            }
            else
            {
                if (MailFrame.Instance == null || !MailFrame.Instance.IsVisible)
                {
                    if (mailbox == null)
                    {
                        AutoAngler.Instance.Log("No Mailbox found at location {0}. Vendoring instead", loc);
                        Vendor ven = ProfileManager.CurrentOuterProfile.VendorManager.GetClosestVendor();
                        if (ven != null)
                        {
                            BotPoi.Current = new BotPoi(ven, PoiType.Repair);
                        }
                        else
                        {
                            BotPoi.Current = new BotPoi(PoiType.InnKeeper);
                        }
                        return(RunStatus.Failure);
                    }
                    mailbox.Interact();
                }
                else
                {
                    Vendor ven = ProfileManager.CurrentOuterProfile.VendorManager.GetClosestVendor();
                    if (ven != null)
                    {
// mail all except grey items which we will vendor.
                        MailFrame.Instance.SendMailWithManyAttachments(CharacterSettings.Instance.MailRecipient, 0,
                                                                       _me.BagItems.Where(
                                                                           i => !i.IsSoulbound && !i.IsConjured &&
                                                                           i.Quality != WoWItemQuality.Poor &&
                                                                           !ProtectedItemsManager.Contains(i.Entry))
                                                                       .
                                                                       ToArray());
                        BotPoi.Current = new BotPoi(ven, PoiType.Repair);
                    }
                    else
                    {
                        // mail all since no vender is in profile
                        MailFrame.Instance.SendMailWithManyAttachments(CharacterSettings.Instance.MailRecipient, 0,
                                                                       _me.BagItems.Where(
                                                                           i => !i.IsSoulbound && !i.IsConjured &&
                                                                           !ProtectedItemsManager.Contains(i.Entry))
                                                                       .
                                                                       ToArray());
                        BotPoi.Current = new BotPoi(PoiType.None);
                    }
                }
            }
            return(RunStatus.Success);
        }
Exemplo n.º 59
0
        public override Widget build(BuildContext context)
        {
            var saveButton = new IconButton(
                icon: new Icon(Icons.save, size: 32, color: Theme.of(context).primaryColor),
                onPressed: SaveClose
                );

            return(new Scaffold(
                       body: new Material(
                           child: new ListView(
                               children: new List <Widget>()
            {
                new Row(
                    children: new List <Widget>()
                {
                    new Padding(
                        padding: EdgeInsets.symmetric(vertical: 10),
                        child: new Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: new List <Widget>()
                    {
                        new IconButton(icon: new Icon(Icons.arrow_back, size: 32, color: Theme.of(context).primaryColor),
                                       onPressed: () =>
                        {
                            Navigator.pop(context);
                        }),
                        mSaveButtonVisiable? saveButton as Widget: new Container() as Widget
                    }
                            )
                        ),
                }

                    ),
                //Titile
                new TextField(
                    maxLength: TEXTFILED_MAX_LENGTH,
                    style: new TextStyle(fontSize: 24),
                    controller: mTitleController,
                    decoration: new InputDecoration(
                        filled: true,
                        fillColor: Colors.white,
                        hintText: "Task Title",
                        contentPadding: EdgeInsets.only(10, 2, 10, 2)
                        ),
                    onChanged: (text =>
                {
                    var needShowSaveButton = text.Trim().Length > 0;
                    if (needShowSaveButton != mSaveButtonVisiable)
                    {
                        setState(() => { mSaveButtonVisiable = needShowSaveButton; });
                    }
                })
                    ),
                //Description
                new TextField(
                    maxLines: 5,
                    controller: mDescriptionController,
                    keyboardType: TextInputType.multiline,
                    style: new TextStyle(fontSize: 18),
                    decoration: new InputDecoration(
                        border: InputBorder.none,
                        filled: true,
                        fillColor: Colors.white,
                        hintText: "Description",
                        contentPadding: EdgeInsets.only(10, 2, 10, 2)
                        )
                    )
            }
                               )


                           )

                       ));
        }
 private static CustomAttribute Cast(Navigator n)
 {
     return((CustomAttribute)n.Current);
 }