Esempio n. 1
0
        public static IPropertyData PurchaceorUpgradeRabbitHole(RealEstateManager ths, RabbitHole rabbitHole)
        {
            IPropertyData data  = null;
            PropertyData  data2 = ths.FindProperty(rabbitHole);

            if (data2 == null)
            {
                if (ths.mOwningHousehold.FamilyFunds >= rabbitHole.RabbitHoleTuning.kInvestCost)
                {
                    NRaas.StoryProgression.Main.Money.AdjustFunds(ths.mOwningHousehold, "PropertyBought", -rabbitHole.RabbitHoleTuning.kInvestCost);
                    data2 = new PropertyData.RabbitHole(rabbitHole, ths);
                    ths.AddToProperties(data2);
                }
            }
            else if (ths.mOwningHousehold.FamilyFunds >= rabbitHole.RabbitHoleTuning.kBuyoutCost)
            {
                ReimburseDeeds(ths, rabbitHole);

                NRaas.StoryProgression.Main.Money.AdjustFunds(ths.mOwningHousehold, "PropertyBought", -rabbitHole.RabbitHoleTuning.kBuyoutCost);

                data2.UpgradeToFullOwnership();
                ths.UpdateProperty(data2);
            }
            data = data2;
            if (data != null)
            {
                Tutorialette.TriggerLesson(Lessons.RealEstate, null);
            }
            return(data);
        }
Esempio n. 2
0
        public static void TransferProperty(Household src, Household dst, PropertyData deed)
        {
            src.RealEstateManager.mAllProperties.Remove(deed);

            PropertyData.RabbitHole rabbithole = deed as PropertyData.RabbitHole;
            if (rabbithole != null)
            {
                foreach (PropertyData existing in dst.RealEstateManager.AllProperties)
                {
                    PropertyData.RabbitHole existingHole = existing as PropertyData.RabbitHole;
                    if (existingHole == null)
                    {
                        continue;
                    }

                    if (existingHole.GetRabbitHole() == rabbithole.GetRabbitHole())
                    {
                        existingHole.mCurrentCollectibleFunds += rabbithole.TotalValue;
                        return;
                    }
                }
            }

            dst.RealEstateManager.mAllProperties.Add(deed);

            deed.mOwner = dst.RealEstateManager;
        }
Esempio n. 3
0
        public static void TransferRealEstate(Household newHouse, Household oldHouse)
        {
            Common.StringBuilder msg = new Common.StringBuilder("TransferRealEstate");

            if (oldHouse.RealEstateManager != null)
            {
                for (int i = oldHouse.RealEstateManager.mAllProperties.Count - 1; i >= 0; i--)
                {
                    PropertyData data = oldHouse.RealEstateManager.mAllProperties[i] as PropertyData;
                    if (data == null)
                    {
                        continue;
                    }

                    msg += Common.NewLine + "Data: " + data.PropertyType;

                    PropertyData newData = null;

                    switch (data.PropertyType)
                    {
                    case RealEstatePropertyType.RabbitHole:
                        PropertyData.RabbitHole oldData1 = data as PropertyData.RabbitHole;

                        PropertyData.RabbitHole newData1 = newHouse.RealEstateManager.FindProperty(oldData1.GetRabbitHole()) as PropertyData.RabbitHole;

                        newData = newData1;

                        if ((newData1 != null) && (!newData1.IsFullOwner))
                        {
                            newData1.mIsFullOwner = oldData1.mIsFullOwner;
                        }

                        break;

                    case RealEstatePropertyType.VacationHome:
                    case RealEstatePropertyType.Venue:
                        PropertyData oldData2 = data as PropertyData;

                        foreach (IPropertyData newData2 in newHouse.RealEstateManager.AllProperties)
                        {
                            if (newData2.World != oldData2.World)
                            {
                                continue;
                            }

                            if (newData2.LotId != oldData2.LotId)
                            {
                                continue;
                            }

                            newData = newData2 as PropertyData;
                            break;
                        }

                        break;
                    }

                    PropertyData transferData = null;
                    if (newData == null)
                    {
                        msg += Common.NewLine + "Transfer";

                        transferData = data;
                    }
                    else
                    {
                        msg += Common.NewLine + "Money: " + data.TotalValue;

                        newData.mCurrentCollectibleFunds += data.TotalValue;
                        data.mCurrentCollectibleFunds     = 0;
                        data.mStoredValue = 0;
                    }

                    if (transferData != null)
                    {
                        transferData.mOwner = newHouse.RealEstateManager;

                        newHouse.RealEstateManager.mAllProperties.Add(transferData);
                    }

                    oldHouse.RealEstateManager.mAllProperties.RemoveAt(i);
                }
            }

            Common.DebugNotify(msg);
        }