예제 #1
0
        private static bool UpdateOriginalHook(string hookName, Action <Composite> updater)
        {
            if (!OriginalHooks.ContainsKey(hookName))
            {
                return(false);
            }

            updater(OriginalHooks[hookName]);
            return(true);
        }
예제 #2
0
 protected override Composite CreateBehavior()
 {
     var children=new Composite[2];
     var compositeArray=new Composite[2];
     compositeArray[0]=new Action(new ActionSucceedDelegate(FlagTagAsCompleted));
     children[0]=new Decorator(CheckDistanceWithinPathPrecision, new Sequence(compositeArray));
     ActionDelegate actionDelegateMove=GilesMoveToLocation;
     var sequenceblank=new Sequence(
         new Action(actionDelegateMove)
         );
     children[1]=sequenceblank;
     return new PrioritySelector(children);
 }
예제 #3
0
        protected override Composite CreateBehavior()
        {
            Composite[] children=new Composite[2];

            ActionDelegate actionDelegateCast=new ActionDelegate(Funky.FunkyTPBehavior);
            Sequence sequenceblank=new Sequence(
                new Zeta.TreeSharp.Action(actionDelegateCast)
                );

            children[0]=new Zeta.TreeSharp.Decorator(new CanRunDecoratorDelegate(Funky.FunkyTPOverlord), sequenceblank);
            children[1]=new Zeta.TreeSharp.Action(new ActionSucceedDelegate(FlagTagAsCompleted));

            return new PrioritySelector(children);
        }
예제 #4
0
        protected override Composite CreateBehavior()
        {
            Composite[] children       = new Composite[2];
            Composite[] compositeArray = new Composite[2];
            compositeArray[0] = new Zeta.TreeSharp.Action(new ActionSucceedDelegate(FlagTagAsCompleted));
            children[0]       = new Zeta.TreeSharp.Decorator(new CanRunDecoratorDelegate(CheckDistanceWithinPathPrecision), new Sequence(compositeArray));
            ActionDelegate actionDelegateMove = new ActionDelegate(GilesMoveToLocation);
            Sequence       sequenceblank      = new Sequence(
                new Zeta.TreeSharp.Action(actionDelegateMove)
                );

            children[1] = sequenceblank;
            return(new PrioritySelector(children));
        }
예제 #5
0
        protected override Composite CreateBehavior()
        {
            var children       = new Composite[2];
            var compositeArray = new Composite[2];

            compositeArray[0] = new Action(new ActionSucceedDelegate(FlagTagAsCompleted));
            children[0]       = new Decorator(CheckDistanceWithinPathPrecision, new Sequence(compositeArray));
            ActionDelegate actionDelegateMove = GilesMoveToLocation;
            var            sequenceblank      = new Sequence(
                new Action(actionDelegateMove)
                );

            children[1] = sequenceblank;
            return(new PrioritySelector(children));
        }
예제 #6
0
파일: GenericCombat.cs 프로젝트: ipo/AGBA
 public Composite GenerateMoveToTargetBehavior()
 {
     var Behavior = new PrioritySelector();
     var MoveToMob = new Action(delegate(object context)
                                    {
                                        if (_context.CurrentTarget == null) return;
                                        if (_context.CurrentTarget.GetNativeObject() == null) return;
                                        Vector3 position = _context.CurrentTarget.GetPosition();
                                        BotManager.Legs.Walk(position.X, position.Y);
                                    });
     Behavior.AddChild(MoveToMob);
     Behavior.AddChild(new Sleep(200));
     return Behavior;
 }
예제 #7
0
파일: GenericCombat.cs 프로젝트: ipo/AGBA
        public Composite GenerateCheckAvailableTargetsBehavior(float range)
        {
            var checkAvailableTargetsBehavior = new Action(
                delegate(object context)
                    {
                        if (_context.CurrentTarget == null) return RunStatus.Success;
                        if (_context.CurrentTarget.GetNativeObject() == null) return RunStatus.Success;
                        try
                        {
                            if (_context.CurrentTarget.getDistance() >= range) return RunStatus.Success;
                        }
                        catch (Exception e)
                        {
                            return RunStatus.Success;
                        }
                        _context.IsActive = true;
                        context = _context;

                        return RunStatus.Failure;
                    });

            return checkAvailableTargetsBehavior;
        }
