Esempio n. 1
0
        protected override string ToXMLString()
        {
            Common.StringBuilder result = new Common.StringBuilder(base.ToXMLString());

            result += Common.NewLine + "    <LightWeight>" + mIntensityWeights[0] + "</LightWeight>";
            result += Common.NewLine + "    <ModerateWeight>" + mIntensityWeights[1] + "</ModerateWeight>";
            result += Common.NewLine + "    <HeavyWeight>" + mIntensityWeights[2] + "</HeavyWeight>";
            result += Common.NewLine + "    <MinTransitionTime>" + mTransitionTime.First + "</MinTransitionTime>";
            result += Common.NewLine + "    <MaxTransitionTime>" + mTransitionTime.Second + "</MaxTransitionTime>";
            result += Common.NewLine + "    <NumIntensityChangeWeights>";

            for (int i = 0; i < mIntensityChangeWeights.Count; i++)
            {
                if (i != 0)
                {
                    result += ",";
                }

                result += mIntensityChangeWeights[i].ToString();
            }

            result += "</NumIntensityChangeWeights>";
            result += Common.NewLine + "    <MinIntensityDuration>" + mMinIntensityDuration + "</MinIntensityDuration>";

            return(result.ToString());
        }
Esempio n. 2
0
        public override void Startup()
        {
            Common.StringBuilder msg = new Common.StringBuilder("PlayFlowStateEx:Startup" + Common.NewLine);
            Traveler.InsanityWriteLog(msg);

            try
            {
                msg += Common.NewLine + "A";
                Traveler.InsanityWriteLog(msg);

                ProductVersion prevVersions = EditTownModel.sEPVenuesPlaced;

                base.Startup();

                if (GameStates.HasTravelData)
                {
                    EditTownModel.sEPVenuesPlaced = prevVersions;
                }

                msg += Common.NewLine + "B";
                Traveler.InsanityWriteLog(msg);
            }
            catch (Exception e)
            {
                Traveler.InsanityException(msg, e);
            }
        }
Esempio n. 3
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            Common.StringBuilder builder = new Common.StringBuilder();

            foreach (VectorBooter.Data vector in VectorBooter.Vectors)
            {
                builder.Append(Common.NewLine + Common.NewLine + vector.ToString());
            }

            foreach (SymptomBooter.Data symptom in SymptomBooter.Symptoms)
            {
                builder.Append(Common.NewLine + Common.NewLine + symptom.ToString());
            }

            foreach (ResistanceBooter.Data resistance in ResistanceBooter.Resistances)
            {
                builder.Append(Common.NewLine + Common.NewLine + resistance.ToString());
            }

            builder.Append(Common.NewLine + Vector.Settings.Dump());

            Common.DebugWriteLog(builder);

            return(OptionResult.SuccessRetain);
        }
Esempio n. 4
0
        protected override OptionResult Run(GameHitParameters<GameObject> parameters)
        {
            IEnumerable<FilePersistenceEx.Item> selection = FilePersistenceEx.GetChoices(Name);
            if (selection == null) return OptionResult.Failure;
             
            Common.StringBuilder builder = new Common.StringBuilder(FilePersistence.sHeader + Common.NewLine + "<Settings>");

            foreach (FilePersistenceEx.Item choice in selection)
            {
                string text = choice.CreateExportString();

                if (!string.IsNullOrEmpty(text))
                {
                    builder.Append(text);
                }
            }

            builder.Append(Common.NewLine + "</Settings>");

            Common.DebugWriteLog(builder);

            FilePersistence.ExportToFile(builder.ToString());

            return OptionResult.SuccessRetain;
        }
Esempio n. 5
0
        public static void LogFailure(GameObject routingObject, RouteAction.FailureExplanation explanation, RoutePlanResult planResult, string errorText)
        {
            RoutingComponent.mnNumDoRouteFailures += (ulong)0x1L;
            if (RoutingComponent.mbLogFailures)
            {
                Common.StringBuilder msg = new Common.StringBuilder("Explanation: " + explanation);
                msg += Common.NewLine + "Result: " + planResult;
                msg += Common.NewLine + "Error: " + errorText;

                if (routingObject.LotCurrent != null)
                {
                    msg += Common.NewLine + "Address A: " + routingObject.LotCurrent.Address;
                }

                Sim sim = routingObject as Sim;
                if (sim != null)
                {
                    InteractionInstance currentInteraction = sim.CurrentInteraction;
                    InteractionInstance nextInteraction = sim.InteractionQueue.GetNextInteraction();
                    if (((currentInteraction != null) && (currentInteraction.Target != null)) && (currentInteraction.Target.LotCurrent != null))
                    {
                        msg += Common.NewLine + "Address B: " + currentInteraction.Target.LotCurrent.Address;
                    }

                    if (((nextInteraction != null) && (nextInteraction.Target != null)) && (nextInteraction.Target.LotCurrent != null))
                    {
                        msg += Common.NewLine + "Address C: " + nextInteraction.Target.LotCurrent.Address;
                    }
                }

                Common.DebugNotify(msg, sim);
            }
        }
Esempio n. 6
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            Common.StringBuilder msg = new Common.StringBuilder();

            try
            {
                Sim actor  = parameters.mActor as Sim;
                Sim target = parameters.mTarget as Sim;

                if (!AcceptCancelDialog.Show("You are about to run 'ForceError', proceed?"))
                {
                    return(OptionResult.Failure);
                }

                target.mInteractionQueue = null;
            }
            catch (Exception e)
            {
                GameHitParameters <GameObject> .Exception(parameters, msg, e);
            }
            finally
            {
                Common.DebugWriteLog(msg);
            }
            return(OptionResult.SuccessClose);
        }
Esempio n. 7
0
        public static void LogFailure(GameObject routingObject, RouteAction.FailureExplanation explanation, RoutePlanResult planResult, string errorText)
        {
            RoutingComponent.mnNumDoRouteFailures += (ulong)0x1L;
            if (RoutingComponent.mbLogFailures)
            {
                Common.StringBuilder msg = new Common.StringBuilder("Explanation: " + explanation);
                msg += Common.NewLine + "Result: " + planResult;
                msg += Common.NewLine + "Error: " + errorText;

                if (routingObject.LotCurrent != null)
                {
                    msg += Common.NewLine + "Address A: " + routingObject.LotCurrent.Address;
                }

                Sim sim = routingObject as Sim;
                if (sim != null)
                {
                    InteractionInstance currentInteraction = sim.CurrentInteraction;
                    InteractionInstance nextInteraction    = sim.InteractionQueue.GetNextInteraction();
                    if (((currentInteraction != null) && (currentInteraction.Target != null)) && (currentInteraction.Target.LotCurrent != null))
                    {
                        msg += Common.NewLine + "Address B: " + currentInteraction.Target.LotCurrent.Address;
                    }

                    if (((nextInteraction != null) && (nextInteraction.Target != null)) && (nextInteraction.Target.LotCurrent != null))
                    {
                        msg += Common.NewLine + "Address C: " + nextInteraction.Target.LotCurrent.Address;
                    }
                }

                Common.DebugNotify(msg, sim);
            }
        }
Esempio n. 8
0
        public static void Exception(IActor a, object b, Exception e)
        {
            if (b is SimDescription)
            {
                Sim sim = a as Sim;
                if (sim != null)
                {
                    Common.Exception(sim.SimDescription, b as SimDescription, e);
                    return;
                }
            }
            else if (b is IScriptLogic)
            {
                Common.Exception(a, b as IScriptLogic, e);
                return;
            }

            Common.StringBuilder text = new Common.StringBuilder();
            if (b != null)
            {
                text += b.ToString();
            }

            Common.Exception(a, null, text, e);
        }
Esempio n. 9
0
            public StipendGrade CalculateGrade(Homemaker career, ref Common.StringBuilder debugging)
            {
                int positive;
                int negative;

                CalculateStipend(out positive, out negative, ref debugging);

                if (positive == 0)
                {
                    if (negative > 0)
                    {
                        return(StipendGrade.F);
                    }
                    else
                    {
                        return(StipendGrade.C);
                    }
                }
                else
                {
                    if (negative == 0)
                    {
                        return(StipendGrade.A);
                    }
                    else if (positive > negative)
                    {
                        return(StipendGrade.B);
                    }
                    else
                    {
                        return(StipendGrade.D);
                    }
                }
            }
Esempio n. 10
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            Common.StringBuilder msg = new Common.StringBuilder("Run");

            try
            {
                Sim sim = parameters.mTarget as Sim;
                if (sim == null)
                {
                    return(OptionResult.Failure);
                }

                if (OnPerform != null)
                {
                    OnPerform(sim);
                }

                /*
                 * foreach (PropertyData deed in RealEstateManager.AllPropertiesFromAllHouseholds())
                 * {
                 *  msg += Common.NewLine + "Name: " + deed.LocalizedName;
                 *  msg += Common.NewLine + " Owner: " + deed.Owner.OwningHousehold.Name;
                 * }*/
            }
            catch (Exception e)
            {
                Common.Exception(parameters.mActor, parameters.mTarget, msg, e);
            }
            finally
            {
                Common.WriteLog(msg);
            }

            return(OptionResult.SuccessRetain);
        }
Esempio n. 11
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            IEnumerable <FilePersistenceEx.Item> selection = FilePersistenceEx.GetChoices(Name);

            if (selection == null)
            {
                return(OptionResult.Failure);
            }

            Common.StringBuilder builder = new Common.StringBuilder(FilePersistence.sHeader + Common.NewLine + "<Settings>");

            foreach (FilePersistenceEx.Item choice in selection)
            {
                string text = choice.CreateExportString();

                if (!string.IsNullOrEmpty(text))
                {
                    builder.Append(text);
                }
            }

            builder.Append(Common.NewLine + "</Settings>");

            Common.DebugWriteLog(builder);

            FilePersistence.ExportToFile(builder.ToString());

            return(OptionResult.SuccessRetain);
        }
Esempio n. 12
0
        public override void Shutdown()
        {
            Common.StringBuilder msg = new Common.StringBuilder("TravelArrivalStateEx:Shutdown");
            Traveler.InsanityWriteLog(msg);

            try
            {
                base.Shutdown();

                LoadSaveManager.ObjectGroupLoaded -= ToInWorldStateEx.OnObjectGroupLoaded;

                World.sOnWorldLoadStatusEventHandler -= ToInWorldStateEx.OnWorldLoadStatusEx;

                World.sOnWorldLoadFinishedEventHandler -= ToInWorldStateEx.OnWorldLoadFinishedEx;
                World.sOnWorldLoadFinishedEventHandler += ToInWorldStateEx.sOnWorldLoadFinishedEventHandler;

                msg += "A";
                msg += Common.NewLine + "StatusCount: " + ToInWorldStateEx.StatusCount;
                Traveler.InsanityWriteLog(msg);
            }
            catch (Exception e)
            {
                Traveler.InsanityException(msg, e);
            }
        }
