Exemplo n.º 1
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());
            }
Exemplo n.º 2
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());
        }
Exemplo n.º 3
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;
        }
Exemplo 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);
        }
Exemplo n.º 5
0
            public override string ToString()
            {
                Common.StringBuilder text = new Common.StringBuilder(base.ToString());

                text.AddXML("Pushed", mMoodPushedHome);

                return(text.ToString());
            }
Exemplo n.º 6
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());
 }
Exemplo n.º 7
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();
 }
Exemplo n.º 8
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());
 }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
            public override string ToString()
            {
                Common.StringBuilder text = new Common.StringBuilder();

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

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

            result += base.ToString();

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

            return(result.ToString());
        }
Exemplo n.º 12
0
        public override string ToString()
        {
            Common.StringBuilder text = new Common.StringBuilder("<CasteOptions>");

            text.AddXML("ID", mID);
            text += base.ToString();

            text += Common.NewLine + "</CasteOptions>";

            return(text.ToString());
        }
Exemplo n.º 13
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());
        }
Exemplo n.º 14
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();
        }
Exemplo n.º 15
0
        public static string GetWorldDataToString()
        {
            Common.StringBuilder msg = new Common.StringBuilder();

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

            return(msg.ToString());
        }
Exemplo n.º 16
0
        protected virtual string ToXMLString()
        {
            Common.StringBuilder result = new Common.StringBuilder();

            result += Common.NewLine + "    <Weight>" + mWeight + "</Weight>";
            result += Common.NewLine + "    <MinLength>" + mLength.First + "</MinLength>";
            result += Common.NewLine + "    <MaxLength>" + mLength.Second + "</MaxLength>";
            result += Common.NewLine + "    <MinTemp>" + mTemp.First + "</MinTemp>";
            result += Common.NewLine + "    <MaxTemp>" + mTemp.Second + "</MaxTemp>";

            return(result.ToString());
        }
Exemplo n.º 17
0
        public string ToXMLString(Season season, Weather weather, string name)
        {
            Common.StringBuilder result = new Common.StringBuilder();

            result += Common.NewLine + "  <" + weather + "Tuning>";
            result += Common.NewLine + "    <Season>" + season + "</Season>";
            result += Common.NewLine + "    <Name>" + name + "</Name>";
            result += ToXMLString();
            result += Common.NewLine + "  </" + weather + "Tuning>";

            return(result.ToString());
        }
Exemplo n.º 18
0
        public override string ToString()
        {
            Common.StringBuilder text = new Common.StringBuilder();

            text += StoryProgression.Localize("Accounting:Header", false, new object[] { SimClock.ElapsedCalendarDays() - mStartDay });

            mValues.Sort(new Comparison <Value>(Value.SortByName));

            string result = null;

            int net = 0;

            foreach (Value value in mValues)
            {
                if (value.Amount > 0)
                {
                    result += value.ToString();

                    net += value.Amount;
                }
            }

            if (!string.IsNullOrEmpty(result))
            {
                text += Common.NewLine + Common.NewLine + StoryProgression.Localize("Accounting:Gain");
                text += result;
            }

            result = null;

            foreach (Value value in mValues)
            {
                if (value.Amount < 0)
                {
                    result += value.ToString();

                    net += value.Amount;
                }
            }

            if (!string.IsNullOrEmpty(result))
            {
                text += Common.NewLine + Common.NewLine + StoryProgression.Localize("Accounting:Loss");
                text += result;
            }

            text += Common.NewLine + Common.NewLine + StoryProgression.Localize("Accounting:Net", false, new object[] { net });

            return(text.ToString());
        }
Exemplo n.º 19
0
        public override string ToString()
        {
            Common.StringBuilder text = new Common.StringBuilder(base.ToString());

            if (mSkillLevels == null)
            {
                text += Common.NewLine + "<NoSkills/>";
            }
            else
            {
                foreach (KeyValuePair <SkillNames, Pair <int, float> > skill in mSkillLevels)
                {
                    text.AddXML(skill.Key.ToString(), skill.Value.First + ":" + skill.Value.Second);
                }
            }
            return(text.ToString());
        }
Exemplo n.º 20
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());
        }
Exemplo n.º 21
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();
        }
Exemplo n.º 22
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;
        }
Exemplo n.º 23
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);
        }
Exemplo n.º 24
0
            public override string ToString()
            {
                Common.StringBuilder text = new Common.StringBuilder("<ID>" + mID + "</ID>");

                foreach (ElementalSimData data in mData.Values)
                {
                    text += Common.NewLine + "<" + data.GetType().Name + ">";
                    text += Common.NewLine + data.ToString();
                    text += Common.NewLine + "</" + data.GetType().Name + ">";
                }

                foreach (CasteOptions option in SimCastes)
                {
                    text += Common.NewLine + "<Caste>" + option.Name + "</Caste>";
                }

                return(text.ToString());
            }
Exemplo n.º 25
0
            public override string ToString()
            {
                Common.StringBuilder results = new Common.StringBuilder();

                results += "LoadedNames";
                foreach (KeyValuePair <CASAgeGenderFlags, Genders> loadedNames in mLoadedNames)
                {
                    results += Common.NewLine + "Species: " + loadedNames.Key;
                    results += Common.NewLine + loadedNames.Value;
                }

                results += Common.NewLine + "Names";
                foreach (KeyValuePair <CASAgeGenderFlags, Genders> names in mNames)
                {
                    results += Common.NewLine + "Species: " + names.Key;
                    results += Common.NewLine + names.Value;
                }

                return(results.ToString());
            }
Exemplo n.º 26
0
        public override string ToString()
        {
            Common.StringBuilder text = new Common.StringBuilder("<HouseholdOptions>");

            Household house = House;

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

            text += base.ToString();

            text += Common.NewLine + "</HouseholdOptions>";

            return(text.ToString());
        }
Exemplo n.º 27
0
        public override string ToString()
        {
            Common.StringBuilder text = new Common.StringBuilder("<LotOptions>");

            Lot lot = Lot;

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

            text += base.ToString();

            text += Common.NewLine + "</LotOptions>";

            return(text.ToString());
        }
Exemplo n.º 28
0
        public static string PartToString(CASPart part)
        {
            Common.StringBuilder msg = new Common.StringBuilder();

            msg += Common.NewLine + "Body Type: " + part.BodyType;
            msg += Common.NewLine + "  Instance: 0x" + part.Key.InstanceId.ToString("X16");
            msg += Common.NewLine + "  Group: 0x" + part.Key.GroupId.ToString("X8");
            msg += Common.NewLine + "  Ages: " + (part.AgeGenderSpecies & CASAgeGenderFlags.AgeMask);
            msg += Common.NewLine + "  Genders: " + (part.AgeGenderSpecies & CASAgeGenderFlags.GenderMask);
            msg += Common.NewLine + "  Species: " + (part.AgeGenderSpecies & CASAgeGenderFlags.SpeciesMask);
            msg += Common.NewLine + "  Categories: ";

            foreach (OutfitCategories category in Enum.GetValues(typeof(OutfitCategories)))
            {
                if (category == OutfitCategories.None)
                {
                    continue;
                }

                if ((part.CategoryFlags & (uint)category) == (uint)category)
                {
                    msg += category + ",";
                }
            }

            msg += Common.NewLine + "  Extended: ";

            foreach (OutfitCategoriesExtended category in Enum.GetValues(typeof(OutfitCategoriesExtended)))
            {
                if ((part.CategoryFlags & (uint)category) == (uint)category)
                {
                    msg += category + ",";
                }
            }

            msg += Common.NewLine + "  BotPart: " + OutfitUtils.IsBotPart(part);

            return(msg.ToString());
        }
Exemplo n.º 29
0
        public string ToXMLTemperatureString(Season season)
        {
            Common.StringBuilder result = new Common.StringBuilder();

            result += Common.NewLine + "  <Temperature>";
            result += Common.NewLine + "    <Season>" + season + "</Season>";
            result += Common.NewLine + "    <Name>" + mName + "</Name>";
            result += Common.NewLine + "    <StartDay>" + mStart + "</StartDay>";
            result += Common.NewLine + "    <EndDay>" + mEnd + "</EndDay>";
            result += Common.NewLine + "    <Enabled>" + mEnabled + "</Enabled>";
            result += Common.NewLine + "    <MorningMin>" + mMorningTemp.First + "</MorningMin>";
            result += Common.NewLine + "    <MorningMax>" + mMorningTemp.Second + "</MorningMax>";
            result += Common.NewLine + "    <NoonMin>" + mNoonTemp.First + "</NoonMin>";
            result += Common.NewLine + "    <NoonMax>" + mNoonTemp.Second + "</NoonMax>";
            result += Common.NewLine + "    <EveningMin>" + mEveningTemp.First + "</EveningMin>";
            result += Common.NewLine + "    <EveningMax>" + mEveningTemp.Second + "</EveningMax>";
            result += Common.NewLine + "    <NightMin>" + mNightTemp.First + "</NightMin>";
            result += Common.NewLine + "    <NightMax>" + mNightTemp.Second + "</NightMax>";
            result += Common.NewLine + "  </Temperature>";

            return(result.ToString());
        }
Exemplo n.º 30
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            Common.StringBuilder result = new Common.StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?>");

            List <TunableNamespaceOption> options = new Tunable.ListingOption().GetOptions();

            options.Sort(CommonOptionItem.SortByName);

            result += Common.NewLine + "<Tuning>";

            foreach (TunableNamespaceOption option in options)
            {
                option.Export(result);
            }

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

            Common.WriteLog(result.ToString(), false);

            SimpleMessageDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Success"));

            return(OptionResult.SuccessRetain);
        }
