Exemplo n.º 1
0
        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();
                }
            }
        }