Beispiel #1
0
        private void OnSelected(object sender, TreeViewEventArgs args)
        {
            using (var freezer = new FormFreezer(this, true)) {
                string         name   = args.Node.Name;
                TreeViewAction action = args.Action;

                if (table.Controls.Count == 3)
                {
                    var control = table.Controls[2];
                    table.Controls.RemoveAt(2);
                    control.Dispose();
                    GC.Collect();
                }

                if (name == "pc_light")
                {
                    lblTitle.Text       = Program.IniReader["elyosQuests"];
                    txtDescription.Text = String.Empty;
                }
                else if (name == "pc_dark")
                {
                    lblTitle.Text       = Program.IniReader["asmodiansQuests"];
                    txtDescription.Text = String.Empty;
                }
                else if (name.StartsWith("Q"))
                {
                    Quest    quest   = (Quest)args.Node.Tag;
                    HtmlPage summary = quest.HtmlPages.Where(p => p.name == "quest_summary")
                                       .FirstOrDefault();
                    if (summary == null)
                    {
                        lblTitle.Text       = args.Node.Text;
                        txtDescription.Text = String.Empty;
                    }
                    else
                    {
                        lblTitle.Text       = summary.QuestTitle;
                        txtDescription.Text = summary.QuestDescription;
                        var page = new QuestPage(args.Node);
                        page.Width            = table.Width - page.Margin.Horizontal;
                        page.QuestId          = quest.id;
                        page.IsMission        = quest.category1 == "mission";
                        page.Zone             = Utility.StringIndex.GetString(quest.category2);
                        page.RepeatCount      = quest.max_repeat_count;
                        page.CanAbandon       = !quest.cannot_giveup;
                        page.CanShare         = !quest.cannot_share;
                        page.ClientLevel      = quest.client_level;
                        page.ExtendsInventory = quest.reward_extend_inventory1 > 0;
                        page.ExtendsStigma    = quest.reward_extend_stigma1;
                        if (!String.IsNullOrEmpty(quest.gender_permitted))
                        {
                            page.Genders = quest.gender_permitted.Split(' ', ',');
                        }
                        if (!String.IsNullOrEmpty(quest.race_permitted))
                        {
                            page.Races = quest.race_permitted.Split(' ', ',');
                        }
                        if (!String.IsNullOrEmpty(quest.class_permitted))
                        {
                            page.Classes = quest.class_permitted.Split(' ', ',');
                        }

                        List <string> finished = new List <string>();
                        if (!String.IsNullOrEmpty(quest.finished_quest_cond1))
                        {
                            finished.AddRange(quest.finished_quest_cond1.Split(' ', ','));
                        }
                        if (!String.IsNullOrEmpty(quest.finished_quest_cond2))
                        {
                            finished.AddRange(quest.finished_quest_cond2.Split(' ', ','));
                        }
                        if (!String.IsNullOrEmpty(quest.finished_quest_cond3))
                        {
                            finished.AddRange(quest.finished_quest_cond3.Split(' ', ','));
                        }
                        if (!String.IsNullOrEmpty(quest.finished_quest_cond4))
                        {
                            finished.AddRange(quest.finished_quest_cond4.Split(' ', ','));
                        }
                        if (finished.Count > 0)
                        {
                            page.Finished = finished.ToArray();
                        }

                        List <string> unfinished = new List <string>();
                        if (!String.IsNullOrEmpty(quest.unfinished_quest_cond1))
                        {
                            unfinished.AddRange(quest.unfinished_quest_cond1.Split(' ', ','));
                        }
                        if (!String.IsNullOrEmpty(quest.unfinished_quest_cond2))
                        {
                            unfinished.AddRange(quest.unfinished_quest_cond2.Split(' ', ','));
                        }
                        if (!String.IsNullOrEmpty(quest.unfinished_quest_cond3))
                        {
                            unfinished.AddRange(quest.unfinished_quest_cond3.Split(' ', ','));
                        }
                        if (!String.IsNullOrEmpty(quest.unfinished_quest_cond4))
                        {
                            unfinished.AddRange(quest.unfinished_quest_cond4.Split(' ', ','));
                        }
                        if (!String.IsNullOrEmpty(quest.unfinished_quest_cond5))
                        {
                            unfinished.AddRange(quest.unfinished_quest_cond5.Split(' ', ','));
                        }
                        if (unfinished.Count > 0)
                        {
                            page.Unfinished = unfinished.ToArray();
                        }

                        table.Controls.Add(page, 0, 2);
                    }
                }
                else if (name.StartsWith("S"))
                {
                    var      questNode = args.Node.Parent;
                    Quest    quest     = (Quest)questNode.Tag;
                    HtmlPage summary   = quest.HtmlPages.Where(p => p.name == "quest_summary")
                                         .FirstOrDefault();
                    Step step = (Step)args.Node.Tag;
                    lblTitle.Text       = summary.QuestTitle;
                    txtDescription.Text = step.Description;
                    Step[] allSteps = questNode.Nodes.Cast <TreeNode>().Select(n => (Step)n.Tag).ToArray();
                    var    page     = new StepPage(quest, allSteps, step.Number);
                    page.Width = table.Width - page.Margin.Horizontal;
                    table.Controls.Add(page, 0, 2);
                }
                else
                {
                    lblTitle.Text       = args.Node.Text;
                    txtDescription.Text = String.Empty;
                    //var page = new StepPage(args.Node);
                    //page.Width = table.Width - page.Margin.Horizontal;
                    //table.Controls.Add(page, 0, 2);
                }

                // fix row 2 height
                OnTableSizeChanged(null, null);
            }
        }