Exemplo n.º 31
0
        public override string ToString()
        {
            Common.StringBuilder text = new Common.StringBuilder();

            SimDescription sim = SimDescription;

            if (sim == null)
            {
                text.AddXML("SimID", "Null");
            }
            else
            {
                text.AddXML("SimName", sim.FullName);
                text.AddXML("SimID", sim.SimDescriptionId);
            }

            foreach (string clan in mClans)
            {
                text.AddXML("Clan", clan);
            }

            text.AddXML("CurrentDay", SimClock.ElapsedCalendarDays());

            if (Other != null)
            {
                text += Common.NewLine + Other.ToString();
            }
            else
            {
                text += Common.NewLine + "<NoOther/>";
            }

            text += Common.NewLine + base.ToString();

            return(text.ToString());
        }
Exemplo n.º 32
0
            public override string ToString()
            {
                Common.StringBuilder results = new Common.StringBuilder();

                results += "LoadedNames";
                foreach (KeyValuePair<CASAgeGenderFlags, Genders> loadedNames in mLoadedNames)
                {
                    results += Common.NewLine + "Species: " + loadedNames.Key;
                    results += Common.NewLine + loadedNames.Value;
                }

                results += Common.NewLine + "Names";
                foreach (KeyValuePair<CASAgeGenderFlags, Genders> names in mNames)
                {
                    results += Common.NewLine + "Species: " + names.Key;
                    results += Common.NewLine + names.Value;
                }

                return results.ToString();
            }
Exemplo n.º 33
0
        public static string GetWorldDataToString()
        {
            Common.StringBuilder msg = new Common.StringBuilder();

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

            return msg.ToString();
        }
Exemplo n.º 34
0
        public static string PartToString(CASPart part)
        {
            Common.StringBuilder msg = new Common.StringBuilder();

            msg += Common.NewLine + "Body Type: " + part.BodyType;
            msg += Common.NewLine + "  Instance: 0x" + part.Key.InstanceId.ToString("X16");
            msg += Common.NewLine + "  Group: 0x" + part.Key.GroupId.ToString("X8");
            msg += Common.NewLine + "  Ages: " + (part.AgeGenderSpecies & CASAgeGenderFlags.AgeMask);
            msg += Common.NewLine + "  Genders: " + (part.AgeGenderSpecies & CASAgeGenderFlags.GenderMask);
            msg += Common.NewLine + "  Species: " + (part.AgeGenderSpecies & CASAgeGenderFlags.SpeciesMask);
            msg += Common.NewLine + "  Categories: ";

            foreach (OutfitCategories category in Enum.GetValues(typeof(OutfitCategories)))
            {
                if (category == OutfitCategories.None) continue;

                if ((part.CategoryFlags & (uint)category) == (uint)category)
                {
                    msg += category + ",";
                }
            }

            msg += Common.NewLine + "  Extended: ";

            foreach (OutfitCategoriesExtended category in Enum.GetValues(typeof(OutfitCategoriesExtended)))
            {
                if ((part.CategoryFlags & (uint)category) == (uint)category)
                {
                    msg += category + ",";
                }
            }

            msg += Common.NewLine + "  BotPart: " + OutfitUtils.IsBotPart(part);

            return msg.ToString();
        }
Exemplo n.º 35
0
        public string ToXMLString()
        {
            Common.StringBuilder temperature = new Common.StringBuilder();

            Dictionary <Weather, Common.StringBuilder> weather = new Dictionary <Sims3.SimIFace.Enums.Weather, Common.StringBuilder>();

            foreach (Weather w in Enum.GetValues(typeof(Weather)))
            {
                switch (w)
                {
                case Sims3.SimIFace.Enums.Weather.BewitchingRain:
                case Sims3.SimIFace.Enums.Weather.None:
                case Sims3.SimIFace.Enums.Weather.RevivingSprinkle:
                    continue;
                }

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

                builder += Common.NewLine + "  <" + w + "Tuning>";
                builder += Common.NewLine + "    <!-- This is the default set, do not alter or remove -->";
                builder += Common.NewLine + "    <Season></Season>";
                builder += Common.NewLine + "    <Name></Name>";
                builder += Common.NewLine + "    <Weight>0</Weight>";
                builder += Common.NewLine + "    <MinLength>0</MinLength>";
                builder += Common.NewLine + "    <MaxLength>24</MaxLength>";
                builder += Common.NewLine + "    <MinTemp>-1000</MinTemp>";
                builder += Common.NewLine + "    <MaxTemp>1000</MaxTemp>";

                switch (w)
                {
                case Sims3.SimIFace.Enums.Weather.Rain:
                case Sims3.SimIFace.Enums.Weather.Snow:
                    builder += Common.NewLine + "    <LightWeight>1</LightWeight>";
                    builder += Common.NewLine + "    <ModerateWeight>1</ModerateWeight>";
                    builder += Common.NewLine + "    <HeavyWeight>1</HeavyWeight>";
                    builder += Common.NewLine + "    <MinTransitionTime>0.25</MinTransitionTime>";
                    builder += Common.NewLine + "    <MaxTransitionTime>1</MaxTransitionTime>";
                    builder += Common.NewLine + "    <NumIntensityChangeWeights>1,1,1,1,1,1</NumIntensityChangeWeights>";
                    builder += Common.NewLine + "    <MinIntensityDuration>1</MinIntensityDuration>";
                    break;
                }

                builder += Common.NewLine + "  </" + w + "Tuning>";

                weather.Add(w, builder);
            }

            temperature += Common.NewLine + "  <Temperature>";
            temperature += Common.NewLine + "    <!-- This is the default set, do not alter or remove -->";
            temperature += Common.NewLine + "    <Season></Season>";
            temperature += Common.NewLine + "    <Name></Name>";
            temperature += Common.NewLine + "    <StartDay>1</StartDay>";
            temperature += Common.NewLine + "    <EndDay>-1</EndDay>";
            temperature += Common.NewLine + "    <Enabled>True</Enabled>";
            temperature += Common.NewLine + "    <MorningMin>0</MorningMin>";
            temperature += Common.NewLine + "    <MorningMax>0</MorningMax>";
            temperature += Common.NewLine + "    <NoonMin>0</NoonMin>";
            temperature += Common.NewLine + "    <NoonMax>0</NoonMax>";
            temperature += Common.NewLine + "    <EveningMin>0</EveningMin>";
            temperature += Common.NewLine + "    <EveningMax>0</EveningMax>";
            temperature += Common.NewLine + "    <NightMin>0</NightMin>";
            temperature += Common.NewLine + "    <NightMax>0</NightMax>";
            temperature += Common.NewLine + "  </Temperature>";

            foreach (KeyValuePair <Season, WeatherSettings> setting in mWeatherSettings)
            {
                foreach (WeatherProfile profile in setting.Value.Profiles)
                {
                    temperature += profile.ToXMLTemperatureString(setting.Key);

                    foreach (KeyValuePair <Weather, Common.StringBuilder> w in weather)
                    {
                        w.Value.Append(profile.ToXMLWeatherString(setting.Key, w.Key));
                    }
                }
            }

            Common.StringBuilder result = new Common.StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
            result += Common.NewLine + "<Seasons>";

            result += temperature;

            foreach (Common.StringBuilder w in weather.Values)
            {
                result += w;
            }

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

            return(result.ToString());
        }
