Esempio n. 1
0
 public virtual bool RouteAndAnimate(InteractionInstance interaction, Sim Actor)
 {
     if (!base.Actor.RouteToPointRadialRange(base.Target.Position, 0.5f, 2f))
     {
         return(false);
     }
     interaction.StandardEntry();
     if (Actor.SimDescription.ChildOrAbove)
     {
         //Think about styling
         ThoughtBalloonManager.BalloonData balloonData = ThoughtBalloonManager.GetBalloonData("Makeover", base.Actor);
         balloonData.BalloonType = ThoughtBalloonTypes.kSpeechBalloon;
         base.Actor.ThoughtBalloonManager.ShowBalloon(balloonData);
     }
     return(true);
 }
Esempio n. 2
0
 // Token: 0x06006FBA RID: 28602 RVA: 0x0026CE70 File Offset: 0x0026BE70
 public void EventCallbackResurrectSimDeathFlower(StateMachineClient sender, IEvent evt)
 {
     EventTracker.SendEvent(EventTypeId.kGotSavedByDeathFlower, this.Target);
     this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.DeathFlowerPostEvent;
     if (GrimReaperSituation.ShouldDoDeathEvent(this.Target))
     {
         StyledNotification.Format format = new StyledNotification.Format(Localization.LocalizeString("Gameplay/Services/GrimReaper:DeathFlower1", new object[]
         {
             this.Target
         }), this.Actor.ObjectId, StyledNotification.NotificationStyle.kSimTalking);
         StyledNotification.Show(format);
     }
     ThoughtBalloonManager.BalloonData balloonData = new ThoughtBalloonManager.BalloonData(this.mDeathFlower.GetThoughtBalloonThumbnailKey());
     balloonData.mPriority = ThoughtBalloonPriority.High;
     balloonData.Duration  = ThoughtBalloonDuration.Medium;
     balloonData.mCoolDown = ThoughtBalloonCooldown.Medium;
     balloonData.LowAxis   = ThoughtBalloonAxis.kLike;
     this.Actor.ThoughtBalloonManager.ShowBalloon(balloonData);
     this.EventCallbackResurrectSim();
 }
Esempio n. 3
0
        public void LoopFunc(StateMachineClient smc, LoopData ld)
        {
            if (ld.mLifeTime > kWatchPlantMaxTime)
            {
                Actor.AddExitReason(ExitReason.Finished);
                return;
            }
            ThoughtBalloonManager.BalloonData balloonData = new ThoughtBalloonManager.BalloonData(Target.GetThumbnailKey());
            balloonData.BalloonType = ThoughtBalloonTypes.kThoughtBalloon;
            balloonData.mPriority   = ThoughtBalloonPriority.Low;
            balloonData.mFlags      = ThoughtBalloonFlags.ShowIfSleeping;
            Actor.ThoughtBalloonManager.ShowBalloon(balloonData);
            AcquireStateMachine("catdoginvestigate");
            EnterStateMachine("catdoginvestigate", "Enter", "x");
            AnimateSim("Investigate");
            AnimateSim("Exit");
            ReactionTypes reactionType = kReactionList[RandomUtil.GetInt(kReactionList.Length - 1)];

            Actor.PlayReaction(reactionType, ReactionSpeed.ImmediateWithoutOverlay);
        }
Esempio n. 4
0
        public override void OnSimGoingHome(Sim sim)
        {
            float num = ApplyLikingChange(sim);

            if (Host.HasTrait(TraitNames.LegendaryHost))
            {
                sim.BuffManager.AddElement(BuffNames.AwesomeParty, Origin.FromParty);
            }

            ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.BalloonData("balloon_partyballoons");
            if (num >= 0f)
            {
                bd.LowAxis = ThoughtBalloonAxis.kLike;
            }
            else
            {
                bd.LowAxis = ThoughtBalloonAxis.kDislike;
            }
            bd.mPriority = ThoughtBalloonPriority.High;
            bd.Duration  = ThoughtBalloonDuration.Long;
            bd.mCoolDown = ThoughtBalloonCooldown.Long;
            sim.ThoughtBalloonManager.ShowBalloon(bd);
            OnGoingHomeBuffCleanup(sim);
        }
Esempio n. 5
0
        public static void CalculateAttractionScore(Relationship ths, bool displayNotice)
        {
            if (ths == null)
            {
                return;
            }

            ths.AttractionScore = 0;

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

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

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

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

                        newScore  = score - origScore;
                        origScore = score;

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

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

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

                        newScore  = score - origScore;
                        origScore = score;

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

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

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

                        newScore  = score - origScore;
                        origScore = score;

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

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

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

                        newScore  = score - origScore;
                        origScore = score;

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

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

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

                        newScore  = score - origScore;
                        origScore = score;

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

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

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

                        newScore  = score - origScore;
                        origScore = score;

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

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

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

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

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

                        newScore  = score - origScore;
                        origScore = score;

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

                        int familyFundsA = 0;

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

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

                        int familyFundsB = 0;

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

                        newScore  = score - origScore;
                        origScore = score;

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

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

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

                        newScore  = score - origScore;
                        origScore = score;

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

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

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

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

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

                        newScore  = score - origScore;
                        origScore = score;

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

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

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

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

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

                        case CASAgeGenderFlags.YoungAdult:
                            ageA = 2;
                            break;

                        case CASAgeGenderFlags.Adult:
                            ageA = 3;
                            break;

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

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

                        case CASAgeGenderFlags.YoungAdult:
                            ageB = 2;
                            break;

                        case CASAgeGenderFlags.Adult:
                            ageB = 3;
                            break;

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

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

                        newScore  = score - origScore;
                        origScore = score;

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

                        ths.AttractionScore = score;

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

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

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

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

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

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

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

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

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

            if (ths.AttractionNPCController != null)
            {
                ths.AttractionNPCController.Dispose();
            }
        }
