public NewQuestsPanel()
 {
     Instance = this;
     this.dockableControl = new DockableControl(this);
     this.InitializeComponent();
     base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
     this.focusPanel.Focus();
 }
        public void init(bool resized)
        {
            int height = base.Height;
            Instance = this;
            base.clearControls();
            this.headerImage.Size = new Size(base.Width, 40);
            this.headerImage.Position = new Point(0, 0);
            base.addControl(this.headerImage);
            this.headerImage.Create((Image) GFXLibrary.mail2_titlebar_left, (Image) GFXLibrary.mail2_titlebar_middle, (Image) GFXLibrary.mail2_titlebar_right);
            CustomSelfDrawPanel.WikiLinkControl.init(this.headerImage, 0x13, new Point(base.Width - 0x2c, 3));
            this.backgroundImage.Size = new Size(base.Width, height - 40);
            this.backgroundImage.Position = new Point(0, 40);
            base.addControl(this.backgroundImage);
            this.backgroundImage.Create((Image) GFXLibrary.mail2_mail_panel_upper_left, (Image) GFXLibrary.mail2_mail_panel_upper_middle, (Image) GFXLibrary.mail2_mail_panel_upper_right, (Image) GFXLibrary.mail2_mail_panel_middle_left, (Image) GFXLibrary.mail2_mail_panel_middle_middle, (Image) GFXLibrary.mail2_mail_panel_middle_right, (Image) GFXLibrary.mail2_mail_panel_lower_left, (Image) GFXLibrary.mail2_mail_panel_lower_middle, (Image) GFXLibrary.mail2_mail_panel_lower_right);
            this.underlayImage.Image = (Image) GFXLibrary.quest_screen_warm;
            this.underlayImage.Position = new Point(6, 0);
            this.backgroundImage.addControl(this.underlayImage);
            this.questImage.Image = (Image) GFXLibrary.quest_screen_top;
            this.questImage.Position = new Point(0x15, 0x12);
            this.backgroundImage.addControl(this.questImage);
            this.parishNameLabel.Text = SK.Text("QuestPanel_Quests", "Quests");
            this.parishNameLabel.Color = ARGBColors.White;
            this.parishNameLabel.DropShadowColor = ARGBColors.Black;
            this.parishNameLabel.Position = new Point(20, 0);
            this.parishNameLabel.Size = new Size(base.Width - 40, 40);
            this.parishNameLabel.Font = FontManager.GetFont("Arial", 18f, FontStyle.Regular);
            this.parishNameLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT;
            this.headerImage.addControl(this.parishNameLabel);
            this.questsScrollArea.Position = new Point(40, 230);
            this.questsScrollArea.Size = new Size(880, ((height - 230) - 20) - 40);
            this.questsScrollArea.ClipRect = new Rectangle(new Point(0, 0), new Size(880, ((height - 230) - 20) - 40));
            this.backgroundImage.addControl(this.questsScrollArea);
            this.insetImage.Position = new Point(0x15, 220);
            this.insetImage.Size = new Size(0x3b3, (((height - 230) - 20) - 40) + 20);
            this.backgroundImage.addControl(this.insetImage);
            this.insetImage.Create((Image) GFXLibrary.quest_9sclice_grey_inset_top_left, (Image) GFXLibrary.quest_9sclice_grey_inset_top_mid, (Image) GFXLibrary.quest_9sclice_grey_inset_top_right, (Image) GFXLibrary.quest_9sclice_grey_inset_mid_left, (Image) GFXLibrary.quest_9sclice_grey_inset_mid_mid, (Image) GFXLibrary.quest_9sclice_grey_inset_mid_right, (Image) GFXLibrary.quest_9sclice_grey_inset_bottom_left, (Image) GFXLibrary.quest_9sclice_grey_inset_bottom_mid, (Image) GFXLibrary.quest_9sclice_grey_inset_bottom_right);
            int num2 = this.questsScrollBar.Value;
            this.questsScrollBar.Position = new Point(930, 230);
            this.questsScrollBar.Size = new Size(0x18, ((height - 230) - 20) - 40);
            this.backgroundImage.addControl(this.questsScrollBar);
            this.questsScrollBar.Value = 0;
            this.questsScrollBar.Max = 100;
            this.questsScrollBar.NumVisibleLines = 0x19;
            this.questsScrollBar.Create(null, null, null, (Image) GFXLibrary._24wide_thumb_top, (Image) GFXLibrary._24wide_thumb_middle, (Image) GFXLibrary._24wide_thumb_bottom);
            this.questsScrollBar.setValueChangeDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ValueChangedDelegate(this.wallScrollBarMoved));
            this.mouseWheelOverlay.Position = this.questsScrollArea.Position;
            this.mouseWheelOverlay.Size = this.questsScrollArea.Size;
            this.mouseWheelOverlay.setMouseWheelDelegate(new CustomSelfDrawPanel.CSDControl.CSD_MouseWheelDelegate(this.mouseWheelMoved));
            this.backgroundImage.addControl(this.mouseWheelOverlay);
            NewQuestsData questData = GameEngine.Instance.World.getNewQuestData();
            if ((questData == null) || (questData.questID < 0))
            {
                this.lblQuestName.Text = SK.Text("QUESTS_No_Active_Quest", "No Active Quest");
                this.lblQuestName.Color = ARGBColors.Black;
                this.lblQuestName.Position = new Point(170, 0x13);
                this.lblQuestName.Size = new Size(700, 30);
                this.lblQuestName.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold);
                this.lblQuestName.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
                this.questImage.addControl(this.lblQuestName);
                goto Label_11ED;
            }
            int data = 0;
            int parameter = 1;
            int num5 = 0;
            NewQuests.NewQuestDefinition def = NewQuests.getNewQuestDef(questData.questID);
            addRewardIcons(this.questImage, new Point(170, 0x4b), def, 1);
            this.questIcon.Image = (Image) GFXLibrary.quest_icons[Math.Min(def.questType, GFXLibrary.quest_icons.Length - 1)];
            this.questIcon.Position = new Point(170, 0x10);
            this.questImage.addControl(this.questIcon);
            this.lblQuestName.Text = SK.NoStoreText("Z_QUESTS_" + def.tagString);
            this.lblQuestName.Color = ARGBColors.Black;
            this.lblQuestName.Position = new Point(220, 0x13);
            this.lblQuestName.Size = new Size(700, 30);
            this.lblQuestName.Font = FontManager.GetFont("Arial", 13f, FontStyle.Bold);
            this.lblQuestName.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
            this.questImage.addControl(this.lblQuestName);
            NumberFormatInfo nFI = GameEngine.NFI;
            this.lblQuestDescription.Text = SK.Text("QUEST_PANEL_DESCRIPTION_OBJECTIVE", "Objective");
            this.lblQuestDescription.Text = this.lblQuestDescription.Text + " - ";
            switch (questData.questID)
            {
                case 0x22:
                case 0x30:
                case 4:
                case 0x10:
                case 0x65:
                case 0x7a:
                case 0x40:
                case 0x54:
                    this.lblQuestDescription.Text = this.lblQuestDescription.Text + SK.Text("QUESTS_Spread_New_description", "Learn about invite a friend");
                    break;

                default:
                    if (def.parameter > 0)
                    {
                        this.lblQuestDescription.Text = this.lblQuestDescription.Text + SK.NoStoreText("Z_QUEST_DESCRIPTIONS_" + def.tagString) + " : " + def.parameter.ToString("N", nFI);
                    }
                    else
                    {
                        this.lblQuestDescription.Text = this.lblQuestDescription.Text + SK.NoStoreText("Z_QUEST_DESCRIPTIONS_" + def.tagString);
                    }
                    break;
            }
            this.lblQuestDescription.Color = ARGBColors.Black;
            this.lblQuestDescription.RolloverColor = ARGBColors.White;
            this.lblQuestDescription.Position = new Point(220, 0x2a);
            this.lblQuestDescription.Size = new Size(740, 50);
            this.lblQuestDescription.Font = FontManager.GetFont("Arial", 11f, FontStyle.Bold);
            this.lblQuestDescription.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
            this.lblQuestDescription.Data = questData.questID;
            this.lblQuestDescription.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.OpenFurtherInformation));
            this.lblQuestDescription.Tag = def.tagString;
            this.questImage.addControl(this.lblQuestDescription);
            if ((questData.completionState < 0) || !isQuestComplete(questData))
            {
                this.abandonButton.Enabled = true;
                if (((def.parameter > 0) || (questData.questID == 0x42)) || ((questData.questID == 0x92) || (questData.questID == 0x1d)))
                {
                    switch (questData.questID)
                    {
                        case 20:
                        case 5:
                        case 0x2a:
                        case 0x43:
                        case 0x7d:
                        case 0x63:
                        case 0x9d:
                        case 0xa7:
                        case 0x94:
                        case 140:
                        {
                            double num7 = GameEngine.Instance.World.getCurrentGold() - questData.startingData;
                            num5 = (int) num7;
                            if (num7 < 0.0)
                            {
                                num7 = 0.0;
                            }
                            data = (int) num7;
                            parameter = def.parameter;
                            goto Label_0C4E;
                        }
                        case 0x1d:
                            data = this.bitCount(questData.data);
                            parameter = 4;
                            num5 = data;
                            goto Label_0C4E;

                        case 4:
                        case 0x10:
                        case 0x22:
                        case 0x40:
                        case 0x30:
                        case 0x7a:
                        case 0x65:
                        case 0x54:
                            data = questData.data;
                            parameter = def.parameter;
                            num5 = data;
                            goto Label_0C4E;

                        case 0x42:
                            data = this.bitCount(questData.data);
                            parameter = 6;
                            num5 = data;
                            goto Label_0C4E;

                        case 0x92:
                            data = this.bitCount(questData.data);
                            parameter = 8;
                            num5 = data;
                            goto Label_0C4E;
                    }
                    data = questData.data;
                    parameter = def.parameter;
                    num5 = data;
                }
            }
            else
            {
                this.completeGlow2.Image = (Image) GFXLibrary.quest_button_glow;
                this.completeGlow2.Position = new Point(0x278, 0x84);
                this.completeGlow2.Alpha = 1f;
                this.questImage.addControl(this.completeGlow2);
                this.completeGlow.Image = (Image) GFXLibrary.quest_button_glow;
                this.completeGlow.Position = new Point(0x278, 0x84);
                this.completeGlow.Alpha = 1f;
                this.questImage.addControl(this.completeGlow);
                this.glowValue = 0;
                this.abandonButton.Enabled = false;
                this.completeButton.ImageNorm = (Image) GFXLibrary.mail2_button_blue_141wide_normal;
                this.completeButton.ImageOver = (Image) GFXLibrary.mail2_button_blue_141wide_over;
                this.completeButton.ImageClick = (Image) GFXLibrary.mail2_button_blue_141wide_pushed;
                this.completeButton.Position = new Point(0x288, 0x95);
                this.completeButton.Text.Text = SK.Text("QUESTS_Complete", "Complete");
                this.completeButton.Text.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
                this.completeButton.Text.Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold);
                this.completeButton.TextYOffset = -3;
                this.completeButton.Text.Color = ARGBColors.Black;
                this.completeButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.completeQuest), "NewQuests_Complete_Clicked");
                this.completeButton.Enabled = true;
                this.questImage.addControl(this.completeButton);
                switch (questData.questID)
                {
                    case 0x42:
                        data = parameter = 6;
                        break;

                    case 0x43:
                    case 0x2a:
                    case 5:
                    case 20:
                    case 0x63:
                    case 0x7d:
                    case 140:
                    case 0x94:
                    case 0x9d:
                    case 0xa7:
                        data = parameter = def.parameter;
                        break;

                    case 0x1d:
                        data = parameter = 4;
                        break;

                    case 0x92:
                        data = parameter = 8;
                        break;

                    default:
                        data = parameter = def.parameter;
                        break;
                }
                if (parameter == 0)
                {
                    parameter = data = 1;
                }
                num5 = data;
            }
            Label_0C4E:
            this.questProgressBar.Position = new Point(0xa2, 0x7c);
            this.questProgressBar.Size = new Size(0x2fe, 0x16);
            this.questProgressBar.Offset = new Point(0, 0);
            this.questImage.addControl(this.questProgressBar);
            this.questProgressBar.Create(null, null, null, (Image) GFXLibrary.quest_screen_progbar_left, (Image) GFXLibrary.quest_screen_progbar_mid, (Image) GFXLibrary.quest_screen_progbar_right);
            this.questProgressBar.setValues((double) data, (double) parameter);
            this.progressTextLabel.Text = num5.ToString("N", nFI) + " / " + parameter.ToString("N", nFI);
            this.progressTextLabel.Color = ARGBColors.White;
            this.progressTextLabel.Position = new Point(0, -1);
            this.progressTextLabel.Size = new Size(this.questProgressBar.Width, this.questProgressBar.Height);
            this.progressTextLabel.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular);
            this.progressTextLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
            this.questProgressBar.addControl(this.progressTextLabel);
            this.abandonButton.ImageNorm = (Image) GFXLibrary.mail2_button_blue_141wide_normal;
            this.abandonButton.ImageOver = (Image) GFXLibrary.mail2_button_blue_141wide_over;
            this.abandonButton.ImageClick = (Image) GFXLibrary.mail2_button_blue_141wide_pushed;
            this.abandonButton.Position = new Point(0x31e, 0x95);
            this.abandonButton.Text.Text = SK.Text("QUESTS_Abandon", "Abandon");
            this.abandonButton.Text.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
            this.abandonButton.Text.Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold);
            this.abandonButton.TextYOffset = -3;
            this.abandonButton.Text.Color = ARGBColors.Black;
            this.abandonButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.abandonQuest), "NewQuests_Abandon_Started_Quest_Clicked");
            this.abandonButton.Enabled = true;
            this.questImage.addControl(this.abandonButton);
            switch (questData.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))
                    {
                        CustomSelfDrawPanel.CSDButton control = new CustomSelfDrawPanel.CSDButton {
                            ImageNorm = (Image) GFXLibrary.banner_ad_friend_quest,
                            OverBrighten = true,
                            Position = new Point(0x98, 5)
                        };
                        control.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.friendClicked), "LogoutPanel_invite_a_friend");
                        this.questImage.addControl(control);
                        this.lblQuestDescription.Text = "";
                        this.lblQuestName.Text = "";
                    }
                    else
                    {
                        this.lblQuestDescription.Text = SK.Text("QUESTS_Spread_New_description", "Learn about Invite a Friend");
                    }
                    break;
            }
            if (def.timed > 0)
            {
                if (questData.completionState == 0)
                {
                    TimeSpan span = new TimeSpan(def.timed, 0, 0);
                    TimeSpan span2 = span - (VillageMap.getCurrentServerTime() - questData.startTime);
                    int totalSeconds = (int) span2.TotalSeconds;
                    this.timeLeftLabel.Text = SK.Text("QUESTS_TimeRemaining", "Time Remaining") + " : " + VillageMap.createBuildTimeStringFull(totalSeconds);
                    this.timeLeftLabel.Color = ARGBColors.Black;
                    this.timeLeftLabel.Position = new Point(170, 0x91);
                    this.timeLeftLabel.Size = new Size(760, 50);
                    this.timeLeftLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Bold);
                    this.timeLeftLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
                    this.timeLeftLabel.Visible = true;
                    this.questImage.addControl(this.timeLeftLabel);
                }
                else if (questData.completionState < 0)
                {
                    this.timeLeftLabel.Text = SK.Text("QUESTS_QuestFailed", "Quest Failed");
                    this.timeLeftLabel.Color = ARGBColors.Black;
                    this.timeLeftLabel.Position = new Point(170, 0x91);
                    this.timeLeftLabel.Size = new Size(760, 50);
                    this.timeLeftLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Bold);
                    this.timeLeftLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
                    this.timeLeftLabel.Visible = true;
                    this.questImage.addControl(this.timeLeftLabel);
                }
            }
            Label_11ED:
            this.completedQuestsLabel.Text = SK.Text("QUESTS_CompletedQuests", "Completed Quests") + " : " + questData.totalCompleted.ToString();
            this.completedQuestsLabel.Color = ARGBColors.Black;
            this.completedQuestsLabel.RolloverColor = ARGBColors.White;
            this.completedQuestsLabel.Position = new Point(170, 0xa5);
            this.completedQuestsLabel.Size = new Size(460, 50);
            this.completedQuestsLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Bold);
            this.completedQuestsLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
            this.completedQuestsLabel.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.showCompletedQuests));
            this.questImage.addControl(this.completedQuestsLabel);
            this.tutorialText.Text = SK.Text("Quest_Tutorial_Inprogress", "The Tutorial is currently in progress. Please finish or quit the Tutorial to access Quests.");
            this.tutorialText.Color = ARGBColors.Black;
            this.tutorialText.Position = this.questsScrollArea.Position;
            this.tutorialText.Size = this.questsScrollArea.Size;
            this.tutorialText.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold);
            this.tutorialText.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER;
            this.questImage.addControl(this.tutorialText);
            if (!resized)
            {
                this.m_selectedQuest = -1;
                TimeSpan span3 = (TimeSpan) (DateTime.Now - this.lastFullUpdateTime);
                RemoteServices.Instance.set_GetQuestData_UserCallBack(new RemoteServices.GetQuestData_UserCallBack(this.getQuestDataCallback));
                if (span3.TotalMinutes > 1.0)
                {
                    RemoteServices.Instance.GetQuestData(true);
                }
                else
                {
                    RemoteServices.Instance.GetQuestData(false);
                }
            }
            this.rebuild(this.m_selectedQuest);
            if (resized)
            {
                this.questsScrollBar.Value = num2;
                this.questsScrollBar.scrollDown(0);
                this.wallScrollBarMoved();
            }
        }
            public void init(int quest, NewQuestsPanel parent, int position, int activeQuest, bool allowStart, bool completed)
            {
                this.m_quest = quest;
                this.m_activeQuest = activeQuest;
                this.m_parent = parent;
                this.clearControls();
                if ((position & 1) == 0)
                {
                    this.backgroundImage.Image = (Image) GFXLibrary.quest_screen_bar1;
                }
                else
                {
                    this.backgroundImage.Image = (Image) GFXLibrary.quest_screen_bar2;
                }
                this.backgroundImage.Position = new Point(60, 11);
                if (!completed)
                {
                    this.backgroundImage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.lineClicked));
                }
                base.addControl(this.backgroundImage);
                if (quest < 0)
                {
                    this.lblQuestName.Text = SK.Text("QUESTS_AbandonedQuests", "Abandoned Quests : ") + quest.ToString();
                    this.lblQuestName.Color = ARGBColors.Black;
                    if (activeQuest != quest)
                    {
                        this.lblQuestName.RolloverColor = ARGBColors.White;
                    }
                    this.lblQuestName.Position = new Point(9, 0);
                    this.lblQuestName.Size = new Size(700, this.backgroundImage.Height);
                    this.lblQuestName.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold);
                    this.lblQuestName.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT;
                    this.backgroundImage.addControl(this.lblQuestName);
                    this.startQuestButton.ImageNorm = (Image) GFXLibrary.mail2_button_blue_141wide_normal;
                    this.startQuestButton.ImageOver = (Image) GFXLibrary.mail2_button_blue_141wide_over;
                    this.startQuestButton.ImageClick = (Image) GFXLibrary.mail2_button_blue_141wide_pushed;
                    this.startQuestButton.Position = new Point(670, 6);
                    this.startQuestButton.Text.Text = SK.Text("QUESTS_Restore", "Restore");
                    this.startQuestButton.Text.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
                    this.startQuestButton.Text.Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold);
                    this.startQuestButton.TextYOffset = -3;
                    this.startQuestButton.Text.Color = ARGBColors.Black;
                    this.startQuestButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.restoreQuests), "NewQuests_Restore_Quests_Clicked");
                    this.backgroundImage.addControl(this.startQuestButton);
                    this.Size = new Size(880, 60);
                }
                else
                {
                    NewQuests.NewQuestDefinition def = NewQuests.getNewQuestDef(quest);
                    if (!completed)
                    {
                        base.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.lineClicked));
                    }
                    if ((activeQuest != quest) || completed)
                    {
                        this.Size = new Size(880, 60);
                    }
                    else
                    {
                        this.Size = new Size(880, 130);
                        NumberFormatInfo nFI = GameEngine.NFI;
                        switch (def.ID)
                        {
                            case 0x22:
                            case 0x30:
                            case 4:
                            case 0x10:
                            case 0x65:
                            case 0x7a:
                            case 0x40:
                            case 0x54:
                                this.lblQuestDescription.Text = this.lblQuestDescription.Text + SK.Text("QUESTS_Spread_New_description", "Learn about Invite a Friend");
                                break;

                            default:
                                if (def.parameter > 0)
                                {
                                    this.lblQuestDescription.Text = this.lblQuestDescription.Text + SK.NoStoreText("Z_QUEST_DESCRIPTIONS_" + def.tagString) + " : " + def.parameter.ToString("N", nFI);
                                }
                                else
                                {
                                    this.lblQuestDescription.Text = this.lblQuestDescription.Text + SK.NoStoreText("Z_QUEST_DESCRIPTIONS_" + def.tagString);
                                }
                                break;
                        }
                        this.lblQuestDescription.Color = ARGBColors.Black;
                        this.lblQuestDescription.RolloverColor = ARGBColors.White;
                        this.lblQuestDescription.Position = new Point(0xaf, 0x39);
                        this.lblQuestDescription.Size = new Size(760, 50);
                        this.lblQuestDescription.Font = FontManager.GetFont("Arial", 11f, FontStyle.Regular);
                        this.lblQuestDescription.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
                        this.lblQuestDescription.Data = def.ID;
                        this.lblQuestDescription.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.OpenFurtherInformation));
                        this.lblQuestDescription.Tag = def.tagString;
                        base.addControl(this.lblQuestDescription);
                        this.lblObjective.Text = SK.Text("QUEST_PANEL_DESCRIPTION_OBJECTIVE", "Objective");
                        this.lblObjective.Color = ARGBColors.Black;
                        this.lblObjective.Position = new Point(70, 0x39);
                        this.lblObjective.Size = new Size(760, 50);
                        this.lblObjective.Font = FontManager.GetFont("Arial", 11f, FontStyle.Bold);
                        this.lblObjective.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
                        base.addControl(this.lblObjective);
                        NewQuestsPanel.addRewardIcons(this, new Point(70, 0x5f), def, 1);
                    }
                    this.questImage.Image = (Image) GFXLibrary.quest_icons[Math.Min(def.questType, GFXLibrary.quest_icons.Length - 1)];
                    this.questImage.Position = new Point(0, 6);
                    if (!completed)
                    {
                        this.questImage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.lineClicked));
                    }
                    base.addControl(this.questImage);
                    this.lblQuestName.Text = SK.NoStoreText("Z_QUESTS_" + def.tagString);
                    this.lblQuestName.Color = ARGBColors.Black;
                    if ((activeQuest != quest) && !completed)
                    {
                        this.lblQuestName.RolloverColor = ARGBColors.White;
                    }
                    this.lblQuestName.Position = new Point(9, 0);
                    this.lblQuestName.Size = new Size(700, this.backgroundImage.Height);
                    this.lblQuestName.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold);
                    this.lblQuestName.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT;
                    if (!completed)
                    {
                        this.lblQuestName.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.lineClicked));
                    }
                    this.backgroundImage.addControl(this.lblQuestName);
                    if (allowStart && !completed)
                    {
                        this.startQuestButton.ImageNorm = (Image) GFXLibrary.quest_checkboxes[0];
                        this.startQuestButton.ImageOver = (Image) GFXLibrary.quest_checkboxes[2];
                        this.startQuestButton.MoveOnClick = true;
                        this.startQuestButton.Position = new Point(0x2cb, 6);
                        this.startQuestButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.startQuest), "NewQuests_Start_Quest_Clicked");
                        this.startQuestButton.CustomTooltipID = 0xc81;
                        this.backgroundImage.addControl(this.startQuestButton);
                    }
                    if (!completed)
                    {
                        this.abandonQuestButton.ImageNorm = (Image) GFXLibrary.quest_checkboxes[1];
                        this.abandonQuestButton.ImageOver = (Image) GFXLibrary.quest_checkboxes[3];
                        this.abandonQuestButton.MoveOnClick = true;
                        this.abandonQuestButton.Position = new Point(0x2fd, 6);
                        this.abandonQuestButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.abandonQuest), "NewQuests_Abandon_Clicked");
                        this.abandonQuestButton.CustomTooltipID = 0xc82;
                        this.backgroundImage.addControl(this.abandonQuestButton);
                    }
                }
            }
 public NewQuestRewardPopup openNewQuestRewardPopup(int questID, int villageID, NewQuestsPanel parent)
 {
     this.openGreyOutWindow(false);
     this.closePopupWindow(this.m_newQuestRewardPopup);
     this.m_newQuestRewardPopup = new NewQuestRewardPopup();
     this.m_newQuestRewardPopup.init(questID, villageID, parent);
     this.positionWindow(this.m_newQuestRewardPopup, false, false);
     this.m_newQuestRewardPopup.Show(this.getGreyOutWindow());
     GameEngine.Instance.DisableMouseClicks();
     return this.m_newQuestRewardPopup;
 }
 public void init(int questID, int villageID, NewQuestsPanel questPanel, NewQuestRewardPopup parent)
 {
     this.m_questID = questID;
     this.m_villageID = -1;
     this.m_questPanel = questPanel;
     base.clearControls();
     bool flag = false;
     if (GameEngine.Instance.World.YourHouse > 0)
     {
         flag = true;
     }
     if (GameEngine.Instance.LocalWorldData.Alternate_Ruleset == 1)
     {
         flag = false;
     }
     List<int> list = GameEngine.Instance.World.getUserVillageIDList();
     int height = 200;
     NewQuests.NewQuestDefinition def = NewQuests.getNewQuestDef(questID);
     this.fb_questID = def.questType - 1;
     NumberFormatInfo nFI = GameEngine.NFI;
     if (def.parameter > 0)
     {
         this.fb_questCaption = SK.NoStoreText("Z_QUEST_DESCRIPTIONS_" + def.tagString) + " : " + def.parameter.ToString("N", nFI);
     }
     else
     {
         this.fb_questCaption = SK.NoStoreText("Z_QUEST_DESCRIPTIONS_" + def.tagString);
     }
     if ((((def.reward_apples > 0) || (def.reward_stone > 0)) || (def.reward_wood > 0)) && (list.Count > 1))
     {
         if ((def.getRewardGlory() > 0) && flag)
         {
             height = 0x1ec;
         }
         else
         {
             height = 410;
         }
     }
     else if ((def.getRewardGlory() > 0) && flag)
     {
         height = 270;
     }
     else
     {
         height = 200;
     }
     parent.Size = new Size(550, height);
     this.headerBarImage.Position = new Point(0, 0);
     this.headerBarImage.Size = new Size(base.Width, 30);
     base.addControl(this.headerBarImage);
     this.headerBarImage.Create((Image) GFXLibrary.messageboxtop_left, (Image) GFXLibrary.messageboxtop_middle, (Image) GFXLibrary.messageboxtop_right);
     this.backgroundImage.SpecialGradient = true;
     this.backgroundImage.Position = new Point(0, 30);
     this.backgroundImage.Size = new Size(base.Width, height - 30);
     base.addControl(this.backgroundImage);
     this.captureLabel.Text = SK.Text("QuestLine_Collect_Reward", "Collect Reward");
     this.captureLabel.Color = ARGBColors.White;
     this.captureLabel.Position = new Point(13, 7);
     this.captureLabel.Size = new Size(0x14f, 20);
     this.captureLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold);
     this.captureLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
     this.headerBarImage.addControl(this.captureLabel);
     this.strip1.Image = (Image) GFXLibrary.quest_popup_hz_strip_02;
     this.strip1.Position = new Point(4, 4);
     this.backgroundImage.addControl(this.strip1);
     this.questIcon.Image = (Image) GFXLibrary.quest_icons[Math.Min(def.questType, GFXLibrary.quest_icons.Length - 1)];
     this.questIcon.Position = new Point(12, 12);
     this.backgroundImage.addControl(this.questIcon);
     this.fb_questString = this.lblQuestName.Text = SK.NoStoreText("Z_QUESTS_" + def.tagString);
     this.lblQuestName.Color = ARGBColors.Black;
     this.lblQuestName.Position = new Point(70, 0x1a);
     this.lblQuestName.Size = new Size(700, 30);
     this.lblQuestName.Font = FontManager.GetFont("Arial", 12f, FontStyle.Bold);
     this.lblQuestName.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
     this.backgroundImage.addControl(this.lblQuestName);
     this.facebookShareButton.ImageNorm = (Image) GFXLibrary.facebookBlueNorm;
     this.facebookShareButton.ImageOver = (Image) GFXLibrary.facebookBlueOver;
     this.facebookShareButton.ImageClick = (Image) GFXLibrary.facebookBlueClick;
     this.facebookShareButton.Position = new Point(0xeb, height - 0x4b);
     this.facebookShareButton.UseTextSize = true;
     this.facebookShareButton.Text.Text = SK.Text("FACEBOOK_Share", "Share");
     this.facebookShareButton.Text.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
     this.facebookShareButton.Text.Position = new Point(20, 2);
     this.facebookShareButton.Text.Size = new Size(110, 0x15);
     this.facebookShareButton.Text.Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold);
     this.facebookShareButton.TextYOffset = 0;
     this.facebookShareButton.Text.Color = ARGBColors.Black;
     this.facebookShareButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.facebookShareClicked));
     this.backgroundImage.addControl(this.facebookShareButton);
     this.strip2.Image = (Image) GFXLibrary.quest_popup_hz_strip_01;
     this.strip2.Position = new Point(0x18, 0x4f);
     this.backgroundImage.addControl(this.strip2);
     NewQuestsPanel.addRewardIcons(this.backgroundImage, new Point(30, 80), def, 0);
     this.collectButton.ImageNorm = (Image) GFXLibrary.mail2_button_blue_141wide_normal;
     this.collectButton.ImageOver = (Image) GFXLibrary.mail2_button_blue_141wide_over;
     this.collectButton.ImageClick = (Image) GFXLibrary.mail2_button_blue_141wide_pushed;
     this.collectButton.Position = new Point(0x181, 0x57);
     this.collectButton.Text.Text = SK.Text("QUESTS_Collect", "Collect");
     this.collectButton.Text.Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold);
     this.collectButton.Text.Color = ARGBColors.Black;
     this.collectButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.okClicked), "NewQuests_Collect_Clicked");
     this.backgroundImage.addControl(this.collectButton);
     if (def.reward_charges.Length > 0)
     {
         this.chargesImage.Image = (Image) GFXLibrary.quest_rewards[9];
         this.chargesImage.Position = new Point(0x19, height - 0x52);
         this.chargesImage.CustomTooltipID = 0xc8c;
         this.backgroundImage.addControl(this.chargesImage);
     }
     if (((def.reward_apples > 0) || (def.reward_stone > 0)) || (def.reward_wood > 0))
     {
         if (list.Count > 1)
         {
             this.strip4.Image = (Image) GFXLibrary.quest_popup_hz_strip_03;
             this.strip4.Position = new Point(0x18, 0x97);
             this.backgroundImage.addControl(this.strip4);
             this.collectButton.Enabled = false;
             this.villageIcon.Image = (Image) GFXLibrary.char_village_icons[5];
             this.villageIcon.Position = new Point(30, 0x94);
             this.backgroundImage.addControl(this.villageIcon);
             if (Program.mySettings.LanguageIdent == "fr")
             {
                 this.targetVillageLabel.Text = "Village Cible";
             }
             else
             {
                 this.targetVillageLabel.Text = SK.Text("VillageArmiesPanel_Target_Village", "Target Village");
             }
             this.targetVillageLabel.Color = ARGBColors.Black;
             this.targetVillageLabel.Position = new Point(0, 130);
             this.targetVillageLabel.Size = new Size(base.Width, 30);
             this.targetVillageLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Bold);
             this.targetVillageLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER;
             this.backgroundImage.addControl(this.targetVillageLabel);
             this.villageNameLabel.Text = SK.Text("QUESTS_Pick_a_Village", "Pick a Village");
             this.villageNameLabel.Color = ARGBColors.Black;
             this.villageNameLabel.Position = new Point(90, 0x92);
             this.villageNameLabel.Size = new Size(base.Width - 90, this.villageIcon.Height);
             this.villageNameLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Bold);
             this.villageNameLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT;
             this.backgroundImage.addControl(this.villageNameLabel);
             this.questsScrollArea.Position = new Point(0x3d, 200);
             this.questsScrollArea.Size = new Size(390, 0x73);
             this.questsScrollArea.ClipRect = new Rectangle(new Point(0, 0), new Size(390, 0x73));
             this.backgroundImage.addControl(this.questsScrollArea);
             this.insetImage.Position = new Point(0x37, 0xc6);
             this.insetImage.Size = new Size(440, 0x77);
             this.backgroundImage.addControl(this.insetImage);
             this.insetImage.Create((Image) GFXLibrary.quest_popup_inset_top, (Image) GFXLibrary.quest_popup_inset_middle, (Image) GFXLibrary.quest_popup_inset_bottom);
             this.questsScrollBar.Position = new Point(0x1cd, 0xcd);
             this.questsScrollBar.Size = new Size(0x18, 0x69);
             this.backgroundImage.addControl(this.questsScrollBar);
             this.questsScrollBar.Value = 0;
             this.questsScrollBar.Max = 100;
             this.questsScrollBar.NumVisibleLines = 0x19;
             this.questsScrollBar.Create(null, null, null, (Image) GFXLibrary._24wide_thumb_top, (Image) GFXLibrary._24wide_thumb_middle, (Image) GFXLibrary._24wide_thumb_bottom);
             this.questsScrollBar.setValueChangeDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ValueChangedDelegate(this.wallScrollBarMoved));
             this.mouseWheelOverlay.Position = this.questsScrollArea.Position;
             this.mouseWheelOverlay.Size = this.questsScrollArea.Size;
             this.mouseWheelOverlay.setMouseWheelDelegate(new CustomSelfDrawPanel.CSDControl.CSD_MouseWheelDelegate(this.mouseWheelMoved));
             this.backgroundImage.addControl(this.mouseWheelOverlay);
             this.addVillages(true);
         }
         else if (list.Count > 0)
         {
             this.m_villageID = list[0];
         }
     }
     if ((def.getRewardGlory() > 0) && flag)
     {
         this.orLabel.Text = SK.Text("QUESTS_or", "Or");
         this.orLabel.Color = ARGBColors.Black;
         this.orLabel.Position = new Point(0, height - 0x91);
         this.orLabel.Size = new Size(base.Width, 30);
         this.orLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Bold);
         this.orLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER;
         this.backgroundImage.addControl(this.orLabel);
         this.strip3.Image = (Image) GFXLibrary.quest_popup_hz_strip_01;
         this.strip3.Position = new Point(0x18, (height - 0x7b) - 1);
         this.backgroundImage.addControl(this.strip3);
         NewQuestsPanel.addRewardIcons(this.backgroundImage, new Point(30, height - 0x7b), def, -1);
         this.collectGloryButton.ImageNorm = (Image) GFXLibrary.misc_button_blue_210wide_normal;
         this.collectGloryButton.ImageOver = (Image) GFXLibrary.misc_button_blue_210wide_over;
         this.collectGloryButton.ImageClick = (Image) GFXLibrary.misc_button_blue_210wide_pushed;
         this.collectGloryButton.Position = new Point(0x13c, ((height - 0x7b) + 8) - 1);
         this.collectGloryButton.Text.Text = SK.Text("QUESTS_Collect_Glory", "Collect Glory");
         this.collectGloryButton.Text.Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold);
         this.collectGloryButton.Text.Color = ARGBColors.Black;
         this.collectGloryButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.okGloryClicked), "NewQuests_Collect_Glory_Clicked");
         this.backgroundImage.addControl(this.collectGloryButton);
     }
     this.cancelButton.ImageNorm = (Image) GFXLibrary.mail2_button_blue_141wide_normal;
     this.cancelButton.ImageOver = (Image) GFXLibrary.mail2_button_blue_141wide_over;
     this.cancelButton.ImageClick = (Image) GFXLibrary.mail2_button_blue_141wide_pushed;
     this.cancelButton.Position = new Point(0x181, height - 0x4b);
     this.cancelButton.Text.Text = SK.Text("GENERIC_Cancel", "Cancel");
     this.cancelButton.Text.Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold);
     this.cancelButton.Text.Color = ARGBColors.Black;
     this.cancelButton.setClickDelegate(delegate {
         InterfaceMgr.Instance.closeNewQuestRewardPopup();
         InterfaceMgr.Instance.ParentForm.TopMost = true;
         InterfaceMgr.Instance.ParentForm.TopMost = false;
     }, "NewQuests_Cancel");
     this.backgroundImage.addControl(this.cancelButton);
     base.Invalidate();
     parent.Invalidate();
 }
 public void init(int questID, int villageID, NewQuestsPanel parent)
 {
     this.newQuestRewardPanel.Visible = true;
     this.newQuestRewardPanel.init(questID, villageID, parent, this);
 }