Ejemplo n.º 1
0
            private new bool CanMakeBabyWith(Sim actor, Sim target)
            {
                BuffBetrayed.BuffInstanceBetrayed betrayed;
                if (actor == target)
                {
                    return(false);
                }
                if (actor.SimDescription.Species != target.SimDescription.Species)
                {
                    return(false);
                }
                if ((target.IsRobot || target.OccultManager.HasOccultType(OccultTypes.Mummy)) || (target.OccultManager.HasOccultType(OccultTypes.PlantSim) || HolographicProjectionSituation.IsSimHolographicallyProjected(target)))
                {
                    return(false);
                }
                if (target.OccultManager.HasOccultType(OccultTypes.TimeTraveler))
                {
                    return(false);
                }
                if (target.Service is GrimReaper)
                {
                    return(false);
                }
                if (BuffBetrayed.DoesSimFeelBetrayed(actor, target.SimDescription, out betrayed))
                {
                    return(false);
                }
                if (!OccultImaginaryFriend.CanSimGetRomanticWithSim(actor, target))
                {
                    return(false);
                }
                if ((target.CurrentInteraction != null) && (target.InteractionQueue.HasInteractionOfType(this) || target.InteractionQueue.HasInteractionOfType(Hospital.BeForcedToMakeBabyWith.Singleton)))
                {
                    return(false);
                }
                GreyedOutTooltipCallback callback = null;
                string reason;

                if (!CommonSocials.CanGetRomantic(actor, target, false, true, true, ref callback, out reason))
                {
                    return(false);
                }
                CASAgeGenderFlags flags = CASAgeGenderFlags.YoungAdult | CASAgeGenderFlags.Elder | CASAgeGenderFlags.Adult;

                if (Woohooer.Settings.AllowTeen(true))
                {
                    flags = flags | CASAgeGenderFlags.Teen;
                }
                return(((actor.SimDescription.Age & flags) != CASAgeGenderFlags.None) && ((target.SimDescription.Age & flags) != CASAgeGenderFlags.None));
            }
Ejemplo n.º 2
0
            public override List <Sim> GetYouShouldTargets(Sim thisActor, Sim pushedSocialActor)
            {
                InteractionPriority priority = new InteractionPriority(InteractionPriorityLevel.UserDirected);

                SocialInteractionA.Definition pushedSocialDefinition = new SocialInteractionA.Definition(mPushedSocialActionKey, new string[0x0], null, false);
                pushedSocialDefinition.ChecksToSkip = mChecksToSkip;

                List <Sim> list = new List <Sim>();

                foreach (Sim sim in pushedSocialActor.LotCurrent.GetAllActors())
                {
                    if (sim == thisActor)
                    {
                        continue;
                    }

                    if (sim == pushedSocialActor)
                    {
                        continue;
                    }

                    if (sim.SimDescription.HasActiveRole)
                    {
                        continue;
                    }

                    GreyedOutTooltipCallback tooltipCallback = null;
                    if (!PushedSocialTest(pushedSocialActor, sim, pushedSocialDefinition, priority, tooltipCallback))
                    {
                        continue;
                    }

                    ActionData data = ActionData.Get(mPushedSocialActionKey);
                    if ((data != null) && ((data.IntendedCommodityString == CommodityTypes.Amorous) || (data.IntendedCommodityString == AmorousCommodity.sAmorous2)))
                    {
                        // Custom Function
                        string reason;
                        if (!CommonSocials.CanGetRomantic(sim.SimDescription, pushedSocialActor.SimDescription, false, true, true, ref tooltipCallback, out reason))
                        {
                            continue;
                        }
                    }

                    list.Add(sim);
                }

                return(list);
            }
Ejemplo n.º 3
0
        public static bool TestEnableAttractionNPCController(Relationship relation)
        {
            if (relation == null)
            {
                return(false);
            }

            GreyedOutTooltipCallback greyedOutTooltipCallback = null;

            if (!CommonSocials.SatisfiedInteractionLevel(relation.SimDescriptionA, relation.SimDescriptionB, true, ref greyedOutTooltipCallback))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 4
0
            public override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                try
                {
                    InteractionInstance currentInteraction = a.CurrentInteraction;
                    if (((currentInteraction != null) && (currentInteraction.Target == target)) && ((currentInteraction is CuddleSeated) || (currentInteraction is NestedCuddleInteraction)))
                    {
                        return(false);
                    }

                    IHasSeatingGroup container = a.Posture.Container as IHasSeatingGroup;
                    if (container != null)
                    {
                        Seat seat = container.SeatingGroup[a];
                        if ((seat != null) && (seat is IHotTubSeat))
                        {
                            if (target.CurrentOutfitCategory == OutfitCategories.SkinnyDippingTowel)
                            {
                                greyedOutTooltipCallback = new GrayedOutTooltipHelper(target.IsFemale, "ClothesStolenTooltip", null).GetTooltip;
                                return(false);
                            }
                        }
                    }

                    string reason;
                    if (!CommonSocials.CanGetRomantic(a, target, isAutonomous, false, true, ref greyedOutTooltipCallback, out reason))
                    {
                        return(false);
                    }

                    if (!StartSeatedCuddleA.Definition.CanCuddle(a, target, ref greyedOutTooltipCallback, true))
                    {
                        return(false);
                    }

                    return(true);
                }
                catch (Exception exception)
                {
                    Common.Exception(a, target, exception);
                    return(false);
                }
            }
Ejemplo n.º 5
0
        public static bool ProposalTest(HotairBalloon ths, Sim a, Sim b, bool autonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
        {
            if ((ths.mCurrentHeight == HotairBalloon.BalloonHeight.OnGround) || (ths.mTargetHeight == HotairBalloon.BalloonHeight.OnGround))
            {
                return(false);
            }

            if (a == b)
            {
                return(false);
            }

            greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(HotairBalloon.LocalizeString(a.IsFemale, "ProposalTooltip", new object[0x0]));
            if ((a.SimDescription.IsGhost && !a.SimDescription.IsPlayableGhost) || (b.SimDescription.IsGhost && !b.SimDescription.IsPlayableGhost))
            {
                return(false);
            }

            // Custom
            return(CommonSocials.TestProposeMarriage(a, b, null, autonomous, ref greyedOutTooltipCallback));
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        public static bool CanGoOnDate(SimDescription a, SimDescription b)
        {
            Relationship relationship = Relationship.Get(a, b, false);

            if (relationship == null)
            {
                return(false);
            }

            if (!relationship.AreRomantic() && ((relationship.STC == null) || !relationship.STC.IsRomantic))
            {
                return(false);
            }

            string reason;
            GreyedOutTooltipCallback callback = null;

            if (!CommonSocials.CanGetRomantic(a, b, true, false, true, ref callback, out reason))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 8
0
            public override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                /*
                 * if (a.SimDescription.IsVisuallyPregnant)
                 * {
                 *  return false;
                 * }
                 * if (target.SimDescription.IsVisuallyPregnant)
                 * {
                 *  return false;
                 * }
                 */

                InteractionInstance currentInteraction = a.CurrentInteraction;

                if (((currentInteraction != null) && (currentInteraction.Target == target)) && ((currentInteraction is CuddleSeated) || (currentInteraction is NestedCuddleInteraction)))
                {
                    return(false);
                }

                string reason;

                return(CommonSocials.CanGetRomantic(a, target, isAutonomous, false, true, ref greyedOutTooltipCallback, out reason) && CanCuddle(a, target, ref greyedOutTooltipCallback, true));
            }
Ejemplo n.º 9
0
        protected static Dictionary <int, SimDescription> GetPotentials(Sim actor)
        {
            CASAgeGenderFlags allow = CASAgeGenderFlags.None;

            if ((actor.SimDescription.Teen && Woohooer.Settings.AllowTeen(true)) || (actor.SimDescription.YoungAdultOrAbove && Woohooer.Settings.AllowTeenAdult(true)))
            {
                allow |= CASAgeGenderFlags.Teen;
            }

            if (actor.SimDescription.Teen && Woohooer.Settings.AllowTeen(true) && Woohooer.Settings.AllowTeenAdult(true))
            {
                allow |= CASAgeGenderFlags.YoungAdult | CASAgeGenderFlags.Adult | CASAgeGenderFlags.Elder;
            }

            if (actor.SimDescription.YoungAdultOrAbove)
            {
                allow |= CASAgeGenderFlags.YoungAdult | CASAgeGenderFlags.Adult | CASAgeGenderFlags.Elder;
            }

            Dictionary <int, List <SimDescription> > potentials = KamaSimtra.GetPotentials(allow, true);

            Dictionary <int, SimDescription> choices = new Dictionary <int, SimDescription>();

            for (int i = 1; i <= 10; i++)
            {
                List <SimDescription> fullList;
                if (!potentials.TryGetValue(i, out fullList))
                {
                    continue;
                }

                bool needFemale = false;

                if (actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Male))
                {
                    if (actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Female))
                    {
                        if (RandomUtil.CoinFlip())
                        {
                            needFemale = true;
                        }
                    }
                    else
                    {
                        needFemale = false;
                    }
                }
                else if (actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Female))
                {
                    needFemale = true;
                }
                else
                {
                    needFemale = !actor.IsFemale;
                }

                List <SimDescription> randomList = new List <SimDescription>();

                foreach (SimDescription sim in fullList)
                {
                    if (sim.IsFemale != needFemale)
                    {
                        continue;
                    }

                    if (sim.Household == actor.Household)
                    {
                        continue;
                    }

                    string reason;
                    GreyedOutTooltipCallback callback = null;
                    if (!CommonSocials.CanGetRomantic(actor.SimDescription, sim, false, true, true, ref callback, out reason))
                    {
                        if (callback != null)
                        {
                            Common.Notify(sim.FullName + Common.NewLine + callback());
                        }
                        continue;
                    }

                    if (choices.ContainsValue(sim))
                    {
                        continue;
                    }

                    randomList.Add(sim);
                }

                if (randomList.Count > 0)
                {
                    choices.Add(i, RandomUtil.GetRandomObjectFromList(randomList));
                }
            }

            return(choices);
        }