Esempio n. 13
0
            protected override bool PrivatePerform()
            {
                List <OptionItem> options = new List <OptionItem>();

                Manager.GetOptions(options, true, null);

                Common.StringBuilder builder = new Common.StringBuilder();

                int index = 0;

                while (index < options.Count)
                {
                    OptionItem option = options[index];
                    index++;

                    builder.Append(Common.NewLine + option.Name);

                    MasterListingOption master = option as MasterListingOption;
                    if (master != null)
                    {
                        foreach (OptionItem subItem in master.GetOptions())
                        {
                            options.Insert(index, subItem);
                        }
                    }
                }

                Common.WriteLog(builder);
                return(true);
            }
Esempio n. 14
0
        public void AddSummaryToLog(string localizedText, string[] extended)
        {
            Common.StringBuilder extendedText = new Common.StringBuilder();

            extendedText += EAText.GetNumberString(SimClock.ElapsedCalendarDays()) + " ";
            extendedText += SimClock.CurrentTime().ToString() + ": ";
            extendedText += localizedText;

            if (extended != null)
            {
                extendedText += " (";

                bool first = true;
                foreach (string text in extended)
                {
                    if (!first)
                    {
                        extendedText += " ";
                    }

                    extendedText += text;
                    first         = false;
                }

                extendedText += ")";
            }

            AddValue <DumpStoryLogOption, string>(extendedText.ToString());
        }
Esempio n. 15
0
        public override void Startup()
        {
            Common.StringBuilder msg = new Common.StringBuilder("TravelArrivalStateEx:Startup");
            Traveler.InsanityWriteLog(msg);

            try
            {
                ToInWorldStateEx.StatusCount = 0;

                LoadSaveManager.ObjectGroupLoaded += ToInWorldStateEx.OnObjectGroupLoaded;

                ToInWorldStateEx.sOnWorldLoadFinishedEventHandler = World.sOnWorldLoadFinishedEventHandler;
                World.sOnWorldLoadFinishedEventHandler = ToInWorldStateEx.OnWorldLoadFinishedEx;

                World.sOnWorldLoadStatusEventHandler += ToInWorldStateEx.OnWorldLoadStatusEx;

                base.Startup();

                msg += "A";
                msg += Common.NewLine + "FileName: " + GameStates.LoadFileName;
                Traveler.InsanityWriteLog(msg);
            }
            catch (Exception e)
            {
                Traveler.InsanityException(msg, e);
            }
        }
Esempio n. 16
0
 public static void RefillDisplays()
 {
     if (Cupcake.Settings.mAutoRestock)
     {
         Common.StringBuilder msg = new Common.StringBuilder();
         Common.StringBuilder displayMsg;
         foreach (CraftersConsignmentDisplay display in Sims3.Gameplay.Queries.GetObjects <CraftersConsignmentDisplay>())
         {
             try
             {
                 RestockDisplay(display, out displayMsg);
                 msg += displayMsg + Common.NewLine + Common.NewLine;
             }
             catch (Exception e)
             {
                 Common.Exception("", e);
             }
         }
         Common.DebugWriteLog(msg);
         msg        = null;
         displayMsg = null;
         goodies.Clear();
         qualites.Clear();
     }
     else
     {
         Common.DebugNotify("Auto restock disabled.");
     }
 }
Esempio n. 17
0
        public override void Startup()
        {
            Common.StringBuilder msg = new Common.StringBuilder("ToInWorldStateEx:Startup");
            Traveler.InsanityWriteLog(msg);

            try
            {
                sStatusCount = 0;

                LoadSaveManager.ObjectGroupLoaded += OnObjectGroupLoaded;

                sOnWorldLoadFinishedEventHandler       = World.sOnWorldLoadFinishedEventHandler;
                World.sOnWorldLoadFinishedEventHandler = OnWorldLoadFinishedEx;

                World.sOnWorldLoadStatusEventHandler += OnWorldLoadStatusEx;

                base.Startup();

                msg += Common.NewLine + "FileName: " + GameStates.LoadFileName;
                Traveler.InsanityWriteLog(msg);
            }
            catch (Exception e)
            {
                Traveler.InsanityException(msg, e);
            }
        }
Esempio n. 18
0
            public override string ToString()
            {
                Common.StringBuilder results = new Common.StringBuilder();

                results += Common.NewLine + "Male: ";
                foreach (string name in mMales)
                {
                    results += "," + name;
                }

                results += Common.NewLine + "Female: ";
                foreach (string name in mFemales)
                {
                    results += "," + name;
                }

                results += Common.NewLine + "MaleExclusions: ";
                foreach (string name in mMaleExclusions.Keys)
                {
                    results += "," + name;
                }

                results += Common.NewLine + "FemaleExclusions: ";
                foreach (string name in mFemaleExclusions.Keys)
                {
                    results += "," + name;
                }

                return(results.ToString());
            }
Esempio n. 19
0
        public override void Shutdown()
        {
            Common.StringBuilder msg = new Common.StringBuilder("TravelArrivalStateEx:Shutdown");
            Traveler.InsanityWriteLog(msg);

            try
            {
                base.Shutdown();

                LoadSaveManager.ObjectGroupLoaded -= ToInWorldStateEx.OnObjectGroupLoaded;

                World.sOnWorldLoadStatusEventHandler -= ToInWorldStateEx.OnWorldLoadStatusEx;

                World.sOnWorldLoadFinishedEventHandler -= ToInWorldStateEx.OnWorldLoadFinishedEx;
                World.sOnWorldLoadFinishedEventHandler += ToInWorldStateEx.sOnWorldLoadFinishedEventHandler;

                msg += "A";
                msg += Common.NewLine + "StatusCount: " + ToInWorldStateEx.StatusCount;
                Traveler.InsanityWriteLog(msg);
            }
            catch (Exception e)
            {
                Traveler.InsanityException(msg, e);
            }
        }
Esempio n. 20
0
 public void Export(Common.StringBuilder result)
 {
     foreach (ITunableFieldOption option in GetOptions())
     {
         option.Export(result);
     }
 }
Esempio n. 21
0
        public override void Startup()
        {
            Common.StringBuilder msg = new Common.StringBuilder("PlayFlowStateEx:Startup" + Common.NewLine);
            Traveler.InsanityWriteLog(msg);

            try
            {
                msg += Common.NewLine + "A";
                Traveler.InsanityWriteLog(msg);

                ProductVersion prevVersions = EditTownModel.sEPVenuesPlaced;

                base.Startup();

                if (GameStates.HasTravelData)
                {
                    EditTownModel.sEPVenuesPlaced = prevVersions;
                }

                msg += Common.NewLine + "B";
                Traveler.InsanityWriteLog(msg);
            }
            catch (Exception e)
            {
                Traveler.InsanityException(msg, e);
            }
        }
Esempio n. 22
0
        public void AddTuning(InteractionObjectPair ths, Common.StringBuilder msg)
        {
            msg += Common.NewLine + "AddTuning";

            if (ths.InteractionDefinition != null)
            {
                msg += Common.NewLine + "A";

                bool flag;
                Type key = ths.InteractionDefinition.GetType();
                if (!InteractionObjectPair.sRequiresTuningCache.TryGetValue(key, out flag))
                {
                    msg += Common.NewLine + "B";

                    flag = true;
                    for (Type type2 = key; (type2 != null) && flag; type2 = type2.BaseType)
                    {
                        flag &= type2.GetCustomAttributes(typeof(DoesntRequireTuningAttribute), false).Length == 0x0;
                    }
                    InteractionObjectPair.sRequiresTuningCache.Add(key, flag);
                }
                if (flag)
                {
                    msg += Common.NewLine + "C";

                    Type b = null;
                    if (ths.mTarget != null)
                    {
                        b = ths.mTarget.GetType();
                    }
                    else
                    {
                        b = ths.mTargetType;
                    }
                    if (b != null)
                    {
                        InteractionTuning tuning;
                        Pair <Type, Type> pair = new Pair <Type, Type>(key, b);

                        /*
                         * if (InteractionObjectPair.sTuningCache.TryGetValue(pair, out tuning))
                         * {
                         *  msg += Common.NewLine + "D";
                         *
                         *  ths.mTuning = tuning;
                         * }
                         * else*/
                        {
                            msg += Common.NewLine + "E";

                            string fullName = key.FullName;
                            tuning      = GetTuning(key, fullName, b, msg);
                            ths.mTuning = tuning;
                            InteractionObjectPair.sTuningCache[pair] = tuning;
                        }
                    }
                }
            }
        }
Esempio n. 23
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            Common.StringBuilder builder = new Common.StringBuilder();

            Dictionary <ulong, List <SimDescription> > allSims = SimListing.AllSims <SimDescription>(null, true);

            foreach (VectorBooter.Data vector in VectorBooter.Vectors)
            {
                Dictionary <string, List <SimDescription> > stages = new Dictionary <string, List <SimDescription> >();

                foreach (KeyValuePair <ulong, List <DiseaseVector> > sims in Vector.Settings.AllVectors)
                {
                    List <SimDescription> choices;
                    if (!allSims.TryGetValue(sims.Key, out choices))
                    {
                        continue;
                    }

                    SimDescription sim = choices[0];

                    foreach (DiseaseVector disease in sims.Value)
                    {
                        if (disease.Guid != vector.Guid)
                        {
                            continue;
                        }

                        string key = disease.StageName + " " + disease.Strain;

                        List <SimDescription> value;
                        if (!stages.TryGetValue(key, out value))
                        {
                            value = new List <SimDescription>();
                            stages.Add(key, value);
                        }

                        value.Add(sim);
                    }
                }

                string result = Common.NewLine + vector.Guid;

                foreach (KeyValuePair <string, List <SimDescription> > stage in stages)
                {
                    result += Common.NewLine + " " + stage.Key + " : " + stage.Value.Count;

                    foreach (SimDescription sim in stage.Value)
                    {
                        result += Common.NewLine + "  " + sim.FullName;
                    }
                }

                builder.Append(result);
            }

            Common.DebugWriteLog(builder);

            return(OptionResult.SuccessRetain);
        }
Esempio n. 24
0
 public override string ToString()
 {
     Common.StringBuilder text = new Common.StringBuilder(base.ToString());
     text.AddXML("Testing", mTesting.ToString());
     text.AddXML("Dying", mDying.ToString());
     text.AddXML("Notified", mNotified.ToString());
     return(text.ToString());
 }
Esempio n. 25
0
            public void OnChanged()
            {
                Common.StringBuilder noticeText = new Common.StringBuilder();
                Common.StringBuilder logText = new Common.StringBuilder();
                Common.ExceptionLogger.Convert(mSim, noticeText, logText);

                Common.DebugStackLog(logText);
            }
