コード例 #1
0
        public override bool StartMethod()
        {
            BotBehaviorQueue.Queue(new QueueItem
            {
                Condition = ret => ScriptManager.GetCondition(Condition).Invoke(),
                Name      = Name ?? Condition,
                Nodes     = Body,
            });

            return(true);
        }
コード例 #2
0
        public override bool GetConditionExec()
        {
            if (QuestTools.EnableDebugLogging)
            {
                Logger.Log("Initializing '{0}' with condition={1}", Name, Condition);
            }

            BotBehaviorQueue.Queue(new QueueItem
            {
                Condition = ret => ScriptManager.GetCondition(Condition).Invoke(),
                Name      = Name,
                Nodes     = Body,
                Persist   = Persist,
                Repeat    = Repeat,
            });

            return(false);
        }
コード例 #3
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);
        }