コード例 #1
0
        public static HouseholdContentsProxy Import(string packageName)
        {
            ulong lotId = DownloadContent.ImportHouseholdContentsFromExportBin(packageName);

            if (lotId != 0x0L)
            {
                HouseholdContentsProxy householdContents = new HouseholdContentsProxy();
                if (DownloadContent.ImportHouseholdContents(householdContents, lotId))
                {
                    householdContents.mContents.ContentId = lotId;
                    return(householdContents);
                }
            }

            return(null);
        }
コード例 #2
0
        public static void Import(ExportBinContents ths, bool origImport)
        {
            switch (ths.mExportBinType)
            {
                case ExportBinType.Household:
                    ulong lotId = DownloadContent.ImportHouseholdContentsFromExportBin(ths.mPackageName);
                    if (lotId != 0x0L)
                    {
                        // Custom
                        HouseholdContentsProxy proxy = new HouseholdContentsProxy();
                        if (DownloadContent.ImportHouseholdContents(proxy, lotId))
                        {
                            ths.mHouseholdContents = proxy.Contents;
                            ths.mHouseholdContents.ContentId = lotId;
                        }
                    }
                    break;
                case ExportBinType.HouseholdLot:
                case ExportBinType.Lot:
                    ulong oldLotContentId = 0x0L;
                    ulong lotContendId = DownloadContent.ImportLotContentsFromExportBin(ths.mPackageName, ref oldLotContentId);
                    if (lotContendId != 0x0L)
                    {
                        if (ths.mExportBinType == ExportBinType.HouseholdLot)
                        {
                            // Custom
                            HouseholdContentsProxy proxy = new HouseholdContentsProxy();
                            ths.mHouseholdContents = proxy.Contents;

                            if (DownloadContent.ImportHouseholdContents(proxy, lotContendId))
                            {
                                ths.mHouseholdContents.ContentId = lotContendId;
                            }
                        }

                        LotContents contents2 = new LotContents(ths.mPackageName, lotContendId, ths.mHouseholdContents, ths.mLotContentsWorth, ths.LotType, ths.LotContentsSizeX, ths.LotContentsSizeY, ths.IsHouseboatLot, ths.mLotMaxLevel, oldLotContentId, ths.mResidentialLotSubType, ths.mCommercialLotSubType);
                        ths.mLotContents = contents2;
                    }
                    break;
            }

            if (origImport || (ths.mIndexMap == null))
            {
                ths.mIndexMap = CreateIndexMap(ths.Household);
            }
        }
コード例 #3
0
ファイル: BinEx.cs プロジェクト: Robobeurre/NRaas
        public static HouseholdContents ImportHouseholdForTravel()
        {
            try
            {
                ulong lotId = DownloadContent.ImportHouseholdContentsFromTravelBin();
                if (lotId != 0x0L)
                {
                    HouseholdContentsProxy householdContents = new HouseholdContentsProxy();
                    if (DownloadContent.ImportHouseholdContents(householdContents, lotId))
                    {
                        householdContents.Contents.ContentId = lotId;
                        return householdContents.Contents;
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("ImportHouseholdForTravel", e);
            }

            return null;
        }
コード例 #4
0
ファイル: BinEx.cs プロジェクト: Robobeurre/NRaas
        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;
            }
        }
コード例 #5
0
ファイル: BinEx.cs プロジェクト: Robobeurre/NRaas
        public static bool ExportHouseholdForTravel(Household household)
        {
            try
            {
                foreach (Sim sim in Households.AllSims(household))
                {
                    sim.SetObjectToReset();

                    DreamCatcher.PruneDreamManager(sim);
                }

                Common.Sleep();

                ulong id = DownloadContent.GenerateGUID();
                HouseholdContentsProxy householdContents = new HouseholdContentsProxy(household);
                householdContents.Contents.ContentId = id;
                if (DownloadContent.StoreHouseholdContents(householdContents, id))
                {
                    DownloadContent.ExportLotContentsToTravelBin(id);
                    return true;
                }
            }
            catch (Exception e)
            {
                Common.Exception("ExportHouseholdForTravel", e);
            }

            return false;
        }
コード例 #6
0
        public static HouseholdContentsProxy Import(string packageName)
        {
            ulong lotId = DownloadContent.ImportHouseholdContentsFromExportBin(packageName);
            if (lotId != 0x0L)
            {
                HouseholdContentsProxy householdContents = new HouseholdContentsProxy();
                if (DownloadContent.ImportHouseholdContents(householdContents, lotId))
                {
                    householdContents.mContents.ContentId = lotId;
                    return householdContents;
                }
            }

            return null;
        }