Пример #1
0
        protected void AppendQuestRequirements(Quest quest, QuestLister lister)
        {
            if (quest.HasQuestRequirements() == false)
            {
                return;
            }

            body += "<h2>Quest requirements:</h2>";
            body += "<br>";

            int quest_count = 0;

            quest.ListRequiredQuests(s =>
            {
                int indent = 0;
                foreach (char c in s)
                {
                    if (c == '\t')
                    {
                        indent += 17;
                    }
                }

                string label_id   = "quest_input_" + quest_count;
                string quest_name = s;
                quest_name        = quest_name.Replace("\t", "");
                quest_name        = quest_name.Replace("\n", "");
                body +=
                    "<span id='quest' style='margin-left: " + indent + "px'>" +
                    "<input type='checkbox' id='" + label_id + "'> " +
                    "<label for='" + label_id + "'>" + s + "</label> <a href='" + lister.GetFullQuestURL(quest_name) + "'>[wiki]</a>" +
                    "</span><br>";

                ++quest_count;
            });

            if (quest.HasQuestPointRequirements() == true)
            {
                body += "<h2>Quest points:</h2>";
                body += "<ul>";

                foreach (KeyValuePair <string, int> qp in quest.GetQuestPointRequirements())
                {
                    body += "<li>" + qp.Key + " (<b>" + qp.Value + "</b>) <a href='" + lister.GetFullQuestURL(qp.Key) + "'>[wiki]</a></li>";
                }

                body += "</ul>";
            }
        }
Пример #2
0
        public HTMLOutput(Quest quest, QuestLister lister)
        {
            body += "<!DOCTYPE HTML>";
            body += "<head>";
            body += "<title>Quest Planner</title>";
            body +=
                "<style>" +
                "*{ font-family: Verdana; }" +
                "body{ background-color: gainsboro; }" +
                "#quest{ border-left: 1px solid black; padding-left: 5px; } " +
                "#skill{ background-color: antiquewhite; border: 1px solid black; padding: 5px; min-width: 256px; }" +
                "label{ cursor: pointer; }" +
                "label:hover{ color: blue; }" +
                "h2{ color: darkred; }" +
                "a{ font-size: 10pt; color: red; }" +
                "a:visited { font-size: 10pt; color: brown; }" +
                "#excerpt{ color: gray; font-size: 11pt; }" +
                "</style>";
            body += "</head>";
            body += "<body>";

            string name = quest.GetName();

            body += "<h1 style='color: brown'>" + name + " <a href='" + lister.GetFullQuestURL(name) + "'>[wiki]</a></h1>";


            if (quest.HasAnyRequirements() == false)
            {
                body += "<h2>This quest has no requirements, go to the starting location to begin the quest!</h2>";
            }
            else
            {
                AppendQuestRequirements(quest, lister);
                AppendSkillRequirements(quest);
                AppendMiscRequirements(quest);
            }

            body +=
                "<hr><br><span id='excerpt'>" +
                "Thank you for using this tool!<br>" +
                "There might be edge-cases that I did not handle, thus I do not provide any guarantee that all required information is there.<br>" +
                "A known issue, for instance, is that miniquest linking does not function properly.<br><br>Enjoy your quests!<br><br>" +
                "- Plague Cow<br>" +
                "</span>";

            body += "</body>";
        }
Пример #3
0
        static int Main(string[] args)
        {
            QuestLister lister = new QuestLister(@"https://runescape.wiki/w/List_of_quests");

            lister.ListAvailableQuests();
            int quest_count = lister.GetQuestCount();

            Console.WriteLine("==============================================\n");

            Random r = new Random();

            Console.WriteLine("Would you like random quests? Press 'R'. If using the quest planner as usual; press any other key\n");
            if (Console.ReadKey(true).Key == ConsoleKey.R)
            {
                Console.WriteLine("\n--------------------------------------------------------------------------------------------------");
                Console.WriteLine("\n  Randomizer mode (Press any key, except 'Q' to generate a new random quest. Type 'Q' to exit)\n");
                Console.WriteLine("--------------------------------------------------------------------------------------------------\n");
                while (Console.ReadKey(true).Key != ConsoleKey.Q)
                {
                    double random_number = r.NextDouble();
                    int    random_index  = (int)Math.Floor(random_number * (double)quest_count);

                    Console.WriteLine("Random quest: {0}", lister.GetQuestName(random_index));
                }

                return(0);
            }

            Console.WriteLine("\n--------------------------------------------------------------------------------------------------");
            Console.WriteLine("\n  Planner mode\n");
            Console.WriteLine("--------------------------------------------------------------------------------------------------\n");

#if TEST_ALL_QUESTS
            Console.WriteLine("===============[Test]===============");

            for (int i = 0; i < quest_count; ++i)
            {
                Console.WriteLine("\n> Showing requirements for '{0}', This might take a short time..\n", lister.GetQuestName(i));
                Quest chosen_quest = new Quest(lister.GetFullQuestURL(i));
            }

            Console.WriteLine("===============[/Test]===============");
#endif

            while (true)
            {
                Console.WriteLine("==============================================\n");
                Console.WriteLine("Please choose a quest to list the requirements of, or type 'exit' to quit:\n");

                string input = Console.ReadLine();

                if (input == "exit")
                {
                    break;
                }

                int chosen = 0;
                if (int.TryParse(input, out chosen))
                {
                    chosen -= 1;
                    if (chosen < 0 || chosen >= quest_count)
                    {
                        Console.WriteLine("Invalid input, the valid options are 1 to {0}", quest_count);
                        continue;
                    }

                    Console.WriteLine("\n> Showing requirements for '{0}', This might take a short time..\n", lister.GetQuestName(chosen));
                    Quest chosen_quest = new Quest(lister.GetFullQuestURL(chosen));

                    HTMLOutput output = new HTMLOutput(chosen_quest, lister);
                    output.Show();

                    Console.WriteLine("\n> ..Done!\n", lister.GetQuestName(chosen));
                }
                else
                {
                    Console.WriteLine("Invalid input, only numbers are allowed to navigate to a quest");
                }
            }

            return(0);
        }