protected virtual bool DoQuestAbandon(string rawParameters, params CommandParameter[] parameters) { if (parameters.Length == 0) { Send("Abandon which quest?"); return(true); } int id = parameters[0].AsNumber; IQuest quest = id > 0 ? Quests.ElementAtOrDefault(id - 1) : null; if (quest == null) { Send("No such quest."); return(true); } AbandonQuest(quest); return(true); }
protected virtual bool DoQuests(string rawParameters, params CommandParameter[] parameters) { if (parameters.Length == 0) { StringBuilder sb = new StringBuilder(); sb.AppendLine("Quests:"); if (!Quests.Any()) { sb.AppendLine("None."); } else { int id = 0; foreach (IQuest quest in Quests) { sb.Append(BuildQuestSummary(quest, id)); id++; } } Page(sb); } else { int id = parameters[0].AsNumber; IQuest quest = id > 0 ? Quests.ElementAtOrDefault(id - 1) : null; // index starts at 0 if (quest == null) { Send("No such quest."); return(true); } StringBuilder sb = new StringBuilder(); sb.AppendFormatLine($"{quest.Blueprint.Title}: {(quest.IsCompleted ? "%g%complete%x%" : "in progress")}"); sb.AppendLine(quest.Blueprint.Description); sb.Append(BuildQuestObjectives(quest)); Page(sb); } return(true); }
protected virtual bool DoQuestComplete(string rawParameters, params CommandParameter[] parameters) { if (parameters.Length == 0) { Send("Complete which quest?"); return(true); } int id = parameters[0].AsNumber; IQuest quest = id > 0 ? Quests.ElementAtOrDefault(id - 1) : null; if (quest == null) { Send("No such quest."); return(true); } if (Room.People.All(x => x != quest.Giver)) { Send($"You must be near {quest.Giver.DisplayName} to complete this quest."); return(true); } CompleteQuest(quest); return(true); }