Ejemplo n.º 1
0
        public static PlaceResult PlaceFromExportBin(ExportBinContents exportBinItem, Lot lot, PlaceAction action, bool buyFurnished, GetLotCost onLotCost, ref Sim newActiveSim)
        {
            if (exportBinItem == null)
            {
                return(PlaceResult.ContentFailure);
            }

            bool flag = exportBinItem.IsLoaded();

            if (!flag)
            {
                ExportBinContentsEx.Import(exportBinItem, false);
            }

            PlaceResult result = PlaceFromExportBin(exportBinItem.Household, exportBinItem, lot, action, buyFurnished, onLotCost, ref newActiveSim);

            if (!flag)
            {
                ExportBinContentsEx.Flush(exportBinItem);
            }

            return(result);
        }
Ejemplo n.º 2
0
        public static PlaceResult PlaceFromExportBin(Household household, ExportBinContents exportBinItem, Lot lot, PlaceAction action, bool buyFurnished, GetLotCost onLotCost, ref Sim newActiveSim)
        {
            if (household == null)
            {
                return(PlaceResult.InvalidBinHousehold);
            }
            else if (lot == null)
            {
                return(PlaceResult.InvalidLot);
            }
            else if (exportBinItem == null)
            {
                return(PlaceResult.ContentFailure);
            }

            bool flag = exportBinItem.IsLoaded();

            if (!flag)
            {
                ExportBinContentsEx.Import(exportBinItem, false);
            }

            PlaceResult contentFailure = PlaceResult.ContentFailure;

            if (household != null)
            {
                if (((action & PlaceAction.PlaceAndPay) != PlaceAction.PlaceOnly) && !PayForLot(household, lot, buyFurnished, onLotCost))
                {
                    if (!flag)
                    {
                        ExportBinContentsEx.Flush(exportBinItem);
                    }
                    Household.CleanupOldIdToNewSimDescriptionMap();
                    return(PlaceResult.InsufficientFunds);
                }

                if ((!buyFurnished) && (!lot.IsApartmentLot))
                {
                    lot.MakeLotUnfurnished();
                    Common.Sleep();
                    lot.UpdateCachedValues();
                }

                CreateActors(household, lot, false);
                CreateInventories(household, exportBinItem.HouseholdContents, exportBinItem.IndexMap);
                Common.Sleep();
                BinCommon.UpdateImportedUrnstones(household, lot);
                household.PostImport();

                if ((action & PlaceAction.MoveIn) != PlaceAction.PlaceOnly)
                {
                    BinCommon.MoveIn(household, lot);
                }
                if ((action & PlaceAction.Activate) != PlaceAction.PlaceOnly)
                {
                    newActiveSim = BinCommon.ActivateSim(exportBinItem.Household, lot);
                }

                ThumbnailManager.GenerateHouseholdThumbnail(household.HouseholdId, household.HouseholdId, ThumbnailSizeMask.Large | ThumbnailSizeMask.Medium);
                contentFailure = PlaceResult.Success;
            }

            if (!flag)
            {
                ExportBinContentsEx.Flush(exportBinItem);
            }

            return(contentFailure);
        }
Ejemplo n.º 3
0
        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);
            }
        }