예제 #1
0
파일: Occult.cs 프로젝트: yakoder/NRaas
            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");
                }
            }
예제 #2
0
파일: MotiveKey.cs 프로젝트: yakoder/NRaas
        public string GetLocalizedName()
        {
            string result = null;

            if (mOccult != OccultTypes.None)
            {
                result += OccultTypeHelper.GetLocalizedName(mOccult) + " ";
            }

            if (mAgeSpecies != CASAgeGenderFlags.None)
            {
                CASAgeGenderFlags age     = mAgeSpecies & CASAgeGenderFlags.AgeMask;;
                CASAgeGenderFlags species = mAgeSpecies & CASAgeGenderFlags.SpeciesMask;

                result += Common.LocalizeEAString("UI/Feedback/CAS:" + age) + " ";
                result += Common.Localize("Species:" + species) + " ";
            }

            result += CommoditiesEx.GetMotiveLocalizedName(mKind);

            return(result);
        }
예제 #3
0
 protected override string GetLocalizedValue(OccultTypes value, ref ThumbnailKey icon)
 {
     return(OccultTypeHelper.GetLocalizedName(value));
 }
예제 #4
0
 public override string GetLocalizedValue(OccultTypes value)
 {
     return(OccultTypeHelper.GetLocalizedName(value));
 }
