Exemple #1
0
        public override bool Run()
        {
            try
            {
                Proprietor assignedRole = Actor.SimDescription.AssignedRole as Proprietor;
                if (assignedRole == null)
                {
                    return(false);
                }

                if (Actor.LotCurrent != Target.LotCurrent)
                {
                    Actor.RouteToLot(Target.LotCurrent.LotId);
                }

                if (!Target.SimFestRouteOffStageToEmceeIdleSpot(Actor))
                {
                    Actor.RouteToObjectRadius(Target, 5f);
                }

                if (Target.OwnerProprietor == null)
                {
                    Target.OwnerProprietor = Actor;
                }

                if (!Target.InSimFest && SimFestManager.IsSimFestScheduledTodayAtLot(Target.LotCurrent.LotId))
                {
                    Gig  scheduledGigForToday = Target.LotCurrent.GetScheduledGigForToday();
                    bool flag = false;
                    foreach (Sim sim in Household.ActiveHousehold.Sims)
                    {
                        if (sim.OccupationAsPerformanceCareer != null)
                        {
                            SteadyGig gig2 = sim.OccupationAsPerformanceCareer.TryToGetSteadyGigOwnedBySim(Actor);
                            if ((gig2 != null) && (gig2.Day == SimClock.CurrentDayOfWeek))
                            {
                                flag = true;
                            }
                        }
                    }

                    if (((scheduledGigForToday == null) || scheduledGigForToday.IsNPCGig) && !flag)
                    {
                        float startTime;
                        float endTime;
                        if (scheduledGigForToday != null)
                        {
                            Target.LotCurrent.UnscheduleGig(scheduledGigForToday);
                            if (scheduledGigForToday == scheduledGigForToday.Occupation.CurrentJob)
                            {
                                scheduledGigForToday.LeaveJob(Career.LeaveJobReason.kJobBecameInvalid);
                            }
                            scheduledGigForToday.Occupation.RemoveJob(scheduledGigForToday, true);
                        }

                        Target.GetRoleTimes(out startTime, out endTime);
                        if (assignedRole.IsThereEnoughTimeForASimFest(endTime))
                        {
                            assignedRole.InitSimFest(endTime);
                            Target.InSimFest = true;
                            Target.AddRoleGivingInteraction(Actor);
                            Target.InSimFest = true;

                            // Custom
                            RegisterSpace.Helpers.ShowStageEx.SetupSimFest(Target);
                        }
                    }
                }
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }