Exemplo n.º 1
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (Guests.Count < TargetMinimum)
            {
                IncStat("Too Few");
                return(false);
            }

            AddStat("Guests", Guests.Count);

            if (Household.ActiveHousehold != null)
            {
                foreach (SimDescription active in HouseholdsEx.Humans(Household.ActiveHousehold))
                {
                    Target = active;
                    if (!TargetAllow(active))
                    {
                        continue;
                    }

                    if (mGuests.Contains(active))
                    {
                        continue;
                    }

                    if (ManagerFriendship.AreFriends(Sim, active))
                    {
                        mGuests.Add(active);
                    }
                }

                Target = null;
            }

            int delay = 3;

            if (Lot == Sim.LotHome)
            {
                Situations.PushGoHome(this, Sim);

                PushBuffetInteractions(this, Sim, Lot);

                DateAndTime startTime = SimClock.CurrentTime();
                startTime.Ticks += SimClock.ConvertToTicks(3f, TimeUnit.Hours);

                /*
                 * if (Lot != Sim.LotHome)
                 * {
                 *  DateAndTime rentTime = startTime;
                 *  rentTime.Ticks -= SimClock.ConvertToTicks(Sims3.Gameplay.Situations.Party.HoursToStartRentBeforePartyStart, TimeUnit.Hours);
                 *  if (rentTime.CompareTo(SimClock.CurrentTime()) < 0)
                 *  {
                 *      rentTime = SimClock.Add(SimClock.CurrentTime(), TimeUnit.Minutes, 2f);
                 *  }
                 *
                 *  if (!RentScheduler.Instance.RentLot(Lot, Sim.CreatedSim, rentTime, Guests))
                 *  {
                 *      IncStat("Couldn't Rent");
                 *      Lot = Sim.LotHome;
                 *  }
                 * }
                 */

                Party party = GetParty(Lot, Sim.CreatedSim, Guests, PartyAttire, startTime);

                EventTracker.SendEvent(new PartyEvent(EventTypeId.kThrewParty, Sim.CreatedSim, Sim, party));

                delay = 3;
            }
            else
            {
                List <Sim> followers = new List <Sim>();

                foreach (SimDescription guest in Guests)
                {
                    if (SimTypes.IsSelectable(guest))
                    {
                        continue;
                    }

                    if (!Sims.Instantiate(guest, Lot, false))
                    {
                        continue;
                    }

                    Sim guestSim = guest.CreatedSim;
                    if (guestSim == null)
                    {
                        continue;
                    }

                    guestSim.PushSwitchToOutfitInteraction(Sims3.Gameplay.Actors.Sim.ClothesChangeReason.GoingToSituation, PartyAttire);

                    followers.Add(guestSim);
                }

                AddStat("Followers", followers.Count);

                if (!Situations.PushMassVisit(this, Sim, followers, Lot))
                {
                    return(false);
                }

                delay = 0;
            }

            if (mReport)
            {
                Manager.AddAlarm(new DelayedStoryScenario(this, delay));
            }

            return(true);
        }