Example #1
0
        public static void OnAccept(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i)
        {
            try
            {
                ScoringLookup.IncStat("OnAccept Woohoo");

                if (Common.kDebugging)
                {
                    Woohooer.DebugNotify("Woohoo" + Common.NewLine + actor.FullName + Common.NewLine + target.FullName, actor, target);
                }

                WooHooSocialInteraction woohooSocial = i as WooHooSocialInteraction;
                if (woohooSocial != null)
                {
                    woohooSocial.PushWooHoo(actor, target);
                }
                else
                {
                    new CommonWoohoo.PushWoohoo(actor, target, i.Autonomous, CommonWoohoo.WoohooStyle.Safe);
                }
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
            }
        }
Example #2
0
        public static bool ScoreInsulting(Sim actor, Sim target, bool isAutonomous, string scoring)
        {
            ScoringLookup.IncStat("OnScoreInsulting Try");

            if (!isAutonomous)
            {
                if (!Woohooer.Settings.TraitScoringForUserDirected)
                {
                    ScoringLookup.IncStat("OnScoreInsulting Not User TraitScored");
                    return(false);
                }
            }

            if (!Woohooer.Settings.UsingTraitScoring)
            {
                ScoringLookup.IncStat("OnScoreInsulting Not TraitScored");
                return(false);
            }

            // Target is not interested and is not attracted to sim

            if (!TestScoringAbsolute(target, actor, scoring, true))
            {
                if (!TestScoringAbsolute(target, actor, "Attraction", false))
                {
                    ScoringLookup.IncStat("OnScoreInsulting Attraction");
                    return(true);
                }
            }

            ScoringLookup.IncStat("OnScoreInsulting Fail");
            return(false);
        }
