Ejemplo n.º 1
0
            public override void ConfigureInteraction()
            {
                try
                {
                    mCareer = Actor.OccupationAsCareer;

                    mFinishTime = (SimClock.Hours24 + mCareer.CurLevel.DayLength) % 24;

                    InteractionIconKey = new ThumbnailKey(ResourceKey.CreatePNGKey(mCareer.DreamsAndPromisesIcon, 0x0), ThumbnailSize.Medium);
                    mCareer.SetTones(this);

                    StringDelegate delegate2;
                    if (((mCareer.LastTone != null) && mCareer.LastTone.ShouldAddTone(mCareer)) && mCareer.LastTone.Test(this, out delegate2))
                    {
                        CurrentTone = mCareer.LastTone;
                    }
                    if (mCareer.IsSpecialWorkTime)
                    {
                        TimeOfDayStage stage = new TimeOfDayStage(LocalizeString("WorkStage", new object[0x0]), mCareer.HourSpecialWorkTimeEnds, 24f);
                        Stages = new List <Stage>(new Stage[] { stage });
                    }
                    else
                    {
                        float maxDurationInHours     = (mCareer.CurLevel.DayLength + Career.kNumHoursEarlyCanShowUpForWork) + mCareer.OvertimeHours;
                        WorkInRabbitHoleStage stage2 = new WorkInRabbitHoleStage(LocalizeString("WorkEndShiftStage", new object[0x0]), mFinishTime, maxDurationInHours, mCareer);
                        Stages      = new List <Stage>(new Stage[] { stage2 });
                        ActiveStage = stage2;
                        if (Actor.TraitManager.HasElement(TraitNames.Workaholic))
                        {
                            foreach (CareerTone tone in mCareer.Tones)
                            {
                                if (tone is WorkHardTone)
                                {
                                    CurrentTone = tone;
                                    break;
                                }
                            }
                        }
                        else if (Actor.TraitManager.HasElement(TraitNames.Schmoozer))
                        {
                            foreach (CareerTone tone2 in mCareer.Tones)
                            {
                                if (tone2 is SuckUpToBossTone)
                                {
                                    CurrentTone = tone2;
                                    break;
                                }
                            }
                        }
                    }
                }
                catch (ResetException)
                {
                    throw;
                }
                catch (Exception e)
                {
                    Common.Exception(Actor, Target, e);
                }
            }
