// Methods
            public override bool Test(Sim a, MusicalInstrument target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                try
                {
                    if (target.ActorsUsingMe.Count == 0x0)
                    {
                        return(false);
                    }
                    Sim          sim          = target.ActorsUsingMe[0x0];
                    Relationship relationship = Relationship.Get(a, sim, false);
                    if ((relationship != null) && (relationship.LTR.CurrentLTR == LongTermRelationshipTypes.Enemy))
                    {
                        return(false);
                    }
                    if (target.ActorsUsingMe.Contains(a))
                    {
                        return(false);
                    }

                    return(CelebrityManager.CanSocialize(a, sim));
                }
                catch (ResetException)
                {
                    throw;
                }
                catch (Exception e)
                {
                    Common.Exception(a, target, e);
                    return(false);
                }
            }
Beispiel #2
0
            public override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                try
                {
                    if (a == target)
                    {
                        return(false);
                    }

                    if (!Woohooer.Settings.mAllowTeenSkinnyDip)
                    {
                        if (target.SimDescription.TeenOrBelow)
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        if (target.SimDescription.ChildOrBelow)
                        {
                            return(false);
                        }
                    }

                    if (!CelebrityManager.CanSocialize(a, target))
                    {
                        return(false);
                    }

                    if (target.SimDescription.IsVisuallyPregnant)
                    {
                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Localization.LocalizeString(target.IsFemale, "Gameplay/Actors/Sim:PregnantFailure", new object[0]));
                        return(false);
                    }

                    SwimmingInPool posture = a.Posture as SwimmingInPool;
                    SwimmingInPool pool2   = target.Posture as SwimmingInPool;
                    if (posture == null)
                    {
                        return(false);
                    }

                    if ((pool2 != null) && (pool2.ContainerPool == posture.ContainerPool))
                    {
                        return(false);
                    }

                    if (!Pool.SimOutfitSupportsSkinnyDipping(target, ref greyedOutTooltipCallback))
                    {
                        return(false);
                    }
                    return(true);
                }
                catch (Exception e)
                {
                    Common.Exception(a, target, e);
                    return(false);
                }
            }
Beispiel #3
0
            public override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                try
                {
                    if (a == target)
                    {
                        return(false);
                    }

                    if (Woohooer.Settings.mAllowTeenSkinnyDip)
                    {
                        if (target.SimDescription.ChildOrBelow)
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        if (target.SimDescription.TeenOrBelow)
                        {
                            return(false);
                        }
                    }

                    if (!CelebrityManager.CanSocialize(a, target))
                    {
                        return(false);
                    }

                    SwimmingInPool posture = a.Posture as SwimmingInPool;
                    SwimmingInPool pool2   = target.Posture as SwimmingInPool;
                    if (posture == null)
                    {
                        return(false);
                    }
                    if ((pool2 != null) && (pool2.ContainerPool == posture.ContainerPool))
                    {
                        return(false);
                    }

                    if (!Pool.SimOutfitSupportsSkinnyDipping(target, ref greyedOutTooltipCallback))
                    {
                        return(false);
                    }
                    return(true);
                }
                catch (Exception e)
                {
                    Common.Exception(a, target, e);
                    return(false);
                }
            }
Beispiel #4
0
            public override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                try
                {
                    SimDescription simDescription = target.SimDescription;
                    if (a == target)
                    {
                        return(false);
                    }

                    if (simDescription.ChildOrBelow || !target.IsHuman)
                    {
                        return(false);
                    }

                    /*
                     * if (simDescription.IsVisuallyPregnant)
                     * {
                     *  return false;
                     * }
                     */

                    if (!CelebrityManager.CanSocialize(a, target))
                    {
                        return(false);
                    }

                    if (simDescription.HasActiveRole && ((simDescription.AssignedRole.Type == Role.RoleType.Bartender) || (simDescription.AssignedRole.Type == Role.RoleType.Bouncer)))
                    {
                        return(false);
                    }

                    if (!(a.Posture is HotTubPosture))
                    {
                        return(false);
                    }

                    if (target.CurrentOutfitCategory == OutfitCategories.SkinnyDippingTowel)
                    {
                        greyedOutTooltipCallback = new GreyedOutTooltipCallback(new GrayedOutTooltipHelper(target.IsFemale, "ClothesStolenTooltip", null).GetTooltip);
                        return(false);
                    }
                    return(true);
                }
                catch (Exception e)
                {
                    Common.Exception(a, target, e);
                    return(false);
                }
            }
