public void update() { VillageMap village = GameEngine.Instance.Village; if (village != null) { if (GameEngine.Instance.World.isRegionCapital(village.VillageID)) { this.stockpileHeaderLabel.Text = SK.Text("ResourcesPanel_Parish_Resources", "Parish Resources"); } else if (GameEngine.Instance.World.isCountyCapital(village.VillageID)) { this.stockpileHeaderLabel.Text = SK.Text("ResourcesPanel_County_Resources", "County Resources"); } else if (GameEngine.Instance.World.isProvinceCapital(village.VillageID)) { this.stockpileHeaderLabel.Text = SK.Text("ResourcesPanel_Province_Resources", "Province Resources"); } else if (GameEngine.Instance.World.isCountryCapital(village.VillageID)) { this.stockpileHeaderLabel.Text = SK.Text("ResourcesPanel_Country_Resources", "Country Resources"); } NumberFormatInfo nFI = GameEngine.NFI; VillageMap.StockpileLevels levels = new VillageMap.StockpileLevels(); village.getStockpileLevels(levels); this.woodLabel.Text = SK.Text("ResourceTypeWood", "Wood") + ": " + levels.woodLevel.ToString("N", nFI); this.stoneLabel.Text = SK.Text("ResourceType_Stone", "Stone") + ": " + levels.stoneLevel.ToString("N", nFI); this.pitchLabel.Text = SK.Text("ResourceType_Pitch", "Pitch") + ": " + levels.pitchLevel.ToString("N", nFI); this.ironLabel.Text = SK.Text("ResourceType_Iron", "Iron") + ": " + levels.ironLevel.ToString("N", nFI); } }
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 void update() { VillageMap village = GameEngine.Instance.Village; if (village != null) { NumberFormatInfo nFI = GameEngine.NFI; VillageMap.StockpileLevels levels = new VillageMap.StockpileLevels(); village.getStockpileLevels(levels); VillageMap.GranaryLevels levels2 = new VillageMap.GranaryLevels(); village.getGranaryLevels(levels2); VillageMap.ArmouryLevels levels3 = new VillageMap.ArmouryLevels(); village.getArmouryLevels(levels3); VillageMap.TownHallLevels levels4 = new VillageMap.TownHallLevels(); village.getTownHallLevels(levels4); VillageMap.InnLevels levels5 = new VillageMap.InnLevels(); village.getInnLevels(levels5); this.woodLabel.Text = levels.woodLevel.ToString("N", nFI); this.stoneLabel.Text = levels.stoneLevel.ToString("N", nFI); this.pitchLabel.Text = levels.pitchLevel.ToString("N", nFI); this.ironLabel.Text = levels.ironLevel.ToString("N", nFI); this.aleLabel.Text = levels5.aleLevel.ToString("N", nFI); this.applesLabel.Text = levels2.applesLevel.ToString("N", nFI); this.breadLabel.Text = levels2.breadLevel.ToString("N", nFI); this.cheeseLabel.Text = levels2.cheeseLevel.ToString("N", nFI); this.meatLabel.Text = levels2.meatLevel.ToString("N", nFI); this.vegLabel.Text = levels2.vegLevel.ToString("N", nFI); this.fishLabel.Text = levels2.fishLevel.ToString("N", nFI); this.bowsLabel.Text = levels3.bowsLevel.ToString("N", nFI); this.pikesLabel.Text = levels3.pikesLevel.ToString("N", nFI); this.swordsLabel.Text = levels3.swordsLevel.ToString("N", nFI); this.armourLabel.Text = levels3.armourLevel.ToString("N", nFI); this.catapultsLabel.Text = levels3.catapultsLevel.ToString("N", nFI); this.clothesLabel.Text = levels4.clothesLevel.ToString("N", nFI); this.furnitureLabel.Text = levels4.furnitureLevel.ToString("N", nFI); this.saltLabel.Text = levels4.saltLevel.ToString("N", nFI); this.wineLabel.Text = levels4.wineLevel.ToString("N", nFI); this.venisonLabel.Text = levels4.venisonLevel.ToString("N", nFI); this.spicesLabel.Text = levels4.spicesLevel.ToString("N", nFI); this.silkLabel.Text = levels4.silkLevel.ToString("N", nFI); this.metalwareLabel.Text = levels4.metalwareLevel.ToString("N", nFI); this.stockpileLimitLabel.Text = "(" + this.getCap(6).ToString("N", nFI) + ")"; this.innLimitLabel.Text = "(" + this.getCap(12).ToString("N", nFI) + ")"; this.granaryLimitLabel.Text = "(" + this.getCap(13).ToString("N", nFI) + ")"; this.armouryLimitLabel.Text = "(" + this.getCap(0x1d).ToString("N", nFI) + ")"; this.hallLimitLabel.Text = "(" + this.getCap(0x17).ToString("N", nFI) + ")"; if (this.selectedResource >= 0) { this.selectedHeadingLabel.Text = VillageBuildingsData.getResourceNames(this.selectedResource) + ": " + ((int) village.getResourceLevel(this.selectedResource)).ToString("N", nFI); double num2 = village.getResourceProductionPerDay(this.selectedResource); this.dailyProductionValueLabel.Text = ((int) num2).ToString("N", nFI); this.totalBuildingsValueLabel.Text = village.numBuildingsOfType(this.selectedResource).ToString("N", nFI); this.workingBuildingsValueLabel.Text = village.numWorkingBuildingsOfType(this.selectedResource).ToString("N", nFI); } this.cardbar.update(); } }
public void updateStockpile(GraphicsMgr gfx, VillageMap vm) { if (this.baseSprite != null) { if (this.stockpileExtension == null) { this.stockpileExtension = new VillageMapBuildingStockpileExtension(); for (int j = 0; j < 0x10; j++) { this.stockpileExtension.cell[j] = new SpriteWrapper(); this.stockpileExtension.cell[j].Visible = false; this.stockpileExtension.cell[j].PosX = -96 + VillageMapBuildingStockpileExtension.stockpileLayout[j * 2]; this.stockpileExtension.cell[j].PosY = -43 + VillageMapBuildingStockpileExtension.stockpileLayout[(j * 2) + 1]; this.baseSprite.AddChild(this.stockpileExtension.cell[j]); this.stockpileExtension.showGood(gfx, j, -1, 0); } } for (int i = 0; i < 0x10; i++) { this.stockpileExtension.showGood(gfx, i, -1, 0); } VillageMap.StockpileLevels levels = new VillageMap.StockpileLevels(); if (!vm.getStockpileLevels(levels)) { for (int k = 0; k < 0x10; k++) { this.stockpileExtension.showGood(gfx, k, -1, 0); } } else { int index = 0; if (levels.woodLevel > 13333248.0) { index = 12; } else if (levels.woodLevel > 3733248.0) { index = 11; } else if (levels.woodLevel > 1333248.0) { index = 10; } else if (levels.woodLevel > 373248.0) { index = 9; } else if (levels.woodLevel > 133248.0) { index = 8; } else if (levels.woodLevel > 37248.0) { index = 7; } else if (levels.woodLevel > 13248.0) { index = 6; } else if (levels.woodLevel > 3648.0) { index = 5; } else if (levels.woodLevel > 1248.0) { index = 4; } else if (levels.woodLevel > 288.0) { index = 3; } else if (levels.woodLevel > 48.0) { index = 2; } else if (levels.woodLevel > 0.0) { index = 1; } else { index = 0; } int num4 = 0; if (levels.stoneLevel > 13333248.0) { num4 = 12; } else if (levels.stoneLevel > 3733248.0) { num4 = 11; } else if (levels.stoneLevel > 1333248.0) { num4 = 10; } else if (levels.stoneLevel > 373248.0) { num4 = 9; } else if (levels.stoneLevel > 133248.0) { num4 = 8; } else if (levels.stoneLevel > 37248.0) { num4 = 7; } else if (levels.stoneLevel > 13248.0) { num4 = 6; } else if (levels.stoneLevel > 3648.0) { num4 = 5; } else if (levels.stoneLevel > 1248.0) { num4 = 4; } else if (levels.stoneLevel > 288.0) { num4 = 3; } else if (levels.stoneLevel > 48.0) { num4 = 2; } else if (levels.stoneLevel > 0.0) { num4 = 1; } else { num4 = 0; } int num5 = 0; if (levels.ironLevel > 13333248.0) { num5 = 12; } else if (levels.ironLevel > 3733248.0) { num5 = 11; } else if (levels.ironLevel > 1333248.0) { num5 = 10; } else if (levels.ironLevel > 373248.0) { num5 = 9; } else if (levels.ironLevel > 133248.0) { num5 = 8; } else if (levels.ironLevel > 37248.0) { num5 = 7; } else if (levels.ironLevel > 13248.0) { num5 = 6; } else if (levels.ironLevel > 3648.0) { num5 = 5; } else if (levels.ironLevel > 1248.0) { num5 = 4; } else if (levels.ironLevel > 288.0) { num5 = 3; } else if (levels.ironLevel > 48.0) { num5 = 2; } else if (levels.ironLevel > 0.0) { num5 = 1; } else { num5 = 0; } int num6 = 0; if (levels.pitchLevel > 4444416.0) { num6 = 12; } else if (levels.pitchLevel > 1244416.0) { num6 = 11; } else if (levels.pitchLevel > 444416.0) { num6 = 10; } else if (levels.pitchLevel > 124416.0) { num6 = 9; } else if (levels.pitchLevel > 44416.0) { num6 = 8; } else if (levels.pitchLevel > 12416.0) { num6 = 7; } else if (levels.pitchLevel > 4416.0) { num6 = 6; } else if (levels.pitchLevel > 1216.0) { num6 = 5; } else if (levels.pitchLevel > 416.0) { num6 = 4; } else if (levels.pitchLevel > 96.0) { num6 = 3; } else if (levels.pitchLevel > 16.0) { num6 = 2; } else if (levels.pitchLevel > 0.0) { num6 = 1; } else { num6 = 0; } for (int m = 0; m < 0x10; m++) { this.pilesUsed[m] = false; } int num8 = ((index + num4) + num5) + num6; if (num8 > 0x10) { int num9 = 0x10; int num10 = 0; if (index >= 1) { num10++; } if (num4 >= 1) { num10++; } if (num5 >= 1) { num10++; } if (num6 >= 1) { num10++; } num9 -= num10; double num11 = ((double) num9) / ((double) (num8 - num10)); PileOrderSort[] sortArray = new PileOrderSort[4]; int num12 = 0; if (index > 1) { PileOrderSort sort; sort = new PileOrderSort { origPiles = index - 1, numPiles = index - 1, type = 0 }; sortArray[num12++] = sort; } if (num4 > 1) { PileOrderSort sort2; sort2 = new PileOrderSort { origPiles = num4 - 1, numPiles = num4 - 1, type = 3 }; sortArray[num12++] = sort2; } if (num5 > 1) { PileOrderSort sort3; sort3 = new PileOrderSort { origPiles = num5 - 1, numPiles = num5 - 1, type = 4 }; sortArray[num12++] = sort3; } if (num6 > 1) { PileOrderSort sort4; sort4 = new PileOrderSort { origPiles = num6 - 1, numPiles = num6 - 1, type = 5 }; sortArray[num12++] = sort4; } if (num12 > 1) { for (int num13 = 0; num13 < (num12 - 1); num13++) { for (int num14 = 0; num14 < (num12 - 1); num14++) { if (sortArray[num14].numPiles < sortArray[num14 + 1].numPiles) { PileOrderSort sort5 = sortArray[num14]; sortArray[num14] = sortArray[num14 + 1]; sortArray[num14 + 1] = sort5; } } } } int num15 = 0; for (int num16 = 0; num16 < num12; num16++) { sortArray[num16].numPiles = Math.Floor((double) (sortArray[num16].numPiles * num11)); num15 += (int) sortArray[num16].numPiles; } if (num15 < num9) { int num17 = num9 - num15; for (int num18 = 0; num17 > 0; num18++) { int num19 = num18 % num12; if (sortArray[num19].numPiles < sortArray[num19].origPiles) { PileOrderSort sort1 = sortArray[num19]; sort1.numPiles++; num17--; } } } if (index >= 1) { index = 1; } if (num4 >= 1) { num4 = 1; } if (num5 >= 1) { num5 = 1; } if (num6 >= 1) { num6 = 1; } for (int num20 = 0; num20 < num12; num20++) { int numPiles = (int) sortArray[num20].numPiles; switch (sortArray[num20].type) { case 0: index += numPiles; break; case 3: num4 += numPiles; break; case 4: num5 += numPiles; break; case 5: num6 += numPiles; break; } } int num22 = ((index + num4) + num5) + num6; if (num22 != 0x10) { index = 0; } } int num23 = 0; int num24 = 0; for (int n = 0; n < index; n++) { num24 = this.woodPileOrder[num23++]; this.pilesUsed[num24] = true; if (n != (index - 1)) { this.stockpileExtension.showGood(gfx, num24, 6, 0x30); } else { int num26 = (((int) levels.woodLevel) - this.goods48Levels[index]) / this.goodsDividers[index]; this.stockpileExtension.showGood(gfx, num24, 6, Math.Min(num26, 0x30)); } } num23 = 0; for (int num27 = 0; num27 < num5; num27++) { do { num24 = this.ironPileOrder[num23++]; } while (this.pilesUsed[num24]); this.pilesUsed[num24] = true; if (num27 != (num5 - 1)) { this.stockpileExtension.showGood(gfx, num24, 8, 0x30); } else { int num28 = (((int) levels.ironLevel) - this.goods48Levels[num5]) / this.goodsDividers[num5]; this.stockpileExtension.showGood(gfx, num24, 8, Math.Min(num28, 0x30)); } } num23 = 0; for (int num29 = 0; num29 < num4; num29++) { do { num24 = this.stonePileOrder[num23++]; } while (this.pilesUsed[num24]); this.pilesUsed[num24] = true; if (num29 != (num4 - 1)) { this.stockpileExtension.showGood(gfx, num24, 7, 0x30); } else { int num30 = (((int) levels.stoneLevel) - this.goods48Levels[num4]) / this.goodsDividers[num4]; this.stockpileExtension.showGood(gfx, num24, 7, Math.Min(num30, 0x30)); } } num23 = 0; for (int num31 = 0; num31 < num6; num31++) { do { num24 = this.pitchPileOrder[num23++]; } while (this.pilesUsed[num24]); this.pilesUsed[num24] = true; if (num31 != (num6 - 1)) { this.stockpileExtension.showGood(gfx, num24, 9, 0x10); } else { int num32 = (((int) levels.pitchLevel) - this.goods16Levels[num6]) / this.goodsDividers[num6]; this.stockpileExtension.showGood(gfx, num24, 9, Math.Min(num32, 0x10)); } } } } }
public void updateValues() { NumberFormatInfo nFI = GameEngine.NFI; VillageMap village = GameEngine.Instance.Village; if (village == null) { for (int i = 0; i < 8; i++) { this.setRowValues(i, -1, -1, -1); } this.tradersAvailableValue.Text = "0/0"; this.traderCapacityValue.Text = "0"; } else { StockExchangeInfo info2 = null; if ((this.selectedStockExchange >= 0) && (this.stockExchanges[this.selectedStockExchange] != null)) { info2 = (StockExchangeInfo) this.stockExchanges[this.selectedStockExchange]; this.updateDeliveryTime(this.selectedStockExchange); } WorldData localWorldData = GameEngine.Instance.LocalWorldData; switch (this.lastTab) { case 1: { VillageMap.StockpileLevels levels = new VillageMap.StockpileLevels(); village.getStockpileLevels(levels); if (info2 != null) { this.setRowValues(0, (int) levels.woodLevel, info2.woodLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(6), 6)); this.setRowValues(1, (int) levels.stoneLevel, info2.stoneLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(7), 7)); this.setRowValues(2, (int) levels.ironLevel, info2.ironLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(8), 8)); this.setRowValues(3, (int) levels.pitchLevel, info2.pitchLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(9), 9)); break; } this.setRowValues(0, (int) levels.woodLevel, -1, -1); this.setRowValues(1, (int) levels.stoneLevel, -1, -1); this.setRowValues(2, (int) levels.ironLevel, -1, -1); this.setRowValues(3, (int) levels.pitchLevel, -1, -1); break; } case 2: { VillageMap.GranaryLevels levels2 = new VillageMap.GranaryLevels(); village.getGranaryLevels(levels2); VillageMap.InnLevels levels3 = new VillageMap.InnLevels(); village.getInnLevels(levels3); if (info2 != null) { this.setRowValues(0, (int) levels2.applesLevel, info2.applesLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(13), 13)); this.setRowValues(1, (int) levels2.cheeseLevel, info2.cheeseLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(0x11), 0x11)); this.setRowValues(2, (int) levels2.meatLevel, info2.meatLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(0x10), 0x10)); this.setRowValues(3, (int) levels2.breadLevel, info2.breadLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(14), 14)); this.setRowValues(4, (int) levels2.vegLevel, info2.vegLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(15), 15)); this.setRowValues(5, (int) levels2.fishLevel, info2.fishLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(0x12), 0x12)); this.setRowValues(6, (int) levels3.aleLevel, info2.aleLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(12), 12)); break; } this.setRowValues(0, (int) levels2.applesLevel, -1, -1); this.setRowValues(1, (int) levels2.cheeseLevel, -1, -1); this.setRowValues(2, (int) levels2.meatLevel, -1, -1); this.setRowValues(3, (int) levels2.breadLevel, -1, -1); this.setRowValues(4, (int) levels2.vegLevel, -1, -1); this.setRowValues(5, (int) levels2.fishLevel, -1, -1); this.setRowValues(6, (int) levels3.aleLevel, -1, -1); break; } case 3: { VillageMap.ArmouryLevels levels4 = new VillageMap.ArmouryLevels(); village.getArmouryLevels(levels4); if (info2 != null) { this.setRowValues(0, (int) levels4.bowsLevel, info2.bowsLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(0x1d), 0x1d)); this.setRowValues(1, (int) levels4.pikesLevel, info2.pikesLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(0x1c), 0x1c)); this.setRowValues(2, (int) levels4.armourLevel, info2.armourLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(0x1f), 0x1f)); this.setRowValues(3, (int) levels4.swordsLevel, info2.swordsLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(30), 30)); this.setRowValues(4, (int) levels4.catapultsLevel, info2.catapultsLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(0x20), 0x20)); break; } this.setRowValues(0, (int) levels4.bowsLevel, -1, -1); this.setRowValues(1, (int) levels4.pikesLevel, -1, -1); this.setRowValues(2, (int) levels4.armourLevel, -1, -1); this.setRowValues(3, (int) levels4.swordsLevel, -1, -1); this.setRowValues(4, (int) levels4.catapultsLevel, -1, -1); break; } case 4: { VillageMap.TownHallLevels levels5 = new VillageMap.TownHallLevels(); village.getTownHallLevels(levels5); if (info2 != null) { this.setRowValues(0, (int) levels5.venisonLevel, info2.venisonLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(0x16), 0x16)); this.setRowValues(1, (int) levels5.furnitureLevel, info2.furnitureLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(0x15), 0x15)); this.setRowValues(2, (int) levels5.metalwareLevel, info2.metalwareLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(0x1a), 0x1a)); this.setRowValues(3, (int) levels5.clothesLevel, info2.clothesLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(0x13), 0x13)); this.setRowValues(4, (int) levels5.wineLevel, info2.wineLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(0x21), 0x21)); this.setRowValues(5, (int) levels5.saltLevel, info2.saltLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(0x17), 0x17)); this.setRowValues(6, (int) levels5.spicesLevel, info2.spicesLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(0x18), 0x18)); this.setRowValues(7, (int) levels5.silkLevel, info2.silkLevel, TradingCalcs.calcSellCost(localWorldData, info2.getFakeLevel(0x19), 0x19)); break; } this.setRowValues(0, (int) levels5.venisonLevel, -1, -1); this.setRowValues(1, (int) levels5.furnitureLevel, -1, -1); this.setRowValues(2, (int) levels5.metalwareLevel, -1, -1); this.setRowValues(3, (int) levels5.clothesLevel, -1, -1); this.setRowValues(4, (int) levels5.wineLevel, -1, -1); this.setRowValues(5, (int) levels5.saltLevel, -1, -1); this.setRowValues(6, (int) levels5.spicesLevel, -1, -1); this.setRowValues(7, (int) levels5.silkLevel, -1, -1); break; } } this.numTraders = village.numTraders(); this.numFreeTraders = village.numFreeTraders(); if (this.numFreeTraders > this.numTraders) { village.refreshTraderNumbers(); } this.tradersAvailableValue.Text = this.numFreeTraders.ToString() + "/" + this.numTraders.ToString(); this.traderCapacityValue.Text = (this.currentResourcePacketSize * this.numFreeTraders).ToString("N", nFI); } this.showBuySellWindow(); }
public void updateStockpile(GraphicsMgr gfx, VillageMap vm) { if (this.baseSprite != null) { if (this.stockpileExtension == null) { this.stockpileExtension = new VillageMapBuildingStockpileExtension(); for (int j = 0; j < 0x10; j++) { this.stockpileExtension.cell[j] = new SpriteWrapper(); this.stockpileExtension.cell[j].Visible = false; this.stockpileExtension.cell[j].PosX = -96 + VillageMapBuildingStockpileExtension.stockpileLayout[j * 2]; this.stockpileExtension.cell[j].PosY = -43 + VillageMapBuildingStockpileExtension.stockpileLayout[(j * 2) + 1]; this.baseSprite.AddChild(this.stockpileExtension.cell[j]); this.stockpileExtension.showGood(gfx, j, -1, 0); } } for (int i = 0; i < 0x10; i++) { this.stockpileExtension.showGood(gfx, i, -1, 0); } VillageMap.StockpileLevels levels = new VillageMap.StockpileLevels(); if (!vm.getStockpileLevels(levels)) { for (int k = 0; k < 0x10; k++) { this.stockpileExtension.showGood(gfx, k, -1, 0); } } else { int index = 0; if (levels.woodLevel > 13333248.0) { index = 12; } else if (levels.woodLevel > 3733248.0) { index = 11; } else if (levels.woodLevel > 1333248.0) { index = 10; } else if (levels.woodLevel > 373248.0) { index = 9; } else if (levels.woodLevel > 133248.0) { index = 8; } else if (levels.woodLevel > 37248.0) { index = 7; } else if (levels.woodLevel > 13248.0) { index = 6; } else if (levels.woodLevel > 3648.0) { index = 5; } else if (levels.woodLevel > 1248.0) { index = 4; } else if (levels.woodLevel > 288.0) { index = 3; } else if (levels.woodLevel > 48.0) { index = 2; } else if (levels.woodLevel > 0.0) { index = 1; } else { index = 0; } int num4 = 0; if (levels.stoneLevel > 13333248.0) { num4 = 12; } else if (levels.stoneLevel > 3733248.0) { num4 = 11; } else if (levels.stoneLevel > 1333248.0) { num4 = 10; } else if (levels.stoneLevel > 373248.0) { num4 = 9; } else if (levels.stoneLevel > 133248.0) { num4 = 8; } else if (levels.stoneLevel > 37248.0) { num4 = 7; } else if (levels.stoneLevel > 13248.0) { num4 = 6; } else if (levels.stoneLevel > 3648.0) { num4 = 5; } else if (levels.stoneLevel > 1248.0) { num4 = 4; } else if (levels.stoneLevel > 288.0) { num4 = 3; } else if (levels.stoneLevel > 48.0) { num4 = 2; } else if (levels.stoneLevel > 0.0) { num4 = 1; } else { num4 = 0; } int num5 = 0; if (levels.ironLevel > 13333248.0) { num5 = 12; } else if (levels.ironLevel > 3733248.0) { num5 = 11; } else if (levels.ironLevel > 1333248.0) { num5 = 10; } else if (levels.ironLevel > 373248.0) { num5 = 9; } else if (levels.ironLevel > 133248.0) { num5 = 8; } else if (levels.ironLevel > 37248.0) { num5 = 7; } else if (levels.ironLevel > 13248.0) { num5 = 6; } else if (levels.ironLevel > 3648.0) { num5 = 5; } else if (levels.ironLevel > 1248.0) { num5 = 4; } else if (levels.ironLevel > 288.0) { num5 = 3; } else if (levels.ironLevel > 48.0) { num5 = 2; } else if (levels.ironLevel > 0.0) { num5 = 1; } else { num5 = 0; } int num6 = 0; if (levels.pitchLevel > 4444416.0) { num6 = 12; } else if (levels.pitchLevel > 1244416.0) { num6 = 11; } else if (levels.pitchLevel > 444416.0) { num6 = 10; } else if (levels.pitchLevel > 124416.0) { num6 = 9; } else if (levels.pitchLevel > 44416.0) { num6 = 8; } else if (levels.pitchLevel > 12416.0) { num6 = 7; } else if (levels.pitchLevel > 4416.0) { num6 = 6; } else if (levels.pitchLevel > 1216.0) { num6 = 5; } else if (levels.pitchLevel > 416.0) { num6 = 4; } else if (levels.pitchLevel > 96.0) { num6 = 3; } else if (levels.pitchLevel > 16.0) { num6 = 2; } else if (levels.pitchLevel > 0.0) { num6 = 1; } else { num6 = 0; } for (int m = 0; m < 0x10; m++) { this.pilesUsed[m] = false; } int num8 = ((index + num4) + num5) + num6; if (num8 > 0x10) { int num9 = 0x10; int num10 = 0; if (index >= 1) { num10++; } if (num4 >= 1) { num10++; } if (num5 >= 1) { num10++; } if (num6 >= 1) { num10++; } num9 -= num10; double num11 = ((double)num9) / ((double)(num8 - num10)); PileOrderSort[] sortArray = new PileOrderSort[4]; int num12 = 0; if (index > 1) { PileOrderSort sort; sort = new PileOrderSort { origPiles = index - 1, numPiles = index - 1, type = 0 }; sortArray[num12++] = sort; } if (num4 > 1) { PileOrderSort sort2; sort2 = new PileOrderSort { origPiles = num4 - 1, numPiles = num4 - 1, type = 3 }; sortArray[num12++] = sort2; } if (num5 > 1) { PileOrderSort sort3; sort3 = new PileOrderSort { origPiles = num5 - 1, numPiles = num5 - 1, type = 4 }; sortArray[num12++] = sort3; } if (num6 > 1) { PileOrderSort sort4; sort4 = new PileOrderSort { origPiles = num6 - 1, numPiles = num6 - 1, type = 5 }; sortArray[num12++] = sort4; } if (num12 > 1) { for (int num13 = 0; num13 < (num12 - 1); num13++) { for (int num14 = 0; num14 < (num12 - 1); num14++) { if (sortArray[num14].numPiles < sortArray[num14 + 1].numPiles) { PileOrderSort sort5 = sortArray[num14]; sortArray[num14] = sortArray[num14 + 1]; sortArray[num14 + 1] = sort5; } } } } int num15 = 0; for (int num16 = 0; num16 < num12; num16++) { sortArray[num16].numPiles = Math.Floor((double)(sortArray[num16].numPiles * num11)); num15 += (int)sortArray[num16].numPiles; } if (num15 < num9) { int num17 = num9 - num15; for (int num18 = 0; num17 > 0; num18++) { int num19 = num18 % num12; if (sortArray[num19].numPiles < sortArray[num19].origPiles) { PileOrderSort sort1 = sortArray[num19]; sort1.numPiles++; num17--; } } } if (index >= 1) { index = 1; } if (num4 >= 1) { num4 = 1; } if (num5 >= 1) { num5 = 1; } if (num6 >= 1) { num6 = 1; } for (int num20 = 0; num20 < num12; num20++) { int numPiles = (int)sortArray[num20].numPiles; switch (sortArray[num20].type) { case 0: index += numPiles; break; case 3: num4 += numPiles; break; case 4: num5 += numPiles; break; case 5: num6 += numPiles; break; } } int num22 = ((index + num4) + num5) + num6; if (num22 != 0x10) { index = 0; } } int num23 = 0; int num24 = 0; for (int n = 0; n < index; n++) { num24 = this.woodPileOrder[num23++]; this.pilesUsed[num24] = true; if (n != (index - 1)) { this.stockpileExtension.showGood(gfx, num24, 6, 0x30); } else { int num26 = (((int)levels.woodLevel) - this.goods48Levels[index]) / this.goodsDividers[index]; this.stockpileExtension.showGood(gfx, num24, 6, Math.Min(num26, 0x30)); } } num23 = 0; for (int num27 = 0; num27 < num5; num27++) { do { num24 = this.ironPileOrder[num23++]; }while (this.pilesUsed[num24]); this.pilesUsed[num24] = true; if (num27 != (num5 - 1)) { this.stockpileExtension.showGood(gfx, num24, 8, 0x30); } else { int num28 = (((int)levels.ironLevel) - this.goods48Levels[num5]) / this.goodsDividers[num5]; this.stockpileExtension.showGood(gfx, num24, 8, Math.Min(num28, 0x30)); } } num23 = 0; for (int num29 = 0; num29 < num4; num29++) { do { num24 = this.stonePileOrder[num23++]; }while (this.pilesUsed[num24]); this.pilesUsed[num24] = true; if (num29 != (num4 - 1)) { this.stockpileExtension.showGood(gfx, num24, 7, 0x30); } else { int num30 = (((int)levels.stoneLevel) - this.goods48Levels[num4]) / this.goodsDividers[num4]; this.stockpileExtension.showGood(gfx, num24, 7, Math.Min(num30, 0x30)); } } num23 = 0; for (int num31 = 0; num31 < num6; num31++) { do { num24 = this.pitchPileOrder[num23++]; }while (this.pilesUsed[num24]); this.pilesUsed[num24] = true; if (num31 != (num6 - 1)) { this.stockpileExtension.showGood(gfx, num24, 9, 0x10); } else { int num32 = (((int)levels.pitchLevel) - this.goods16Levels[num6]) / this.goodsDividers[num6]; this.stockpileExtension.showGood(gfx, num24, 9, Math.Min(num32, 0x10)); } } } } }
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 void updateCommitValues() { int goldLevel = 0; VillageMap.StockpileLevels levels = new VillageMap.StockpileLevels(); if (GameEngine.Instance.Castle != null) { GameEngine.Instance.Castle.adjustLevels(ref levels, ref goldLevel); this.commitBuildWoodLabel.Text = (0.0 - levels.woodLevel).ToString(); this.commitBuildStoneLabel.Text = (0.0 - levels.stoneLevel).ToString(); this.commitBuildIronLabel.Text = (0.0 - levels.ironLevel).ToString(); this.commitBuildPitchLabel.Text = (0.0 - levels.pitchLevel).ToString(); this.commitBuildGoldLabel.Text = goldLevel.ToString(); this.commitBuildTimeLabel.Text = GameEngine.Instance.Castle.GetNewBuildTime(); } }
public void setCastleElementInfo(string pieceName, int woodCost, int stoneCost, int ironCost, int pitchCost, int goldCost, string buildTime, bool rollover) { NumberFormatInfo nFI = GameEngine.NFI; VillageMap village = GameEngine.Instance.Village; this.clearCastlePlaceInfo(); this.castlePlaceTypeLabel.Text = pieceName; this.castlePlaceTypeLabel.Visible = true; if (this.currentCastlePlaceTab != 0) { this.castlePlaceTimeLabel.Visible = true; if (buildTime.Length > 8) { string str = ""; bool flag = false; for (int i = 0; i < buildTime.Length; i++) { char ch = buildTime[i]; if (ch == ':') { if (flag) { break; } str = str + ch; flag = true; } else { str = str + ch; } } buildTime = str; } this.castlePlaceTimeImage.Visible = true; this.castlePlaceTimeLabel.Text = buildTime; if (woodCost > 0) { this.castlePlaceWoodLabel.Text = woodCost.ToString("N", nFI); this.castlePlaceWoodLabel.Visible = true; this.castlePlaceWoodImage.Visible = true; this.castlePlaceWoodLabel.Color = ARGBColors.Black; if ((village != null) && (village.getResourceLevel(6) < woodCost)) { this.castlePlaceWoodLabel.Color = ARGBColors.Red; } } if (stoneCost > 0) { this.castlePlaceStoneLabel.Text = stoneCost.ToString("N", nFI); this.castlePlaceStoneLabel.Visible = true; this.castlePlaceStoneImage.Visible = true; this.castlePlaceStoneLabel.Color = ARGBColors.Black; if ((village != null) && (village.getResourceLevel(7) < stoneCost)) { this.castlePlaceStoneLabel.Color = ARGBColors.Red; } } if (pitchCost > 0) { this.castlePlacePitchLabel.Text = pitchCost.ToString("N", nFI); this.castlePlacePitchLabel.Visible = true; this.castlePlacePitchImage.Visible = true; this.castlePlacePitchLabel.Color = ARGBColors.Black; if ((village != null) && (village.getResourceLevel(9) < pitchCost)) { this.castlePlacePitchLabel.Color = ARGBColors.Red; } } if (ironCost > 0) { this.castlePlaceIronLabel.Text = ironCost.ToString("N", nFI); this.castlePlaceIronLabel.Visible = true; this.castlePlaceIronImage.Visible = true; this.castlePlaceIronLabel.Color = ARGBColors.Black; if ((village != null) && (village.getResourceLevel(8) < ironCost)) { this.castlePlaceIronLabel.Color = ARGBColors.Red; } } double capitalGold = GameEngine.Instance.World.getCurrentGold(); int villageID = InterfaceMgr.Instance.getSelectedMenuVillage(); if (GameEngine.Instance.World.isCapital(villageID) && (GameEngine.Instance.Castle != null)) { capitalGold = village.m_capitalGold; int goldLevel = (int) capitalGold; VillageMap.StockpileLevels levels = new VillageMap.StockpileLevels(); GameEngine.Instance.Castle.adjustLevels(ref levels, ref goldLevel); this.castleTotalGoldLabel.Text = goldLevel.ToString("N", nFI); } if (goldCost > 0) { this.castlePlaceGoldLabel.Text = goldCost.ToString("N", nFI); this.castlePlaceGoldLabel.Visible = true; this.castlePlaceGoldImage.Visible = true; this.castlePlaceGoldLabel.Color = ARGBColors.Black; if (capitalGold < goldCost) { this.castlePlaceGoldLabel.Color = ARGBColors.Red; } } if (!rollover) { this.buildingBeingPlaced = true; } } }
public void updateValues() { NumberFormatInfo nFI = GameEngine.NFI; VillageMap village = GameEngine.Instance.Village; if (village != null) { if (this.selectedStockExchange < 0) { this.selectStockExchange(village.VillageID); } StockExchangeInfo info = null; if ((this.selectedStockExchange >= 0) && (this.stockExchanges[this.selectedStockExchange] != null)) { info = (StockExchangeInfo) this.stockExchanges[this.selectedStockExchange]; } WorldData localWorldData = GameEngine.Instance.LocalWorldData; if (this.lastTab == 1) { VillageMap.StockpileLevels levels = new VillageMap.StockpileLevels(); village.getStockpileLevels(levels); VillageMap.InnLevels levels2 = new VillageMap.InnLevels(); village.getInnLevels(levels2); if (info == null) { this.setRowValues(0, (int) levels.woodLevel, -1, -1); this.setRowValues(1, (int) levels.stoneLevel, -1, -1); this.setRowValues(2, (int) levels.ironLevel, -1, -1); this.setRowValues(3, (int) levels.pitchLevel, -1, -1); } else { this.setRowValues(0, (int) levels.woodLevel, info.woodLevel, TradingCalcs.calcSellCost(localWorldData, info.getFakeLevel(6), 6)); this.setRowValues(1, (int) levels.stoneLevel, info.stoneLevel, TradingCalcs.calcSellCost(localWorldData, info.getFakeLevel(7), 7)); this.setRowValues(2, (int) levels.ironLevel, info.ironLevel, TradingCalcs.calcSellCost(localWorldData, info.getFakeLevel(8), 8)); this.setRowValues(3, (int) levels.pitchLevel, info.pitchLevel, TradingCalcs.calcSellCost(localWorldData, info.getFakeLevel(9), 9)); } } } else { for (int i = 0; i < 8; i++) { this.setRowValues(i, -1, -1, -1); } } this.showBuySellWindow(); }
public void update() { VillageMap village = GameEngine.Instance.Village; if (village != null) { if (GameEngine.Instance.World.isRegionCapital(village.VillageID)) { this.stockpileHeaderLabel.Text = SK.Text("ResourcesPanel_Parish_Resources", "Parish Resources"); } else if (GameEngine.Instance.World.isCountyCapital(village.VillageID)) { this.stockpileHeaderLabel.Text = SK.Text("ResourcesPanel_County_Resources", "County Resources"); } else if (GameEngine.Instance.World.isProvinceCapital(village.VillageID)) { this.stockpileHeaderLabel.Text = SK.Text("ResourcesPanel_Province_Resources", "Province Resources"); } else if (GameEngine.Instance.World.isCountryCapital(village.VillageID)) { this.stockpileHeaderLabel.Text = SK.Text("ResourcesPanel_Country_Resources", "Country Resources"); } NumberFormatInfo nFI = GameEngine.NFI; VillageMap.StockpileLevels levels = new VillageMap.StockpileLevels(); village.getStockpileLevels(levels); this.woodLabel.Text = SK.Text("ResourceTypeWood", "Wood") + ": " + levels.woodLevel.ToString("N", nFI); this.stoneLabel.Text = SK.Text("ResourceType_Stone", "Stone") + ": " + levels.stoneLevel.ToString("N", nFI); this.pitchLabel.Text = SK.Text("ResourceType_Pitch", "Pitch") + ": " + levels.pitchLevel.ToString("N", nFI); this.ironLabel.Text = SK.Text("ResourceType_Iron", "Iron") + ": " + levels.ironLevel.ToString("N", nFI); } }
public void run() { long lastFrameTime = this.lastFrameTime; long currentMillisecondsLong = DXTimer.GetCurrentMillisecondsLong(); if (lastFrameTime == 0L) { lastFrameTime = currentMillisecondsLong - 0x21L; } long num3 = currentMillisecondsLong - lastFrameTime; if (num3 >= 0x21L) { this.ticked = true; if (num3 >= 0x31L) { this.lastFrameTime = currentMillisecondsLong; } else { this.lastFrameTime += 0x21L; } InterfaceMgr.Instance.getDXBasePanel().AllowDraw(); InterfaceMgr.Instance.getDXBasePanel().Invalidate(); Program.DoEvents(); } if (this.villageToAbandon >= 0) { DialogResult result; int villageToAbandon = this.villageToAbandon; this.villageHasBeenDownloaded = false; InterfaceMgr.Instance.changeTab(9); InterfaceMgr.Instance.changeTab(1); for (int i = 0; i < 210; i++) { Thread.Sleep(0x21); Program.DoEvents(); RemoteServices.Instance.processData(); if (this.villageHasBeenDownloaded) { this.villageToAbandon = -1; for (int j = 0; j < 10; j++) { Thread.Sleep(0x21); this.run(); RemoteServices.Instance.processData(); } break; } } int num7 = 0; VillageMap map = Instance.getVillage(villageToAbandon); if (map != null) { num7 = map.countBuildings(); } MessageBoxButtons yesNo = MessageBoxButtons.YesNo; if (num7 <= 0) { result = MyMessageBox.Show(SK.Text("Abandon_Message", "You are about to Abandon this village. You will lose ownership of this village and once abandoned it can not be reversed.") + Environment.NewLine + SK.Text("BuyVillagePopup_Are_You_REALLY_Sure", "Are You REALLY Sure you want to do this and that you have selected the correct village?") + Environment.NewLine + Environment.NewLine + SK.Text("BuyVillagePopup_To_Be_Abandon", "The Village to be abandoned is : ") + Environment.NewLine + Environment.NewLine + Instance.World.getVillageName(villageToAbandon) + Environment.NewLine + Environment.NewLine + ".", SK.Text("MENU_Abandon_Warning", "Warning! : Abandon") + " : " + Instance.World.getVillageName(villageToAbandon) + "?", yesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button2, 0); } else { result = MyMessageBox.Show(SK.Text("Abandon_Message", "You are about to Abandon this village. You will lose ownership of this village and once abandoned it can not be reversed.") + Environment.NewLine + SK.Text("BuyVillagePopup_Are_You_REALLY_Sure", "Are You REALLY Sure you want to do this and that you have selected the correct village?") + Environment.NewLine + Environment.NewLine + SK.Text("BuyVillagePopup_To_Be_Abandon", "The Village to be abandoned is : ") + Environment.NewLine + Environment.NewLine + Instance.World.getVillageName(villageToAbandon) + Environment.NewLine + Environment.NewLine + "." + SK.Text("BuyVillagePopup_Num_Buildings", "The number of buildings in this village : ") + num7.ToString() + Environment.NewLine + Environment.NewLine + ".", SK.Text("MENU_Abandon_Warning", "Warning! : Abandon") + " : " + Instance.World.getVillageName(villageToAbandon) + "?", yesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button2, 0); } if (result == DialogResult.Yes) { RemoteServices.Instance.set_VillageRename_UserCallBack(new RemoteServices.VillageRename_UserCallBack(MainMenuBar2.VillageRenameCallback)); RemoteServices.Instance.VillageAbandon(villageToAbandon); } this.villageToAbandon = -1; } if (!this.ticked) { goto Label_0F19; } if (this.lastSoundClear == DateTime.MinValue) { this.lastSoundClear = DateTime.Now; } else { TimeSpan span = (TimeSpan) (DateTime.Now - this.lastSoundClear); if (span.TotalMinutes > 5.0) { this.lastSoundClear = DateTime.Now; this.AudioEngine.unloadUnplayingSounds(); } } Program.steam_run(); Program.arc_run(); this.audio.update(); Form activeForm = Form.ActiveForm; if ((activeForm != InterfaceMgr.Instance.ParentForm) && (activeForm != InterfaceMgr.Instance.ChatForm)) { scrollLeft = false; scrollUp = false; scrollRight = false; scrollDown = false; Instance.GFX.keyControlled = false; shiftPressed = false; tabPressed = false; } this.gfx.RenderList.clearLayers(); this.ticked = false; this.tickCount++; if (this.GameDisplayMode == GameDisplays.DISPLAY_VILLAGE) { if (this.village != null) { this.village.Update(true); } if (this.castle != null) { this.castle.Update(false); } InterfaceMgr.Instance.runVillageInterface(); } else if (this.GameDisplayMode == GameDisplays.DISPLAY_CASTLE) { if (this.gameDisplayModeSubMode == GameDisplaySubModes.SUBMODE_DEFAULT) { if (this.village != null) { this.village.Update(false); } if (this.castle != null) { this.castle.Update(true); } InterfaceMgr.Instance.runCastleInterface(); } else if (this.gameDisplayModeSubMode == GameDisplaySubModes.SUBMODE_CASTLE_ATTACKER_SETUP) { if (this.castle_AttackerSetup != null) { this.castle_AttackerSetup.Update(true); } } else if ((this.gameDisplayModeSubMode == GameDisplaySubModes.SUBMODE_BATTLE) && (this.castle_Battle != null)) { this.castle_Battle.BattleUpdateManager(true); } } else { double currentMilliseconds; double callHomeRate; int num14; if (this.GameDisplayMode != GameDisplays.DISPLAY_WORLD) { if (this.GameDisplayMode == GameDisplays.DISPLAY_REPORTS) { if ((this.tickCount % 10) == 0) { InterfaceMgr.Instance.updateVillageReports(); } goto Label_095D; } if (this.GameDisplayMode == GameDisplays.DISPLAY_LEADERBOARD) { if ((this.tickCount % 10) == 0) { InterfaceMgr.Instance.updateVillageReports(); } goto Label_095D; } if (this.GameDisplayMode == GameDisplays.DISPLAY_USER_INFO) { if ((this.tickCount % 10) == 0) { InterfaceMgr.Instance.updateVillageReports(); } goto Label_095D; } if (this.GameDisplayMode == GameDisplays.DISPLAY_ALL_VILLAGES) { if ((this.tickCount % 10) == 0) { InterfaceMgr.Instance.updateVillageReports(); } goto Label_095D; } if (this.GameDisplayMode == GameDisplays.DISPLAY_RANKINGS) { InterfaceMgr.Instance.updateVillageReports(); goto Label_095D; } if (this.GameDisplayMode == GameDisplays.DISPLAY_FACTIONS) { if ((this.tickCount % 10) == 0) { InterfaceMgr.Instance.updateVillageReports(); } goto Label_095D; } if (this.GameDisplayMode == GameDisplays.DISPLAY_QUESTS) { InterfaceMgr.Instance.updateVillageReports(); goto Label_095D; } if (this.GameDisplayMode != GameDisplays.DISPLAY_ARMIES) { if (this.GameDisplayMode == GameDisplays.DISPLAY_RESEARCH) { InterfaceMgr.Instance.updateResearch((this.tickCount % 10) == 0); } else if (this.GameDisplayMode == GameDisplays.DISPLAY_AVATAR_EDITOR) { InterfaceMgr.Instance.updateVillageReports(); } goto Label_095D; } if ((this.tickCount % 10) != 0) { goto Label_095D; } currentMilliseconds = DXTimer.GetCurrentMilliseconds(); callHomeRate = this.LocalWorldData.callHomeRate; num14 = InterfaceMgr.Instance.getGameActivityMode(); switch (num14) { case 1: callHomeRate *= 2.0; break; case 2: callHomeRate *= 4.0; break; case 3: callHomeRate *= 6.0; break; case 4: callHomeRate *= 14.0; break; case 5: callHomeRate *= 20.0; break; } } else { bool special = false; this.world.Update(); if (this.world.ZoomChange != 0.0) { this.world.changeZoom((float) this.world.ZoomChange); if (this.world.ZoomChange <= 0.0) { this.world.centreMap(false); } } if ((this.tickCount % 10) == 0) { InterfaceMgr.Instance.updateTraderInfo(); InterfaceMgr.Instance.updatePersonInfo(); this.World.updateLocalVillagesFromFactions(); InterfaceMgr.Instance.ensureInfoTabCleared(); this.World.monitorAIInvasionActivity(); } double num8 = DXTimer.GetCurrentMilliseconds(); double num9 = this.LocalWorldData.callHomeRate; int mode = InterfaceMgr.Instance.getGameActivityMode(); switch (mode) { case 1: num9 *= 2.0; break; case 2: num9 *= 4.0; break; case 3: num9 *= 6.0; break; case 4: num9 *= 14.0; break; case 5: num9 *= 20.0; break; } this.clockMode = mode; double num11 = ((num8 - this.lastFullTickTime) * 64.0) / (num9 * 1000.0); this.clockFrame = (int) num11; if (this.clockFrame >= 0x3f) { this.clockFrame = 0x3f; } if (((num8 - this.lastFullTickTime) > (num9 * 1000.0)) || this.forceTriggerFullTick) { this.clockFrame = 0; this.forceTriggerFullTick = false; if ((num8 - this.lastFullTickRegisterTime) > 240000.0) { this.lastFullTickTime = num8; this.lastFullTickRegisterTime = num8; this.World.doFullTick(true, mode); } else if (!InterfaceMgr.Instance.isGameMinimised()) { this.lastFullTickTime = num8; this.World.doFullTick(false, mode); } special = true; } InterfaceMgr.Instance.worldTabUpdate(special); goto Label_095D; } if ((currentMilliseconds - this.lastFullTickTime) > (callHomeRate * 1000.0)) { this.lastFullTickTime = currentMilliseconds; this.World.doFullTick(false, num14); } InterfaceMgr.Instance.updateVillageReports(); } Label_095D: if ((this.GameDisplayMode != GameDisplays.DISPLAY_QUESTS) && ((this.tickCount % 60) == 0x23)) { NewQuestsPanel.handleClientSideQuestReporting(true); } if (this.forceTriggerFullTick && (this.GameDisplayMode != GameDisplays.DISPLAY_WORLD)) { double num15 = DXTimer.GetCurrentMilliseconds(); this.forceTriggerFullTick = false; this.lastFullTickTime = num15; this.World.doFullTick(false, 3); } if (((this.GameDisplayMode != GameDisplays.DISPLAY_WORLD) && (this.GameDisplayMode != GameDisplays.DISPLAY_ARMIES)) && !InterfaceMgr.Instance.isGameMinimised()) { double num16 = DXTimer.GetCurrentMilliseconds(); double num17 = this.LocalWorldData.callHomeRate; switch (InterfaceMgr.Instance.getGameActivityMode()) { case 0: num17 *= 3.0; break; case 1: num17 *= 4.0; break; case 2: num17 *= 7.0; break; case 3: num17 *= 10.0; break; case 4: num17 *= 19.0; break; case 5: num17 *= 25.0; break; } if ((num16 - this.lastFullTickTime) > (num17 * 1000.0)) { this.lastFullTickTime = num16; this.World.getArmiesIfNewAttacks(); } } if ((this.tickCount % 10) == 0) { if (Instance.GameDisplayMode == GameDisplays.DISPLAY_CASTLE) { int goldLevel = (int) this.world.getCurrentGold(); if ((this.Castle != null) && !this.World.isCapital(this.Castle.VillageID)) { VillageMap.StockpileLevels levels = new VillageMap.StockpileLevels(); this.Castle.adjustLevels(ref levels, ref goldLevel); InterfaceMgr.Instance.setGold((double) goldLevel); } } else { InterfaceMgr.Instance.setGold(this.world.getCurrentGold()); } InterfaceMgr.Instance.setHonour(this.world.getCurrentHonour(), this.world.getRank()); InterfaceMgr.Instance.setFaithPoints(this.world.getCurrentFaithPoints()); InterfaceMgr.Instance.setPoints(this.world.getCurrentPoints()); InterfaceMgr.Instance.setServerTime(VillageMap.getCurrentServerTime(), this.World.getGameDay()); if (RemoteServices.Instance.queueEmpty()) { InterfaceMgr.Instance.setConnectionLight(false); } else { InterfaceMgr.Instance.setConnectionLight(true); } long highestAttackingArmy = -1L; int numAttacks = this.World.countIncomingAttacks(ref highestAttackingArmy); InterfaceMgr.Instance.getMainTabBar().incomingAttacks(numAttacks, highestAttackingArmy); InterfaceMgr.Instance.getMainTabBar().updateResearchTime(this.World.UserResearchData); foreach (VillageMap map2 in this.villages) { if (map2 != null) { map2.makeTroopsUpdate(); } } this.World.updateArmyRetrievalData(); this.monitorDownTime(); Sound.monitorMusic(); } InterfaceMgr.Instance.mailUpdate(); InterfaceMgr.Instance.chatUpdate(); InterfaceMgr.Instance.getMainTabBar().update(); InterfaceMgr.Instance.updatePopups(); this.World.updateResearch(false); this.World.updateArmies(); this.World.updateTraders(); this.World.updatePeople(); PizzazzPopupWindow.updatePizzazz(); InterfaceMgr.Instance.runTutorialWindow(); this.manageInput(); if ((this.tickCount % 0x708) == 0) { GC.Collect(); GC.WaitForPendingFinalizers(); } if ((this.tickCount % 120) == 0) { this.World.runClientAchievementTests(); } if (((this.noVillagePopup == null) && (this.noAutoVillagePopup == null)) && ((this.lostVillagePopup == null) && RemoteServices.Instance.Show5thAgeMessage)) { Instance.openLostVillage(5); RemoteServices.Instance.Show2ndAgeMessage = false; RemoteServices.Instance.Show3rdAgeMessage = false; RemoteServices.Instance.Show4thAgeMessage = false; } if ((((this.noVillagePopup == null) && (this.noAutoVillagePopup == null)) && ((this.lostVillagePopup == null) && RemoteServices.Instance.Show4thAgeMessage)) && !RemoteServices.Instance.Show5thAgeMessage) { Instance.openLostVillage(4); RemoteServices.Instance.Show2ndAgeMessage = false; RemoteServices.Instance.Show3rdAgeMessage = false; } if ((((this.noVillagePopup == null) && (this.noAutoVillagePopup == null)) && ((this.lostVillagePopup == null) && RemoteServices.Instance.Show3rdAgeMessage)) && (!RemoteServices.Instance.Show4thAgeMessage && !RemoteServices.Instance.Show5thAgeMessage)) { Instance.openLostVillage(3); RemoteServices.Instance.Show2ndAgeMessage = false; } if ((((this.noVillagePopup == null) && (this.noAutoVillagePopup == null)) && ((this.lostVillagePopup == null) && RemoteServices.Instance.Show2ndAgeMessage)) && ((!RemoteServices.Instance.Show3rdAgeMessage && !RemoteServices.Instance.Show4thAgeMessage) && !RemoteServices.Instance.Show5thAgeMessage)) { Instance.openLostVillage(2); } if ((((this.noVillagePopup == null) && (this.noAutoVillagePopup == null)) && ((this.lostVillagePopup == null) && !this.World.isRetrievingUserVillages())) && !LoggingOutPopup.loggingOut) { if (this.World.numVillagesOwned() == 0) { this.World.updateLastAttackerInfo(); } } else if (this.noVillagePopup != null) { this.noVillagePopup.update(); } else if (this.lostVillagePopup != null) { this.lostVillagePopup.update(); } else if (this.noAutoVillagePopup != null) { this.noAutoVillagePopup.update(); } TutorialWindow.runTutorial(); this.debugPopupRun(); this.loginHistoryRun(); if (this.pendingUserVillageZoom) { int villageID = InterfaceMgr.Instance.getSelectedMenuVillage(); if (villageID >= 0) { this.pendingUserVillageZoom = false; WorldMap.VillageData data = this.world.getVillageData(villageID); if (data != null) { this.world.startMultiStageZoom(10000.0, (double) data.x, (double) data.y); } } } Label_0F19: if (Program.ShowSeasonalFX && (SnowSystem.getInstance().snowTexture != null)) { SnowSystem.getInstance().update(this.gfx); } if (this.finaliseResize) { try { this.finaliseResize = false; if (InterfaceMgr.Instance.ParentForm != null) { ((MainWindow) InterfaceMgr.Instance.ParentForm).finaliseResize(); } } catch (Exception) { } } }