Exemplo n.º 36
0
        public static bool DoRoute(RoutingComponent ths, Route r)
        {
            Sim owner = ths.Owner as Sim;

            if ((!r.ExecutionFromNonSimTaskIsSafe && (owner != null)) && (Simulator.CurrentTask != ths.Owner.ObjectId))
            {
                Simulator.CurrentTask.ObjectFromId <GameObject>();
                return(false);
            }

            IBoat boat = ths.Owner as IBoat;

            if (ths.RoutingParent != null)
            {
                if (!(ths.RoutingParent is IBoat) || (r.GetOption2(Route.RouteOption2.EndAsBoat) && (!r.PlanResult.Succeeded() || !RoutingComponent.PlannedRouteHasNonBoatSubpath(r))))
                {
                    // Custom
                    if (ths.RoutingParent.RoutingComponent is CarRoutingComponent)
                    {
                        return(CarRoutingComponentEx.DoRoute(ths.RoutingParent.RoutingComponent as CarRoutingComponent, r));
                    }
                    else
                    {
                        return(ths.RoutingParent.RoutingComponent.DoRoute(r));
                    }
                }
            }
            else if (((boat != null) && r.PlanResult.Succeeded()) && (!r.GetOption2(Route.RouteOption2.EndAsBoat) || RoutingComponent.PlannedRouteHasNonBoatSubpath(r)))
            {
                Sim driver = boat.GetDriver();
                if (driver != null)
                {
                    return(driver.RoutingComponent.DoRoute(r));
                }
            }

            Common.StringBuilder msg = new Common.StringBuilder("RoutingComponentEx:DoRoute" + Common.NewLine);
            if (owner != null)
            {
                msg += Common.NewLine + owner.FullName + Common.NewLine;
            }

            ths.mRouteActions.Clear();
            bool routeSuccess = true;

            try
            {
                RouteAction.FailureExplanation explanation = RouteAction.FailureExplanation.None;
                RoutingComponent.mnNumDoRouteCalls += (ulong)0x1L;
                if (r.PlanResult.Succeeded())
                {
                    ths.OnAboutToStartFollowingRoute(r);
                    if (r.PlanResult.Succeeded())
                    {
                        ths.PushActionsForRoute(r, r);
                        if (owner != null)
                        {
                            owner.PushBackpackPostureIfNecessary();
                            owner.PushCanePostureIfNecessary();
                            owner.PushJetpackPostureIfNecessary();
                        }
                    }
                    else
                    {
                        routeSuccess = false;
                    }
                }
                else
                {
                    routeSuccess = false;
                }

                msg.Append("A");

                if (!routeSuccess)
                {
                    explanation |= RouteAction.FailureExplanation.InitialPlanFailure;
                    LogFailure(ths.Owner, RouteAction.FailureExplanation.InitialPlanFailure, r.PlanResult, "Initial Path Plan Failure (WILL NOT play route fail)");
                    r.SetRouteActionResult(0x2);
                    return(false);
                }

                msg.Append("B");

                int failures = 0;

                if ((ths.RoutingParent != null) && (ths.RoutingParent is IBoat))
                {
                    ths.UpdateDynamicFootprint(ths.RoutingParent as GameObject, false);
                }
                else
                {
                    ths.UpdateDynamicFootprint(ths.Owner, false);
                }

                Vector3 originalPosition = ths.Owner.Position;
                int     loops            = 0;

                bool  success       = true;
                Route processedPath = r;
                bool  isOutside     = ths.Owner.IsOutside;
                ths.mNumWaterEntriesThisRoute = 0;
                while (ths.mRouteActions.Count != 0x0)
                {
                    // Custom
                    if (ths.Owner.Position == originalPosition)
                    {
                        loops++;
                    }

                    if ((loops > 30) || (ths.mRouteActions.Count > 30))
                    {
                        success = false;
                        ths.mRouteActions.Clear();
                        break;
                    }

                    if (ths.mRouteActions[0] is GetInBoatRouteAction)
                    {
                        ths.mNumWaterEntriesThisRoute++;
                        if (ths.mNumWaterEntriesThisRoute > 10)
                        {
                            if (owner != null)
                            {
                                owner.SetToResetAndSendHome();
                            }
                            else
                            {
                                ths.Owner.SetObjectToReset();
                            }
                            return(false);
                        }
                    }

                    if ((owner != null) && owner.IsOutside)
                    {
                        owner.PushHoverboardPostureIfNecessary();
                    }

                    // Custom
                    RouteAction routeAction = ths.mRouteActions[0x0];

                    msg.Append(Common.NewLine + routeAction.GetType());

                    RouteAction.ActionResult actionResult = RouteAction.ActionResult.Continue;

                    //using (BuffsChangedProxy buffsProxy = new BuffsChangedProxy(owner))
                    {
                        try
                        {
                            if (routeAction is ObstacleEncounteredRouteInterruptAction)
                            {
                                actionResult = ObstacleEncounteredRouteInterruptActionEx.PerformAction(routeAction as ObstacleEncounteredRouteInterruptAction);
                            }
                            else
                            {
                                actionResult = routeAction.PerformAction();
                            }
                        }
                        catch (ResetException)
                        {
                            throw;
                        }
                        catch (SacsErrorException e)
                        {
                            Common.DebugException(owner, null, msg, e);

                            failures++;

                            if (failures > 10)
                            {
                                actionResult = RouteAction.ActionResult.Terminate;
                            }
                            else
                            {
                                actionResult = RouteAction.ActionResult.ContinueAndPopPathAndReplan;
                            }

                            routeAction.OnReset();
                        }
                        catch (Exception e)
                        {
                            Common.Exception(owner, null, msg.ToString(), e);

                            string stackTrace = e.StackTrace.ToString();

                            if (stackTrace.Contains("OccultManager:DisallowClothesChange"))
                            {
                                OccultTypeHelper.ValidateOccult(owner.SimDescription, null);

                                actionResult = RouteAction.ActionResult.Terminate;
                            }
                            else if (stackTrace.Contains("CommonDoor:IsAllowedThrough"))
                            {
                                Corrections.CleanupCommonDoors(null);
                                actionResult = RouteAction.ActionResult.Terminate;
                            }
                            else if (stackTrace.Contains("SimRoutingComponent:RequestWalkStyle"))
                            {
                                actionResult = RouteAction.ActionResult.Terminate;
                            }
                            else
                            {
                                failures++;

                                if (failures > 10)
                                {
                                    actionResult = RouteAction.ActionResult.Terminate;
                                }
                                else
                                {
                                    actionResult = RouteAction.ActionResult.ContinueAndPopPathAndReplan;
                                }
                            }

                            routeAction.OnReset();
                        }
                    }

                    msg.Append(Common.NewLine + "C");

                    // Custom
                    if ((ths.mRouteActions.Count > 0) && (ths.mRouteActions[0x0].ForciblyReplanned) && (actionResult == RouteAction.ActionResult.ContinueAndPopPath))
                    {
                        actionResult = RouteAction.ActionResult.ContinueAndFollowPath;
                    }

                    msg.Append(Common.NewLine + actionResult + Common.NewLine);

                    if (GoHere.Settings.mDetailedRouting)
                    {
                        if (Sim.ActiveActor == owner)
                        {
                            Common.DebugNotify(msg);
                        }
                    }

                    if (ths.mRouteActions.Count == 0x0)
                    {
                        explanation |= RouteAction.FailureExplanation.InternalPlanFailure;
                        success      = false;
                        break;
                    }

                    msg.Append("D");

                    ths.mPreviousRouteAction = ths.mRouteActions[0x0];
                    switch (actionResult)
                    {
                    case RouteAction.ActionResult.Continue:
                    case RouteAction.ActionResult.ContinueAndPopPath:
                    case RouteAction.ActionResult.ContinueAndPopPathAndReplan:
                    case RouteAction.ActionResult.ContinueAndPopPathAndRestart:
                    case RouteAction.ActionResult.ContinueAndFollowPath:
                        msg.Append("E");

                        ths.mRouteActions.RemoveAt(0x0);
                        bool flag3 = (processedPath.GetNumPaths() > 0x1) || (processedPath.IsLoop());
                        if (((actionResult == RouteAction.ActionResult.ContinueAndPopPath) && flag3) || ((actionResult == RouteAction.ActionResult.ContinueAndPopPathAndRestart) || (actionResult == RouteAction.ActionResult.ContinueAndPopPathAndReplan)))
                        {
                            if (flag3)
                            {
                                processedPath.PopPath();
                            }

                            msg.Append("F");

                            if (actionResult == RouteAction.ActionResult.ContinueAndPopPathAndReplan)
                            {
                                Vector3 outPosition = new Vector3();
                                if ((ths.RoutingParent != null) && (ths.RoutingParent is IBoat))
                                {
                                    outPosition = ths.RoutingParent.PositionOnFloor;
                                }
                                else if (ths.Owner != null)
                                {
                                    if ((owner != null) && (owner.Posture is SwimmingInPool))
                                    {
                                        outPosition = ths.Owner.Position;
                                    }
                                    else
                                    {
                                        outPosition = ths.Owner.PositionOnFloor;
                                    }
                                }
                                else
                                {
                                    processedPath.GetPathStartPoint(0x0, ref outPosition);
                                }
                                processedPath.ReplanFromPoint(outPosition);
                            }

                            msg.Append("G");

                            if (actionResult == RouteAction.ActionResult.ContinueAndPopPathAndRestart)
                            {
                                Vector3 positionOnFloor = new Vector3();
                                if (ths.Owner != null)
                                {
                                    positionOnFloor = ths.Owner.PositionOnFloor;
                                }
                                else
                                {
                                    processedPath.GetPathStartPoint(0x0, ref positionOnFloor);
                                }
                                processedPath.SetOption(Route.RouteOption.EnablePlanningAsCar, false);
                                processedPath.SetOption(Route.RouteOption.EnableSubwayPlanning, false);
                                processedPath.SetOption2(Route.RouteOption2.EnableHoverTrainPlanning, false);
                                processedPath.ReplanFromPoint(positionOnFloor);
                                explanation |= RouteAction.FailureExplanation.CancelledByScript;
                                success      = false;
                                ths.mRouteActions.Clear();
                            }
                            else if (processedPath.PlanResult.Succeeded())
                            {
                                ths.PushActionsForRoute(r, processedPath);
                            }
                            else
                            {
                                explanation |= RouteAction.FailureExplanation.ReplanFailure;
                                success      = false;
                                ths.mRouteActions.Clear();
                            }
                        }
                        else if ((actionResult == RouteAction.ActionResult.ContinueAndFollowPath) && (r.GetNumPaths() > 0x0))
                        {
                            msg.Append("H");

                            if (r.PlanResult.Succeeded())
                            {
                                ths.PushActionsForRoute(r, processedPath);
                            }
                            else
                            {
                                explanation |= RouteAction.FailureExplanation.InternalPlanFailure;
                                success      = false;
                                ths.mRouteActions.Clear();
                            }
                        }
                        break;

                    default:
                        msg.Append("I");

                        explanation |= ths.mPreviousRouteAction.FailureExplanations;
                        success      = false;
                        ths.mRouteActions.Clear();
                        break;
                    }
                }

                msg.Append("J");

                ths.mRouteActions.Clear();
                r.SetRouteActionResult((uint)explanation);
                if (!success)
                {
                    if (ths.mPreviousRouteAction == null)
                    {
                        LogFailure(ths.Owner, explanation, r.PlanResult, "(Null mPreviousRouteAction failure)");
                    }
                    else
                    {
                        LogFailure(ths.Owner, explanation, r.PlanResult, "(failure in " + ths.mPreviousRouteAction.ToString() + ")");
                    }
                }

                msg.Append("K");

                if ((ths.RoutingParent != null) && (ths.RoutingParent is IBoat))
                {
                    ths.UpdateDynamicFootprint(ths.RoutingParent as GameObject, true);
                }
                else
                {
                    ths.UpdateDynamicFootprint(ths.Owner, true);
                }

                routeSuccess             = (success && (processedPath == r)) && r.PlanResult.Succeeded();
                ths.mPreviousRouteAction = null;
                if (ths.OnRouteActionsFinished != null)
                {
                    ths.OnRouteActionsFinished(ths.Owner, routeSuccess);
                }

                if (((SeasonsManager.Enabled && routeSuccess) && (isOutside && (owner != null))) && ((owner.IsHuman && owner.SimDescription.ChildOrAbove) && (!owner.IsOutside && (owner.CurrentOutfitCategory == OutfitCategories.Outerwear))))
                {
                    owner.SwitchToOutfitWithSpin(Sim.ClothesChangeReason.RemovingOuterwear);
                }

                if (owner != null)
                {
                    SwimmingInPool posture = owner.Posture as SwimmingInPool;
                    if ((posture != null) && posture.UsedShortEntryAnimation)
                    {
                        posture.UsedShortEntryAnimation = false;
                        if (owner.SimDescription.IsMatureMermaid)
                        {
                            OccultMermaid.PutOnTailWithSpin(owner.SimDescription);
                        }
                    }
                }
            }
            catch (ResetException)
            {
                routeSuccess = false;
                if (ths.mRouteActions.Count > 0x0)
                {
                    RouteAction action = ths.mRouteActions[0x0];
                    if (action != null)
                    {
                        action.OnReset();
                    }
                }
                ths.mRouteActions.Clear();
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(owner, null, msg.ToString(), e);
                routeSuccess = false;

                if (ths.mRouteActions.Count > 0x0)
                {
                    RouteAction action = ths.mRouteActions[0x0];
                    if (action != null)
                    {
                        action.OnReset();
                    }
                }
                ths.mRouteActions.Clear();
            }
            finally
            {
                ths.mRouteActions.Clear();
                if (owner != null)
                {
                    owner.RestoreUsedHoverboard();
                }

                if ((owner != null) && (owner.FirstName == "Roberto"))
                {
                    Common.DebugStackLog(msg);
                }
            }

            return(routeSuccess);
        }
