/// <summary> /// Creates an instance of a quest given the accordingly table containing the information. /// </summary> /// <param name="questTable"></param> public Quest(QuestTemplate questTable) { Name = questTable.Name; Description = questTable.Description; QuestId = questTable.Id; CanRepeat = questTable.CanRepeat; // Load up requirements LoadStartRequirements(questTable); LoadRewards(questTable); Steps = new List<QuestStep>(); foreach (var step in questTable.QuestSteps) { var newStep = new QuestStep(); foreach (var requirement in step.Requirements) { var concreteRequirement = QuestRequirementFactory.GetConcreteQuestRequirement(requirement); newStep.Requirements.Add(concreteRequirement); } Steps.Add(newStep); } Script = ScriptLoader.Instance.GetQuestScript(this); }
public QuestEditorForm(QuestTemplate questTemplate) { InitializeComponent(); SetContentTemplate(questTemplate); questRewardEditor1.Template = questTemplate; questStepEditor1.Template = questTemplate; // Do some data binding where possible textName.DataBindings.Add("Text", ContentTemplate, "Name"); textDescription.DataBindings.Add("Text", ContentTemplate, "Description"); checkRepeat.DataBindings.Add("Checked", ContentTemplate, "CanRepeat"); }
private void LoadStartRequirements(QuestTemplate questTable) { StartRequirements = new List<IQuestRequirement>(); }
private void LoadRewards(QuestTemplate questTable) { QuestRewards = new List<IQuestReward>(); foreach (var reward in questTable.Rewards) { var concreteReward = QuestRequirementFactory.GetConcreteQuestReward(reward); QuestRewards.Add(concreteReward); } }