Example #1
0
        private const int RiftPortalSNO = 345935; // X1_OpenWorld_LootRunPortal

        internal static bool ShouldFollowerOpenRift()
        {
            if (Player.IsGreaterRiftStarted)
            {
                return(false);
            }

            if (ZetaDia.WorldType != Act.OpenWorld)
            {
                return(false);
            }

            if (SimpleFollow.IsLeader)
            {
                // Current profile tag must be OpenRift / QTOpenRiftWrapper
                var currentBehavior = ProfileManager.CurrentProfileBehavior;
                if (currentBehavior != null && !currentBehavior.GetType().Name.Contains("OpenRift"))
                {
                    return(false);
                }

                if (!SimpleFollow.Followers.Any())
                {
                    return(false);
                }

                if (!SimpleFollow.Followers.Any(f => f.Value.HasRiftKeys))
                {
                    return(false);
                }
            }

            // In regular rift quests
            if (ConditionParser.IsActiveQuestAndStep(337492, 1) ||
                ConditionParser.IsActiveQuestAndStep(337492, 3) ||
                ConditionParser.IsActiveQuestAndStep(337492, 13) ||
                ConditionParser.IsActiveQuestAndStep(337492, 16))
            {
                return(false);
            }

            var portals = ZetaDia.Actors.GetActorsOfType <GizmoPortal>(true).Where(p => p.ActorSNO == RiftPortalSNO).ToList();

            if (portals.Any())
            {
                return(false);
            }

            var allFollowersConnected = SimpleFollow.Followers.Count == Social.NumPartyMembers - 1;

            Logr.Debug("Follower Count={0}, NumPartyMembers={1}", SimpleFollow.Followers.Count, Social.NumPartyMembers);
            Logr.Debug("HighestTeamRiftKey={0} HighestLevelTieredRiftKey={1}", SimpleFollow.Leader.HighestTeamRiftKey, SimpleFollow.Leader.HighestLevelTieredRiftKey);

            var result = allFollowersConnected && SimpleFollow.Leader.HighestTeamRiftKey <= SimpleFollow.Leader.HighestLevelTieredRiftKey;

            Logr.Debug("RequestFollowerOpenRift?={0}", result);
            return(result);
        }
