Ejemplo n.º 1
0
            public override bool Get(SimDescription me, IMiniSimDescription actor, Dictionary <LongTermRelationshipTypes, string> results)
            {
                SimDescription actorSim = actor as SimDescription;

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

                Relationship relation = Relationship.Get(me, actorSim, false);

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

                LTRData data = LTRData.Get(relation.CurrentLTR);

                if (data != null)
                {
                    results[relation.CurrentLTR] = data.GetName(me, actor);
                }

                return(true);
            }
Ejemplo n.º 2
0
 public void PerformPrank(Business business)
 {
     if (!CheckIfAttemptingPrankOnConsecutiveDay(business))
     {
         bool         flag         = false;
         Sim          createdSim   = business.SimConspiringPrank.CreatedSim;
         Sim          sim2         = business.SimAffectedByPrank.CreatedSim;
         bool         flag2        = business.SimAffectedByPrank == createdSim.Occupation.Boss;
         Relationship relationship = Relationship.Get(createdSim, sim2, true);
         LTRData      data         = LTRData.Get(relationship.LTR.CurrentLTR);
         if (!relationship.STC.InNegativeContext || (data.RelationshipClass >= LTRData.RelationshipClassification.Medium))
         {
             base.Display(LocalizeString(createdSim.SimDescription, "FunnyPrankWorked", new object[] { createdSim.SimDescription, business.SimAffectedByPrank }), createdSim.ObjectId, business);
             flag = true;
             float change = flag2 ? Business.kLTRIncreaseWhenPrankSucceedsOnBoss : Business.kLTRIncreaseWhenPrankSucceeds;
             relationship.LTR.UpdateLiking(change);
             relationship.UpdateSTCFromOutsideConversation(sim2, createdSim, CommodityTypes.Funny, (float)Business.kSTCValueOnPranks);
         }
         else if (relationship.STC.InNegativeContext || (data.RelationshipClass == LTRData.RelationshipClassification.Low))
         {
             base.Display(LocalizeString(createdSim.SimDescription, "BadPrankFailed", new object[] { createdSim.SimDescription, business.SimAffectedByPrank }), createdSim.ObjectId, business);
             CommodityTypes[] randomList = new CommodityTypes[] { CommodityTypes.Boring, CommodityTypes.Creepy, CommodityTypes.Insulting, CommodityTypes.Awkward, CommodityTypes.Steamed };
             float            num2       = flag2 ? Business.kLTRDecreaseWhenPrankFailsOnBoss : Business.kLTRDecreaseWhenPrankFails;
             relationship.LTR.UpdateLiking(num2);
             relationship.UpdateSTCFromOutsideConversation(sim2, createdSim, RandomUtil.GetRandomObjectFromList(randomList), (float)Business.kSTCValueOnPranks);
         }
         if (flag2)
         {
             float perfChange = flag ? Business.kCareerPerformanceChange : (-1f * Business.kCareerPerformanceChange);
             business.AddPerformance(perfChange);
         }
         business.WasLastPrankSuccessful = flag;
         business.IsPrankSet             = false;
     }
 }
Ejemplo n.º 3
0
        private static bool RelationshipIsInappropriate(LTRData data, IMiniSimDescription a, IMiniSimDescription b, LongTermRelationshipTypes currentLTR)
        {
            if (!data.IsRomantic)
            {
                return(false);
            }

            if ((a.ChildOrBelow) || (b.ChildOrBelow))
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 4
0
            public new List <Sim> GetSims(Sim actor)
            {
                List <Sim> list = new List <Sim>();

                foreach (Relationship relationship in actor.SocialComponent.Relationships)
                {
                    SimDescription otherSimDescription = relationship.GetOtherSimDescription(actor.SimDescription);
                    if ((((LTRData.Get(relationship.LTR.CurrentLTR).Score >= Hospital.CreateBabyWith.kLTRForBabyMaking) && (otherSimDescription.CreatedSim != null)) && (this.CanMakeBabyWith(actor, otherSimDescription.CreatedSim) && !otherSimDescription.CreatedSim.IsSleeping)) && !otherSimDescription.CreatedSim.IsAtWork)
                    {
                        list.Add(otherSimDescription.CreatedSim);
                    }
                }
                return(list);
            }
Ejemplo n.º 5
0
        protected static void Perform(Relationship relation, LongTermRelationshipTypes newState)
        {
            if (relation.CurrentLTR == newState)
            {
                return;
            }

            LongTermRelationshipTypes oldState = relation.CurrentLTR;

            LTRData data = LTRData.Get(newState);

            if (data == null)
            {
                return;
            }

            bool  isChangingWorlds = GameStates.sIsChangingWorlds;
            float liking           = relation.LTR.Liking;

            try
            {
                GameStates.sIsChangingWorlds = true;

                relation.LTR.ChangeBitsForState(newState);
                relation.LTR.ChangeState(newState);
            }
            finally
            {
                relation.LTR.mLiking         = liking;
                GameStates.sIsChangingWorlds = isChangingWorlds;
            }

            switch (newState)
            {
            case LongTermRelationshipTypes.Partner:
            case LongTermRelationshipTypes.Fiancee:
            case LongTermRelationshipTypes.Spouse:
                relation.SimDescriptionA.SetPartner(relation.SimDescriptionB);
                break;
            }

            relation.LTR.UpdateUI();

            SetPreviousState(relation.SimDescriptionA, relation.SimDescriptionB, newState);
            SetPreviousState(relation.SimDescriptionB, relation.SimDescriptionA, newState);
        }
Ejemplo n.º 6
0
        protected static bool BumpDown(SimDescription a, SimDescription b, bool prompt)
        {
            Relationship relation = Relationship.Get(a, b, true);

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

            string currentState = relation.LTR.CurrentLTR;

            string nextState = ChangeRelationship.NextNegativeRomanceState(currentState);

            if (nextState == null)
            {
                if (prompt)
                {
                    SimpleMessageDialog.Show("Bump to Lower Level", "There is no way to go lower than these sims already are.");
                }
                return(false);
            }

            if (relation.LTR.RelationshipIsInappropriate(LTRData.Get(nextState)))
            {
                if (prompt)
                {
                    SimpleMessageDialog.Show("Bump to Lower Level", "A relationship of " + nextState + " is unavailable to the selected sims.");
                }
                return(false);
            }

            if (a.Partner == b)
            {
                a.Partner = null;
                b.Partner = null;
            }

            relation.LTR.ForceChangeState(nextState);
            if (currentState == relation.LTR.CurrentLTR)
            {
                return(false);
            }

            StyledNotification.Show(new StyledNotification.Format("Relationship between " + a.FirstName + " " + a.LastName + " and " + b.FirstName + " " + b.LastName + " changed to " + nextState, StyledNotification.NotificationStyle.kAlert));
            return(true);
        }
Ejemplo n.º 7
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));
        }
