Beispiel #1
0
 private void RunToNearestPortal(GhostBlackboard blackboard)
 {
     if (blackboard.NearPortals.Any())
     {
         WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, BotUtils.MoveAhead(WowInterface.Player.Position, blackboard.NearPortals.OrderBy(e => e.Position.GetDistance(WowInterface.Player.Position)).First().Position, 4f));
     }
 }
Beispiel #2
0
        private BehaviorTreeStatus RunToCorpsePositionAndSearchForPortals(GhostBlackboard blackboard)
        {
            Vector3 upliftedPosition = blackboard.CorpsePosition;

            upliftedPosition.Z = 0f;
            return(RunToAndExecute(upliftedPosition, () => RunToNearestPortal(blackboard)));
        }
Beispiel #3
0
        private BehaviorTreeStatus FollowNearestUnit(GhostBlackboard blackboard)
        {
            WowPlayer player = blackboard.PlayerToFollow;

            if (WowInterface.Player.Position.GetDistance(player.Position) > Config.MinFollowDistance)
            {
                WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, player.Position);
            }

            return(BehaviorTreeStatus.Ongoing);
        }
Beispiel #4
0
 private BehaviorTreeStatus RunToCorpseAndRetrieveIt(GhostBlackboard blackboard)
 {
     if (WowInterface.Player.Position.GetDistance(blackboard.CorpsePosition) > Config.GhostResurrectThreshold)
     {
         WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, blackboard.CorpsePosition);
         return(BehaviorTreeStatus.Ongoing);
     }
     else
     {
         WowInterface.HookManager.LuaRetrieveCorpse();
         return(BehaviorTreeStatus.Success);
     }
 }
Beispiel #5
0
        public StateGhost(AmeisenBotStateMachine stateMachine, AmeisenBotConfig config, WowInterface wowInterface) : base(stateMachine, config, wowInterface)
        {
            Blackboard = new GhostBlackboard(wowInterface);

            DungeonSelector = new Selector <GhostBlackboard>
                              (
                (b) => Config.DungeonUsePartyMode,
                new Selector <GhostBlackboard>
                (
                    (b) => WowInterface.DungeonEngine.TryGetProfileByMapId(StateMachine.LastDiedMap) != null,
                    new Leaf <GhostBlackboard>(RunToDungeonProfileEntry),
                    new Selector <GhostBlackboard>
                    (
                        (b) => IsUnitToFollowNear(out b.playerToFollowGuid),
                        new Leaf <GhostBlackboard>(FollowNearestUnit),
                        new Leaf <GhostBlackboard>(RunToCorpsePositionAndSearchForPortals)
                    )
                ),
                new Selector <GhostBlackboard>
                (
                    (b) => WowInterface.DungeonEngine.DeathEntrancePosition != default,
                    new Leaf <GhostBlackboard>(RunToDungeonEntry),
                    new Leaf <GhostBlackboard>(RunToCorpsePositionAndSearchForPortals)
                )
                              );

            BehaviorTree = new AmeisenBotBehaviorTree <GhostBlackboard>
                           (
                new Selector <GhostBlackboard>
                (
                    (b) => WowInterface.ObjectManager.MapId.IsBattlegroundMap(),
                    new Leaf <GhostBlackboard>((b) =>
            {
                WowInterface.MovementEngine.StopMovement();
                return(BehaviorTreeStatus.Ongoing);
            }),
                    new Selector <GhostBlackboard>
                    (
                        (b) => StateMachine.LastDiedMap.IsDungeonMap(),
                        DungeonSelector,
                        new Leaf <GhostBlackboard>(RunToCorpseAndRetrieveIt)
                    )
                ),
                Blackboard,
                TimeSpan.FromSeconds(1)
                           );
        }
Beispiel #6
0
        private BehaviorTreeStatus RunToDungeonProfileEntry(GhostBlackboard blackboard)
        {
            Vector3 position = WowInterface.DungeonEngine.TryGetProfileByMapId(StateMachine.LastDiedMap).WorldEntry;

            return(RunToAndExecute(position, () => RunToNearestPortal(blackboard)));
        }
Beispiel #7
0
 private BehaviorTreeStatus RunToDungeonEntry(GhostBlackboard blackboard)
 {
     return(RunToAndExecute(WowInterface.DungeonEngine.DeathEntrancePosition, () => RunToNearestPortal(blackboard)));
 }
Beispiel #8
0
 public override void Enter()
 {
     Blackboard = new GhostBlackboard(WowInterface);
 }