Ejemplo n.º 1
0
        public static string CompleteQuest(List <string> strings)
        {
            if (Campaign.Current == null)
            {
                return("Campaign was not started.");
            }
            if (CampaignCheats.CheckParameters(strings, 0) || CampaignCheats.CheckHelp(strings))
            {
                return("Format is \"campaign.complete_active_quest [QuestName]\".");
            }
            string questName = string.Join(" ", strings.ToArray()).Trim(new char[]
            {
                '"'
            });
            QuestBase questBase = Campaign.Current.QuestManager.Quests.FirstOrDefault((QuestBase q) => q.Title.ToString().ToLower().Contains(questName.ToLower()));

            if (questBase == null)
            {
                return("Failed to find active quest with name \"" + questName + "\"");
            }
            MethodInfo method = questBase.GetType().GetMethod("CompleteQuestWithSuccess", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

            if (method == null)
            {
                return("Failed to locate method.");
            }
            method.Invoke(questBase, null);
            return(string.Format("{0} has been completed.", questBase.Title));
        }