Ejemplo n.º 8
0
        protected static void ForceChangeState(Relationship relation, LongTermRelationshipTypes state)
        {
            LongTermRelationship.InteractionBits bits = relation.LTR.LTRInteractionBits & (LongTermRelationship.InteractionBits.HaveBeenBestFriends | LongTermRelationship.InteractionBits.HaveBeenFriends | LongTermRelationship.InteractionBits.HaveBeenPartners);

            LTRData data = LTRData.Get(state);

            if (relation.LTR.RelationshipIsInappropriate(data))
            {
                relation.LTR.ChangeBitsForState(state);
                relation.LTR.ChangeState(state);
                relation.LTR.UpdateUI();
            }
            else
            {
                relation.LTR.ForceChangeState(state);
            }

            if (state == LongTermRelationshipTypes.Spouse)
            {
                relation.SimDescriptionA.Genealogy.Marry(relation.SimDescriptionB.Genealogy);

                MidlifeCrisisManager.OnBecameMarried(relation.SimDescriptionA, relation.SimDescriptionB);

                relation.LTR.RemoveInteractionBit(LongTermRelationship.InteractionBits.Divorce);
                relation.LTR.AddInteractionBit(LongTermRelationship.InteractionBits.Marry);

                relation.SetMarriedInGame();

                if (SeasonsManager.Enabled)
                {
                    relation.WeddingAnniversary      = new WeddingAnniversary(SeasonsManager.CurrentSeason, (int)SeasonsManager.DaysElapsed);
                    relation.WeddingAnniversary.SimA = relation.SimDescriptionA;
                    relation.WeddingAnniversary.SimB = relation.SimDescriptionB;
                    relation.WeddingAnniversary.CreateAlarm();
                }
            }

            relation.LTR.AddInteractionBit(bits);
        }
Ejemplo n.º 9
0
        public static List <PhoneSimPicker.SimPickerInfo> ListOfAllSims(Sim me)
        {
            List <PhoneSimPicker.SimPickerInfo> sims = new List <PhoneSimPicker.SimPickerInfo>();

            List <Sim> list = new List <Sim>(Sims3.Gameplay.Queries.GetObjects <Sim>());

            foreach (Sim sim in list)
            {
                if (sim.LotCurrent != me.LotCurrent)
                {
                    continue;
                }

                if (!sim.SimDescription.TeenOrAbove)
                {
                    continue;
                }

                PhoneSimPicker.SimPickerInfo item = new PhoneSimPicker.SimPickerInfo();
                item.FirstName      = sim.SimDescription.LastName + ",";
                item.LastName       = sim.SimDescription.FirstName;
                item.Thumbnail      = sim.SimDescription.GetThumbnailKey(ThumbnailSize.Large, 0);
                item.SimDescription = sim.SimDescription;

                Relationship relation = Relationship.Get(sim.SimDescription, me.SimDescription, false);
                if (relation != null)
                {
                    item.RelationShip      = relation.LTR.Liking;
                    item.RelationshipImage = relation.LTR.CurrentLTR;
                    item.Friend            = relation.AreFriends();
                }
                else if (sim == me)
                {
                    item.RelationShip      = 100f;
                    item.RelationshipImage = "Best Friend";
                    item.Friend            = true;
                }
                else
                {
                    item.RelationShip      = 0f;
                    item.RelationshipImage = "Stranger";
                    item.Friend            = false;
                }

                item.RelationshipText          = LTRData.Get(item.RelationshipImage).GetName(me.SimDescription, sim.SimDescription);
                item.RelationshipWithFirstName = me.SimDescription.FirstName;

                item.CoWorker = false;
                if ((me.CareerManager != null) && (me.CareerManager.Job != null))
                {
                    if (sim.SimDescription == me.CareerManager.Job.Boss)
                    {
                        item.CoWorker = true;
                    }
                    else
                    {
                        foreach (SimDescription description2 in me.CareerManager.Job.Coworkers)
                        {
                            if (description2 == sim.SimDescription)
                            {
                                item.CoWorker = true;
                                break;
                            }
                        }
                    }
                }

                sims.Add(item);
            }

            return(sims);
        }
Ejemplo n.º 10
0
        protected override bool Run(SimDescription a, SimDescription b)
        {
            Relationship relation = Relationship.Get(a, b, true);

            if (relation == null)
            {
                return(true);
            }

            LongTermRelationshipTypes currentState = relation.LTR.CurrentLTR;

            List <NewLevel> allOptions = new List <NewLevel>();

            int count = 0;

            LongTermRelationshipTypes newState = NextNegativeEnemyState(currentState);

            while ((count < 25) && (newState != LongTermRelationshipTypes.Undefined))
            {
                count++;

                LTRData level = LTRData.Get(newState);
                if ((level != null) && (!RelationshipIsInappropriate(relation.LTR, level)))
                {
                    allOptions.Insert(0, new NewLevel(newState, false, false));
                }

                newState = NextNegativeEnemyState(newState);
            }

            if (SimTypes.IsEquivalentSpecies(a, b))
            {
                newState = NextNegativeRomanceState(currentState);
                while ((count < 25) && (newState != LongTermRelationshipTypes.Undefined))
                {
                    count++;

                    LTRData level = LTRData.Get(newState);
                    if ((level != null) && (!RelationshipIsInappropriate(relation.LTR, level)))
                    {
                        allOptions.Insert(0, new NewLevel(newState, false, true));
                    }

                    newState = NextNegativeRomanceState(newState);
                }
            }

            allOptions.Add(new NewLevel(currentState, true, false));

            newState = NextPositiveFriendState(currentState);
            while ((count < 25) && (newState != LongTermRelationshipTypes.Undefined))
            {
                count++;

                LTRData level = LTRData.Get(newState);
                if ((level != null) && (!RelationshipIsInappropriate(relation.LTR, level)))
                {
                    allOptions.Add(new NewLevel(newState, true, false));
                }

                newState = NextPositiveFriendState(newState);
            }

            if (SimTypes.IsEquivalentSpecies(a, b))
            {
                newState = NextPositiveRomanceState(currentState);
                while ((count < 25) && (newState != LongTermRelationshipTypes.Undefined))
                {
                    count++;

                    LTRData level = LTRData.Get(newState);
                    if ((level != null) && (!RelationshipIsInappropriate(relation.LTR, level)))
                    {
                        allOptions.Add(new NewLevel(newState, true, true));
                    }

                    newState = NextPositiveRomanceState(newState);
                }
            }

            Dictionary <LongTermRelationshipTypes, bool> states = new Dictionary <LongTermRelationshipTypes, bool>();

            List <NewLevel> options = new List <NewLevel>();

            foreach (NewLevel level in allOptions)
            {
                if (level.mState == LongTermRelationshipTypes.Undefined)
                {
                    continue;
                }

                if (states.ContainsKey(level.mState))
                {
                    continue;
                }
                states.Add(level.mState, true);

                count++;

                level.Count = count;

                options.Add(level);
            }

            NewLevel choice = new RelationshipSelection(a.FullName, options, a, b).SelectSingle();

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

            List <string> selection = new List <string>();

            if (choice.mState == currentState)
            {
                return(true);
            }

            Dictionary <LongTermRelationshipTypes, bool> lookup = new Dictionary <LongTermRelationshipTypes, bool>();

            lookup.Add(relation.LTR.CurrentLTR, true);

            bool bFirst = true;

            if (choice.mUp)
            {
                int recurseCount = 0;
                while ((recurseCount < 25) && (BumpUp(a, b, bFirst, choice.mRomantic)))
                {
                    recurseCount++;

                    if (choice.mState == relation.LTR.CurrentLTR)
                    {
                        return(true);
                    }

                    if (lookup.ContainsKey(relation.LTR.CurrentLTR))
                    {
                        return(true);
                    }
                    lookup.Add(relation.LTR.CurrentLTR, true);

                    bFirst = false;
                }
            }
            else
            {
                int recurseCount = 0;
                while ((recurseCount < 25) && (BumpDown(a, b, bFirst, choice.mRomantic)))
                {
                    recurseCount++;

                    if (choice.mState == relation.LTR.CurrentLTR)
                    {
                        return(true);
                    }

                    if (lookup.ContainsKey(relation.LTR.CurrentLTR))
                    {
                        return(true);
                    }
                    lookup.Add(relation.LTR.CurrentLTR, true);

                    bFirst = false;
                }
            }

            return(true);
        }