Beispiel #5
0
        private static List <InteractionObjectPair> SocialsForNewConversation(SocialComponent ths, Sim actor, Sim target, bool isAutonomous)
        {
            string msg = null;

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

            string[]                 path     = new string[0x0];
            InteractionPriority      priority = new InteractionPriority(isAutonomous ? InteractionPriorityLevel.Autonomous : InteractionPriorityLevel.UserDirected);
            GreyedOutTooltipCallback greyedOutTooltipCallback = null;

            foreach (string str in CelebrityManager.CanSocialize(actor, target) ? new string[] { "Greet Friendly", "Greet Insulting" } : new string[] { "Greet Celebrity" })
            {
                InteractionObjectPair         iop        = new InteractionObjectPair(new SocialInteractionA.Definition(str, path, null, false), target);
                InteractionInstanceParameters parameters = new InteractionInstanceParameters(iop, actor, priority, isAutonomous, true);

                InteractionTestResult result = iop.InteractionDefinition.Test(ref parameters, ref greyedOutTooltipCallback);

                msg += Common.NewLine + "A " + str + " " + iop.InteractionDefinition.GetType().ToString() + " " + result;

                if (result == InteractionTestResult.Pass)
                {
                    list.Add(iop);
                }
            }
            foreach (SocialInteractionCandidate candidate in Conversation.GetActiveTopicInteractions(Relationship.GetLongTermRelationship(actor, target), actor, target, null, isAutonomous))
            {
                if (candidate.Topic.Data.AvailableWhenConversationStarts)
                {
                    InteractionObjectPair         pair2       = new InteractionObjectPair(new SocialInteractionA.Definition(candidate.Name, path, null, false), target);
                    InteractionInstanceParameters parameters2 = new InteractionInstanceParameters(pair2, actor, priority, isAutonomous, true);

                    InteractionTestResult result = pair2.InteractionDefinition.Test(ref parameters2, ref greyedOutTooltipCallback);

                    msg += Common.NewLine + "B " + candidate.Name + " " + pair2.InteractionDefinition.GetType().ToString() + " " + result;

                    if (result == InteractionTestResult.Pass)
                    {
                        list.Add(pair2);
                    }
                }
            }

            Common.WriteLog(msg);

            return(list);
        }
Beispiel #6
0
        public static IEnumerable <InteractionObjectPair> GetAllInteractionsForPieMenu(SocialComponent ths, Sim actor)
        {
            Sim          mSim = ths.mSim;
            Relationship r    = Relationship.Get(mSim, actor, false);

            if ((r == null) || (r.LTR.CurrentLTR == LongTermRelationshipTypes.Stranger))
            {
                sMsg += Common.NewLine + "NewConversation2";

                return(SocialsForNewConversation(ths, actor, mSim, false));
            }
            if (ths.mSim.NeedsToBeGreeted(actor))
            {
                sMsg += Common.NewLine + "Greeting2";

                return(ths.SocialsForGreeting(actor, ths.mSim));
            }
            LTRData           data            = LTRData.Get(r.LTR.CurrentLTR);
            bool              flag            = false;
            GroupingSituation situationOfType = actor.GetSituationOfType <GroupingSituation>();

            if (situationOfType != null)
            {
                flag = situationOfType.IsSimInGroup(mSim);
            }
            DateAndTime whenLastTalked = Relationship.GetWhenLastTalked(actor, mSim);

            if (((!flag && (actor.Conversation == null)) && ((actor.Household != mSim.Household) && (data.HowWellWeKnowEachOther <= 0x1))) && (SimClock.ElapsedTime(TimeUnit.Hours, whenLastTalked) > 24f))
            {
                sMsg += Common.NewLine + "NewConversation3";

                return(SocialsForNewConversation(ths, actor, mSim, false));
            }
            if (!CelebrityManager.CanSocialize(actor, mSim))
            {
                sMsg += Common.NewLine + "Impress";

                return(SocialComponent.SocialsForImpressCelebrity(actor, mSim));
            }

            sMsg += Common.NewLine + "All";

            return(GetUnfilteredSocials(ths, actor, mSim, r));
        }