Exemplo n.º 37
0
        public string ToXMLString()
        {
            Common.StringBuilder temperature = new Common.StringBuilder();

            Dictionary<Weather, Common.StringBuilder> weather = new Dictionary<Sims3.SimIFace.Enums.Weather, Common.StringBuilder>();

            foreach(Weather w in Enum.GetValues(typeof(Weather)))
            {
                switch (w)
                {
                    case Sims3.SimIFace.Enums.Weather.BewitchingRain:
                    case Sims3.SimIFace.Enums.Weather.None:
                    case Sims3.SimIFace.Enums.Weather.RevivingSprinkle:
                        continue;
                }

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

                builder += Common.NewLine + "  <" + w + "Tuning>";
                builder += Common.NewLine + "    <!-- This is the default set, do not alter or remove -->";
                builder += Common.NewLine + "    <Season></Season>";
                builder += Common.NewLine + "    <Name></Name>";
                builder += Common.NewLine + "    <Weight>0</Weight>";
                builder += Common.NewLine + "    <MinLength>0</MinLength>";
                builder += Common.NewLine + "    <MaxLength>24</MaxLength>";
                builder += Common.NewLine + "    <MinTemp>-1000</MinTemp>";
                builder += Common.NewLine + "    <MaxTemp>1000</MaxTemp>";

                switch (w)
                {
                    case Sims3.SimIFace.Enums.Weather.Rain:
                    case Sims3.SimIFace.Enums.Weather.Snow:
                        builder += Common.NewLine + "    <LightWeight>1</LightWeight>";
                        builder += Common.NewLine + "    <ModerateWeight>1</ModerateWeight>";
                        builder += Common.NewLine + "    <HeavyWeight>1</HeavyWeight>";
                        builder += Common.NewLine + "    <MinTransitionTime>0.25</MinTransitionTime>";
                        builder += Common.NewLine + "    <MaxTransitionTime>1</MaxTransitionTime>";
                        builder += Common.NewLine + "    <NumIntensityChangeWeights>1,1,1,1,1,1</NumIntensityChangeWeights>";
                        builder += Common.NewLine + "    <MinIntensityDuration>1</MinIntensityDuration>";
                        break;
                }

                builder += Common.NewLine + "  </" + w + "Tuning>";

                weather.Add(w, builder);
            }

            temperature += Common.NewLine + "  <Temperature>";
            temperature += Common.NewLine + "    <!-- This is the default set, do not alter or remove -->";
            temperature += Common.NewLine + "    <Season></Season>";
            temperature += Common.NewLine + "    <Name></Name>";
            temperature += Common.NewLine + "    <StartDay>1</StartDay>";
            temperature += Common.NewLine + "    <EndDay>-1</EndDay>";
            temperature += Common.NewLine + "    <Enabled>True</Enabled>";
            temperature += Common.NewLine + "    <MorningMin>0</MorningMin>";
            temperature += Common.NewLine + "    <MorningMax>0</MorningMax>";
            temperature += Common.NewLine + "    <NoonMin>0</NoonMin>";
            temperature += Common.NewLine + "    <NoonMax>0</NoonMax>";
            temperature += Common.NewLine + "    <EveningMin>0</EveningMin>";
            temperature += Common.NewLine + "    <EveningMax>0</EveningMax>";
            temperature += Common.NewLine + "    <NightMin>0</NightMin>";
            temperature += Common.NewLine + "    <NightMax>0</NightMax>";
            temperature += Common.NewLine + "  </Temperature>";

            foreach (KeyValuePair<Season, WeatherSettings> setting in mWeatherSettings)
            {
                foreach (WeatherProfile profile in setting.Value.Profiles)
                {
                    temperature += profile.ToXMLTemperatureString(setting.Key);

                    foreach (KeyValuePair<Weather, Common.StringBuilder> w in weather)
                    {
                        w.Value.Append(profile.ToXMLWeatherString(setting.Key, w.Key));
                    }
                }
            }

            Common.StringBuilder result = new Common.StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
            result += Common.NewLine + "<Seasons>";

            result += temperature;

            foreach (Common.StringBuilder w in weather.Values)
            {
                result += w;
            }

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

            return result.ToString();
        }
Exemplo n.º 38
0
        public string ToXMLString(Season season, Weather weather, string name)
        {
            Common.StringBuilder result = new Common.StringBuilder();

            result += Common.NewLine + "  <" + weather + "Tuning>";
            result += Common.NewLine + "    <Season>" + season + "</Season>";
            result += Common.NewLine + "    <Name>" + name + "</Name>";
            result += ToXMLString();
            result += Common.NewLine + "  </" + weather + "Tuning>";

            return result.ToString();
        }
