public static List <IDescendantHouseholdUiData> GetTimeAlamanacDescendantHouseholdData(FutureDescendantService instance) { // custom BuildDescendantHouseholdSpecs(instance); List <IDescendantHouseholdUiData> list = new List <IDescendantHouseholdUiData>(); List <ulong> remove = new List <ulong>(); foreach (ulong num in FutureDescendantService.sPersistableData.DescendantHouseholdsMap.Keys) { // Overwatch does this too but no harm in doing it here too if (SimDescription.Find(num) == null && MiniSims.Find(num) == null) { remove.Add(num); } FutureDescendantService.DescendantHouseholdUiData item = new FutureDescendantService.DescendantHouseholdUiData { mAncestorSimId = num }; int householdWealthScore = 0; int numberOfMembers = 0; bool flag = false; foreach (FutureDescendantService.FutureDescendantHouseholdInfo info in FutureDescendantService.sPersistableData.DescendantHouseholdsMap[num]) { if (remove.Contains(num) && info.IsSimAnAncestor(num)) { FutureDescendantService.sPersistableData.InvalidDescendantHouseholdsInfo.Add(info); flag = true; continue; } if (!info.HasAncestorFromHousehold(Household.ActiveHousehold)) { flag = true; continue; } foreach (ulong num4 in info.mHouseholdMembers) { IMiniSimDescription iMiniSimDescription = SimDescription.GetIMiniSimDescription(num4); if ((iMiniSimDescription != null) && !item.mHouseholdMembers.Contains(iMiniSimDescription)) { item.mHouseholdMembers.Add(iMiniSimDescription); } } householdWealthScore += info.mCurrentHouseholdWealthScore; numberOfMembers += info.mCurrentDesiredHouseholdSize; } householdWealthScore /= Math.Max(1, FutureDescendantService.sPersistableData.DescendantHouseholdsMap[num].Count); numberOfMembers /= Math.Max(1, FutureDescendantService.sPersistableData.DescendantHouseholdsMap[num].Count); item.mHouseholdWorth = FutureDescendantService.GetWealthTypeString(householdWealthScore); item.mHouseholdSize = FutureDescendantService.GetHouseholdSizeString(numberOfMembers); if (item != null && !flag) { list.Add(item); } } return(list); }
public static List<IDescendantHouseholdUiData> GetTimeAlamanacDescendantHouseholdData(FutureDescendantService instance) { // custom BuildDescendantHouseholdSpecs(instance); List<IDescendantHouseholdUiData> list = new List<IDescendantHouseholdUiData>(); List<ulong> remove = new List<ulong>(); foreach (ulong num in FutureDescendantService.sPersistableData.DescendantHouseholdsMap.Keys) { // Overwatch does this too but no harm in doing it here too if (SimDescription.Find(num) == null && MiniSims.Find(num) == null) { remove.Add(num); } FutureDescendantService.DescendantHouseholdUiData item = new FutureDescendantService.DescendantHouseholdUiData { mAncestorSimId = num }; int householdWealthScore = 0; int numberOfMembers = 0; bool flag = false; foreach (FutureDescendantService.FutureDescendantHouseholdInfo info in FutureDescendantService.sPersistableData.DescendantHouseholdsMap[num]) { if (remove.Contains(num) && info.IsSimAnAncestor(num)) { FutureDescendantService.sPersistableData.InvalidDescendantHouseholdsInfo.Add(info); flag = true; continue; } if (!info.HasAncestorFromHousehold(Household.ActiveHousehold)) { flag = true; continue; } foreach (ulong num4 in info.mHouseholdMembers) { IMiniSimDescription iMiniSimDescription = SimDescription.GetIMiniSimDescription(num4); if ((iMiniSimDescription != null) && !item.mHouseholdMembers.Contains(iMiniSimDescription)) { item.mHouseholdMembers.Add(iMiniSimDescription); } } householdWealthScore += info.mCurrentHouseholdWealthScore; numberOfMembers += info.mCurrentDesiredHouseholdSize; } householdWealthScore /= Math.Max(1, FutureDescendantService.sPersistableData.DescendantHouseholdsMap[num].Count); numberOfMembers /= Math.Max(1, FutureDescendantService.sPersistableData.DescendantHouseholdsMap[num].Count); item.mHouseholdWorth = FutureDescendantService.GetWealthTypeString(householdWealthScore); item.mHouseholdSize = FutureDescendantService.GetHouseholdSizeString(numberOfMembers); if (item != null && !flag) { list.Add(item); } } return list; }