コード例 #1
0
        public override bool Run()
        {
            try
            {
                AlarmHandle handle;
                float       kTimeToRemoveTattoos;
                if (!Target.RouteToChairControls(Actor))
                {
                    return(false);
                }
                if (!StartSync(true))
                {
                    return(false);
                }
                Actor.LoopIdle();
                Actor.SkillManager.AddElement(SkillNames.Tattooing);
                StandardEntry();

                BeginCommodityUpdates();

                Sim instanceActor = LinkedInteractionInstance.InstanceActor;
                Target.OnStartTattooing(instanceActor);
                AcquireStateMachine(Target.StateMachineName, AnimationPriority.kAPNormalPlus);
                SetActorAndEnter(Target.ActorForTattooer, Actor, "Enter");
                SetActor("tattooChair", Target);
                SetActor(Target.ActorForTattooed, instanceActor);
                SetParameter("isScared", TattooChair.ShouldPlayScaredReaction(instanceActor));
                AddPersistentScriptEventHandler(0x0, new SacsEventHandler(Target.OnSound));
                EnterState(Target.ActorForTattooed, "Enter");
                AnimateSim("Tattoo");

                kTimeToRemoveTattoos = Tattooing.GetTimeToTattoo(Actor);
                handle = Target.AddAlarm(kTimeToRemoveTattoos * TattooChair.kTimeAtWhichToPerformAction, TimeUnit.Minutes, OnDisplayCas, "Tattoo Chair - Display Cas", AlarmType.DeleteOnReset);

                bool succeeded = DoTimedLoop(kTimeToRemoveTattoos);
                if (!succeeded)
                {
                    Target.RemoveAlarm(handle);
                }

                AnimateSim("Exit");
                FinishLinkedInteraction(true);
                EndCommodityUpdates(succeeded);
                StandardExit();
                WaitForSyncComplete();
                Target.Repairable.UpdateBreakage(Actor.IsSelectable ? Actor : instanceActor);
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
コード例 #2
0
ファイル: GiveTattooToSelfEx.cs プロジェクト: yakoder/NRaas
 public override bool Run()
 {
     try
     {
         if (!Target.RouteToChairControls(Actor))
         {
             return(false);
         }
         EnterStateMachine(Target.StateMachineName, "Enter", "x");
         SetActor("tattooChair", Target);
         SetActor("y", Actor);
         AnimateSim("Tattoo Self Stand");
         AddPersistentScriptEventHandler(0x0, new SacsEventHandler(Target.OnSound));
         bool succeeded = DoTimedLoop(TattooChair.kTimeToPrepareSelfTattoo);
         AnimateSim("Exit");
         if (!succeeded || !Target.RouteToChair(Actor))
         {
             return(false);
         }
         EnterState("x", "Enter");
         EnterState("tattooChair", "Enter");
         Actor.SkillManager.AddElement(SkillNames.Tattooing);
         StandardEntry();
         BeginCommodityUpdates();
         SetParameter("isScared", TattooChair.ShouldPlayScaredReaction(Actor));
         AnimateSim("Tattoo Self");
         float       timeToTattoo = Tattooing.GetTimeToTattoo(Actor);
         AlarmHandle handle       = Target.AddAlarm(timeToTattoo * TattooChair.kTimeAtWhichToPerformAction, TimeUnit.Minutes, new AlarmTimerCallback(OnDisplayCas), "Tattoo Chair - Display Cas", AlarmType.DeleteOnReset);
         succeeded = DoTimedLoop(timeToTattoo);
         if (!succeeded)
         {
             Target.RemoveAlarm(handle);
         }
         AnimateSim("Exit");
         Target.Repairable.UpdateBreakage(Actor);
         EndCommodityUpdates(succeeded);
         StandardExit();
         return(succeeded);
     }
     catch (ResetException)
     {
         throw;
     }
     catch (Exception e)
     {
         Common.Exception(Actor, Target, e);
         return(false);
     }
 }
コード例 #3
0
        public override bool DoTeleport(IGameObject gameObject)
        {
            if ((!(InteractionDefinition is Definition) || (Target == null)) || (Actor == null))
            {
                return(false);
            }

            GameObject destinationObject = null;
            bool       flag = IsForOccupation(Actor);

            if ((flag && (Actor != null)) && (Actor.Occupation != null))
            {
                destinationObject = Actor.Occupation.OfficeLocation;
            }
            else if ((IsForSchool(Actor) && (Actor.School != null)) && (Actor.School.CareerLoc != null))
            {
                // Custom
                destinationObject = Actor.School.CareerLoc.Owner.RabbitHoleProxy;
            }

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

            bool flag2 = Target.Teleport(Actor, destinationObject);

            if ((flag2 && flag) && ((Actor.Occupation.HoursUntilWork > kEarlyBonusHoursEarlyToGetBonus) && (Actor.Occupation.HoursUntilWork < 12f)))
            {
                Target.AddAlarm(kEarlyNoticeDelayInMinutes, TimeUnit.Minutes, WorkEarlyBonus, "Get to work early bonus", AlarmType.DeleteOnReset);
            }
            if (flag2 && (destinationObject is RabbitHole))
            {
                InteractionInstance entry = (flag ? WorkInRabbitHole.Singleton : GoToSchoolInRabbitHole.Singleton).CreateInstance(destinationObject, Actor, Actor.InheritedPriority(), false, true);
                return(Actor.InteractionQueue.AddNext(entry));
            }

            return(flag2);
        }
コード例 #4
0
ファイル: TakeElevatorToTopEx.cs プロジェクト: pepoluan/NRaas
        public override bool InRabbitHole()
        {
            DoChargeCheck(true);
            if (base.InteractionDefinition is TakeElevatorToTopEx.StairsDefinition)
            {
                AddWondrousViewAlarmHandle = Target.AddAlarm((float)EiffelTower.TakeElevatorToTop.kTimeUntilWondrousViewBuff * 2, TimeUnit.Minutes, new AlarmTimerCallback(AddWondrousViewBuffCallback), "AddWondrousViewBuffAlarm", AlarmType.DeleteOnReset);
                AddSoreBuffAlarmHandle     = Target.AddAlarm((float)EiffelTower.TakeElevatorToTop.kTimeUntilSoreBuff, TimeUnit.Minutes, new AlarmTimerCallback(AddSoreBuffCallback), "AddSoreBuffAlarm", AlarmType.DeleteOnReset);
                Actor.AddCardioDelta(EiffelTower.TakeElevatorToTop.kDaysToReachCardioShape);
                Actor.SkillManager.StartGainWithoutSkillMeter(SkillNames.Athletic, EiffelTower.TakeElevatorToTop.kAthleticSkillGainRate, true);
            }
            else
            {
                AddWondrousViewAlarmHandle = Target.AddAlarm((float)EiffelTower.TakeElevatorToTop.kTimeUntilWondrousViewBuff, TimeUnit.Minutes, new AlarmTimerCallback(AddWondrousViewBuffCallback), "AddWondrousViewBuffAlarm", AlarmType.DeleteOnReset);
            }
            try
            {
                Definition definition = InteractionDefinition as Definition;

                StartStages();
                BeginCommodityUpdates();

                bool succeeded = false;
                try
                {
                    succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new Interaction <Sim, RabbitHole> .InsideLoopFunction(LoopDel), null);
                }
                finally
                {
                    EndCommodityUpdates(succeeded);
                }

                if (IsGettingItOn)
                {
                    if (Actor == WooHooer)
                    {
                        switch (RomanticType)
                        {
                        case RabbitHoleRomanticType.TryForBaby:
                        case RabbitHoleRomanticType.WooHoo:
                            CommonWoohoo.RunPostWoohoo(WooHooer, WooHooee, Target, mStyle, CommonWoohoo.WoohooLocation.EiffelTower, true);
                            break;
                        }

                        Relationship relationship = Relationship.Get(WooHooer, WooHooee, true);
                        if (relationship != null)
                        {
                            relationship.UpdateSTCFromOutsideConversation(WooHooer, WooHooee, definition.VisitTuning.WooHooingCommodity, definition.VisitTuning.WooHooingSTCIncrement);
                        }
                    }

                    if ((mImpregnate) && (CommonPregnancy.IsSuccess(WooHooer, WooHooee, Autonomous, mStyle)))
                    {
                        CommonPregnancy.Impregnate(WooHooer, WooHooee, Autonomous, mStyle);
                    }

                    Target.RabbitHoleProxy.TurnOffWooHooEffect();
                }

                if (Actor.HasExitReason(ExitReason.StageComplete) || (Actor.HasExitReason(ExitReason.Finished) && !IsGettingItOn))
                {
                    Career occupationAsCareer = Actor.OccupationAsCareer;
                    if ((occupationAsCareer != null) && (occupationAsCareer.CareerLoc.Owner == Target))
                    {
                        Actor.BuffManager.AddElement(BuffNames.Bored, definition.VisitBuffOrigin);
                        return(succeeded);
                    }

                    float visitBoredomChanceAdult = definition.VisitTuning.VisitBoredomChanceAdult;
                    if (Actor.SimDescription.Teen)
                    {
                        visitBoredomChanceAdult = definition.VisitTuning.VisitBoredomChanceTeen;
                    }
                    else if (Actor.SimDescription.Child)
                    {
                        visitBoredomChanceAdult = definition.VisitTuning.VisitBoredomChanceChild;
                    }

                    if (RandomUtil.RandomChance(visitBoredomChanceAdult))
                    {
                        Actor.BuffManager.AddElement(BuffNames.Bored, definition.VisitBuffOrigin);
                        return(succeeded);
                    }

                    BuffNames[] namesArray = new BuffNames[] { BuffNames.Excited, BuffNames.Fascinated, BuffNames.Intrigued, BuffNames.Impressed, BuffNames.Educated };
                    Actor.BuffManager.AddElement(namesArray[RandomUtil.GetInt(0x4)], definition.VisitBuffOrigin);
                }
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }