Beispiel #1
0
            public override void SetValue(Values value, Values storeType)
            {
                mValue = value;

                if (value.mOccult != OccultTypes.None)
                {
                    mName = OccultTypeHelper.GetLocalizedName(value.mOccult);
                }
                else if (value.mDeathType != SimDescription.DeathType.None)
                {
                    mName = Urnstones.GetLocalizedString(false, value.mDeathType);
                }
                else
                {
                    mName = Common.Localize("Species:Human");
                }
            }
Beispiel #2
0
        public static void AlienRefreshCallback()
        {
            string msg = "Alien Household Refresh" + Common.NewLine;

            if (Household.AlienHousehold == null)
            {
                msg += " - Alien household is null";
                Common.DebugNotify(msg);
                return;
            }

            if (Household.AlienHousehold.NumMembers < AlienUtils.kAlienHouseholdNumMembers)
            {
                msg += " - Adding new alien" + Common.NewLine;

                CASAgeGenderFlags age         = RandomUtil.GetRandomObjectFromList(Aliens.Settings.mValidAlienAges);
                CASAgeGenderFlags gender      = RandomUtil.CoinFlip() ? CASAgeGenderFlags.Male : CASAgeGenderFlags.Female;
                SimDescription    description = MakeAlien(age, gender, GameUtils.GetCurrentWorld(), 1f, true);

                if (Aliens.Settings.mAllowOccultAliens && RandomUtil.RandomChance(Aliens.Settings.mOccultAlienChance))
                {
                    msg += " -- Creating occult alien" + Common.NewLine;

                    int numOccults = RandomUtil.GetInt(1, Aliens.Settings.mMaxAlienOccults);
                    List <OccultTypes> validOccults = new List <OccultTypes>(Aliens.Settings.mValidAlienOccults);

                    for (int i = 0; i < numOccults; i++)
                    {
                        if (validOccults.Count == 0)
                        {
                            break;
                        }

                        OccultTypes type = RandomUtil.GetRandomObjectFromList(validOccults);

                        if (type != OccultTypes.Ghost)
                        {
                            OccultTypeHelper.Add(description, type, false, false);

                            msg += " --- " + OccultTypeHelper.GetLocalizedName(type) + Common.NewLine;
                        }
                        else
                        {
                            SimDescription.DeathType deathType =
                                RandomUtil.GetRandomObjectFromList((SimDescription.DeathType[])Enum.GetValues(typeof(SimDescription.DeathType)));
                            Urnstones.SimToPlayableGhost(description, deathType);

                            msg += " --- " + Urnstones.GetLocalizedString(description.IsFemale, deathType) + Common.NewLine;
                        }

                        validOccults.Remove(type);
                    }
                }

                msg += " -- Adding baseline skills" + Common.NewLine;

                Skill element = null;

                element = description.SkillManager.AddElement(SkillNames.Logic);

                if (element != null)
                {
                    element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mLogicSkill[0], Aliens.Settings.mLogicSkill[1]));
                }

                msg += " --- " + element.Name + Common.NewLine;

                element = description.SkillManager.AddElement(SkillNames.Handiness);

                if (element != null)
                {
                    element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mHandinessSkill[0], Aliens.Settings.mHandinessSkill[1]));
                }

                msg += " --- " + element.Name + Common.NewLine;

                try
                {
                    if (Aliens.Settings.mFutureSim)
                    {
                        msg += " -- Adding Adv Tech skill" + Common.NewLine;

                        description.TraitManager.AddElement(TraitNames.FutureSim);
                        element = description.SkillManager.AddElement(SkillNames.Future);

                        if (element != null)
                        {
                            element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mFutureSkill[0], Aliens.Settings.mFutureSkill[1]));
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add Adv Tech skill", e);
                }

                /*
                 * if (age == CASAgeGenderFlags.Teen)
                 * {
                 *  element = description.SkillManager.AddElement(SkillNames.LearnToDrive);
                 *
                 *  if (element != null)
                 *      element.ForceSkillLevelUp(SkillManager.GetMaximumSupportedSkillLevel(SkillNames.LearnToDrive));
                 * }
                 */

                try
                {
                    if (Aliens.Settings.mAlienScience)
                    {
                        msg += " -- Adding Science skill" + Common.NewLine;

                        //Sim temp = description.InstantiateOffScreen(LotManager.GetFarthestLot(Household.ActiveHouseholdLot));
                        element = description.SkillManager.AddElement(SkillNames.Science);

                        if (element != null)
                        {
                            element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mScienceSkill[0], Aliens.Settings.mScienceSkill[1]));
                        }

                        //temp.Destroy();
                    }
                }
                catch (Exception e)
                {
                    Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add Science skill", e);
                }

                try
                {
                    if (OccultTypeHelper.HasType(description, OccultTypes.Fairy) || OccultTypeHelper.HasType(description, OccultTypes.PlantSim))
                    {
                        msg += " -- Adding Gardening skill" + Common.NewLine;

                        element = description.SkillManager.AddElement(SkillNames.Gardening);

                        if (element != null)
                        {
                            element.ForceSkillLevelUp(RandomUtil.GetInt(3, 6));
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add Gardening skill", e);
                }

                try
                {
                    if (OccultTypeHelper.HasType(description, OccultTypes.Fairy))
                    {
                        msg += " -- Adding Fairy Magic skill" + Common.NewLine;

                        element = description.SkillManager.AddElement(SkillNames.FairyMagic);

                        if (element != null)
                        {
                            element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mFairyMagicSkill[0], Aliens.Settings.mFairyMagicSkill[1]));
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add Fairy Magic skill", e);
                }

                try
                {
                    if (OccultTypeHelper.HasType(description, OccultTypes.Werewolf))
                    {
                        msg += " -- Adding Lycanthropy skill" + Common.NewLine;

                        element = description.SkillManager.AddElement(SkillNames.Lycanthropy);

                        if (element != null)
                        {
                            element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mLycanthropySkill[0], Aliens.Settings.mLycanthropySkill[1]));
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add Lycanthropy skill", e);
                }

                try
                {
                    if (OccultTypeHelper.HasType(description, OccultTypes.Witch))
                    {
                        msg += " -- Adding witch skills" + Common.NewLine;

                        element = description.SkillManager.AddElement(SkillNames.Spellcasting);

                        if (element != null)
                        {
                            element.ForceSkillLevelUp(RandomUtil.GetInt(3, 6));
                        }

                        element = description.SkillManager.AddElement(SkillNames.Spellcraft);

                        if (element != null)
                        {
                            element.ForceSkillLevelUp(RandomUtil.GetInt(3, 6));
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add witch skills", e);
                }

                msg += " -- Adding alien to household";

                Household.AlienHousehold.AddSilent(description);
                description.OnHouseholdChanged(Household.AlienHousehold, false);

                Common.DebugNotify(msg);
            }
        }
Beispiel #3
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());
        }