Exemple #1
0
            protected override bool Push()
            {
                SimDescription injured = Target;
                SimDescription killer  = Sim;

                if (mFail)
                {
                    killer = null;

                    if (mParentScenario.AllowGoToJail)
                    {
                        Manager.AddAlarm(new GoToJailScenario(Sim, Bail));

                        injured = null;
                    }
                    else
                    {
                        injured = Sim;
                    }
                }

                if ((mParentScenario.AllowInjury) && (injured != null) && (injured.CreatedSim != null) && (injured.CreatedSim.LotCurrent == mVictim.LotCurrent))
                {
                    if (!ManagerSim.HasTrait(injured, TraitNames.ImmuneToFire))
                    {
                        ManagerSim.AddBuff(Manager, injured, BuffNames.Singed, Origin.FromFire);

                        Manager.AddAlarm(new GoToHospitalScenario(injured, killer, "InjuredArson", SimDescription.DeathType.Burn));
                    }
                }

                return(true);
            }
Exemple #2
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            base.PrivateUpdate(frame);

            if (mPush)
            {
                Sim createdSim = Job.OwnerDescription.CreatedSim;
                if (createdSim != null)
                {
                    if ((SimTypes.IsSelectable(Job.OwnerDescription)) || (!NpcParty.IsHostAtNpcParty(createdSim)))
                    {
                        foreach (InteractionInstance instance in createdSim.InteractionQueue.InteractionList)
                        {
                            if (instance is ICountsAsWorking)
                            {
                                IncStat("Already Queued");
                                return(false);
                            }
                        }

                        VisitSituation.AnnounceTimeToGoToWork(createdSim);
                        createdSim.InteractionQueue.Add(CareerPushScenario.GetWorkInteraction(Job));
                    }
                }

                if (GetValue <AllowGoHomePushOption, bool>(Sim))
                {
                    Manager.AddAlarm(new GoHomePushScenario(Sim));
                }
            }
            return(true);
        }
Exemple #3
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            bool bWorkFound = false;

            foreach (InteractionInstance instance in Sim.CreatedSim.InteractionQueue.InteractionList)
            {
                if (instance is ICountsAsWorking)
                {
                    bWorkFound = true;
                }
                else if (bWorkFound)
                {
                    if (instance.GetPriority().Level != InteractionPriorityLevel.UserDirected)
                    {
                        continue;
                    }

                    IncStat("Denied: " + instance.GetType().Name);
                    return(false);
                }
            }

            if (Sim.CreatedSim.LotCurrent == Sim.LotHome)
            {
                Manager.AddAlarm(new GoHomePushScenario(Sim));
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemple #4
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Sim sim = Sim.CreatedSim;

            if (sim == null)
            {
                Sims.Instantiate(Sim, null, false);

                sim = Sim.CreatedSim;
            }

            if (sim == null)
            {
                IncStat("Hibernating");
                return(false);
            }

            Career job = Occupation as Career;

            Careers.VerifyTone(job);

            if (!ManagerCareer.ValidCareer(job))
            {
                IncStat("Career Invalidated");
                return(false);
            }

            InteractionInstance instance = GetWorkInteraction(job);

            if (instance == null)
            {
                IncStat("No Interaction");
                return(false);
            }
            else if (!Test(sim, instance.InteractionDefinition))
            {
                return(false);
            }
            else
            {
                if (sim.InteractionQueue.Add(instance))
                {
                    if (GetValue <AllowGoHomePushOption, bool>(Sim))
                    {
                        Manager.AddAlarm(new GoHomePushScenario(Sim));
                    }
                }
                else
                {
                    IncStat("Failure");
                }

                mReport = PostSlackerWarning();
                return(true);
            }
        }
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            int totalFunds = Perform(Sim.CreatedSim);

            if (totalFunds <= 0)
            {
                return(false);
            }

            Manager.AddAlarm(new PostScenario(Sim, totalFunds));
            return(true);
        }
        protected override bool Push()
        {
            if (mFail)
            {
                if (AllowGoToJail)
                {
                    Manager.AddAlarm(new GoToJailScenario(Sim, Bail));
                }
            }

            return(Situations.PushVisit(this, Sim, Target.LotHome));
        }