Example #2
0
        private static async Task <bool> OpenRiftTask()
        {
            // Move to and use Greater Rift Portal
            if (ZetaDia.Me.IsParticipatingInTieredLootRun && ZetaDia.IsInTown && ZetaDia.CurrentLevelAreaId == (int)SNOLevelArea.x1_Westm_Hub &&
                ConditionParser.IsActiveQuestAndStep((int)SNOQuest.X1_LR_DungeonFinder, 13))
            {
                // [202EBD3C] GizmoType: Portal Name: X1_OpenWorld_Tiered_Rifts_Portal-5041 ActorSNO: 396751 Distance: 11.58544 Position: <606.84, 750.39, 2.53> Barracade: False Radius: 8.316568
                var moveToPortal = new MoveToActorTag
                {
                    QuestId       = (int)SNOQuest.X1_LR_DungeonFinder,
                    StepId        = 13,
                    ActorId       = GreaterRiftPortalSNO,
                    X             = 606,
                    Y             = 750,
                    Z             = 2,
                    IsPortal      = true,
                    InteractRange = 9,
                    Timeout       = 10
                };
                Logr.Log("Queueing MoveToActor for interacting with Greater Rift Portal");
                BotBehaviorQueue.Queue(moveToPortal,
                                       ret => ZetaDia.Me.IsParticipatingInTieredLootRun && ZetaDia.IsInTown && ZetaDia.CurrentLevelAreaId == (int)SNOLevelArea.x1_Westm_Hub &&
                                       !ConditionParser.IsActiveQuestAndStep(337492, 10));
                return(true);
            }

            if (!SimpleFollow.Leader.RequestOpenRift)
            {
                return(false);
            }

            if (HighestLevelTieredRiftKey > SimpleFollow.Leader.HighestTeamRiftKey)
            {
                return(false);
            }

            // In regular rift quests
            if (ConditionParser.IsActiveQuestAndStep(337492, 1) ||
                ConditionParser.IsActiveQuestAndStep(337492, 3) ||
                ConditionParser.IsActiveQuestAndStep(337492, 13) ||
                ConditionParser.IsActiveQuestAndStep(337492, 16))
            {
                return(false);
            }

            // In Rift Trial
            if (ZetaDia.ActInfo.ActiveQuests.Any(q => q.QuestSNO == (int)SNOQuest.p1_TieredRift_Challenge))
            {
                return(false);
            }

            // Our rift key is the lowest of the team, lets open a rift!

            var keyPriorityList = SimpleFollow.Leader.RiftKeyPriority;

            if (keyPriorityList.Count != 3)
            {
                throw new ArgumentOutOfRangeException("RiftKeyPriority", "Expected 3 Rift keys, API is broken?");
            }

            if (ZetaDia.Actors.GetActorsOfType <DiaObject>(true).Any(i => i.IsValid && i.ActorSNO == RiftPortalSNO))
            {
                Logr.Log("Rift Portal already open!");
                return(false);
            }

            if (!ZetaDia.IsInTown)
            {
                return(await CommonCoroutines.UseTownPortal("Going to town to open rift"));
            }

            bool needsGreaterKeys = !ZetaDia.Me.Inventory.Backpack.Any(i => IsRiftKey(i) && IsGreaterRiftKey(i)) &&
                                    ZetaDia.Me.Inventory.StashItems.Any(i => IsRiftKey(i) && IsGreaterRiftKey(i));
            bool needsTrialKeys = !ZetaDia.Me.Inventory.Backpack.Any(i => IsRiftKey(i) && IsTrialRiftKey(i)) &&
                                  ZetaDia.Me.Inventory.StashItems.Any(i => IsRiftKey(i) && IsTrialRiftKey(i));
            bool needsNormalKeys = !ZetaDia.Me.Inventory.Backpack.Any(i => IsRiftKey(i) && IsNormalKey(i)) &&
                                   ZetaDia.Me.Inventory.StashItems.Any(i => IsRiftKey(i) && IsNormalKey(i));

            if (needsGreaterKeys)
            {
                Logr.Log("Moving to stash to get Greater Rift Keys");
                BotBehaviorQueue.Queue(new GetItemFromStashTag {
                    GreaterRiftKey = true, StackCount = 1
                });
                return(true);
            }

            if (needsTrialKeys)
            {
                Logr.Log("Moving to stash to get Trial Rift Keys");
                BotBehaviorQueue.Queue(new GetItemFromStashTag {
                    ActorId = 408416, StackCount = 1
                });
                return(true);
            }

            if (needsNormalKeys)
            {
                Logr.Log("Moving to stash to get Rift Keys");
                BotBehaviorQueue.Queue(new GetItemFromStashTag {
                    ActorId = (int)SNOActor.LootRunKey, StackCount = 1
                });
                return(true);
            }

            int questStepId = 1;
            var quest       = ZetaDia.ActInfo.ActiveQuests.FirstOrDefault(q => q.QuestSNO == (int)SNOQuest.X1_LR_DungeonFinder);

            if (quest != null)
            {
                questStepId = quest.QuestStep;
            }

            if (ZetaDia.IsInTown && !ConditionParser.ActorExistsAt(RiftPortalSNO, 606, 750, 2, 50) && !ConditionParser.ActorExistsAt(GreaterRiftPortalSNO, 606, 750, 2, 50))
            {
                BotBehaviorQueue.Reset();
                Logr.Log("Queueing QTOpenRiftWrapper");
                BotBehaviorQueue.Queue(new QTOpenRiftWrapperTag());
                BotBehaviorQueue.Queue(new WaitTimerTag {
                    QuestId = 337492, StepId = questStepId, WaitTime = 2000
                });
                FollowTag.LastInteractTime = DateTime.Now.AddSeconds(15);
            }

            if (ZetaDia.IsInTown && ConditionParser.ActorExistsAt(RiftPortalSNO, 606, 750, 2, 50) && ConditionParser.IsActiveQuestAndStep(337492, questStepId))
            {
                Logr.Log("Queueing MoveToActor for Rift Portal");
                BotBehaviorQueue.Reset();
                BotBehaviorQueue.Queue(new MoveToActorTag {
                    QuestId = 337492, StepId = questStepId, ActorId = RiftPortalSNO, Timeout = 10
                });
                BotBehaviorQueue.Queue(new WaitTimerTag {
                    QuestId = 337492, StepId = questStepId, WaitTime = 2000
                });
                FollowTag.LastInteractTime = DateTime.Now.AddSeconds(15);
            }
            if (ZetaDia.IsInTown && ConditionParser.ActorExistsAt(GreaterRiftPortalSNO, 606, 750, 2, 50) && ConditionParser.IsActiveQuestAndStep(337492, questStepId))
            {
                Logr.Log("Queueing MoveToActor for Greater Rift Portal");
                BotBehaviorQueue.Reset();
                BotBehaviorQueue.Queue(new MoveToActorTag {
                    QuestId = 337492, StepId = questStepId, ActorId = GreaterRiftPortalSNO, Timeout = 10
                });
                BotBehaviorQueue.Queue(new WaitTimerTag {
                    QuestId = 337492, StepId = questStepId, WaitTime = 2000
                });
                FollowTag.LastInteractTime = DateTime.Now.AddSeconds(15);
            }
            return(true);
        }