Example #1
0
        public int Assets(Household house)
        {
            int assets = 0;

            if (house == null)
            {
                return(0);
            }
            else
            {
                assets = house.FamilyFunds + Lots.GetLotCost(house.LotHome);
            }

            if (house.RealEstateManager != null)
            {
                foreach (PropertyData data in house.RealEstateManager.AllProperties)
                {
                    Lot lot = LotManager.GetLot(data.LotId);
                    if (lot == null)
                    {
                        assets += data.TotalValue;
                    }
                    else if (lot.ResidentialLotSubType == ResidentialLotSubType.kEP1_PlayerOwnable)
                    {
                        assets += data.TotalValue;
                    }
                    else
                    {
                        assets += ManagerLot.GetUnfurnishedLotCost(lot, 0);
                    }
                }
            }

            return(assets);
        }
Example #2
0
        public override void Shutdown()
        {
            base.Shutdown();

            mFirst = true;

            if (mTask != null)
            {
                mTask.Dispose();
                mTask = null;
            }

            foreach (Manager manager in mManagers)
            {
                try
                {
                    manager.Shutdown();
                }
                catch (Exception e)
                {
                    Common.DebugException(manager.UnlocalizedName, e);
                }
            }

            mRunning = false;

            mManagers      = null;
            mManagerLookup = null;

            mScenarioManager  = null;
            mSimManager       = null;
            mHouseholdManager = null;
            mLotManager       = null;

            sOptions = null;
        }
Example #3
0
        public override void Startup(PersistentOptionBase vOptions)
        {
            try
            {
                mManagers = new List <Manager>();

                Castes = new ManagerCaste(this);

                Lots = new ManagerLot(this);

                Households = new ManagerHousehold(this);

                Sims = new ManagerSim(this);

                Money = new ManagerMoney(this);

                Deaths = new ManagerDeath(this);

                Skills = new ManagerSkill(this);

                Careers = new ManagerCareer(this);

                Pregnancies = new ManagerPregnancy(this);

                Romances = new ManagerRomance(this);

                Flirts = new ManagerFlirt(this);

                Friends = new ManagerFriendship(this);

                Situations = new ManagerSituation(this);

                Personalities = new ManagerPersonality(this);

                Scenarios = new ManagerScenario(this);

                Scoring = new ManagerScoring(this);

                Stories = new ManagerStory(this);

                mManagerLookup = new Dictionary <Type, Manager>();
                mManagerLookup.Add(GetType(), this);

                mManagerByName = new Dictionary <string, Manager>();
                mManagerByName.Add(GetTitlePrefix(PrefixType.Pure), this);

                foreach (Manager manager in mManagers)
                {
                    mManagerLookup.Add(manager.GetType(), manager);
                    mManagerByName.Add(manager.GetTitlePrefix(PrefixType.Pure), manager);
                }

                InstallOptions(sInitialInstall);

                foreach (Manager manager in mManagers)
                {
                    manager.InstallOptions(sInitialInstall);
                }

                if (Common.IsAwayFromHomeworld())
                {
                    // Stop persistence for the moment
                    OptionStore optionStore = sOptions;
                    sOptions = null;

                    List <IAdjustForVacationOption> options = new List <IAdjustForVacationOption>();
                    GetOptions(options, false, null);

                    foreach (IAdjustForVacationOption option in options)
                    {
                        option.AdjustForVacationTown();
                    }

                    sOptions = optionStore;
                }

                Options.Restore();

                Common.kDebugging = GetValue <DebuggingOption, bool>();

                base.Startup(Options);

                RemoveStats();

                foreach (Manager manager in mManagers)
                {
                    try
                    {
                        manager.Startup(Options);
                    }
                    catch (Exception exception)
                    {
                        BooterLogger.AddError(exception.ToString());
                    }
                }

                if (DebuggingEnabled)
                {
                    TestOptionNameUniqueness();
                }

                sInitialInstall = false;

                mFirst = true;
                mTask  = new Common.AlarmTask(1f, TimeUnit.Seconds, OnTimer, 10f, TimeUnit.Minutes);
            }
            catch (Exception exception)
            {
                Common.Exception("Startup", exception);
            }
        }