예제 #8
0
 protected override Composite CreateBehavior()
 {
     //Funky.hashSkipAheadAreaCache=new HashSet<Funky.SkipAheadNavigation>();
     Composite[] children=new Composite[2];
     Composite[] compositeArray=new Composite[2];
     compositeArray[0]=new Zeta.TreeSharp.Action(new ActionSucceedDelegate(FlagTagAsCompleted));
     children[0]=new Zeta.TreeSharp.Decorator(new CanRunDecoratorDelegate(CheckDistanceWithinPathPrecision), new Sequence(compositeArray));
     ActionDelegate actionDelegateMove=new ActionDelegate(GilesMoveToLocation);
     Sequence sequenceblank=new Sequence(
         new Zeta.TreeSharp.Action(actionDelegateMove)
         );
     children[1]=sequenceblank;
     return new PrioritySelector(children);
 }
예제 #9
0
        internal static void HookBehaviorTree()
        {
            Logger.DBLog.InfoFormat("[Funky] Treehooks..");
            #region TreeHooks

            #region OutOfGame
            CanRunDecoratorDelegate shouldPreformOutOfGameBehavior = OutOfGame.OutOfGameOverlord;
            ActionDelegate          actionDelgateOOGBehavior       = OutOfGame.OutOfGameBehavior;
            Sequence sequenceOOG = new Sequence(
                new Action(actionDelgateOOGBehavior)
                );
            var OutOfGameInsert = new Decorator(shouldPreformOutOfGameBehavior, sequenceOOG);
            SetHookValue(HookType.OutOfGame, 0, OutOfGameInsert, true);
            Logger.DBLog.DebugFormat("Out of game tree hooked");
            #endregion

            #region Death
            Logger.DBLog.DebugFormat("Death...");
            //Insert Death Tally Counter At Beginning!
            CanRunDecoratorDelegate deathTallyDecoratorDelegate    = DeathBehavior.TallyDeathCanRunDecorator;
            ActionDelegate          actionDelegatedeathTallyAction = DeathBehavior.TallyDeathAction;
            Action    deathTallyAction    = new Action(actionDelegatedeathTallyAction);
            Decorator deathTallyDecorator = new Decorator(deathTallyDecoratorDelegate, deathTallyAction);

            //Death Wait..
            CanRunDecoratorDelegate deathWaitDecoratorDelegate = DeathBehavior.DeathShouldWait;
            ActionDelegate          deathWaitActionDelegate    = DeathBehavior.DeathWaitAction;
            Action    deathWaitAction    = new Action(deathWaitActionDelegate);
            Decorator deathWaitDecorator = new Decorator(deathWaitDecoratorDelegate, deathWaitAction);


            Sequence DeathSequence = new Sequence
                                     (
                deathTallyDecorator,
                deathWaitDecorator
                                     );
            SetHookValue(HookType.Death, 0, DeathSequence, true);
            //hook.Value.Add(deathTallyActionReset);
            Logger.DBLog.DebugFormat("Death tree hooked");
            #endregion


            if (RoutineManager.Current.Name == "Funky")
            {
                CanRunDecoratorDelegate canRunDelegateCombatTargetCheck = CombatHandler.GlobalOverlord;
                ActionDelegate          actionDelegateCoreTarget        = CombatHandler.HandleTarget;
                Sequence sequencecombat = new Sequence
                                          (
                    new Action(actionDelegateCoreTarget)
                                          );
                var NewCombatComposite = new Decorator(canRunDelegateCombatTargetCheck, sequencecombat);
                SetHookValue(HookType.Combat, 0, NewCombatComposite);

                CanRunDecoratorDelegate canRunDelegateBlank = BlankDecorator;
                ActionDelegate          actionDelegateBlank = BlankAction;
                Sequence sequenceblank = new Sequence(
                    new Action(actionDelegateBlank)
                    );

                var NewLootComposite = new Decorator(canRunDelegateBlank, sequenceblank);
                SetHookValue(HookType.Loot, 0, NewLootComposite);
            }

            #endregion

            initTreeHooks = true;
        }