Exemple #7
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (mDeathType == SimDescription.DeathType.None)
            {
                mDeathType = ManagerDeath.GetRandomDeathType();
            }

            GettingOldScenario.AddDeathScenarios(this, frame);

            if (mKiller != null)
            {
                AddAssassinationKill(mKiller, Sim, false);
            }

            Manager.AddAlarm(new PostScenario(Sim, mDeathType, mStoryName));
            return(true);
        }
Exemple #8
0
 protected void ToggleAutoClean(int interval)
 {
     if (interval > 0)
     {
         if ((mAutoCleanAlarm == null) && (Manager != null))
         {
             mAutoCleanAlarm = Manager.AddAlarm(new AutoCleanScenario());
         }
     }
     else
     {
         if (mAutoCleanAlarm != null)
         {
             mAutoCleanAlarm.Dispose();
             mAutoCleanAlarm = null;
         }
     }
 }
Exemple #9
0
        protected override bool Push()
        {
            SimDescription injured = Target;
            SimDescription killer  = Sim;

            if (mFail)
            {
                killer = null;

                if (AllowGoToJail)
                {
                    Manager.AddAlarm(new GoToJailScenario(Sim, Bail));

                    injured = null;
                }
                else
                {
                    injured = Sim;
                }
            }

            if ((AllowInjury) && (injured != null) && (injured.CreatedSim != null) && (injured.CreatedSim.LotCurrent == mVictim.LotCurrent))
            {
                Handiness skill = injured.SkillManager.GetSkill <Handiness>(SkillNames.Handiness);
                if ((skill == null) || (RandomUtil.RandomChance01((skill.MaxSkillLevel - skill.SkillLevel) / (float)skill.MaxSkillLevel)))
                {
                    if ((mVictim is Bathtub) || (mVictim is Shower) || (mVictim is Toilet) || (mVictim is Sink))
                    {
                        ManagerSim.AddBuff(Manager, injured, BuffNames.Soaked, Origin.FromFailedRepair);

                        Manager.AddAlarm(new GoToHospitalScenario(injured, killer, mVictim, "InjuredDrown", SimDescription.DeathType.Drown));
                    }
                    else
                    {
                        ManagerSim.AddBuff(Manager, injured, BuffNames.SingedElectricity, Origin.FromFailedRepair);

                        Manager.AddAlarm(new GoToHospitalScenario(injured, killer, mVictim, "InjuredElectrocute", SimDescription.DeathType.Electrocution));
                    }
                }
            }

            return(Situations.PushVisit(this, Sim, Target.LotHome));
        }
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (!base.PrivateUpdate(frame))
            {
                return(false);
            }

            int delay = 1;

            if (IsHomeParty)
            {
                delay = 4;
            }

            foreach (SimDescription guest in Guests)
            {
                Manager.AddAlarm(new DelayedMoochScenario(Sim, guest, delay));
            }

            return(true);
        }
Exemple #11
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (OnInheritCashScenario != null)
            {
                OnInheritCashScenario(this, frame);
            }

            if (OnPropagateMournScenario != null)
            {
                OnPropagateMournScenario(this, frame);
            }

            if (OnFuneralScenario != null)
            {
                OnFuneralScenario(this, frame);
            }

            ManagerSim.ForceRecount();

            Manager.AddAlarm(new SimDisposedScenario(Sim));
            return(true);
        }
 protected override bool PrivateUpdate(ScenarioFrame frame)
 {
     Manager.AddAlarm(new WorkTwoHourCommuteScenario(Sim));
     return(true);
 }