Ejemplo n.º 11
0
 private static bool RelationshipIsInappropriate(LongTermRelationship ltr, LTRData data)
 {
     return(RelationshipIsInappropriate(data, ltr.mParent.SimDescriptionA, ltr.mParent.SimDescriptionB, ltr.CurrentLTR));
 }
Ejemplo n.º 12
0
        protected static bool BumpUp(SimDescription a, SimDescription b, bool prompt)
        {
            Relationship relation = Relationship.Get(a, b, true);

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

            string currentState = relation.LTR.CurrentLTR;

            string nextState = null;

            if (currentState == "Stranger")
            {
                nextState = "Acquaintance";
            }
            else
            {
                nextState = ChangeRelationship.NextPositiveRomanceState(currentState);
            }

            if (nextState == null)
            {
                if (prompt)
                {
                    SimpleMessageDialog.Show("Bump to Next Level", "There is no way to go higher than these sims already are.");
                }
                return(false);
            }

            if (relation.LTR.RelationshipIsInappropriate(LTRData.Get(nextState)))
            {
                if (prompt)
                {
                    SimpleMessageDialog.Show("Bump to Next Level", "A relationship of " + nextState + " is unavailable to the selected sims.");
                }
                return(false);
            }

            if (a.Genealogy.IsBloodRelated(b.Genealogy))
            {
                if ((prompt) && (!AcceptCancelDialog.Show(a.FirstName + " " + a.LastName + " and " + b.FirstName + " " + b.LastName + " are blood related.  Proceed?")))
                {
                    return(false);
                }
            }

            if (currentState == "Romantic Interest")
            {
                if ((a.Partner != null) && (a.Partner != b))
                {
                    if ((b.Partner != null) && (b.Partner != a))
                    {
                        if ((prompt) && (!AcceptCancelDialog.Show("Both " + a.FirstName + " " + a.LastName + " and " + b.FirstName + " " + b.LastName + " already have different partners.  Proceed?")))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        if ((prompt) && (!AcceptCancelDialog.Show(a.FirstName + " " + a.LastName + " already has a different partner.  Proceed?")))
                        {
                            return(false);
                        }
                    }
                }
                else if ((b.Partner != null) && (b.Partner != a))
                {
                    if ((prompt) && (!AcceptCancelDialog.Show(b.FirstName + " " + b.LastName + " already has a different partner.  Proceed?")))
                    {
                        return(false);
                    }
                }

                if (a.Partner != null)
                {
                    BumpDown(a, a.Partner, false);
                }
                if (b.Partner != null)
                {
                    BumpDown(b, b.Partner, false);
                }

                a.SetPartner(b);
            }

            relation.LTR.ForceChangeState(nextState);

            if (currentState == relation.LTR.CurrentLTR)
            {
                return(false);
            }

            StyledNotification.Show(new StyledNotification.Format("Relationship between " + a.FirstName + " " + a.LastName + " and " + b.FirstName + " " + b.LastName + " changed to " + nextState, StyledNotification.NotificationStyle.kAlert));
            return(true);
        }
Ejemplo n.º 13
0
            /*
             * [Tunable]
             * [TunableComment("Range: Fun/Stress motive amount.  Description:  Amount of stress that a Sim gets when seeing another Sim die.")]
             * public static float kWitnessDeathStressPenalty = -50f;
             *
             * [Tunable]
             * [TunableComment("Range: Float multiplier.  Description:  Multiplier on additional stress when a family member of loved one sees a Sim die.")]
             * public static float kWitnessDeathRelationshipMultiplier = 1.5f;
             *
             * [TunableComment("Range: Fun/Stress motive amount.  Description:  Amount of fun that a Sim gets when seeing an enemy Sim die.")]
             * [Tunable]
             * public static float kWitnessEnemyDeathFunGain = 50f;
             *
             */



            public override bool Run()
            {
                SwimmingInPool swimmingInPool = Actor.Posture as SwimmingInPool;

                if (swimmingInPool != null && !swimmingInPool.ContainerPool.RouteToEdge(Actor))
                {
                    return(false);
                }
                SwimmingInPool swimmingInPool2 = Target.Posture as SwimmingInPool;

                if (swimmingInPool2 != null)
                {
                    if (!swimmingInPool2.ContainerPool.RouteToEdge(Actor))
                    {
                        return(false);
                    }
                    Actor.RouteTurnToFace(Target.Position);
                }

                else if (!GlobalFunctions.ObjectsWithinRadiusOfEachOther(Actor, Target, 2f))
                {
                    if (Actor == null || Target == null || Target.LotCurrent == null)
                    {
                        return(false);
                    }

                    Route route = Actor.CreateRoute();
                    if (route == null)
                    {
                        return(false);
                    }

                    RequestWalkStyle(Sim.WalkStyle.Run);

                    route.PlanToPointRadialRange(Target.Position, 2f, 6f, RouteDistancePreference.PreferNearestToRouteDestination, RouteOrientationPreference.TowardsObject, Target.LotCurrent.LotId, new int[1]
                    {
                        Target.RoomId
                    });

                    if (Actor == null || !Actor.DoRoute(route))
                    {
                        return(false);
                    }
                    UnrequestWalkStyle(Sim.WalkStyle.Run);
                }
                else
                {
                    Actor.RouteTurnToFace(Target.Position);
                }
                if (Simulator.CheckYieldingContext(false))
                {
                    Simulator.Sleep(20);
                }
                if (Target.SimDescription == null || !Target.SimDescription.IsValidDescription)
                {
                    return(true);
                }
                NFinalizeDeath.CheckYieldingContext();
                StateMachineClient stateMachineClient = StateMachineClient.Acquire(Actor, "DeathReactions");

                stateMachineClient.SetActor("x", Actor);
                stateMachineClient.EnterState("x", "Enter");
                BeginCommodityUpdates();
                bool flag  = false;
                bool flag2 = false;

                //bool flag3 = false;

                LTRData.RelationshipClassification relationshipClassification = LTRData.RelationshipClassification.Low;
                Relationship relationship = Relationship.Get(Actor, Target, false);

                if (relationship != null)
                {
                    relationshipClassification = LTRData.Get(relationship.LTR.CurrentLTR).RelationshipClass;
                }

                if (Actor == null || Target == null || Actor.Genealogy == null || Target.Genealogy == null)
                {
                    return(true);
                }

                if (relationshipClassification == LTRData.RelationshipClassification.High || Actor.Genealogy.IsBloodRelated(Target.Genealogy))
                {
                    if (relationship != null && relationship.AreRomantic() && relationship.LTR.IsPositive)
                    {
                        flag2 = true;
                    }
                    else
                    {
                        flag = true;
                    }
                    //flag3 = true;
                }
                NFinalizeDeath.CheckYieldingContext();
                switch (Actor.SimDescription.Species)
                {
                case CASAgeGenderFlags.None:
                case CASAgeGenderFlags.Human:
                    if (!Actor.IsInActiveHousehold)
                    {
                        stateMachineClient.RequestState("x", "Shocked");
                        NFinalizeDeath.CheckYieldingContext();
                        if (RandomUtil.RandomChance(25))
                        {
                            stateMachineClient.RequestState("x", "Evil");
                        }
                        else
                        {
                            stateMachineClient.RequestState("x", "LovedOneLoop");
                        }
                        flag  = true;
                        flag2 = true;
                        //flag3 = true;
                    }
                    else
                    {
                        stateMachineClient.RequestState("x", "Shocked");
                        NFinalizeDeath.CheckYieldingContext();
                        Actor.Motives.ChangeValue(CommodityKind.Fun, kWitnessDeathStressPenalty);
                        stateMachineClient.RequestState("x", "BasicLoop");
                        flag  = false;
                        flag2 = false;
                        //flag3 = false;
                    }

                    break;

                case CASAgeGenderFlags.Dog:
                case CASAgeGenderFlags.LittleDog:
                    stateMachineClient.RequestState("x", "Dog");
                    break;

                case CASAgeGenderFlags.Cat:
                    stateMachineClient.RequestState("x", "Cat");
                    break;

                case CASAgeGenderFlags.Horse:
                    stateMachineClient.RequestState("x", "Horse");
                    break;
                }
                EventTracker.SendEvent(EventTypeId.kSawSimDie, Actor, Target);
                DoLoop(ExitReason.Default, __LoopDel, stateMachineClient);
                EndCommodityUpdates(true);
                if (Actor.IsInActiveHousehold)
                {
                    if (Actor.BuffManager == null)
                    {
                        return(false);
                    }

                    if (flag2 && Target.SimDescription.DeathStyle != 0)
                    {
                        Actor.BuffManager.AddElement(BuffNames.HeartBroken, Origin.FromWitnessingDeath);
                        BuffHeartBroken.BuffInstanceHeartBroken buffInstanceHeartBroken = Actor.BuffManager.GetElement(BuffNames.HeartBroken) as BuffHeartBroken.BuffInstanceHeartBroken;
                        if (buffInstanceHeartBroken != null)
                        {
                            buffInstanceHeartBroken.MissedSim = Target.SimDescription;
                        }
                    }
                    else if (flag && Target.SimDescription.DeathStyle != 0)
                    {
                        Actor.BuffManager.AddElement(BuffNames.Mourning, Urnstone.CalculateMourningMoodStrength(Actor, Target.SimDescription), Origin.FromWitnessingDeath);
                        BuffMourning.BuffInstanceMourning buffInstanceMourning = Actor.BuffManager.GetElement(BuffNames.Mourning) as BuffMourning.BuffInstanceMourning;
                        if (buffInstanceMourning != null)
                        {
                            buffInstanceMourning.MissedSim = Target.SimDescription;
                        }
                    }
                }
                else
                {
                    if (Actor.BuffManager == null)
                    {
                        return(false);
                    }
                    if (flag2)
                    {
                        Actor.BuffManager.AddElement(BuffNames.HeartBroken, Origin.FromWitnessingDeath);
                        BuffHeartBroken.BuffInstanceHeartBroken buffInstanceHeartBroken = Actor.BuffManager.GetElement(BuffNames.HeartBroken) as BuffHeartBroken.BuffInstanceHeartBroken;
                        if (buffInstanceHeartBroken != null)
                        {
                            buffInstanceHeartBroken.MissedSim = Target.SimDescription;
                        }
                    }
                    else if (flag)
                    {
                        Actor.BuffManager.AddElement(BuffNames.Mourning, Urnstone.CalculateMourningMoodStrength(Actor, Target.SimDescription), Origin.FromWitnessingDeath);
                        BuffMourning.BuffInstanceMourning buffInstanceMourning = Actor.BuffManager.GetElement(BuffNames.Mourning) as BuffMourning.BuffInstanceMourning;
                        if (buffInstanceMourning != null)
                        {
                            buffInstanceMourning.MissedSim = Target.SimDescription;
                        }
                    }
                }
                NFinalizeDeath.CheckYieldingContext();
                stateMachineClient.RequestState("x", "Exit");
                stateMachineClient.Dispose();
                //if (!NFinalizeDeath.IsAllActiveHousehold_SimObject(Actor) &&
                //        !NFinalizeDeath.IsAllActiveHousehold_SimObject(Target) &&
                //        !(Actor.SimDescription.Service is GrimReaper) &&
                //        !(Target.SimDescription.Service is GrimReaper) &&
                //        RandomUtil.RandomChance(70)
                //)
                //return NFinalizeDeath.ForceNHSReapSoul(Target, Actor);

                return(true);
            }
Ejemplo n.º 14
0
        protected static void OnLTRChanged(Event e)
        {
            using (Common.TestSpan span = new Common.TestSpan(ScoringLookup.Stats, "Duration TeenAdultControl:OnLTRChanged"))
            {
                if (!sInLTRChanged)
                {
                    try
                    {
                        sInLTRChanged = true;

                        RelationshipLTRChangedEvent ltrEvent = e as RelationshipLTRChangedEvent;
                        if ((ltrEvent != null) && (ltrEvent.OldLTR != ltrEvent.RelationshipState))
                        {
                            Common.StringBuilder msg = new Common.StringBuilder("TeenAdult:OnLTRChanged");

                            Relationship relation = ltrEvent.Relationship;

                            SimDescription descA = relation.SimDescriptionA;
                            SimDescription descB = relation.SimDescriptionB;

                            bool perform = false;

                            LTRData oldLTR = LTRData.Get(ltrEvent.OldLTR);
                            if (oldLTR != null)
                            {
                                if (LongTermRelationship.RelationshipIsInappropriate(oldLTR, descA, descB, ltrEvent.OldLTR))
                                {
                                    perform = true;
                                }
                            }

                            LongTermRelationshipTypes wasRel = ltrEvent.RelationshipState;

                            msg += Common.NewLine + relation.SimDescriptionA.FullName;
                            msg += Common.NewLine + relation.SimDescriptionB.FullName;
                            msg += Common.NewLine + "Old: " + ltrEvent.OldLTR;
                            msg += Common.NewLine + "Was: " + wasRel;
                            msg += Common.NewLine + "Perform: " + perform;

                            if ((perform) && (descA.IsHuman) && (descB.IsHuman))
                            {
                                if (((descA.Teen) && (descB.YoungAdultOrAbove)) || ((descB.Teen) && (descA.YoungAdultOrAbove)))
                                {
                                    sTracer.Perform();

                                    if (sTracer.mRevert)
                                    {
                                        Perform(relation, ltrEvent.OldLTR);

                                        msg += Common.NewLine + "Now: " + ltrEvent.RelationshipState;
                                    }

                                    if (!sTracer.mIgnore)
                                    {
                                        msg += Common.NewLine + sTracer;

                                        Common.DebugStackLog(msg);
                                    }
                                }
                            }
                        }
                    }
                    finally
                    {
                        sInLTRChanged = false;
                    }
                }
            }
        }
