private void OnQuestInfoPanelClick(object sender, RoutedEventArgs e) { QuestInfoPanel info = (sender as QuestInfoPanel); // Load the details. if (this.Target != null) { this.Quest = info.TargetQuest; } }
private void BindQuests() { if (this.Target != null && this.Player != null) { QuestDetailContainer.Visibility = Visibility.Collapsed; QuestListContainer.Visibility = Visibility.Visible; lstQuests.Children.Clear(); foreach (var item in this.Target.Inventory.GetQuests()) { RdlActor playerQuest = this.Player.Inventory.GetQuests().Where(q => q.Name == item.Name).FirstOrDefault(); if (playerQuest != null) { // Do not display quests for which the player has already completed. if (playerQuest.Properties.GetValue <bool>("IsComplete")) { continue; } // Do not display quests where the target is the endswith value and the player has not finished // nor has the player started quest. if ((!playerQuest.Properties.GetValue <bool>("IsFinished") || !playerQuest.Properties.GetValue <bool>("IsStarted")) && playerQuest.Properties.GetValue <int>(String.Format("EndsWith_{0}", this.Target.ID)) == this.Target.ID) { continue; } } if (!String.IsNullOrEmpty(item.Properties.GetValue <string>("ParentQuestName"))) { // If the player has not completed the parent quest, do not display this // quest as an option. // TODO: This is inefficient, need a better way to query this. if (this.Player.Inventory.GetQuests().Where(q => q.Name == item.Properties.GetValue <string>("ParentQuestName") && !q.Properties.GetValue <bool>("IsComplete")).Count() > 0) { continue; } } QuestInfoPanel pnl = new QuestInfoPanel(); pnl.PlayerQuest = playerQuest; pnl.TargetQuest = item; pnl.Click += new RoutedEventHandler(OnQuestInfoPanelClick); pnl.Refresh(); lstQuests.Children.Add(pnl); } } else { this.ShowLoader(); } }