예제 #10
0
파일: Vendoring.cs 프로젝트: ipo/AGBA
        public Composite GenerateTownPortalBehavior()
        {
            CanRunDecoratorDelegate InTown = delegate
                                                 {
                                                     bool timeOut = (_lastTP + TPTimer < Environment.TickCount);
                if (ZetaDia.Me == null) return false;
                if (!ZetaWrap.IsInTown() && (ZetaDia.Me.CommonData.AnimationState != AnimationState.Channeling || timeOut))
                {
                    _lastTP = Environment.TickCount;
                    return true;
                }
                return false;
            };

            var pSequence = new Sequence();
            var PortHome = new Action(delegate
            {
                ZetaDia.Me.UseTownPortal();
                return RunStatus.Success;
            });
            pSequence.AddChild(PortHome);
            return new DecoratorContinue(InTown, PortHome);
        }
예제 #11
0
        internal static void HookBehaviorTree()
        {
            Logger.DBLog.InfoFormat("[Funky] Treehooks..");
            #region TreeHooks

            #region OutOfGame
            CanRunDecoratorDelegate shouldPreformOutOfGameBehavior = OutOfGame.OutOfGameOverlord;
            ActionDelegate actionDelgateOOGBehavior = OutOfGame.OutOfGameBehavior;
            Sequence sequenceOOG = new Sequence(
                    new Action(actionDelgateOOGBehavior)
            );
            var OutOfGameInsert = new Decorator(shouldPreformOutOfGameBehavior, sequenceOOG);
            SetHookValue(HookType.OutOfGame, 0, OutOfGameInsert, true);
            Logger.DBLog.DebugFormat("Out of game tree hooked");
            #endregion

            #region Death
            Logger.DBLog.DebugFormat("Death...");
            //Insert Death Tally Counter At Beginning!
            CanRunDecoratorDelegate deathTallyDecoratorDelegate = DeathBehavior.TallyDeathCanRunDecorator;
            ActionDelegate actionDelegatedeathTallyAction = DeathBehavior.TallyDeathAction;
            Action deathTallyAction = new Action(actionDelegatedeathTallyAction);
            Decorator deathTallyDecorator = new Decorator(deathTallyDecoratorDelegate, deathTallyAction);

            //Death Wait..
            CanRunDecoratorDelegate deathWaitDecoratorDelegate = DeathBehavior.DeathShouldWait;
            ActionDelegate deathWaitActionDelegate = DeathBehavior.DeathWaitAction;
            Action deathWaitAction = new Action(deathWaitActionDelegate);
            Decorator deathWaitDecorator = new Decorator(deathWaitDecoratorDelegate, deathWaitAction);

            Sequence DeathSequence = new Sequence
            (
                deathTallyDecorator,
                deathWaitDecorator
            );
            SetHookValue(HookType.Death, 0, DeathSequence, true);
            //hook.Value.Add(deathTallyActionReset);
            Logger.DBLog.DebugFormat("Death tree hooked");
            #endregion

            if (RoutineManager.Current.Name == "Funky")
            {
                CanRunDecoratorDelegate canRunDelegateCombatTargetCheck = CombatHandler.GlobalOverlord;
                ActionDelegate actionDelegateCoreTarget = CombatHandler.HandleTarget;
                Sequence sequencecombat = new Sequence
                (
                    new Action(actionDelegateCoreTarget)
                );
                var NewCombatComposite = new Decorator(canRunDelegateCombatTargetCheck, sequencecombat);
                SetHookValue(HookType.Combat, 0, NewCombatComposite);

                CanRunDecoratorDelegate canRunDelegateBlank = BlankDecorator;
                ActionDelegate actionDelegateBlank = BlankAction;
                Sequence sequenceblank = new Sequence(
                        new Action(actionDelegateBlank)
                        );

                var NewLootComposite = new Decorator(canRunDelegateBlank, sequenceblank);
                SetHookValue(HookType.Loot, 0, NewLootComposite);
            }

            #endregion

            initTreeHooks = true;
        }