Exemplo n.º 1
0
        private async Task MainMenu()
        {
            TreeRoot.StatusText = "Running Main Menu";
            if (PartyManager.IsInParty && PartyManager.IsPartyLeader)
            {
                if (!IsCrossRealm)
                {
                    Logger.Warn("I am a Party Leader, waiting for everyone to join the zone.");
                    await Coroutine.Wait(TimeSpan.FromMinutes(30), PartyLeaderWaitConditions);
                }
                else
                {
                    Logger.Warn("I am a Party Leader in a XRealm Party. I assume everyone is in the zone.");
                }

                if (DeepDungeon.StopPlz)
                {
                    return;
                }

                Logger.Warn("Everyone is now in the zone");
                for (var i = 0; i < 6; i++)
                {
                    Logger.Warn("Giving them {0} seconds to do what they need to at the NPC", 60 - i * 10);
                    await Coroutine.Sleep(TimeSpan.FromSeconds(10));

                    if (DeepDungeon.StopPlz)
                    {
                        return;
                    }
                }
            }

            //read the current level state
            await ReadStartingLevel();

            // have save data and our max level is
            if (GetFloorStatus(_saveStates))
            {
                Logger.Verbose("Resetting the floor");
                await DeepDungeonSaveData.ClickReset(UseSaveSlot);

                // todo: wait for server response in a better way.
                await Coroutine.Sleep(1000);
            }

            if (_error)
            {
                lock (_errorLock)
                {
                    _error = false;
                }
            }


            if (!PartyManager.IsInParty || PartyManager.IsPartyLeader)
            {
                Logger.Verbose("Starting Save Slot Selection process");

                await DeepDungeonSaveData.ClickSaveSlot(UseSaveSlot);

                await Coroutine.Wait(2000, () => SelectString.IsOpen || ContentsFinderConfirm.IsOpen || SelectYesno.IsOpen);

                // if select yesno is open (new as of 4.36 hotfixes)
                if (SelectYesno.IsOpen)
                {
                    SelectYesno.ClickYes();
                    await Coroutine.Sleep(1000);
                }

                // if we are using an "empty" save slot
                if (SelectString.IsOpen)
                {
                    Logger.Verbose("Using Empty Save Slot");
                    Logger.Verbose("Going through the Talk dialogs...");

                    await Coroutine.Sleep(1000);

                    SelectString.ClickSlot(0);

                    await Coroutine.Sleep(1000);

                    //                    Logger.Verbose("Are you sure Fixed Party");
                    await Coroutine.Wait(1000, () => SelectYesno.IsOpen);

                    await Coroutine.Sleep(150);

                    if (SelectYesno.IsOpen)
                    {
                        SelectYesno.ClickYes();
                        await Coroutine.Sleep(150);
                    }

                    await Coroutine.Sleep(1000);

                    //-- Are you sure you want to enter alone?
                    if (!PartyManager.IsInParty)
                    {
                        //                        Logger.Verbose("Enter Alone Talk");
                        //talk stuff
                        await Coroutine.Wait(1000, () => Talk.DialogOpen);

                        await Coroutine.Sleep(150);

                        Talk.Next();

                        await Coroutine.Sleep(500);

                        //                        Logger.Verbose("Enter Alone?");
                        await Coroutine.Wait(1000, () => SelectYesno.IsOpen);

                        SelectYesno.ClickYes();
                        await Coroutine.Sleep(1000);
                    }

                    //                    Logger.Verbose("Floor 51 wait");
                    //--floor 51 logic
                    await Coroutine.Wait(1000, () => SelectString.IsOpen || ContentsFinderConfirm.IsOpen);

                    if (SelectString.IsOpen)
                    {
                        await Coroutine.Sleep(1000);

                        if (Settings.Instance.StartAt51)
                        {
                            Logger.Verbose("Start at {1}: {0}", _bettertargetFloor.End > Constants.SelectedDungeon.CheckPointLevel - 1, Constants.SelectedDungeon.CheckPointLevel);
                        }

                        if (Settings.Instance.StartAt51 && _bettertargetFloor.End > Constants.SelectedDungeon.CheckPointLevel - 1)
                        {
                            SelectString.ClickSlot(1);
                        }
                        else
                        {
                            SelectString.ClickSlot(0);
                        }
                        await Coroutine.Sleep(1000);
                    }

                    Logger.Verbose("Done with window interaction.");
                }
                else
                {
                    Logger.Verbose($"ContentsFinderConfirm is open: {ContentsFinderConfirm.IsOpen} so we aren't going through the main menu.");
                }

                _bettertargetFloor = null;
            }

            Logger.Info("Waiting on the queue, Or for an error.");
            DungeonQueue.Reset();
        }