Exemple #13
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            List <GameObject> burnables = new List <GameObject>();

            foreach (Lot lot in ManagerLot.GetOwnedLots(Target))
            {
                foreach (GameObject obj in lot.GetObjects <GameObject>())
                {
                    if (obj == null)
                    {
                        continue;
                    }

                    if (obj.GetFireType() == FireType.DoesNotBurn)
                    {
                        continue;
                    }

                    if (string.IsNullOrEmpty(obj.CatalogName))
                    {
                        continue;
                    }

                    if (obj is Sim)
                    {
                        continue;
                    }

                    if (obj is ICrib)
                    {
                        continue;
                    }

                    if (obj.InUse)
                    {
                        continue;
                    }

                    if (!obj.InWorld)
                    {
                        continue;
                    }

                    if (obj.LotCurrent == null)
                    {
                        continue;
                    }

                    LotLocation loc         = LotLocation.Invalid;
                    ulong       lotLocation = World.GetLotLocation(obj.PositionOnFloor, ref loc);
                    if (!World.HasSolidFloor(obj.LotCurrent.mLotId, loc))
                    {
                        continue;
                    }

                    burnables.Add(obj);
                }
            }

            if (burnables.Count == 0)
            {
                IncStat("No Burnables");
                return(false);
            }

            GameObject victim = RandomUtil.GetRandomObjectFromList(burnables);

            if (!Situations.PushVisit(this, Sim, Target.LotHome))
            {
                IncStat("Push Fail");
                return(false);
            }

            mFail = IsFail(Sim, Target);

            if (mFail)
            {
                int cost = (int)(victim.Value * 1.5);

                Money.AdjustFunds(Sim, "Damages", -cost);

                Money.AdjustFunds(Target, "Insurance", cost);
            }

            Manager.AddAlarm(new BurnScenario(Sim, Target, victim, this, mFail));
            return(true);
        }
Exemple #14
0
 protected override bool PrivateUpdate(ScenarioFrame frame)
 {
     return(Manager.AddAlarm(new SchoolTwoHourCommuteScenario(Sim)) != null);
 }
Exemple #15
0
 protected override void OnPerform()
 {
     Manager.AddAlarm(new SimDisposedScenario(mSim));
 }
 protected override void PrivateStartup()
 {
     mAlarm = Manager.AddAlarm(new TScenario(), false);
 }
Exemple #17
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Common.StringBuilder msg = new Common.StringBuilder("PrivateUpdate");

            try
            {
                bool fullList = !GetValue <CustomNamesOnlyOption <ManagerLot>, bool>();

                foreach (SimDescription baby in mBabies)
                {
                    msg += Common.NewLine + baby.FullName;

                    if (!SimTypes.IsSelectable(baby))
                    {
                        baby.FirstName = Sims.EnsureUniqueName(baby);
                    }

                    List <SimDescription> parents = Relationships.GetParents(baby);

                    parents.Remove(Sim);
                    if ((mDad == null) && (parents.Count > 0))
                    {
                        mDad = parents[0];
                    }

                    msg += Common.NewLine + "A";

                    List <OccultTypes> choices = OccultTypeHelper.CreateList(Sim.OccultManager.CurrentOccultTypes, true);

                    // Grandparent occult inheritance
                    foreach (SimDescription parent in Relationships.GetParents(Sim))
                    {
                        if (parent.OccultManager == null)
                        {
                            continue;
                        }

                        choices.AddRange(OccultTypeHelper.CreateList(parent.OccultManager.CurrentOccultTypes, true));
                    }

                    msg += Common.NewLine + "B";

                    if ((mDad != null) && (mDad.OccultManager != null))
                    {
                        choices.AddRange(OccultTypeHelper.CreateList(mDad.OccultManager.CurrentOccultTypes, true));

                        // Grandparent occult inheritance
                        foreach (SimDescription parent in Relationships.GetParents(mDad))
                        {
                            if (parent.OccultManager == null)
                            {
                                continue;
                            }

                            choices.AddRange(OccultTypeHelper.CreateList(parent.OccultManager.CurrentOccultTypes, true));
                        }
                    }

                    msg += Common.NewLine + "C";

                    Sims.ApplyOccultChance(this, baby, choices, GetValue <ChanceOfOccultBabyOptionV2, int>(), GetValue <MaximumNewbornOccultOption, int>());

                    msg += Common.NewLine + "D";

                    if ((SimTypes.IsServiceAlien(mDad)) || (SimTypes.IsServiceAlien(Sim)))
                    {
                        baby.SetAlienDNAPercentage(1f);
                    }
                    else
                    {
                        baby.SetAlienDNAPercentage(SimDescription.GetAlienDNAPercentage(mDad, Sim, true));
                    }
                }

                msg += Common.NewLine + "E";

                if (OnRenameNewbornsScenario != null)
                {
                    OnRenameNewbornsScenario(this, frame);
                }

                if (!SimTypes.IsSelectable(Sim))
                {
                    ManagerSim.IncrementLifetimeHappiness(Sim, Sims3.Gameplay.Rewards.LifeEventRewards.kLifetimeHappinessRewardForBaby);
                }

                SetElapsedTime <DayOfLastBabyOption>(Sim);

                msg += Common.NewLine + "F";

                if (mDad != null)
                {
                    if (!SimTypes.IsSelectable(mDad))
                    {
                        ManagerSim.IncrementLifetimeHappiness(mDad, Sims3.Gameplay.Rewards.LifeEventRewards.kLifetimeHappinessRewardForBaby);
                    }

                    SetElapsedTime <DayOfLastBabyOption>(mDad);
                }

                msg += Common.NewLine + "G";

                foreach (SimDescription baby in mBabies)
                {
                    Manager.AddAlarm(new NormalBabyAgingScenario(baby));
                }

                msg += Common.NewLine + "H";

                if (OnBirthScenario != null)
                {
                    OnBirthScenario(this, frame);
                }

                msg += Common.NewLine + "I";

                // Do this at the end once everything else has done its thing
                foreach (SimDescription baby in mBabies)
                {
                    msg += Common.NewLine + baby.FullName;

                    HouseholdOptions houseData = GetHouseOptions(baby.Household);
                    if (houseData != null)
                    {
                        int netWorth = houseData.GetValue <NetWorthOption, int>();

                        foreach (SimDescription parent in Relationships.GetParents(baby))
                        {
                            SimData parentData = GetData(parent);
                            if (parentData != null)
                            {
                                foreach (CasteOptions caste in parentData.Castes)
                                {
                                    if (!caste.GetValue <CasteInheritedOption, bool>())
                                    {
                                        continue;
                                    }

                                    if (!caste.Matches(baby, netWorth))
                                    {
                                        continue;
                                    }

                                    SimData babyData = GetData(baby);
                                    if (babyData != null)
                                    {
                                        babyData.AddValue <ManualCasteOption, CasteOptions>(caste);
                                    }
                                }
                            }
                        }
                    }
                }

                msg += Common.NewLine + "J";

                Add(frame, new SuccessScenario(), ScenarioResult.Start);
            }
            catch (Exception e)
            {
                Common.Exception(ToString() + Common.NewLine + msg.ToString(), e);
            }
            return(false);
        }