Ejemplo n.º 15
0
        public List <PhoneSimPicker.SimPickerInfo> GetPickerInfo()
        {
            List <PhoneSimPicker.SimPickerInfo> sims = new List <PhoneSimPicker.SimPickerInfo>();

            if (mAddAll)
            {
                PhoneSimPicker.SimPickerInfo all = new PhoneSimPicker.SimPickerInfo();

                if (mLastFirst)
                {
                    all.FirstName = "";
                    all.LastName  = "(" + Common.LocalizeEAString("Ui/Caption/ObjectPicker:All") + ")";
                }
                else
                {
                    all.FirstName = "(" + Common.LocalizeEAString("Ui/Caption/ObjectPicker:All") + ")";
                    all.LastName  = "";
                }

                all.CoWorker                  = false;
                all.Thumbnail                 = new ThumbnailKey(ResourceKey.CreatePNGKey("shop_all_r2", ResourceUtils.ProductVersionToGroupId(ProductVersion.BaseGame)), ThumbnailSize.Large);
                all.RelationShip              = 0f;
                all.LtrType                   = LongTermRelationshipTypes.Stranger;
                all.Friend                    = false;
                all.RelationshipText          = "";
                all.RelationshipWithFirstName = mMe.FirstName;

                sims.Add(all);
            }

            foreach (T sim in All)
            {
                if (!AllowRow(sim))
                {
                    continue;
                }

                PhoneSimPicker.SimPickerInfo item = new PhoneSimPicker.SimPickerInfo();

                string firstName = null;
                string lastName  = null;
                GetName(sim, out firstName, out lastName);

                item.FirstName = firstName;
                item.LastName  = lastName;
                item.CoWorker  = false;

                IMiniRelationship relation = null;

                if (sim is SimDescription)
                {
                    SimDescription simDesc = sim as SimDescription;

                    if (simDesc.GetOutfit(OutfitCategories.Everyday, 0x0) != null)
                    {
                        try
                        {
                            item.Thumbnail = sim.GetThumbnailKey(ThumbnailSize.Large, 0);
                        }
                        catch
                        { }
                    }

                    if (mMe is SimDescription)
                    {
                        SimDescription meDesc = mMe as SimDescription;

                        relation = Relationship.Get(simDesc, meDesc, false);

                        if ((meDesc.CareerManager != null) && (meDesc.CareerManager.Occupation != null))
                        {
                            if (sim == meDesc.CareerManager.Occupation.Boss)
                            {
                                item.CoWorker = true;
                            }
                            else if (meDesc.CareerManager.Occupation.Coworkers != null)
                            {
                                foreach (SimDescription description2 in meDesc.CareerManager.Occupation.Coworkers)
                                {
                                    if (description2 == sim)
                                    {
                                        item.CoWorker = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        relation = mMe.GetMiniRelationship(simDesc);
                    }
                }
                else
                {
                    try
                    {
                        item.Thumbnail = sim.GetThumbnailKey(ThumbnailSize.Large, 0);
                    }
                    catch
                    { }

                    relation = sim.GetMiniRelationship(mMe);
                }

                item.SimDescription = sim;

                if (sim == mMe)
                {
                    item.RelationShip = 100f;
                    item.LtrType      = LongTermRelationshipTypes.BestFriend;
                    item.Friend       = true;
                }
                else if (relation != null)
                {
                    item.RelationShip = relation.CurrentLTRLiking;
                    item.LtrType      = relation.CurrentLTR;
                    item.Friend       = relation.AreFriends() || relation.AreRomantic();
                }
                else
                {
                    item.RelationShip = 0f;
                    item.LtrType      = LongTermRelationshipTypes.Stranger;
                    item.Friend       = false;
                }

                item.RelationshipText          = LTRData.Get(item.LtrType).GetName(mMe, sim);
                item.RelationshipWithFirstName = mMe.FirstName;

                sims.Add(item);
            }

            return(sims);
        }
Ejemplo n.º 16
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.º 17
0
 protected static string LocalizeStatus(SimDescription a, SimDescription b, LongTermRelationshipTypes state)
 {
     return(LTRData.Get(state).GetName(a, b));
 }
Ejemplo n.º 18
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            //if (!UIUtils.IsOkayToStartModalDialog()) return false;

            bool hasExclusiveAccess;
            Lot  partyVenue = GetVenue(parameters.mActor, out hasExclusiveAccess);

            float            num2;
            OutfitCategories formalwear;

            Sims3.Gameplay.Situations.Party party = null;
            bool isPartyAtHome = (partyVenue == parameters.mActor.LotHome);

            if (partyVenue == null)
            {
                return(OptionResult.Failure);
            }
            if (!parameters.mActor.IsSelectable)
            {
                return(OptionResult.Failure);
            }

            PartyPickerDialog.PartyType partyTypes = PartyPickerDialog.PartyType.kAll;

            // Keep as GameUtils
            if (GameUtils.IsOnVacation())
            {
                partyTypes &= ~PartyPickerDialog.PartyType.kBirthday;
            }

            if (partyVenue.LastDiedSim == null)
            {
                partyTypes &= ~PartyPickerDialog.PartyType.kFuneral;
            }

            Sim actorSim = parameters.mActor as Sim;

            Political job = actorSim.Occupation as Political;

            if ((job == null) || (!job.HasCampaignMoneyMetric()))
            {
                partyTypes &= ~PartyPickerDialog.PartyType.kCampaign;
            }

            partyTypes &= ~PartyPickerDialog.PartyType.kWedding;

            foreach (Sim sim in CommonSpace.Helpers.Households.AllSims(parameters.mActor.Household))
            {
                if (sim.IsEngaged)
                {
                    partyTypes |= PartyPickerDialog.PartyType.kWedding;
                    break;
                }
            }

            if (!GameUtils.IsInstalled(ProductVersion.EP4))
            {
                partyTypes &= ~PartyPickerDialog.PartyType.kBachelorParty;
                partyTypes &= ~PartyPickerDialog.PartyType.kChildSlumberParty;
                partyTypes &= ~PartyPickerDialog.PartyType.kTeenParty;
                partyTypes &= ~PartyPickerDialog.PartyType.kTeenSlumberParty;
            }
            else
            {
                if (isPartyAtHome)
                {
                    if (!actorSim.SimDescription.Child)
                    {
                        partyTypes &= ~PartyPickerDialog.PartyType.kChildSlumberParty;
                    }

                    if (!actorSim.SimDescription.Teen)
                    {
                        partyTypes &= ~PartyPickerDialog.PartyType.kTeenParty;
                        partyTypes &= ~PartyPickerDialog.PartyType.kTeenSlumberParty;
                    }
                }
                else
                {
                    partyTypes &= ~PartyPickerDialog.PartyType.kChildSlumberParty;
                    partyTypes &= ~PartyPickerDialog.PartyType.kTeenParty;
                    partyTypes &= ~PartyPickerDialog.PartyType.kTeenSlumberParty;
                }
            }

            partyTypes &= ~PartyPickerDialog.PartyType.kPoolParty;
            partyTypes &= ~PartyPickerDialog.PartyType.kFeastParty;
            partyTypes &= ~PartyPickerDialog.PartyType.kCostumeParty;
            partyTypes &= ~PartyPickerDialog.PartyType.kGiftGivingParty;
            if (GameUtils.IsInstalled(ProductVersion.EP8) /*&& isPartyAtHome*/)
            {
                partyTypes |= PartyPickerDialog.PartyType.kFeastParty;
                partyTypes |= PartyPickerDialog.PartyType.kCostumeParty;
                partyTypes |= PartyPickerDialog.PartyType.kGiftGivingParty;
                //if (PoolParty.CanSimThrowPoolParty(actorSim))
                if (partyVenue.GetSwimmingPoolCount() > 0)
                {
                    partyTypes |= PartyPickerDialog.PartyType.kPoolParty;
                }
            }

            partyTypes &= ~PartyPickerDialog.PartyType.kJuiceKeggerParty;
            partyTypes &= ~PartyPickerDialog.PartyType.kBonfire;
            partyTypes &= ~PartyPickerDialog.PartyType.kTailgatingParty;
            partyTypes &= ~PartyPickerDialog.PartyType.kVideoGameLANParty;
            partyTypes &= ~PartyPickerDialog.PartyType.kMasqueradeBall;
            partyTypes &= ~PartyPickerDialog.PartyType.kVictoryParty;

            if (GameUtils.IsInstalled(ProductVersion.EP9))
            {
                partyTypes |= PartyPickerDialog.PartyType.kTailgatingParty;
                partyTypes |= PartyPickerDialog.PartyType.kVideoGameLANParty;
                partyTypes |= PartyPickerDialog.PartyType.kMasqueradeBall;
                partyTypes |= PartyPickerDialog.PartyType.kVictoryParty;

                if (JuiceKeggerParty.CanSimThrowJuiceKeggerParty(actorSim))
                {
                    partyTypes |= PartyPickerDialog.PartyType.kJuiceKeggerParty;
                }

                if (BonfireParty.CanSimThrowBonfire(actorSim))
                {
                    partyTypes |= PartyPickerDialog.PartyType.kBonfire;
                }
            }

            bool         criteriaCanceled;
            SimSelection list = SimSelection.Create(Common.Localize("Party:SelectTitle"), actorSim.SimDescription, this, GetCriteria(parameters), false, false, out criteriaCanceled);

            if (list.IsEmpty)
            {
                SimpleMessageDialog.Show(Common.LocalizeEAString("Gameplay/Objects/Electronics/Phone/CallThrowParty:NoSimsWT"), Common.LocalizeEAString(parameters.mActor.IsFemale, "Gameplay/Objects/Electronics/Phone/CallThrowParty:NoSims", new object[] { parameters.mActor }), ModalDialog.PauseMode.PauseSimulator);
                return(OptionResult.Failure);
            }

            float openHour    = -1f;
            float closingHour = -1f;

            PartyPickerDialog.PartyInfo info = PartyPickerDialogEx.Show(partyTypes, list.GetPickerInfo(), parameters.mActor.GetThumbnailKey(), isPartyAtHome, 25, -1, openHour, closingHour, PartyPickerDialog.ClothingType.kNone, actorSim.IsFemale);
            if ((info == null) || (info.PartyType == PartyPickerDialog.PartyType.kNone))
            {
                return(OptionResult.Failure);
            }

            float hoursPassedOfDay = SimClock.HoursPassedOfDay;

            if (hoursPassedOfDay > info.Time)
            {
                num2 = 24f - (hoursPassedOfDay - info.Time);
            }
            else
            {
                num2 = info.Time - hoursPassedOfDay;
            }
            if (num2 < 1f)
            {
                num2 += 24f;
            }
            long        ticks            = SimClock.ConvertToTicks(num2, TimeUnit.Hours);
            DateAndTime startTime        = SimClock.CurrentTime() + new DateAndTime(ticks);
            bool        bHostIsLegendary = actorSim.HasTrait(TraitNames.LegendaryHost);
            float       fMaxLTR          = 0f;
            LTRData     data             = LTRData.Get(LongTermRelationshipTypes.Friend);

            if (data != null)
            {
                fMaxLTR = data.Liking - 1;
            }
            List <SimDescription> simList = new List <SimDescription>();

            foreach (object obj2 in info.SimList)
            {
                SimDescription simDescription = obj2 as SimDescription;
                if ((simDescription != null) && CanSimBeInvitedToParty(simDescription, partyVenue, actorSim, fMaxLTR, bHostIsLegendary, true))
                {
                    if (!simList.Contains(simDescription))
                    {
                        simList.Add(simDescription);
                        if (simDescription.TraitManager.HasElement(TraitNames.PartyAnimal))
                        {
                            Sim createdSim = simDescription.CreatedSim;
                            if (createdSim != null)
                            {
                                TraitTipsManager.ShowTraitTip(13271263770231522640L, createdSim, TraitTipsManager.TraitTipCounterIndex.PartyAnimal, TraitTipsManager.kPartyAnimalCountOfParties);
                            }
                        }
                        if (simDescription.IsCelebrity)
                        {
                            EventTracker.SendEvent(EventTypeId.kPartyInviteCeleb, parameters.mActor);
                        }
                    }

                    bool bShouldMatchAge = (simDescription.Age == actorSim.SimDescription.Age) && ((simDescription.Teen) || (simDescription.Child));
                    if (!hasExclusiveAccess && RandomUtil.RandomChance(HouseParty.HousePartyParams.PercentageChanceOfBringingAFriend))
                    {
                        SimDescription friend = SocialComponent.FindFriendNotInList(simDescription, simList, parameters.mActor.LotHome, bShouldMatchAge);
                        if ((friend != null) && CanSimBeInvitedToParty(friend, partyVenue, null, 0f, false, false))
                        {
                            simList.Add(friend);
                        }
                    }
                }
            }

            DateAndTime time = startTime;

            time.Ticks -= SimClock.ConvertToTicks(Sims3.Gameplay.Situations.Party.HoursToStartRentBeforePartyStart, TimeUnit.Hours);
            if (time.CompareTo(SimClock.CurrentTime()) < 0)
            {
                time = SimClock.Add(SimClock.CurrentTime(), TimeUnit.Minutes, 2f);
            }

            if ((partyVenue != parameters.mActor.LotHome) && !RentScheduler.Instance.RentLot(partyVenue, actorSim, time, simList, hasExclusiveAccess))
            {
                SimpleMessageDialog.Show(string.Empty, Phone.Call.LocalizeCallString("ThrowParty", "CantRent", new object[] { parameters.mActor }), ModalDialog.PauseMode.PauseSimulator);
                return(OptionResult.Failure);
            }

            switch (info.ClothingType)
            {
            case PartyPickerDialog.ClothingType.kFormal:
                formalwear = OutfitCategories.Formalwear;
                break;

            case PartyPickerDialog.ClothingType.kCasual:
                formalwear = OutfitCategories.Everyday;
                break;

            case PartyPickerDialog.ClothingType.kSwimwear:
                formalwear = OutfitCategories.Swimwear;
                break;

            case PartyPickerDialog.ClothingType.kCostumes:
                formalwear = OutfitCategories.Everyday;
                break;

            default:
                formalwear = OutfitCategories.Everyday;
                break;
            }

            float infoTime = info.Time;

            switch (info.PartyType)
            {
            case PartyPickerDialog.PartyType.kCampaign:
                SimpleMessageDialog.Show(Common.LocalizeEAString(actorSim.IsFemale, "Gameplay/Situations/Party:FundraiserTitle"), Common.LocalizeEAString(actorSim.IsFemale, "Gameplay/Situations/Party:FundraiserStart", new object[] { infoTime }), ModalDialog.PauseMode.PauseSimulator);
                party = new CampaignFundraiser(partyVenue, actorSim, simList, formalwear, startTime);
                EventTracker.SendEvent(EventTypeId.kThrewFundraiser, parameters.mActor);
                break;

            case PartyPickerDialog.PartyType.kBirthday:
                SimpleMessageDialog.Show(Common.LocalizeEAString(actorSim.IsFemale, "Gameplay/Situations/Party:BirthdayTitle"), Common.LocalizeEAString(actorSim.IsFemale, "Gameplay/Situations/Party:BirthdayStart", new object[] { infoTime }), ModalDialog.PauseMode.PauseSimulator);
                party = new BirthdayParty(partyVenue, actorSim, simList, formalwear, startTime);
                break;

            case PartyPickerDialog.PartyType.kWedding:
                string messageText = string.Empty;
                if (GameUtils.IsInstalled(ProductVersion.EP4))
                {
                    messageText = Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situations/Party:WeddingStartWithArch", new object[] { infoTime });
                }
                else
                {
                    messageText = Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situations/Party:WeddingStart", new object[] { infoTime });
                }

                SimpleMessageDialog.Show(Common.LocalizeEAString(actorSim.IsFemale, "Gameplay/Situations/Party:WeddingTitle"), messageText, ModalDialog.PauseMode.PauseSimulator);

                EnsureFianceeIsInvitedToWeddingParty(actorSim, simList);

                party = new WeddingParty(partyVenue, actorSim, simList, formalwear, startTime);
                break;

            case PartyPickerDialog.PartyType.kFuneral:
                SimpleMessageDialog.Show(Common.LocalizeEAString(actorSim.IsFemale, "Gameplay/Situations/Party:FuneralTitle"), Common.LocalizeEAString(actorSim.IsFemale, "Gameplay/Situations/Party:FuneralStart", new object[] { infoTime }), ModalDialog.PauseMode.PauseSimulator);
                party = new Funeral(partyVenue, actorSim, simList, formalwear, startTime);
                break;

            case PartyPickerDialog.PartyType.kBachelorParty:
                SimpleMessageDialog.Show(Common.LocalizeEAString(actorSim.IsFemale, "Gameplay/Situations/Party:BachelorPartyTitle"), Common.LocalizeEAString(actorSim.IsFemale, "Gameplay/Situations/Party:BachelorStart", new object[] { infoTime }), ModalDialog.PauseMode.PauseSimulator);
                party = new BachelorParty(partyVenue, actorSim, simList, formalwear, startTime);
                EventTracker.SendEvent(EventTypeId.kThrewBachelorParty, actorSim);
                actorSim.SimDescription.SetHadBachelorParty();
                break;

            case PartyPickerDialog.PartyType.kTeenParty:
                SimpleMessageDialog.Show(Common.LocalizeEAString(actorSim.IsFemale, "Gameplay/Situations/Party:TeenPartyTitle"), Common.LocalizeEAString(actorSim.IsFemale, "Gameplay/Situations/Party:TeenStart", new object[] { infoTime }), ModalDialog.PauseMode.PauseSimulator);
                party = new TeenParty(partyVenue, actorSim, simList, formalwear, startTime);
                break;

            case PartyPickerDialog.PartyType.kChildSlumberParty:
            case PartyPickerDialog.PartyType.kTeenSlumberParty:
                SimpleMessageDialog.Show(Common.LocalizeEAString(actorSim.IsFemale, "Gameplay/Situations/Party:SlumberPartyTitle"), Common.LocalizeEAString(actorSim.IsFemale, "Gameplay/Situations/Party:SlumberStart", new object[] { infoTime, actorSim }), ModalDialog.PauseMode.PauseSimulator);
                party = new SlumberParty(partyVenue, actorSim, simList, formalwear, startTime);
                break;

            case PartyPickerDialog.PartyType.kCostumeParty:
                SimpleMessageDialog.Show(Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situation/Party:CostumePartyTitle", new object[0x0]), Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situation/Party:CostumePartyStart", new object[] { infoTime }), ModalDialog.PauseMode.PauseSimulator);
                party = new CostumeParty(partyVenue, actorSim, simList, formalwear, startTime);
                EventTracker.SendEvent(EventTypeId.kCostumePartyScheduled, actorSim);
                break;

            case PartyPickerDialog.PartyType.kGiftGivingParty:
                SimpleMessageDialog.Show(Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situation/Party:GiftGivingPartyTitle", new object[0x0]), Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situation/Party:GiftGivingPartyStart", new object[] { infoTime }), ModalDialog.PauseMode.PauseSimulator);
                party = new GiftGivingParty(partyVenue, actorSim, simList, formalwear, startTime);
                EventTracker.SendEvent(EventTypeId.kGiftGivingPartyScheduled, actorSim);
                break;

            case PartyPickerDialog.PartyType.kPoolParty:
                SimpleMessageDialog.Show(Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situation/Party:PoolPartyTitle", new object[0x0]), Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situation/Party:PoolPartyStart", new object[] { infoTime }), ModalDialog.PauseMode.PauseSimulator);
                party = new PoolParty(partyVenue, actorSim, simList, formalwear, startTime);
                EventTracker.SendEvent(EventTypeId.kSchedulePoolParty, actorSim);
                break;

            case PartyPickerDialog.PartyType.kFeastParty:
                SimpleMessageDialog.Show(Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situation/Party:FeastPartyTitle", new object[0x0]), Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situation/Party:FeastPartyStart", new object[] { infoTime }), ModalDialog.PauseMode.PauseSimulator);
                party = new FeastParty(partyVenue, actorSim, simList, formalwear, startTime);
                EventTracker.SendEvent(EventTypeId.kFeastPartyScheduled, actorSim);
                break;

            case PartyPickerDialog.PartyType.kJuiceKeggerParty:
                SimpleMessageDialog.Show(Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situations/Party:JuiceKeggerPartyTitle", new object[0]), Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situations/Party:JuiceKeggerStart", new object[] { infoTime }), ModalDialog.PauseMode.PauseSimulator);
                party = new JuiceKeggerParty(partyVenue, actorSim, simList, formalwear, startTime);
                EventTracker.SendEvent(EventTypeId.kThrewJuiceKeggerParty, actorSim);
                break;

            case PartyPickerDialog.PartyType.kTailgatingParty:
                SimpleMessageDialog.Show(Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situations/Party:TailgatingPartyTitle", new object[0]), Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situations/Party:TailgatingStart", new object[] { infoTime }), ModalDialog.PauseMode.PauseSimulator);
                party = new TailgatingParty(partyVenue, actorSim, simList, formalwear, startTime);
                EventTracker.SendEvent(EventTypeId.kThrewTailgatingParty, actorSim);
                break;

            case PartyPickerDialog.PartyType.kBonfire:
                SimpleMessageDialog.Show(Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situations/Party:BonfireTitle", new object[0]), Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situations/Party:BonfireStart", new object[] { infoTime }), ModalDialog.PauseMode.PauseSimulator);
                party = new BonfireParty(partyVenue, actorSim, simList, formalwear, startTime);
                EventTracker.SendEvent(EventTypeId.kThrewBonfireParty, actorSim);
                break;

            case PartyPickerDialog.PartyType.kVideoGameLANParty:
                SimpleMessageDialog.Show(Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situations/Party:VideoGameLANPartyTitle", new object[0]), Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situations/Party:VideoGameLANStart", new object[] { infoTime }), ModalDialog.PauseMode.PauseSimulator);
                party = new VideoGameLANParty(partyVenue, actorSim, simList, formalwear, startTime);
                EventTracker.SendEvent(EventTypeId.kThrewVideoGameLANParty, actorSim);
                break;

            case PartyPickerDialog.PartyType.kMasqueradeBall:
                SimpleMessageDialog.Show(Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situations/Party:MasqueradeBallTitle", new object[0]), Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situations/Party:MasqueradeStart", new object[] { infoTime }), ModalDialog.PauseMode.PauseSimulator);
                party = new MasqueradeBall(partyVenue, actorSim, simList, formalwear, startTime);
                EventTracker.SendEvent(EventTypeId.kThrewMasqueradeBall, actorSim);
                break;

            case PartyPickerDialog.PartyType.kVictoryParty:
                SimpleMessageDialog.Show(Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situations/Party:VictoryPartyTitle", new object[0]), Localization.LocalizeString(actorSim.IsFemale, "Gameplay/Situations/Party:VictoryStart", new object[] { infoTime }), ModalDialog.PauseMode.PauseSimulator);
                party = new VictoryParty(partyVenue, actorSim, simList, formalwear, startTime);
                EventTracker.SendEvent(EventTypeId.kThrewVictoryParty, actorSim);
                break;

            default:
                SimpleMessageDialog.Show(Common.LocalizeEAString(actorSim.IsFemale, "Gameplay/Situations/Party:GenericTitle"), Common.LocalizeEAString(actorSim.IsFemale, "Gameplay/Situations/Party:HouseStart", new object[] { infoTime }), ModalDialog.PauseMode.PauseSimulator);
                party = new HouseParty(partyVenue, actorSim, simList, formalwear, startTime);
                break;
            }

            if (party == null)
            {
                return(OptionResult.Failure);
            }

            foreach (SimDescription sim in party.GuestDescriptions)
            {
                Instantiation.EnsureInstantiate(sim, party.Lot);
            }

            EventTracker.SendEvent(new PartyEvent(EventTypeId.kThrewParty, actorSim, actorSim.SimDescription, party));
            if (actorSim.HasTrait(TraitNames.PartyAnimal))
            {
                TraitTipsManager.ShowTraitTip(13271263770231522640L, actorSim, TraitTipsManager.TraitTipCounterIndex.PartyAnimal, TraitTipsManager.kPartyAnimalCountOfParties);
            }
            return(OptionResult.SuccessClose);
        }