Ejemplo n.º 10
0
        public static void Apply(Sim actor, Sim target, bool risky)
        {
            if (!Woohooer.Settings.mApplyBuffs)
            {
                return;
            }

            bool useTraitScoring = Woohooer.Settings.UsingTraitScoring;

            if ((actor == null) || (target == null))
            {
                return;
            }

            Relationship relation = Relationship.Get(actor, target, false);

            if (relation == null)
            {
                return;
            }

            bool witnessed = false;

            if (useTraitScoring)
            {
                string reason;

                foreach (Sim sim in actor.LotCurrent.GetAllActors())
                {
                    if (!sim.IsHuman)
                    {
                        continue;
                    }

                    if ((sim == actor) || (sim == target))
                    {
                        continue;
                    }

                    if (sim.RoomId != actor.RoomId)
                    {
                        continue;
                    }

                    if ((!CommonSocials.CanGetRomantic(sim.SimDescription, actor.SimDescription, out reason)) && (!CommonSocials.CanGetRomantic(sim.SimDescription, target.SimDescription, out reason)))
                    {
                        continue;
                    }

                    if (ScoringLookup.GetScore("LikeWatching", sim.SimDescription) > 0)
                    {
                        sim.BuffManager.AddElement(sVoyeur, sWoohooOrigin);

                        witnessed = true;
                    }
                    else
                    {
                        sim.BuffManager.AddElement(BuffNames.Embarrassed, sWoohooOrigin);
                    }
                }
            }

            Sim[] sims = new Sim[] { actor, target };

            foreach (Sim sim in sims)
            {
                if (!sim.IsHuman)
                {
                    continue;
                }

                if (useTraitScoring)
                {
                    if (KamaSimtra.GetSkillLevel(sim.SimDescription) < 4)
                    {
                        if (ScoringLookup.GetScore("WorryAboutWoohoo", sim.SimDescription) > 0)
                        {
                            sim.BuffManager.AddElement(sWorryAboutWoohoo, sWoohooOrigin);
                        }
                    }
                }

                if (witnessed)
                {
                    sim.BuffManager.AddElement(sWitnessed, sWoohooOrigin);
                }

                if (useTraitScoring)
                {
                    if ((risky) && (!Woohooer.Settings.ReplaceWithRisky))
                    {
                        int score = ScoringLookup.GetScore("LikeRisky", sim.SimDescription);
                        if (score > 0)
                        {
                            sim.BuffManager.RemoveElement(sDislikeRisky);
                            sim.BuffManager.AddElement(sLikeRisky, sWoohooOrigin);
                        }
                        else if (score < 0)
                        {
                            sim.BuffManager.RemoveElement(sLikeRisky);
                            sim.BuffManager.AddElement(sDislikeRisky, sWoohooOrigin);
                        }
                    }
                }

                if (actor.Partner == target.SimDescription)
                {
                    sim.BuffManager.AddElement(sLikePartner, sWoohooOrigin);
                }
                else if (sim.Partner != null)
                {
                    if (useTraitScoring)
                    {
                        int score = ScoringLookup.GetScore("Monogamous", sim.SimDescription);
                        if (score > 0)
                        {
                            sim.BuffManager.RemoveElement(sLikeAdultery);
                            sim.BuffManager.AddElement(sDislikeAdultery, sWoohooOrigin);
                        }
                        else if (score < 0)
                        {
                            sim.BuffManager.RemoveElement(sDislikeAdultery);
                            sim.BuffManager.AddElement(sLikeAdultery, sWoohooOrigin);
                        }
                    }
                }

                if ((useTraitScoring) && (!relation.AreRomantic()))
                {
                    if (relation.LTR.Liking > 75)
                    {
                        int score = ScoringLookup.GetScore("LikeFriendWithBenefits", sim.SimDescription);
                        if (score > 0)
                        {
                            sim.BuffManager.RemoveElement(sDislikeFriendWithBenefits);
                            sim.BuffManager.AddElement(sLikeFriendWithBenefits, sWoohooOrigin);
                        }
                        else if (score < 0)
                        {
                            sim.BuffManager.RemoveElement(sLikeFriendWithBenefits);
                            sim.BuffManager.AddElement(sDislikeFriendWithBenefits, sWoohooOrigin);
                        }
                    }
                    else
                    {
                        int score = ScoringLookup.GetScore("LikeOneNightStand", sim.SimDescription);
                        if (score > 0)
                        {
                            sim.BuffManager.RemoveElement(sDislikeOneNightStand);
                            sim.BuffManager.AddElement(sLikeOneNightStand, sWoohooOrigin);
                        }
                        else if (score < 0)
                        {
                            sim.BuffManager.RemoveElement(sLikeOneNightStand);
                            sim.BuffManager.AddElement(sDislikeOneNightStand, sWoohooOrigin);
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        public static bool CanTryForBaby(Sim actor, Sim target, bool autonomous, CommonWoohoo.WoohooStyle style, ref GreyedOutTooltipCallback callback, out string reason)
        {
            using (Common.TestSpan span = new Common.TestSpan(ScoringLookup.Stats, "Duration CanTryForBaby", Common.DebugLevel.Stats))
            {
                int  chance       = 0;
                bool teenCanTry   = false;
                int  speciesIndex = PersistedSettings.GetSpeciesIndex(actor);

                switch (style)
                {
                case CommonWoohoo.WoohooStyle.Risky:
                case CommonWoohoo.WoohooStyle.TryForBaby:
                    if (actor.SimDescription.Teen || target.SimDescription.Teen)
                    {
                        chance = Woohooer.Settings.mTryForBabyTeenBabyMadeChance;
                    }
                    else
                    {
                        chance = Woohooer.Settings.mTryForBabyMadeChanceV2[speciesIndex];
                    }

                    teenCanTry = Woohooer.Settings.mTeenTryForBabyAutonomous;
                    break;
                }

                if (chance <= 0)
                {
                    reason   = "Chance Fail";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }

                if (!CommonSocials.CanGetRomantic(actor, target, autonomous, true, true, ref callback, out reason))
                {
                    return(false);
                }

                if (autonomous || Woohooer.Settings.TestStoryProgression(autonomous))
                {
                    if (sStoryProgressionAllowPregnancy.Valid && Woohooer.Settings.TestStoryProgression(autonomous))
                    {
                        if (actor.SimDescription.Gender == target.SimDescription.Gender)
                        {
                            reason   = "Surrogate: Same Sex Fail";
                            callback = Common.DebugTooltip(reason);
                            return(false);
                        }
                        else
                        {
                            SimDescription male, female;

                            if (actor.IsFemale)
                            {
                                female = actor.SimDescription;
                                male   = target.SimDescription;
                            }
                            else
                            {
                                male   = actor.SimDescription;
                                female = target.SimDescription;
                            }

                            reason = sStoryProgressionAllowPregnancy.Invoke <string>(new object[] { female, male, autonomous });

                            if (reason != null)
                            {
                                callback = Woohooer.StoryProgressionTooltip(reason, false);
                                return(false);
                            }
                        }
                    }
                }

                if (actor.SimDescription.Gender == target.SimDescription.Gender)
                {
                    reason   = "Surrogate: Same Sex Fail";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }
                else
                {
                    if (actor.IsFemale && !CanGetPreggers(actor, autonomous, ref callback, out reason))
                    {
                        return(false);
                    }
                    else if (!CanGetPreggers(target, autonomous, ref callback, out reason))
                    {
                        return(false);
                    }
                }

                if (autonomous || Woohooer.Settings.mTestAllConditionsForUserDirected[speciesIndex])
                {
                    if (HasBlockingBuff(actor))
                    {
                        reason   = "Actor Buff Block";
                        callback = delegate { return(Common.Localize("TryForBaby:BuffBlock")); };
                        return(false);
                    }

                    if (HasBlockingBuff(target))
                    {
                        reason   = "Target Buff Block";
                        callback = delegate { return(Common.Localize("TryForBaby:BuffBlock")); };
                        return(false);
                    }

                    if (autonomous)
                    {
                        if (actor.SimDescription.IsPregnant || target.SimDescription.IsPregnant)
                        {
                            reason   = "Pregnant";
                            callback = delegate { return(Common.Localize("TryForBaby:Pregnant")); };
                            return(false);
                        }
                    }
                    else
                    {
                        if ((actor.IsRobot && actor.SimDescription.IsPregnant) || actor.SimDescription.IsVisuallyPregnant)
                        {
                            reason   = "Pregnant";
                            callback = delegate { return(Common.Localize("TryForBaby:Pregnant")); };
                            return(false);
                        }

                        if ((target.IsRobot && target.SimDescription.IsPregnant) || target.SimDescription.IsVisuallyPregnant)
                        {
                            if (actor.SimDescription.IsVisuallyPregnant || target.SimDescription.IsVisuallyPregnant)
                            {
                                reason   = "Pregnant";
                                callback = delegate { return(Common.Localize("TryForBaby:Pregnant")); };
                                return(false);
                            }
                        }
                    }
                }

                if (actor.IsFemale && !actor.IsRobot && actor.SimDescription.Elder)
                {
                    reason   = "Elder";
                    callback = delegate { return(Common.Localize("TryForBaby:Elder")); };
                    return(false);
                }

                if (target.IsFemale && !target.IsRobot && target.SimDescription.Elder)
                {
                    reason   = "Elder";
                    callback = delegate { return(Common.Localize("TryForBaby:Elder")); };
                    return(false);
                }

                if (actor.SimDescription.Teen || target.SimDescription.Teen)
                {
                    if (!teenCanTry && autonomous)
                    {
                        reason   = "Teenagers";
                        callback = delegate { return(Common.LocalizeEAString("NRaas.Woohooer:Teenagers")); };
                        return(false);
                    }
                }

                if ((!actor.IsRobot && SimTypes.IsSkinJob(actor.SimDescription)) || (!target.IsRobot && SimTypes.IsSkinJob(target.SimDescription)))
                {
                    reason   = "Skin Job";
                    callback = delegate { return(Common.Localize("TryForBaby:SkinJob")); };
                    return(false);
                }

                return(true);
            }
        }
Ejemplo n.º 13
0
        public bool BaseRunEx()
        {
            mRelationship = Relationship.Get(Actor, Target, true);
            if (mRelationship == null)
            {
                return(false);
            }
            bool flag = false;

            if (IsSlowDance)
            {
                string reason;
                GreyedOutTooltipCallback greyedOutTooltipCallback = null;
                if (CommonSocials.CanGetRomantic(Actor, Target, false, false, true, ref greyedOutTooltipCallback, out reason))
                {
                    flag = true;
                }
            }
            else
            {
                foreach (CommodityTypes types in kAcceptableCommodities)
                {
                    if (mRelationship.STC.CurrentCommodity == types)
                    {
                        flag = true;
                        break;
                    }
                }
            }

            Definition interactionDefinition = InteractionDefinition as Definition;
            IDanceable danceObject           = interactionDefinition.DanceObject;

            if (flag)
            {
                mDanceFloor = DanceFloor.FindAndRouteOntoADanceFloorWithFollower(Actor, Target, danceObject);
                if (mDanceFloor != null)
                {
                    mDanceFloor.AddToUseList(Actor);
                    if (!mDanceFloor.IsActorUsingMe(Target))
                    {
                        mDanceFloor.AddToUseList(Target);
                    }
                }
            }

            Stereo targetStereo = interactionDefinition.TargetStereo;

            if (targetStereo != null)
            {
                targetStereo.AddSimListener(Actor);
                targetStereo.AddSimListener(Target);
            }

            string         instanceName = "SocialJigTwoPerson";
            ProductVersion baseGame     = ProductVersion.BaseGame;

            if (IsSlowDance)
            {
                instanceName = "SlowdanceJig";
                baseGame     = ProductVersion.EP8;
            }

            SocialJig = GlobalFunctions.CreateObjectOutOfWorld(instanceName, baseGame) as SocialJigTwoPerson;
            bool succeeded = false;

            Actor.SynchronizationLevel  = Sim.SyncLevel.NotStarted;
            Target.SynchronizationLevel = Sim.SyncLevel.NotStarted;
            string name = (Stereo.PartySimIsGettingMusicFromPartyLocation(Actor, danceObject) || Stereo.PartySimIsGettingMusicFromPartyLocation(Target, danceObject)) ? LocalizeString("BeRockingDancingTogether", new object[0x0]) : LocalizeString("BeDancingTogether", new object[0x0]);

            if (BeginSocialInteraction(new SocialInteractionB.Definition(null, name, false), true, false))
            {
                IGlass objectInRightHand = Actor.GetObjectInRightHand() as IGlass;
                if (objectInRightHand != null)
                {
                    objectInRightHand.PutGlassAway();
                }
                objectInRightHand = Target.GetObjectInRightHand() as IGlass;
                if (objectInRightHand != null)
                {
                    objectInRightHand.PutGlassAway();
                }

                string             stateMachineName = IsSlowDance ? "slowdance_together" : "dance_together";
                StateMachineClient smc = StateMachineClient.Acquire(Actor, stateMachineName);
                if (IsSlowDance)
                {
                    smc.SetActor("x", Actor);
                    smc.SetActor("y", Target);
                }
                else
                {
                    smc.SetActor("x", Target);
                    smc.SetActor("y", Actor);
                }
                smc.EnterState("x", "enter");
                smc.EnterState("y", "enter");
                if (GameUtils.IsInstalled(ProductVersion.EP7))
                {
                    smc.SetParameter("xIsProper", Target.HasTrait(TraitNames.Proper));
                    smc.SetParameter("yIsProper", Actor.HasTrait(TraitNames.Proper));
                }
                BeginCommodityUpdates();
                smc.RequestState(false, "x", "Ask_To_Dance");
                smc.RequestState(true, "y", "Ask_To_Dance");
                if (flag)
                {
                    smc.RequestState(false, "x", "Last_Sync");
                    smc.RequestState(true, "y", "Last_Sync");
                    smc.RequestState(false, "x", "dance");
                    smc.RequestState(true, "y", "dance");
                    Actor.SkillManager.StartGainAndAddSkillIfNeeded(SkillNames.Dancing, Stereo.kRateOfSkillGainForDancing);
                    Target.SkillManager.StartGainAndAddSkillIfNeeded(SkillNames.Dancing, Stereo.kRateOfSkillGainForDancing);
                    if (IsSlowDance)
                    {
                        EventTracker.SendEvent(EventTypeId.kSlowDanced, Actor, Target);
                        EventTracker.SendEvent(EventTypeId.kSlowDanced, Target, Actor);
                    }
                    succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(DanceTogetherDelegate), smc);
                    Actor.SkillManager.StopSkillGain(SkillNames.Dancing);
                    Target.SkillManager.StopSkillGain(SkillNames.Dancing);
                    smc.RequestState(false, "x", "friendly");
                    smc.RequestState(true, "y", "friendly");
                }
                else
                {
                    smc.RequestState(false, "x", "awkward");
                    smc.RequestState(true, "y", "awkward");
                    mRelationship.LTR.UpdateLiking(Stereo.kLtrDecreaseAfterRejectingDanceTogether);
                    succeeded = false;
                }
            }

            Definition definition2 = InteractionDefinition as Definition;

            if ((definition2 != null) && (definition2.DanceObject is DJTurntable))
            {
                EventTracker.SendEvent(EventTypeId.kDanceToDJMusic, Target);
                EventTracker.SendEvent(EventTypeId.kDanceToDJMusic, Actor);
            }

            EndCommodityUpdates(succeeded);
            Actor.ClearSynchronizationData();
            return(succeeded);
        }
Ejemplo n.º 14
0
            public override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (mTargetDanceObject == null)
                {
                    return(false);
                }

                if (!a.BuffManager.HasElement(BuffNames.EnjoyingMusic))
                {
                    return(false);
                }

                SimDescription simDescription = target.SimDescription;

                if (((target.IsLeavingLot || (target.Service != null)) || ((target.Posture != null) && !target.Posture.AllowsNormalSocials())) || ((target.IsDying() || (a == target)) || ((!simDescription.TeenOrAbove || (a.GetObjectInRightHand() is IGuitar)) || (target.CurrentInteraction is IPlayInstrumentInteraction))))
                {
                    return(false);
                }

                if (isAutonomous)
                {
                    string reason;
                    if (!CommonSocials.CanGetRomantic(a, target, isAutonomous, false, true, ref greyedOutTooltipCallback, out reason))
                    {
                        return(false);
                    }
                    else if (a.CanHaveRomanceWith(target))
                    {
                        // EA Standard interaction is visible
                        return(false);
                    }

                    if (!a.SimDescription.CheckAutonomousGenderPreference(target.SimDescription))
                    {
                        return(false);
                    }

                    if (IsSlowDance && !mTargetDanceObject.AllowsSlowDance)
                    {
                        return(false);
                    }
                }

                if (IsSlowDance)
                {
                    string reason;
                    if (!CommonSocials.CanGetRomantic(a, target, isAutonomous, false, true, ref greyedOutTooltipCallback, out reason))
                    {
                        //greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Stereo.DanceTogetherA.LocalizeString("CantSlowdanceWithSim", new object[0x0]));
                        return(false);
                    }
                    else if (a.CanHaveRomanceWith(target))
                    {
                        // EA Standard interaction is visible
                        return(false);
                    }
                }
                else if (!isAutonomous)
                {
                    // EA Standard interaction is visible
                    return(false);
                }

                return(CelebrityManager.CanSocialize(a, target) && CelebrityManager.CanSocialize(target, a));
            }
Ejemplo n.º 15
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);
            }
        }