Esempio n. 6
0
        public override bool Run()
        {
            try
            {
                if (!StartSync())
                {
                    return(false);
                }

                // Custom
                mReactToSocialBroadcaster = new ReactionBroadcaster(Actor, Conversation.ReactToSocialParams, SocialComponentEx.ReactToJealousEventHigh);
                //SocialComponent.SendCheatingEvents(Actor, Target, !Rejected);

                StandardEntry(false);
                BeginCommodityUpdates();
                if (IsMaster)
                {
                    ReturnInstance.EnsureMaster();
                    StartSocial("Make Out");
                    InitiateSocialUI(Actor, Target);
                    (LinkedInteractionInstance as NestedRelaxingInteraction).Rejected = Rejected;
                    if (Rejected)
                    {
                        ReturnInstance.mCurrentStateMachine.RequestState(null, "MakeOutReject");
                        ReturnInstance.mCurrentStateMachine.RequestState(null, "ToRelax");
                        FinishSocial("Make Out", true);
                    }
                    else
                    {
                        ReturnInstance.mCurrentStateMachine.RequestState(null, "MakeOut");
                        StartStages();
                        if ((Actor.Posture.Container as Bed).IsTent)
                        {
                            ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.BalloonData("balloon_lips");
                            Actor.ThoughtBalloonManager.ShowBalloon(bd);
                            Target.ThoughtBalloonManager.ShowBalloon(bd);
                        }
                        DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                        FinishSocial("Make Out", true);
                    }
                }
                else
                {
                    DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                }

                FinishLinkedInteraction(IsMaster);
                EndCommodityUpdates(!Rejected);
                StandardExit(false, false);
                EventTracker.SendEvent(new SocialEvent(EventTypeId.kSocialInteraction, Actor, Target, "Make Out", !IsMaster, !Rejected, false, CommodityTypes.Undefined));
                if (!Rejected)
                {
                    Actor.SimDescription.SetFirstKiss(Target.SimDescription);
                    DoResume();
                }
                WaitForSyncComplete();
                return(!Rejected);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Esempio n. 7
0
        public void ApplyRandomBuff(Sim actor, JellyBeanBush.JellyBeanBuffType buffType)
        {
            BuffNames buffNames = BuffNames.Undefined;

            switch (buffType)
            {
            case JellyBeanBush.JellyBeanBuffType.NormalPositive:
                buffNames = RandomUtil.GetRandomObjectFromList <BuffNames>(JellyBeanBush.kPositiveBuffs);
                break;

            case JellyBeanBush.JellyBeanBuffType.NormalNegative:
                buffNames = RandomUtil.GetRandomObjectFromList <BuffNames>(JellyBeanBush.kNegativeBuffs);
                break;

            case JellyBeanBush.JellyBeanBuffType.TransPositive:
                buffNames = RandomUtil.GetRandomObjectFromList <BuffNames>(JellyBeanBush.kPosTransBuffs);
                break;

            case JellyBeanBush.JellyBeanBuffType.TransNegative:
                buffNames = RandomUtil.GetRandomObjectFromList <BuffNames>(JellyBeanBush.kNegTransBuffs);
                break;
            }
            if (buffNames == BuffNames.Undefined)
            {
                return;
            }
            if (!actor.BuffManager.AddElement(buffNames, Origin.FromMagicJellyBean))
            {
                return;
            }
            BuffInstance element = actor.BuffManager.GetElement(buffNames);

            if (element == null)
            {
                return;
            }
            ThoughtBalloonManager.BalloonData balloonData;
            if (element.ThumbString == "moodlet_terrified")
            {
                balloonData = new ThoughtBalloonManager.BalloonData("ep7_balloon_moodlet_terrified");
            }
            else if (element.ThumbString == "moodlet_blueblitz")
            {
                balloonData = new ThoughtBalloonManager.BalloonData("ep7_balloon_moodlet_blueblitz");
            }
            else if (element.ThumbString == "moodlet_allglowyontheoutside")
            {
                balloonData = new ThoughtBalloonManager.BalloonData("ep7_balloon_moodlet_allglowyontheoutside");
            }
            else
            {
                balloonData = new ThoughtBalloonManager.BalloonData(element.ThumbString);
            }
            balloonData.mPriority = ThoughtBalloonPriority.High;
            actor.ThoughtBalloonManager.ShowBalloon(balloonData);
            if (JellyBeanBush.mJellyBeanBuffs.ContainsKey(buffNames))
            {
                JellyBeanBush.JellyBeanBuffStruct jellyBeanBuffStruct = JellyBeanBush.mJellyBeanBuffs[buffNames];
                float        value        = 0f;
                MotiveTuning motiveTuning = actor.GetMotiveTuning(jellyBeanBuffStruct.commodity);
                if (motiveTuning != null)
                {
                    if (jellyBeanBuffStruct.value > 0f)
                    {
                        value = MathUtils.Clamp(jellyBeanBuffStruct.value + JellyBeanBush.kMotiveDelta, motiveTuning.Min, motiveTuning.Max);
                    }
                    else
                    {
                        value = MathUtils.Clamp(jellyBeanBuffStruct.value - JellyBeanBush.kMotiveDelta, motiveTuning.Min, motiveTuning.Max);
                    }
                }
                actor.Motives.SetValue(jellyBeanBuffStruct.commodity, value);
            }
        }
Esempio n. 8
0
        private new void LoopFunc(StateMachineClient smc, Interaction <Sim, Terrain> .LoopData ld)
        {
            try
            {
                WaterTypes waterType = FishingSpot.GetWaterType(Hit.mType);
                EventTracker.SendEvent(new FishingLoopEvent(EventTypeId.kWentFishing, Actor, waterType, ld.mLifeTime));
                Actor.TryGroupTalk();
                //Actor.TrySinging();
                Fishing skill = Actor.SkillManager.GetSkill <Fishing>(SkillNames.Fishing);
                if (mShowTns && (ld.mLifeTime > kTimeToShowFishingTns))
                {
                    string str;
                    if (BaitInUse != null)
                    {
                        str = Common.LocalizeEAString("Gameplay/Objects/Fishing:NoFishWithBait");
                    }
                    else
                    {
                        str = Common.LocalizeEAString("Gameplay/Objects/Fishing:NoFishNoBait");
                    }
                    Actor.ShowTNSIfSelectable(str, StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid);
                    if ((mLoopLengthForNextFish - ld.mLifeTime) < kTimeToCatchPostTns)
                    {
                        mLoopLengthForNextFish = ld.mLifeTime + kTimeToCatchPostTns;
                    }
                    mShowTns = false;
                }

                if (ld.mLifeTime > mLoopLengthForNextFish)
                {
                    mLoopLengthForNextFish += mFishingData.GetNextFishTimeLength(mIsAngler, skill.IsFisherman());
                    FishType none     = FishType.None;
                    string   baitUsed = null;
                    if (BaitInUse != null)
                    {
                        baitUsed = BaitInUse.Key;
                    }

                    if (!mShowTns)
                    {
                        none = mFishingData.GetFishCaught(Actor, baitUsed);
                    }

                    if ((mSittingInBoatPosture != null) && (none == FishType.Box))
                    {
                        none = FishType.None;
                    }

                    FishType type3 = none;
                    if (type3 == FishType.None)
                    {
                        bool flag = false;
                        if (Actor.TraitManager.HasElement(TraitNames.Clumsy))
                        {
                            flag = RandomUtil.RandomChance01(kChanceOfPlayingLostFishAnimIfClumsy);
                        }
                        else
                        {
                            flag = RandomUtil.RandomChance01(kChanceOfPlayingLostFishAnim);
                        }
                        if (!flag)
                        {
                            return;
                        }
                        AnimateSim("CatchNothing");
                    }
                    else if (type3 == FishType.Box)
                    {
                        int        num = 0x0;
                        WorldType  currentWorldType = GameUtils.GetCurrentWorldType();
                        WorldName  currentWorld     = GameUtils.GetCurrentWorld();
                        List <int> list             = new List <int>();
                        for (int i = 0x0; i < sBoxData.Count; i++)
                        {
                            BoxData data = sBoxData[i];
                            if (((data.AllowedWorldType == WorldType.Undefined) || (data.AllowedWorldType == currentWorldType)) && (((data.AllowedWorlds == null) || (data.AllowedWorlds.Count == 0x0)) || (data.AllowedWorlds.Contains(currentWorld) || data.AllowedWorlds.Contains(WorldName.Undefined))))
                            {
                                num += sBoxChances[i];
                                list.Add(i);
                            }
                        }
                        int chance = RandomUtil.GetInt(num - 0x1);
                        int num4   = 0x0;
                        foreach (int num5 in list)
                        {
                            num4 = num5;
                            if (chance < sBoxChances[num5])
                            {
                                break;
                            }
                            chance -= sBoxChances[num5];
                        }
                        IGameObject obj2 = GlobalFunctions.CreateObject(sBoxData[num4].ItemName, Vector3.OutOfWorld, 0x1, Vector3.UnitZ);
                        if (obj2 == null)
                        {
                            return;
                        }
                        bool happy = sBoxData[num4].Happy;
                        if (Actor.TraitManager.HasElement(TraitNames.Insane))
                        {
                            happy = !happy;
                        }
                        SetSplashAndDripEffects(EffectSize.Small);
                        if (happy)
                        {
                            AnimateSim("CatchBoxHappy");
                            Actor.Inventory.TryToAdd(obj2, false);
                        }
                        else
                        {
                            AnimateSim("CatchBoxSad");
                            Actor.Inventory.TryToAdd(obj2, false);
                        }
                        Actor.ShowTNSIfSelectable(Common.LocalizeEAString(Actor.IsFemale, "Gameplay/Objects/Fishing:CaughtBox", new object[] { Actor, obj2 }), StyledNotification.NotificationStyle.kGameMessagePositive, obj2.ObjectId, Actor.ObjectId);
                    }
                    else
                    {
                        int    num6;
                        string str3;
                        Fish   actor = Fish.CreateFish(none, Actor, skill, BaitInUse, out num6, out str3);
                        actor.UpdateVisualState(CatHuntingComponent.CatHuntingModelState.InInventory);
                        mNumberFishCaught++;
                        SetActor("fish", actor);
                        SetSplashAndDripEffects(actor.EffectSize);
                        PlayFishCatchAnimation(num6);
                        if (str3 != null)
                        {
                            Actor.ShowTNSIfSelectable(str3, StyledNotification.NotificationStyle.kGameMessagePositive, actor.ObjectId, Actor.ObjectId);
                        }

                        EventTracker.SendEvent(new CaughtFishEvent(EventTypeId.kCaughtFish, Actor, actor, baitUsed));
                        Actor.Inventory.TryToAdd(actor, false);
                        if ((BaitInUse != null) && RandomUtil.RandomChance(kPercentChanceBaitLost))
                        {
                            Actor.Inventory.SetNotInUse(BaitInUse);
                            Actor.Inventory.RemoveByForce(BaitInUse);
                            IFishBait baitInUse = BaitInUse;
                            BaitInUse = FindProperBait(new Fishing.BaitInfo(baitInUse));
                            if (BaitInUse == null)
                            {
                                ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.BalloonData(baitInUse.GetThoughtBalloonThumbnailKey());
                                bd.mCoolDown = ThoughtBalloonCooldown.Medium;
                                bd.LowAxis   = ThoughtBalloonAxis.kDislike;
                                Actor.ThoughtBalloonManager.ShowBalloon(bd);
                                Actor.InteractionQueue.FireQueueChanged();
                                string message = Common.LocalizeEAString(Actor.IsFemale, "Gameplay/Objects/Fishing:NoMoreBait", new object[] { Actor, baitInUse.GetLocalizedName() });
                                Actor.ShowTNSIfSelectable(message, StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, Actor.ObjectId);
                            }
                            baitInUse.Destroy();
                        }
                    }

                    if (!ActiveStage.IsComplete((InteractionInstance)this))
                    {
                        mCurrentStateMachine.SetParameter("skillLevel", skill.GetSkillLevelParameterForJazzGraph());
                        AnimateSim("Fish");
                    }
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.DebugException(Actor, Target, e);
            }
        }
Esempio n. 9
0
        private new void LoopFunc(StateMachineClient smc, Interaction<Sim, Terrain>.LoopData ld)
        {
            try
            {
                WaterTypes waterType = FishingSpot.GetWaterType(Hit.mType);
                EventTracker.SendEvent(new FishingLoopEvent(EventTypeId.kWentFishing, Actor, waterType, ld.mLifeTime));
                Actor.TryGroupTalk();
                //Actor.TrySinging();
                Fishing skill = Actor.SkillManager.GetSkill<Fishing>(SkillNames.Fishing);
                if (mShowTns && (ld.mLifeTime > kTimeToShowFishingTns))
                {
                    string str;
                    if (BaitInUse != null)
                    {
                        str = Common.LocalizeEAString("Gameplay/Objects/Fishing:NoFishWithBait");
                    }
                    else
                    {
                        str = Common.LocalizeEAString("Gameplay/Objects/Fishing:NoFishNoBait");
                    }
                    Actor.ShowTNSIfSelectable(str, StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid);
                    if ((mLoopLengthForNextFish - ld.mLifeTime) < kTimeToCatchPostTns)
                    {
                        mLoopLengthForNextFish = ld.mLifeTime + kTimeToCatchPostTns;
                    }
                    mShowTns = false;
                }
                
                if (ld.mLifeTime > mLoopLengthForNextFish)
                {
                    mLoopLengthForNextFish += mFishingData.GetNextFishTimeLength(mIsAngler, skill.IsFisherman());
                    FishType none = FishType.None;
                    string baitUsed = null;
                    if (BaitInUse != null)
                    {
                        baitUsed = BaitInUse.Key;
                    }

                    if (!mShowTns)
                    {
                        none = mFishingData.GetFishCaught(Actor, baitUsed);
                    }

                    if ((mSittingInBoatPosture != null) && (none == FishType.Box))
                    {
                        none = FishType.None;
                    }

                    FishType type3 = none;
                    if (type3 == FishType.None)
                    {
                        bool flag = false;
                        if (Actor.TraitManager.HasElement(TraitNames.Clumsy))
                        {
                            flag = RandomUtil.RandomChance01(kChanceOfPlayingLostFishAnimIfClumsy);
                        }
                        else
                        {
                            flag = RandomUtil.RandomChance01(kChanceOfPlayingLostFishAnim);
                        }
                        if (!flag)
                        {
                            return;
                        }
                        AnimateSim("CatchNothing");
                    }
                    else if (type3 == FishType.Box)
                    {
                        int num = 0x0;
                        WorldType currentWorldType = GameUtils.GetCurrentWorldType();
                        WorldName currentWorld = GameUtils.GetCurrentWorld();
                        List<int> list = new List<int>();
                        for (int i = 0x0; i < sBoxData.Count; i++)
                        {
                            BoxData data = sBoxData[i];
                            if (((data.AllowedWorldType == WorldType.Undefined) || (data.AllowedWorldType == currentWorldType)) && (((data.AllowedWorlds == null) || (data.AllowedWorlds.Count == 0x0)) || (data.AllowedWorlds.Contains(currentWorld) || data.AllowedWorlds.Contains(WorldName.Undefined))))
                            {
                                num += sBoxChances[i];
                                list.Add(i);
                            }
                        }
                        int chance = RandomUtil.GetInt(num - 0x1);
                        int num4 = 0x0;
                        foreach (int num5 in list)
                        {
                            num4 = num5;
                            if (chance < sBoxChances[num5])
                            {
                                break;
                            }
                            chance -= sBoxChances[num5];
                        }
                        IGameObject obj2 = GlobalFunctions.CreateObject(sBoxData[num4].ItemName, Vector3.OutOfWorld, 0x1, Vector3.UnitZ);
                        if (obj2 == null)
                        {
                            return;
                        }
                        bool happy = sBoxData[num4].Happy;
                        if (Actor.TraitManager.HasElement(TraitNames.Insane))
                        {
                            happy = !happy;
                        }
                        SetSplashAndDripEffects(EffectSize.Small);
                        if (happy)
                        {
                            AnimateSim("CatchBoxHappy");
                            Actor.Inventory.TryToAdd(obj2, false);
                        }
                        else
                        {
                            AnimateSim("CatchBoxSad");
                            Actor.Inventory.TryToAdd(obj2, false);
                        }
                        Actor.ShowTNSIfSelectable(Common.LocalizeEAString(Actor.IsFemale, "Gameplay/Objects/Fishing:CaughtBox", new object[] { Actor, obj2 }), StyledNotification.NotificationStyle.kGameMessagePositive, obj2.ObjectId, Actor.ObjectId);
                    }
                    else
                    {
                        int num6;
                        string str3;
                        Fish actor = Fish.CreateFish(none, Actor, skill, BaitInUse, out num6, out str3);
                        actor.UpdateVisualState(CatHuntingComponent.CatHuntingModelState.InInventory);
                        mNumberFishCaught++;
                        SetActor("fish", actor);
                        SetSplashAndDripEffects(actor.EffectSize);
                        PlayFishCatchAnimation(num6);
                        if (str3 != null)
                        {
                            Actor.ShowTNSIfSelectable(str3, StyledNotification.NotificationStyle.kGameMessagePositive, actor.ObjectId, Actor.ObjectId);
                        }

                        EventTracker.SendEvent(new CaughtFishEvent(EventTypeId.kCaughtFish, Actor, actor, baitUsed));
                        Actor.Inventory.TryToAdd(actor,false);
                        if ((BaitInUse != null) && RandomUtil.RandomChance(kPercentChanceBaitLost))
                        {
                            Actor.Inventory.SetNotInUse(BaitInUse);
                            Actor.Inventory.RemoveByForce(BaitInUse);
                            IFishBait baitInUse = BaitInUse;
                            BaitInUse = FindProperBait(new Fishing.BaitInfo(baitInUse));
                            if (BaitInUse == null)
                            {
                                ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.BalloonData(baitInUse.GetThoughtBalloonThumbnailKey());
                                bd.mCoolDown = ThoughtBalloonCooldown.Medium;
                                bd.LowAxis = ThoughtBalloonAxis.kDislike;
                                Actor.ThoughtBalloonManager.ShowBalloon(bd);
                                Actor.InteractionQueue.FireQueueChanged();
                                string message = Common.LocalizeEAString(Actor.IsFemale, "Gameplay/Objects/Fishing:NoMoreBait", new object[] { Actor, baitInUse.GetLocalizedName() });
                                Actor.ShowTNSIfSelectable(message, StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, Actor.ObjectId);
                            }
                            baitInUse.Destroy();
                        }
                    }

                    if (!ActiveStage.IsComplete((InteractionInstance) this))
                    {
                        mCurrentStateMachine.SetParameter("skillLevel", skill.GetSkillLevelParameterForJazzGraph());
                        AnimateSim("Fish");
                    }
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.DebugException(Actor, Target, e);
            }
        }
Esempio n. 10
0
        public override bool Run()
        {
            if (Target.InUse)
            {
                return(false);
            }

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

            StandardEntry();

            if (!SetupAbductee())
            {
                StandardExit();
                return(false);
            }

            Animation.ForceAnimation(Actor.ObjectId, true);
            Animation.ForceAnimation(Target.ObjectId, true);
            Target.mTakeOffPos = Actor.Position;

            if (!Target.RouteToUFOAndTakeOff(Actor))
            {
                StandardExit();
                return(false);
            }

            if (SimToAbduct.IsSelectable)
            {
                Camera.FocusOnGivenPosition(mJig.Position, CarUFO.kAbductLerpParams, true);
            }

            BeginCommodityUpdates();
            bool flag = AbductSim();

            EndCommodityUpdates(true);

            Sim[] sims;

            if (flag)
            {
                EventTracker.SendEvent(EventTypeId.kAbductSimUFO, Actor, SimToAbduct);
                sims = new Sim[] { Actor, SimToAbduct };
                DoTimedLoop((float)Aliens.Settings.mAbductionLength, ExitReason.None);
            }
            else
            {
                sims = new Sim[] { Actor }
            };

            DateAndTime previousDateAndTime = SimClock.CurrentTime();
            Vector3     landingRefPos       = mJig.Position;

            while (!Target.TryLandUFOAndExitSims(sims, landingRefPos, SimToAbduct.IsSelectable))
            {
                Simulator.Sleep(30u);

                if (SimClock.ElapsedTime(TimeUnit.Minutes, previousDateAndTime) > 30f)
                {
                    Target.ForceExitUFODueToLandingFailure(sims);
                    break;
                }
            }

            mFromInventory = Actor.Inventory.TryToAdd(Target);

            if (flag)
            {
                SimToAbduct.BuffManager.AddElement(BuffsAndTraits.sAbductedEx, Origin.FromAbduction);
                ThoughtBalloonManager.BalloonData balloonData = new ThoughtBalloonManager.BalloonData(Actor.GetThumbnailKey());
                balloonData.BalloonType = ThoughtBalloonTypes.kThoughtBalloon;
                balloonData.LowAxis     = ThoughtBalloonAxis.kDislike;
                balloonData.Duration    = ThoughtBalloonDuration.Medium;
                balloonData.mPriority   = ThoughtBalloonPriority.High;
                SimToAbduct.ThoughtBalloonManager.ShowBalloon(balloonData);
                SimToAbduct.PlayReaction(RandomUtil.GetRandomObjectFromList(new List <ReactionTypes>(AlienUtils.kAbductionReactions)),
                                         ReactionSpeed.NowOrLater);
                SimToAbduct.ShowTNSIfSelectable(CarUFO.LocalizeString(SimToAbduct.IsFemale, "NPCAbductionTNS", new object[] { SimToAbduct }),
                                                StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, SimToAbduct.ObjectId);
                FinishLinkedInteraction(true);
            }

            StandardExit();

            if (flag)
            {
                WaitForSyncComplete();
            }

            return(flag);
        }
Esempio n. 11
0
        public static void CalculateAttractionScore(Relationship ths, bool displayNotice)
        {
            if (ths == null) return;

            ths.AttractionScore = 0;

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

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

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

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

                        newScore = score - origScore;
                        origScore = score;

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

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

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

                        newScore = score - origScore;
                        origScore = score;

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

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

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

                        newScore = score - origScore;
                        origScore = score;

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

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

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

                        newScore = score - origScore;
                        origScore = score;

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

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

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

                        newScore = score - origScore;
                        origScore = score;

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

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

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

                        newScore = score - origScore;
                        origScore = score;

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

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

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

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

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

                        newScore = score - origScore;
                        origScore = score;

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

                        int familyFundsA = 0;

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

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

                        int familyFundsB = 0;

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

                        newScore = score - origScore;
                        origScore = score;

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

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

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

                        newScore = score - origScore;
                        origScore = score;

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

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

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

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

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

                        newScore = score - origScore;
                        origScore = score;

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

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

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

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

                        int ageA = 0;
                        switch (simA.Age)
                        {
                            case CASAgeGenderFlags.Teen:
                                ageA = 1;
                                break;
                            case CASAgeGenderFlags.YoungAdult:
                                ageA = 2;
                                break;
                            case CASAgeGenderFlags.Adult:
                                ageA = 3;
                                break;
                            case CASAgeGenderFlags.Elder:
                                ageA = 4;
                                break;
                        }

                        int ageB = 0;
                        switch (simB.Age)
                        {
                            case CASAgeGenderFlags.Teen:
                                ageB = 1;
                                break;
                            case CASAgeGenderFlags.YoungAdult:
                                ageB = 2;
                                break;
                            case CASAgeGenderFlags.Adult:
                                ageB = 3;
                                break;
                            case CASAgeGenderFlags.Elder:
                                ageB = 4;
                                break;
                        }

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

                        newScore = score - origScore;
                        origScore = score;

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

                        ths.AttractionScore = score;

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

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

                            switch (ths.LTR.CurrentLTR)
                            {
                                case LongTermRelationshipTypes.Spouse:
                                case LongTermRelationshipTypes.Fiancee:
                                case LongTermRelationshipTypes.Ex:
                                case LongTermRelationshipTypes.ExSpouse:
                                case LongTermRelationshipTypes.Partner:
                                case LongTermRelationshipTypes.RomanticInterest:
                                    break;
                                default:
                                    if (displayNotice)
                                    {
                                        Sim createdSimA = simA.CreatedSim;
                                        Sim createdSimB = simB.CreatedSim;
                                        if ((createdSimA != null) && (createdSimB != null))
                                        {
                                            if ((createdSimA.LotCurrent == createdSimB.LotCurrent) && (createdSimA.RoomId == createdSimB.RoomId))
                                            {
                                                VisualEffect effect = VisualEffect.Create("ep8AttractionSystem");
                                                createdSimB.ParentHeadlineFx(effect);
                                                effect.SubmitOneShotEffect(VisualEffect.TransitionType.SoftTransition);

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

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

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

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

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

            if (ths.AttractionNPCController != null)
            {
                ths.AttractionNPCController.Dispose();
            }
        }
Esempio n. 12
0
        public override bool Run()
        {
            try
            {
                if (!StartSync())
                {
                    return false;
                }

                // Custom
                mReactToSocialBroadcaster = new ReactionBroadcaster(Actor, Conversation.ReactToSocialParams, SocialComponentEx.ReactToJealousEventHigh);
                //SocialComponent.SendCheatingEvents(Actor, Target, !Rejected);

                StandardEntry(false);
                BeginCommodityUpdates();
                if (IsMaster)
                {
                    ReturnInstance.EnsureMaster();
                    StartSocial("Make Out");
                    InitiateSocialUI(Actor, Target);
                    (LinkedInteractionInstance as NestedRelaxingInteraction).Rejected = Rejected;
                    if (Rejected)
                    {
                        ReturnInstance.mCurrentStateMachine.RequestState(null, "MakeOutReject");
                        ReturnInstance.mCurrentStateMachine.RequestState(null, "ToRelax");
                        FinishSocial("Make Out", true);
                    }
                    else
                    {
                        ReturnInstance.mCurrentStateMachine.RequestState(null, "MakeOut");
                        StartStages();
                        if ((Actor.Posture.Container as Bed).IsTent)
                        {
                            ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.BalloonData("balloon_lips");
                            Actor.ThoughtBalloonManager.ShowBalloon(bd);
                            Target.ThoughtBalloonManager.ShowBalloon(bd);
                        }
                        DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                        FinishSocial("Make Out", true);
                    }
                }
                else
                {
                    DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                }

                FinishLinkedInteraction(IsMaster);
                EndCommodityUpdates(!Rejected);
                StandardExit(false, false);
                EventTracker.SendEvent(new SocialEvent(EventTypeId.kSocialInteraction, Actor, Target, "Make Out", !IsMaster, !Rejected, false, CommodityTypes.Undefined));
                if (!Rejected)
                {
                    Actor.SimDescription.SetFirstKiss(Target.SimDescription);
                    DoResume();
                }
                WaitForSyncComplete();
                return !Rejected;
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return false;
            }
        }
Esempio n. 13
0
        public void motive_motive_distress(Sim sim, CommodityKind commodity)
        {
            if (commodity == (CommodityKind)0x44440444)
            {
                return;
            }

            SimDescription simd        = sim.SimDescription;
            BuffManager    buffManager = sim.BuffManager;
            Motives        moves       = sim.Motives;

            switch (commodity)
            {
            case CommodityKind.Bladder:
            {
                bool flag = true;
                InteractionDefinition interactionDefinition;
                switch (simd.Species)
                {
                case CASAgeGenderFlags.Horse:
                    interactionDefinition = Sim.HorsePee.Singleton;
                    break;

                case CASAgeGenderFlags.Dog:
                case CASAgeGenderFlags.LittleDog:
                    interactionDefinition = (InteractionDefinition)Sim.DogPeeStart.Singleton;
                    break;

                case CASAgeGenderFlags.Cat:
                    interactionDefinition = (InteractionDefinition)Sim.CatPeeStart.Singleton;
                    break;

                default:
                    interactionDefinition = Sim.BladderFailure.Singleton;
                    break;
                }

                foreach (InteractionInstance interaction in sim.InteractionQueue.InteractionList)
                {
                    if (interaction is Sim.DogPee || interaction is Sim.CatPee || interaction.InteractionDefinition == interactionDefinition)
                    {
                        flag = false;
                        break;
                    }
                }

                if (flag)
                {
                    SwimmingInPool swimmingInPool = sim.Posture as SwimmingInPool;
                    if (swimmingInPool == null)
                    {
                        InteractionInstance interactionInstance = interactionDefinition.CreateInstance(sim, sim, new InteractionPriority(InteractionPriorityLevel.High), false, false);
                        Sim.DogPeeStart     dogPeeStart         = interactionInstance as Sim.DogPeeStart;
                        if (dogPeeStart != null)
                        {
                            dogPeeStart.DoNotRoute = true;
                        }
                        else
                        {
                            Sim.CatPeeStart catPeeStart = interactionInstance as Sim.CatPeeStart;
                            if (catPeeStart != null)
                            {
                                catPeeStart.DoNotRoute = true;
                            }
                        }
                        if (sim.InteractionQueue.AddNext(interactionInstance) && simd.IsRaccoon)
                        {
                            sim.AddExitReason(ExitReason.BuffFailureState);
                        }
                        else
                        {
                            BuffInstance buffOfSolveCommodity = buffManager.GetBuffOfSolveCommodity(commodity);
                            if (buffOfSolveCommodity != null && buffOfSolveCommodity.EffectValue <= 0)
                            {
                                ThoughtBalloonManager.BalloonData balloonData = new ThoughtBalloonManager.BalloonData(buffOfSolveCommodity.ThumbString);
                                if (balloonData.IsValid)
                                {
                                    balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
                                    balloonData.mCoolDown   = ThoughtBalloonCooldown.None;
                                    sim.ThoughtBalloonManager.ShowBalloon(balloonData);
                                }
                            }

                            moves.SetMax(CommodityKind.Bladder);

                            if (!simd.IsPet)
                            {
                                PuddleManager.AddPuddle(sim.Position);
                                moves.SetValue(CommodityKind.Hygiene, -100f);
                                if (GlobalFunctions.AreOtherSimsNearby(sim, BuffEmbarrassed.DistanceForEmbarrassedBuff))
                                {
                                    buffManager.AddElement(BuffNames.Embarrassed, Origin.FromPeeingSelf);
                                }
                                ActiveTopic.AddToSim(sim, "Embarrassment");
                            }
                            else
                            {
                                MetaAutonomyVenueType metaAutonomyVenueType = sim.LotCurrent.GetMetaAutonomyVenueType();
                                if ((!simd.IsADogSpecies || metaAutonomyVenueType != MetaAutonomyVenueType.DogPark) && World.GetTerrainType(sim.Position) == TerrainType.LotFloor)
                                {
                                    PuddleManager.AddPuddle(sim.Position);
                                }
                            }
                            EventTracker.SendEvent(EventTypeId.kBladderFailure, sim);
                        }
                        Motive motive = moves.GetMotive(CommodityKind.Bladder);
                        if (motive != null)
                        {
                            motive.PotionBladderDecayOverride = false;
                        }
                    }
                    else
                    {
                        swimmingInPool.ContainerPool.PeeInPool(sim);
                    }
                }
                break;
            }

            case CommodityKind.Hunger:
            case CommodityKind.VampireThirst:

                if (simd.IsFrankenstein)
                {
                    OccultFrankenstein.PushFrankensteinShortOut(sim);
                }
                else if (!simd.IsGhost && !simd.IsDead && !IsCheckKillSimInteraction(sim))
                {
                    if (sim.Posture.Satisfies(CommodityKind.ScubaDiving, null) && !simd.IsMermaid)
                    {
                        sim.Kill(SimDescription.DeathType.ScubaDrown);
                    }
                    else if (sim.Posture.Satisfies(CommodityKind.SwimmingInPool, null) && !simd.IsMermaid)
                    {
                        sim.Kill(SimDescription.DeathType.Drown);
                    }
                    else if (SimTemperature.HasFrozenSolidInteraction(sim))
                    {
                        sim.Kill(SimDescription.DeathType.Freeze, null, false);
                    }
                    else if (OccultMermaid.IsDehydrated(sim))
                    {
                        sim.Kill(SimDescription.DeathType.MermaidDehydrated, null, false);
                    }
                    else
                    {
                        sim.Kill(sim.SimDescription.IsVampire ? SimDescription.DeathType.Thirst : SimDescription.DeathType.Starve);
                    }
                }
                break;

            case CommodityKind.Temperature:
            {
                float value = moves.GetValue(CommodityKind.Temperature);
                if (value > 0f)
                {
                    SimTemperature.PushSpontaneouslyCombustInteraction(sim);
                }
                else
                {
                    SimTemperature.PushFreezeInteraction(sim);
                }
                break;
            }

            case CommodityKind.MermaidDermalHydration:
                OccultMermaid.CollapseFromDehydration(sim);
                break;
            }
        }
Esempio n. 14
0
        public static bool Run(CarUFO.AbductSimA ths)
        {
            if (ths.Target.InUse)
            {
                return(false);
            }

            ths.mNPCAbductor = (ths.SimToAbduct != null);

            if (!ths.mNPCAbductor)
            {
                ths.SimToAbduct = ths.GetSelectedObject() as Sim;
            }

            if (ths.SimToAbduct == null)
            {
                return(false);
            }

            ths.StandardEntry();

            if (!ths.SetupAbductee())
            {
                ths.StandardExit();
                return(false);
            }

            Animation.ForceAnimation(ths.Actor.ObjectId, true);
            Animation.ForceAnimation(ths.Target.ObjectId, true);
            ths.Target.mTakeOffPos = ths.Actor.Position;

            if (!ths.Target.RouteToUFOAndTakeOff(ths.Actor))
            {
                ths.StandardExit();
                return(false);
            }

            Camera.FocusOnGivenPosition(ths.mJig.Position, CarUFO.kAbductLerpParams, true);
            ths.BeginCommodityUpdates();
            bool flag = ths.AbductSim();

            ths.EndCommodityUpdates(true);
            Sim[] sims;

            if (flag)
            {
                EventTracker.SendEvent(EventTypeId.kAbductSimUFO, ths.Actor, ths.SimToAbduct);
                sims = new Sim[] { ths.Actor, ths.SimToAbduct };

                if (ths.mNPCAbductor)
                {
                    ths.DoTimedLoop(AlienUtils.kAbductionLength, ExitReason.None);
                }
            }
            else
            {
                sims = new Sim[] { ths.Actor };
            }

            DateAndTime previous   = SimClock.CurrentTime();
            Vector3     landRefPos = ths.GetLandingRefPos(ths.mNPCAbductor);

            while (!ths.Target.TryLandUFOAndExitSims(sims, landRefPos, true))
            {
                Simulator.Sleep(30u);

                if (SimClock.ElapsedTime(TimeUnit.Minutes, previous) > 30f)
                {
                    ths.Target.ForceExitUFODueToLandingFailure(sims);
                    break;
                }
            }

            ths.mFromInventory = (ths.mFromInventory || ths.mNPCAbductor);

            if (ths.mFromInventory)
            {
                ths.mFromInventory = ths.Actor.Inventory.TryToAdd(ths.Target);
            }

            if (!ths.mFromInventory)
            {
                ths.Target.ParkUFO(ths.Actor.LotHome, ths.Actor);
            }

            if (flag)
            {
                if (ths.mNPCAbductor)
                {
                    if (AlienUtilsEx.IsImpregnationSuccessful(ths.SimToAbduct, ths.Actor))
                    {
                        ths.SimToAbduct.SimDescription.Pregnancy = new Pregnancy(ths.SimToAbduct, ths.Actor.SimDescription);
                        ths.SimToAbduct.TraitManager.AddHiddenElement(AlienUtilsEx.sAlienPregnancy);
                    }

                    ths.SimToAbduct.BuffManager.AddElement(BuffNames.Abducted, Origin.FromAbduction);
                    ThoughtBalloonManager.BalloonData data = new ThoughtBalloonManager.BalloonData(ths.Actor.GetThumbnailKey());
                    data.BalloonType = ThoughtBalloonTypes.kThoughtBalloon;
                    data.LowAxis     = ThoughtBalloonAxis.kDislike;
                    data.Duration    = ThoughtBalloonDuration.Medium;
                    data.mPriority   = ThoughtBalloonPriority.High;
                    ths.SimToAbduct.ThoughtBalloonManager.ShowBalloon(data);
                    ths.SimToAbduct.PlayReaction(AlienUtils.kAbductionReactions[RandomUtil.GetInt(0, AlienUtils.kAbductionReactions.Length - 1)], ReactionSpeed.NowOrLater);
                    ths.SimToAbduct.ShowTNSIfSelectable(CarUFO.LocalizeString(ths.SimToAbduct.IsFemale, "NPCAbductionTNS", new object[] { ths.SimToAbduct.ObjectId }),
                                                        StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, ths.SimToAbduct.ObjectId);
                }
                else
                {
                    Sim.ForceSocial(ths.Actor, ths.SimToAbduct, "Reveal Prank", InteractionPriorityLevel.High, true);
                }

                ths.FinishLinkedInteraction(true);
            }

            ths.StandardExit();

            if (flag)
            {
                ths.WaitForSyncComplete();
            }

            return(flag);
        }
Esempio n. 15
0
        public override bool Run()
        {
            try
            {
                if (!SafeToSync())
                {
                    Common.Notify("Fail D");
                    return(false);
                }

                IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                if (LinkedInteractionInstance == null)
                {
                    HotairBalloon.WooHooSocial entry = definition.ProxyClone(Target).CreateInstance(Actor, Target, GetPriority(), Autonomous, CancellableByPlayer) as HotairBalloon.WooHooSocial;
                    if (entry == null)
                    {
                        Common.Notify("Fail A");
                        return(false);
                    }

                    entry.mIsSocialTarget     = true;
                    LinkedInteractionInstance = entry;
                    Target.InteractionQueue.AddNext(entry);
                }

                HotairBalloon.InBalloonPosture posture = Actor.Posture as HotairBalloon.InBalloonPosture;
                if (posture == null)
                {
                    Common.Notify("Fail B");
                    return(false);
                }

                if (!StartSync(!mIsSocialTarget))
                {
                    Common.Notify("Fail C");
                    return(false);
                }

                StandardEntry();
                BeginCommodityUpdates();
                if (mIsSocialTarget)
                {
                    DoLoop(ExitReason.Finished);
                }
                else
                {
                    StartSocial(CommonWoohoo.GetSocialName(definition.GetStyle(this), Actor));

                    Animation.ForceAnimation(Actor.ObjectId, true);
                    Animation.ForceAnimation(Target.ObjectId, true);

                    if (Rejected)
                    {
                        Target.Posture.CurrentStateMachine.RequestState(true, "x", "ToFromSocial");
                        posture.CurrentStateMachine.RequestState(true, "x", "ToFromSocial");
                        posture.CurrentStateMachine.SetActor("y", Target);
                        CreateProps(posture.CurrentStateMachine);
                        posture.CurrentStateMachine.SetParameter("XSimR", posture.IsXActor ? YesOrNo.no : YesOrNo.yes);
                        posture.CurrentStateMachine.EnterState("x", "EnterSocial");
                        posture.CurrentStateMachine.EnterState("y", "EnterSocial");
                        ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.DoubleBalloonData("balloon_woohoo", "balloon_question");
                        bd.BalloonType = ThoughtBalloonTypes.kSpeechBalloon;
                        Actor.ThoughtBalloonManager.ShowBalloon(bd);
                        posture.CurrentStateMachine.RequestState(false, "y", "woohoo rejected");
                        posture.CurrentStateMachine.RequestState(true, "x", "woohoo rejected");
                        bd             = new ThoughtBalloonManager.BalloonData("balloon_woohoo");
                        bd.BalloonType = ThoughtBalloonTypes.kSpeechBalloon;
                        bd.LowAxis     = ThoughtBalloonAxis.kDislike;
                        Target.ThoughtBalloonManager.ShowBalloon(bd);
                        posture.CurrentStateMachine.RequestState(false, "y", "ExitSocial");
                        posture.CurrentStateMachine.RequestState(true, "x", "ExitSocial");
                        posture.CurrentStateMachine.RemoveActor(Target);
                        Target.Posture.CurrentStateMachine.EnterState("x", "ToFromSocial");
                        posture.CurrentStateMachine.EnterState("x", "ToFromSocial");
                        Target.Posture.CurrentStateMachine.EnterState("x", "IdleStand");
                        posture.CurrentStateMachine.EnterState("x", "IdleStand");
                        Actor.GetRelationship(Target, true).LTR.UpdateLiking(HotairBalloon.kWoohooRejectLtrChange);
                        SocialComponent.SetSocialFeedbackForActorAndTarget(CommodityTypes.Friendly, Actor, Target, false, 0x0, LongTermRelationshipTypes.Undefined, LongTermRelationshipTypes.Undefined);
                        SocialCallback.AddRejectedByEx(Actor, Target, GetInteractionName(), null, this);
                    }
                    else
                    {
                        switch (posture.Balloon.mCurrentHeight)
                        {
                        case HotairBalloon.BalloonHeight.OnGround:
                            posture.CurrentStateMachine.SetParameter("Height", SkillLevel.poor);
                            break;

                        case HotairBalloon.BalloonHeight.Height1:
                            posture.CurrentStateMachine.SetParameter("Height", SkillLevel.novice);
                            break;
                        }

                        Sim actor = posture.IsXActor ? Actor : Target;
                        Sim sim2  = posture.IsXActor ? Target : Actor;
                        actor.Posture.CurrentStateMachine.RequestState(true, "x", "ToFromSocial");
                        sim2.Posture.CurrentStateMachine.RequestState(true, "x", "ToFromSocial");
                        sim2.Posture.CurrentStateMachine.SetActor("y", actor);
                        CreateProps(sim2.Posture.CurrentStateMachine);
                        sim2.Posture.CurrentStateMachine.EnterState("x", "EnterSocial");
                        sim2.Posture.CurrentStateMachine.EnterState("y", "EnterSocial");
                        ThoughtBalloonManager.BalloonData data2 = new ThoughtBalloonManager.DoubleBalloonData("balloon_woohoo", "balloon_question");
                        data2.BalloonType = ThoughtBalloonTypes.kSpeechBalloon;
                        Actor.ThoughtBalloonManager.ShowBalloon(data2);
                        sim2.Posture.CurrentStateMachine.RequestState(false, "y", "woohoo");
                        sim2.Posture.CurrentStateMachine.RequestState(true, "x", "woohoo");
                        sim2.Posture.CurrentStateMachine.RequestState(false, "y", "ExitSocial");
                        sim2.Posture.CurrentStateMachine.RequestState(true, "x", "ExitSocial");
                        sim2.Posture.CurrentStateMachine.RemoveActor(actor);
                        actor.Posture.CurrentStateMachine.EnterState("x", "ToFromSocial");
                        sim2.Posture.CurrentStateMachine.EnterState("x", "ToFromSocial");
                        Relationship relationship = Actor.GetRelationship(Target, true);
                        relationship.STC.Update(Actor, Target, CommodityTypes.Amorous, HotairBalloon.kSTCIncreaseAfterWoohoo);
                        relationship.LTR.UpdateLiking(-HotairBalloon.kWoohooRejectLtrChange);

                        CommonWoohoo.RunPostWoohoo(Actor, Target, posture.Balloon, definition.GetStyle(this), definition.GetLocation(posture.Balloon), true);

                        if (CommonPregnancy.IsSuccess(Actor, Target, Autonomous, definition.GetStyle(this)))
                        {
                            CommonPregnancy.Impregnate(Actor, Target, Autonomous, definition.GetStyle(this));
                        }

                        actor.Posture.CurrentStateMachine.EnterState("x", "IdleStand");
                        sim2.Posture.CurrentStateMachine.EnterState("x", "IdleStand");

                        Actor.BuffManager.AddElement((BuffNames)(0x9a7f5f1919df0036L), Origin.None);
                        Target.BuffManager.AddElement((BuffNames)(0x9a7f5f1919df0036L), Origin.None);
                    }

                    FinishSocial(CommonWoohoo.GetSocialName(definition.GetStyle(this), Actor), Rejected);
                    Target.AddExitReason(ExitReason.Finished);
                }

                FinishLinkedInteraction(mIsSocialTarget);
                EndCommodityUpdates(Rejected);
                StandardExit();
                WaitForSyncComplete();
                posture.Balloon.PushIdleInteractionOnSim(Actor);
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception exception)
            {
                Woohooer.Settings.AddChange(Actor);
                Woohooer.Settings.AddChange(Target);

                Common.Exception(Actor, Target, exception);
                return(false);
            }
        }
Esempio n. 16
0
        public override bool Run()
        {
            if (!base.Actor.RouteToObjectRadialRange(base.Target, 0f, base.Target.MaxProximityBeforeSwiping()))
            {
                //Honestly just plain annoying to watch, especially since sims love this interaction so much
                //base.Actor.PlayRouteFailure();
                return(false);
            }
            base.Actor.RouteTurnToFace(base.Target.Position);
            base.StandardEntry();
            base.BeginCommodityUpdates();
            List <ObjectGuid> objectsICanBuyInDisplay = DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target);

            RandomUtil.RandomizeListOfObjects <ObjectGuid>(objectsICanBuyInDisplay);
            for (int i = 0; base.Actor.HasNoExitReason() && (i < objectsICanBuyInDisplay.Count); i++)
            {
                ObjectGuid guid   = objectsICanBuyInDisplay[i];
                GameObject target = GlobalFunctions.ConvertGuidToObject <GameObject>(guid);
                if (target != null)
                {
                    base.Actor.RouteTurnToFace(target.Position);
                    int priority = 100;
                    base.Actor.LookAtManager.SetInteractionLookAt(target, priority, LookAtJointFilter.HeadBones | LookAtJointFilter.TorsoBones);
                    bool flag = RandomUtil.RandomChance01(CraftersConsignment.kBrowseChanceOfDislikingObject);
                    ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.BalloonData(target.GetThumbnailKey());
                    if (flag)
                    {
                        bd.LowAxis = ThoughtBalloonAxis.kDislike;
                    }
                    base.Actor.ThoughtBalloonManager.ShowBalloon(bd);
                    string state = "1";
                    if (flag)
                    {
                        state = RandomUtil.GetRandomStringFromList(new string[] { "3", "5", "CantStandArtTraitReaction" });
                    }
                    else
                    {
                        state = RandomUtil.GetRandomStringFromList(new string[] { "0", "1", "2" });
                    }
                    base.EnterStateMachine("viewobjectinteraction", "Enter", "x");
                    base.AnimateSim(state);
                    base.AnimateSim("Exit");
                    base.Actor.LookAtManager.ClearInteractionLookAt();
                }
            }
            if (base.Autonomous && !base.Actor.IsSelectable)
            {
                float chance = CraftersConsignment.kBrowseBaseChanceOfBuyingObjectWithoutSale + base.Target.mSaleDiscount;
                if (RandomUtil.RandomChance01(chance))
                {
                    List <ObjectGuid> randomList = DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target);
                    if (randomList.Count > 0)
                    {
                        ObjectGuid randomObjectFromList = RandomUtil.GetRandomObjectFromList <ObjectGuid>(randomList);
                        if (randomObjectFromList != ObjectGuid.InvalidObjectGuid)
                        {
                            PurchaseItemEx.Definition continuationDefinition = null;
                            if (Actor.Motives.IsHungry())
                            {
                                PreparedFood food = GlobalFunctions.ConvertGuidToObject <PreparedFood>(randomObjectFromList);
                                if (food != null)
                                {
                                    continuationDefinition = new PurchaseItemEx.BuyFoodDefinition(food);
                                }
                            }
                            if (continuationDefinition == null)
                            {
                                continuationDefinition = new PurchaseItemEx.Definition(randomObjectFromList, false);
                            }
                            base.TryPushAsContinuation(continuationDefinition);
                        }
                    }
                }
            }
            if (!base.Autonomous)
            {
                List <ObjectGuid> list3 = DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target);
                if (objectsICanBuyInDisplay.Count > 0)
                {
                    StringBuilder builder = new StringBuilder();
                    builder.AppendLine(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "BrowseItemsForPurchaseHeading", new object[0]));
                    for (int j = 0; j < list3.Count; j++)
                    {
                        GameObject obj3 = GlobalFunctions.ConvertGuidToObject <GameObject>(list3[j]);
                        if (obj3 != null)
                        {
                            ServingContainer container = obj3 as ServingContainer;
                            if (container != null)
                            {
                                builder.AppendLine(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "BrowseLineItem", new object[] { container.CookingProcess.RecipeNameFinal, DisplayHelper.ComputeFinalPriceOnObject(list3[j]) }));
                            }
                            else
                            {
                                Common.Notify("BrowseEx for " + obj3.CatalogName);
                                builder.AppendLine(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "BrowseLineItem", new object[] { obj3.CatalogName, DisplayHelper.ComputeFinalPriceOnObject(list3[j]) }));
                            }
                        }
                    }
                    base.Actor.ShowTNSIfSelectable(builder.ToString(), StyledNotification.NotificationStyle.kGameMessagePositive);
                }
            }
            base.EndCommodityUpdates(true);
            base.StandardExit();
            return(true);
        }
Esempio n. 17
0
 public override bool Run()
 {
     if (!base.Actor.RouteToObjectRadialRange(base.Target, 0f, base.Target.MaxProximityBeforeSwiping()))
     {
         base.Actor.PlayRouteFailure();
         return false;
     }
     base.Actor.RouteTurnToFace(base.Target.Position);
     base.StandardEntry();
     base.BeginCommodityUpdates();
     List<ObjectGuid> objectsICanBuyInDisplay = DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target);
     RandomUtil.RandomizeListOfObjects<ObjectGuid>(objectsICanBuyInDisplay);
     for (int i = 0; base.Actor.HasNoExitReason() && (i < objectsICanBuyInDisplay.Count); i++)
     {
         ObjectGuid guid = objectsICanBuyInDisplay[i];
         GameObject target = GlobalFunctions.ConvertGuidToObject<GameObject>(guid);
         if (target != null)
         {
             base.Actor.RouteTurnToFace(target.Position);
             int priority = 100;
             base.Actor.LookAtManager.SetInteractionLookAt(target, priority, LookAtJointFilter.HeadBones | LookAtJointFilter.TorsoBones);
             bool flag = RandomUtil.RandomChance01(CraftersConsignment.kBrowseChanceOfDislikingObject);
             ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.BalloonData(target.GetThumbnailKey());
             if (flag)
             {
                 bd.LowAxis = ThoughtBalloonAxis.kDislike;
             }
             base.Actor.ThoughtBalloonManager.ShowBalloon(bd);
             string state = "1";
             if (flag)
             {
                 state = RandomUtil.GetRandomStringFromList(new string[] { "3", "5", "CantStandArtTraitReaction" });
             }
             else
             {
                 state = RandomUtil.GetRandomStringFromList(new string[] { "0", "1", "2" });
             }
             base.EnterStateMachine("viewobjectinteraction", "Enter", "x");
             base.AnimateSim(state);
             base.AnimateSim("Exit");
             base.Actor.LookAtManager.ClearInteractionLookAt();
         }
     }
     if (base.Autonomous && !base.Actor.IsSelectable)
     {
         float chance = CraftersConsignment.kBrowseBaseChanceOfBuyingObjectWithoutSale + base.Target.mSaleDiscount;
         if (RandomUtil.RandomChance01(chance))
         {
             List<ObjectGuid> randomList = DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target);
             if (randomList.Count > 0)
             {
                 ObjectGuid randomObjectFromList = RandomUtil.GetRandomObjectFromList<ObjectGuid>(randomList);
                 if (randomObjectFromList != ObjectGuid.InvalidObjectGuid)
                 {
                     PurchaseItemEx.Definition continuationDefinition = new PurchaseItemEx.Definition(randomObjectFromList, DisplayHelper.ComputeFinalPriceOnObject(randomObjectFromList), false);
                     base.TryPushAsContinuation(continuationDefinition);
                 }
             }
         }
     }
     if (!base.Autonomous)
     {
         List<ObjectGuid> list3 = DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target);
         if (objectsICanBuyInDisplay.Count > 0)
         {
             StringBuilder builder = new StringBuilder();
             builder.AppendLine(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "BrowseItemsForPurchaseHeading", new object[0]));
             for (int j = 0; j < list3.Count; j++)
             {
                 GameObject obj3 = GlobalFunctions.ConvertGuidToObject<GameObject>(list3[j]);
                 if (obj3 != null)
                 {
                     ServingContainer container = obj3 as ServingContainer;
                     if (container != null)
                     {
                         builder.AppendLine(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "BrowseLineItem", new object[] { container.CookingProcess.RecipeNameFinal, DisplayHelper.ComputeFinalPriceOnObject(list3[j]) }));
                     }
                     else
                     {
                         Common.Notify("BrowseEx for " + obj3.CatalogName);
                         builder.AppendLine(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "BrowseLineItem", new object[] { obj3.CatalogName, DisplayHelper.ComputeFinalPriceOnObject(list3[j]) }));
                     }
                 }
             }
             base.Actor.ShowTNSIfSelectable(builder.ToString(), StyledNotification.NotificationStyle.kGameMessagePositive);
         }
     }
     base.EndCommodityUpdates(true);
     base.StandardExit();
     return true;
 }