Ejemplo n.º 19
0
            protected override bool Run(SimDescription a, SimDescription b)
            {
                Relationship relation = Relationship.Get(a, b, true);

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

                string currentState = relation.LTR.CurrentLTR;

                List <NewLevel> allOptions = new List <NewLevel>();

                string newState = ChangeRelationship.NextNegativeRomanceState(currentState);

                while (newState != null)
                {
                    if (!relation.LTR.RelationshipIsInappropriate(LTRData.Get(newState)))
                    {
                        allOptions.Insert(0, new NewLevel(newState, false));
                    }

                    newState = ChangeRelationship.NextNegativeRomanceState(newState);
                }

                allOptions.Add(new NewLevel(currentState, true));

                if (currentState == "Stranger")
                {
                    newState = "Acquaintance";
                    allOptions.Add(new NewLevel(newState, true));
                }
                else
                {
                    newState = currentState;
                }

                newState = ChangeRelationship.NextPositiveRomanceState(newState);
                while (newState != null)
                {
                    if (!relation.LTR.RelationshipIsInappropriate(LTRData.Get(newState)))
                    {
                        allOptions.Add(new NewLevel(newState, true));
                    }

                    newState = ChangeRelationship.NextPositiveRomanceState(newState);
                }

                List <ObjectPicker.HeaderInfo> headers = new List <ObjectPicker.HeaderInfo>();

                headers.Add(new ObjectPicker.HeaderInfo("Level", "Relationship Level", 230));

                int count = 0;

                List <ObjectPicker.RowInfo> rowInfo = new List <ObjectPicker.RowInfo>();

                foreach (NewLevel level in allOptions)
                {
                    ObjectPicker.RowInfo item = new ObjectPicker.RowInfo(level, new List <ObjectPicker.ColumnInfo>());

                    count++;

                    item.ColumnInfo.Add(new ObjectPicker.TextColumn(count.ToString() + ". " + level.mState));

                    rowInfo.Add(item);
                }

                List <ObjectPicker.TabInfo> tabInfo = new List <ObjectPicker.TabInfo>();

                tabInfo.Add(new ObjectPicker.TabInfo("shop_all_r2", Localization.LocalizeString("Ui/Caption/ObjectPicker:All", new object[0]), rowInfo));

                string buttonTrue  = "Ok";
                string buttonFalse = Localization.LocalizeString("Ui/Caption/ObjectPicker:Cancel", new object[0]);

                List <ObjectPicker.RowInfo> list = ObjectPickerDialog.Show(true, ModalDialog.PauseMode.PauseSimulator, "Relationship", buttonTrue, buttonFalse, tabInfo, headers, 1, new Vector2(-1f, -1f), true);

                List <string> selection = new List <string>();

                if ((list == null) || (list.Count == 0))
                {
                    return(false);
                }

                NewLevel choice = list[0].Item as NewLevel;

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

                if (choice.mState == currentState)
                {
                    return(false);
                }

                bool bFirst = true;

                if (choice.mUp)
                {
                    while (BumpUp(a, b, bFirst))
                    {
                        if (choice.mState == relation.LTR.CurrentLTR)
                        {
                            return(true);
                        }

                        if (currentState == relation.LTR.CurrentLTR)
                        {
                            return(false);
                        }
                        currentState = relation.LTR.CurrentLTR;

                        bFirst = false;
                    }
                }
                else
                {
                    while (BumpDown(a, b, bFirst))
                    {
                        if (choice.mState == relation.LTR.CurrentLTR)
                        {
                            return(true);
                        }

                        if (currentState == relation.LTR.CurrentLTR)
                        {
                            return(false);
                        }
                        currentState = relation.LTR.CurrentLTR;

                        bFirst = false;
                    }
                }

                return(true);
            }