Ejemplo n.º 16
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);
            }
        }
Ejemplo n.º 17
0
            public override bool RomanticSimTest(Sim actor, Sim sim, bool isAutonomous)
            {
                GreyedOutTooltipCallback greyedOutTooltipCallback = null;

                return(CommonSocials.SatisfiesRomance(actor, sim, "RabbitholeRomance ", isAutonomous, ref greyedOutTooltipCallback));
            }
Ejemplo n.º 18
0
        public override bool InRabbitHole()
        {
            try
            {
                ActiveStage.Start();

                SimDescription choice = null;

                if (mMaster)
                {
                    if (!AcceptCancelDialog.Show(Common.Localize("Rendezvous:Prompt", Actor.IsFemale, new object[] { KamaSimtra.Settings.mRendezvousCostPerLevel })))
                    {
                        return(false);
                    }

                    Dictionary <int, List <SimDescription> > potentials = KamaSimtra.GetPotentials(Woohooer.Settings.AllowTeen(true));

                    List <SimDescription> choices = new List <SimDescription>();
                    for (int i = 1; i <= 10; i++)
                    {
                        List <SimDescription> fullList;
                        if (!potentials.TryGetValue(i, out fullList))
                        {
                            continue;
                        }

                        bool needFemale = false;

                        if (Actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Male))
                        {
                            if (Actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Female))
                            {
                                if (RandomUtil.CoinFlip())
                                {
                                    needFemale = true;
                                }
                            }
                            else
                            {
                                needFemale = false;
                            }
                        }
                        else if (Actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Female))
                        {
                            needFemale = true;
                        }
                        else
                        {
                            needFemale = !Actor.IsFemale;
                        }

                        List <SimDescription> randomList = new List <SimDescription>();

                        foreach (SimDescription sim in fullList)
                        {
                            if (sim.IsFemale != needFemale)
                            {
                                continue;
                            }

                            if (sim.Household == Actor.Household)
                            {
                                continue;
                            }

                            string reason;
                            GreyedOutTooltipCallback callback = null;
                            if (!CommonSocials.CanGetRomantic(Actor.SimDescription, sim, false, true, true, ref callback, out reason))
                            {
                                if (callback != null)
                                {
                                    Common.DebugNotify(sim.FullName + Common.NewLine + callback());
                                }
                                continue;
                            }

                            if (choices.Contains(sim))
                            {
                                continue;
                            }

                            randomList.Add(sim);
                        }

                        if (randomList.Count > 0)
                        {
                            choices.Add(RandomUtil.GetRandomObjectFromList(randomList));
                        }
                    }

                    if (choices.Count == 0)
                    {
                        Common.Notify(Common.Localize("Rendezvous:NoneAvailable", Actor.IsFemale));
                        return(false);
                    }

                    choice = new SimSelection(Common.Localize("Rendezvous:MenuName"), Actor.SimDescription, choices, SimSelection.Type.Rendezvous, -1000).SelectSingle();
                    if (choice == null)
                    {
                        Common.Notify(Common.Localize("Rendezvous:NoSelect", Actor.IsFemale));
                        return(false);
                    }

                    if (Instantiation.PerformOffLot(choice, Target.LotCurrent, null) == null)
                    {
                        Common.Notify(Common.Localize("Rendezvous:BadSim", Actor.IsFemale, new object[] { choice }));
                        return(false);
                    }

                    Rendezvous interaction = Singleton.CreateInstance(Target, choice.CreatedSim, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true) as Rendezvous;
                    interaction.mMaster = false;
                    interaction.LinkedInteractionInstance = this;

                    choice.CreatedSim.InteractionQueue.CancelAllInteractions();
                    if (!choice.CreatedSim.InteractionQueue.AddNext(interaction))
                    {
                        Common.Notify(Common.Localize("Rendezvous:BadSim", Actor.IsFemale, new object[] { choice }));
                        return(false);
                    }

                    if (!DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), WaitPeriodLoop, null))
                    {
                        Common.Notify(Common.Localize("Rendezvous:BadSim", Actor.IsFemale, new object[] { choice }));
                        return(false);
                    }

                    if (!mBegin)
                    {
                        Common.Notify(Common.Localize("Rendezvous:BadSim", Actor.IsFemale, new object[] { choice }));
                        return(false);
                    }
                    else
                    {
                        Actor.ClearExitReasons();

                        TimedStage stage = new TimedStage(GetInteractionName(), KamaSimtra.Settings.mRendezvousDuration, false, false, true);
                        Stages      = new List <Stage>(new Stage[] { stage });
                        ActiveStage = stage;
                        ActiveStage.Start();
                    }
                }
                else
                {
                    Rendezvous interaction = LinkedInteractionInstance as Rendezvous;
                    if (interaction == null)
                    {
                        return(false);
                    }

                    interaction.mBegin = true;
                }

                if (mMaster)
                {
                    if (!CelebrityManager.TryModifyFundsWithCelebrityDiscount(Actor, Target, KamaSimtra.Settings.mRendezvousCostPerLevel * choice.SkillManager.GetSkillLevel(KamaSimtra.StaticGuid), true))
                    {
                        Common.Notify(Common.Localize("Rendezvous:CannotPay", Actor.IsFemale));
                        return(false);
                    }

                    Common.Notify(choice.CreatedSim, Common.Localize("Rendezvous:Success", Actor.IsFemale, choice.IsFemale, new object[] { choice }));

                    KamaSimtra skill = KamaSimtra.EnsureSkill(Actor);
                    if (skill != null)
                    {
                        skill.RendezvousActive = true;
                    }
                }

                BeginCommodityUpdates();
                bool succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                EndCommodityUpdates(succeeded);

                if (KamaSimtra.Settings.mRandomRendezvousMoodlet)
                {
                    Actor.BuffManager.AddElement(RandomUtil.GetRandomObjectFromList(sRandomBuffs), WoohooBuffs.sWoohooOrigin);
                }

                if (mMaster)
                {
                    CommonWoohoo.WoohooLocation location = CommonWoohoo.WoohooLocation.RabbitHole;

                    List <WoohooLocationControl> choices = CommonWoohoo.GetValidLocations(Actor.SimDescription);
                    if (choices.Count > 0)
                    {
                        location = RandomUtil.GetRandomObjectFromList(choices).Location;
                    }

                    CommonWoohoo.RunPostWoohoo(Actor, choice.CreatedSim, Target, CommonWoohoo.WoohooStyle.Safe, location, false);
                }

                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Ejemplo n.º 19