Exemplo n.º 39
0
        public string GetDetails(IMiniSimDescription me)
        {
            Common.StringBuilder msg = new Common.StringBuilder();

            try
            {
                msg += GetHeader(me);

                SimDescription simDesc = me as SimDescription;
                MiniSimDescription miniDesc = me as MiniSimDescription;

                if (simDesc != null)
                {
                    if (!simDesc.AgingEnabled)
                    {
                        msg += Common.Localize("Status:AgingDisabled", me.IsFemale);
                    }

                    msg += Common.NewLine + Common.LocalizeEAString("Ui/Caption/HUD/KnownInfoDialog:" + simDesc.Zodiac.ToString());
                }
                else if (miniDesc != null)
                {
                    if (!miniDesc.mbAgingEnabled)
                    {
                        msg += Common.Localize("Status:AgingDisabled", me.IsFemale);
                    }
                }

                SimDescription.DeathType deathType = SimDescription.DeathType.None;
                if (simDesc != null)
                {
                    deathType = simDesc.DeathStyle;
                }
                else if (miniDesc != null)
                {
                    deathType = miniDesc.mDeathStyle;
                }

                if (deathType != SimDescription.DeathType.None)
                {
                    msg += Common.Localize("Status:Death", me.IsFemale) + Urnstones.GetLocalizedString(me.IsFemale, deathType);
                }

                List<OccultTypes> occultTypes = new List<OccultTypes>();

                OccultTypes primaryOccult = OccultTypes.None;

                if (simDesc != null)
                {
                    if (simDesc.OccultManager != null)
                    {
                        foreach (OccultTypes type in Enum.GetValues(typeof(OccultTypes)))
                        {
                            if (type == OccultTypes.None) continue;

                            if (simDesc.OccultManager.HasOccultType(type))
                            {
                                occultTypes.Add(type);
                            }
                        }
                    }

                    if (simDesc.SupernaturalData != null)
                    {
                        primaryOccult = simDesc.SupernaturalData.OccultType;
                    }
                }
                else if (miniDesc != null)
                {
                    if (miniDesc.IsVampire)
                    {
                        occultTypes.Add(OccultTypes.Vampire);
                    }
                    if (miniDesc.IsFrankenstein)
                    {
                        occultTypes.Add(OccultTypes.Frankenstein);
                    }
                    if (miniDesc.IsMummy)
                    {
                        occultTypes.Add(OccultTypes.Mummy);
                    }
                    if (miniDesc.IsUnicorn)
                    {
                        occultTypes.Add(OccultTypes.Unicorn);
                    }
                    if (miniDesc.IsGenie)
                    {
                        occultTypes.Add(OccultTypes.Unicorn);
                    }
                    if (miniDesc.IsWerewolf)
                    {
                        occultTypes.Add(OccultTypes.Werewolf);
                    }
                    if (miniDesc.IsWitch)
                    {
                        occultTypes.Add(OccultTypes.Witch);
                    }
                    if (miniDesc.IsFairy)
                    {
                        occultTypes.Add(OccultTypes.Fairy);
                    }
                }

                foreach (OccultTypes type in occultTypes)
                {
                    string isPrimary = null;
                    if (primaryOccult == type)
                    {
                        isPrimary = " (+)";
                    }

                    msg += Common.Localize("Status:Occult", me.IsFemale, new object[] { OccultTypeHelper.GetLocalizedName(type) + isPrimary });
                }

                if (simDesc != null)
                {
                    if (simDesc.LotHome != null)
                    {
                        msg += Common.Localize("Status:TypeResidentV2", me.IsFemale);
                    }
                    else if (simDesc.Household == null)
                    {
                        msg += Common.Localize("Status:TypeOutOfTowner", me.IsFemale);
                    }
                    else if (simDesc.AssignedRole != null)
                    {
                        msg += Common.Localize("Status:TypeService", me.IsFemale, new object[] { Roles.GetLocalizedName(simDesc.AssignedRole) });
                    }
                    else if (simDesc.Household.IsServiceNpcHousehold)
                    {
                        if (SimTypes.InServicePool(simDesc))
                        {
                            msg += Common.Localize("Status:TypeService", me.IsFemale, new object[] { Common.LocalizeEAString("Ui/Caption/Services/Service:" + simDesc.CreatedByService.ServiceType.ToString()) });
                        }
                        else
                        {
                            msg += Common.Localize("Status:TypeOutOfTowner", me.IsFemale);
                        }
                    }
                    else if (simDesc.Household.IsTouristHousehold)
                    {
                        msg += Common.Localize("Status:TypeTourist", me.IsFemale);
                    }
                    else if (simDesc.Household.IsTravelHousehold)
                    {
                        msg += Common.Localize("Status:TypeTravel", me.IsFemale);
                    }
                    else
                    {
                        msg += Common.Localize("Status:TypeHomeless", me.IsFemale);
                    }
                }
                else if (miniDesc != null)
                {
                    msg += Common.Localize("Status:TypeOutOfTowner", me.IsFemale);
                }

                string worldName = me.HomeWorld.ToString();
                if (!Enum.IsDefined(typeof(WorldName), me.HomeWorld))
                {
                    worldName = ((ulong)me.HomeWorld).ToString();
                }

                string homeWorld = Common.LocalizeEAString("Ui/Caption/Global/WorldName/EP01:" + worldName);// Sims3.UI.Responder.Instance.HudModel.LocationName(me.HomeWorld);
                if ((!string.IsNullOrEmpty(homeWorld)) && (homeWorld != "Ui/Caption/Global/WorldName/EP01:" + worldName))
                {
                    msg += Common.Localize("Status:HomeWorld", me.IsFemale, new object[] { homeWorld });
                }

                if (simDesc != null)
                {
                    msg += Common.Localize("Status:Favorites", me.IsFemale, new object[] { CASCharacter.GetFavoriteColor(simDesc.FavoriteColor), CASCharacter.GetFavoriteFood(simDesc.FavoriteFood), CASCharacter.GetFavoriteMusic(simDesc.FavoriteMusic) });

                    string LTWName = LifetimeWants.GetName(simDesc);
                    if (!string.IsNullOrEmpty(LTWName))
                    {
                        msg += Common.Localize("Status:LTW", me.IsFemale, new object[] { LTWName, Common.Localize("YesNo:" + simDesc.HasCompletedLifetimeWish.ToString()) });
                    }
                    else
                    {
                        msg += Common.Localize("Status:NoLTW", me.IsFemale);
                    }

                    msg += Common.Localize("Status:LifetimeReward", me.IsFemale, new object[] { simDesc.LifetimeHappiness, simDesc.SpendableHappiness });

                    if (simDesc.CreatedSim != null)
                    {
                        if (simDesc.LotHome == simDesc.CreatedSim.LotCurrent)
                        {
                            msg += Common.Localize("Status:LocationHome", me.IsFemale);
                        }
                        else if ((simDesc.CreatedSim.LotCurrent != null) && (!simDesc.CreatedSim.LotCurrent.IsWorldLot))
                        {
                            msg += Common.Localize("Status:LocationAt", me.IsFemale, new object[] { simDesc.CreatedSim.LotCurrent.Name });
                        }
                        else
                        {
                            msg += Common.Localize("Status:LocationTransit", me.IsFemale);
                        }

                        msg += Common.Localize("Status:Mood" + simDesc.CreatedSim.MoodManager.MoodFlavor.ToString(), me.IsFemale);

                        if (simDesc.CreatedSim.Autonomy != null)
                        {
                            if (simDesc.CreatedSim.Autonomy.AllowedToRunMetaAutonomy)
                            {
                                msg += Common.Localize("Status:Autonomous", me.IsFemale);
                            }

                            foreach(Situation situation in simDesc.CreatedSim.Autonomy.SituationComponent.Situations)
                            {
                                msg += Common.Localize("Status:Situation", me.IsFemale, new object[] { situation.ToString() });
                            }
                        }
                    }
                    else
                    {
                        msg += Common.Localize("Status:LocationOutOfTown", me.IsFemale);
                    }
                }

                string traits = null;
                int traitCount = 0;

                if (simDesc != null)
                {
                    if (simDesc.TraitManager != null)
                    {
                        foreach (Trait trait in simDesc.TraitManager.List)
                        {
                            if (trait.IsReward) continue;

                            traits += Common.NewLine + trait.TraitName(me.IsFemale);
                            traitCount++;
                        }
                    }
                }
                else if (miniDesc != null)
                {
                    if (miniDesc.Traits != null)
                    {
                        foreach (TraitNames traitName in miniDesc.Traits)
                        {
                            Trait trait = TraitManager.GetTraitFromDictionary(traitName);
                            if (trait == null) continue;

                            if (trait.IsReward) continue;

                            traits += Common.NewLine + trait.TraitName(me.IsFemale);
                            traitCount++;
                        }
                    }
                }

                if (traitCount > 10)
                {
                    msg += Common.Localize("Status:TraitsOverTen", me.IsFemale, new object[] { traitCount });
                }
                else if (traitCount > 0)
                {
                    msg += Common.Localize("Status:Traits", me.IsFemale, new object[] { traits });
                }
            }
            catch (Exception e)
            {
                Common.Exception(me.FullName, e);

                msg += Common.NewLine + "END OF LINE";
            }

            return msg.ToString();
        }
Exemplo n.º 40
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();
            }