Ejemplo n.º 2
0
        public static void PostInRabbitHoleLoop(GoToSchoolInRabbitHole ths, ref bool succeeded, ref bool detention, ref bool fieldTrip, ref AfterschoolActivity activity, ref bool hasAfterschoolActivity)
        {
            try
            {
                School school = ths.Actor.School;

                ISchoolRabbitHole target = GetTarget(ths);

                activity = ths.GetAfterschoolActivity(ths.Actor, school, target, ref hasAfterschoolActivity);

                fieldTrip = FieldTripSituation.GetFieldTripSituation(ths.Actor) != null;
                detention = school.CurentDetentionStatus == School.DetentionStatus.HasDetention;

                if (detention && !fieldTrip)
                {
                    school.CurentDetentionStatus = School.DetentionStatus.InDetention;
                    float          maxDurationInHours = (school.DayLength + Career.kNumHoursEarlyCanShowUpForWork) + school.SchoolTuning.DetentionLengthInHours;
                    TimeOfDayStage stage = new TimeOfDayStage(Localization.LocalizeString(ths.Actor.IsFemale, "Gameplay/Careers/WorkInRabbitHole:SchoolDetention", new object[0x0]), school.CurLevel.FinishTime() + school.SchoolTuning.DetentionLengthInHours, maxDurationInHours);
                    ths.Stages      = new List <Stage>(new Stage[] { stage });
                    ths.ActiveStage = stage;
                    school.SetTones(ths);
                    ths.Actor.RemoveExitReason(ExitReason.StageComplete);
                    ths.Actor.BuffManager.AddElement(BuffNames.Detention, Origin.FromSchool);
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(ths.Actor, ths.Target, e);
            }
        }
Ejemplo n.º 3
0
            public override void ConfigureInteraction()
            {
                try
                {
                    mCareer = Actor.OccupationAsCareer;

                    mFinishTime = (SimClock.Hours24 + mCareer.CurLevel.DayLength) % 24;

                    InteractionIconKey = new ThumbnailKey(ResourceKey.CreatePNGKey(mCareer.DreamsAndPromisesIcon, 0x0), ThumbnailSize.Medium);
                    mCareer.SetTones(this);

                    StringDelegate delegate2;
                    if (((mCareer.LastTone != null) && mCareer.LastTone.ShouldAddTone(mCareer)) && mCareer.LastTone.Test(this, out delegate2))
                    {
                        CurrentTone = mCareer.LastTone;
                    }
                    if (mCareer.IsSpecialWorkTime)
                    {
                        TimeOfDayStage stage = new TimeOfDayStage(LocalizeString("WorkStage", new object[0x0]), mCareer.HourSpecialWorkTimeEnds, 24f);
                        Stages = new List<Stage>(new Stage[] { stage });
                    }
                    else
                    {
                        float maxDurationInHours = (mCareer.CurLevel.DayLength + Career.kNumHoursEarlyCanShowUpForWork) + mCareer.OvertimeHours;
                        WorkInRabbitHoleStage stage2 = new WorkInRabbitHoleStage(LocalizeString("WorkEndShiftStage", new object[0x0]), mFinishTime, maxDurationInHours, mCareer);
                        Stages = new List<Stage>(new Stage[] { stage2 });
                        ActiveStage = stage2;
                        if (Actor.TraitManager.HasElement(TraitNames.Workaholic))
                        {
                            foreach (CareerTone tone in mCareer.Tones)
                            {
                                if (tone is WorkHardTone)
                                {
                                    CurrentTone = tone;
                                    break;
                                }
                            }
                        }
                        else if (Actor.TraitManager.HasElement(TraitNames.Schmoozer))
                        {
                            foreach (CareerTone tone2 in mCareer.Tones)
                            {
                                if (tone2 is SuckUpToBossTone)
                                {
                                    CurrentTone = tone2;
                                    break;
                                }
                            }
                        }
                    }
                }
                catch (ResetException)
                {
                    throw;
                }
                catch (Exception e)
                {
                    Common.Exception(Actor, Target, e);
                }
            }
Ejemplo n.º 4
0
        public override void ConfigureInteraction()
        {
            TimeOfDayStage stage = new TimeOfDayStage(GetInteractionName(), Target.ComputerTuning.HackEndHour, Target.ComputerTuning.HackTotalHoursAvailable);

            Stages = new List <Stage>(new Stage[] { stage });
        }
Ejemplo n.º 5
0
        public static void PostDetentionLoop(GoToSchoolInRabbitHole ths, bool succeeded, bool detention, bool fieldTrip, AfterschoolActivity activity, bool hasAfterschoolActivity, ref InteractionInstance.InsideLoopFunction afterSchoolLoop)
        {
            try
            {
                School school = ths.Actor.School;

                ISchoolRabbitHole target = GetTarget(ths);

                bool flag5 = false;
                bool flag6 = false;
                if (!fieldTrip && !detention)
                {
                    if (hasAfterschoolActivity)
                    {
                        flag5 = true;
                    }
                    else if (!ths.Actor.IsInActiveHousehold && target.HasAfterschoolActivityToday)
                    {
                        flag5 = RandomUtil.CoinFlip();
                        flag6 = true;
                    }
                }

                if (!flag5)
                {
                    school.FinishWorking();

                    ths.EndCommodityUpdates(succeeded);
                    return;
                }

                CommodityChange fun = new CommodityChange(CommodityKind.Fun, 50, false, 25, OutputUpdateType.ContinuousFlow, false, false, UpdateAboveAndBelowZeroType.Either);

                ths.BeginCommodityUpdate(fun, 1);

                ths.mParticipatedInAfterschoolActivity = true;
                string str  = flag6 ? AfterschoolActivityType.ArtClub.ToString() : activity.CurrentActivityType.ToString();
                float  num3 = (school.DayLength + Career.kNumHoursEarlyCanShowUpForWork) + AfterschoolActivity.kAfterschoolActivityLength;

                string name = null;
                if (Localization.HasLocalizationString("Gameplay/Careers/AfterschoolActivity:" + str))
                {
                    name = Common.LocalizeEAString(ths.Actor.IsFemale, "Gameplay/Careers/AfterschoolActivity:" + str);
                }
                else
                {
                    name = Common.LocalizeEAString(ths.Actor.IsFemale, "Gameplay/Abstracts/Careers/AfterschoolActivity:" + str);
                }

                TimeOfDayStage stage2 = new TimeOfDayStage(name, school.CurLevel.FinishTime() + AfterschoolActivity.kAfterschoolActivityLength, num3);
                ths.Stages      = new List <Stage>(new Stage[] { stage2 });
                ths.ActiveStage = stage2;
                ths.SetAvailableTones(null);
                ths.Actor.RemoveExitReason(ExitReason.StageComplete);

                if (!flag6)
                {
                    activity.StartSkillGainForActivity(ths.Actor);

                    activity.StartAmbientSounds(ths.Actor, ths.Target);

                    if (!sCareerPerformAfterschoolPreLoop.Invoke <bool>(new object[] { ths, activity }))
                    {
                        if (activity.CurrentActivityType == AfterschoolActivityType.StudyClub)
                        {
                            school.AddHomeworkToStudent(false);
                            ths.mHomework = school.OwnersHomework;
                            if (ths.mHomework != null)
                            {
                                school.DidHomeworkInStudyClubToday = true;
                                ths.mHomework.PercentComplete      = 0f;
                                ths.mHomeworkCompletionRate        = ths.mHomework.GetCompletionRate(ths.Actor, false, true);
                            }
                        }
                    }

                    ths.mLastLTRUpdateDateAndTime = SimClock.CurrentTime();

                    afterSchoolLoop = sCareerPerformAfterschoolLoop.Invoke <InteractionInstance.InsideLoopFunction>(new object[] { ths, activity });
                    if (afterSchoolLoop == null)
                    {
                        afterSchoolLoop = ths.AfterschoolActivityLoopDelegate;
                    }
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(ths.Actor, ths.Target, e);
            }
        }
        public static void PostDetentionLoop(GoToSchoolInRabbitHole ths, bool succeeded, bool detention, bool fieldTrip, AfterschoolActivity activity, bool hasAfterschoolActivity, ref InteractionInstance.InsideLoopFunction afterSchoolLoop)
        {
            try
            {
                School school = ths.Actor.School;

                ISchoolRabbitHole target = GetTarget(ths);

                bool flag5 = false;
                bool flag6 = false;
                if (!fieldTrip && !detention)
                {
                    if (hasAfterschoolActivity)
                    {
                        flag5 = true;
                    }
                    else if (!ths.Actor.IsInActiveHousehold && target.HasAfterschoolActivityToday)
                    {
                        flag5 = RandomUtil.CoinFlip();
                        flag6 = true;
                    }
                }

                if (!flag5)
                {
                    school.FinishWorking();

                    ths.EndCommodityUpdates(succeeded);
                    return;
                }

                CommodityChange fun = new CommodityChange(CommodityKind.Fun, 50, false, 25, OutputUpdateType.ContinuousFlow, false, false, UpdateAboveAndBelowZeroType.Either);

                ths.BeginCommodityUpdate(fun, 1);

                ths.mParticipatedInAfterschoolActivity = true;
                string str = flag6 ? AfterschoolActivityType.ArtClub.ToString() : activity.CurrentActivityType.ToString();
                float num3 = (school.DayLength + Career.kNumHoursEarlyCanShowUpForWork) + AfterschoolActivity.kAfterschoolActivityLength;

                string name = null;
                if (Localization.HasLocalizationString("Gameplay/Careers/AfterschoolActivity:" + str))
                {
                    name = Common.LocalizeEAString(ths.Actor.IsFemale, "Gameplay/Careers/AfterschoolActivity:" + str);
                }
                else
                {
                    name = Common.LocalizeEAString(ths.Actor.IsFemale, "Gameplay/Abstracts/Careers/AfterschoolActivity:" + str);
                }

                TimeOfDayStage stage2 = new TimeOfDayStage(name, school.CurLevel.FinishTime() + AfterschoolActivity.kAfterschoolActivityLength, num3);
                ths.Stages = new List<Stage>(new Stage[] { stage2 });
                ths.ActiveStage = stage2;
                ths.SetAvailableTones(null);
                ths.Actor.RemoveExitReason(ExitReason.StageComplete);

                if (!flag6)
                {
                    activity.StartSkillGainForActivity(ths.Actor);

                    activity.StartAmbientSounds(ths.Actor, ths.Target);

                    if (!sCareerPerformAfterschoolPreLoop.Invoke<bool>(new object[] { ths, activity }))
                    {
                        if (activity.CurrentActivityType == AfterschoolActivityType.StudyClub)
                        {
                            school.AddHomeworkToStudent(false);
                            ths.mHomework = school.OwnersHomework;
                            if (ths.mHomework != null)
                            {
                                school.DidHomeworkInStudyClubToday = true;
                                ths.mHomework.PercentComplete = 0f;
                                ths.mHomeworkCompletionRate = ths.mHomework.GetCompletionRate(ths.Actor, false, true);
                            }
                        }
                    }

                    ths.mLastLTRUpdateDateAndTime = SimClock.CurrentTime();

                    afterSchoolLoop = sCareerPerformAfterschoolLoop.Invoke<InteractionInstance.InsideLoopFunction>(new object[] { ths, activity });
                    if (afterSchoolLoop == null)
                    {
                        afterSchoolLoop = ths.AfterschoolActivityLoopDelegate;
                    }
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(ths.Actor, ths.Target, e);
            }
        }
        public static void PostInRabbitHoleLoop(GoToSchoolInRabbitHole ths, ref bool succeeded, ref bool detention, ref bool fieldTrip, ref AfterschoolActivity activity, ref bool hasAfterschoolActivity)
        {
            try
            {
                School school = ths.Actor.School;

                ISchoolRabbitHole target = GetTarget(ths);

                activity = ths.GetAfterschoolActivity(ths.Actor, school, target, ref hasAfterschoolActivity);

                fieldTrip = FieldTripSituation.GetFieldTripSituation(ths.Actor) != null;
                detention = school.CurentDetentionStatus == School.DetentionStatus.HasDetention;

                if (detention && !fieldTrip)
                {
                    school.CurentDetentionStatus = School.DetentionStatus.InDetention;
                    float maxDurationInHours = (school.DayLength + Career.kNumHoursEarlyCanShowUpForWork) + school.SchoolTuning.DetentionLengthInHours;
                    TimeOfDayStage stage = new TimeOfDayStage(Localization.LocalizeString(ths.Actor.IsFemale, "Gameplay/Careers/WorkInRabbitHole:SchoolDetention", new object[0x0]), school.CurLevel.FinishTime() + school.SchoolTuning.DetentionLengthInHours, maxDurationInHours);
                    ths.Stages = new List<Stage>(new Stage[] { stage });
                    ths.ActiveStage = stage;
                    school.SetTones(ths);
                    ths.Actor.RemoveExitReason(ExitReason.StageComplete);
                    ths.Actor.BuffManager.AddElement(BuffNames.Detention, Origin.FromSchool);
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(ths.Actor, ths.Target, e);
            }
        }