0
 public void OnWorldLoadFinished()
 {
     CommonSocials.ToggleKissRules();
 }
Ejemplo n.º 20
0
 public static void CheckForWitnessedCheating(Sim actor, Sim target, bool wasAccepted)
 {
     CommonSocials.SendCheatingEvents(actor, target, WasWitnessed(actor, target, Woohooer.Settings.mWoohooJealousyLevel, true), Woohooer.Settings.mWoohooJealousyLevel, wasAccepted);
 }
Ejemplo n.º 21
0
        protected static void GetPotentials(Sim actor, Computer target, bool autonomous, bool ignoreGender, List <Sim> unknown, List <Sim> known)
        {
            foreach (Sim sim in LotManager.Actors)
            {
                if (sim == null)
                {
                    continue;
                }

                if (actor.Household == sim.Household)
                {
                    continue;
                }

                //msg += Common.NewLine + sim.FullName;

                string reason;
                GreyedOutTooltipCallback callback = null;
                if (!CommonSocials.CanGetRomantic(sim, actor, autonomous, true, true, ref callback, out reason))
                {
                    //msg += Common.NewLine + " " + callback();
                    continue;
                }

                if (!ignoreGender)
                {
                    if (!CommonSocials.CheckAutonomousGenderPreference(sim.SimDescription, actor.SimDescription))
                    {
                        //msg += Common.NewLine + " Not Gender Preference";
                        continue;
                    }
                }

                if (!target.CanSimBeChattedWith(actor, sim))
                {
                    //msg += Common.NewLine + " Not CanBeChatted";
                    continue;
                }

                if (unknown != null)
                {
                    int score = ScoringLookup.GetScore("LikeCyberWoohoo", sim.SimDescription) + KamaSimtra.Settings.mCyberWoohooBaseChanceScoring;
                    if (score < 0)
                    {
                        //msg += Common.NewLine + " Score Fail " + score;
                        continue;
                    }
                }

                if (Relationship.Get(actor, sim, false) == null)
                {
                    if (unknown != null)
                    {
                        unknown.Add(sim);
                    }
                }
                else
                {
                    known.Add(sim);
                }
            }
        }
