예제 #1
0
        private void FollowNodePath(double completionDistance)
        {
            if (CurrentNodes.TryPeek(out DungeonNode node))
            {
                if (WowInterface.ObjectManager.Player.Position.GetDistance(node.Position) > completionDistance)
                {
                    WowInterface.MovementEngine.SetState(MovementEngineState.Moving, node.Position);
                    WowInterface.MovementEngine.Execute();
                }
                else
                {
                    DungeonNode dungeonNode = node;

                    if (dungeonNode.Type == Enums.DungeonNodeType.Door ||
                        dungeonNode.Type == Enums.DungeonNodeType.Collect ||
                        dungeonNode.Type == Enums.DungeonNodeType.Use)
                    {
                        WowGameobject obj = WowInterface.ObjectManager.WowObjects.OfType <WowGameobject>()
                                            .OrderBy(e => e.Position.GetDistance(dungeonNode.Position))
                                            .FirstOrDefault();

                        if (obj != null && obj.Position.GetDistance(WowInterface.ObjectManager.Player.Position) < completionDistance)
                        {
                            WowInterface.HookManager.WowObjectOnRightClick(obj);
                        }
                    }

                    if (CurrentNodes.TryDequeue(out DungeonNode completedNode))
                    {
                        CompletedNodes.Add(completedNode);
                        Progress = Math.Round(CompletedNodes.Count / (double)TotalNodes * 100.0);
                    }
                }
            }
        }
예제 #2
0
        public void Execute()
        {
            if (!HasFinishedDungeon && DungeonProfile != null && CurrentNodes.Count > 0)
            {
                // we are fighting
                if ((WowInterface.ObjectManager.Player.IsInCombat && StateMachine.IsAnyPartymemberInCombat()) ||
                    WowInterface.ObjectManager.Player.IsCasting)
                {
                    return;
                }

                if (Progress == 100.0)
                {
                    // exit dungeon
                    HasFinishedDungeon = true;
                    return;
                }

                // wait for all players to arrive
                if (!AllPlayersArrived)
                {
                    AllPlayersArrived = AreAllPlayersPresent();
                }
                else
                {
                    if (!ShouldWaitForGroup())
                    {
                        if (WowInterface.ObjectManager.Player.Position.GetDistance(CurrentNodes.Peek().Position) > 5)
                        {
                            WowInterface.MovementEngine.SetState(MovementEngineState.Moving, CurrentNodes.Peek().Position);
                            WowInterface.MovementEngine.Execute();
                            return;
                        }
                        else
                        {
                            DungeonNode dungeonNode = CurrentNodes.Peek();

                            if (dungeonNode.Type == Enums.DungeonNodeType.Door ||
                                dungeonNode.Type == Enums.DungeonNodeType.Collect ||
                                dungeonNode.Type == Enums.DungeonNodeType.Use)
                            {
                                WowGameobject obj = WowInterface.ObjectManager.WowObjects.OfType <WowGameobject>()
                                                    .OrderBy(e => e.Position.GetDistance(dungeonNode.Position))
                                                    .FirstOrDefault();

                                if (obj != null && obj.Position.GetDistance(WowInterface.ObjectManager.Player.Position) < 5)
                                {
                                    WowInterface.CharacterManager.InteractWithObject(obj);
                                }
                            }

                            CompletedNodes.Add(CurrentNodes.Dequeue());
                            Progress           = ((double)CompletedNodes.Count / (double)TotalNodes) * 100;
                            HasFinishedDungeon = Progress >= 100.0;
                        }
                    }
                }
            }
            else if (!HasFinishedDungeon && DungeonProfile == null && CurrentNodes.Count == 0)
            {
                LoadProfile(TryLoadProfile());
            }
            else
            {
                // find a way to exit the dungeon, maybe hearthstone
            }
        }