Exemplo n.º 41
0
        public string GetDetails(IMiniSimDescription me)
        {
            Common.StringBuilder msg = new Common.StringBuilder();

            try
            {
                msg += GetHeader(me);

                SimDescription     simDesc  = me as SimDescription;
                MiniSimDescription miniDesc = me as MiniSimDescription;

                if (simDesc != null)
                {
                    if (!simDesc.AgingEnabled)
                    {
                        msg += Common.Localize("Status:AgingDisabled", me.IsFemale);
                    }

                    msg += Common.NewLine + Common.LocalizeEAString("Ui/Caption/HUD/KnownInfoDialog:" + simDesc.Zodiac.ToString());
                }
                else if (miniDesc != null)
                {
                    if (!miniDesc.mbAgingEnabled)
                    {
                        msg += Common.Localize("Status:AgingDisabled", me.IsFemale);
                    }
                }

                SimDescription.DeathType deathType = SimDescription.DeathType.None;
                if (simDesc != null)
                {
                    deathType = simDesc.DeathStyle;
                }
                else if (miniDesc != null)
                {
                    deathType = miniDesc.mDeathStyle;
                }

                if (deathType != SimDescription.DeathType.None)
                {
                    msg += Common.Localize("Status:Death", me.IsFemale) + Urnstones.GetLocalizedString(me.IsFemale, deathType);
                }

                List <OccultTypes> occultTypes = new List <OccultTypes>();

                OccultTypes primaryOccult = OccultTypes.None;

                if (simDesc != null)
                {
                    if (simDesc.OccultManager != null)
                    {
                        foreach (OccultTypes type in Enum.GetValues(typeof(OccultTypes)))
                        {
                            if (type == OccultTypes.None)
                            {
                                continue;
                            }

                            if (simDesc.OccultManager.HasOccultType(type))
                            {
                                occultTypes.Add(type);
                            }
                        }
                    }

                    if (simDesc.SupernaturalData != null)
                    {
                        primaryOccult = simDesc.SupernaturalData.OccultType;
                    }
                }
                else if (miniDesc != null)
                {
                    if (miniDesc.IsVampire)
                    {
                        occultTypes.Add(OccultTypes.Vampire);
                    }
                    if (miniDesc.IsFrankenstein)
                    {
                        occultTypes.Add(OccultTypes.Frankenstein);
                    }
                    if (miniDesc.IsMummy)
                    {
                        occultTypes.Add(OccultTypes.Mummy);
                    }
                    if (miniDesc.IsUnicorn)
                    {
                        occultTypes.Add(OccultTypes.Unicorn);
                    }
                    if (miniDesc.IsGenie)
                    {
                        occultTypes.Add(OccultTypes.Unicorn);
                    }
                    if (miniDesc.IsWerewolf)
                    {
                        occultTypes.Add(OccultTypes.Werewolf);
                    }
                    if (miniDesc.IsWitch)
                    {
                        occultTypes.Add(OccultTypes.Witch);
                    }
                    if (miniDesc.IsFairy)
                    {
                        occultTypes.Add(OccultTypes.Fairy);
                    }
                }

                foreach (OccultTypes type in occultTypes)
                {
                    string isPrimary = null;
                    if (primaryOccult == type)
                    {
                        isPrimary = " (+)";
                    }

                    msg += Common.Localize("Status:Occult", me.IsFemale, new object[] { OccultTypeHelper.GetLocalizedName(type) + isPrimary });
                }

                if (simDesc != null)
                {
                    if (simDesc.LotHome != null)
                    {
                        msg += Common.Localize("Status:TypeResidentV2", me.IsFemale);
                    }
                    else if (simDesc.Household == null)
                    {
                        msg += Common.Localize("Status:TypeOutOfTowner", me.IsFemale);
                    }
                    else if (simDesc.AssignedRole != null)
                    {
                        msg += Common.Localize("Status:TypeService", me.IsFemale, new object[] { Roles.GetLocalizedName(simDesc.AssignedRole) });
                    }
                    else if (simDesc.Household.IsServiceNpcHousehold)
                    {
                        if (SimTypes.InServicePool(simDesc))
                        {
                            msg += Common.Localize("Status:TypeService", me.IsFemale, new object[] { Common.LocalizeEAString("Ui/Caption/Services/Service:" + simDesc.CreatedByService.ServiceType.ToString()) });
                        }
                        else
                        {
                            msg += Common.Localize("Status:TypeOutOfTowner", me.IsFemale);
                        }
                    }
                    else if (simDesc.Household.IsTouristHousehold)
                    {
                        msg += Common.Localize("Status:TypeTourist", me.IsFemale);
                    }
                    else if (simDesc.Household.IsTravelHousehold)
                    {
                        msg += Common.Localize("Status:TypeTravel", me.IsFemale);
                    }
                    else
                    {
                        msg += Common.Localize("Status:TypeHomeless", me.IsFemale);
                    }
                }
                else if (miniDesc != null)
                {
                    msg += Common.Localize("Status:TypeOutOfTowner", me.IsFemale);
                }

                string worldName = me.HomeWorld.ToString();
                if (!Enum.IsDefined(typeof(WorldName), me.HomeWorld))
                {
                    worldName = ((ulong)me.HomeWorld).ToString();
                }

                string homeWorld = Common.LocalizeEAString("Ui/Caption/Global/WorldName/EP01:" + worldName);// Sims3.UI.Responder.Instance.HudModel.LocationName(me.HomeWorld);
                if ((!string.IsNullOrEmpty(homeWorld)) && (homeWorld != "Ui/Caption/Global/WorldName/EP01:" + worldName))
                {
                    msg += Common.Localize("Status:HomeWorld", me.IsFemale, new object[] { homeWorld });
                }

                if (simDesc != null)
                {
                    msg += Common.Localize("Status:Favorites", me.IsFemale, new object[] { CASCharacter.GetFavoriteColor(simDesc.FavoriteColor), CASCharacter.GetFavoriteFood(simDesc.FavoriteFood), CASCharacter.GetFavoriteMusic(simDesc.FavoriteMusic) });

                    string LTWName = LifetimeWants.GetName(simDesc);
                    if (!string.IsNullOrEmpty(LTWName))
                    {
                        msg += Common.Localize("Status:LTW", me.IsFemale, new object[] { LTWName, Common.Localize("YesNo:" + simDesc.HasCompletedLifetimeWish.ToString()) });
                    }
                    else
                    {
                        msg += Common.Localize("Status:NoLTW", me.IsFemale);
                    }

                    msg += Common.Localize("Status:LifetimeReward", me.IsFemale, new object[] { simDesc.LifetimeHappiness, simDesc.SpendableHappiness });

                    if (simDesc.CreatedSim != null)
                    {
                        if (simDesc.LotHome == simDesc.CreatedSim.LotCurrent)
                        {
                            msg += Common.Localize("Status:LocationHome", me.IsFemale);
                        }
                        else if ((simDesc.CreatedSim.LotCurrent != null) && (!simDesc.CreatedSim.LotCurrent.IsWorldLot))
                        {
                            msg += Common.Localize("Status:LocationAt", me.IsFemale, new object[] { simDesc.CreatedSim.LotCurrent.Name });
                        }
                        else
                        {
                            msg += Common.Localize("Status:LocationTransit", me.IsFemale);
                        }

                        msg += Common.Localize("Status:Mood" + simDesc.CreatedSim.MoodManager.MoodFlavor.ToString(), me.IsFemale);

                        if (simDesc.CreatedSim.Autonomy != null)
                        {
                            if (simDesc.CreatedSim.Autonomy.AllowedToRunMetaAutonomy)
                            {
                                msg += Common.Localize("Status:Autonomous", me.IsFemale);
                            }

                            foreach (Situation situation in simDesc.CreatedSim.Autonomy.SituationComponent.Situations)
                            {
                                msg += Common.Localize("Status:Situation", me.IsFemale, new object[] { situation.ToString() });
                            }
                        }
                    }
                    else
                    {
                        msg += Common.Localize("Status:LocationOutOfTown", me.IsFemale);
                    }
                }

                string traits     = null;
                int    traitCount = 0;

                if (simDesc != null)
                {
                    if (simDesc.TraitManager != null)
                    {
                        foreach (Trait trait in simDesc.TraitManager.List)
                        {
                            if (trait.IsReward)
                            {
                                continue;
                            }

                            traits += Common.NewLine + trait.TraitName(me.IsFemale);
                            traitCount++;
                        }
                    }
                }
                else if (miniDesc != null)
                {
                    if (miniDesc.Traits != null)
                    {
                        foreach (TraitNames traitName in miniDesc.Traits)
                        {
                            Trait trait = TraitManager.GetTraitFromDictionary(traitName);
                            if (trait == null)
                            {
                                continue;
                            }

                            if (trait.IsReward)
                            {
                                continue;
                            }

                            traits += Common.NewLine + trait.TraitName(me.IsFemale);
                            traitCount++;
                        }
                    }
                }

                if (traitCount > 10)
                {
                    msg += Common.Localize("Status:TraitsOverTen", me.IsFemale, new object[] { traitCount });
                }
                else if (traitCount > 0)
                {
                    msg += Common.Localize("Status:Traits", me.IsFemale, new object[] { traits });
                }
            }
            catch (Exception e)
            {
                Common.Exception(me.FullName, e);

                msg += Common.NewLine + "END OF LINE";
            }

            return(msg.ToString());
        }
