Пример #1
0
        public static bool isQuestComplete(NewQuestsData questData)
        {
            if ((questData.completionState > 0) && (questData.questID >= 0))
            {
                return true;
            }
            NewQuests.NewQuestDefinition definition = NewQuests.getNewQuestDef(questData.questID);
            if (definition != null)
            {
                switch (questData.questID)
                {
                    case 0x42:
                        if (questData.data != 0x3f)
                        {
                            break;
                        }
                        return true;

                    case 0x43:
                    case 0x2a:
                    case 5:
                    case 20:
                    case 0x63:
                    case 0x7d:
                    case 140:
                    case 0x94:
                    case 0x9d:
                    case 0xa7:
                    {
                        double num2 = GameEngine.Instance.World.getCurrentGold() - questData.startingData;
                        if (num2 < definition.parameter)
                        {
                            break;
                        }
                        return true;
                    }
                    case 0x1d:
                        if (questData.data != 15)
                        {
                            break;
                        }
                        return true;

                    case 0x92:
                        if (questData.data != 0xff)
                        {
                            break;
                        }
                        return true;

                    default:
                        if (definition.parameter == 0)
                        {
                            if (questData.data > 0)
                            {
                                return true;
                            }
                        }
                        else if (questData.data >= definition.parameter)
                        {
                            return true;
                        }
                        break;
                }
            }
            return false;
        }
        public void rebuild()
        {
            int[] completedQuests = null;
            int   y = 0;

            this.questsScrollArea.clearControls();
            if (this.isQuestList)
            {
                if (this.completedQuests == null)
                {
                    NewQuestsData data = GameEngine.Instance.World.getNewQuestData();
                    if (data == null)
                    {
                        return;
                    }
                    completedQuests = data.completedQuests;
                }
                else
                {
                    completedQuests = this.completedQuests.ToArray();
                }
                for (int i = 0; i < completedQuests.Length; i++)
                {
                    int          quest   = completedQuests[i];
                    NewQuestLine control = new NewQuestLine();
                    if (y != 0)
                    {
                        y += 5;
                    }
                    control.Position = new Point(0, y);
                    control.init(quest, i);
                    this.questsScrollArea.addControl(control);
                    y += control.Height;
                }
            }
            else
            {
                CustomSelfDrawPanel.CSDLabel label = new CustomSelfDrawPanel.CSDLabel();
                switch (this._questID)
                {
                case 0x22:
                case 0x30:
                case 4:
                case 0x10:
                case 0x65:
                case 0x7a:
                case 0x40:
                case 0x54:
                    if ((!GameEngine.Instance.World.isBigpointAccount && !Program.aeriaInstall) && (!Program.bigpointPartnerInstall && !Program.arcInstall))
                    {
                        label.Text = SK.Text("QUESTS_IAF_Help1", "Learn about how inviting your friends to the game can earn you up to $160 worth of crowns.");
                    }
                    else
                    {
                        label.Text = SK.Text("QUESTS_IAF_Help2", "Why not invite a friend to play Kingdoms? They can fight alongside you and you will help us to further develop the game. ");
                    }
                    break;

                default:
                    label.Text = SK.NoStoreText("Z_QUEST_HELP_" + this.questText);
                    break;
                }
                label.Color     = ARGBColors.Black;
                label.Position  = new Point(0x24, 30);
                label.Size      = new Size(this.questsScrollArea.Width, this.questsScrollArea.Height);
                label.Font      = FontManager.GetFont("Arial", 12f, FontStyle.Regular);
                label.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
                this.mainBackgroundImage.addControl(label);
            }
            this.questsScrollArea.Size = new Size(this.questsScrollArea.Width, y);
            if (y < this.questsScrollBar.Height)
            {
                this.questsScrollBar.Visible = false;
            }
            else
            {
                this.questsScrollBar.Visible         = true;
                this.questsScrollBar.NumVisibleLines = this.questsScrollBar.Height;
                this.questsScrollBar.Max             = y - this.questsScrollBar.Height;
            }
            this.questsScrollArea.invalidate();
            this.questsScrollBar.invalidate();
            this.mainBackgroundImage.invalidate();
        }