public static void MergeTravelInformation(SimDescription ths, MiniSimDescription msd, Dictionary <ulong, SimDescription> allSims) { Common.StringBuilder msg = new Common.StringBuilder("MergeTravelInformation " + ths.FullName + Common.NewLine); msg += "A"; Traveler.InsanityWriteLog(msg); foreach (MiniRelationship relationship in msd.MiniRelationships) { SimDescription y = null; if (!allSims.TryGetValue(relationship.SimDescriptionId, out y)) { y = SimDescription.Find(relationship.SimDescriptionId); } if (y != null) { Relationship unsafely = null; try { unsafely = Relationship.GetUnsafely(ths, y); } catch (Exception e) { Common.Exception(ths, e); } if (unsafely != null) { float change = relationship.Value - unsafely.LTR.Liking; if (change != 0f) { unsafely.LTR.UpdateLiking(change); } RomanceVisibilityState.MergeTravelInformationOnTravelBackHome(relationship, unsafely); } } } msg += "B"; Traveler.InsanityWriteLog(msg); ths.CASGenealogy = msd.CASGenealogy; AgingCheckTask.Add(ths, msd); msg += "C"; Traveler.InsanityWriteLog(msg); }
public static bool CheckCheating(Sim observer, Sim actor, Sim target, JealousyLevel jealousyLevel) { if (CommonSocials.IsPolyamorous(actor.SimDescription, target.SimDescription, observer.SimDescription)) { return(false); } if (target.HasTrait(TraitNames.NoJealousy)) { return(false); } if (!actor.HasTrait(TraitNames.NoJealousy) && (jealousyLevel != JealousyLevel.None)) { foreach (Situation situation in actor.Autonomy.SituationComponent.Situations) { if (situation.DoesSituationRuleOutJealousy(observer, actor, target, jealousyLevel)) { return(false); } } Relationship relationship = Relationship.Get(observer, actor, false); if (relationship != null) { if (!LTRData.Get(relationship.LTR.CurrentLTR).IsRomantic) { if ((actor.Partner != null) && (actor.Partner != target.SimDescription)) { bool flag = observer.Genealogy.IsBloodRelated(actor.Partner.Genealogy); Relationship relationship2 = Relationship.Get(observer.SimDescription, actor.Partner, false); if (relationship2 != null) { LTRData data2 = LTRData.Get(relationship2.LTR.CurrentLTR); flag |= data2.IsFriendly; } if (flag) { SocialComponent.OnSomeoneICareAboutWasCheatedOn(observer, actor.Partner, actor.SimDescription, target.SimDescription, jealousyLevel); return(true); } } } else { // Custom switch (jealousyLevel) { case JealousyLevel.Medium: case JealousyLevel.High: GreyedOutTooltipCallback greyedOutTooltipCallback = null; if (CommonSocials.TestAllowBreakup(actor, true, ref greyedOutTooltipCallback)) { RomanceVisibilityState.PushAccuseSimOfBetrayal(observer, actor); } return(true); } LongTermRelationshipTypes longTermRelationship = Relationship.GetLongTermRelationship(observer, actor); SocialComponent.PlayReactionAndUpdateRelationshipOnJealousy(observer, actor.SimDescription, target.SimDescription, jealousyLevel); LongTermRelationshipTypes currentLTR = Relationship.GetLongTermRelationship(observer, actor); SocialComponent.SetSocialFeedback(CommodityTypes.Insulting, observer, false, 0x0, longTermRelationship, currentLTR); return(true); } } } return(false); }
private static bool FindCallParticipants(float minLtr, out Sim callee, out SimDescription caller, Phone.RandomCallType callType) { callee = null; caller = null; if ((Sim.ActiveActor != null) && (Sim.ActiveActor.Household != null)) { List <Phone.CallCandidate> randomList = new List <Phone.CallCandidate>(); foreach (Sim sim in Sim.ActiveActor.Household.Sims) { SimDescription simDescription = sim.SimDescription; foreach (object obj2 in Phone.Call.GetAppropriateCallers(sim, minLtr, callType == Phone.RandomCallType.kBoardingSchool)) { int num; float num2; SimDescription description2 = (SimDescription)obj2; if ((Phone.Call.IsSimAvailableForCall(description2, out num, out num2) == Phone.Call.SimAvailability.Available) && (((callType != Phone.RandomCallType.kInviteOver) || (description2.CreatedSim == null)) || description2.CreatedSim.IsAtHome)) { float weight = 0f; bool flag = false; switch (callType) { case Phone.RandomCallType.kSuggestBachelorParty: flag = BachelorParty.IsAvailableToHaveBachelorPartySuggested(sim); if (flag) { weight = BachelorParty.GetWeightToPlaceSuggestBachelorPartyCall(simDescription, description2); } break; case Phone.RandomCallType.kAskToProm: if ((PromSituation.IsGoingToProm(sim) && !PromSituation.HasPromDate(sim)) && !PromSituation.HasPromDate(description2)) { // Custom string reason; if (CommonSocials.CanGetRomantic(sim.SimDescription, description2, out reason)) { weight = RomanceVisibilityState.GetWeightToPlaceCallOrInviteOver(simDescription, description2); flag = true; } } break; case Phone.RandomCallType.kBoardingSchool: if (description2.IsEnrolledInBoardingSchool()) { weight = BoardingSchool.GetWeightToPlaceBoardingSchoolCall(simDescription, description2); flag = true; } break; default: weight = RomanceVisibilityState.GetWeightToPlaceCallOrInviteOver(simDescription, description2); flag = true; break; } if (flag) { randomList.Add(new Phone.CallCandidate(sim, description2, weight)); } } } } if (randomList.Count > 0x0) { Phone.CallCandidate weightedRandomObjectFromList = RandomUtil.GetWeightedRandomObjectFromList(randomList); callee = weightedRandomObjectFromList.Callee; caller = weightedRandomObjectFromList.Caller; return(true); } } return(false); }