Exemplo n.º 42
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Common.StringBuilder msg = new Common.StringBuilder("PrivateUpdate");

            try
            {
                bool fullList = !GetValue <CustomNamesOnlyOption <ManagerLot>, bool>();

                foreach (SimDescription baby in mBabies)
                {
                    msg += Common.NewLine + baby.FullName;

                    if (!SimTypes.IsSelectable(baby))
                    {
                        baby.FirstName = Sims.EnsureUniqueName(baby);
                    }

                    List <SimDescription> parents = Relationships.GetParents(baby);

                    parents.Remove(Sim);
                    if ((mDad == null) && (parents.Count > 0))
                    {
                        mDad = parents[0];
                    }

                    msg += Common.NewLine + "A";

                    List <OccultTypes> choices = OccultTypeHelper.CreateList(Sim.OccultManager.CurrentOccultTypes, true);

                    // Grandparent occult inheritance
                    foreach (SimDescription parent in Relationships.GetParents(Sim))
                    {
                        if (parent.OccultManager == null)
                        {
                            continue;
                        }

                        choices.AddRange(OccultTypeHelper.CreateList(parent.OccultManager.CurrentOccultTypes, true));
                    }

                    msg += Common.NewLine + "B";

                    if ((mDad != null) && (mDad.OccultManager != null))
                    {
                        choices.AddRange(OccultTypeHelper.CreateList(mDad.OccultManager.CurrentOccultTypes, true));

                        // Grandparent occult inheritance
                        foreach (SimDescription parent in Relationships.GetParents(mDad))
                        {
                            if (parent.OccultManager == null)
                            {
                                continue;
                            }

                            choices.AddRange(OccultTypeHelper.CreateList(parent.OccultManager.CurrentOccultTypes, true));
                        }
                    }

                    msg += Common.NewLine + "C";

                    Sims.ApplyOccultChance(this, baby, choices, GetValue <ChanceOfOccultBabyOptionV2, int>(), GetValue <MaximumNewbornOccultOption, int>());

                    msg += Common.NewLine + "D";

                    if ((SimTypes.IsServiceAlien(mDad)) || (SimTypes.IsServiceAlien(Sim)))
                    {
                        baby.SetAlienDNAPercentage(1f);
                    }
                    else
                    {
                        baby.SetAlienDNAPercentage(SimDescription.GetAlienDNAPercentage(mDad, Sim, true));
                    }
                }

                msg += Common.NewLine + "E";

                if (OnRenameNewbornsScenario != null)
                {
                    OnRenameNewbornsScenario(this, frame);
                }

                if (!SimTypes.IsSelectable(Sim))
                {
                    ManagerSim.IncrementLifetimeHappiness(Sim, Sims3.Gameplay.Rewards.LifeEventRewards.kLifetimeHappinessRewardForBaby);
                }

                SetElapsedTime <DayOfLastBabyOption>(Sim);

                msg += Common.NewLine + "F";

                if (mDad != null)
                {
                    if (!SimTypes.IsSelectable(mDad))
                    {
                        ManagerSim.IncrementLifetimeHappiness(mDad, Sims3.Gameplay.Rewards.LifeEventRewards.kLifetimeHappinessRewardForBaby);
                    }

                    SetElapsedTime <DayOfLastBabyOption>(mDad);
                }

                msg += Common.NewLine + "G";

                foreach (SimDescription baby in mBabies)
                {
                    Manager.AddAlarm(new NormalBabyAgingScenario(baby));
                }

                msg += Common.NewLine + "H";

                if (OnBirthScenario != null)
                {
                    OnBirthScenario(this, frame);
                }

                msg += Common.NewLine + "I";

                // Do this at the end once everything else has done its thing
                foreach (SimDescription baby in mBabies)
                {
                    msg += Common.NewLine + baby.FullName;

                    HouseholdOptions houseData = GetHouseOptions(baby.Household);
                    if (houseData != null)
                    {
                        int netWorth = houseData.GetValue <NetWorthOption, int>();

                        foreach (SimDescription parent in Relationships.GetParents(baby))
                        {
                            SimData parentData = GetData(parent);
                            if (parentData != null)
                            {
                                foreach (CasteOptions caste in parentData.Castes)
                                {
                                    if (!caste.GetValue <CasteInheritedOption, bool>())
                                    {
                                        continue;
                                    }

                                    if (!caste.Matches(baby, netWorth))
                                    {
                                        continue;
                                    }

                                    SimData babyData = GetData(baby);
                                    if (babyData != null)
                                    {
                                        babyData.AddValue <ManualCasteOption, CasteOptions>(caste);
                                    }
                                }
                            }
                        }
                    }
                }

                msg += Common.NewLine + "J";

                Add(frame, new SuccessScenario(), ScenarioResult.Start);
            }
            catch (Exception e)
            {
                Common.Exception(ToString() + Common.NewLine + msg.ToString(), e);
            }
            return(false);
        }
Exemplo n.º 43
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;
        }
