public static ColonyModel MapColony(Colony c) { return(new ColonyModel() { ColonyId = c.ColonyID, Name = c.Name, LaborerCount = c.LaborerCount, AutoRecruit = c.JobFinder.AutoRecruit, AvailableMeals = c.Stockpile.TotalMeals, BedCount = c.BedTracker.BedCount, OpenJobCount = ColonyTool.GetJobCounts(c).Select(kvp => kvp.Value.AvailableCount).Sum(), StockpileCount = c.Stockpile.ItemCount, BannerCount = c.Banners.Length, ColonistCount = c.FollowerCount, Owners = c.Owners.Select(o => o.Name).ToList(), ColonyState = ColonyState.GetColonyState(c), MonsterCount = MonsterTracker.GetAllMonstersByID().Where(m => m.Value.OriginalGoal.ColonyID == c.ColonyID).Count() }); }
public static ColonyModel MapColony(Colony c) { return(new ColonyModel() { ColonyId = c.ColonyID, Name = c.Name, LaborerCount = c.LaborerCount, AutoRecruit = c.JobFinder.AutoRecruit, AvailableFood = c.Stockpile.TotalFood, BedCount = c.BedTracker.BedCount, Happiness = c.HappinessData.CachedHappiness, OpenJobCount = c.JobFinder.OpenJobCount, StockpileCount = c.Stockpile.ItemCount, BannerCount = c.Banners.Length, ColonistCount = c.FollowerCount, Owners = c.Owners.Select(o => o.Name).ToList(), ColonyState = ColonyState.GetColonyState(c), MonsterCount = MonsterTracker.GetAllMonstersByID().Where(m => m.Value.OriginalGoal.ColonyID == c.ColonyID).Count() }); }