public static void ReactToJealousEvent(Sim s, ReactionBroadcaster rb, JealousyLevel level, bool woohoo) { try { if (!WoohooScoring.ReactsToJealousy(s)) { return; } Sim broadcastingObject = rb.BroadcastingObject as Sim; if (broadcastingObject == null) { return; } if (broadcastingObject.CurrentInteraction == null) { return; } Sim target = null; IWooHooDefinition definition = broadcastingObject.CurrentInteraction.InteractionDefinition as IWooHooDefinition; if (definition != null) { target = definition.ITarget(broadcastingObject.CurrentInteraction); } if (target == null) { target = broadcastingObject.SynchronizationTarget; } if (target == null) { Woohooer.DebugNotify("Bad Target"); return; } if (CommonSocials.CaresAboutJealousy(broadcastingObject, target, s, level, woohoo)) { if ((s != broadcastingObject) && (s != target)) { if ((target != null) && (!SocialComponentEx.CheckCheating(s, broadcastingObject, target, level)) && (!broadcastingObject.CurrentInteraction.IsRejected)) { SocialComponentEx.CheckCheating(s, target, broadcastingObject, level); } } } } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(s, e); } }
public static void ReactToJealousEventMedium(Sim s, ReactionBroadcaster rb) { JealousyLevel level = JealousyLevel.Medium; if (level > Woohooer.Settings.mRomanceJealousyLevel) { level = Woohooer.Settings.mRomanceJealousyLevel; } ReactToJealousEvent(s, rb, level, false); }
public static void ReactToJealousEvent(Sim s, ReactionBroadcaster rb, JealousyLevel level, bool woohoo) { try { if (!WoohooScoring.ReactsToJealousy(s)) return; Sim broadcastingObject = rb.BroadcastingObject as Sim; if (broadcastingObject == null) return; if (broadcastingObject.CurrentInteraction == null) { return; } Sim target = null; IWooHooDefinition definition = broadcastingObject.CurrentInteraction.InteractionDefinition as IWooHooDefinition; if (definition != null) { target = definition.ITarget(broadcastingObject.CurrentInteraction); } if (target == null) { target = broadcastingObject.SynchronizationTarget; } if (target == null) { Woohooer.DebugNotify("Bad Target"); return; } if (CommonSocials.CaresAboutJealousy(broadcastingObject, target, s, level, woohoo)) { if ((s != broadcastingObject) && (s != target)) { if ((target != null) && (!SocialComponentEx.CheckCheating(s, broadcastingObject, target, level)) && (!broadcastingObject.CurrentInteraction.IsRejected)) { SocialComponentEx.CheckCheating(s, target, broadcastingObject, level); } } } } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(s, e); } }
private static bool WasWitnessed(Sim actor, Sim target, JealousyLevel level, bool woohoo) { foreach (Sim sim in actor.LotCurrent.GetAllActors()) { if (sim == actor) { continue; } if (sim == target) { continue; } if (CommonSocials.CaresAboutJealousy(actor, target, sim, level, woohoo)) { return(true); } } return(false); }
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); }
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; }
public static void SendCheatingEvents(Sim actor, Sim target, bool witnessed, JealousyLevel level, bool wasAccepted) { if (!witnessed) return; if ((actor.Partner != null) && (actor.Partner != target.SimDescription)) { if (!CommonSocials.IsPolyamorous(actor.SimDescription, target.SimDescription, actor.Partner)) { DisgracefulActionEvent e = new DisgracefulActionEvent(EventTypeId.kSimCommittedDisgracefulAction, actor, DisgracefulActionType.Cheating); e.TargetId = target.SimDescription.SimDescriptionId; EventTracker.SendEvent(e); } } if (((target.Partner != null) && (target.Partner != actor.SimDescription)) && wasAccepted) { if (!CommonSocials.IsPolyamorous(target.SimDescription, actor.SimDescription, target.Partner)) { DisgracefulActionEvent event3 = new DisgracefulActionEvent(EventTypeId.kSimCommittedDisgracefulAction, target, DisgracefulActionType.Cheating); event3.TargetId = actor.SimDescription.SimDescriptionId; EventTracker.SendEvent(event3); } } }
public static bool CaresAboutJealousy(Sim actor, Sim target, Sim witness, JealousyLevel level, bool woohoo) { if (actor.HasTrait(TraitNames.NoJealousy)) return false; if (target.HasTrait(TraitNames.NoJealousy)) return false; if (CommonSocials.IsPolyamorous(actor.SimDescription, target.SimDescription, witness.SimDescription)) return false; foreach (Situation situation in actor.Autonomy.SituationComponent.Situations) { if (situation.DoesSituationRuleOutJealousy(witness, actor, target, level)) { return false; } } if (witness.RoomId == actor.RoomId) { return true; } else if (woohoo) { if (witness.IsOutside != actor.IsOutside) { return false; } else { int diff = witness.Level - actor.Level; if (diff < 0) { diff = -diff; } if ((actor.Level < 0) && (diff > 0)) { return false; } else if ((actor.Level >= 0) && (diff > 1)) { return false; } else if (witness.CurrentInteraction is ISleeping) { return witness.TraitManager.HasElement(TraitNames.LightSleeper); } else { return true; } } } else { return false; } }