Exemple #18
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);
        }
            protected override bool PrivateUpdate(ScenarioFrame frame)
            {
                Career job = Job;

                if (Sim.CreatedSim == null)
                {
                    Sims.Instantiate(Sim, null, false);
                }

                if (Sim.CreatedSim == null)
                {
                    IncStat("Hibernating");
                    return(false);
                }

                if ((job.mCalledInSick) || (job.mIsFakeSickDay))
                {
                    IncStat("Sick Day");
                    return(false);
                }

                Careers.VerifyTone(job);

                bool selfCommute = false;

                if ((!GetValue <AllowCarpoolOption, bool>(Sim)) ||
                    (!CarpoolEnabled(job)) ||
                    (!job.CurLevel.HasCarpool) ||
                    (!SimTypes.IsSelectable(Sim)))
                {
                    if (!SimTypes.IsSelectable(Sim))
                    {
                        try
                        {
                            // Don't queue stomp on their birthday
                            if ((Sim.YearsSinceLastAgeTransition != 0) &&
                                (Sim.CreatedSim.InteractionQueue != null))
                            {
                                Sim.CreatedSim.InteractionQueue.CancelAllInteractions();
                            }
                        }
                        catch (Exception e)
                        {
                            Common.DebugException(Sim, e);
                        }
                    }

                    if (SimTypes.IsSelectable(Sim))
                    {
                        IncStat("Active Alarm");
                    }
                    else
                    {
                        IncStat("Inactive Alarm");
                    }

                    selfCommute = true;
                }
                else
                {
                    IncStat("Carpool");
                }

                if ((SimTypes.IsSelectable(Sim)) && (GetValue <ShowCarpoolMessageOption, bool>()) && job.mHoursUntilWork <= 2)
                {
                    string msg = GetCarpoolMessage(selfCommute);
                    if (msg != null)
                    {
                        StyledNotification.Format format = new StyledNotification.Format(msg, ObjectGuid.InvalidObjectGuid, Sim.CreatedSim.ObjectId, StyledNotification.NotificationStyle.kGameMessagePositive);
                        StyledNotification.Show(format, job.CareerIconColored);
                    }
                }

                Manager.AddAlarm(GetCommuteScenario(selfCommute));

                return(selfCommute);
            }