public override void RefreshValues() { var town = _ownWorkshopCopy.Settlement.GetComponent <Town>(); var stash = MBObjectManager.Instance.GetObject <TownWorkshopStash>(x => x.Town == town); AmountInStash = (stash?.Stash.Where(x => x.EquipmentElement.Item.ItemCategory == _inputType).Sum(x => x.Amount) ?? 0).ToString(); var items = town.Owner.ItemRoster.Where(x => x.EquipmentElement.Item.ItemCategory == _inputType && x.Amount > 0); var totalAmount = items.Sum(x => x.Amount); AmountInTown = totalAmount.ToString(); var price = totalAmount == 0 ? 0 : items.Sum(x => town.GetItemPrice(x.EquipmentElement) * x.Amount) / (float)totalAmount; PriceInTown = ((int)price).ToString(); PriceBrush = "Clan.Finance.TotalIncome.Text"; if (price > _inputType.AverageValue) { PriceBrush = "Clan.Finance.TotalExpenses.Text"; } var realItem = ItemObject.All.FirstOrDefault(x => _inputType == x.ItemCategory); InputName = _inputType.GetName().ToString(); ImageIdentifier = new ImageIdentifierVM(realItem); }