Exemplo n.º 2
0
        private async Task MainMenu()
        {
            TreeRoot.StatusText = "Running Main Menu";
            if (PartyManager.IsInParty)
            {
                Logger.Warn("I am in a party. I am waiting for everyone to join the zone.");
                await Coroutine.Wait(TimeSpan.FromMinutes(30), PartyLeaderWaitConditions);

                if (DeepDungeon.StopPlz)
                {
                    return;
                }
                if (PartyManager.IsPartyLeader)
                {
                    Logger.Warn("Everyone is now in the zone");
                    for (var i = 0; i < 6; i++)
                    {
                        Logger.Warn("Giving them {0} seconds to do what they need to at the NPC", 60 - i * 10);
                        await Coroutine.Sleep(TimeSpan.FromSeconds(10));

                        if (DeepDungeon.StopPlz)
                        {
                            return;
                        }
                    }
                }
            }
            //read the current level state
            await ReadStartingLevel();

            // have save data and our max level is
            if (GetFloorStatus(_aetherialLevels, _saveStates))
            {
                Logger.Verbose("Resetting the floor");
                await DeepDungeonSaveData.ClickReset(UseSaveSlot);

                _saveStates = Sd.SaveStates;
            }
            if (_error)
            {
                lock (_errorLock)
                    _error = false;
            }


            if (!PartyManager.IsInParty || PartyManager.IsPartyLeader)
            {
                await DeepDungeonSaveData.ClickSaveSlot(UseSaveSlot);

                // if we are using an "empty" save slot
                if (!_saveStates[UseSaveSlot].Saved)
                {
                    Logger.Verbose("Using Empty Save Slot");
                    Logger.Verbose("Going through the Talk dialogs...");
                    // -- Fixed Party --
                    await Coroutine.Sleep(1000);

                    await Coroutine.Wait(1000, () => SelectString.IsOpen);

                    SelectString.ClickSlot(0);

                    await Coroutine.Sleep(500);

                    //                    Logger.Verbose("Are you sure Fixed Party");
                    await Coroutine.Wait(1000, () => SelectYesno.IsOpen);

                    if (SelectYesno.IsOpen)
                    {
                        SelectYesno.ClickYes();
                    }

                    await Coroutine.Sleep(500);

                    //-- Are you sure you want to enter alone?
                    if (!PartyManager.IsInParty)
                    {
                        //                        Logger.Verbose("Enter Alone Talk");
                        //talk stuff
                        await Coroutine.Wait(1000, () => Talk.DialogOpen);

                        Talk.Next();

                        await Coroutine.Sleep(500);

                        //                        Logger.Verbose("Enter Alone?");
                        await Coroutine.Wait(1000, () => SelectYesno.IsOpen);

                        SelectYesno.ClickYes();
                        await Coroutine.Sleep(500);
                    }

                    //                    Logger.Verbose("Floor 51 wait");
                    //--floor 51 logic
                    await Coroutine.Wait(1000, () => SelectString.IsOpen || ContentsFinderConfirm.IsOpen);

                    if (SelectString.IsOpen)
                    {
                        await Coroutine.Sleep(500);

                        if (Settings.Instance.StartAt51)
                        {
                            Logger.Verbose("Start at 51: {0}", _targetFloor.LevelMax > 50);
                        }

                        if (Settings.Instance.StartAt51 && _targetFloor.LevelMax > 50)
                        {
                            SelectString.ClickSlot(1);
                        }
                        else
                        {
                            SelectString.ClickSlot(0);
                        }
                    }
                    Logger.Verbose("Done with window interaction.");
                }
                _targetFloor = null;
            }
            Logger.Info("Waiting on the queue, Or for an error.");
            DungeonQueue.Reset();
        }