Esempio n. 18
0
        public override bool Run()
        {
            if (Target.InUse)
            {
                return(false);
            }

            mNPCAbductor = (SimToAbduct != null);

            if (!mNPCAbductor)
            {
                SimToAbduct = GetSelectedObject() as Sim;
            }

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

            StandardEntry();

            if (!SetupAbductee())
            {
                StandardExit();
                return(false);
            }

            Animation.ForceAnimation(Actor.ObjectId, true);
            Animation.ForceAnimation(Target.ObjectId, true);
            Target.mTakeOffPos = Actor.Position;

            if (!Target.RouteToUFOAndTakeOff(Actor))
            {
                StandardExit();
                return(false);
            }

            Camera.FocusOnGivenPosition(mJig.Position, CarUFO.kAbductLerpParams, true);
            BeginCommodityUpdates();
            bool flag = AbductSim();

            EndCommodityUpdates(true);
            Sim[] sims;

            if (flag)
            {
                EventTracker.SendEvent(EventTypeId.kAbductSimUFO, Actor, SimToAbduct);
                sims = new Sim[] { Actor, SimToAbduct };

                if (mNPCAbductor)
                {
                    DoTimedLoop(AlienUtils.kAbductionLength, ExitReason.None);
                }
            }
            else
            {
                sims = new Sim[] { Actor };
            }

            DateAndTime previous   = SimClock.CurrentTime();
            Vector3     landRefPos = GetLandingRefPos(mNPCAbductor);

            while (!Target.TryLandUFOAndExitSims(sims, landRefPos, true))
            {
                Simulator.Sleep(30u);

                if (SimClock.ElapsedTime(TimeUnit.Minutes, previous) > 30f)
                {
                    Target.ForceExitUFODueToLandingFailure(sims);
                    break;
                }
            }

            mFromInventory = (mFromInventory || mNPCAbductor);

            if (mFromInventory)
            {
                mFromInventory = Actor.Inventory.TryToAdd(Target);
            }

            if (!mFromInventory)
            {
                Target.ParkUFO(Actor.LotHome, Actor);
            }

            if (flag)
            {
                if (mNPCAbductor)
                {
                    AbductionBuffs.ApplyAbductedEx(SimToAbduct, Actor.SimDescription, false);
                    ThoughtBalloonManager.BalloonData data = new ThoughtBalloonManager.BalloonData(Actor.GetThumbnailKey());
                    data.BalloonType = ThoughtBalloonTypes.kThoughtBalloon;
                    data.LowAxis     = ThoughtBalloonAxis.kDislike;
                    data.Duration    = ThoughtBalloonDuration.Medium;
                    data.mPriority   = ThoughtBalloonPriority.High;
                    SimToAbduct.ThoughtBalloonManager.ShowBalloon(data);
                    SimToAbduct.PlayReaction(AlienUtils.kAbductionReactions[RandomUtil.GetInt(0, AlienUtils.kAbductionReactions.Length - 1)], ReactionSpeed.NowOrLater);
                    SimToAbduct.ShowTNSIfSelectable(CarUFO.LocalizeString(SimToAbduct.IsFemale, "NPCAbductionTNS", new object[] { SimToAbduct.ObjectId }),
                                                    StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, SimToAbduct.ObjectId);
                }
                else
                {
                    Sim.ForceSocial(Actor, SimToAbduct, "Reveal Prank", InteractionPriorityLevel.High, true);
                }

                FinishLinkedInteraction(true);
            }

            StandardExit();

            if (flag)
            {
                WaitForSyncComplete();
            }

            return(flag);
        }