public static void WoohooDisgraceChecks(Sim actor, Sim target) { if (!WasWitnessed(actor, target, JealousyLevel.High, true)) { return; } if (actor.LotCurrent.IsCommunityLot) { DisgracefulActionEvent e = new DisgracefulActionEvent(EventTypeId.kSimCommittedDisgracefulAction, actor, DisgracefulActionType.WooHooInPublic); e.TargetId = target.SimDescription.SimDescriptionId; EventTracker.SendEvent(e); e = new DisgracefulActionEvent(EventTypeId.kSimCommittedDisgracefulAction, target, DisgracefulActionType.WooHooInPublic); e.TargetId = actor.SimDescription.SimDescriptionId; EventTracker.SendEvent(e); } OccultTypes currentOccultTypes = target.SimDescription.OccultManager.CurrentOccultTypes; OccultTypes types2 = actor.SimDescription.OccultManager.CurrentOccultTypes; List <KamaSimtra.OccultTypesEx> actorTypes = KamaSimtra.GetOccultType(actor.SimDescription, false); List <KamaSimtra.OccultTypesEx> targetTypes = KamaSimtra.GetOccultType(target.SimDescription, false); if (actorTypes.Count == 0) { if (targetTypes.Count > 0) { DisgracefulActionEvent event3 = new DisgracefulActionEvent(EventTypeId.kSimCommittedDisgracefulAction, actor, DisgracefulActionType.WooHooWithOccult); event3.TargetId = target.SimDescription.SimDescriptionId; EventTracker.SendEvent(event3); } } else if (targetTypes.Count == 0) { DisgracefulActionEvent event4 = new DisgracefulActionEvent(EventTypeId.kSimCommittedDisgracefulAction, target, DisgracefulActionType.WooHooWithOccult); event4.TargetId = actor.SimDescription.SimDescriptionId; EventTracker.SendEvent(event4); } }
public static ListenerAction OnFindSimCommittedDisgracefulAction(Event e) { if (CelebrityUtil.sCelebrityDisgracefulActionData == null) // EA Fail if not EP Installed. { return(ListenerAction.Keep); } try { DisgracefulActionEvent disgracefulActionEvent = e as DisgracefulActionEvent; if (disgracefulActionEvent == null) { return(ListenerAction.Keep); } Sim sim = disgracefulActionEvent.Actor as Sim; if (sim == null) { return(ListenerAction.Keep); } SimDescription findsim = sim.SimDescription; if (findsim == null) { return(ListenerAction.Keep); } if (findsim == null || !findsim.IsValid || !findsim.IsValidDescription || !findsim.IsCelebrity) { return(ListenerAction.Keep); } Household household = findsim.Household; if (household != null && household == Household.ActiveHousehold) { return(ListenerAction.Keep); } CelebrityManager celma = findsim.CelebrityManager; if (celma == null || CantBeDisgraced(celma)) { return(ListenerAction.Keep); } //SimDescription simDescription = sim.SimDescription; DisgracefulActionType disgracefulActionType = disgracefulActionEvent.DisgracefulActionType; CelebrityDisgracefulActionStaticData value; if (!CelebrityUtil.sCelebrityDisgracefulActionData.TryGetValue(disgracefulActionType, out value)) { return(ListenerAction.Keep); } if (celma.mDisgracefulActionQueue != null) { foreach (DisgracefulActionEvent item in celma.mDisgracefulActionQueue) { if (item.TargetId == disgracefulActionEvent.TargetId && item.DisgracefulActionType == disgracefulActionEvent.DisgracefulActionType) { return(ListenerAction.Keep); } } } if (RandomUtil.RandomChance01(value.Chance) || RandomUtil.RandomChance01(65)) { if (celma.mDisgracefulActionQueue == null) { celma.mDisgracefulActionQueue = new List <DisgracefulActionEvent>(); } celma.mDisgracefulActionQueue.Add(disgracefulActionEvent); sim.AddAlarm(30, TimeUnit.Minutes, delegate { try { STriggerDisgrace(celma); } catch (ResetException) { throw; } catch { } }, null, AlarmType.NeverPersisted); } } //catch (ResetException){ throw; } catch { } return(ListenerAction.Keep); }
public void TriggerDisgrace() { // Test New 96? CelebrityManager This = CelebrityManager_; Sim ownerSim = This.OwnerSim; BuffManager buffManager = This.OwnerSim.BuffManager; if (This.mDisgracefulActionQueue != null && This.mDisgracefulActionQueue.Count != 0) { DisgracefulActionEvent disgracefulActionEvent = This.mDisgracefulActionQueue[0]; DisgracefulActionType disgracefulActionType = disgracefulActionEvent.DisgracefulActionType; This.mDisgracefulActionQueue.Remove(disgracefulActionEvent); CelebrityDisgracefulActionStaticData value = null; if (!CantBeDisgraced(This) && CelebrityUtil.sCelebrityDisgracefulActionData.TryGetValue(disgracefulActionType, out value) /* || !(Sims3.Gameplay.Moded.DGSHelperCommands.kNoDisgracedInIsPlayer && (ownerSim.IsInActiveHousehold || ownerSim.IsSafeInActiveHousehold)) */) { buffManager.RemoveElement(BuffNames.PubliclyDisgraced); SimDescription simDescription = SimDescription.Find(disgracefulActionEvent.TargetId); bool flag = disgracefulActionType == DisgracefulActionType.Cheating && !ownerSim.HasTrait(TraitNames.NoJealousy); foreach (Relationship relationship in ownerSim.SocialComponent.Relationships) { if (relationship.SimDescriptionB != simDescription) { if (flag && relationship.AreRomantic()) { Sim createdSim = relationship.SimDescriptionB.CreatedSim; if (createdSim != null) { SocialComponent.OnIWasCheatedOn(createdSim, ownerSim.SimDescription, simDescription, JealousyLevel.Medium); } } relationship.LTR.UpdateLiking(0f - CelebrityManager.kLTRLostFromDisgrace); } } if (value != null) { buffManager.AddElement(BuffNames.PubliclyDisgraced, value.DisgracedOrigin); } else { buffManager.AddElement(BuffNames.PubliclyDisgraced, Origin.FromFalselyAccused); } if (value != null && value.DisgracedOrigin == Origin.FromFalselyAccused) { ownerSim.CelebrityManager.IncrementFalselyAccused(); } else { ownerSim.CelebrityManager.IncrementPubliclyDisgraced(); } if (value != null) { ownerSim.ShowTNSAndPlayStingIfSelectable("sting_generic_tragic", value.TnsId, null, ownerSim, null, null, new bool[1] { ownerSim.IsFemale }, ownerSim.IsFemale, ownerSim); } } } }
public ListenerAction OnSimCommittedDisgracefulAction(Event e) { if (CelebrityUtil.sCelebrityDisgracefulActionData == null) // EA Fail if not Installed. { return(ListenerAction.Remove); } if (CelebrityManager_ == null) { return(ListenerAction.Remove); } if (CantBeDisgraced(CelebrityManager_)) { return(ListenerAction.Keep); } DisgracefulActionEvent disgracefulActionEvent = e as DisgracefulActionEvent; if (disgracefulActionEvent == null) { return(ListenerAction.Keep); } Sim sim = disgracefulActionEvent.Actor as Sim; if (sim == null) { return(ListenerAction.Keep); } SimDescription simDescription = sim.SimDescription; if (simDescription == null || !simDescription.IsValid || !simDescription.IsValidDescription) { return(ListenerAction.Keep); } DisgracefulActionType disgracefulActionType = disgracefulActionEvent.DisgracefulActionType; CelebrityDisgracefulActionStaticData value; if (!CelebrityUtil.sCelebrityDisgracefulActionData.TryGetValue(disgracefulActionType, out value)) { return(ListenerAction.Keep); } if (CelebrityManager_.mDisgracefulActionQueue != null) { foreach (DisgracefulActionEvent item in CelebrityManager_.mDisgracefulActionQueue) { if (item.TargetId == disgracefulActionEvent.TargetId && item.DisgracefulActionType == disgracefulActionEvent.DisgracefulActionType) { return(ListenerAction.Keep); } } } if (RandomUtil.RandomChance01(value.Chance)) { if (CelebrityManager_.mDisgracefulActionQueue == null) { CelebrityManager_.mDisgracefulActionQueue = new List <DisgracefulActionEvent>(); } CelebrityManager_.mDisgracefulActionQueue.Add(disgracefulActionEvent); sim.AddAlarm(CelebrityManager.kDelayBeforeDisgracefulActionIsKnown, TimeUnit.Minutes, TriggerDisgrace, "CelebrityManager: Disgrace delay alarm", AlarmType.AlwaysPersisted); } return(ListenerAction.Keep); }
protected override void OnPerform() { try { mScenario.IncStat("TriggerDisgraceTask"); CelebrityManager manager = mScenario.Sim.CelebrityManager; if ((manager.mDisgracefulActionQueue == null) || (manager.mDisgracefulActionQueue.Count == 0x0)) { mScenario.IncStat("DisgraceTask: No Task Event"); return; } CelebrityDisgracefulActionStaticData data; DisgracefulActionEvent item = manager.mDisgracefulActionQueue[0x0]; manager.mDisgracefulActionQueue.Remove(item); DisgracefulActionType disgracefulActionType = item.DisgracefulActionType; if (manager.CantBeDisgraced()) { mScenario.IncStat("DisgraceTask: Not Disgracable"); return; } if (!CelebrityUtil.sCelebrityDisgracefulActionData.TryGetValue(disgracefulActionType, out data)) { mScenario.IncStat("DisgraceTask: No Task Data"); return; } BuffManager buffManager = null; if (mScenario.Sim.CreatedSim != null) { buffManager = mScenario.Sim.CreatedSim.BuffManager; } if (buffManager != null) { buffManager.RemoveElement(BuffNames.PubliclyDisgraced); } SimDescription otherNaughty = ManagerSim.Find(item.TargetId); bool flag = (disgracefulActionType == DisgracefulActionType.Cheating) && !mScenario.Sim.TraitManager.HasElement(TraitNames.NoJealousy); int change = NRaas.StoryProgression.Main.GetValue <RelationshipChangeOption, int>(); if (change > 0) { change = 0; } foreach (Relationship relationship in Relationship.Get(mScenario.Sim)) { SimDescription other = relationship.GetOtherSimDescription(mScenario.Sim); if (other == otherNaughty) { continue; } if (other.ToddlerOrBelow) { continue; } bool testFriendship = true; if (!mScenario.Cares(other, disgracefulActionType, mScenario.GetValue <RelationDropChanceOption, int>(), out testFriendship)) { mScenario.IncStat("DisgraceTask: Sim Doesn't Care"); continue; } if (flag && relationship.AreRomantic()) { Sim createdSim = other.CreatedSim; if (createdSim != null) { SocialComponent.OnIWasCheatedOn(createdSim, mScenario.Sim, otherNaughty, JealousyLevel.Medium); } } if (relationship.AreFriends()) { mScenario.AddScoring("DisgraceTask: Relation Change", change); relationship.LTR.UpdateLiking(change); } } if (buffManager != null) { buffManager.AddElement(BuffNames.PubliclyDisgraced, data.DisgracedOrigin); } if (data.DisgracedOrigin == Origin.FromFalselyAccused) { manager.IncrementFalselyAccused(); } else { manager.IncrementPubliclyDisgraced(); } Sim sim = mScenario.Sim.CreatedSim; if (sim != null) { mScenario.IncStat("DisgraceTask: Display Message"); sim.ShowTNSAndPlayStingIfSelectable("sting_generic_tragic", data.TnsId, null, sim, null, null, new bool[] { mScenario.Sim.IsFemale }, mScenario.Sim.IsFemale, new object[] { sim }); } } catch (Exception e) { Common.Exception(mScenario.Sim, e); } }
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); } } }