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 updateInn(GraphicsMgr gfx, VillageMap vm)
 {
     if (this.baseSprite != null)
     {
         if (this.innExtension == null)
         {
             this.innExtension = new VillageMapBuildingInnExtension();
             for (int j = 0; j < 3; j++)
             {
                 this.innExtension.cell[j] = new SpriteWrapper();
                 this.innExtension.cell[j].Visible = false;
                 this.innExtension.cell[j].PosX = -80 + VillageMapBuildingInnExtension.innLayout[j * 2];
                 this.innExtension.cell[j].PosY = -44 + VillageMapBuildingInnExtension.innLayout[(j * 2) + 1];
                 this.baseSprite.AddChild(this.innExtension.cell[j]);
                 this.innExtension.showGood(gfx, j, -1, 0);
             }
         }
         for (int i = 0; i < 3; i++)
         {
             this.innExtension.showGood(gfx, i, -1, 0);
         }
         VillageMap.InnLevels levels = new VillageMap.InnLevels();
         if (vm.getInnLevels(levels))
         {
             if (levels.aleLevel == 0.0)
             {
                 if (vm.m_effectiveAleRationsLevel > 0.0)
                 {
                     this.open = true;
                 }
                 else
                 {
                     this.open = false;
                 }
             }
             else
             {
                 this.open = true;
                 int index = 0;
                 if (levels.aleLevel > 416.0)
                 {
                     index = 4;
                 }
                 else if (levels.aleLevel > 96.0)
                 {
                     index = 3;
                 }
                 else if (levels.aleLevel > 16.0)
                 {
                     index = 2;
                 }
                 else if (levels.aleLevel > 0.0)
                 {
                     index = 1;
                 }
                 else
                 {
                     index = 0;
                 }
                 if (index > 3)
                 {
                     index = 3;
                 }
                 for (int k = 0; k < index; k++)
                 {
                     if (k != (index - 1))
                     {
                         this.innExtension.showGood(gfx, k, 12, 0x10);
                     }
                     else
                     {
                         int num6 = (((int) levels.aleLevel) - this.goods16Levels[index]) / this.goodsDividers[index];
                         this.innExtension.showGood(gfx, k, 12, Math.Min(num6, 0x10));
                     }
                 }
             }
         }
     }
 }
 public void updateInn(GraphicsMgr gfx, VillageMap vm)
 {
     if (this.baseSprite != null)
     {
         if (this.innExtension == null)
         {
             this.innExtension = new VillageMapBuildingInnExtension();
             for (int j = 0; j < 3; j++)
             {
                 this.innExtension.cell[j]         = new SpriteWrapper();
                 this.innExtension.cell[j].Visible = false;
                 this.innExtension.cell[j].PosX    = -80 + VillageMapBuildingInnExtension.innLayout[j * 2];
                 this.innExtension.cell[j].PosY    = -44 + VillageMapBuildingInnExtension.innLayout[(j * 2) + 1];
                 this.baseSprite.AddChild(this.innExtension.cell[j]);
                 this.innExtension.showGood(gfx, j, -1, 0);
             }
         }
         for (int i = 0; i < 3; i++)
         {
             this.innExtension.showGood(gfx, i, -1, 0);
         }
         VillageMap.InnLevels levels = new VillageMap.InnLevels();
         if (vm.getInnLevels(levels))
         {
             if (levels.aleLevel == 0.0)
             {
                 if (vm.m_effectiveAleRationsLevel > 0.0)
                 {
                     this.open = true;
                 }
                 else
                 {
                     this.open = false;
                 }
             }
             else
             {
                 this.open = true;
                 int index = 0;
                 if (levels.aleLevel > 416.0)
                 {
                     index = 4;
                 }
                 else if (levels.aleLevel > 96.0)
                 {
                     index = 3;
                 }
                 else if (levels.aleLevel > 16.0)
                 {
                     index = 2;
                 }
                 else if (levels.aleLevel > 0.0)
                 {
                     index = 1;
                 }
                 else
                 {
                     index = 0;
                 }
                 if (index > 3)
                 {
                     index = 3;
                 }
                 for (int k = 0; k < index; k++)
                 {
                     if (k != (index - 1))
                     {
                         this.innExtension.showGood(gfx, k, 12, 0x10);
                     }
                     else
                     {
                         int num6 = (((int)levels.aleLevel) - this.goods16Levels[index]) / this.goodsDividers[index];
                         this.innExtension.showGood(gfx, k, 12, Math.Min(num6, 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 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();
 }