Esempio n. 26
0
            public override string ToString()
            {
                Common.StringBuilder text = new Common.StringBuilder(base.ToString());

                text.AddXML("Pushed", mMoodPushedHome);

                return(text.ToString());
            }
Esempio n. 27
0
 public override string ToString()
 {
     Common.StringBuilder text = new Common.StringBuilder(base.ToString());
     text.AddXML("Career", mCareer);
     text.AddXML("Level", mCareerLevel);
     text.AddXML("Retire", mRetire);
     return text.ToString();
 }
Esempio n. 28
0
 public override string ToString()
 {
     Common.StringBuilder text = new Common.StringBuilder(base.ToString());
     text.AddXML("Career", mCareer);
     text.AddXML("Level", mCareerLevel);
     text.AddXML("Retire", mRetire);
     return(text.ToString());
 }
Esempio n. 29
0
            public void OnChanged()
            {
                Common.StringBuilder noticeText = new Common.StringBuilder();
                Common.StringBuilder logText    = new Common.StringBuilder();
                Common.ExceptionLogger.Convert(mSim, noticeText, logText);

                Common.DebugStackLog(logText);
            }
Esempio n. 30
0
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            Sim sim = me.CreatedSim;

            if (sim == null)
            {
                return(false);
            }

            if (sim.Motives == null)
            {
                return(false);
            }

            List <MotiveValue> values = new List <MotiveValue> ();

            if (Common.kDebugging)
            {
                foreach (Motive motive in sim.Motives.AllMotives)
                {
                    values.Add(new MotiveValue(motive.Commodity, motive));
                }

                values.Sort(MotiveValue.OnSort);
            }
            else
            {
                values.Add(new MotiveValue(MotiveID.Bladder, sim.Motives.GetMotive(CommodityKind.Bladder)));
                values.Add(new MotiveValue(MotiveID.Energy, sim.Motives.GetMotive(CommodityKind.Energy)));
                values.Add(new MotiveValue(MotiveID.Energy, sim.Motives.GetMotive(CommodityKind.AlienBrainPower)));
                values.Add(new MotiveValue(MotiveID.Fun, sim.Motives.GetMotive(CommodityKind.Fun)));
                values.Add(new MotiveValue(MotiveID.Hunger, sim.Motives.GetMotive(CommodityKind.Hunger)));
                values.Add(new MotiveValue(MotiveID.Hunger, sim.Motives.GetMotive(CommodityKind.VampireThirst)));
                values.Add(new MotiveValue(MotiveID.Hygiene, sim.Motives.GetMotive(CommodityKind.Hygiene)));
                values.Add(new MotiveValue(MotiveID.Hygiene, sim.Motives.GetMotive(CommodityKind.CatScratch)));
                values.Add(new MotiveValue(MotiveID.Hygiene, sim.Motives.GetMotive(CommodityKind.DogDestruction)));
                values.Add(new MotiveValue(MotiveID.Social, sim.Motives.GetMotive(CommodityKind.Social)));
                values.Add(new MotiveValue(CommodityKind.Temperature, sim.Motives.GetMotive(CommodityKind.Temperature)));
                values.Add(new MotiveValue(CommodityKind.MagicFatigue, sim.Motives.GetMotive(CommodityKind.MagicFatigue)));
            }

            Common.StringBuilder msg = new Common.StringBuilder(me.FullName + Common.NewLine + Common.NewLine + Common.Localize("Mood:Range"));

            foreach (MotiveValue value in values)
            {
                if (!value.mExists)
                {
                    continue;
                }

                msg += Common.Localize("Mood:Element", sim.IsFemale, new object[] { value.mName, value.mValue });
            }

            SimpleMessageDialog.Show(Name, msg.ToString());

            Common.DebugWriteLog(msg);
            return(true);
        }
Esempio n. 31
0
            public static void Append(Common.StringBuilder msg)
            {
                if (!Common.kDebugging)
                {
                    return;
                }

                sLogger.PrivateAppend(msg);
            }
Esempio n. 32
0
        public void Track(string text)
        {
            if (mTracking == null)
            {
                mTracking = new Common.StringBuilder();
            }

            mTracking.Append(text + Common.NewLine + Common.NewLine);
        }
Esempio n. 33
0
            protected override int PrivateLog(Common.StringBuilder builder)
            {
                if (mEntry.Count > 0)
                {
                    Append(mEntry.ToString());
                }

                return(base.PrivateLog(builder));
            }
Esempio n. 34
0
            public override string ToString()
            {
                Common.StringBuilder text = new Common.StringBuilder();

                text.AddXML("Hour", mPregnancyHour);
                text.AddXML("LastCheck", mLastCheckPregnancy);

                return(text.ToString());
            }
Esempio n. 35
0
        public override string ToString()
        {
            Common.StringBuilder result = new Common.StringBuilder("<TownOptions>");

            result += base.ToString();

            result += Common.NewLine + "</TownOptions>";

            return(result.ToString());
        }
Esempio n. 36
0
        protected override int PrivateLog(Common.StringBuilder builder)
        {
            if (sChanged)
            {
                sBin.Log(sLogger);
                sChanged = false;
            }

            return base.PrivateLog(builder);
        }
Esempio n. 37
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            Common.StringBuilder msg = new Common.StringBuilder("");
            BakeryController.RestockDisplay(mTarget as CraftersConsignmentDisplay, out msg);

            Common.DebugWriteLog(msg);

            Common.Notify(Common.Localize("General:Success"));

            return(OptionResult.SuccessClose);
        }
Esempio n. 38
0
        public static string LookupToString()
        {
            Common.StringBuilder msg = new Common.StringBuilder(Common.NewLine + "FileNameBooter");

            foreach (KeyValuePair<string, string> data in sLoadedNames)
            {
                msg += Common.NewLine + "  " + data.Key + " : " + data.Value;
            }

            return msg.ToString();
        }
Esempio n. 39
0
        public static void OneDayPassed(Household ths)
        {
            Common.StringBuilder msg = new Common.StringBuilder("OneDayPassed");
            Traveler.InsanityWriteLog(msg);

            if ((!Traveler.Settings.mPauseTravel) && (Traveler.Settings.mTreatAsVacation) && (Household.ActiveHousehold == ths))
            {
                GameStates.CurrentDayOfTrip++;

                msg += Common.NewLine + GameStates.CurrentDayOfTrip;
                Traveler.InsanityWriteLog(msg);

                Common.DebugNotify("Traveler:AlarmTask:OnDayPassed " + GameStates.CurrentDayOfTrip + "/" + GameStates.TripLength);

                if (PlumbBob.SelectedActor != null)
                {
                    (Sims3.Gameplay.UI.Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel).OnSimAgeChanged(PlumbBob.SelectedActor.ObjectId);
                }

                msg += Common.NewLine + "A";
                Traveler.InsanityWriteLog(msg);

                if (GameUtils.IsUniversityWorld())
                {
                    msg += Common.NewLine + "B";
                    Traveler.InsanityWriteLog(msg);

                    OneDayPassedUniversityUpdates(ths);
                }
                else if (GameUtils.IsFutureWorld())
                {
                    msg += Common.NewLine + "C";
                    Traveler.InsanityWriteLog(msg);

                    ths.OneDayPassedFutureUpdates();
                }
                else
                {
                    msg += Common.NewLine + "D";
                    Traveler.InsanityWriteLog(msg);

                    OneDayPassedVacationUpdates(ths);
                }

                msg += Common.NewLine + "E";
                Traveler.InsanityWriteLog(msg);
            }
            else
            {
                Common.DebugNotify("Traveler:AlarmTask:OnDayPassed Paused");
            }
        }