Ejemplo n.º 22
0
 protected override bool Satisfies(Sim actor, Sim target, ToiletStall obj, bool isAutonomous, ref GreyedOutTooltipCallback callback)
 {
     return(base.Satisfies(actor, target, obj, isAutonomous, ref callback) && CommonSocials.SatisfiesRomance(actor, target, "ToiletStallMakeOut ", isAutonomous, ref callback));
 }
Ejemplo n.º 23
0
        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);
        }
Ejemplo n.º 24
0
        public static void CalculateAttractionScore(Relationship ths, bool displayNotice)
        {
            if (ths == null)
            {
                return;
            }

            ths.AttractionScore = 0;

            //if (ths.AttractionScore == float.PositiveInfinity)
            {
                SimDescription simA = ths.SimDescriptionA;
                SimDescription simB = ths.SimDescriptionB;
                if ((simA != null) && (simB != null) && (simA.IsHuman) && (simB.IsHuman))
                {
                    string reason;
                    GreyedOutTooltipCallback greyedOutTooltipCallback = null;
                    if (CommonSocials.CanGetRomantic(simA, simB, true, false, true, ref greyedOutTooltipCallback, out reason))
                    {
                        float score = RandomUtil.GetFloat(Relationship.kBaseRandomAttraction[0x0], Relationship.kBaseRandomAttraction[0x1]);

                        score += Woohooer.Settings.mAttractionBaseChanceScoringV3[PersistedSettings.GetSpeciesIndex(simA)];

                        float origScore = score;
                        float highScore = 0f;
                        float newScore  = 0f;

                        switch (ths.LTR.CurrentLTR)
                        {
                        case LongTermRelationshipTypes.Spouse:
                        case LongTermRelationshipTypes.Fiancee:
                            if (score > 0)
                            {
                                score *= 2;
                            }
                            else
                            {
                                score = 0;
                            }
                            break;
                        }

                        newScore  = score - origScore;
                        origScore = score;

                        Relationship.AttractionType attractionType = Relationship.AttractionType.None;
                        foreach (Trait traitA in simA.TraitManager.List)
                        {
                            if (traitA.IsReward)
                            {
                                continue;
                            }

                            foreach (Trait traitB in simB.TraitManager.List)
                            {
                                if (traitB.IsReward)
                                {
                                    continue;
                                }

                                if (traitA.TraitGuid == traitB.TraitGuid)
                                {
                                    score += Relationship.kTraitModifier;
                                }
                                else if (TraitManager.DoTraitsConflict(traitA.Guid, traitB.Guid))
                                {
                                    score -= Relationship.kTraitModifier;
                                }
                            }
                        }

                        newScore  = score - origScore;
                        origScore = score;

                        if (ths.TestWasNewHighScore(Relationship.AttractionType.Trait, newScore, ref highScore))
                        {
                            attractionType = Relationship.AttractionType.Trait;
                        }

                        Occupation occupation = simA.Occupation;
                        if (occupation != null)
                        {
                            score += occupation.CareerLevel * Relationship.kCareerBonusPerLevel;
                        }

                        Occupation occupation2 = simB.Occupation;
                        if (occupation2 != null)
                        {
                            score += occupation2.CareerLevel * Relationship.kCareerBonusPerLevel;
                        }

                        newScore  = score - origScore;
                        origScore = score;

                        if (ths.TestWasNewHighScore(Relationship.AttractionType.Career, newScore, ref highScore))
                        {
                            attractionType = Relationship.AttractionType.Career;
                        }

                        foreach (Skill skill in simA.SkillManager.List)
                        {
                            score += skill.SkillLevel * Relationship.kSkillBonusPerLevel;
                        }

                        foreach (Skill skill2 in simB.SkillManager.List)
                        {
                            score += skill2.SkillLevel * Relationship.kSkillBonusPerLevel;
                        }

                        newScore  = score - origScore;
                        origScore = score;

                        if (ths.TestWasNewHighScore(Relationship.AttractionType.Skill, newScore, ref highScore))
                        {
                            attractionType = Relationship.AttractionType.Skill;
                        }

                        List <OccultTypes> listA = OccultTypeHelper.CreateList(simA);
                        List <OccultTypes> listB = OccultTypeHelper.CreateList(simB);

                        foreach (OccultTypes typeA in listA)
                        {
                            if (listB.Contains(typeA))
                            {
                                score += Relationship.kBonusForMatchingOccult;
                            }
                        }

                        newScore  = score - origScore;
                        origScore = score;

                        if (ths.TestWasNewHighScore(Relationship.AttractionType.Occult, newScore, ref highScore))
                        {
                            attractionType = Relationship.AttractionType.Occult;
                        }

                        CelebrityManager celebrityManagerA = simA.CelebrityManager;
                        if (celebrityManagerA != null)
                        {
                            score += celebrityManagerA.Level * Relationship.kCelebrityBonusPerLevel;
                        }

                        CelebrityManager celebrityManagerB = simB.CelebrityManager;
                        if (celebrityManagerB != null)
                        {
                            score += celebrityManagerB.Level * Relationship.kCelebrityBonusPerLevel;
                        }

                        newScore  = score - origScore;
                        origScore = score;

                        if (ths.TestWasNewHighScore(Relationship.AttractionType.Celebrity, newScore, ref highScore))
                        {
                            attractionType = Relationship.AttractionType.Celebrity;
                        }

                        if (simA.Zodiac == simB.Zodiac)
                        {
                            score += Relationship.kMatchingSignsBonus;
                        }

                        if (simA.FavoriteColor == simB.FavoriteColor)
                        {
                            score += Relationship.kMatchingSignsBonus / 2;
                        }

                        if (simA.FavoriteFood == simB.FavoriteFood)
                        {
                            score += Relationship.kMatchingSignsBonus / 2;
                        }

                        if (simA.FavoriteMusic == simB.FavoriteMusic)
                        {
                            score += Relationship.kMatchingSignsBonus / 2;
                        }

                        newScore  = score - origScore;
                        origScore = score;

                        if (ths.TestWasNewHighScore(Relationship.AttractionType.Astro, newScore, ref highScore))
                        {
                            attractionType = Relationship.AttractionType.Astro;
                        }

                        int familyFundsA = 0;

                        Household house = simA.Household;
                        if (house != null)
                        {
                            familyFundsA = house.FamilyFunds;
                        }

                        if (familyFundsA >= Relationship.kAttractedMoneyAmounts[0x2])
                        {
                            score += Relationship.kAttractedMoneyBonuses[0x2];
                        }
                        else if (familyFundsA >= Relationship.kAttractedMoneyAmounts[0x1])
                        {
                            score += Relationship.kAttractedMoneyBonuses[0x1];
                        }
                        else if (familyFundsA >= Relationship.kAttractedMoneyAmounts[0x0])
                        {
                            score += Relationship.kAttractedMoneyBonuses[0x0];
                        }

                        int familyFundsB = 0;

                        house = simB.Household;
                        if (house != null)
                        {
                            familyFundsB = house.FamilyFunds;
                        }
                        if (familyFundsB >= Relationship.kAttractedMoneyAmounts[0x2])
                        {
                            score += Relationship.kAttractedMoneyBonuses[0x2];
                        }
                        else if (familyFundsB >= Relationship.kAttractedMoneyAmounts[0x1])
                        {
                            score += Relationship.kAttractedMoneyBonuses[0x1];
                        }
                        else if (familyFundsB >= Relationship.kAttractedMoneyAmounts[0x0])
                        {
                            score += Relationship.kAttractedMoneyBonuses[0x0];
                        }

                        newScore  = score - origScore;
                        origScore = score;

                        if (ths.TestWasNewHighScore(Relationship.AttractionType.Money, newScore, ref highScore))
                        {
                            attractionType = Relationship.AttractionType.Money;
                        }

                        foreach (TraitNames trait in sAttractionTraits)
                        {
                            if (simA.HasTrait(trait))
                            {
                                score += Relationship.kAttractionLifetimeRewardBonus;
                            }

                            if (simB.HasTrait(trait))
                            {
                                score += Relationship.kAttractionLifetimeRewardBonus;
                            }
                        }

                        newScore  = score - origScore;
                        origScore = score;

                        if (ths.TestWasNewHighScore(Relationship.AttractionType.Attractive, newScore, ref highScore))
                        {
                            attractionType = Relationship.AttractionType.Attractive;
                        }

                        BuffManager buffManagerA = null;
                        if (simA.CreatedSim != null)
                        {
                            buffManagerA = simA.CreatedSim.BuffManager;
                        }

                        BuffManager buffManagerB = null;
                        if (simB.CreatedSim != null)
                        {
                            buffManagerB = simB.CreatedSim.BuffManager;
                        }

                        foreach (BuffNames posBuff in Relationship.kPositiveBuffList)
                        {
                            if ((buffManagerA != null) && (buffManagerA.HasElement(posBuff)))
                            {
                                score += Relationship.kPerBuffModifier;
                            }
                            if ((buffManagerB != null) && (buffManagerB.HasElement(posBuff)))
                            {
                                score += Relationship.kPerBuffModifier;
                            }
                        }

                        foreach (BuffNames negBuff in Relationship.kNegativeBuffList)
                        {
                            if ((buffManagerA != null) && (buffManagerA.HasElement(negBuff)))
                            {
                                score -= Relationship.kPerBuffModifier;
                            }
                            if ((buffManagerB != null) && (buffManagerB.HasElement(negBuff)))
                            {
                                score -= Relationship.kPerBuffModifier;
                            }
                        }

                        newScore  = score - origScore;
                        origScore = score;

                        if (ths.TestWasNewHighScore(Relationship.AttractionType.Buffs, newScore, ref highScore))
                        {
                            attractionType = Relationship.AttractionType.Buffs;
                        }

                        score += simA.Fitness * 25;
                        score += simB.Fitness * 25;

                        if (simA.Weight < 0)
                        {
                            score += 25 - simA.Weight * -25;
                        }
                        else
                        {
                            score += 25 - simA.Weight * 25;
                        }

                        if (simB.Weight < 0)
                        {
                            score += 25 - simB.Weight * -25;
                        }
                        else
                        {
                            score += 25 - simB.Weight * 25;
                        }

                        int ageA = 0;
                        switch (simA.Age)
                        {
                        case CASAgeGenderFlags.Teen:
                            ageA = 1;
                            break;

                        case CASAgeGenderFlags.YoungAdult:
                            ageA = 2;
                            break;

                        case CASAgeGenderFlags.Adult:
                            ageA = 3;
                            break;

                        case CASAgeGenderFlags.Elder:
                            ageA = 4;
                            break;
                        }

                        int ageB = 0;
                        switch (simB.Age)
                        {
                        case CASAgeGenderFlags.Teen:
                            ageB = 1;
                            break;

                        case CASAgeGenderFlags.YoungAdult:
                            ageB = 2;
                            break;

                        case CASAgeGenderFlags.Adult:
                            ageB = 3;
                            break;

                        case CASAgeGenderFlags.Elder:
                            ageB = 4;
                            break;
                        }

                        score -= Math.Abs(ageA - ageB) * 25;

                        newScore  = score - origScore;
                        origScore = score;

                        if (ths.TestWasNewHighScore(Relationship.AttractionType.Physical, newScore, ref highScore))
                        {
                            attractionType = Relationship.AttractionType.Physical;
                        }

                        ths.AttractionScore = score;

                        if (Common.kDebugging)
                        {
                            Common.DebugNotify(simA.FullName + Common.NewLine + simB.FullName + Common.NewLine + "Attraction: " + score + Common.NewLine + attractionType);
                        }

                        if ((ths.AreAttracted) && ((SimTypes.IsSelectable(simA)) || (SimTypes.IsSelectable(simB))))
                        {
                            if (AttractionHelper.TestEnableAttractionNPCController(ths))
                            {
                                if (ths.AttractionNPCController == null)
                                {
                                    ths.AttractionNPCController = new AttractionNPCBehaviorController(ths);
                                }
                            }
                            else
                            {
                                if (ths.AttractionNPCController != null)
                                {
                                    ths.AttractionNPCController.Dispose();
                                }
                            }

                            switch (ths.LTR.CurrentLTR)
                            {
                            case LongTermRelationshipTypes.Spouse:
                            case LongTermRelationshipTypes.Fiancee:
                            case LongTermRelationshipTypes.Ex:
                            case LongTermRelationshipTypes.ExSpouse:
                            case LongTermRelationshipTypes.Partner:
                            case LongTermRelationshipTypes.RomanticInterest:
                                break;

                            default:
                                if (displayNotice)
                                {
                                    Sim createdSimA = simA.CreatedSim;
                                    Sim createdSimB = simB.CreatedSim;
                                    if ((createdSimA != null) && (createdSimB != null))
                                    {
                                        if ((createdSimA.LotCurrent == createdSimB.LotCurrent) && (createdSimA.RoomId == createdSimB.RoomId))
                                        {
                                            VisualEffect effect = VisualEffect.Create("ep8AttractionSystem");
                                            createdSimB.ParentHeadlineFx(effect);
                                            effect.SubmitOneShotEffect(VisualEffect.TransitionType.SoftTransition);

                                            VisualEffect effect2 = VisualEffect.Create("ep8AttractionSystem");
                                            createdSimA.ParentHeadlineFx(effect2);
                                            effect2.SubmitOneShotEffect(VisualEffect.TransitionType.SoftTransition);

                                            ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.BalloonData(createdSimA.GetThumbnailKey());
                                            bd.BalloonType = ThoughtBalloonTypes.kSpeechBalloon;
                                            createdSimB.ThoughtBalloonManager.ShowBalloon(bd);

                                            ThoughtBalloonManager.BalloonData data2 = new ThoughtBalloonManager.BalloonData(createdSimB.GetThumbnailKey());
                                            data2.BalloonType = ThoughtBalloonTypes.kSpeechBalloon;
                                            createdSimA.ThoughtBalloonManager.ShowBalloon(data2);

                                            TNSNames reasonTNS = ths.GetReasonTNS(attractionType);
                                            if (reasonTNS != TNSNames.None)
                                            {
                                                Sim target = createdSimB.IsSelectable ? createdSimB : createdSimA;
                                                Sim actor  = (createdSimB == target) ? createdSimA : createdSimB;
                                                target.ShowTNSIfSelectable(reasonTNS, actor, target, new object[] { actor, target });
                                            }

                                            EventTracker.SendEvent(EventTypeId.kMeetAttractiveSim, createdSimB);
                                            EventTracker.SendEvent(EventTypeId.kMeetAttractiveSim, createdSimA);
                                            Audio.StartObjectSound(createdSimB.IsSelectable ? createdSimB.ObjectId : createdSimA.ObjectId, "sting_attraction", false);
                                        }
                                    }
                                }
                                break;
                            }
                        }
                        else if (ths.AttractionNPCController != null)
                        {
                            ths.AttractionNPCController.Dispose();
                        }
                    }
                    else
                    {
                        if (greyedOutTooltipCallback != null)
                        {
                            Common.DebugNotify(simA.FullName + Common.NewLine + simB.FullName + Common.NewLine + greyedOutTooltipCallback());
                        }
                    }
                }
            }

            if (ths.AttractionNPCController != null)
            {
                ths.AttractionNPCController.Dispose();
            }
        }