Beispiel #7
0
            public override InteractionTestResult Test(ref InteractionInstanceParameters parameters, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                InteractionTestResult result = base.Test(ref parameters, ref greyedOutTooltipCallback);

                if (result == InteractionTestResult.Def_TestFailed)
                {
                    Sim actor  = parameters.Actor as Sim;
                    Sim target = parameters.Target as Sim;

                    if (!actor.SimDescription.IsVampire)
                    {
                        return(InteractionTestResult.Def_TestFailed);
                    }
                    else if (!actor.Posture.AllowsNormalSocials() || !target.Posture.AllowsNormalSocials())
                    {
                        return(InteractionTestResult.GenericFail);
                    }
                    else if ((actor.Posture is SwimmingInPool) || (target.Posture is SwimmingInPool))
                    {
                        return(InteractionTestResult.Social_TargetInPool);
                    }
                    else if (Relationship.AreStrangers(actor, target) || target.NeedsToBeGreeted(actor))
                    {
                        return(InteractionTestResult.Social_TargetIsUngreetedOnCurrentLot);
                    }
                    else if (!CelebrityManager.CanSocialize(actor, target))
                    {
                        return(InteractionTestResult.Social_TargetCannotBeSocializedWith);
                    }
                    else if (GetYouShouldTargets(actor, target).Count == 0x0)
                    {
                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(YouShould.LocalizeString("InteractionUnavailable", new object[0x0]));
                        return(InteractionTestResult.GenericFail);
                    }

                    return(InteractionTestResult.Pass);
                }

                return(result);
            }
