protected override bool PrivateRun(IMiniSimDescription a, SimDescription b) { if (!Fixup(a as SimDescription)) return false; if (!Fixup(b)) return false; return Run(a.CASGenealogy as Genealogy, b.Genealogy); }
public WorldName GetHomeWorld(IMiniSimDescription desc) { if (desc == null) { return(WorldName.Undefined); } if (desc.HomeWorld != WorldName.Undefined && desc.HomeWorld != WorldName.UserCreated) { return(desc.HomeWorld); } if (!mWorldForSims.ContainsKey(desc.SimDescriptionId)) { return(WorldName.Undefined); } string world = mWorldForSims[desc.SimDescriptionId]; string name = world.Replace(".world", ""); WorldName worldName = WorldName.Undefined; try { worldName = unchecked ((WorldName)ResourceUtils.HashString32(name.Replace(" ", ""))); } catch { return(WorldName.Undefined); } return(worldName); }
public string GetDetails(IMiniSimDescription miniSim) { SimDescription me = miniSim as SimDescription; if (me == null) { return(null); } string msg = PersonalStatus.GetHeader(me); msg += GetJob(me); msg += Common.NewLine + GetSchool(me); if ((me.CareerManager != null) && (me.CareerManager.QuitCareers != null) && (me.CareerManager.QuitCareers.Count > 0)) { msg += Common.Localize("Status:QuitCareers", me.IsFemale, new object[] { me.CareerManager.QuitCareers.Count }); foreach (Occupation career in me.CareerManager.QuitCareers.Values) { msg += Common.Localize("Status:QuitCareer", me.IsFemale, new object[] { career.CareerName, career.CareerLevel }); } } return(msg); }
protected virtual bool Allow(MiniSimDescription me, IMiniSimDescription actor) { IEnumerable <TOption> options = GetOptions(); if (options == null) { return(true); } if (MatchAll) { foreach (TOption option in options) { if (!option.Test(me, false, actor)) { return(false); } } return(true); } else { foreach (TOption option in options) { if (option.Test(me, false, actor)) { return(true); } } return(false); } }
protected override bool Allow(SimDescription me, IMiniSimDescription actor) { if (me.CreatedSim == null) { return(false); } SimDescription actorDesc = actor as SimDescription; if (actorDesc == null) { return(false); } if (actorDesc.CreatedSim == null) { return(false); } if (mLot == null) { return(me.CreatedSim.LotCurrent == actorDesc.CreatedSim.LotCurrent); } else { return(me.CreatedSim.LotCurrent == mLot); } }
protected bool PrivateGet(IMiniSimDescription me, IMiniSimDescription actor, Dictionary<Values, Values> results) { List<OccultTypes> types = new List<OccultTypes>(); foreach (OccultTypes type in Enum.GetValues(typeof(OccultTypes))) { if (type == OccultTypes.Ghost) { if (me.IsDead) { types.Add(type); } } else if (SimTypes.IsOccult(me, type)) { types.Add(type); } } if (types.Count == 0) { types.Add(OccultTypes.None); } foreach (OccultTypes type in types) { Values value = new Values(type, SimDescription.DeathType.None); results[value] = value; } return true; }
public override bool Get(SimDescription me, IMiniSimDescription actor, Dictionary <OccupationNames, OccupationNames> results) { if (me.Household == null) { return(false); } if (me.Occupation != null) { results[me.Occupation.Guid] = me.Occupation.Guid; } else { if (SimTypes.IsSpecial(me)) { return(false); } if (!me.TeenOrAbove) { return(false); } results[OccupationNames.Undefined] = OccupationNames.Undefined; } return(true); }
public string GetDetails(IMiniSimDescription miniSim) { SimDescription me = miniSim as SimDescription; if (me == null) return null; string msg = PersonalStatus.GetHeader(me) + Common.NewLine; List<string> skills = new List<string>(); foreach (Skill skill in me.SkillManager.List) { if (skill.SkillLevel <= 0) continue; skills.Add(Common.Localize("SkillsStatus:Element", me.IsFemale, new object[] { skill.Name, skill.SkillLevel })); } if (skills.Count == 0) { msg += Common.Localize("SkillsStatus:NoSkill"); } else { skills.Sort(); foreach (string skill in skills) { msg += skill; } } return msg; }
protected bool Run(IMiniSimDescription a, IMiniSimDescription b) { try { if (b is SimDescription) { SimDescription sim = b as SimDescription; if (!Test(a, sim)) return true; return PrivateRun(a, sim); } else { MiniSimDescription sim = b as MiniSimDescription; if (!Test(a, sim)) return true; return PrivateRun(a, sim); } } catch (Exception e) { Common.Exception(a, b as SimDescription, e); return false; } }
public int GetScoreValue(IMiniSimDescription me, IMiniSimDescription actor, bool satisfies, int missDivisor) { if (Test(me, false, actor, false) && satisfies) { return(OptionScoreData.mOptionHitValue); } else { if (OptionScoreData.mOptionMissValue != 0 || !satisfies || missDivisor == 0) { return(OptionScoreData.mOptionMissValue); } /* * int val = OptionScoreData.mOptionHitValue / missDivisor; * * if (val > 0) * { * return -1 * val; * } * else * { * return val; * } */ return(0); } }
public override bool Get(MiniSimDescription me, IMiniSimDescription actor, Dictionary <int, int> results) { try { if (me.CASGenealogy == null) { return(false); } if (me.CASGenealogy.IChildren == null) { return(false); } int count = me.CASGenealogy.IChildren.Count; results[count] = count; return(true); } catch { // Sim may not have a valid celebrity manager return(false); } }
private static bool IsValidRelationship(IMiniSimDescription sim1, IMiniSimDescription sim2, CASFamilyScreen.RelationshipType relationship) { switch (relationship) { case CASFamilyScreen.RelationshipType.Roommate: return true; case CASFamilyScreen.RelationshipType.Spouse: if (!sim1.TeenOrAbove) return false; if (!sim2.TeenOrAbove) return false; if (CASFamilyScreenEx.kAllowAdultTeen) return true; return (sim1.Teen == sim2.Teen); case CASFamilyScreen.RelationshipType.Parent: if (sim2.Age > sim1.Age) return false; return sim1.TeenOrAbove; case CASFamilyScreen.RelationshipType.Child: if (sim1.Age > sim2.Age) return false; return sim2.TeenOrAbove; case CASFamilyScreen.RelationshipType.Sibling: return true; } return false; }
protected bool Run(IMiniSimDescription a, IMiniSimDescription b) { try { if (b is SimDescription) { SimDescription sim = b as SimDescription; if (!Test(a, sim)) { return(true); } return(PrivateRun(a, sim)); } else { MiniSimDescription sim = b as MiniSimDescription; if (!Test(a, sim)) { return(true); } return(PrivateRun(a, sim)); } } catch (Exception e) { Common.Exception(a, b as SimDescription, e); return(false); } }
public override bool Get(MiniSimDescription me, IMiniSimDescription actor, Dictionary <int, int> results) { int level = Genealogies.GetFamilyLevel(me.CASGenealogy); results[level] = level; return(true); }
public static void Perform(IMiniSimDescription me) { if (!Responder.Instance.IsGameStatePending || !Responder.Instance.IsGameStateShuttingDown) { Dialogs.FamilyTreeDialog.Show(me); } }
protected override bool Run(IMiniSimDescription me, bool singleSelection) { if (!base.Run(me, singleSelection)) { return(false); } int age, maxAge; GetAge(me, out age, out maxAge); age += mAge; if (age <= 0) { age = 0; } else if ((me.Age != CASAgeGenderFlags.Elder) && (age > maxAge)) { age = maxAge; } AlterAge(me, age); return(true); }
public override bool Get(SimDescription me, IMiniSimDescription actor, Dictionary <AfterschoolActivityType, AfterschoolActivityType> results) { if (me.CareerManager == null) { return(false); } School school = me.CareerManager.School; if (school == null) { return(false); } if (school.AfterschoolActivities == null) { return(false); } foreach (AfterschoolActivity activity in school.AfterschoolActivities) { results[activity.CurrentActivityType] = activity.CurrentActivityType; } return(true); }
public override SimSelection.UpdateResult Update(IMiniSimDescription actor, IEnumerable <SimSelection.ICriteria> criteria, List <IMiniSimDescription> allSims, bool secondStage) { if (!secondStage) { string text = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Prompt", actor.IsFemale), ""); if (string.IsNullOrEmpty(text)) { return(SimSelection.UpdateResult.Failure); } if (!int.TryParse(text, out mValue)) { Common.Notify(Common.Localize("Numeric:Error")); return(SimSelection.UpdateResult.Failure); } return(SimSelection.UpdateResult.Delay); } else { RandomUtil.RandomizeListOfObjects(allSims); allSims.RemoveRange(mValue, allSims.Count - mValue); return(SimSelection.UpdateResult.Success); } }
public static List <IMiniSimDescription> GetSimsMatchingFilterAsMinis(string name, ulong sim) { List <IMiniSimDescription> results = new List <IMiniSimDescription>(); SavedFilter filter = GetFilter(name); if (sim == 0 && PlumbBob.SelectedActor != null) { sim = PlumbBob.SelectedActor.SimDescription.SimDescriptionId; } if (filter != null && sim != 0) { bool okayed; IMiniSimDescription mini = SimDescription.Find(sim); if (mini != null) { List <SimSelection.ICriteria> crit = new List <SimSelection.ICriteria>(); crit.Add(new SavedFilter.Item(filter)); SimSelection selection = SimSelection.Create("", mini, null, crit, true, false, out okayed); if (selection.All != null && selection.All.Count > 0) { results.AddRange(selection.All); } } } return(results); }
public bool Test(IMiniSimDescription me, bool fullFamily, IMiniSimDescription actor) { SimDescription trueSim = me as SimDescription; if (trueSim == null) { return(false); } if (SimTypes.IsSpecial(trueSim)) { return(false); } int funds = 0; if (trueSim.Household != null) { funds = new T().GetValue(trueSim.Household); } if (funds < Value.x) { return(false); } if (mFinal) { return(true); } return(funds <= Value.y); }
protected override bool Allow(MiniSimDescription me, IMiniSimDescription actor) { if (mFilter == null) { return(false); } foreach (SimSelection.ICriteria item in mFilter.mElements) { if (item.CanBeRandomCriteria && RandomUtil.CoinFlip()) { continue; } ITestableOption testable = item as ITestableOption; if (testable == null) { continue; } if (!testable.Test(me, false, actor)) { return(false); } } return(true); }
public override bool Get(SimDescription me, IMiniSimDescription actor, Dictionary <int, int> results) { int percent = (int)(me.AlienDNAPercentage * 100f) / 10; results[percent] = percent; return(true); }
public override bool Get(SimDescription me, IMiniSimDescription actor, Dictionary <OccupationNames, OccupationNames> results) { if (me.Household == null) { return(false); } if (me.CareerManager == null) { return(false); } School school = me.CareerManager.School; if (school != null) { results[school.Guid] = school.Guid; } else { if (SimTypes.IsSpecial(me)) { return(false); } if (me.YoungAdultOrAbove) { return(false); } results[OccupationNames.Undefined] = OccupationNames.Undefined; } return(true); }
public override bool Get(SimDescription me, IMiniSimDescription actor, Dictionary <OccupationNames, OccupationNames> results) { if (me.Household == null) { return(false); } if (me.CareerManager == null) { return(false); } if (me.CareerManager.QuitCareers == null) { return(false); } foreach (Occupation career in me.CareerManager.QuitCareers.Values) { if (career == null) { continue; } results[career.Guid] = career.Guid; } return(true); }
public static bool SimCanTextWithActorEx(Sim actor, IMiniSimDescription other, bool foreignText) { if (foreignText) { return(false); } SimDescription description = other as SimDescription; Sim target = (description != null) ? description.CreatedSim : null; if (target == null) { return(false); } if (actor.LotCurrent == target.LotCurrent) { return(false); } if (actor.SimDescription.IsEP11Bot) { if ((actor.TraitManager == null) || !actor.TraitManager.HasElement(TraitNames.CapacityToLoveChip)) { return(false); } if (description.IsEP11Bot && (description.CreatedSim.TraitManager == null || !description.CreatedSim.TraitManager.HasElement(TraitNames.CapacityToLoveChip))) { return(false); } } return(true); }
public override bool Get(SimDescription me, IMiniSimDescription actor, Dictionary <LongTermRelationshipTypes, string> results) { SimDescription actorSim = actor as SimDescription; if (actorSim == null) { return(false); } Relationship relation = Relationship.Get(me, actorSim, false); if (relation == null) { return(false); } LTRData data = LTRData.Get(relation.CurrentLTR); if (data != null) { results[relation.CurrentLTR] = data.GetName(me, actor); } return(true); }
protected override bool Allow(SimDescription me, IMiniSimDescription actor) { if (me.CareerManager != null) { DateAndTime TwoHourTime = SimClock.CurrentTime(); TwoHourTime.Ticks += SimClock.ConvertToTicks(2f, TimeUnit.Hours); if (me.Occupation != null) { if (me.Occupation.IsWorkHour(TwoHourTime)) { return(false); } } if (me.CareerManager.School != null) { if (me.CareerManager.School.IsWorkHour(TwoHourTime)) { return(false); } } } return(true); }
protected override bool Allow(SimDescription me, IMiniSimDescription actor) { if (me.Occupation == null) { return(false); } if (me.Occupation.Guid != mCareer.Guid) { return(false); } Career rabbitHoleCareer = mCareer as Career; if (rabbitHoleCareer != null) { CareerLocation testLoc = Career.FindClosestCareerLocation(me, mCareer.Guid); if (testLoc == null) { return(false); } } return(true); }
public static List <IDescendantHouseholdUiData> GetTimeAlamanacDescendantHouseholdData(FutureDescendantService instance) { // custom BuildDescendantHouseholdSpecs(instance); List <IDescendantHouseholdUiData> list = new List <IDescendantHouseholdUiData>(); List <ulong> remove = new List <ulong>(); foreach (ulong num in FutureDescendantService.sPersistableData.DescendantHouseholdsMap.Keys) { // Overwatch does this too but no harm in doing it here too if (SimDescription.Find(num) == null && MiniSims.Find(num) == null) { remove.Add(num); } FutureDescendantService.DescendantHouseholdUiData item = new FutureDescendantService.DescendantHouseholdUiData { mAncestorSimId = num }; int householdWealthScore = 0; int numberOfMembers = 0; bool flag = false; foreach (FutureDescendantService.FutureDescendantHouseholdInfo info in FutureDescendantService.sPersistableData.DescendantHouseholdsMap[num]) { if (remove.Contains(num) && info.IsSimAnAncestor(num)) { FutureDescendantService.sPersistableData.InvalidDescendantHouseholdsInfo.Add(info); flag = true; continue; } if (!info.HasAncestorFromHousehold(Household.ActiveHousehold)) { flag = true; continue; } foreach (ulong num4 in info.mHouseholdMembers) { IMiniSimDescription iMiniSimDescription = SimDescription.GetIMiniSimDescription(num4); if ((iMiniSimDescription != null) && !item.mHouseholdMembers.Contains(iMiniSimDescription)) { item.mHouseholdMembers.Add(iMiniSimDescription); } } householdWealthScore += info.mCurrentHouseholdWealthScore; numberOfMembers += info.mCurrentDesiredHouseholdSize; } householdWealthScore /= Math.Max(1, FutureDescendantService.sPersistableData.DescendantHouseholdsMap[num].Count); numberOfMembers /= Math.Max(1, FutureDescendantService.sPersistableData.DescendantHouseholdsMap[num].Count); item.mHouseholdWorth = FutureDescendantService.GetWealthTypeString(householdWealthScore); item.mHouseholdSize = FutureDescendantService.GetHouseholdSizeString(numberOfMembers); if (item != null && !flag) { list.Add(item); } } return(list); }
public FamilyTreeDialog(IMiniSimDescription sim) : base(sConstructorStub) { mSimTreeInfos.Clear(); mSimTreeInfoEx.Clear(); RefreshTree(sim); }
protected override bool Allow(SimDescription me, IMiniSimDescription actor) { if (!me.TeenOrAbove) return false; if (me.mGenderPreferenceMale <= 0) return false; return true; }
public static void CleanseGenealogy(IMiniSimDescription me) { Genealogy genealogy = me.CASGenealogy as Genealogy; if (genealogy != null) { genealogy.ClearAllGenealogyInformation(); } }
public override bool CanTextWithEachOther(Sim actor, IMiniSimDescription other, bool foreignText) { if (!Phone.SendTextBase.SimCanTextWithActor(actor, other, foreignText)) { return(false); } return(SendWooHootyTextEx.SimCanTextWithActorEx(actor, other, foreignText)); }
public override bool CanTextWithEachOther(Sim actor, IMiniSimDescription other, bool foreignText) { if (!Phone.SendTextBase.SimCanTextWithActor(actor, other, foreignText)) { return false; } return SendWooHootyTextEx.SimCanTextWithActorEx(actor, other, foreignText); }
public string GetDetails(IMiniSimDescription me) { string msg = null; try { msg = PersonalStatus.GetHeader(me); SimDescription simDesc = me as SimDescription; foreach (SimPersonality personality in SP::NRaas.StoryProgression.Main.Personalities.GetClanMembership(simDesc, true)) { msg += Common.NewLine + personality.GetLocalizedName(); if (personality.Me != null) { msg += Common.NewLine + Common.Localize("Personalities:Leader", personality.IsFemaleLocalization(), new object[] { personality.Me }); } int memberCount = personality.GetClanMembers(false).Count; if (memberCount > 0) { msg += Common.Localize("Personalities:Members", personality.IsFemaleLocalization(), new object[] { memberCount }); } Dictionary<SimDescription, bool> opponents = new Dictionary<SimDescription, bool>(); foreach (SimPersonality opponent in SP::NRaas.StoryProgression.Main.Personalities.AllPersonalities) { if (opponent.IsOpposing(personality)) { int count = 0; foreach (SimDescription sim in opponent.GetClanMembers(true)) { if (opponents.ContainsKey(sim)) continue; opponents.Add(sim, true); count++; } if (count > 0) { msg += Common.NewLine + Common.Localize(GetTitlePrefix() + ":Opposing", opponent.IsFemaleLocalization(), new object[] { opponent.GetLocalizedName(), count }); } } } } } catch (Exception e) { Common.Exception(me.FullName, e); msg += Common.NewLine + "END OF LINE"; } return msg; }
protected override bool Allow(MiniSimDescription me, IMiniSimDescription actor) { Genealogy genealogy = actor.CASGenealogy as Genealogy; if (genealogy == null) return false; if (me.Genealogy.IsSufficientlyRelatedToRuleOutRomance(genealogy)) return false; return true; }
protected override bool Allow(MiniSimDescription me, IMiniSimDescription actor) { Genealogy genealogy = actor.CASGenealogy as Genealogy; if (genealogy == null) return false; if (!me.Genealogy.IsBloodRelated(genealogy)) return false; return true; }
public override bool Get(SimDescription me, IMiniSimDescription actor, Dictionary <string, SimPersonality> results) { foreach (SimPersonality personality in SP::NRaas.StoryProgression.Main.Personalities.GetClanLeadership(me)) { results[GetName(personality)] = personality; } return(true); }
protected override bool Allow(SimDescription me, IMiniSimDescription actor) { if (me.CreatedSim == null) { return(false); } return(me.CreatedSim.DreamsAndPromisesManager != null); }
protected override bool Allow(MiniSimDescription me, IMiniSimDescription actor) { if (me.LastName == null) { return(false); } return(me.LastName.Trim().ToLower().StartsWith(mPrefix)); }
protected override bool Allow(SimDescription me, IMiniSimDescription actor) { SimDescription active = null; if (Sim.ActiveActor != null) { active = Sim.ActiveActor.SimDescription; } return (me == active); }
protected override bool AllowSpecies(IMiniSimDescription me) { if (Common.AssemblyCheck.IsInstalled("NRaasWoohooer")) { return true; } else { return me.IsHuman; } }
public override SimSelection.UpdateResult Update(IMiniSimDescription actor, IEnumerable<SimSelection.ICriteria> criteria, List<IMiniSimDescription> allSims, bool secondStage) { if (secondStage) return SimSelection.UpdateResult.Success; mPrefix = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Prompt", actor.IsFemale), ""); if (string.IsNullOrEmpty(mPrefix)) return SimSelection.UpdateResult.Failure; mPrefix = mPrefix.Trim().ToLower(); return base.Update(actor, criteria, allSims, secondStage); }
public string GetDetails(IMiniSimDescription mini) { SimDescription sim = mini as SimDescription; if (sim != null) { return NRaas.MasterControllerSpace.Households.StatusBase.GetDetails(sim.LotHome, sim.Household); } else { return null; } }
protected bool Prompt (IMiniSimDescription me) { if (!ApplyAll) { if (!AcceptCancelDialog.Show(Common.Localize("TotalAnnihilation:Prompt", me.IsFemale, new object[] { me }))) { return false; } } return true; }
private PartnerType GetPartnerType(IMiniSimDescription simA, IMiniSimDescription simB) { if ((simA.CASGenealogy.ISpouse != null) && (simA.CASGenealogy.ISpouse.IMiniSimDescription == simB)) { return simA.CASGenealogy.PartnerType; } IMiniSimDescription spouseA = FindDeadPartner(simA, false); if (spouseA != simB) { return PartnerType.None; } IMiniSimDescription spouseB = FindDeadPartner(simB, false); if (spouseB != simA) { return PartnerType.None; } SimDescription a = simA as SimDescription; SimDescription b = simB as SimDescription; if ((a != null) && (b != null)) { Relationship relation = Relationship.Get(a, b, false); if (relation == null) { return PartnerType.None; } else { switch (relation.CurrentLTR) { case LongTermRelationshipTypes.Ex: case LongTermRelationshipTypes.Partner: return PartnerType.BGFriend; case LongTermRelationshipTypes.ExSpouse: case LongTermRelationshipTypes.Spouse: return PartnerType.Marriage; case LongTermRelationshipTypes.Fiancee: return PartnerType.Fiance; default: return PartnerType.None; } } } return PartnerType.None; }
protected override int GetMaxSelectionB(IMiniSimDescription miniSim) { SimDescription sim = miniSim as SimDescription; if (sim == null) return 0; if (sim.Occupation == null) return 0; int count = 0; if (sim.Occupation.Coworkers != null) { count = sim.Occupation.Coworkers.Count; } return (sim.Occupation.MaxCoworkers - count); }
public static float GetCurrentAgeInDays(IMiniSimDescription sim) { float agingYears = 0; foreach (CASAgeGenderFlags age in GetAges(sim.Species)) { if (age >= sim.Age) continue; agingYears += AgingManager.GetAgingStageLength(sim.Species, age); } agingYears += sim.YearsSinceLastAgeTransition; return AgingManager.Singleton.AgingYearsToSimDays(agingYears); }
protected override bool Allow(SimDescription me, IMiniSimDescription actor) { if (actor is SimDescription) { return (me.Household == (actor as SimDescription).Household); } else if (actor is MiniSimDescription) { return (actor as MiniSimDescription).HouseholdMembers.Contains(me.SimDescriptionId); } else { return false; } }
// Retain private new FamilyTreeThumb CreateFamilyTreeThumb(IMiniSimDescription desc, Vector2 pos) { FamilyTreeThumb windowByExportID = UIManager.LoadLayout(ResourceKey.CreateUILayoutKey("HUDSimologyFamilyTreeThumbItem", 0x0)).GetWindowByExportID(0x1) as FamilyTreeThumb; //windowByExportID.SimDescription = desc; windowByExportID.mSimDesc = desc; UpdateThumb(windowByExportID); windowByExportID.Position = pos; mThumbParentWin.AddChild(windowByExportID); // Custom windowByExportID.MouseUp += OnFamilyTreeThumbClick; windowByExportID.TooltipText = desc.FullName; return windowByExportID; }
protected override bool Allow(SimDescription me, IMiniSimDescription actor) { SimDescription actorDesc = actor as SimDescription; if (actorDesc == null) return false; if (IsCoworker(actorDesc.Occupation, me)) { return true; } if ((actorDesc.CareerManager != null) && (IsCoworker(actorDesc.CareerManager.School, me))) { return true; } return false; }
protected override bool Allow(SimDescription me, IMiniSimDescription actor) { if (actor is SimDescription) { return (me.Household != (actor as SimDescription).Household); } else if (actor is MiniSimDescription) { MiniSimDescription miniSim = actor as MiniSimDescription; if (miniSim.HouseholdMembers == null) return false; return !miniSim.HouseholdMembers.Contains(me.SimDescriptionId); } else { return false; } }
protected override bool Allow(SimDescription me, IMiniSimDescription actor) { if (me.CreatedSim == null) return false; SimDescription actorDesc = actor as SimDescription; if (actorDesc == null) return false; if (actorDesc.CreatedSim == null) return false; if (mLot == null) { return (me.CreatedSim.LotCurrent == actorDesc.CreatedSim.LotCurrent); } else { return (me.CreatedSim.LotCurrent == mLot); } }
public static ThumbnailKey GetThumbnailKey(IMiniSimDescription ths, ThumbnailSize size, int thumbIndex) { try { if (ths == null) return ThumbnailKey.kInvalidThumbnailKey; MiniSimDescription miniSim = ths as MiniSimDescription; if (miniSim != null) { if (!ThumbnailManager.KeyExistsInDB(miniSim.mThumbKey)) { SimDescription sim = MiniSims.UnpackSim(miniSim); ThumbnailKey thumbnailKey = sim.GetThumbnailKey(ThumbnailSize.Large, 0x0); try { sim.Dispose(false, true); } catch (Exception e) { Common.Exception(sim, e); } return thumbnailKey; } return miniSim.mThumbKey; } else if ((ths.CASGenealogy == null) || (ths.CASGenealogy.IsAlive())) { return ths.GetThumbnailKey(size, thumbIndex); } else { return ths.GetDeceasedThumbnailKey(size, thumbIndex); } } catch (Exception e) { Common.Exception(ths.FullName, e); return ThumbnailKey.kInvalidThumbnailKey; } }
protected void GetAge(IMiniSimDescription me, out int age, out int maxAge) { 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; } maxAge = (int)AgingManager.Singleton.AgingYearsToSimDays(AgingManager.GetMaximumAgingStageLength(me)); age = (int)AgingManager.Singleton.AgingYearsToSimDays(agingYearsSinceLastAgeTransition); }
protected override bool Allow(SimDescription me, IMiniSimDescription actor) { if (me.CareerManager != null) { DateAndTime TwoHourTime = SimClock.CurrentTime(); TwoHourTime.Ticks += SimClock.ConvertToTicks(2f, TimeUnit.Hours); if (me.Occupation != null) { if (me.Occupation.IsWorkHour(TwoHourTime)) return false; } if (me.CareerManager.School != null) { if (me.CareerManager.School.IsWorkHour(TwoHourTime)) return false; } } return true; }
protected override bool Run(IMiniSimDescription me, bool singleSelection) { if (!base.Run(me, singleSelection)) return false; int age, maxAge; GetAge(me, out age, out maxAge); age = mAge; if (me.Age != CASAgeGenderFlags.Elder) { if (mAge > maxAge) { age = maxAge; } } AlterAge(me, age); return true; }
protected override bool Run(IMiniSimDescription me, bool singleSelection) { int age, maxAge; GetAge(me, out age, out maxAge); if (!ApplyAll) { string text = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Prompt", me.IsFemale, new object[] { me, maxAge }), age.ToString()); if (string.IsNullOrEmpty(text)) return false; mAge = 0; if (!int.TryParse(text, out mAge)) { SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error")); return false; } } return true; }