コード例 #1
0
ファイル: StepPage.cs プロジェクト: GiGatR00n/AionParsers
        public StepPage(Quest quest, Step[] steps, int stepToGet)
            : this()
        {
            if (quest == null)
                throw new ArgumentNullException("quest");
            if (steps == null)
                throw new ArgumentNullException("steps");
            _allSteps = steps;
            _quest = quest;
            if (stepToGet < 1 || stepToGet > steps.Length)
                throw new ArgumentOutOfRangeException("stepToGet");
            _step = steps[stepToGet - 1];

            HtmlPage[][] sortedPages = quest.StepPages;
            if (sortedPages == null) {
                try {
                    sortedPages = quest.StepPages = GetSortedQuestPages(steps.Length);
                } catch (Exception ex) {
                    Debug.Print(ex.ToString());
                    return;
                }
            }

            if (sortedPages[stepToGet - 1] != null)
                _pages = sortedPages[stepToGet - 1].ToList();

            int row = 0;
            if (_step != null) {
                if (_step.IsCollection) {
                    if (!String.IsNullOrEmpty(_quest.collect_item1))
                        _collectItems.Add(_quest.collect_item1);
                    if (!String.IsNullOrEmpty(_quest.collect_item2))
                        _collectItems.Add(_quest.collect_item2);
                    if (!String.IsNullOrEmpty(_quest.collect_item3))
                        _collectItems.Add(_quest.collect_item3);
                    if (!String.IsNullOrEmpty(_quest.collect_item4))
                        _collectItems.Add(_quest.collect_item4);
                    foreach (string item in _collectItems) {
                        var itemLabel = new LinkLabel();
                        itemLabel.AutoSize = true;
                        itemLabel.LinkColor = Color.FromArgb(255, 255, 192);
                        itemLabel.VisitedLinkColor = Color.FromArgb(230, 230, 0);
                        itemLabel.ActiveLinkColor = Color.Yellow;
                        itemLabel.DisabledLinkColor = Color.FromArgb(224, 224, 224);
                        itemLabel.Margin = new Padding(30, 1, 3, 1);

                        string[] itemPlusCount = item.Split(' ');
                        if (itemPlusCount.Length != 2) {
                            continue;
                        }
                        itemLabel.Text = String.Format("{0} (×{1})",
                                                       Utility.ItemIndex[itemPlusCount[0]], itemPlusCount[1]);
                        tableItems.Controls.Add(itemLabel, 0, row++);
                        if (row > 1) {
                            tableItems.RowStyles.Add(new RowStyle(SizeType.AutoSize));
                        }
                        itemLabel.Links[0].LinkData = Utility.ItemIndex.GetItem(itemPlusCount[0]);
                        itemLabel.LinkClicked += new LinkLabelLinkClickedEventHandler(OnItemLinkClicked);
                        // itemLabel.Click += new EventHandler(OnLinkLabelClicked);
                    }
                    if (row != 0) {
                        lblTask.Text = Program.IniReader["collectItems"] + ':';
                        tableItems.RowCount = row;
                        tableItems.AutoSize = true;
                    } else {
                        lblTask.Text = String.Empty;
                    }
                } else {
                    lblTask.Text = String.Empty;
                }
            }

            int pageCount = 0;
            int rewardNo = 0;
            foreach (HtmlPage page in _pages) {
                pageCount++;
                if (page.name.StartsWith("select_quest_reward"))
                    rewardNo = page.HtmlPageId - 4;
                AddTabPage(page, true, rewardNo);
                //break;
            }

            tabPages.TabPages.RemoveAt(0);
        }
コード例 #2
0
ファイル: StepPage.cs プロジェクト: webdes27/AionParsers
        public StepPage(Quest quest, Step[] steps, int stepToGet) : this()
        {
            if (quest == null)
            {
                throw new ArgumentNullException("quest");
            }
            if (steps == null)
            {
                throw new ArgumentNullException("steps");
            }
            _allSteps = steps;
            _quest    = quest;
            if (stepToGet < 1 || stepToGet > steps.Length)
            {
                throw new ArgumentOutOfRangeException("stepToGet");
            }
            _step = steps[stepToGet - 1];

            HtmlPage[][] sortedPages = quest.StepPages;
            if (sortedPages == null)
            {
                try {
                    sortedPages = quest.StepPages = GetSortedQuestPages(steps.Length);
                } catch (Exception ex) {
                    Debug.Print(ex.ToString());
                    return;
                }
            }

            if (sortedPages[stepToGet - 1] != null)
            {
                _pages = sortedPages[stepToGet - 1].ToList();
            }

            int row = 0;

            if (_step != null)
            {
                if (_step.IsCollection)
                {
                    if (!String.IsNullOrEmpty(_quest.collect_item1))
                    {
                        _collectItems.Add(_quest.collect_item1);
                    }
                    if (!String.IsNullOrEmpty(_quest.collect_item2))
                    {
                        _collectItems.Add(_quest.collect_item2);
                    }
                    if (!String.IsNullOrEmpty(_quest.collect_item3))
                    {
                        _collectItems.Add(_quest.collect_item3);
                    }
                    if (!String.IsNullOrEmpty(_quest.collect_item4))
                    {
                        _collectItems.Add(_quest.collect_item4);
                    }
                    foreach (string item in _collectItems)
                    {
                        var itemLabel = new LinkLabel();
                        itemLabel.AutoSize          = true;
                        itemLabel.LinkColor         = Color.FromArgb(255, 255, 192);
                        itemLabel.VisitedLinkColor  = Color.FromArgb(230, 230, 0);
                        itemLabel.ActiveLinkColor   = Color.Yellow;
                        itemLabel.DisabledLinkColor = Color.FromArgb(224, 224, 224);
                        itemLabel.Margin            = new Padding(30, 1, 3, 1);

                        string[] itemPlusCount = item.Split(' ');
                        if (itemPlusCount.Length != 2)
                        {
                            continue;
                        }
                        itemLabel.Text = String.Format("{0} (×{1})",
                                                       Utility.ItemIndex[itemPlusCount[0]], itemPlusCount[1]);
                        tableItems.Controls.Add(itemLabel, 0, row++);
                        if (row > 1)
                        {
                            tableItems.RowStyles.Add(new RowStyle(SizeType.AutoSize));
                        }
                        itemLabel.Links[0].LinkData = Utility.ItemIndex.GetItem(itemPlusCount[0]);
                        itemLabel.LinkClicked      += new LinkLabelLinkClickedEventHandler(OnItemLinkClicked);
                        // itemLabel.Click += new EventHandler(OnLinkLabelClicked);
                    }
                    if (row != 0)
                    {
                        lblTask.Text        = Program.IniReader["collectItems"] + ':';
                        tableItems.RowCount = row;
                        tableItems.AutoSize = true;
                    }
                    else
                    {
                        lblTask.Text = String.Empty;
                    }
                }
                else
                {
                    lblTask.Text = String.Empty;
                }
            }

            int pageCount = 0;
            int rewardNo  = 0;

            foreach (HtmlPage page in _pages)
            {
                pageCount++;
                if (page.name.StartsWith("select_quest_reward"))
                {
                    rewardNo = page.HtmlPageId - 4;
                }
                AddTabPage(page, true, rewardNo);
                //break;
            }

            tabPages.TabPages.RemoveAt(0);
        }