Beispiel #8
0
        public static void OnPickFromPanel(MiniSimDescription ths, UIMouseEventArgs eventArgs, GameObjectHit gameObjectHit)
        {
            try
            {
                Sims3.Gameplay.UI.PieMenu.ClearInteractions();
                Sims3.Gameplay.UI.PieMenu.HidePieMenuSimHead    = true;
                Sims3.UI.Hud.PieMenu.sIncrementalButtonIndexing = true;

                Sim activeActor = Sim.ActiveActor;
                if (activeActor != null)
                {
                    if (activeActor.InteractionQueue.CanPlayerQueue())
                    {
                        List <InteractionObjectPair> interactions = new List <InteractionObjectPair>();

                        if (GameUtils.IsInstalled(ProductVersion.EP8))
                        {
                            InteractionDefinition interaction = new Mailbox.WriteLoveLetter.Definition(ths.SimDescriptionId);
                            interactions.Add(new InteractionObjectPair(interaction, activeActor));
                        }

                        IPhone targetObject = activeActor.Inventory.Find <IPhone>();
                        if (targetObject != null)
                        {
                            interactions.Add(new InteractionObjectPair(GetCallInviteOverForeignVisitorsFromRelationPanelDefinition(ths), targetObject));
                            interactions.Add(new InteractionObjectPair(targetObject.GetCallChatFromRelationPanelDefinition(ths), targetObject));
                            interactions.Add(new InteractionObjectPair(targetObject.GetCallInviteToAttendGraduationFromRelationPanelDefinition(ths), targetObject));
                        }
                        if (GameUtils.IsInstalled(ProductVersion.EP9))
                        {
                            interactions.Add(new InteractionObjectPair(targetObject.GetSendChatTextFromRelationPanelDefinition(ths), targetObject));
                            interactions.Add(new InteractionObjectPair(targetObject.GetSendInsultTextFromRelationPanelDefinition(ths), targetObject));
                            interactions.Add(new InteractionObjectPair(targetObject.GetSendPictureTextFromRelationPanelDefinition(ths), targetObject));
                            interactions.Add(new InteractionObjectPair(targetObject.GetSendSecretAdmirerTextFromRelationPanelDefinition(ths), targetObject));
                            interactions.Add(new InteractionObjectPair(targetObject.GetSendBreakUpTextFromRelationPanelDefinition(ths), targetObject));
                            interactions.Add(new InteractionObjectPair(targetObject.GetSendWooHootyTextFromRelationPanelDefinition(ths), targetObject));
                        }

                        if (CelebrityManager.CanSocialize(activeActor.SimDescription, ths))
                        {
                            Sims3.Gameplay.UI.PieMenu.TestAndBringUpPieMenu(null, eventArgs, gameObjectHit, interactions, InteractionMenuTypes.Normal);
                        }
                        else
                        {
                            GreyedOutTooltipCallback greyedOutTooltipCallbackForced = delegate
                            {
                                return(Common.LocalizeEAString("Gameplay/CelebritySystem/CelebrityManager:NotAbleToSocialize"));
                            };
                            Sims3.Gameplay.UI.PieMenu.TestAndBringUpPieMenu(null, eventArgs, gameObjectHit, interactions, InteractionMenuTypes.Normal, "Gameplay/Abstracts/GameObject:NoInteractions", false, greyedOutTooltipCallbackForced);
                        }
                    }
                    else
                    {
                        Vector2 mousePosition;
                        if (eventArgs.DestinationWindow != null)
                        {
                            mousePosition = eventArgs.DestinationWindow.WindowToScreen(eventArgs.MousePosition);
                        }
                        else
                        {
                            mousePosition = eventArgs.MousePosition;
                        }
                        Sims3.Gameplay.UI.PieMenu.ShowGreyedOutTooltip(Common.LocalizeEAString("Gameplay/Abstracts/GameObject:TooManyInteractions"), mousePosition);
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception(ths.FullName, e);
            }
        }
Beispiel #9
0
        public static void OnPickFromPanel(SimDescription ths, UIMouseEventArgs eventArgs, GameObjectHit gameObjectHit)
        {
            try
            {
                Sims3.Gameplay.UI.PieMenu.ClearInteractions();
                Sims3.Gameplay.UI.PieMenu.HidePieMenuSimHead    = true;
                Sims3.UI.Hud.PieMenu.sIncrementalButtonIndexing = true;

                Sim activeActor = Sim.ActiveActor;
                if (activeActor != null)
                {
                    if (activeActor.InteractionQueue.CanPlayerQueue())
                    {
                        bool success = false;
                        try
                        {
                            IPhone activePhone = null;
                            if (activeActor.Inventory != null)
                            {
                                activePhone = activeActor.Inventory.Find <IPhone>();
                            }

                            List <InteractionObjectPair> interactions = new List <InteractionObjectPair>();

                            bool isServiceAlien = (ths.Household != null) && ths.Household.IsAlienHousehold;
                            if (GameUtils.IsInstalled(ProductVersion.EP8) && !isServiceAlien)
                            {
                                interactions.Add(new InteractionObjectPair(new Mailbox.WriteLoveLetter.Definition(ths.SimDescriptionId), activeActor));
                            }

                            if (GameUtils.IsInstalled(ProductVersion.EP10))
                            {
                                interactions.Add(new InteractionObjectPair(new OccultMermaid.SignalMermaid.Definition(ths), activeActor));
                            }

                            if (ths.CreatedSim != null)
                            {
                                List <InteractionObjectPair> others = ths.CreatedSim.GetAllInteractionsForActor(activeActor);
                                if (others != null)
                                {
                                    interactions.AddRange(others);
                                }
                            }

                            if (ths.IsHuman)
                            {
                                if (ths.CreatedSim != null)
                                {
                                    interactions.Add(new InteractionObjectPair(CallOver.Singleton, ths.CreatedSim));
                                }

                                if (activePhone != null)
                                {
                                    interactions.Add(new InteractionObjectPair(activePhone.GetCallChatFromRelationPanelDefinition(ths), activePhone));

                                    if (GameUtils.IsInstalled(ProductVersion.EP4))
                                    {
                                        interactions.Add(new InteractionObjectPair(activePhone.GetCallPrank(ths), activePhone));
                                    }

                                    if (GameUtils.IsInstalled(ProductVersion.EP9))
                                    {
                                        interactions.Add(new InteractionObjectPair(activePhone.GetSendChatTextFromRelationPanelDefinition(ths), activePhone));
                                        interactions.Add(new InteractionObjectPair(activePhone.GetSendInsultTextFromRelationPanelDefinition(ths), activePhone));
                                        interactions.Add(new InteractionObjectPair(activePhone.GetSendPictureTextFromRelationPanelDefinition(ths), activePhone));
                                        interactions.Add(new InteractionObjectPair(activePhone.GetSendSecretAdmirerTextFromRelationPanelDefinition(ths), activePhone));
                                        interactions.Add(new InteractionObjectPair(activePhone.GetSendBreakUpTextFromRelationPanelDefinition(ths), activePhone));
                                        if (!sGetSendWooHootyTextDefinition.Valid)
                                        {
                                            interactions.Add(new InteractionObjectPair(activePhone.GetSendWooHootyTextFromRelationPanelDefinition(ths), activePhone));
                                        }
                                        else
                                        {
                                            InteractionDefinition instance = null;
                                            instance = sGetSendWooHootyTextDefinition.Invoke <InteractionDefinition>(new object[] { ths });
                                            interactions.Add(new InteractionObjectPair(instance, activePhone));
                                        }
                                    }

                                    if ((!ths.IsEnrolledInBoardingSchool() && !ths.IsDroppingOut) && !GameStates.IsEarlyDepartureSim(ths.SimDescriptionId))
                                    {
                                        interactions.Add(new InteractionObjectPair(activePhone.GetCallInviteOverFromRelationPanelDefinition(ths, true), activePhone));
                                        interactions.Add(new InteractionObjectPair(activePhone.GetCallInviteToLotFromRelationPanelDefintion(ths), activePhone));
                                        interactions.Add(new InteractionObjectPair(activePhone.GetCallAskOutOnDateFromRelationPanelDefintion(ths), activePhone));
                                        if (!isServiceAlien)
                                        {
                                            interactions.Add(new InteractionObjectPair(activePhone.GetCallInviteHouseholdOverFromRelationshipPanelDefiniton(ths), activePhone));
                                        }
                                        interactions.Add(new InteractionObjectPair(activePhone.GetCallInviteToAttendGraduationFromRelationPanelDefinition(ths), activePhone));
                                    }
                                    else
                                    {
                                        interactions.Add(new InteractionObjectPair(activePhone.GetRemoveFromBoardingSchool(ths), activePhone));
                                    }
                                }
                            }
                            else if (ths.IsPet)
                            {
                                if (ths.CreatedSim != null)
                                {
                                    interactions.Add(new InteractionObjectPair(Sim.CallPet.Singleton, ths.CreatedSim));
                                }

                                if (activePhone != null)
                                {
                                    interactions.Add(new InteractionObjectPair(activePhone.GetCallBringPetOverFromRelationshipPanelDefinition(ths), activePhone));
                                }
                            }

                            if (CelebrityManager.CanSocialize(activeActor.SimDescription, ths))
                            {
                                Sims3.Gameplay.UI.PieMenu.TestAndBringUpPieMenu(ths.CreatedSim, eventArgs, gameObjectHit, interactions, InteractionMenuTypes.Normal);
                                success = true;
                            }
                        }
                        catch (Exception e)
                        {
                            Common.Exception(activeActor.SimDescription, ths, e);
                        }

                        if ((!success) && (ths.CreatedSim != null))
                        {
                            Sims3.Gameplay.UI.PieMenu.TestAndBringUpPieMenu(ths.CreatedSim, eventArgs, gameObjectHit, InteractionsEx.GetImmediateInteractions(ths.CreatedSim), InteractionMenuTypes.Normal);
                        }
                    }
                    else
                    {
                        Vector2 mousePosition;
                        if (eventArgs.DestinationWindow != null)
                        {
                            mousePosition = eventArgs.DestinationWindow.WindowToScreen(eventArgs.MousePosition);
                        }
                        else
                        {
                            mousePosition = eventArgs.MousePosition;
                        }
                        Sims3.Gameplay.UI.PieMenu.ShowGreyedOutTooltip(Common.LocalizeEAString("Gameplay/Abstracts/GameObject:TooManyInteractions"), mousePosition);
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception(ths, e);
            }
        }
Beispiel #10
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));
            }