public static PlaceResult PlaceFromGameBin(EditTownModel ths, UIBinInfo info, ulong lotId, PlaceAction action) { PlaceResult contentFailure = PlaceResult.ContentFailure; Lot lot = LotManager.GetLot(lotId); if (lot == null) { return(PlaceResult.InvalidLot); } else if (lot.Household != null) { return(PlaceResult.HouseholdPresent); } ths.GetInWorldHouseholdBinInfoList(); contentFailure = PlaceResult.ContentFailure; if (info.HouseholdId != ulong.MaxValue) { BinCommon.KickSimsOffLot(lot, true); if (info.LotId != ulong.MaxValue) { contentFailure = BinCommonEx.PlaceHouseholdAndContentsFromGameBin(info.ContentId, lot, action, Mover.GetLotCost); } else { contentFailure = BinCommonEx.PlaceHouseholdFromGameBin(info.ContentId, lot, action, Mover.GetLotCost); } if (contentFailure != PlaceResult.Success) { return(contentFailure); } ths.mGameBin.Remove(info); if (ths.GameBinChanged != null) { ths.GameBinChanged(ths, null); } info = BinCommon.CreateInWorldBinInfo(lot.Household, lot); if (info != null) { ths.mInWorldHouseholdBin.Add(info); } } return(contentFailure); }
public static PlaceResult PlaceFromExportBin(EditTownModel ths, UIBinInfo info, ulong lotId, PlaceAction action, bool showConfirmDialog) { try { PlaceResult contentFailure = PlaceResult.ContentFailure; Lot lot = LotManager.GetLot(lotId); if (lot == null) { return(PlaceResult.InvalidLot); } ExportBinContents exportBinItem = ths.FindExportBinContents(info.ContentId); if (exportBinItem != null) { ths.GetInWorldHouseholdBinInfoList(); ths.GetInWorldLotBinInfoList(); Sim newActiveSim = null; if (lot.Household != null) { return(BinCommonEx.MergeHouseholdFromExportBin(exportBinItem, lot, showConfirmDialog, Mover.Settings.mAllowGreaterThanEight)); } BinCommon.KickSimsOffLot(lot, true); ProgressDialog.Show(Localization.LocalizeString("Ui/Caption/Global:Processing", new object[0x0])); try { try { contentFailure = BinCommonEx.PlaceFromExportBin(exportBinItem, lot, action, true, Mover.GetLotCost, ref newActiveSim); ExportBinContentsEx.Flush(exportBinItem); UIBinInfo item = BinCommon.CreateInWorldBinInfo(lot.Household, lot); if (item != null) { if (info.HouseholdId != ulong.MaxValue) { ths.mInWorldHouseholdBin.Add(item); } else { ths.mInWorldLotBin.Add(item); } } } finally { ProgressDialog.Close(); } } catch (ExecutionEngineException) { } } return(contentFailure); } catch (Exception e) { Common.Exception("PlaceFromExportBin", e); return(PlaceResult.ContentFailure); } }
public static PlaceResult MergeHouseholdFromExportBin(ExportBinContents exportBinItem, Lot lot, bool showConfirmDialog, bool allowOverstuff) { try { if (exportBinItem == null) { return(PlaceResult.ContentFailure); } bool flag = exportBinItem.IsLoaded(); if (!flag) { ExportBinContentsEx.Import(exportBinItem, false); } PlaceResult householdPresent = PlaceResult.HouseholdPresent; Household household = exportBinItem.Household; Household otherHouse = lot.Household; if (household == null) { householdPresent = PlaceResult.InvalidBinHousehold; } if (lot == null) { householdPresent = PlaceResult.InvalidLot; } if (exportBinItem == null) { householdPresent = PlaceResult.ContentFailure; } try { try { if (((household != null) && (householdPresent == PlaceResult.HouseholdPresent)) && (otherHouse != null)) { // Custom if ((!allowOverstuff) && (!household.CanMergeWithHousehold(otherHouse, false))) { SimpleMessageDialog.Show(Common.LocalizeEAString("Ui/Caption/GameEntry/EditTown:MergeWarning"), Common.LocalizeEAString("Ui/Caption/MovingDialog:TooManySims")); } // Custom else if ((!allowOverstuff) && (!household.CanMergeWithHousehold(otherHouse, true))) { SimpleMessageDialog.Show(Common.LocalizeEAString("Ui/Caption/GameEntry/EditTown:MergeWarning"), Common.LocalizeEAString("Ui/Caption/MovingDialog:TooManySims_Pregnant")); } else if (!showConfirmDialog || PlayFlowConfirmMergePetHousehold.Show(BinCommon.CreateInWorldBinInfo(lot.LotId), exportBinItem.BinInfo)) { ProgressDialog.Show(Common.LocalizeEAString("Ui/Caption/Global:Processing")); otherHouse.ModifyFamilyFunds(household.FamilyFunds); List <SimDescription> simDescs = new List <SimDescription>(); foreach (SimDescription description in household.AllSimDescriptions) { simDescs.Add(description); } CreateActors(simDescs, null, false); BinCommon.CreateFamilyInventories(household, exportBinItem.HouseholdContents); BinCommon.MoveInventoryInto(household, otherHouse); household.PostImport(); List <Sim> sims = new List <Sim>(); foreach (SimDescription description2 in simDescs) { otherHouse.AddSim(description2.CreatedSim); sims.Add(description2.CreatedSim); } otherHouse.AddWardrobeToWardrobe(household.Wardrobe); otherHouse.AddServiceUniforms(household.ServiceUniforms); CreateSimInventories(simDescs, exportBinItem.HouseholdContents, exportBinItem.IndexMap); BinCommon.PlaceSims(sims, lot); ThumbnailManager.GenerateHouseholdThumbnail(otherHouse.HouseholdId, otherHouse.HouseholdId, ThumbnailSizeMask.Large | ThumbnailSizeMask.Medium); (Sims3.UI.Responder.Instance.EditTownModel as EditTownModel).DirtyWorldBins(); Bin.Singleton.FireContentsChanged(); } } Household.CleanupOldIdToNewSimDescriptionMap(); if (!flag) { ExportBinContentsEx.Flush(exportBinItem); } } finally { ProgressDialog.Close(); } } catch (ExecutionEngineException) { } return(householdPresent); } catch (Exception e) { Common.Exception("MergeHouseholdFromExportBin", e); return(PlaceResult.ContentFailure); } }