public void init(int quest, int position) { 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); base.addControl(this.backgroundImage); NewQuests.NewQuestDefinition definition = NewQuests.getNewQuestDef(quest); this.Size = new Size(0x1bc, 60); this.questImage.Image = (Image)GFXLibrary.quest_icons[Math.Min(definition.questType, GFXLibrary.quest_icons.Length - 1)]; this.questImage.Position = new Point(0, 6); base.addControl(this.questImage); this.lblQuestName.Text = SK.NoStoreText("Z_QUESTS_" + definition.tagString); this.lblQuestName.Color = ARGBColors.Black; this.lblQuestName.Position = new Point(9, 0); this.lblQuestName.Size = new Size(400, 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); }
public void okClicked() { this.m_questDef = NewQuests.getNewQuestDef(this.m_questID); VillageMap map = GameEngine.Instance.getVillage(this.m_villageID); if (map == null) { this.confirmAvailableSpace(); } else { VillageMap.StockpileLevels levels = new VillageMap.StockpileLevels(); VillageMap.GranaryLevels levels2 = new VillageMap.GranaryLevels(); map.getStockpileLevels(levels); map.getGranaryLevels(levels2); bool flag = false; double num = 0.0; double num2 = 0.0; if (this.m_questDef.reward_apples > 0) { num2 = GameEngine.Instance.World.UserResearchData.getResourceCap(GameEngine.Instance.LocalWorldData, 0x12, false) * CardTypes.getResourceCapMultiplier(0x12, GameEngine.Instance.World.UserCardData); num = num2 - levels2.fishLevel; if (Convert.ToInt32(num) < this.m_questDef.reward_apples) { flag = true; } } if ((this.m_questDef.reward_stone > 0) && !flag) { num2 = GameEngine.Instance.World.UserResearchData.getResourceCap(GameEngine.Instance.LocalWorldData, 7, false) * CardTypes.getResourceCapMultiplier(7, GameEngine.Instance.World.UserCardData); num = num2 - levels.stoneLevel; if (Convert.ToInt32(num) < this.m_questDef.reward_stone) { flag = true; } } if ((this.m_questDef.reward_wood > 0) && !flag) { num2 = GameEngine.Instance.World.UserResearchData.getResourceCap(GameEngine.Instance.LocalWorldData, 6, false) * CardTypes.getResourceCapMultiplier(6, GameEngine.Instance.World.UserCardData); num = num2 - levels.woodLevel; if (Convert.ToInt32(num) < this.m_questDef.reward_wood) { flag = true; } } if (!flag || (MyMessageBox.Show(SK.Text("Quest_Reward_Insufficient_Space", "You do not have enough room to store all of the reward at this village. Are you sure you want to send the reward to this village?"), SK.Text("Quest_Reward_Insufficient_Space_header", "Insufficient Space"), MessageBoxButtons.YesNo) != DialogResult.No)) { this.CompleteQuest(); } } }
public override void setData(GetReport_ReturnType returnData) { base.setData(returnData); switch (returnData.reportType) { case 100: { base.lblSubTitle.Text = SK.Text("Reports_Quest_Complete", "Completed Quest") + " :"; NewQuests.NewQuestDefinition definition = NewQuests.getNewQuestDef(returnData.genericData1); base.lblSecondaryText.Text = SK.NoStoreText("Z_QUESTS_" + definition.tagString); goto Label_0242; } case 0x65: { base.lblSubTitle.Text = SK.Text("Reports_Quest Failed", "Failed Quest") + " :"; NewQuests.NewQuestDefinition definition2 = NewQuests.getNewQuestDef(returnData.genericData1); base.lblSecondaryText.Text = SK.NoStoreText("Z_QUESTS_" + definition2.tagString); goto Label_0242; } case 0x66: base.lblSubTitle.Text = SK.Text("Reports_Spins", "Wheel Spin Prize"); base.lblSecondaryText.Text = Wheel.getRewardText(returnData.genericData1, returnData.genericData2, base.nfi); return; case 0x81: case 130: case 0x83: if (returnData.reportType != 0x81) { if (returnData.reportType == 0x83) { base.lblSubTitle.Text = SK.Text("Reports_AI_Spins_capture", "Wheel Spin Bonus from AI Capture"); } else { base.lblSubTitle.Text = SK.Text("Reports_Forage_Spins", "Wheel Spin Bonus from Foraging"); } break; } base.lblSubTitle.Text = SK.Text("Reports_AI_Spins", "Wheel Spin Bonus from AI Razing"); break; default: goto Label_0242; } switch (returnData.genericData1) { case 2: base.lblSecondaryText.Text = SK.Text("REPORTS_SeasonalWheelSpins2", "Tier 2 Wheel Spin"); return; case 3: base.lblSecondaryText.Text = SK.Text("REPORTS_SeasonalWheelSpins3", "Tier 3 Wheel Spin"); return; case 4: base.lblSecondaryText.Text = SK.Text("REPORTS_SeasonalWheelSpins4", "Tier 4 Wheel Spin"); return; case 5: base.lblSecondaryText.Text = SK.Text("REPORTS_SeasonalWheelSpins5", "Tier 5 Wheel Spin"); return; default: base.lblSecondaryText.Text = SK.Text("REPORTS_SeasonalWheelSpins1", "Tier 1 Wheel Spin"); return; } Label_0242: base.btnUtility.Visible = true; base.btnUtility.Text.Text = SK.Text("GENERIC_Quests", "Quests"); }
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(); }