예제 #5
0
        public static string GetStatus(SimDescription sim)
        {
            string str = sim.FullName;

            bool serviceOrRole = false;

            if (sim.AssignedRole != null)
            {
                serviceOrRole = true;
                ShoppingRegister register = sim.AssignedRole.RoleGivingObject as ShoppingRegister;
                if (register != null)
                {
                    str += ", " + register.RegisterRoleName(sim.IsFemale);
                }
                else
                {
                    string roleName;
                    if (Localization.GetLocalizedString(sim.AssignedRole.CareerTitleKey, out roleName))
                    {
                        str += ", " + roleName;
                    }
                }

                string hours = GetRoleHours(sim);
                if (!string.IsNullOrEmpty(hours))
                {
                    str += Common.NewLine + hours;
                }
            }
            else if (SimTypes.InServicePool(sim))
            {
                serviceOrRole = true;

                string serviceName;
                if (Localization.GetLocalizedString("Ui/Caption/Services/Service:" + sim.CreatedByService.ServiceType.ToString(), out serviceName))
                {
                    str += ", " + serviceName;
                }
            }

            if ((serviceOrRole) || (Tagger.Settings.mTagDataSettings[TagDataType.Orientation] && Tagger.Settings.mTagDataSettings[TagDataType.LifeStage] && (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays] || (Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage] && sim.AgingEnabled))))
            {
                str += Common.NewLine;
            }
            else
            {
                str += " - ";
            }

            if (sim.TeenOrAbove && !sim.IsPet && Tagger.Settings.mTagDataSettings[TagDataType.Orientation])
            {
                str += Common.Localize("SimType:" + TagDataHelper.GetOrientation(sim).ToString());
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.LifeStage])
            {
                if (Tagger.Settings.mTagDataSettings[TagDataType.Orientation])
                {
                    str += " ";
                }

                str += sim.AgeLocalizedText;
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays] || Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage])
            {
                str += " (";
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays])
            {
                str += Common.Localize("TagData:Age", sim.IsFemale, new object[] { Math.Round(Aging.GetCurrentAgeInDays(sim as IMiniSimDescription)) });
            }

            if (sim.AgingEnabled)
            {
                if (Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage])
                {
                    str += ", " + Common.Localize("TagData:Birthday", sim.IsFemale, new object[] { (int)(AgingManager.Singleton.AgingYearsToSimDays(AgingManager.GetMaximumAgingStageLength(sim)) - AgingManager.Singleton.AgingYearsToSimDays(sim.AgingYearsSinceLastAgeTransition)) });
                }
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays] || Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage])
            {
                str += ")";
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.Occult] && sim.OccultManager != null)
            {
                List <OccultTypes> types = OccultTypeHelper.CreateList(sim, false);

                if (types.Count > 0)
                {
                    str += Common.NewLine;

                    string occultString = "";
                    foreach (OccultTypes type in types)
                    {
                        occultString += ", " + OccultTypeHelper.GetLocalizedName(type);
                    }

                    str += Common.Localize("TagData:OccultTag", sim.IsFemale, new object[] { occultString.Remove(0, 2) });
                }
            }

            Sim createdSim = sim.CreatedSim;

            if (Tagger.Settings.Debugging)
            {
                if (createdSim != null)
                {
                    str += Common.NewLine + "Autonomy: ";
                    if (createdSim.Autonomy == null)
                    {
                        str += "None";
                    }
                    else
                    {
                        if (createdSim.Autonomy.AutonomyDisabled)
                        {
                            str += "Disabled";
                        }
                        else if (!AutonomyRestrictions.IsAnyAutonomyEnabled(createdSim))
                        {
                            str += "User Disabled";
                        }
                        else if (createdSim.Autonomy.IsRunningHighLODSimulation)
                        {
                            str += "High";
                        }
                        else
                        {
                            str += "Low";
                        }

                        if (createdSim.Autonomy.ShouldRunLocalAutonomy)
                        {
                            str += " Local";
                        }

                        if (createdSim.CanRunAutonomyImmediately())
                        {
                            str += " Ready";
                        }
                        else if (!createdSim.mLastInteractionWasAutonomous)
                        {
                            str += " Push";
                        }
                        else if (!createdSim.mLastInteractionSucceeded)
                        {
                            str += " Fail";
                        }

                        if (createdSim.Autonomy.InAutonomyManagerQueue)
                        {
                            str += " Queued";
                        }
                    }
                }
            }

            if (createdSim != null)
            {
                if (Tagger.Settings.mTagDataSettings[TagDataType.Mood])
                {
                    str += Common.NewLine;
                    int flavour = (int)createdSim.MoodManager.MoodFlavor;

                    str += Common.Localize("TagData:MoodTag", sim.IsFemale, new object[] { Common.LocalizeEAString(false, "Ui/Tooltip/HUD/SimDisplay:MoodFlavor" + flavour.ToString()) }) + " ";
                }

                if (Tagger.Settings.mTagDataSettings[TagDataType.MotiveInfo])
                {
                    if (!Tagger.Settings.mTagDataSettings[TagDataType.Mood])
                    {
                        str += Common.NewLine;
                    }

                    string motives = ", ";
                    int    num     = 0;
                    foreach (CommodityKind kind in (Sims3.UI.Responder.Instance.HudModel as HudModel).GetMotives(sim.CreatedSim))
                    {
                        if (sim.CreatedSim.Motives.HasMotive(kind))
                        {
                            if (num >= 6)
                            {
                                break;
                            }

                            motives += FetchMotiveLocalization(sim.Species, kind) + ": " + "(" + sim.CreatedSim.Motives.GetValue(kind).ToString("0.") + ") ";
                        }

                        num++;
                    }

                    str += Common.Localize("TagData:Motives", sim.IsFemale, new object[] { motives.Remove(0, 2) });
                }

                if (Tagger.Settings.mTagDataSettings[TagDataType.CurrentInteraction] && createdSim.CurrentInteraction != null)
                {
                    str += Common.NewLine;

                    try
                    {
                        str += createdSim.CurrentInteraction.ToString();
                    }
                    catch (Exception e)
                    {
                        Common.DebugException(createdSim, e);

                        str += createdSim.CurrentInteraction.GetType();
                    }

                    Tone tone = createdSim.CurrentInteraction.CurrentTone;
                    if (tone != null)
                    {
                        str += Common.NewLine + tone.ToString();
                    }

                    SocialInteractionBase social = createdSim.CurrentInteraction as SocialInteractionBase;
                    if ((social != null) && (social.Target != null))
                    {
                        str += " " + Common.Localize("TagData:With", sim.IsFemale, new object[] { social.Target.Name });
                    }

                    if (createdSim.CurrentInteraction is Terrain.GoHereWith)
                    {
                        InviteToLotSituation situtation = InviteToLotSituation.FindInviteToLotSituationInvolving(createdSim);
                        if (situtation != null)
                        {
                            if (situtation.SimA != createdSim)
                            {
                                str += " " + situtation.SimA.Name;
                            }
                            else if (situtation.SimB != createdSim)
                            {
                                str += situtation.SimB.Name;
                            }
                        }
                    }
                }
            }

            if (!SimTypes.IsSpecial(sim))
            {
                str += Common.NewLine + Common.Localize("TagData:CashTag", sim.IsFemale, new object[] { sim.FamilyFunds });

                if ((Tagger.Settings.mTagDataSettings[TagDataType.Debt] || Tagger.Settings.mTagDataSettings[TagDataType.NetWorth]) && sGetDebtAndNetworth.Valid)
                {
                    int bit = 0;
                    if (Tagger.Settings.mTagDataSettings[TagDataType.Debt])
                    {
                        bit = bit + 1;
                    }
                    if (Tagger.Settings.mTagDataSettings[TagDataType.NetWorth])
                    {
                        bit = bit + 4;
                    }

                    str += sGetDebtAndNetworth.Invoke <string>(new object[] { sim, bit });
                }

                if (Tagger.Settings.mTagDataSettings[TagDataType.Job])
                {
                    if (sim.Occupation != null)
                    {
                        str += Common.NewLine;
                        if (sim.Occupation.OfficeLocation != null)
                        {
                            str += Common.Localize("TagData:JobAt", sim.IsFemale, new object[] { sim.Occupation.CurLevelJobTitle, sim.Occupation.OfficeLocation.GetLocalizedName() });
                        }
                        else
                        {
                            str += Common.Localize("TagData:JobTag", sim.IsFemale, new object[] { sim.Occupation.CurLevelJobTitle });
                        }
                    }
                }

                if (Tagger.Settings.mTagDataSettings[TagDataType.PartnerInfo])
                {
                    if (sim.Partner != null)
                    {
                        Relationship rel    = sim.GetRelationship(sim.Partner, false);
                        string       status = "Happily";
                        if (rel != null)
                        {
                            if (rel.CurrentLTRLiking < -15)
                            {
                                status = "Unhappily";
                            }
                        }

                        str += Common.NewLine;

                        if (sim.IsMarried)
                        {
                            str += Common.Localize("TagData:Spouse", sim.IsFemale, new object[] { Common.Localize("TagData:" + status), sim.Partner });
                        }
                        else
                        {
                            str += Common.Localize("TagData:Partner", sim.IsFemale, new object[] { sim.Partner });
                        }
                    }
                }
            }

            if (sim.IsPregnant && Tagger.Settings.mTagDataSettings[TagDataType.PregnancyInfo])
            {
                IMiniSimDescription father = SimDescription.Find(sim.Pregnancy.DadDescriptionId);
                if (father == null)
                {
                    father = MiniSimDescription.Find(sim.Pregnancy.DadDescriptionId);
                }

                str += Common.NewLine;

                if (father != null)
                {
                    if (sim.Partner != null && father != sim.Partner && !sim.IsPet)
                    {
                        string uhoh = Common.Localize("TagData:Uhoh");
                        str += Common.Localize("TagData:Pregnancy", sim.IsFemale, new object[] { father, uhoh });
                    }
                    else
                    {
                        str += Common.Localize("TagData:Pregnancy", sim.IsFemale, new object[] { father });
                    }
                }
                else
                {
                    str += Common.Localize("TagData:PregnancyUnknown", sim.IsFemale);
                }
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.PersonalityInfo] && sGetClanInfo.Valid)
            {
                List <string> info = sGetClanInfo.Invoke <List <string> >(new object [] { sim });
                foreach (string personality in info)
                {
                    str += Common.NewLine + personality;
                }
            }

            return(str);
        }
