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)); } }
private BehaviorTreeStatus RunToCorpsePositionAndSearchForPortals(GhostBlackboard blackboard) { Vector3 upliftedPosition = blackboard.CorpsePosition; upliftedPosition.Z = 0f; return(RunToAndExecute(upliftedPosition, () => RunToNearestPortal(blackboard))); }
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); }
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); } }
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) ); }
private BehaviorTreeStatus RunToDungeonProfileEntry(GhostBlackboard blackboard) { Vector3 position = WowInterface.DungeonEngine.TryGetProfileByMapId(StateMachine.LastDiedMap).WorldEntry; return(RunToAndExecute(position, () => RunToNearestPortal(blackboard))); }
private BehaviorTreeStatus RunToDungeonEntry(GhostBlackboard blackboard) { return(RunToAndExecute(WowInterface.DungeonEngine.DeathEntrancePosition, () => RunToNearestPortal(blackboard))); }
public override void Enter() { Blackboard = new GhostBlackboard(WowInterface); }