Exemplo n.º 44
0
        public static bool DoRoute(RoutingComponent ths, Route r)
        {
            Sim owner = ths.Owner as Sim;
            if ((!r.ExecutionFromNonSimTaskIsSafe && (owner != null)) && (Simulator.CurrentTask != ths.Owner.ObjectId))
            {
                Simulator.CurrentTask.ObjectFromId<GameObject>();
                return false;
            }

            IBoat boat = ths.Owner as IBoat;
            if (ths.RoutingParent != null)
            {
                if (!(ths.RoutingParent is IBoat) || (r.GetOption2(Route.RouteOption2.EndAsBoat) && (!r.PlanResult.Succeeded() || !RoutingComponent.PlannedRouteHasNonBoatSubpath(r))))
                {
                    // Custom
                    if (ths.RoutingParent.RoutingComponent is CarRoutingComponent)
                    {
                        return CarRoutingComponentEx.DoRoute(ths.RoutingParent.RoutingComponent as CarRoutingComponent, r);
                    }
                    else
                    {
                        return ths.RoutingParent.RoutingComponent.DoRoute(r);
                    }
                }
            }
            else if (((boat != null) && r.PlanResult.Succeeded()) && (!r.GetOption2(Route.RouteOption2.EndAsBoat) || RoutingComponent.PlannedRouteHasNonBoatSubpath(r)))
            {
                Sim driver = boat.GetDriver();
                if (driver != null)
                {
                    return driver.RoutingComponent.DoRoute(r);
                }
            }

            Common.StringBuilder msg = new Common.StringBuilder("RoutingComponentEx:DoRoute" + Common.NewLine);
            if (owner != null)
            {
                msg += Common.NewLine + owner.FullName + Common.NewLine;
            }

            ths.mRouteActions.Clear();
            bool routeSuccess = true;
            try
            {
                RouteAction.FailureExplanation explanation = RouteAction.FailureExplanation.None;
                RoutingComponent.mnNumDoRouteCalls += (ulong)0x1L;
                if (r.PlanResult.Succeeded())
                {
                    ths.OnAboutToStartFollowingRoute(r);
                    if (r.PlanResult.Succeeded())
                    {
                        ths.PushActionsForRoute(r, r);
                        if (owner != null)
                        {
                            owner.PushBackpackPostureIfNecessary();
                            owner.PushCanePostureIfNecessary();
                            owner.PushJetpackPostureIfNecessary();
                        }
                    }
                    else
                    {
                        routeSuccess = false;
                    }
                }
                else
                {
                    routeSuccess = false;
                }

                msg.Append("A");

                if (!routeSuccess)
                {
                    explanation |= RouteAction.FailureExplanation.InitialPlanFailure;
                    LogFailure(ths.Owner, RouteAction.FailureExplanation.InitialPlanFailure, r.PlanResult, "Initial Path Plan Failure (WILL NOT play route fail)");
                    r.SetRouteActionResult(0x2);
                    return false;
                }

                msg.Append("B");

                int failures = 0;

                if ((ths.RoutingParent != null) && (ths.RoutingParent is IBoat))
                {
                    ths.UpdateDynamicFootprint(ths.RoutingParent as GameObject, false);
                }
                else
                {
                    ths.UpdateDynamicFootprint(ths.Owner, false);
                }

                Vector3 originalPosition = ths.Owner.Position;
                int loops = 0;

                bool success = true;
                Route processedPath = r;
                bool isOutside = ths.Owner.IsOutside;
                ths.mNumWaterEntriesThisRoute = 0;
                while (ths.mRouteActions.Count != 0x0)
                {
                    // Custom
                    if (ths.Owner.Position == originalPosition)
                    {
                        loops++;
                    }

                    if ((loops > 30) || (ths.mRouteActions.Count > 30))
                    {
                        success = false;
                        ths.mRouteActions.Clear();
                        break;
                    }

                    if (ths.mRouteActions[0] is GetInBoatRouteAction)
                    {
                        ths.mNumWaterEntriesThisRoute++;
                        if (ths.mNumWaterEntriesThisRoute > 10)
                        {
                            if (owner != null)
                            {
                                owner.SetToResetAndSendHome();
                            }
                            else
                            {
                                ths.Owner.SetObjectToReset();
                            }
                            return false;
                        }
                    }

                    if ((owner != null) && owner.IsOutside)
                    {
                        owner.PushHoverboardPostureIfNecessary();
                    }

                    // Custom
                    RouteAction routeAction = ths.mRouteActions[0x0];

                    msg.Append(Common.NewLine + routeAction.GetType());

                    RouteAction.ActionResult actionResult = RouteAction.ActionResult.Continue;

                    //using (BuffsChangedProxy buffsProxy = new BuffsChangedProxy(owner))
                    {
                        try
                        {
                            if (routeAction is ObstacleEncounteredRouteInterruptAction)
                            {
                                actionResult = ObstacleEncounteredRouteInterruptActionEx.PerformAction(routeAction as ObstacleEncounteredRouteInterruptAction);
                            }
                            else
                            {
                                actionResult = routeAction.PerformAction();
                            }
                        }
                        catch (ResetException)
                        {
                            throw;
                        }
                        catch (SacsErrorException e)
                        {
                            Common.DebugException(owner, null, msg, e);

                            failures++;

                            if (failures > 10)
                            {
                                actionResult = RouteAction.ActionResult.Terminate;
                            }
                            else
                            {
                                actionResult = RouteAction.ActionResult.ContinueAndPopPathAndReplan;
                            }

                            routeAction.OnReset();
                        }
                        catch (Exception e)
                        {
                            Common.Exception(owner, null, msg.ToString(), e);

                            string stackTrace = e.StackTrace.ToString();

                            if (stackTrace.Contains("OccultManager:DisallowClothesChange"))
                            {
                                OccultTypeHelper.ValidateOccult(owner.SimDescription, null);

                                actionResult = RouteAction.ActionResult.Terminate;
                            }
                            else if (stackTrace.Contains("CommonDoor:IsAllowedThrough"))
                            {
                                Corrections.CleanupCommonDoors(null);
                                actionResult = RouteAction.ActionResult.Terminate;
                            }
                            else if (stackTrace.Contains("SimRoutingComponent:RequestWalkStyle"))
                            {
                                actionResult = RouteAction.ActionResult.Terminate;
                            }
                            else
                            {
                                failures++;

                                if (failures > 10)
                                {
                                    actionResult = RouteAction.ActionResult.Terminate;
                                }
                                else
                                {
                                    actionResult = RouteAction.ActionResult.ContinueAndPopPathAndReplan;
                                }
                            }

                            routeAction.OnReset();
                        }
                    }

                    msg.Append(Common.NewLine + "C");

                    // Custom
                    if ((ths.mRouteActions.Count > 0) && (ths.mRouteActions[0x0].ForciblyReplanned) && (actionResult == RouteAction.ActionResult.ContinueAndPopPath))
                    {
                        actionResult = RouteAction.ActionResult.ContinueAndFollowPath;
                    }

                    msg.Append(Common.NewLine + actionResult + Common.NewLine);

                    if (GoHere.Settings.mDetailedRouting)
                    {
                        if (Sim.ActiveActor == owner)
                        {
                            Common.DebugNotify(msg);
                        }
                    }

                    if (ths.mRouteActions.Count == 0x0)
                    {
                        explanation |= RouteAction.FailureExplanation.InternalPlanFailure;
                        success = false;
                        break;
                    }

                    msg.Append("D");

                    ths.mPreviousRouteAction = ths.mRouteActions[0x0];
                    switch(actionResult)
                    {
                        case RouteAction.ActionResult.Continue:
                        case RouteAction.ActionResult.ContinueAndPopPath:
                        case RouteAction.ActionResult.ContinueAndPopPathAndReplan:
                        case RouteAction.ActionResult.ContinueAndPopPathAndRestart:
                        case RouteAction.ActionResult.ContinueAndFollowPath:
                            msg.Append("E");

                            ths.mRouteActions.RemoveAt(0x0);
                            bool flag3 = (processedPath.GetNumPaths() > 0x1) || (processedPath.IsLoop());
                            if (((actionResult == RouteAction.ActionResult.ContinueAndPopPath) && flag3) || ((actionResult == RouteAction.ActionResult.ContinueAndPopPathAndRestart) || (actionResult == RouteAction.ActionResult.ContinueAndPopPathAndReplan)))
                            {
                                if (flag3)
                                {
                                    processedPath.PopPath();
                                }

                                msg.Append("F");

                                if (actionResult == RouteAction.ActionResult.ContinueAndPopPathAndReplan)
                                {
                                    Vector3 outPosition = new Vector3();
                                    if ((ths.RoutingParent != null) && (ths.RoutingParent is IBoat))
                                    {
                                        outPosition = ths.RoutingParent.PositionOnFloor;
                                    }
                                    else if (ths.Owner != null)
                                    {
                                        if ((owner != null) && (owner.Posture is SwimmingInPool))
                                        {
                                            outPosition = ths.Owner.Position;
                                        }
                                        else
                                        {
                                            outPosition = ths.Owner.PositionOnFloor;
                                        }
                                    }
                                    else
                                    {
                                        processedPath.GetPathStartPoint(0x0, ref outPosition);
                                    }
                                    processedPath.ReplanFromPoint(outPosition);
                                }

                                msg.Append("G");

                                if (actionResult == RouteAction.ActionResult.ContinueAndPopPathAndRestart)
                                {
                                    Vector3 positionOnFloor = new Vector3();
                                    if (ths.Owner != null)
                                    {
                                        positionOnFloor = ths.Owner.PositionOnFloor;
                                    }
                                    else
                                    {
                                        processedPath.GetPathStartPoint(0x0, ref positionOnFloor);
                                    }
                                    processedPath.SetOption(Route.RouteOption.EnablePlanningAsCar, false);
                                    processedPath.SetOption(Route.RouteOption.EnableSubwayPlanning, false);
                                    processedPath.SetOption2(Route.RouteOption2.EnableHoverTrainPlanning, false);
                                    processedPath.ReplanFromPoint(positionOnFloor);
                                    explanation |= RouteAction.FailureExplanation.CancelledByScript;
                                    success = false;
                                    ths.mRouteActions.Clear();
                                }
                                else if (processedPath.PlanResult.Succeeded())
                                {
                                    ths.PushActionsForRoute(r, processedPath);
                                }
                                else
                                {
                                    explanation |= RouteAction.FailureExplanation.ReplanFailure;
                                    success = false;
                                    ths.mRouteActions.Clear();
                                }
                            }
                            else if ((actionResult == RouteAction.ActionResult.ContinueAndFollowPath) && (r.GetNumPaths() > 0x0))
                            {
                                msg.Append("H");

                                if (r.PlanResult.Succeeded())
                                {
                                    ths.PushActionsForRoute(r, processedPath);
                                }
                                else
                                {
                                    explanation |= RouteAction.FailureExplanation.InternalPlanFailure;
                                    success = false;
                                    ths.mRouteActions.Clear();
                                }
                            }
                            break;
                        default:
                            msg.Append("I");

                            explanation |= ths.mPreviousRouteAction.FailureExplanations;
                            success = false;
                            ths.mRouteActions.Clear();
                            break;
                    }
                }

                msg.Append("J");

                ths.mRouteActions.Clear();
                r.SetRouteActionResult((uint)explanation);
                if (!success)
                {
                    if (ths.mPreviousRouteAction == null)
                    {
                        LogFailure(ths.Owner, explanation, r.PlanResult, "(Null mPreviousRouteAction failure)");
                    }
                    else
                    {
                        LogFailure(ths.Owner, explanation, r.PlanResult, "(failure in " + ths.mPreviousRouteAction.ToString() + ")");
                    }
                }

                msg.Append("K");

                if ((ths.RoutingParent != null) && (ths.RoutingParent is IBoat))
                {
                    ths.UpdateDynamicFootprint(ths.RoutingParent as GameObject, true);
                }
                else
                {
                    ths.UpdateDynamicFootprint(ths.Owner, true);
                }

                routeSuccess = (success && (processedPath == r)) && r.PlanResult.Succeeded();
                ths.mPreviousRouteAction = null;
                if (ths.OnRouteActionsFinished != null)
                {
                    ths.OnRouteActionsFinished(ths.Owner, routeSuccess);
                }

                if (((SeasonsManager.Enabled && routeSuccess) && (isOutside && (owner != null))) && ((owner.IsHuman && owner.SimDescription.ChildOrAbove) && (!owner.IsOutside && (owner.CurrentOutfitCategory == OutfitCategories.Outerwear))))
                {
                    owner.SwitchToOutfitWithSpin(Sim.ClothesChangeReason.RemovingOuterwear);
                }

                if (owner != null)
                {
                    SwimmingInPool posture = owner.Posture as SwimmingInPool;
                    if ((posture != null) && posture.UsedShortEntryAnimation)
                    {
                        posture.UsedShortEntryAnimation = false;
                        if (owner.SimDescription.IsMatureMermaid)
                        {
                            OccultMermaid.PutOnTailWithSpin(owner.SimDescription);
                        }
                    }
                }
            }
            catch (ResetException)
            {
                routeSuccess = false;
                if (ths.mRouteActions.Count > 0x0)
                {
                    RouteAction action = ths.mRouteActions[0x0];
                    if (action != null)
                    {
                        action.OnReset();
                    }
                }
                ths.mRouteActions.Clear();
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(owner, null, msg.ToString(), e);
                routeSuccess = false;

                if (ths.mRouteActions.Count > 0x0)
                {
                    RouteAction action = ths.mRouteActions[0x0];
                    if (action != null)
                    {
                        action.OnReset();
                    }
                }
                ths.mRouteActions.Clear();
            }
            finally
            {
                ths.mRouteActions.Clear();
                if (owner != null)
                {
                    owner.RestoreUsedHoverboard();
                }

                if ((owner != null) && (owner.FirstName == "Roberto"))
                {
                    Common.DebugStackLog(msg);
                }
            }

            return routeSuccess;
        }
Exemplo n.º 45
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();
        }
Exemplo n.º 46
0
        public string ToXMLTemperatureString(Season season)
        {
            Common.StringBuilder result = new Common.StringBuilder();

            result += Common.NewLine + "  <Temperature>";
            result += Common.NewLine + "    <Season>" + season + "</Season>";
            result += Common.NewLine + "    <Name>" + mName + "</Name>";
            result += Common.NewLine + "    <StartDay>" + mStart + "</StartDay>";
            result += Common.NewLine + "    <EndDay>" + mEnd + "</EndDay>";
            result += Common.NewLine + "    <Enabled>" + mEnabled + "</Enabled>";
            result += Common.NewLine + "    <MorningMin>" + mMorningTemp.First + "</MorningMin>";
            result += Common.NewLine + "    <MorningMax>" + mMorningTemp.Second + "</MorningMax>";
            result += Common.NewLine + "    <NoonMin>" + mNoonTemp.First + "</NoonMin>";
            result += Common.NewLine + "    <NoonMax>" + mNoonTemp.Second + "</NoonMax>";
            result += Common.NewLine + "    <EveningMin>" + mEveningTemp.First + "</EveningMin>";
            result += Common.NewLine + "    <EveningMax>" + mEveningTemp.Second + "</EveningMax>";
            result += Common.NewLine + "    <NightMin>" + mNightTemp.First + "</NightMin>";
            result += Common.NewLine + "    <NightMax>" + mNightTemp.Second + "</NightMax>";
            result += Common.NewLine + "  </Temperature>";

            return result.ToString();
        }
Exemplo n.º 47
0
        protected virtual string ToXMLString()
        {
            Common.StringBuilder result = new Common.StringBuilder();

            result += Common.NewLine + "    <Weight>" + mWeight + "</Weight>";
            result += Common.NewLine + "    <MinLength>" + mLength.First + "</MinLength>";
            result += Common.NewLine + "    <MaxLength>" + mLength.Second + "</MaxLength>";
            result += Common.NewLine + "    <MinTemp>" + mTemp.First + "</MinTemp>";
            result += Common.NewLine + "    <MaxTemp>" + mTemp.Second + "</MaxTemp>";

            return result.ToString();
        }