Ejemplo n.º 25
0
            public override bool Test(Sim actor, Phone target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (base.Test(actor, target, isAutonomous, ref greyedOutTooltipCallback))
                {
                    if (isAutonomous)
                    {
                        if (!Woohooer.Settings.mWoohootyTextAutonomous[PersistedSettings.GetSpeciesIndex(actor)])
                        {
                            return(false);
                        }
                    }

                    if (!actor.IsAtHome)
                    {
                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(TravelUtil.LocalizeString(actor.IsFemale, "NotAtHome", new object[] { actor }));
                        return(false);
                    }

                    if (!base.CanSimInviteOver(actor, isAutonomous) || !base.CanInviteOverToLot(actor.LotCurrent, isAutonomous))
                    {
                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(TravelUtil.LocalizeString(actor.IsFemale, "CannotInviteOver", new object[] { actor }));
                        return(false);
                    }

                    if (actor.SimDescription.IsEP11Bot)
                    {
                        if ((actor.TraitManager == null) || !actor.TraitManager.HasElement(TraitNames.CapacityToLoveChip))
                        {
                            return(false);
                        }
                    }

                    bool flag  = false;
                    bool flag2 = false;
                    if (actor.SimDescription.Teen && Woohooer.Settings.AllowTeen(true))
                    {
                        flag = true;
                    }

                    if (actor.SimDescription.Teen && Woohooer.Settings.AllowTeenAdult(true))
                    {
                        flag2 = true;
                    }

                    bool locationTest = false;

                    foreach (IMiniRelationship relationship in Relationship.GetMiniRelationships(actor.SimDescription))
                    {
                        SimDescription description = SimDescription.Find(relationship.GetOtherSimDescriptionId(actor.SimDescription));
                        if (description != null && description.CreatedSim != null && description.CreatedSim.LotCurrent != actor.LotCurrent && !description.ChildOrBelow && description.IsHuman)
                        {
                            if (!flag && actor.SimDescription.Teen && description.Teen)
                            {
                                continue;
                            }

                            if (!flag2 && actor.SimDescription.Teen && description.YoungAdultOrAbove)
                            {
                                continue;
                            }

                            if (isAutonomous && !CommonSocials.CheckAutonomousGenderPreference(actor.SimDescription, description))
                            {
                                continue;
                            }

                            if (isAutonomous && !CommonWoohoo.SatisfiesCooldown(actor, description.CreatedSim, isAutonomous, ref greyedOutTooltipCallback))
                            {
                                continue;
                            }

                            if (!locationTest)
                            {
                                // only humans can use this so we don't need to keep scanning the lot each loop
                                if (!CommonWoohoo.HasWoohooableObject(actor.LotHome, actor, description.CreatedSim))
                                {
                                    return(false);
                                }
                                else
                                {
                                    locationTest = true;
                                }
                            }


                            return(true);
                        }
                    }
                }

                return(false);
            }
