Esempio n. 1
0
            public override void SetValue(Color dataType, Color storeType)
            {
                mValue = dataType;

                mName = CASCharacter.GetFavoriteColor(dataType);

                SetThumbnail(ResourceKey.CreatePNGKey(CASCharacter.GetFavoriteColorPngName(dataType), 0x0));
            }
Esempio n. 2
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());
        }
Esempio n. 3
0
        public static OptionResult Perform(Dictionary <ulong, List <IMiniSimDescription> > sims)
        {
            ProgressDialog.Show(Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/Global:Processing", new object[0x0]), false);

            try
            {
                StringBuilder total = new StringBuilder();

                total.Append("0 HEAD");
                total.Append(Common.NewLine + "1 GEDC");
                total.Append(Common.NewLine + "2 VERS 5.5");
                total.Append(Common.NewLine + "2 FORM LINEAGE-LINKED");
                total.Append(Common.NewLine + "1 CHAR ANSI");
                total.Append(Common.NewLine + "1 LANG English");
                total.Append(Common.NewLine + "1 SOUR SIMS3");
                total.Append(Common.NewLine + "2 NAME NRaas MasterController");

                Dictionary <IMiniSimDescription, string> ids = new Dictionary <IMiniSimDescription, string>();

                Dictionary <IMiniSimDescription, StringBuilder> dataLookup = new Dictionary <IMiniSimDescription, StringBuilder>();

                int count = 0;

                foreach (List <IMiniSimDescription> miniSims in sims.Values)
                {
                    foreach (IMiniSimDescription miniSim in miniSims)
                    {
                        SimDescription trueSim = miniSim as SimDescription;
                        if (trueSim != null)
                        {
                            if ((trueSim.Household != null) && (SimTypes.IsSpecial(trueSim)) && (!trueSim.IsDead))
                            {
                                continue;
                            }
                        }

                        count++;

                        string id = "@I" + count.ToString() + "@";

                        ids.Add(miniSim, id);

                        StringBuilder data = new StringBuilder();

                        data.Append(Common.NewLine + "0 " + id + " INDI");
                        data.Append(Common.NewLine + "1 NAME " + miniSim.FirstName + " /" + miniSim.LastName + "/");
                        data.Append(Common.NewLine + "2 GIVN " + miniSim.FirstName);
                        data.Append(Common.NewLine + "2 SURN " + miniSim.LastName);

                        if (miniSim.IsMale)
                        {
                            data.Append(Common.NewLine + "1 SEX M");
                        }
                        else
                        {
                            data.Append(Common.NewLine + "1 SEX F");
                        }

                        if (miniSim.IsDead)
                        {
                            data.Append(Common.NewLine + "1 DEAT");
                        }

                        AppendEvent(data, "Criteria.Age", (int)Aging.GetCurrentAgeInDays(miniSim));
                        AppendEvent(data, "Criteria.Celebrity", (int)miniSim.CelebrityLevel);

                        if (trueSim != null)
                        {
                            if (trueSim.LotHome != null)
                            {
                                AppendEvent(data, "Criteria.LotName", trueSim.LotHome.Name);
                                AppendEvent(data, "Criteria.LotAddress", trueSim.LotHome.Address);
                            }

                            AppendEvent(data, "AlmaMater", trueSim.AlmaMaterName);
                            AppendEvent(data, "Criteria.Zodiac", Common.LocalizeEAString("Ui/Caption/HUD/KnownInfoDialog:" + trueSim.Zodiac.ToString()));

                            if (trueSim.Occupation != null)
                            {
                                AppendEvent(data, "Criteria.Career", trueSim.Occupation.CareerName + " (" + trueSim.Occupation.CareerLevel + ")");
                            }

                            if (trueSim.CareerManager != null)
                            {
                                School school = trueSim.CareerManager.School;
                                if (school != null)
                                {
                                    AppendEvent(data, "Criteria.School", school.CareerName);
                                }

                                if (trueSim.CareerManager.QuitCareers != null)
                                {
                                    foreach (Occupation career in trueSim.CareerManager.QuitCareers.Values)
                                    {
                                        if (career == null)
                                        {
                                            continue;
                                        }

                                        if (career is School)
                                        {
                                            AppendEvent(data, "Criteria.PriorSchool", career.CareerName + " (" + career.CareerLevel + ")");
                                        }
                                        else
                                        {
                                            AppendEvent(data, "Criteria.PriorCareer", career.CareerName + " (" + career.CareerLevel + ")");
                                        }
                                    }
                                }
                            }

                            string LTWName = LifetimeWants.GetName(trueSim);
                            if (!string.IsNullOrEmpty(LTWName))
                            {
                                AppendEvent(data, "Criteria.LifetimeWish", LTWName);
                            }

                            AppendEvent(data, "Criteria.PreferenceColor", CASCharacter.GetFavoriteColor(trueSim.FavoriteColor));
                            AppendEvent(data, "Criteria.PreferenceFood", CASCharacter.GetFavoriteFood(trueSim.FavoriteFood));
                            AppendEvent(data, "Criteria.PreferenceMusic", CASCharacter.GetFavoriteMusic(trueSim.FavoriteMusic));

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

                                    AppendEvent(data, "Criteria.Trait", trait.TraitName(trueSim.IsFemale));
                                }
                            }

                            if (trueSim.SkillManager != null)
                            {
                                foreach (Skill skill in trueSim.SkillManager.List)
                                {
                                    AppendEvent(data, "Criteria.Skill", skill.Name + " (" + skill.SkillLevel + ")");
                                }
                            }
                        }
                        else
                        {
                            MiniSimDescription miniDesc = miniSim as MiniSimDescription;
                            if (miniDesc != null)
                            {
                                AppendEvent(data, "AlmaMater", miniDesc.AlmaMaterName);
                                AppendEvent(data, "Criteria.Zodiac", Common.LocalizeEAString("Ui/Caption/HUD/KnownInfoDialog:" + miniDesc.Zodiac.ToString()));
                                AppendEvent(data, "Criteria.Career", miniDesc.JobOrServiceName);
                                AppendEvent(data, "Criteria.School", miniDesc.SchoolName);

                                if (miniDesc.Traits != null)
                                {
                                    foreach (TraitNames traitName in miniDesc.Traits)
                                    {
                                        Trait trait = TraitManager.GetTraitFromDictionary(traitName);
                                        if (trait == null)
                                        {
                                            continue;
                                        }

                                        if (trait.IsReward)
                                        {
                                            continue;
                                        }

                                        AppendEvent(data, "Criteria.Trait", trait.TraitName(miniDesc.IsFemale));
                                    }
                                }
                            }
                        }

                        dataLookup.Add(miniSim, data);
                    }
                }

                count = 0;

                StringBuilder familyOutput = new StringBuilder();

                Dictionary <string, bool> families = new Dictionary <string, bool>();

                foreach (List <IMiniSimDescription> miniSims in sims.Values)
                {
                    foreach (IMiniSimDescription miniSim in miniSims)
                    {
                        SimDescription trueSim = miniSim as SimDescription;
                        if (trueSim != null)
                        {
                            if ((trueSim.Household != null) && (SimTypes.IsSpecial(trueSim)) && (!trueSim.IsDead))
                            {
                                continue;
                            }
                        }

                        Genealogy genealogy = miniSim.CASGenealogy as Genealogy;
                        if (genealogy == null)
                        {
                            continue;
                        }

                        IMiniSimDescription p1 = null, p2 = null;

                        if (genealogy.Parents.Count == 1)
                        {
                            p1 = genealogy.Parents[0].IMiniSimDescription;
                        }
                        else if (genealogy.Parents.Count == 2)
                        {
                            p1 = genealogy.Parents[0].IMiniSimDescription;
                            p2 = genealogy.Parents[1].IMiniSimDescription;
                        }
                        else
                        {
                            continue;
                        }

                        string father = null;
                        string mother = null;

                        if (p1 != null)
                        {
                            if (p1.IsMale)
                            {
                                if (ids.ContainsKey(p1))
                                {
                                    father = ids[p1];
                                }
                            }
                            else
                            {
                                if (ids.ContainsKey(p1))
                                {
                                    mother = ids[p1];
                                }
                            }
                        }

                        if (p2 != null)
                        {
                            if (father == null)
                            {
                                if (ids.ContainsKey(p2))
                                {
                                    father = ids[p2];
                                }
                            }
                            else
                            {
                                if (ids.ContainsKey(p2))
                                {
                                    mother = ids[p2];
                                }
                            }
                        }

                        if (p1 == null)
                        {
                            p1 = p2;
                            p2 = null;
                        }

                        if (families.ContainsKey(father + mother))
                        {
                            continue;
                        }
                        families.Add(father + mother, true);

                        count++;

                        string familyID = "@F" + count.ToString() + "@";

                        familyOutput.Append(Common.NewLine + "0 " + familyID + " FAM");

                        if (father != null)
                        {
                            familyOutput.Append(Common.NewLine + "1 HUSB " + father);
                        }

                        if (mother != null)
                        {
                            familyOutput.Append(Common.NewLine + "1 WIFE " + mother);
                        }

                        Genealogy p1Genealogy = p1.CASGenealogy as Genealogy;
                        if (p1Genealogy == null)
                        {
                            continue;
                        }

                        Genealogy p2Genealogy = null;
                        if (p2 != null)
                        {
                            p2Genealogy = p2.CASGenealogy as Genealogy;
                            if (p2Genealogy == null)
                            {
                                continue;
                            }
                        }

                        foreach (Genealogy child in p1Genealogy.Children)
                        {
                            if (child == null)
                            {
                                continue;
                            }

                            if (child.SimDescription == null)
                            {
                                continue;
                            }

                            if (p2 == null)
                            {
                                if (child.Parents.Count != 1)
                                {
                                    continue;
                                }
                            }
                            else
                            {
                                if (!child.Parents.Contains(p2Genealogy))
                                {
                                    continue;
                                }
                            }

                            if (dataLookup.ContainsKey(child.SimDescription))
                            {
                                dataLookup[child.SimDescription].Append(Common.NewLine + "1 FAMC " + familyID);
                            }

                            if (ids.ContainsKey(child.SimDescription))
                            {
                                familyOutput.Append(Common.NewLine + "1 CHIL " + ids[child.SimDescription]);
                            }
                        }

                        if (p1 != null)
                        {
                            if (dataLookup.ContainsKey(p1))
                            {
                                dataLookup[p1].Append(Common.NewLine + "1 FAMS " + familyID);
                            }
                        }

                        if (p2 != null)
                        {
                            if (dataLookup.ContainsKey(p2))
                            {
                                dataLookup[p2].Append(Common.NewLine + "1 FAMS " + familyID);
                            }
                        }

                        if ((p1 != null) && (p2 != null) && (p1Genealogy.Spouse == p2Genealogy))
                        {
                            familyOutput.Append(Common.NewLine + "1 MARR");
                        }
                    }
                }

                foreach (StringBuilder data in dataLookup.Values)
                {
                    total.Append(data.ToString());
                }

                total.Append(familyOutput);

                total.Append(Common.NewLine + "0 TRLR");

                NRaas.MasterController.WriteLog(total.ToString(), false);
            }
            finally
            {
                ProgressDialog.Close();
            }

            SimpleMessageDialog.Show(Common.Localize("DumpGenealogy:MenuName"), Common.Localize("DumpGenealogy:Prompt"));
            return(OptionResult.SuccessClose);
        }