my code stock.com

Andreas Spegel

PickUp Quest from Adventure Guide #2
by Andreas Spegel

Mit diesem Code kann man eine Quest aus den 2 anderen Fenster annehmen.

Snippet options

Download: Download snippet as pickup-quest-from-adventure-guide-2.cpp.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

        <!-- PickUp Quest from Adventure Guide -->
            <CustomBehavior File="RunCode" Type="Definition"><![CDATA[ 
                async Task PickUpQuestFromAdventureGuide(uint QuestID)
                {
                    Func <bool> HasQuest = () => StyxWoW.Me.QuestLog.GetQuestById((uint)QuestID) != null;
                    Func <bool> IsQuestCompleted = () => StyxWoW.Me.QuestLog.GetCompletedQuests().Contains((uint)QuestID);
                    if (HasQuest() || IsQuestCompleted() || QuestLog.Instance.IsFull) return;
                    Logging.Write(System.Windows.Media.Colors.Yellow, "[Profile]: Try to PickUp Quest from Adventure Guide! - QuestID: {0}", QuestID);
                    Lua.DoString("CloseAllWindows()"); // Close all open Windows
                    for (int i=2; i <= 3; i++) //Loop for every available Suggestion
                    {
                        if (HasQuest() || IsQuestCompleted()) return;
                        Lua.DoString("C_AdventureJournal.ActivateEntry('{0}')", i); // Activate/Click/Open the current Suggestion in Suggestions Window 1
                        await CommonCoroutines.SleepForRandomUiInteractionTime();  // Wait for delay (to Open Quest Window or not)
                        if (QuestFrame.Instance.IsVisible && QuestFrame.Instance.CurrentShownQuestId == QuestID)
                        {
                            QuestFrame.Instance.AcceptQuest();
                            await Coroutine.Wait(5000, HasQuest); // Wait for delay (to Quest appears in Log)
                            if (HasQuest())
                            {
                                Logging.Write(System.Windows.Media.Colors.Yellow, "[Profile]: PickUp Quest from Adventure Guide was successful! - QuestID: {0}", QuestID);
                                return;
                            }
                        }
                        Lua.DoString("CloseAllWindows()"); // Close all Windows
                    }
                    Logging.Write(System.Windows.Media.Colors.Yellow, "[Profile]: Try to PickUp Quest from Adventure Guide FAILED! Seems not Available (anymore) - QuestID: {0}", QuestID);
                } 
            ]]></CustomBehavior>
        <!-- PickUp Quest from Adventure Guide -->
        
        
        <!-- PickUp Quest from Adventure Guide -->   
            <CustomBehavior File="RunCode" Code="await PickUpQuestFromAdventureGuide(28549)" />
        <!-- PickUp Quest from Adventure Guide -->          

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.