Example #1
0
        public static PlaceResult PlaceHouseholdAndContentsFromGameBin(ulong contentId, Lot lot, PlaceAction action, GetLotCost onLotCost)
        {
            LotContents lotContents = Bin.Singleton.FindLot(contentId);

            if (lotContents != null)
            {
                Household household = lotContents.Household.Household;
                if (household != null)
                {
                    if (((action & PlaceAction.PlaceAndPay) != PlaceAction.PlaceOnly) && !PayForLot(household, lot, true, onLotCost))
                    {
                        return(PlaceResult.InsufficientFunds);
                    }

                    CreateActors(household, lot, false);
                    CreateInventories(lotContents.Household);
                    if ((action & PlaceAction.MoveIn) != PlaceAction.PlaceOnly)
                    {
                        BinCommon.MoveIn(household, lot);
                    }

                    Bin.Singleton.RemoveLotFromGameBin(lotContents);
                    return(PlaceResult.Success);
                }
            }
            return(PlaceResult.ContentFailure);
        }
Example #2
0
        public static bool PayForLot(EditTownModel ths, UIBinInfo info, ulong lotId)
        {
            Lot lot = LotManager.GetLot(lotId);

            if (lot != null)
            {
                ExportBinContents contents = ths.FindExportBinContents(info.ContentId);
                if (contents != null)
                {
                    bool flag = contents.IsLoaded();
                    if (!flag)
                    {
                        ExportBinContentsEx.Import(contents, true);
                    }

                    Household household = contents.Household;
                    if (household != null)
                    {
                        return(BinCommonEx.PayForLot(household, lot, true, Mover.GetLotCost));
                    }

                    if (!flag)
                    {
                        ExportBinContentsEx.Flush(contents);
                    }
                }
                else if (info.LotId != ulong.MaxValue)
                {
                    LotContents contents2 = Bin.Singleton.FindLot(info.LotId);
                    if ((contents2 != null) && (contents2.Household != null))
                    {
                        Household household2 = contents2.Household.Household;
                        if (household2 != null)
                        {
                            return(BinCommonEx.PayForLot(household2, lot, true, Mover.GetLotCost));
                        }
                    }
                }
                else if (info.HouseholdId != ulong.MaxValue)
                {
                    Household household3 = Household.Find(info.HouseholdId);
                    if (household3 != null)
                    {
                        return(BinCommonEx.PayForLot(household3, lot, true, Mover.GetLotCost));
                    }
                }
            }
            return(false);
        }
Example #3
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);
            }
        }
Example #4
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);
            }
        }