Example #3
0
        public static bool SatisfiesUserLikingGate(Sim actor, Sim target, bool isAutonomous, bool woohoo, string logName)
        {
            if ((isAutonomous) || (Woohooer.Settings.mLikingGateForUserDirected))
            {
                if (!CommonSocials.SatisfiesLikingGate(actor, target, woohoo))
                {
                    ScoringLookup.IncStat(logName + " LikingGate");
                    return(false);
                }
                else
                {
                    Relationship relation = Relationship.Get(actor, target, false);
                    if (relation != null)
                    {
                        if ((relation.CurrentSTC != ShortTermContextTypes.Hot) && (relation.CurrentSTC != AmorousCommodity.sHot2))
                        {
                            ScoringLookup.IncStat(logName + " STC Fail " + relation.CurrentSTC);
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
Example #4
0
        public static bool PublicTest(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
        {
            if (!CommonTest(actor, target, ref greyedOutTooltipCallback))
            {
                return(false);
            }

            ScoringLookup.IncStat("OnTest Woohoo Try");

            return(CommonWoohoo.SatisfiesWoohoo(actor, target, "OnTest Woohoo", isAutonomous, false, true, ref greyedOutTooltipCallback));
        }
Example #5
0
        public static bool PublicTest(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
        {
            if (!SimWoohoo.CommonTest(actor, target, ref greyedOutTooltipCallback))
            {
                return(false);
            }

            ScoringLookup.IncStat("OnTest TryForBaby Try");

            return(CommonPregnancy.SatisfiesTryForBaby(actor, target, "OnTest TryForBaby", isAutonomous, false, ref greyedOutTooltipCallback));
        }
Example #6
0
        public static bool ScoreFriendly(Sim actor, Sim target, bool isAutonomous, string scoring)
        {
            ScoringLookup.IncStat("OnScoreFriendly Try");

            if (!isAutonomous)
            {
                if (!Woohooer.Settings.TraitScoringForUserDirected)
                {
                    ScoringLookup.IncStat("OnScoreFriendly Not User TraitScored");
                    return(true);
                }
            }

            if (!Woohooer.Settings.UsingTraitScoring)
            {
                ScoringLookup.IncStat("OnScoreFriendly Not TraitScored");
                return(true);
            }

            // Both sims interested and attracted to each other

            if (!TestScoringAbsolute(target, actor, scoring, true))
            {
                ScoringLookup.IncStat("OnScoreFriendly " + scoring);
                return(false);
            }

            if (!TestScoringAbsolute(target, actor, "Attraction", false))
            {
                ScoringLookup.IncStat("OnScoreFriendly Attraction");
                return(false);
            }

            if (!IsSafeFromJealousy(target, actor, true))
            {
                ScoringLookup.IncStat("OnScoreFriendly Jealousy");
                return(false);
            }

            ScoringLookup.IncStat("OnScoreFriendly Success");

            return(true);
        }
Example #7
0
        public static bool ScoreCreepy(Sim actor, Sim target, bool isAutonomous, string scoring, string title)
        {
            ScoringLookup.IncStat(title + " Try");

            if (!isAutonomous)
            {
                if (!Woohooer.Settings.TraitScoringForUserDirected)
                {
                    ScoringLookup.IncStat(title + " Not User TraitScored");
                    return(false);
                }
            }

            if (!Woohooer.Settings.UsingTraitScoring)
            {
                ScoringLookup.IncStat(title + " Not TraitScored");
                return(false);
            }

            // Target is not attracted to Actor

            /*
             * if (!TestScoringAbsolute(target, actor, scoring, true))
             * {
             *  ScoringLookup.IncStat(title + " " + scoring);
             *  return true;
             * }
             */

            if (!TestScoringAbsolute(target, actor, "Attraction", false))
            {
                ScoringLookup.IncStat(title + " Attraction");
                return(true);
            }

            ScoringLookup.IncStat(title + " Fail");
            return(false);
        }
Example #8
0
        public static bool ScoreAwkward(Sim actor, Sim target, bool isAutonomous, string scoring)
        {
            ScoringLookup.IncStat("OnScoreAwkward Try");

            if (!isAutonomous)
            {
                if (!Woohooer.Settings.TraitScoringForUserDirected)
                {
                    ScoringLookup.IncStat("OnScoreAwkward Not User TraitScored");
                    return(false);
                }
            }

            if (!Woohooer.Settings.UsingTraitScoring)
            {
                ScoringLookup.IncStat("OnScoreAwkward Not TraitScored");
                return(false);
            }

            // Target is not interested

            if (!TestScoringAbsolute(target, actor, scoring, true))
            {
                ScoringLookup.IncStat("OnScoreAwkward " + scoring);
                return(true);
            }

            /*
             * if (!TestScoringAbsolute(target, actor, "Attraction", false))
             * {
             *  ScoringLookup.IncStat("OnScoreAwkward Attraction");
             *  return true;
             * }
             */

            ScoringLookup.IncStat("OnScoreAwkward Fail");
            return(false);
        }
Example #9
0
            protected override void OnPerform()
            {
                WoohooLocationControl location = null;

                if (mObject == null)
                {
                    mObject = GetRandomObject(mActor.SimDescription, out location);
                }

                if ((mObject == null) || (location == null))
                {
                    return;
                }

                InteractionDefinition interaction = location.GetInteraction(mActor, mTarget, mStyle);

                if (interaction != null)
                {
                    IWooHooDefinition woohooDefinition = interaction as IWooHooDefinition;
                    if (woohooDefinition != null)
                    {
                        woohooDefinition.Attempts = mAttempts;
                    }

                    InteractionInstance instance = interaction.CreateInstance(mObject, mActor, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true);

                    if ((mActor.InteractionQueue != null) && (mActor.InteractionQueue.Add(instance)))
                    {
                        ScoringLookup.IncStat("Push Success " + location + " " + mStyle);
                    }
                    else
                    {
                        ScoringLookup.IncStat("Push Fail " + location + " " + mStyle);
                    }
                }
            }
Example #10
0
        public static ScoreTestResult ScoreTarget(string logName, Sim actor, Sim target, bool isAutonomous, string scoring, bool woohoo, bool checkLiking)
        {
            if ((isAutonomous) || (checkLiking))
            {
                if (!CommonSocials.SatisfiesLikingGate(actor, target, woohoo))
                {
                    return(ScoreTestResult.LikingGate);
                }
            }

            if (!Woohooer.Settings.UsingTraitScoring)
            {
                return(ScoreTestResult.Success);
            }

            if (!isAutonomous)
            {
                if (!Woohooer.Settings.TraitScoringForUserDirected)
                {
                    return(ScoreTestResult.Success);
                }
            }

            ScoringLookup.IncStat("OnScoreTarget " + logName + " Try");

            if (!IsSafeFromJealousy(actor, target, woohoo))
            {
                ScoringLookup.IncStat("OnScoreTarget " + logName + " Jealousy");
                return(ScoreTestResult.Jealousy);
            }

            bool success = false;

            if ((actor.Partner == target.SimDescription) || (target.Partner == actor.SimDescription))
            {
                success = TestScoringAbsolute(actor, target, "InterestInRomance", true);
            }
            else
            {
                success = TestScoringNormal(actor, target, "InterestInRomance", true);
            }

            if (!success)
            {
                ScoringLookup.IncStat("OnScoreTarget " + logName + " InterestInRomance");
                return(ScoreTestResult.InterestInRomance);
            }

            if (scoring != "InterestInRomance")
            {
                /*
                 * Relationship relation = Relationship.Get(actor, target, false);
                 * if ((relation != null) && ((relation.CurrentSTC == ShortTermContextTypes.Hot) || (relation.CurrentSTC == AmorousCommodity.sHot2)))
                 * {
                 *  success = TestScoringAbsolute(actor, target, scoring, true);
                 * }
                 * else
                 */
                {
                    success = TestScoringNormal(actor, target, scoring, true);
                }

                if (!success)
                {
                    ScoringLookup.IncStat("OnScoreTarget " + logName + " " + scoring);
                    return(ScoreTestResult.CustomScoring);
                }
            }

            ScoringLookup.IncStat("OnScoreTarget " + logName + " Success");
            return(ScoreTestResult.Success);
        }
Example #11
0
        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);
            }
        }
Example #12
0
        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);
            }
        }
Example #13
0
        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);
            }
        }