Exemple #1
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("CleanupGigs");

            foreach (SimDescription sim in Household.EverySimDescription())
            {
                PerformanceCareer career = sim.OccupationAsPerformanceCareer;
                if (career == null)
                {
                    continue;
                }

                if (career.mSteadyGigs == null)
                {
                    career.mSteadyGigs = new List <SteadyGig>();

                    Overwatch.Log(" Missing GigList Added: " + sim.FullName);
                }

                for (int i = career.mSteadyGigs.Count - 1; i >= 0; i--)
                {
                    SteadyGig gig = career.mSteadyGigs[i];
                    if (gig == null)
                    {
                        career.mSteadyGigs.RemoveAt(i);

                        Overwatch.Log(" Null Gig removed: " + sim.FullName);
                    }
                    else if (gig.Venue == null)
                    {
                        career.mSteadyGigs.RemoveAt(i);

                        Overwatch.Log(" No Venue Gig removed: " + sim.FullName);
                    }
                    else if (MiniSimDescription.Find(gig.ProprietorId) == null)
                    {
                        career.mSteadyGigs.RemoveAt(i);

                        Overwatch.Log(" No Proprietor Gig removed: " + sim.FullName);
                    }
                }
            }
        }
Exemple #2
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);
            }
        }