Esempio n. 40
0
        public static void Initialize(Initializers ths)
        {
            Common.StringBuilder msg = new Common.StringBuilder("Initialize");

            try
            {
                GameUtils.BeginLoadEvent("GameInit");
                for (int i = 0x0; i < ths.mInitializerRecords.Count; i++)
                {
                    Initializers.Record record = ths.mInitializerRecords[i];
                    GameUtils.BeginLoadEvent("GameInit/" + record.ToString());

                    Initializers.Action action = record.Instantiate();

                    if (action.Valid)
                    {
                        msg += Common.NewLine + "Instance: " + action.mInstance;
                        msg += Common.NewLine + "Init: " + action.mInit;
                        msg += Common.NewLine + "Type: " + action.mType;
                        Traveler.InsanityWriteLog(msg);

                        try
                        {
                            string header = action.mType + " - " + action.mInit;
                            using (Common.TestSpan span = new Common.TestSpan(Common.ExternalTimeSpanLogger.sLogger, header))
                            {
                                if (header == "Sims3.Gameplay.CAS.SimDescription - Void PostLoadFixUp()")
                                {
                                    PostLoadFixUp();
                                }
                                else
                                {
                                    action.DoInit();
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            Common.Exception(msg, e);
                        }
                    }

                    GameUtils.EndLoadEvent();
                }
                GameUtils.EndLoadEvent();
            }
            finally
            {
                Common.WriteLog(msg);
            }
        }
Esempio n. 41
0
            protected override bool OnPerform()
            {
                Common.StringBuilder msg = new Common.StringBuilder("EditTownLibraryTask" + Common.NewLine);

                try
                {

                }
                catch (Exception e)
                {
                    Common.Exception(msg, e);
                }
                return true;
            }
Esempio n. 42
0
        public static void MergeTravelInformation(SimDescription ths, MiniSimDescription msd, Dictionary<ulong,SimDescription> allSims)
        {
            Common.StringBuilder msg = new Common.StringBuilder("MergeTravelInformation " + ths.FullName + Common.NewLine);

            msg += "A";
            Traveler.InsanityWriteLog(msg);

            foreach (MiniRelationship relationship in msd.MiniRelationships)
            {
                SimDescription y = null;
                if (!allSims.TryGetValue(relationship.SimDescriptionId, out y))
                {
                    y = SimDescription.Find(relationship.SimDescriptionId);
                }

                if (y != null)
                {
                    Relationship unsafely = null;

                    try
                    {
                        unsafely = Relationship.GetUnsafely(ths, y);
                    }
                    catch (Exception e)
                    {
                        Common.Exception(ths, e);
                    }

                    if (unsafely != null)
                    {
                        float change = relationship.Value - unsafely.LTR.Liking;
                        if (change != 0f)
                        {
                            unsafely.LTR.UpdateLiking(change);
                        }
                        RomanceVisibilityState.MergeTravelInformationOnTravelBackHome(relationship, unsafely);
                    }
                }
            }

            msg += "B";
            Traveler.InsanityWriteLog(msg);

            ths.CASGenealogy = msd.CASGenealogy;

            AgingCheckTask.Add(ths, msd);

            msg += "C";
            Traveler.InsanityWriteLog(msg);
        }
Esempio n. 43
0
        protected override OptionResult Run(GameHitParameters<GameObject> parameters)
        {
            Common.StringBuilder msg = new Common.StringBuilder("Skill");

            Skill skill = SkillManager.GetStaticSkill(Skills.KamaSimtra.StaticGuid);

            for (int i = 0; i < 10; i++)
            {
                msg += Common.NewLine + "Level " + i + " : " + skill.PointsForNextLevel[i];
            }

            Common.DebugNotify(msg);

            return OptionResult.SuccessClose;
        }
Esempio n. 44
0
        public override string ToString()
        {
            Common.StringBuilder text = new Common.StringBuilder(base.ToString());

            if (mHouse != null)
            {
                text.AddXML("House", mHouse.Name);
            }
            else
            {
                text.AddXML("House", "Null");
            }

            text.AddXML("NetWorth", mNetWorth);

            return text.ToString();
        }
Esempio n. 45
0
        public override void Startup()
        {
            Common.StringBuilder msg = new Common.StringBuilder("TravelDepartureStateEx:Startup" + Common.NewLine);
            Traveler.InsanityWriteLog(msg);

            try
            {
                base.Startup();

                msg += "A";
                Traveler.InsanityWriteLog(msg);
            }
            catch (Exception e)
            {
                Traveler.InsanityException(msg, e);
            }
        }
Esempio n. 46
0
        public override void SendToNextState()
        {
            Common.StringBuilder msg = new Common.StringBuilder("TravelDepartureStateEx:SendToNextState" + Common.NewLine);
            Traveler.InsanityWriteLog(msg);

            try
            {
                base.SendToNextState();

                msg += GameStates.sStartupState.ToString();
                Traveler.InsanityWriteLog(msg);
            }
            catch (Exception e)
            {
                Traveler.InsanityException(msg, e);
            }
        }
Esempio n. 47
0
        public static bool OnInfo(IGameObject obj)
        {
            Common.StringBuilder noticeText = new Common.StringBuilder();
            Common.StringBuilder logText = new Common.StringBuilder();
            Common.ExceptionLogger.Convert(obj, noticeText, logText);

            Common.Notify(logText.ToString(), obj.ObjectId);

            Common.WriteLog(logText);

            if (CameraController.IsMapViewModeEnabled())
            {
                Sims3.Gameplay.Core.Camera.ToggleMapView();
            }

            Camera.FocusOnGivenPosition(obj.Position, Camera.kDefaultLerpDuration);
            return true;
        }
Esempio n. 48
0
        protected override OptionResult Run(Lot myLot, Household house)
        {
            Common.StringBuilder msg = new Common.StringBuilder();

            try
            {
                if (!AcceptCancelDialog.Show("You are about to run 'TestLot', proceed?")) return OptionResult.Failure;

                InventoryPanel.sInstance.ShowTimeAlmanacDialog();
            }
            catch (Exception e)
            {
                Common.Exception(myLot, null, msg, e);
            }
            finally
            {
                Common.DebugWriteLog(msg);
            }
            return OptionResult.SuccessClose;
        }
Esempio n. 49
0
        public static void MergeOccults(OccultManager ths, OccultManager source)
        {
            Common.StringBuilder msg = new Common.StringBuilder("MergeOccults " + ths.mOwnerDescription.FullName + Common.NewLine);
            Traveler.InsanityWriteLog(msg);

            foreach (OccultTypes type in Enum.GetValues(typeof(OccultTypes)))
            {
                try
                {
                    switch (type)
                    {
                        case OccultTypes.None:
                        case OccultTypes.Ghost:
                            break;

                        default:
                            if ((source.HasOccultType(type)) && (!ths.HasOccultType(type)))
                            {
                                msg += Common.NewLine + "A " + type;
                                Traveler.InsanityWriteLog(msg);

                                ths.MergeOccult(type);
                            }

                            if ((!source.HasOccultType(type)) && (ths.HasOccultType(type)))
                            {
                                msg += Common.NewLine + "B " + type;
                                Traveler.InsanityWriteLog(msg);

                                OccultTypeHelper.Remove(ths.mOwnerDescription, type, false);
                            }
                            break;
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(ths.mOwnerDescription, null, "Type: " + type, e);
                }
            }
        }
Esempio n. 50
0
        protected override OptionResult Run(GameHitParameters<GameObject> parameters)
        {
            Common.StringBuilder msg = new Common.StringBuilder();

            try
            {
                Sim actor = parameters.mActor as Sim;
                Sim target = parameters.mTarget as Sim;

                if (!AcceptCancelDialog.Show("You are about to run 'ForceError', proceed?")) return OptionResult.Failure;

                target.mInteractionQueue = null;
            }
            catch (Exception e)
            {
                GameHitParameters<GameObject>.Exception(parameters, msg, e);
            }
            finally
            {
                Common.DebugWriteLog(msg);
            }
            return OptionResult.SuccessClose;
        }
Esempio n. 51
0
        public static bool UpdateAndGetRolesThatNeedPeople(RoleManager ths, out List<RoleToFill> rolesThatNeedInWorldSim, out List<RoleToFill> rolesThatNeedOtherWorldSim, out List<RoleToFill> rolesThatNeedCustomCreatedSim)
        {
            rolesThatNeedInWorldSim = new List<RoleToFill>();
            rolesThatNeedOtherWorldSim = new List<RoleToFill>();
            rolesThatNeedCustomCreatedSim = new List<RoleToFill>();

            if (ths == null) return false;

            Common.StringBuilder msg = new Common.StringBuilder("Role Check:");

            foreach (RoleData data in GetRolesForWorld(true))
            {
                switch(data.Type)
                {
                    case Role.RoleType.Paparazzi:
                        if (!Register.Settings.mAllowPaparazzi) continue;
                        break;
                    case Role.RoleType.Explorer:
                        if (!sVacationWorlds.Contains(GameUtils.GetCurrentWorld())) continue;
                        break;
                    case Role.RoleType.Tourist:
                        if (sVacationWorlds.Contains(GameUtils.GetCurrentWorld())) continue;
                        break;
                }

                List<Role> list2;
                bool globalProperTimeForRole = data.IsValidTimeForRole();
                int num = 0x0;

                msg += Common.NewLine + data.Type + " " + data.World + " " + data.Number + " " + globalProperTimeForRole + " " + data.FillRoleFrom;

                if (ths.mRoles.TryGetValue(data.Type, out list2))
                {
                    int num2 = 0x0;
                    while (num2 < list2.Count)
                    {
                        bool found = true;

                        bool localProperTimeForObject = globalProperTimeForRole;
                        Role role = list2[num2];
                        IRoleGiverExtended roleGivingObject = role.RoleGivingObject as IRoleGiverExtended;
                        if (roleGivingObject != null)
                        {
                            if ((roleGivingObject.LotCurrent == null) || (roleGivingObject.HasBeenDestroyed))
                            {
                                RoleManagerTaskEx.SafeRemoveSimFromRole("A", role);

                                found = false;
                            }
                            else
                            {
                                float startHour;
                                float endHour;
                                roleGivingObject.GetRoleTimes(out startHour, out endHour);
                                if (!SimClock.IsTimeBetweenTimes(startHour, endHour))
                                {                                    
                                    localProperTimeForObject = false;
                                }
                            }
                        }

                        if (found)
                        {
                            if (!RoleEx.IsSimGood(role))
                            {
                                RoleManagerTaskEx.SafeRemoveSimFromRole("A", role);

                                found = false;
                            }
                            else if (localProperTimeForObject && (!role.IsTryingToStartRole) && (role.SimInRole == null))
                            {
                                bool success = false;

                                if (Household.ActiveHousehold != null)
                                {
                                    try
                                    {
                                        Sim sim = Instantiation.PerformOffLot(role.mSim, Household.ActiveHousehold.LotHome, null);
                                        if (sim != null)
                                        {
                                            success = true;

                                            Common.DebugNotify("Added To Game\n" + role.mSim.FullName, sim);
                                        }
                                    }
                                    catch (ResetException)
                                    {
                                        throw;
                                    }
                                    catch (Exception e)
                                    {
                                        Common.DebugException(role.mSim, e);
                                    }
                                }

                                if ((!success) || (role.SimInRole == null))
                                {
                                    RoleManagerTaskEx.SafeRemoveSimFromRole("B", role);

                                    found = false;
                                }
                            }
                            else if ((role.RoleGivingObject != null) && (!role.RoleGivingObject.InWorld))
                            {
                                RoleManagerTaskEx.SafeRemoveSimFromRole("C", role);

                                found = false;
                            }
                        }

                        if (found)
                        {
                            if (role.RoleGivingObject == null)
                            {
                                num++;
                            }
                            num2++;
                        }
                    }
                }

                if ((num < data.Number) && globalProperTimeForRole)
                {                    
                    RoleToFill item = new RoleToFill(data.Type, data.Number - num);
                    if ((data.FillRoleFrom == Role.RoleFillFrom.Residents) || (data.FillRoleFrom == Role.RoleFillFrom.Townies))
                    {
                        rolesThatNeedInWorldSim.Add(item);
                    }
                    else if (data.FillRoleFrom == Role.RoleFillFrom.PeopleWhoDontLiveInThisWorld)
                    {
                        rolesThatNeedOtherWorldSim.Add(item);
                    }
                    else if (data.FillRoleFrom == Role.RoleFillFrom.CustomCreatedSim)
                    {
                        bool allow = true;
                        switch (data.Type)
                        {
                            case Role.RoleType.Deer:
                                if (Register.Settings.GetMaximumPoolSize(PetPoolType.NPCDeer) <= 0)
                                {
                                    allow = false;
                                }
                                break;
                            case Role.RoleType.Raccoon:
                                if (Register.Settings.GetMaximumPoolSize(PetPoolType.NPCRaccoon) <= 0)
                                {
                                    allow = false;
                                }
                                break;
                        }

                        if (allow)
                        {
                            rolesThatNeedCustomCreatedSim.Add(item);
                        }
                    }
                }
            }

            Common.DebugNotify(msg);

            return true;
        }
Esempio n. 52
0
            public static void Perform()
            {
                Common.StringBuilder msg = new Common.StringBuilder("ServicePoolCleanup");

                try
                {
                    GrimReaper grim = null;

                    for (int i = Services.AllServices.Count - 1; i >= 0; i--)
                    {
                        Service service = Services.AllServices[i];

                        if (service == null)
                        {
                            Services.AllServices.RemoveAt(i);

                            msg += Common.NewLine + "Empty Service Removed";
                            continue;
                        }

                        msg += Common.NewLine + "Service: " + service.ServiceType;

                        if (service is GrimReaper)
                        {
                            grim = service as GrimReaper;
                        }

                        List<SimDescription> pool = new List<SimDescription>();

                        for (int j = service.mPool.Count - 1; j >= 0; j--)
                        {
                            SimDescription sim = service.mPool[j];
                            if ((sim == null) || (!sim.IsValidDescription) || (sim.Household == null))
                            {
                                service.mPool.RemoveAt(j);

                                msg += Common.NewLine + "Bogus Service Removed " + service.GetType();
                            }
                            else
                            {
                                pool.Add(sim);
                            }
                        }

                        if (pool.Count == 0) continue;

                        int maxSims = 2;

                        if (service.Tuning != null)
                        {
                            maxSims = service.Tuning.kMaxNumNPCsInPool;
                            if (maxSims < 0)
                            {
                                maxSims = 0;
                            }
                        }

                        Dictionary<ulong, bool> assigned = new Dictionary<ulong, bool>();

                        msg += Common.NewLine + "Tuning: " + maxSims;
                        msg += Common.NewLine + "Count: " + pool.Count;

                        ResortWorker workerService = service as ResortWorker;
                        List<ObjectGuid> objsToUnReg = new List<ObjectGuid>();
                        if (workerService != null)
                        {
                            if (workerService.mWorkerInfo != null)
                            {
                                foreach (KeyValuePair<ObjectGuid, ResortWorker.WorkerInfo> info in workerService.mWorkerInfo)
                                {
                                    bool objValid = false;
                                    GameObject obj = GameObject.GetObject(info.Key);
                                    if (obj != null && obj.InWorld)
                                    {
                                        Lot lotCurrent = obj.LotCurrent;
                                        if (lotCurrent != null && lotCurrent.IsCommunityLotOfType(CommercialLotSubType.kEP10_Resort))
                                        {
                                            objValid = true;
                                            assigned[info.Value.CurrentSimDescriptionID] = true;
                                            assigned[info.Value.DesiredSimDescriptionID] = true;
                                        }
                                    }

                                    if (!objValid)
                                    {
                                        objsToUnReg.Add(info.Key);                                        
                                    }
                                }

                                foreach (ObjectGuid guid in objsToUnReg)
                                {
                                    workerService.UnregisterObject(guid);
                                }
                                objsToUnReg.Clear();
                            }
                        }

                        RandomUtil.RandomizeListOfObjects(pool);

                        for (int j = pool.Count - 1; j >= 0; j--)
                        {
                            if (workerService == null)
                            {
                                if (pool.Count <= maxSims) break;
                            }

                            SimDescription choice = pool[j];

                            if (service.IsSimAssignedTask(choice)) continue;

                            if (assigned.ContainsKey(choice.SimDescriptionId)) continue;

                            ServiceCleanup.AttemptServiceDisposal(choice, false, "Too Many " + service.ServiceType);

                            pool.RemoveAt(j);
                        }

                        List<SimDescription> serviceSims = new List<SimDescription>(service.Pool);
                        foreach (SimDescription serviceSim in serviceSims)
                        {
                            if (serviceSim == null) continue;

                            if (!serviceSim.IsValidDescription)
                            {
                                service.EndService(serviceSim);
                            }
                            else if (SimTypes.IsDead(serviceSim))
                            {
                                service.EndService(serviceSim);
                            }
                        }
                    }

                    if (grim != null)
                    {
                        if (grim.mPool.Count == 0)
                        {
                            SimDescription sim = grim.CreateNewNPCForPool(null);
                            if (sim != null)
                            {
                                grim.AddSimToPool(sim);
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(msg, e);
                }
                finally
                {
                    Common.DebugNotify(msg);
                }
            }
Esempio n. 53
0
        private bool DoSingleRouteEx(Route r, bool bAllowOverlays)
        {
            Common.StringBuilder msg = new Common.StringBuilder("DoSingleRouteEx");

            try
            {
                mbRouteLeadInPlaying = false;
                if ((bAllowOverlays && (r.GetDistanceRemaining() > TraitTuning.RouteDistanceForIdle)) && !r.GetOption(Route.RouteOption.DisableRouteLeadIns))
                {
                    if (!mOwnerSim.IsHoldingAnything() && RandomUtil.RandomChance01(TraitTuning.ChanceForRouteLeadIn))
                    {
                        mOwnerSim.OverlayComponent.UpdateInteractionFreeParts(AwarenessLevel.OverlayUpperbody);
                        uint segmentAtDistanceBeforeEnd = r.GetSegmentAtDistanceBeforeEnd(SimScriptAdaptor.DistanceToStopOverlay, true);
                        r.RegisterCallback(OnAboutToFinishRoute, RouteCallbackType.TriggerOnce, RouteCallbackConditions.EnteringSegment(segmentAtDistanceBeforeEnd));
                        r.RegisterCallback(OnRouteFinished, RouteCallbackType.TriggerOnce, new RouteCallbackCondition(RouteCallbackConditions.Ended));
                        mbRouteLeadInPlaying = mOwnerSim.IdleManager.PlayRouteLeadIn();
                        if (mbRouteLeadInPlaying)
                        {
                            OverlayComponent overlayComponent = mOwnerSim.OverlayComponent;
                            overlayComponent.OverlaysEnded += OnOverlaysEnded;
                        }
                    }
                    if (mOwnerSim.IsHuman)
                    {
                        mOwnerSim.OverlayComponent.PlayReaction(ReactionTypes.FacialAutoSelect, null);
                    }
                }

                if (mOwnerSim.IsHorse || mOwnerSim.IsDeer)
                {
                    r.RegisterCallback(HorseDeerRoutingEffectsCallback, RouteCallbackType.TriggerWhileTrue, new RouteCallbackCondition(RouteCallbackConditions.AnimationTriggeredEvent));
                }
                else if ((mOwnerSim.IsPuppy || mOwnerSim.IsKitten) && SeasonsManager.Enabled)
                {
                    r.RegisterCallback(PuppyKittenSnowLevelCallback, RouteCallbackType.TriggerOnTrue, new RouteCallbackCondition(RouteCallbackConditions.InDeepSnow));
                    r.RegisterCallback(PuppyKittenSnowLevelCallback, RouteCallbackType.TriggerOnTrue, new RouteCallbackCondition(RouteCallbackConditions.InShallowSnow));
                }

                bool flag = false;
                IHasScriptProxy destObj = r.DestObj;
                try
                {
                    flag = RoutingComponentEx.DoRoute(this, r);
                    float maxMinutesToWaitForRouteLeadIn = SimScriptAdaptor.MaxMinutesToWaitForRouteLeadIn;
                    DateAndTime previousDateAndTime = SimClock.CurrentTime();

                    while (mbRouteLeadInPlaying && (SimClock.ElapsedTime(TimeUnit.Minutes, previousDateAndTime) < maxMinutesToWaitForRouteLeadIn))
                    {
                        SpeedTrap.Sleep();
                    }

                    if (UsingStroller)
                    {
                        new GetOutOfStrollerRouteAction(mOwnerSim, r).PerformAction();
                    }
                }
                finally
                {
                    if (mbRouteLeadInPlaying)
                    {
                        mbRouteLeadInPlaying = false;
                        OverlayComponent component2 = mOwnerSim.OverlayComponent;
                        component2.OverlaysEnded -= OnOverlaysEnded;
                        mOwnerSim.OverlayComponent.StopAllOverlays();
                    }

                    try
                    {
                        mOwnerSim.IdleManager.StopFacialIdle(true);
                    }
                    catch (Exception e)
                    {
                        Common.Exception(mOwnerSim, e);
                    }

                    if (UsingStroller)
                    {
                        new GetOutOfStrollerRouteAction(mOwnerSim, r).PerformAction();
                    }
                }

                if (!flag || !mOwnerSim.HasExitReason(ExitReason.ObjectStateChanged))
                {
                    return flag;
                }

                if (r.DoRouteFail)
                {
                    InteractionInstance currentInteraction = mOwnerSim.CurrentInteraction;
                    if ((currentInteraction != null) && (currentInteraction.Target != null))
                    {
                        mOwnerSim.PlayRouteFailure(currentInteraction.Target.GetThoughtBalloonThumbnailKey());
                    }
                    else
                    {
                        mOwnerSim.PlayRouteFailure();
                    }
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(mOwnerSim, e);
            }

            return false;
        }
Esempio n. 54
0
        /*
        public static void DebugMsg(Sim sim, Common.StringBuilder msg, string text)
        {
            if (text != null)
            {
                msg += Common.NewLine + text;
            }

            if ((sim != null) && (sim.FirstName == "Roberto"))
            {
                Common.Notify(msg);
            }
        }
        */
        public override bool DoRoute(Route r)
        {
            Sim routeSim = null;

            if (!GoHere.Settings.mAllowCarRouting)
            {
                r.SetOption(Route.RouteOption.EnablePlanningAsCar, false);
                r.SetOption(Route.RouteOption.BeginAsCar, false);
            }

            if (!GoHere.Settings.mAllowBoatRouting)
            {
                r.SetOption2(Route.RouteOption2.EnablePlanningAsBoat, false);
                r.SetOption2(Route.RouteOption2.BeginAsBoat, false);
            }

            Common.StringBuilder msg = new Common.StringBuilder("DoRoute");

            try
            {
                if (r.Follower != null)
                {
                    routeSim = r.Follower.Target as Sim;
                }

                if ((routeSim != null) && (routeSim.Occupation != null))
                {
                    if (routeSim.SimDescription.GetOutfitCount(OutfitCategories.Career) == 0)
                    {
                        routeSim.Occupation.SetOccupationOutfitForCurrentLevel();
                    }
                }

                if (!r.PlanResult.Succeeded())
                {
                    msg += Common.NewLine + "A: " + r.PlanResult + " False";

                    DoRouteFailureBehavior(r);
                    mOwnerSim.AddExitReason(ExitReason.RouteFailed);
                    return false;
                }

                bool flag = false;
                IGameObject destObj = r.DestObj as IGameObject;
                try
                {
                    if (destObj != null)
                    {
                        destObj.AddToRoutingReferenceList(mOwnerSim);
                        mOwnerSim.LookAtManager.SetRoutingLookAt(destObj as GameObject);
                    }

                    mbIgnoreAllObstaclesStartTimeValid = false;
                    if (mOwnerSim.IsActiveSim)
                    {
                        Route.SetFadePriority(mOwnerSim.ObjectId, 0x186a3);
                    }
                    else if (mOwnerSim.IsInActiveHousehold)
                    {
                        Route.SetFadePriority(mOwnerSim.ObjectId, 0x186a2);
                    }
                    else
                    {
                        Route.SetFadePriority(mOwnerSim.ObjectId, 0x186a1);
                    }

                    while (true)
                    {
                        flag = false;
                        if (mbPushRequested)
                        {
                            if ((!(mOwnerSim.Posture is SittingInVehicle) && !(mOwnerSim.Posture is SittingInBoat)) && (mOwnerSim.RoutingComponent.RoutingParent == null))
                            {
                                try
                                {
                                    MidRouteBePushed(r.ExecutionFromNonSimTaskIsSafe);
                                }
                                catch (ResetException)
                                {
                                    throw;
                                }
                                catch (Exception e)
                                {
                                    Common.Exception(routeSim, e);
                                }

                                r.Replan();
                            }
                            else
                            {
                                mbPushRequested = false;
                            }

                            continue;
                        }

                        StartPushImmunity(OnRouteStartedImmuneToPushesDuration);
                        flag = DoSingleRouteEx(r, true);
                        flag &= r.PlanResult.Succeeded();
                        if (mbPushRequested)
                        {
                            continue;
                        }

                        if (r.GetOption(Route.RouteOption.CheckForFootprintsNearGoals))
                        {
                            ObjectGuid guid = r.IsPointObstructedBySim(mOwnerSim.PositionOnFloor);
                            if (guid != ObjectGuid.InvalidObjectGuid)
                            {
                                ObjectGuid runningTargetId = ObjectGuid.InvalidObjectGuid;
                                if (((mOwnerSim.InteractionQueue != null) && (mOwnerSim.InteractionQueue.RunningInteraction != null)) && (mOwnerSim.InteractionQueue.RunningInteraction.Target != null))
                                {
                                    runningTargetId = mOwnerSim.InteractionQueue.RunningInteraction.Target.ObjectId;
                                }

                                if ((guid != runningTargetId) && !PushSims(mOwnerSim.PositionOnFloor, 0.5f, false))
                                {
                                    bool option = r.GetOption(Route.RouteOption.BlockedByPeople);
                                    r.SetOption(Route.RouteOption.BlockedByPeople, true);
                                    r.Replan();
                                    r.SetOption(Route.RouteOption.BlockedByPeople, option);
                                    if (r.PlanResult.Succeeded() && (r.IsPointObstructedBySim(mOwnerSim.PositionOnFloor) == ObjectGuid.InvalidObjectGuid))
                                    {
                                        continue;
                                    }

                                    StartPushImmunity(OnEmergencyGetAwayRouteStartedImmuneToPushesDuration);
                                    Route route = PlanRouteForPush(mOwnerSim, null, PushSimsAwayDistanceMin, PushSimsAwayDistanceMax);
                                    DoSingleRouteEx(route, false);
                                    flag = false;
                                    if (r.DoRouteFail)
                                    {
                                        Sim sim = guid.ObjectFromId<Sim>();
                                        PlayRouteFailureIfAppropriate(sim);
                                    }

                                    RouteFailureTurnJigBlocker = ObjectGuid.InvalidObjectGuid;
                                    HasRouteFailureFromTurnJig = false;

                                    msg += Common.NewLine + "B: " + r.PlanResult + " " + flag;

                                    return flag;
                                }
                            }
                        }

                        break;
                    }

                    if (HasRouteFailureFromTurnJig && r.DoRouteFail)
                    {
                        GameObject obj3 = GameObject.GetObject(RouteFailureTurnJigBlocker);
                        PlayRouteFailureIfAppropriate(obj3);
                    }
                }
                finally
                {
                    if (destObj != null)
                    {
                        destObj.RemoveFromRoutingReferenceList(mOwnerSim);
                    }

                    mbIgnoreAllObstaclesStartTimeValid = false;
                    mbPushImmunityStartTimeValid = false;
                    Route.SetFadePriority(mOwnerSim.ObjectId, 0x186a0);
                    mOwnerSim.LookAtManager.SetRoutingLookAt(null);
                }

                RouteFailureTurnJigBlocker = ObjectGuid.InvalidObjectGuid;
                HasRouteFailureFromTurnJig = false;

                msg += Common.NewLine + "C: " + flag;

                return flag;
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(routeSim, e);
                throw;
            }
            finally
            {
                //Common.DebugNotify(msg, routeSim);
            }
        }
Esempio n. 55
0
        public static void RestockDisplay(CraftersConsignmentDisplay display, out Common.StringBuilder debug)
        {
            debug = new Common.StringBuilder("Display: " + display.CatalogName + Common.NewLine + "ObjectID:" + display.ObjectId);
            if (qualites.Count == 0)
            {
                InitLists();
            }

            List<int> slotsToSkipForWeddingCakeSetupOnChiller = new List<int> { 23, 25 };
            List<int> slotsToSkipForWeddingCakeSetupOnRack = new List<int> { 0, 2, 4 };
            List<int> slotsForWeddingCakesChiller = new List<int> { 21, 22, 24 };
            List<int> slotsForWeddingCakesOnRack = new List<int> { 1, 3 };
            // wedding cake slots are included in these so they get stocked... if the cakes are disabled, they will be skipped properly
            List<int> slotsForElegantStockingOnRack = new List<int> { 1, 3, 5, 8, 9, 11, 13, 14, 17, 18, 20, 22, 23, 26 };
            List<int> slotsForElegantStockingOnChiller = new List<int> { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 21, 22, 24 };
            Recipe randomRestockRecipe = null;

            if (display.LotCurrent != null)
            {
                debug += Common.NewLine + "LotCurrent: " + display.LotCurrent.Name;
            }

            if (!display.InWorld)
            {
                debug += Common.NewLine + "Display not in world";
                return;
            }

            if (Cupcake.Settings.IsDisplayExempt(display.ObjectId))
            {
                debug += Common.NewLine + "Display has auto restock disabled";
                return;
            }

            bool random = false;
            if (!Cupcake.Settings.HasSettings(display.ObjectId))
            {
                debug += Common.NewLine + "Display has no user defined settings.";
                random = true;
            }

            if (!Cupcake.Settings.mAffectActive && random)
            {
                if (display.LotCurrent == null)
                {
                    debug += Common.NewLine + "LotCurrent null";
                    return;
                }

                if (display.LotCurrent.LotId == Household.ActiveHousehold.LotId)
                {
                    debug += Common.NewLine + "On active household lot";
                    return;
                }

                List<PropertyData> list = RealEstateManager.AllPropertiesFromAllHouseholds();
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i] != null && display.LotCurrent.LotId == list[i].LotId && list[i].Owner != null && list[i].Owner.OwningHousehold == Household.ActiveHousehold)
                    {
                        debug += Common.NewLine + "On owned lot";
                        return;
                    }
                }
            }

            DisplayHelper.DisplayTypes displayType;
            Dictionary<int, Slot> slots = DisplayHelper.GetEmptyOrFoodSlots(display, out displayType);
            foreach (KeyValuePair<int, Slot> slot in slots)
            {
                debug += Common.NewLine + "Slot: " + slot.Key;
                if (displayType == DisplayHelper.DisplayTypes.Chiller)
                {
                    if (!Cupcake.Settings.SlotHasSettings(display.ObjectId, slot.Key))
                    {
                        if (slot.Key > 20 && !Cupcake.Settings.mStockWeddingCakes)
                        {
                            debug += Common.NewLine + "Wedding cakes disabled, skipping top shelf";
                            continue;
                        }

                        if (Cupcake.Settings.mStockWeddingCakes && slotsToSkipForWeddingCakeSetupOnChiller.Contains(slot.Key))
                        {
                            debug += Common.NewLine + "Skipping slots for presentable wedding cake setup";
                            continue;
                        }

                        if (Cupcake.Settings.mElegantRestock && !slotsForElegantStockingOnChiller.Contains(slot.Key))
                        {
                            debug += Common.NewLine + "Skipping slot for elegant restocking";
                            continue;
                        }
                    }
                }

                if (displayType == DisplayHelper.DisplayTypes.Rack)
                {
                    if (!Cupcake.Settings.SlotHasSettings(display.ObjectId, slot.Key))
                    {
                        if (Cupcake.Settings.mStockWeddingCakes && slotsToSkipForWeddingCakeSetupOnRack.Contains(slot.Key))
                        {
                            debug += Common.NewLine + "Skipping slots for presentable wedding cake setup";
                            continue;
                        }

                        if (Cupcake.Settings.mElegantRestock && !slotsForElegantStockingOnRack.Contains(slot.Key))
                        {
                            debug += Common.NewLine + "Skipping slot for elegant restocking";
                            continue;
                        }
                    }
                }

                GameObject containedObject = display.GetContainedObject(slot.Value) as GameObject;
                if (containedObject == null)
                {
                    Dictionary<string, List<Quality>> settings = Cupcake.Settings.GetDisplaySettingsForSlot(display.ObjectId, slot.Key);

                    Recipe recipe = null;
                    IFoodContainer container = null;
                    Quality quality = Quality.Perfect;
                    if (random && !Cupcake.Settings.mDisableRandomAutoRestock && (!Cupcake.Settings.mOneRecipePerDisplayOnRandom || (Cupcake.Settings.mOneRecipePerDisplayOnRandom && randomRestockRecipe == null)))
                    {
                        debug += Common.NewLine + "Random";
                        if (Cupcake.Settings.mRandomRestockSettings.Count > 0)
                        {
                            if (Cupcake.Settings.Debugging)
                            {
                                debug += Common.NewLine + "Choices:";
                                foreach (KeyValuePair<string, List<Quality>> val in Cupcake.Settings.mRandomRestockSettings)
                                {
                                    debug += Common.NewLine + val.Key;
                                    foreach (Quality val2 in val.Value)
                                    {
                                        debug += Common.NewLine + val2.ToString();
                                    }
                                }
                            }

                            if (Recipe.NameToRecipeHash.Count > 0)
                            {
                                string pick = RandomUtil.GetRandomObjectFromList<string>(new List<string>(Cupcake.Settings.mRandomRestockSettings.Keys));
                                if (Recipe.NameToRecipeHash.ContainsKey(pick))
                                {
                                    recipe = Recipe.NameToRecipeHash[pick];

                                    debug += Common.NewLine + "Fetching random recipe...";
                                    debug += Common.NewLine + "Pick: " + recipe.Key;

                                    quality = RandomUtil.GetRandomObjectFromList<Quality>(Cupcake.Settings.mRandomRestockSettings[pick]);
                                    debug += Common.NewLine + "Fetching random quality...";
                                    debug += Common.NewLine + "Pick: " + quality.ToString();
                                }
                                else
                                {
                                    debug += Common.NewLine + "Failed to find defined recipe";
                                    continue;
                                }
                            }
                        }
                        else
                        {
                            if (goodies.Count > 0)
                            {
                                recipe = RandomUtil.GetRandomObjectFromList<Recipe>(goodies);
                                debug += Common.NewLine + "Fetching random bakery recipe...";
                                debug += Common.NewLine + "Pick: " + recipe.SpecificNameKey;
                                debug += Common.NewLine + "Quality: Always Perfect";
                            }
                        }

                        randomRestockRecipe = recipe;
                    }

                    if (random && Cupcake.Settings.mOneRecipePerDisplayOnRandom && randomRestockRecipe != null)
                    {
                        debug += Common.NewLine + "OneRecipePerDisplayOnRandom = true" + Common.NewLine + "Last Recipe: " + randomRestockRecipe.GenericName;
                        recipe = randomRestockRecipe;
                    }

                    if (settings != null)
                    {                       
                        debug += Common.NewLine + "Reading user settings...";

                        if (Cupcake.Settings.Debugging)
                        {
                            debug += Common.NewLine + "Choices:";
                            foreach (KeyValuePair<string, List<Quality>> val in settings)
                            {
                                debug += Common.NewLine + val.Key;
                                foreach (Quality val2 in val.Value)
                                {
                                    debug += Common.NewLine + val2.ToString();
                                }
                            }
                        }

                        string pick = "";
                        if (settings.Count > 0)
                        {
                            List<string> tempList = new List<string>();
                            tempList.AddRange(settings.Keys);                            

                            pick = RandomUtil.GetRandomObjectFromList<string>(tempList);

                            if (Recipe.NameToRecipeHash.ContainsKey(pick))
                            {
                                recipe = Recipe.NameToRecipeHash[pick];
                                debug += Common.NewLine + "Fetching random recipe...";
                                debug += Common.NewLine + "Pick: " + recipe.Key;
                            }
                            else
                            {
                                debug += Common.NewLine + "Failed to find defined recipe: " + pick;
                                continue;
                            }
                        }
                        else
                        {
                            debug += Common.NewLine + "Settings for slot was 0 count.";
                            continue;
                        }

                        quality = RandomUtil.GetRandomObjectFromList<Quality>(Cupcake.Settings.mDisplayRestockSettings[display.ObjectId][slot.Key][pick]);
                        debug += Common.NewLine + "Fetching random quality...";
                        debug += Common.NewLine + "Pick: " + quality.ToString();
                    }

                    bool tryCake = false;
                    if (random && Cupcake.Settings.mStockWeddingCakes && !Cupcake.Settings.SlotHasSettings(display.ObjectId, slot.Key))
                    {
                        List<string> cakes = new List<string> { "BSBakeWeddingCake", "WeddingCakeSliceDOT07" };
                        tryCake = true;

                        if (GameUtils.IsInstalled(ProductVersion.EP4))
                        {
                            cakes.Add("Wedding Cake Slice");
                        }

                        if ((displayType == DisplayHelper.DisplayTypes.Chiller && slotsForWeddingCakesChiller.Contains(slot.Key)) || (displayType == DisplayHelper.DisplayTypes.Rack && slotsForWeddingCakesOnRack.Contains(slot.Key)))
                        {
                            debug += Common.NewLine + "Wedding cake slot";
                            recipe = null;
                            while (recipe == null)
                            {
                                string pick = RandomUtil.GetRandomObjectFromList<string>(cakes);
                                if (!Recipe.NameToRecipeHash.TryGetValue(pick, out recipe))
                                {
                                    // for folks with out of date mods
                                    if (pick == "BSBakeWeddingCake")
                                    {
                                        break;
                                    }
                                }                                
                            }
                        }                        
                    }                    

                    if (recipe != null)
                    {
                        if (quality == Quality.Any)
                        {
                            // EA standard apparently doesn't handle this correctly...
                            quality = RandomUtil.GetRandomObjectFromList<Quality>(qualites);
                        }

                        // Catalog recipes                        
                        IGameObject cake = null;                        
                        if (recipe.Key == "WeddingCakeSliceDOT07")
                        {
                            debug += Common.NewLine + "Attempt at Monte Vista cake";
                            cake = GlobalFunctions.CreateObjectOutOfWorld("foodServeCakeWeddingDOT07", ~ProductVersion.Undefined);                            
                            if (cake is FailureObject)
                            {
                                cake = GlobalFunctions.CreateObjectOutOfWorld("foodServeCakeWeddingDOT07", ProductVersion.BaseGame);
                            }                            
                        }
                        else if (recipe.Key == "Wedding Cake Slice")
                        {
                            debug += Common.NewLine + "Attempt at Generations cake";
                            cake = GlobalFunctions.CreateObjectOutOfWorld("foodServeCakeWeddingTraditional", ProductVersion.EP4);
                            if (cake is FailureObject)
                            {
                                cake = GlobalFunctions.CreateObjectOutOfWorld("foodServeCakeWeddingTraditional", ProductVersion.BaseGame);
                            }
                        } else if (((tryCake && cake is FailureObject) || recipe.Key == "BSBakeWeddingCake"))
                        {
                            debug += Common.NewLine + "Attempt at Store Wedding cake";
                            cake = GlobalFunctions.CreateObjectOutOfWorld("foodServeCakeWeddingBakery", ~ProductVersion.Undefined);
                            if (cake is FailureObject)
                            {
                                cake = GlobalFunctions.CreateObjectOutOfWorld("foodServeCakeWeddingBakery", ProductVersion.BaseGame);
                            }   
                        }
                        else if (recipe.Key == "BSBakeBirthdayCake")
                        {
                            debug += Common.NewLine + "Attempt at Store Birthday cake";
                            cake = GlobalFunctions.CreateObjectOutOfWorld("FoodBirthdayCakeBakery", ~ProductVersion.Undefined);
                            if (cake is FailureObject)
                            {
                                cake = GlobalFunctions.CreateObjectOutOfWorld("FoodBirthdayCakeBakery", ProductVersion.BaseGame);
                            }   
                        }
                        else
                        {
                            container = recipe.CreateFinishedFood(recipe.CanMakeGroupServing ? Recipe.MealQuantity.Group : Recipe.MealQuantity.Single, quality);
                        }

                        if (cake != null)
                        {
                            if (cake is FailureObject)
                            {
                                debug += Common.NewLine + "Cake was FailureObject";
                                try
                                {
                                    cake.Destroy();
                                }
                                catch { }
                                continue;
                            }

                            debug += Common.NewLine + "Cake success";
                            DisplayHelper.ParentToSlot(cake as GameObject, slot.Value, display);
                            cake.AddToWorld();
                            InitInteractions(cake as GameObject);
                        }                        

                        if (container != null)
                        {
                            if (container is FailureObject)
                            {
                                debug += Common.NewLine + "Container was FailureObject";
                                try
                                {
                                    container.Destroy();
                                }
                                catch { }
                                continue;
                            }

                            DisplayHelper.ParentToSlot(container as GameObject, slot.Value, display);
                            container.SetGeometryState(recipe.SingleServingContainer); // this is how EA sets it, don't ask                            
                            container.AddToWorld();

                            ServingContainer container2 = container as ServingContainer;
                            if (container2 != null)
                            {
                                int[] numArray = new int[] { 0, 0, 0, 0, 0, 0, 15, 30, 0x2d, 60, 0x4b, 100, 0x65 };
                                container2.CookingProcess.FoodPoints = numArray[(int)quality];
                                container2.CookingProcess.FoodState = FoodCookState.Cooked;
                                container2.FoodCookStateChanged(container2.CookingProcess.FoodState);                               
                            }

                            InitInteractions(container as GameObject);

                            debug += Common.NewLine + "Success: " + recipe.GenericName + Common.NewLine + quality.ToString();
                        }
                    }
                }
                else
                {
                    debug += Common.NewLine + "Slot contained object: " + containedObject.CatalogName;
                }
            }
            display.AddInteractionsToChildObjects();
        }
Esempio n. 56
0
 public static void RefillDisplays()
 {
     if (Cupcake.Settings.mAutoRestock)
     {
         Common.StringBuilder msg = new Common.StringBuilder();
         Common.StringBuilder displayMsg;
         foreach (CraftersConsignmentDisplay display in Sims3.Gameplay.Queries.GetObjects<CraftersConsignmentDisplay>())
         {
             try
             {
                 RestockDisplay(display, out displayMsg);
                 msg += displayMsg + Common.NewLine + Common.NewLine;
             }
             catch (Exception e)
             {
                 Common.Exception("", e);
             }                    
         }
         Common.DebugWriteLog(msg);
         msg = null;
         displayMsg = null;
         goodies.Clear();
         qualites.Clear();
     }
     else
     {
         Common.DebugNotify("Auto restock disabled.");
     }
 }
        public static void PostFutureWorldLoadProcess(FutureDescendantService ths)
        {
            Common.StringBuilder msg = new Common.StringBuilder("PostFutureWorldLoadProcess");

            TransitionSettings();

            if (Traveler.Settings.mDisableDescendants)
            {
                msg += Common.NewLine + "Disabled, returning";
                Common.DebugWriteLog(msg);
                ths.RemoveInactiveDescendantHouseholds();
                return;
            }

            try
            {
                ths.PostWorldLoadFixupOfHouseholds();

                if (!Traveler.Settings.mDisableDescendantModification || (Traveler.Settings.mDisableDescendantModification && !ActiveHouseholdHasDescendants()))
                {
                // Custom
                ProcessDescendantHouseholds(ths);
                }

                ths.BuildAvailableLotLists();

                foreach (SimDescription description in GameStates.TravelHousehold.SimDescriptions)
                {
                    ths.RemoveDescendantMapTags(description.SimDescriptionId);
                }

                List<FutureDescendantService.FutureDescendantHouseholdInfo> remove = new List<FutureDescendantService.FutureDescendantHouseholdInfo>();
                for (int i = 0x0; i < FutureDescendantService.sPersistableData.ActiveDescendantHouseholdsInfo.Count; i++)
                {
                    bool flag = true;
                    FutureDescendantService.FutureDescendantHouseholdInfo household = FutureDescendantService.sPersistableData.ActiveDescendantHouseholdsInfo[i];
                    if (household.DoesHouseholdLotRequireUpdate())
                    {
                        msg += Common.NewLine + "DoesHouseholdLotRequireUpdate = true";
                        flag = ths.UpdateHouseholdHomeLot(ref household);
                        if (!flag)
                        {
                            msg += Common.NewLine + "UpdateHouseholdHomeLot returned false... removing household " + household.mHouseholdName;
                            remove.Add(household);
                        }
                    }

                    if (flag)
                    {
                        msg += Common.NewLine + "UpdateHouseholdHomeLot returned true";
                        household.UpdateHouseholdRelationship();
                        household.SetupDescendantAlarm();                        
                        FixupOccults(ths, household);
                        ths.UpdateHouseholdMapTags(household.mAncestorsSimIds, household.DescendantHousehold);
                    }
                }

                foreach (FutureDescendantService.FutureDescendantHouseholdInfo info2 in remove)
                {
                    FutureDescendantService.sPersistableData.ActiveDescendantHouseholdsInfo.Remove(info2);
                    foreach (List<FutureDescendantService.FutureDescendantHouseholdInfo> list2 in FutureDescendantService.sPersistableData.DescendantHouseholdsMap.Values)
                    {
                        if (list2.Contains(info2))
                        {
                            list2.Remove(info2);
                        }
                    }
                    msg += Common.NewLine + "Successfully invalidated " + info2.mHouseholdName;
                    FutureDescendantService.sPersistableData.InvalidDescendantHouseholdsInfo.Add(info2);
                }                
                ths.CleanupdAvailableLotLists();               
                ths.RemoveInactiveDescendantHouseholds();                

                new Common.AlarmTask(20, TimeUnit.Minutes, PackupMinis);                               
            }
            catch (Exception e)
            {
                Common.Exception("PostFutureWorldLoadProcess", e);
            }
            finally
            {
                Common.DebugWriteLog(msg);
            }
        }
        public static void FixupOccults(FutureDescendantService ths, FutureDescendantService.FutureDescendantHouseholdInfo descendantHouseholdInfo)
        {
            Common.StringBuilder msg = new Common.StringBuilder("FixupOccults");

            if (descendantHouseholdInfo == null)
            {
                msg += Common.NewLine + "descendantHouseholdInfo null";
            }

            if (descendantHouseholdInfo.DescendantHousehold == null)
            {
                msg += Common.NewLine + "descendantHouseholdInfo.DescendantHousehold null";
            }

            if (!descendantHouseholdInfo.mFutureDescendantHouseholdInfoDirty)
            {
                msg += Common.NewLine + "mFutureDescendantHosueholdInfoDirty is false";
            }

            if (Traveler.Settings.mChanceOfOccultHybrid == 0)
            {
                msg += Common.NewLine + "Hybrid 0, returning";
                Common.DebugWriteLog(msg);
                ths.FixupOccults(descendantHouseholdInfo);
                return;
            }            

            try
            {                
                if (((descendantHouseholdInfo != null) && descendantHouseholdInfo.mFutureDescendantHouseholdInfoDirty) && (descendantHouseholdInfo.DescendantHousehold != null))                
                {                    
                    descendantHouseholdInfo.mFutureDescendantHouseholdInfoDirty = false;
                    List<OccultTypes> list = null;                    
                    float minAlienPercentage = 0f;
                    float maxAlienPercentage = 0f;                   
                    if (descendantHouseholdInfo.mProgenitorSimIds != null)
                    {                                                                        
                        foreach (ulong num in descendantHouseholdInfo.mProgenitorSimIds)
                        {
                            SimDescription item = null;
                            bool unpacked = false;
                            msg += Common.NewLine + "Num: " + num;                           
                            item = FutureDescendantHouseholdInfoEx.CreateProgenitor(num, out unpacked);

                            if (CrossWorldControl.sRetention.transitionedOccults.ContainsKey(num))
                            {
                                list = CrossWorldControl.sRetention.transitionedOccults[num];
                            }
                            else
                            {
                                msg += Common.NewLine + "Couldn't find Sim in transitionedOccults (Maybe they had none?)";
                            }

                            if (item != null)
                            {
                                // EA appears to transition this... I hope :)
                                msg += Common.NewLine + "Working on " + item.FullName;
                                if (SimTypes.IsServiceAlien(item))
                                {
                                    msg += Common.NewLine + "Is full blood Alien";
                                    maxAlienPercentage = 1f;
                                }
                                else
                                {
                                    msg += Common.NewLine + "Died (2)";
                                    if (item.AlienDNAPercentage == 0 && item.IsAlien)
                                    {
                                        msg += Common.NewLine + "IsAlien";
                                        minAlienPercentage = 0;
                                        maxAlienPercentage = 1;
                                    }
                                    else
                                    {
                                        if (item.AlienDNAPercentage > maxAlienPercentage)
                                        {
                                            maxAlienPercentage = item.mAlienDNAPercentage;
                                        }
                                        else if (item.AlienDNAPercentage > minAlienPercentage)
                                        {
                                            minAlienPercentage = item.mAlienDNAPercentage;
                                        }
                                    }
                                }                                                                 
                            }
                            else
                            {
                                msg += Common.NewLine + "Failed to find SimDesc";
                            }
                        }
                    }                    

                    if (descendantHouseholdInfo.mHouseholdMembers != null)
                    {                        
                        foreach (ulong num3 in descendantHouseholdInfo.mHouseholdMembers)
                        {
                            SimDescription newSim = SimDescription.Find(num3);
                            if (newSim != null && !newSim.IsDead)
                            {
                                msg += Common.NewLine + "Processing: " + newSim.FullName;                                
                                if (Traveler.Settings.mChanceOfOccultMutation == 0)
                                {
                                    msg += Common.NewLine + "Occult Mutation 0";
                                    List<OccultTypes> descendantOccults = OccultTypeHelper.CreateList(newSim, true);
                                    foreach (OccultTypes type in descendantOccults)
                                    {
                                        if (list == null || !list.Contains(type))
                                        {
                                            OccultTypeHelper.Remove(newSim, type, true);
                                        }
                                    }
                                }

                                if (list != null && list.Count > 0)
                                {
                                    msg += Common.NewLine + "Applying Occult Chance to " + newSim.FullName;
                                    bool success = FutureDescendantHouseholdInfoEx.ApplyOccultChance(newSim, list, Traveler.Settings.mChanceOfOccultHybrid, Traveler.Settings.mChanceOfOccultMutation, Traveler.Settings.mMaxOccult);
                                    if (success)
                                    {
                                        msg += Common.NewLine + "Added occults";
                                    }
                                }
                                else
                                {
                                    msg += Common.NewLine + "No occults found...";
                                }

                                if (minAlienPercentage > 0 || maxAlienPercentage > 0 && RandomUtil.CoinFlip())
                                {
                                    float percent = (minAlienPercentage + maxAlienPercentage) / 2f;
                                    float jitter = SimDescription.kAlienDNAJitterPercent * 2; // 2 generations have passed considering Travelers approach to descendants
                                    percent = RandomUtil.GetFloat(-jitter, jitter);
                                    newSim.SetAlienDNAPercentage(MathUtils.Clamp(percent, 0f, 1f));
                                    
                                    msg += Common.NewLine + "Made alien. Percent: " + newSim.mAlienDNAPercentage;
                                }
                            }
                            else
                            {
                                msg += Common.NewLine + "New Sim was null.";
                            }
                        }
                    }                    
                }
            }
            catch (Exception e)
            {
                Common.Exception("", e);
            }
            finally
            {
                Common.DebugWriteLog(msg);
            }
        }
        public static void BuildDescendantHouseholdSpecs(FutureDescendantService ths)
        {
            Common.StringBuilder msg = new Common.StringBuilder("BuildDescendantHouseholdSpecs");

            try
            {
                if (Household.ActiveHousehold != null)
                {                    
                    // Custom
                    for (int i = FutureDescendantService.sPersistableData.ActiveDescendantHouseholdsInfo.Count - 1; i >= 0; i--)
                    {
                        FutureDescendantService.FutureDescendantHouseholdInfo info = FutureDescendantService.sPersistableData.ActiveDescendantHouseholdsInfo[i];
                        if (info.HasAncestorFromHousehold(Household.ActiveHousehold) && info.mProgenitorSimIds.Count != 4)
                        {                            
                            msg += Common.NewLine + "mProgenitorSimIds wasn't 4 (" + info.mProgenitorSimIds.Count + ") so removing " + info.mHouseholdName;
                            FutureDescendantService.sPersistableData.InvalidDescendantHouseholdsInfo.Add(info);

                            FutureDescendantService.sPersistableData.ActiveDescendantHouseholdsInfo.RemoveAt(i);
                        }
                    }
                    //                    

                    List<SimDescription> simDescriptions = Household.ActiveHousehold.SimDescriptions;
                    foreach (SimDescription description in simDescriptions)
                    {
                        // Custom
                        ProcessSim(ths, description);
                    }

                    foreach (SimDescription description2 in simDescriptions)
                    {
                        ths.GenerateAncestorMap(description2);
                    }

                    foreach (FutureDescendantService.FutureDescendantHouseholdInfo info in FutureDescendantService.sPersistableData.ActiveDescendantHouseholdsInfo)
                    {
                        if (info.HasAncestorFromHousehold(Household.ActiveHousehold))
                        {
                            info.CalculateHouseholdScores();
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("", e);
            }
            finally
            {
                Common.DebugWriteLog(msg);
            }
        }
        private static bool ProcessDescendantHouseholds(FutureDescendantService ths)
        {
            Common.StringBuilder msg = new Common.StringBuilder("ProcessDescendantHouseholds");
           
            for (int i = 0x0; i < FutureDescendantService.sPersistableData.ActiveDescendantHouseholdsInfo.Count; i++)
            {
                try
                {
                    FutureDescendantService.FutureDescendantHouseholdInfo info = FutureDescendantService.sPersistableData.ActiveDescendantHouseholdsInfo[i];
                    Household descendantHousehold = info.DescendantHousehold;            
                    if (descendantHousehold != null)
                    {
                        if (Household.ActiveHousehold != null && info.HasAncestorFromHousehold(Household.ActiveHousehold))
                        {
                            msg += Common.NewLine + "descendantHousehold is not null.";
                            while (descendantHousehold.NumMembers > info.mCurrentDesiredHouseholdSize)
                            {
                                msg += Common.NewLine + "Removing descendant because the current size (" + descendantHousehold.NumMembers + ") is greater than the desired (" + info.mCurrentDesiredHouseholdSize + ")";
                                info.RemoveDescendant();
                            }

                            while (descendantHousehold.NumMembers < info.mCurrentDesiredHouseholdSize)
                            {
                                msg += Common.NewLine + "Adding descendant because the current size (" + descendantHousehold.NumMembers + ") is less  than the desired (" + info.mCurrentDesiredHouseholdSize + ")";
                                // Custom
                                if (!FutureDescendantHouseholdInfoEx.CreateAndAddDescendant(info)) break;
                            }

                            foreach (ulong num2 in Household.mDirtyNameSimIds)
                            {
                                if (info.IsSimAProgenitor(num2))
                                {
                                    SimDescription description = SimDescription.Find(num2);
                                    if (description != null)
                                    {
                                        foreach (SimDescription description2 in info.DescendantHousehold.SimDescriptions)
                                        {
                                            description2.LastName = description.LastName;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        msg += Common.NewLine + "descendantHousehold is null so instatiating a new one.";
                        // Custom
                        Household household2 = FutureDescendantHouseholdInfoEx.Instantiate(info);
                        FutureDescendantService.sPersistableData.ActiveDescendantHouseholdsInfo[i].mFutureDescendantHouseholdInfoDirty = true;
                        if (household2 == null)
                        {
                            msg += Common.NewLine + "NULL";
                        }
                    }                                       
                }
                catch (Exception e)
                {
                    Common.Exception(i.ToString(), e);
                }
                finally
                {                    
                    Common.DebugWriteLog(msg);
                }
            }
            Household.ClearDirtyNameSimIDs();
            return true;
        }