public void OnWorldQuit() { if (Settings.Debugging) { WoohooScoring.Dump(true); } }
public static bool NeedPrivacy(bool inherent, Sim actor, Sim target) { if (inherent) { return(false); } else if (Woohooer.Settings.mEnforcePrivacy) { return(true); } else if ((Woohooer.Settings.mTraitScoredPrivacy) && (Woohooer.Settings.UsingTraitScoring)) { if ((!WoohooScoring.TestScoringNormal(actor, target, "Privacy", false)) && (!WoohooScoring.TestScoringNormal(target, actor, "Privacy", false))) { return(false); } return(true); } else { return(false); } }
protected override OptionResult Run(GameHitParameters <GameObject> parameters) { ScoringLookup.UnloadCaches(false); WoohooScoring.Dump(true); return(OptionResult.SuccessRetain); }
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 bool OnScoreInsulting(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { try { return(WoohooScoring.ScoreInsulting(actor, target, Common.IsAutonomous(actor), "InterestInWoohoo")); } catch (Exception e) { Common.Exception(actor, target, e); return(false); } }
protected override OptionResult Run(GameHitParameters <GameObject> parameters) { WoohooScoring.Dump(false); return(OptionResult.SuccessRetain); }
public static bool SatisfiesTryForBaby(Sim actor, Sim target, string logName, bool isAutonomous, bool scoreTarget, ref GreyedOutTooltipCallback callback) { using (Common.TestSpan span = new Common.TestSpan(ScoringLookup.Stats, "Duration " + logName, Common.DebugLevel.Stats)) { int speciesIndex = PersistedSettings.GetSpeciesIndex(actor); if (isAutonomous) { if (!Woohooer.Settings.mTryForBabyAutonomousV2[speciesIndex]) { return(false); } if (!Woohooer.Settings.mAllowOffLotTryForBabyAutonomous[speciesIndex]) { if (actor.LotCurrent != Household.ActiveHousehold.LotHome) { return(false); } } } if ((!scoreTarget) && (!CommonWoohoo.SatisfiesUserLikingGate(actor, target, isAutonomous, true, logName))) { callback = Common.DebugTooltip("Liking Gate Fail"); return(false); } if (!CommonSocials.SatisfiedInteractionLevel(actor, target, isAutonomous, ref callback)) { return(false); } if (!WoohooInteractionLevelSetting.Satisfies(actor, target, true)) { ScoringLookup.IncStat(logName + " Interaction Level Fail"); callback = Common.DebugTooltip("Interaction Level Fail"); return(false); } if (!CommonWoohoo.SatisfiesCooldown(actor, target, isAutonomous, ref callback)) { return(false); } string reason; if (!CanTryForBaby(actor, target, isAutonomous, CommonWoohoo.WoohooStyle.TryForBaby, ref callback, out reason)) { ScoringLookup.IncStat(logName + " " + reason); return(false); } WoohooScoring.ScoreTestResult result = WoohooScoring.ScoreActor(logName, actor, target, isAutonomous, "InterestInTryForBaby", true); if (result != WoohooScoring.ScoreTestResult.Success) { ScoringLookup.IncStat(logName + " " + result); callback = Common.DebugTooltip("Actor Scoring Fail " + result); return(false); } if (scoreTarget) { result = WoohooScoring.ScoreTarget(logName, target, actor, isAutonomous, "InterestInTryForBaby", true); if (result != WoohooScoring.ScoreTestResult.Success) { ScoringLookup.IncStat(logName + " " + result); callback = Common.DebugTooltip("Target Scoring Fail " + result); return(false); } } ScoringLookup.IncStat(logName + " Success"); return(true); } }
public static bool SatisfiesWoohoo(Sim actor, Sim target, string logName, bool isAutonomous, bool scoreTarget, bool testLiking, ref GreyedOutTooltipCallback callback) { using (Common.TestSpan span = new Common.TestSpan(ScoringLookup.Stats, "Duration " + logName, Common.DebugLevel.Stats)) { if (isAutonomous) { if (!Woohooer.Settings.mWoohooAutonomousV2[PersistedSettings.GetSpeciesIndex(actor)]) { callback = Common.DebugTooltip("Autonomous Denied"); ScoringLookup.IncStat(logName + " Autonomous Denied"); return(false); } } if (!Woohooer.Settings.mAllowZombie) { if ((actor.SimDescription.IsZombie) || (target.SimDescription.IsZombie)) { callback = Common.DebugTooltip("Zombie"); ScoringLookup.IncStat(logName + " Zombie"); return(false); } } if (testLiking) { if (Woohooer.Settings.mHideWoohoo) { callback = Common.DebugTooltip("Hide Woohoo"); ScoringLookup.IncStat(logName + " Hide Woohoo"); return(false); } if ((!scoreTarget) && (!SatisfiesUserLikingGate(actor, target, isAutonomous, true, logName))) { callback = Common.DebugTooltip("Liking Gate Fail"); ScoringLookup.IncStat(logName + " Liking Gate Fail"); return(false); } if (!WoohooInteractionLevelSetting.Satisfies(actor, target, true)) { ScoringLookup.IncStat(logName + " Interaction Level Fail"); callback = Common.DebugTooltip("Interaction Level Fail"); return(false); } } if (!CommonSocials.SatisfiedInteractionLevel(actor, target, isAutonomous, ref callback)) { ScoringLookup.IncStat(logName + " InteractionLevel Fail"); return(false); } if (!SatisfiesCooldown(actor, target, isAutonomous, ref callback)) { ScoringLookup.IncStat(logName + " Cooldown Fail"); return(false); } string reason; if (!CommonSocials.CanGetRomantic(actor, target, isAutonomous, true, testLiking, ref callback, out reason)) { ScoringLookup.IncStat(logName + " " + reason); return(false); } WoohooScoring.ScoreTestResult result = WoohooScoring.ScoreActor(logName, actor, target, isAutonomous, "InterestInWoohoo", true); if (result != WoohooScoring.ScoreTestResult.Success) { ScoringLookup.IncStat(logName + " " + result); callback = Common.DebugTooltip("Actor Scoring Fail " + result); return(false); } if (scoreTarget) { result = WoohooScoring.ScoreTarget(logName, target, actor, isAutonomous, "InterestInWoohoo", true); if (result != WoohooScoring.ScoreTestResult.Success) { ScoringLookup.IncStat(logName + " " + result); callback = Common.DebugTooltip("Target Scoring Fail " + result); return(false); } } ScoringLookup.IncStat(logName + " Success"); return(true); } }
protected static void OnRecalulateDesire() { try { List <Sim> sims = new List <Sim>(); foreach (Sim sim in LotManager.Actors) { try { if (sim.InteractionQueue == null) { continue; } if (sim.InteractionQueue.GetCurrentInteraction() is SocialInteraction) { continue; } if (sim.Autonomy == null) { continue; } if (sim.Autonomy.SituationComponent == null) { continue; } if (sim.Autonomy.SituationComponent.mSituations == null) { continue; } if (sim.Autonomy.SituationComponent.mSituations.Count > 0) { ScoringLookup.IncStat("STC Desire In Situation"); continue; } sims.Add(sim); } catch (Exception e) { Common.Exception(sim, e); } } foreach (Sim sim in sims) { try { SocialComponent social = sim.SocialComponent; if (social == null) { continue; } social.mShortTermDesireToSocializeWith.Clear(); if (!Woohooer.Settings.UsingTraitScoring) { continue; } if (sim.Autonomy.Actor == null) { continue; } if (!sim.Autonomy.ShouldRunLocalAutonomy) { continue; } if (sim.LotCurrent == null) { continue; } if (sim.LotCurrent.IsWorldLot) { continue; } SpeedTrap.Sleep(); if (!WoohooScoring.TestScoringNormal(sim, null, "InterestInRomance", true)) { ScoringLookup.IncStat("STC Desire Fail"); continue; } ScoringLookup.IncStat("STC Desire Success"); List <Sim> others = new List <Sim>(sim.LotCurrent.GetAllActors()); foreach (Sim other in others) { if (sim == other) { continue; } string reason; GreyedOutTooltipCallback callback = null; if (!CommonSocials.CanGetRomantic(sim, other, true, false, true, ref callback, out reason)) { continue; } int std = (int)(RelationshipEx.GetAttractionScore(sim.SimDescription, other.SimDescription, false) * 2); ScoringLookup.AddStat("Desire " + sim.FullName, std); social.AddShortTermDesireToSocializeWith(other, std); SpeedTrap.Sleep(); } } catch (Exception e) { Common.Exception(sim, e); } } } catch (Exception e) { Common.Exception("STCDesire:OnRecalculateDesire", e); } }