Ejemplo n.º 26
0
        public override void Init(ref InteractionInstanceParameters parameters)
        {
            try
            {
                base.Init(ref parameters);

                Sim  target   = null;
                bool mGetting = false;
                if (Autonomous)
                {
                    mMassInfo = MassageTable.MassageInfos[RandomUtil.GetInt(0x4)];

                    bool romantic = ((mMassInfo.mType == MassageTable.MassageType.Romantic) || (mMassInfo.mType == MassageTable.MassageType.AmazingRomantic));

                    List <Sim> validMassageSims = GetValidMassageSims(Target, Actor, romantic, parameters.Autonomous);
                    if (validMassageSims.Count == 0x0)
                    {
                        return;
                    }

                    target = validMassageSims[RandomUtil.GetInt(validMassageSims.Count - 0x1)];
                }
                else
                {
                    target = GetSelectedObject() as Sim;
                    Definition interactionDefinition = InteractionDefinition as Definition;
                    mMassInfo = interactionDefinition.mMassInfo;
                    mGetting  = interactionDefinition.mGetting;
                }

                if (target != null)
                {
                    if (mGetting)
                    {
                        mMasseuse = target;
                        mMassagee = Actor;
                    }
                    else
                    {
                        mMasseuse = Actor;
                        mMassagee = target;
                    }

                    bool cancelled = false;
                    Sim  masseuse  = null;
                    Sim  massagee  = null;
                    if (mMasseuse.IsSelectable)
                    {
                        masseuse = mMasseuse;
                        massagee = mMassagee;
                    }
                    else
                    {
                        masseuse = mMassagee;
                        massagee = mMasseuse;
                    }

                    bool allowAge = false;

                    string reason;
                    GreyedOutTooltipCallback callback = null;
                    if (CommonSocials.CanGetRomantic(Actor, target, Autonomous, false, true, ref callback, out reason))
                    {
                        allowAge = true;
                    }

                    if (((mMassInfo.mType == MassageTable.MassageType.Romantic) || (mMassInfo.mType == MassageTable.MassageType.AmazingRomantic)) && !allowAge)
                    {
                        if (!Autonomous)
                        {
                            masseuse.ShowTNSIfSelectable(MassageTable.LocalizeString("InvalidRomanticMassage", new object[] { massagee }), StyledNotification.NotificationStyle.kGameMessageNegative);
                        }
                        cancelled = true;
                    }

                    if (target.GetRelationship(Actor, true).AreEnemies())
                    {
                        if (!Autonomous)
                        {
                            masseuse.ShowTNSIfSelectable(MassageTable.LocalizeString("NoMassageForEnemy", new object[] { massagee }), StyledNotification.NotificationStyle.kGameMessageNegative);
                        }
                        cancelled = true;
                    }

                    if (cancelled)
                    {
                        Cancelled = true;
                    }
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(parameters.Actor, parameters.Target, e);
            }
        }
Ejemplo n.º 27
0
        public static bool CanTryForBaby(Sim a, Sim target, bool autonomous, CommonWoohoo.WoohooStyle style, ref GreyedOutTooltipCallback greyedOutTooltipCallback, out string reason)
        {
            using (Common.TestSpan span = new Common.TestSpan(ScoringLookup.Stats, "Duration CanTryForBaby", Common.DebugLevel.Stats))
            {
                int  chance     = 0;
                bool teenCanTry = false;

                int speciesIndex = PersistedSettings.GetSpeciesIndex(a);

                PregnancyChoice pregnancyChoice = PregnancyChoice.Either;

                switch (style)
                {
                case CommonWoohoo.WoohooStyle.Risky:
                    if ((a.SimDescription.Teen) || (target.SimDescription.Teen))
                    {
                        chance = Woohooer.Settings.mRiskyTeenBabyMadeChance;
                    }
                    else
                    {
                        chance = Woohooer.Settings.mRiskyBabyMadeChanceV2[speciesIndex];
                    }

                    teenCanTry      = Woohooer.Settings.mTeenRiskyAutonomous;
                    pregnancyChoice = Woohooer.Settings.mRiskyPregnancyChoice;
                    break;

                case CommonWoohoo.WoohooStyle.TryForBaby:
                    if ((a.SimDescription.Teen) || (target.SimDescription.Teen))
                    {
                        chance = Woohooer.Settings.mTryForBabyTeenBabyMadeChance;
                    }
                    else
                    {
                        chance = Woohooer.Settings.mTryForBabyMadeChanceV2[speciesIndex];
                    }

                    teenCanTry      = Woohooer.Settings.mTeenTryForBabyAutonomous;
                    pregnancyChoice = Woohooer.Settings.mTryForBabyPregnancyChoice;
                    break;
                }

                if (chance <= 0)
                {
                    greyedOutTooltipCallback = Common.DebugTooltip("Chance Fail");
                    reason = "Chance Fail";
                    return(false);
                }

                if (!CommonSocials.CanGetRomantic(a, target, autonomous, true, true, ref greyedOutTooltipCallback, out reason))
                {
                    return(false);
                }

                if (autonomous)
                {
                    if ((sStoryProgressionAllowPregnancy.Valid) && (Woohooer.Settings.TestStoryProgression(autonomous)))
                    {
                        reason = sStoryProgressionAllowPregnancy.Invoke <string>(new object[] { a.SimDescription, target.SimDescription, autonomous });
                        if (reason != null)
                        {
                            greyedOutTooltipCallback = Woohooer.StoryProgressionTooltip(reason, false);
                            return(false);
                        }
                    }
                }

                if (a.SimDescription.Gender == target.SimDescription.Gender)
                {
                    if (!Woohooer.Settings.mAllowSameSexTryForBabyV2[speciesIndex])
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Same Sex Fail");
                        reason = "Same Sex Fail";
                        return(false);
                    }

                    if ((!CanGetPreggers(a, autonomous, ref greyedOutTooltipCallback, out reason)) && (!CanGetPreggers(target, autonomous, ref greyedOutTooltipCallback, out reason)))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (a.IsFemale)
                    {
                        if (!CanGetPreggers(a, autonomous, ref greyedOutTooltipCallback, out reason))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        if (!CanGetPreggers(target, autonomous, ref greyedOutTooltipCallback, out reason))
                        {
                            return(false);
                        }
                    }
                }

                if ((autonomous) || (Woohooer.Settings.mTestAllConditionsForUserDirected[speciesIndex]))
                {
                    if (HasBlockingBuff(a))
                    {
                        greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:BuffBlock")); };
                        reason = "BuffBlock";
                        return(false);
                    }

                    if (HasBlockingBuff(target))
                    {
                        greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:BuffBlock")); };
                        reason = "BuffBlock";
                        return(false);
                    }

                    if ((a.SimDescription.Gender != target.SimDescription.Gender) || (pregnancyChoice != PregnancyChoice.Either))
                    {
                        if (autonomous)
                        {
                            if (a.SimDescription.IsPregnant)
                            {
                                greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:Pregnant")); };
                                reason = "Pregnant";
                                return(false);
                            }

                            if (target.SimDescription.IsPregnant)
                            {
                                greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:Pregnant")); };
                                reason = "Pregnant";
                                return(false);
                            }
                        }
                        else
                        {
                            if (a.SimDescription.IsVisuallyPregnant)
                            {
                                greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:Pregnant")); };
                                reason = "Pregnant";
                                return(false);
                            }

                            if (target.SimDescription.IsVisuallyPregnant)
                            {
                                greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:Pregnant")); };
                                reason = "Pregnant";
                                return(false);
                            }
                        }
                    }

                    if ((a.SimDescription.IsMale) && (target.SimDescription.IsMale))
                    {
                        if (!Woohooer.Settings.mAutonomousMaleMaleTryForBabyV2[speciesIndex])
                        {
                            greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:SameSexDenied")); };
                            reason = "SameSexDenied";
                            return(false);
                        }

                        if (a.SimDescription.Elder)
                        {
                            greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:Elder")); };
                            reason = "Elder";
                            return(false);
                        }

                        if (target.SimDescription.Elder)
                        {
                            greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:Elder")); };
                            return(false);
                        }
                    }

                    if ((a.SimDescription.IsFemale) && (target.SimDescription.IsFemale))
                    {
                        if (!Woohooer.Settings.mAutonomousFemaleFemaleTryForBabyV2[speciesIndex])
                        {
                            greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:SameSexDenied")); };
                            reason = "SameSexDenied";
                            return(false);
                        }
                    }

                    if ((a.SimDescription.Elder) && (a.SimDescription.IsFemale))
                    {
                        greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:Elder")); };
                        reason = "Elder";
                        return(false);
                    }

                    if ((target.SimDescription.Elder) && (target.SimDescription.IsFemale))
                    {
                        greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:Elder")); };
                        reason = "Elder";
                        return(false);
                    }

                    if ((a.SimDescription.Teen) || (target.SimDescription.Teen))
                    {
                        if ((!teenCanTry) && (autonomous))
                        {
                            greyedOutTooltipCallback = delegate
                            {
                                return(Common.LocalizeEAString("NRaas.Woohooer:Teenagers"));
                            };
                            reason = "Teenagers";
                            return(false);
                        }
                    }

                    if ((SimTypes.IsSkinJob(a.SimDescription)) || (SimTypes.IsSkinJob(target.SimDescription)))
                    {
                        greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:SkinJob")); };
                        reason = "SkinJob";
                        return(false);
                    }
                }

                return(true);
            }
        }
Ejemplo n.º 28
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);
        }
Ejemplo n.º 29
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);
            }
        }