public static void OnAccept(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i) { try { int actorAge = (int)Aging.GetCurrentAgeInDays(actor.SimDescription); int targetAge = (int)Aging.GetCurrentAgeInDays(target.SimDescription); int difference = 0; string suffix = "SameResult"; if (targetAge > actorAge) { suffix = "OlderResult"; difference = targetAge - actorAge; } else if (targetAge < actorAge) { suffix = "YoungerResult"; difference = actorAge - targetAge; } if (SimTypes.IsSelectable(actor)) { Common.Notify(Common.Localize("AskAboutAge:" + suffix, target.IsFemale, new object[] { difference }), target.ObjectId, ObjectGuid.InvalidObjectGuid, StyledNotification.NotificationStyle.kSimTalking); } } catch (Exception e) { Common.Exception(actor, target, e); } }
public override ObjectPicker.ColumnInfo GetValue(IMiniSimDescription sim) { if (sim == null) { return(new ObjectPicker.TextColumn("")); } else { return(new ObjectPicker.TextColumn(((int)Aging.GetCurrentAgeInDays(sim)).ToString("D4"))); } }
public static string GetHeader(IMiniSimDescription me) { SimDescription simDesc = me as SimDescription; MiniSimDescription miniDesc = me as MiniSimDescription; float agingYearsSinceLastAgeTransition = 0; if (simDesc != null) { agingYearsSinceLastAgeTransition = simDesc.AgingYearsSinceLastAgeTransition; } else if (miniDesc != null) { agingYearsSinceLastAgeTransition = miniDesc.AgingYearsSinceLastAgeTransition; } int trueAge = (int)Aging.GetCurrentAgeInDays(me); int daysToTransition = (int)(AgingManager.Singleton.AgingYearsToSimDays(AgingManager.GetMaximumAgingStageLength(me)) - AgingManager.Singleton.AgingYearsToSimDays(agingYearsSinceLastAgeTransition)); string simName = me.FullName.Trim(); if (string.IsNullOrEmpty(simName)) { Genealogy genealogy = me.CASGenealogy as Genealogy; if (genealogy != null) { simName = genealogy.Name + Common.NewLine + me.SimDescriptionId; } } string header = Common.Localize("Status:NameAge", me.IsFemale, new object[] { simName, SelectionCriteria.Age.Item.GetName(me.Age), trueAge, daysToTransition }); if (me.IsFemale) { header += Common.NewLine + Common.Localize("Criteria.GenderFemale:MenuName"); } else { header += Common.NewLine + Common.Localize("Criteria.GenderMale:MenuName"); } if (me.IsAlien) { header += " " + Common.Localize("Species:Alien"); } else { header += " " + Common.Localize("Species:" + me.Species); } return(header); }
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); }
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); }