public static string ExportHousehold(Bin ths, Household household, bool includeLotContents, bool isMovingPacked) { try { string str = null; if (GameUtils.IsInstalled(ProductVersion.EP4)) { OccultImaginaryFriend.ForceHouseholdImaginaryFriendsBackToInventory(household); } foreach (Sim sim in household.AllActors) { sim.SetObjectToReset(); } Common.Sleep(); if (includeLotContents) { Lot lotHome = household.LotHome; if (lotHome != null) { int num = household.FamilyFunds; int num2 = World.GetEmptyLotWorth(lotHome.LotId) + ((int)World.GetLotAdditionalPropertyValue(lotHome.LotId)); household.SetFamilyFunds(household.FamilyFunds + num2, false); EditTownModel.SendObjectsToProperLot(lotHome); ulong contentId = DownloadContent.StoreLotContents(lotHome, lotHome.LotId); if (contentId != 0x0L) { ThumbnailHelper.GenerateLotThumbnailSet(lotHome.LotId, contentId, ThumbnailSizeMask.ExtraLarge); ThumbnailHelper.GenerateLotThumbnail(lotHome.LotId, contentId, 0x0, ThumbnailSizeMask.Large | ThumbnailSizeMask.Medium); ThumbnailSizeMask mask = ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium; ThumbnailManager.GenerateHouseholdThumbnail(household.HouseholdId, contentId, mask); ths.GenerateSimThumbnails(household, contentId, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge); HouseholdContentsProxy contents = new HouseholdContentsProxy(household); if (DownloadContent.StoreHouseholdContents(contents, contentId)) { str = DownloadContent.ExportLotContentsToExportBin(contentId); } ThumbnailManager.InvalidateLotThumbnails(lotHome.LotId, contentId, ThumbnailSizeMask.ExtraLarge); ThumbnailManager.InvalidateLotThumbnailsForGroup(lotHome.LotId, contentId, ThumbnailSizeMask.Medium, 0x0); ThumbnailManager.InvalidateHouseholdThumbnail(household.HouseholdId, contentId, mask); ths.InvalidateSimThumbnails(household, contentId); } household.SetFamilyFunds(num, false); } return(str); } int familyFunds = household.FamilyFunds; int realEstateFunds = 0; if (household.RealEstateManager != null) { foreach (IPropertyData data in household.RealEstateManager.AllProperties) { realEstateFunds += data.TotalValue; } } if (household.LotHome != null) { int lotWorth = 0; if (isMovingPacked) { lotWorth = World.GetUnfurnishedLotWorth(household.LotHome.LotId) + realEstateFunds; } else { lotWorth = World.GetLotWorth(household.LotHome.LotId) + realEstateFunds; } household.SetFamilyFunds(household.FamilyFunds + lotWorth, false); } if (household.FamilyFunds < 0x4e20) { household.SetFamilyFunds(0x4e20, false); } ulong cacheId = DownloadContent.GenerateGUID(); HouseholdContentsProxy householdContents = new HouseholdContentsProxy(household); householdContents.Contents.ContentId = cacheId; ThumbnailSizeMask sizeMask = ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium; ThumbnailManager.GenerateHouseholdThumbnail(household.HouseholdId, cacheId, sizeMask); ths.GenerateSimThumbnails(household, cacheId, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge); if (DownloadContent.StoreHouseholdContents(householdContents, cacheId)) { str = DownloadContent.ExportLotContentsToExportBin(cacheId); } ThumbnailManager.InvalidateHouseholdThumbnail(household.HouseholdId, cacheId, sizeMask); ths.InvalidateSimThumbnails(household, cacheId); household.SetFamilyFunds(familyFunds, false); return(str); } catch (Exception e) { Common.Exception("ExportHousehold", e); return(null); } }
//public static string NExportHousehold(Bin ths, Household household, bool includeLotContents, bool isMovingPacked) //{ // return NExportHousehold(ths, household, includeLotContents, isMovingPacked, false); //} public static string NExportHousehold(Bin ths, Household household, bool includeLotContents, bool isMovingPacked, bool noReset, bool noThum) { if (ths == null) { throw new NullReferenceException(); } if (household == null) { throw new ArgumentNullException("household"); } try { string createdPackageFile = null; if (GameUtils.IsInstalled(ProductVersion.EP4)) { OccultImaginaryFriend.ForceHouseholdImaginaryFriendsBackToInventory(household); } if (!noReset) { foreach (Sim sim in household.AllActors) { sim.SetObjectToReset(); } } if (Simulator.CheckYieldingContext(false)) { Simulator.Sleep(0); } ThumbnailSizeMask sizeMask; if (includeLotContents) { Lot lotHome = household.LotHome; if (lotHome != null) { int householdFunds = household.FamilyFunds; int lotHomeLotWorth = World.GetEmptyLotWorth(lotHome.LotId) + ((int)World.GetLotAdditionalPropertyValue(lotHome.LotId)); household.SetFamilyFunds(householdFunds + lotHomeLotWorth, false); EditTownModel.SendObjectsToProperLot(lotHome); ulong contentID = DownloadContent.StoreLotContents(lotHome, lotHome.LotId); if (contentID != 0) { ThumbnailHelper.GenerateLotThumbnailSet(lotHome.LotId, contentID, ThumbnailSizeMask.ExtraLarge); ThumbnailHelper.GenerateLotThumbnail(lotHome.LotId, contentID, 0, ThumbnailSizeMask.Large | ThumbnailSizeMask.Medium); sizeMask = ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium; ThumbnailManager.GenerateHouseholdThumbnail(household.HouseholdId, contentID, sizeMask); if (!noThum && household.AllSimDescriptions.Count < 12) { ths.GenerateSimThumbnails(household, contentID, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge); } HouseholdContentsProxy contents = new HouseholdContentsProxy(household); if (DownloadContent.StoreHouseholdContents(contents, contentID)) { createdPackageFile = DownloadContent.ExportLotContentsToExportBin(contentID); } ThumbnailManager.InvalidateLotThumbnails(lotHome.LotId, contentID, ThumbnailSizeMask.ExtraLarge); ThumbnailManager.InvalidateLotThumbnailsForGroup(lotHome.LotId, contentID, ThumbnailSizeMask.Medium, 0); ThumbnailManager.InvalidateHouseholdThumbnail(household.HouseholdId, contentID, sizeMask); try { ths.InvalidateSimThumbnails(household, contentID); } catch (Exception) { if (IsOpenDGSInstalled) { return(null); } } } household.SetFamilyFunds(householdFunds, false); return(createdPackageFile); } //return createdPackageFile; } int familyFunds = household.FamilyFunds; int realEstateFunds = 0; if (household.RealEstateManager != null) { foreach (IPropertyData data in household.RealEstateManager.AllProperties) { realEstateFunds += data.TotalValue; } } if (household.LotHome != null) { int lotWorth = 0; if (isMovingPacked) { lotWorth = World.GetUnfurnishedLotWorth(household.LotHome.LotId) + realEstateFunds; } else { lotWorth = World.GetLotWorth(household.LotHome.LotId) + realEstateFunds; } household.SetFamilyFunds(household.FamilyFunds + lotWorth, false); } if (household.FamilyFunds < 20000) { household.SetFamilyFunds(20000, false); } ulong gGUID = DownloadContent.GenerateGUID(); HouseholdContentsProxy householdContents = new HouseholdContentsProxy(household); householdContents.Contents.ContentId = gGUID; sizeMask = ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium; if (!noThum && household.AllSimDescriptions.Count < 12) { ThumbnailManager.GenerateHouseholdThumbnail(household.HouseholdId, gGUID, sizeMask); ths.GenerateSimThumbnails(household, gGUID, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge); } if (DownloadContent.StoreHouseholdContents(householdContents, gGUID)) { createdPackageFile = DownloadContent.ExportLotContentsToExportBin(gGUID); } ThumbnailManager.InvalidateHouseholdThumbnail(household.HouseholdId, gGUID, sizeMask); try { ths.InvalidateSimThumbnails(household, gGUID); } catch (Exception) { if (IsOpenDGSInstalled) { return(null); } } household.SetFamilyFunds(familyFunds, false); return(createdPackageFile); } catch (Exception) { return(null); } }