Wikia

WoWWiki

KitanBot/Completed Tasks/Questlong

Talk0
102,216pages on
this wiki

< User:KitanBot | Completed Tasks

Overview Edit

Completed: 4/14/2007
Run Time: ~30 min
Page Count: ~60


Task Edit

There is a Bot Request to deprecate {{questtb}} for {{questlong}}.

Issues Edit

  • This technically created some broken links for quests we didn't have but that we had the Thott ID for. Concensus from IRC was that that was fine.

Algorithm Edit

namespace WikiUpdateAlgorithm
{
    public class WikiUpdateAlgorithmQuestlong : IWikiUpdaterAlgorithm
    {
        public string UpdateWiki(string CurrentWiki)
        {
            //Objects Required
            string SearchWiki = CurrentWiki.ToLower();
            StringBuilder Current = new StringBuilder(CurrentWiki);
            Dictionary<string, string> Replacements = new Dictionary<string, string>();

            //Primatives
            string Template = "{{questtb";
            int Position;
            int EndPosition;
            bool Continue;
            int StartQuestNumPos;
            int EndQuestNumPos;
            string[] QuestInfo;

            Position = 0;
            Continue = true;

            while (Continue)
            {
                Position = SearchWiki.IndexOf(Template, Position);
                EndPosition = 0;

                if (Position >= 0)
                {
                    EndPosition = SearchWiki.IndexOf("}}", Position);

                    if (EndPosition > 0)
                    {
                        QuestInfo = CurrentWiki.Substring(Position, EndPosition - Position).Split('|');

                        if (!Replacements.ContainsKey(CurrentWiki.Substring(Position, EndPosition + 2 - Position)))
                        {
                            Replacements.Add(CurrentWiki.Substring(Position, EndPosition + 2 - Position), "{{Questlong|" + QuestInfo[1] + "|" + QuestInfo[2] + "|" + QuestInfo[3] + "}}");
                        }
                    }
                    Position = EndPosition;
                }
                else
                {
                    Continue = false;
                }
            }

            foreach (KeyValuePair<string, string> Replacement in Replacements)
            {
                Current.Replace(Replacement.Key, Replacement.Value);
            }

            return Current.ToString();
        }
        /// <summary>
        /// Summary of the update
        /// </summary>
        /// <returns>String</returns>
        public string UpdateSummary()
        {
            return "Update page from {{questtb}} to {{questlong}}.";
        }
    }
}

Around Wikia's network

Random Wiki