예제 #6
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);
            }
        }
예제 #7
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());
        }
예제 #8
0
파일: Population.cs 프로젝트: yakoder/NRaas
        protected string GetDetails(List <IMiniSimDescription> sims)
        {
            int npcs = 0, homeless = 0, tourists = 0, residents = 0;

            Dictionary <CASAgeGenderFlags, GenderItem> ages = new Dictionary <CASAgeGenderFlags, GenderItem>();

            Dictionary <OccultTypes, GenderItem> occults = new Dictionary <OccultTypes, GenderItem>();

            GenderItem childless = new GenderItem();
            GenderItem married   = new GenderItem();

            GenderItem fertile = new GenderItem();

            int malePregnancies = 0, femalePregnancies = 0, unknownPregnancies = 0;

            int   totalParents  = 0;
            float totalChildren = 0;

            bool includesHuman = false;

            Dictionary <Household, bool> houses = new Dictionary <Household, bool>();

            Dictionary <CASAgeGenderFlags, bool> species = new Dictionary <CASAgeGenderFlags, bool>();

            foreach (IMiniSimDescription miniSim in sims)
            {
                SimDescription member = miniSim as SimDescription;
                if (member == null)
                {
                    continue;
                }

                Household household = member.Household;
                if (household == null)
                {
                    continue;
                }

                if (!household.IsSpecialHousehold)
                {
                    houses[household] = true;
                }

                species[member.Species] = true;

                if (member.IsHuman)
                {
                    includesHuman = true;
                }

                if (member.OccultManager != null)
                {
                    foreach (OccultTypes type in Enum.GetValues(typeof(OccultTypes)))
                    {
                        if (member.OccultManager.HasOccultType(type))
                        {
                            GenderItem item;
                            if (!occults.TryGetValue(type, out item))
                            {
                                item = new GenderItem();
                                occults.Add(type, item);
                            }

                            item.Inc(member.IsFemale);
                        }
                    }
                }

                if (SimTypes.IsService(household))
                {
                    npcs++;
                }
                else if (household.IsTouristHousehold)
                {
                    tourists++;
                }
                else if (household.LotHome == null)
                {
                    homeless++;
                }
                else
                {
                    residents++;

                    if (member.IsPregnant)
                    {
                        if (member.Pregnancy.mGender == CASAgeGenderFlags.Male)
                        {
                            malePregnancies++;
                        }
                        else if (member.Pregnancy.mGender == CASAgeGenderFlags.Female)
                        {
                            femalePregnancies++;
                        }
                        else
                        {
                            unknownPregnancies++;
                        }

                        residents++;
                    }

                    int numChildren = NRaas.CommonSpace.Helpers.Relationships.GetChildren(member).Count;
                    if (numChildren > 0)
                    {
                        totalChildren += numChildren;
                        totalParents++;
                    }
                    else
                    {
                        if ((member.YoungAdult) || (member.Adult))
                        {
                            childless.Inc(member.IsFemale);
                        }
                    }

                    if ((member.Partner != null) && (member.Partner.CreatedSim != null))
                    {
                        married.Inc(member.IsFemale);
                    }

                    GenderItem age;
                    if (!ages.TryGetValue(member.Age, out age))
                    {
                        age = new GenderItem();
                        ages.Add(member.Age, age);
                    }

                    age.Inc(member.IsFemale);

                    if ((member.YoungAdult) || (member.Adult))
                    {
                        fertile.Inc(member.IsFemale);
                    }

                    if (member.Pregnancy != null)
                    {
                        totalChildren++;
                    }
                }
            }

            long males   = malePregnancies;
            long females = femalePregnancies;

            float adults   = 0;
            float children = 0;

            foreach (KeyValuePair <CASAgeGenderFlags, GenderItem> item in ages)
            {
                males   += item.Value.mMale;
                females += item.Value.mFemale;

                if ((item.Key == CASAgeGenderFlags.YoungAdult) || (item.Key == CASAgeGenderFlags.Adult))
                {
                    adults += item.Value.mMale + item.Value.mFemale;
                }
                else if (item.Key != CASAgeGenderFlags.Elder)
                {
                    children += item.Value.mMale + item.Value.mFemale;
                }
            }

            string msg = null;

            List <object> objects = new List <object>();

            objects.Add(houses.Count);
            objects.Add(residents);
            objects.Add(npcs);
            objects.Add(homeless);
            objects.Add(tourists);
            objects.Add(males);
            objects.Add(females);

            msg += Common.Localize("Population:General", false, objects.ToArray());

            msg += Common.Localize("Population:Pregnancies", false, new object[] { malePregnancies, femalePregnancies, unknownPregnancies });

            objects.Clear();

            CASAgeGenderFlags[] ageFlags = null;

            if (includesHuman)
            {
                ageFlags = new CASAgeGenderFlags[] { CASAgeGenderFlags.Baby, CASAgeGenderFlags.Toddler, CASAgeGenderFlags.Child, CASAgeGenderFlags.Teen, CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Adult, CASAgeGenderFlags.Elder };
            }
            else
            {
                ageFlags = new CASAgeGenderFlags[] { CASAgeGenderFlags.Child, CASAgeGenderFlags.Adult, CASAgeGenderFlags.Elder };
            }

            foreach (CASAgeGenderFlags age in ageFlags)
            {
                GenderItem item;
                if (ages.TryGetValue(age, out item))
                {
                    objects.Add(item.mMale);
                    objects.Add(item.mFemale);
                }
                else
                {
                    objects.Add(0);
                    objects.Add(0);
                }
            }

            if (includesHuman)
            {
                msg += Common.Localize("Population:AgeBreakdown", false, objects.ToArray());
            }
            else
            {
                msg += Common.Localize("Population:PetAgeBreakdown", false, objects.ToArray());
            }

            objects.Clear();
            objects.Add(married.mMale);
            objects.Add(married.mFemale);
            objects.Add(childless.mMale);
            objects.Add(childless.mFemale);

            msg += Common.Localize("Population:FamilyBreakdown", false, objects.ToArray());

            if (species.Count == 1)
            {
                if (totalParents > 0)
                {
                    msg += Common.Localize("Population:ChildToParent", false, new object[] { (totalChildren / totalParents) });
                }
            }

            string occultText = null;

            foreach (KeyValuePair <OccultTypes, GenderItem> occult in occults)
            {
                occultText += Common.Localize("Population:Occult", false, new object[] { OccultTypeHelper.GetLocalizedName(occult.Key), occult.Value.mMale, occult.Value.mFemale });
            }

            if (!string.IsNullOrEmpty(occultText))
            {
                msg += Common.NewLine + occultText;
            }

            if (species.Count == 1)
            {
                if (children > 0f)
                {
                    msg += Common.Localize("Population:AdultToChild", false, new object[] { adults, children, (adults / children) });
                }

                if (includesHuman)
                {
                    float adultLength = AgingManager.GetAgingStageLength(CASAgeGenderFlags.Human, CASAgeGenderFlags.YoungAdult);
                    adultLength += AgingManager.GetAgingStageLength(CASAgeGenderFlags.Human, CASAgeGenderFlags.Adult);

                    float childLength = AgingManager.GetAgingStageLength(CASAgeGenderFlags.Human, CASAgeGenderFlags.Baby);
                    childLength += AgingManager.GetAgingStageLength(CASAgeGenderFlags.Human, CASAgeGenderFlags.Toddler);
                    childLength += AgingManager.GetAgingStageLength(CASAgeGenderFlags.Human, CASAgeGenderFlags.Child);
                    childLength += AgingManager.GetAgingStageLength(CASAgeGenderFlags.Human, CASAgeGenderFlags.Teen);

                    if (childLength > 0f)
                    {
                        msg += Common.Localize("Population:PopGrowth", false, new object[] { adultLength, childLength, (adultLength / childLength) });
                    }
                }
            }

            return(msg);
        }
예제 #9
0
 public MermaidServiceItem(int count)
     : base(OccultTypeHelper.GetLocalizedName(Sims3.UI.Hud.OccultTypes.Mermaid), count)
 {
 }