Beispiel #2
0
        private void OnSelected(object sender, TreeViewEventArgs args)
        {
            using (var freezer = new FormFreezer(this, true)) {
                string name = args.Node.Name;
                TreeViewAction action = args.Action;

                if (table.Controls.Count == 3) {
                    var control = table.Controls[2];
                    table.Controls.RemoveAt(2);
                    control.Dispose();
                    GC.Collect();
                }

                if (name == "pc_light") {
                    lblTitle.Text = Program.IniReader["elyosQuests"];
                    txtDescription.Text = String.Empty;
                } else if (name == "pc_dark") {
                    lblTitle.Text = Program.IniReader["asmodiansQuests"];
                    txtDescription.Text = String.Empty;
                } else if (name.StartsWith("Q")) {
                    Quest quest = (Quest)args.Node.Tag;
                    HtmlPage summary = quest.HtmlPages.Where(p => p.name == "quest_summary")
                                      .FirstOrDefault();
                    if (summary == null) {
                        lblTitle.Text = args.Node.Text;
                        txtDescription.Text = String.Empty;
                    } else {
                        lblTitle.Text = summary.QuestTitle;
                        txtDescription.Text = summary.QuestDescription;
                        var page = new QuestPage(args.Node);
                        page.Width = table.Width - page.Margin.Horizontal;
                        page.QuestId = quest.id;
                        page.IsMission = quest.category1 == "mission";
                        page.Zone = Utility.StringIndex.GetString(quest.category2);
                        page.RepeatCount = quest.max_repeat_count;
                        page.CanAbandon = !quest.cannot_giveup;
                        page.CanShare = !quest.cannot_share;
                        page.ClientLevel = quest.client_level;
                        page.ExtendsInventory = quest.reward_extend_inventory1 > 0;
                        page.ExtendsStigma = quest.reward_extend_stigma1;
                        if (!String.IsNullOrEmpty(quest.gender_permitted)) {
                            page.Genders = quest.gender_permitted.Split(' ', ',');
                        }
                        if (!String.IsNullOrEmpty(quest.race_permitted)) {
                            page.Races = quest.race_permitted.Split(' ', ',');
                        }
                        if (!String.IsNullOrEmpty(quest.class_permitted)) {
                            page.Classes = quest.class_permitted.Split(' ', ',');
                        }

                        List<string> finished = new List<string>();
                        if (!String.IsNullOrEmpty(quest.finished_quest_cond1)) {
                            finished.AddRange(quest.finished_quest_cond1.Split(' ', ','));
                        }
                        if (!String.IsNullOrEmpty(quest.finished_quest_cond2)) {
                            finished.AddRange(quest.finished_quest_cond2.Split(' ', ','));
                        }
                        if (!String.IsNullOrEmpty(quest.finished_quest_cond3)) {
                            finished.AddRange(quest.finished_quest_cond3.Split(' ', ','));
                        }
                        if (!String.IsNullOrEmpty(quest.finished_quest_cond4)) {
                            finished.AddRange(quest.finished_quest_cond4.Split(' ', ','));
                        }
                        if (finished.Count > 0)
                            page.Finished = finished.ToArray();

                        List<string> unfinished = new List<string>();
                        if (!String.IsNullOrEmpty(quest.unfinished_quest_cond1)) {
                            unfinished.AddRange(quest.unfinished_quest_cond1.Split(' ', ','));
                        }
                        if (!String.IsNullOrEmpty(quest.unfinished_quest_cond2)) {
                            unfinished.AddRange(quest.unfinished_quest_cond2.Split(' ', ','));
                        }
                        if (!String.IsNullOrEmpty(quest.unfinished_quest_cond3)) {
                            unfinished.AddRange(quest.unfinished_quest_cond3.Split(' ', ','));
                        }
                        if (!String.IsNullOrEmpty(quest.unfinished_quest_cond4)) {
                            unfinished.AddRange(quest.unfinished_quest_cond4.Split(' ', ','));
                        }
                        if (!String.IsNullOrEmpty(quest.unfinished_quest_cond5)) {
                            unfinished.AddRange(quest.unfinished_quest_cond5.Split(' ', ','));
                        }
                        if (unfinished.Count > 0)
                            page.Unfinished = unfinished.ToArray();

                        table.Controls.Add(page, 0, 2);
                    }
                } else if (name.StartsWith("S")) {
                    var questNode = args.Node.Parent;
                    Quest quest = (Quest)questNode.Tag;
                    HtmlPage summary = quest.HtmlPages.Where(p => p.name == "quest_summary")
                                      .FirstOrDefault();
                    Step step = (Step)args.Node.Tag;
                    lblTitle.Text = summary.QuestTitle;
                    txtDescription.Text = step.Description;
                    Step[] allSteps = questNode.Nodes.Cast<TreeNode>().Select(n => (Step)n.Tag).ToArray();
                    var page = new StepPage(quest, allSteps, step.Number);
                    page.Width = table.Width - page.Margin.Horizontal;
                    table.Controls.Add(page, 0, 2);
                } else {
                    lblTitle.Text = args.Node.Text;
                    txtDescription.Text = String.Empty;
                    //var page = new StepPage(args.Node);
                    //page.Width = table.Width - page.Margin.Horizontal;
                    //table.Controls.Add(page, 0, 2);
                }

                // fix row 2 height
                OnTableSizeChanged(null, null);
            }
        }