Esempio n. 1
0
        public QuestText GetQuestText(string questId)
        {
            QuestEntryDetails quest = _GetQuest(questId);

            if (quest == null)
            {
                return(null);
            }

            QuestText questText = new QuestText {
                title       = quest.Title,
                description = quest.defenition.description
            };

            if (quest.status == QuestStatus.Success)
            {
                questText.description += string.Format(" \n {0}", quest.defenition.successMessage);
            }
            else if (quest.status == QuestStatus.Failure)
            {
                questText.description += string.Format(" \n {0}", quest.defenition.failMessage);
            }
            else
            {
                // Generate a list of tasks
                List <QuestTaskText> tasks = new List <QuestTaskText>();
                foreach (QuestTask t in quest.defenition.Tasks)
                {
                    QuestTaskDetails task = _GetTask(t.id);
                    tasks.Add(new QuestTaskText {
                        title  = t.displayName,
                        status = task.status
                    });
                }

                questText.tasks = tasks;
            }

            return(questText);
        }
        public QuestText GetQuestText(string questId)
        {
            QuestEntryDetails quest = _GetQuest(questId);
            if (quest == null) return null;

            QuestText questText = new QuestText {
                title = quest.Title,
                description = quest.defenition.description
            };

            if (quest.status == QuestStatus.Success) {
                questText.description += string.Format(" \n {0}", quest.defenition.successMessage);
            } else if (quest.status == QuestStatus.Failure) {
                questText.description += string.Format(" \n {0}", quest.defenition.failMessage);
            } else {
                // Generate a list of tasks
                List<QuestTaskText> tasks = new List<QuestTaskText>();
                foreach (QuestTask t in quest.defenition.Tasks) {
                    QuestTaskDetails task = _GetTask(t.id);
                    tasks.Add(new QuestTaskText {
                        title = t.displayName,
                        status = task.status
                    });
                }

                questText.tasks = tasks;
            }

            return questText;
        }