public int GetMaximumPoolSize(PetPoolType type) { switch (type) { case PetPoolType.NPCDeer: return(mMaximumDeer); case PetPoolType.NPCRaccoon: return(mMaximumRaccoon); case PetPoolType.StrayCat: return(mMaximumStrayCats); case PetPoolType.StrayDog: return(mMaximumStrayDogs); case PetPoolType.Unicorn: return(mMaximumUnicorns); case PetPoolType.WildHorse: return(mMaximumWildHorses); default: return(-1); } }
// Token: 0x06006FB8 RID: 28600 RVA: 0x0026CC7C File Offset: 0x0026BC7C private void CleanupAndDestroyDeadSim(bool forceCleanup) { if (this.mDeathEffect != null) { this.mDeathEffect.Stop(); this.mDeathEffect = null; } this.Target.ClearReferenceList(); if (this.mSituation.LastSimOfHousehold == null || this.mSituation.LastSimOfHousehold != this.Target || forceCleanup) { if (this.Target.Household == null || this.Target.Household.IsPetHousehold) { SimDescription simDescription = this.Target.SimDescription; PetPoolType petPoolType = PetPoolType.None; CASAgeGenderFlags species = simDescription.Species; if (species <= CASAgeGenderFlags.Cat) { if (species != CASAgeGenderFlags.Horse) { if (species == CASAgeGenderFlags.Cat) { petPoolType = PetPoolType.StrayCat; } } else if (simDescription.IsUnicorn) { petPoolType = PetPoolType.Unicorn; } else { petPoolType = PetPoolType.WildHorse; } } else if (species == CASAgeGenderFlags.Dog || species == CASAgeGenderFlags.LittleDog) { petPoolType = PetPoolType.StrayDog; } if (PetPoolManager.IsPetInPoolType(simDescription, petPoolType)) { PetPoolManager.RemovePet(petPoolType, simDescription); } } this.mGrave.GhostCleanup(this.Target, true); if (this.Target.Autonomy != null) { this.Target.Autonomy.DecrementAutonomyDisabled(); } this.Target.SimDescription.ShowSocialsOnSim = true; if (!this.mWasMemberOfActiveHousehold && Household.ActiveHousehold != null && this.Actor.LotCurrent != Household.ActiveHousehold.LotHome) { this.mGrave.FadeOut(false, 5f, new AlarmTimerCallback(this.HandleNPCGrave)); } this.Target.Destroy(); } }
public static void Perform() { Dictionary <ulong, bool> taxiDrivers = new Dictionary <ulong, bool>(); List <ulong> paps = new List <ulong>(); if ((CarNpcManager.Singleton != null) && (CarNpcManager.Singleton.NpcDriversManager != null)) { for (int i = 0; i < CarNpcManager.Singleton.NpcDriversManager.mDescPools.Length; i++) { Stack <SimDescription> stack = CarNpcManager.Singleton.NpcDriversManager.mDescPools[i]; if (stack == null) { continue; } NpcDriversManager.NpcDrivers type = (NpcDriversManager.NpcDrivers)(i + 0x95d01441); while (stack.Count > 10) { SimDescription sim = stack.Pop(); try { AttemptServiceDisposal(sim, false, "Too Many " + type); } catch (Exception e) { Common.Exception(sim, e); } } foreach (SimDescription sim in stack) { if (taxiDrivers.ContainsKey(sim.SimDescriptionId)) { continue; } taxiDrivers.Add(sim.SimDescriptionId, true); } } } Dictionary <ulong, bool> statueSims = new Dictionary <ulong, bool>(); CauseEffectService instance = CauseEffectService.GetInstance(); if (instance != null) { statueSims[instance.GetTimeTravelerSimID()] = true; List <ITimeStatueUiData> timeStatueData = instance.GetTimeAlmanacTimeStatueData(); if (timeStatueData != null) { foreach (ITimeStatueUiData data in timeStatueData) { TimeStatueRecordData record = data as TimeStatueRecordData; if (record == null) { continue; } statueSims[record.mRecordHolderId] = true; } } } foreach (SimDescription sim in new List <SimDescription> (Households.All(Household.NpcHousehold))) { try { if (SimTypes.IsDead(sim)) { continue; } if (taxiDrivers.ContainsKey(sim.SimDescriptionId)) { continue; } CommonCorrections(sim); if (SimTypes.InServicePool(sim, ServiceType.GrimReaper)) { continue; } if (statueSims.ContainsKey(sim.SimDescriptionId)) { continue; } uint spanLevel = 0; OptionsModel.GetOptionSetting("AgingInterval", out spanLevel); float averageElderAge = AgingManager.Singleton.GetAverageSimLifespanInDays((int)spanLevel); ServiceType type = ServiceType.None; if (sim.CreatedByService != null) { type = sim.CreatedByService.ServiceType; } if (AgingManager.Singleton.GetCurrentAgeInDays(sim) > averageElderAge) { if (sim.LotHome == null) { bool isRole = sim.AssignedRole != null; AttemptServiceDisposal(sim, true, "Too Old " + (!isRole ? type.ToString() : sim.AssignedRole.Type.ToString())); } } if (sim.AssignedRole != null && sim.AssignedRole is RolePaparazzi) { paps.Add(sim.SimDescriptionId); } if (sim.AssignedRole != null) { continue; } if (SimTypes.IsOccult(sim, OccultTypes.ImaginaryFriend)) { bool found = false; foreach (ImaginaryDoll doll in Sims3.Gameplay.Queries.GetObjects <ImaginaryDoll>()) { if (sim.SimDescriptionId == doll.mLiveStateSimDescId) { found = true; break; } } if (found) { continue; } AttemptServiceDisposal(sim, false, "Imaginary"); } else if (SimTypes.IsOccult(sim, OccultTypes.Genie)) { bool found = false; foreach (GenieLamp lamp in Sims3.Gameplay.Queries.GetObjects <GenieLamp>()) { if (sim == lamp.mGenieDescription) { found = true; break; } } if (found) { continue; } AttemptServiceDisposal(sim, false, "Genie"); } else if (sim.IsBonehilda) { bool found = false; foreach (BonehildaCoffin coffin in Sims3.Gameplay.Queries.GetObjects <BonehildaCoffin>()) { if (sim == coffin.mBonehilda) { found = true; break; } } if (found) { continue; } AttemptServiceDisposal(sim, false, "BoneHilda"); } else if ((sim.AssignedRole == null) && (!SimTypes.InServicePool(sim))) { AttemptServiceDisposal(sim, false, "No Purpose"); } else if ((type != ServiceType.None) && (sim.Age & ServiceNPCSpecifications.GetAppropriateAges(type.ToString())) == CASAgeGenderFlags.None) { AttemptServiceDisposal(sim, false, "Wrong Age " + type); } else if (!ServiceNPCSpecifications.ShouldUseServobot(type.ToString()) && sim.IsEP11Bot) { AttemptServiceDisposal(sim, false, "Not EP11 Bot " + type); } } catch (Exception e) { Common.Exception(sim, e); } } // kill extra paps if (paps.Count > Register.Settings.mMaximumPaparazzi) { int count = paps.Count; while (count > Register.Settings.mMaximumPaparazzi && count > 0) { SimDescription sim = SimDescription.Find(paps[0]); if (sim != null) { AttemptServiceDisposal(sim, false, "Too many Paparazzi"); } paps.Remove(paps[0]); count = count - 1; } } foreach (SimDescription sim in new List <SimDescription> (Households.All(Household.PetHousehold))) { try { if (SimTypes.IsDead(sim)) { continue; } CommonCorrections(sim); if ((sim.IsDeer) || (sim.IsRaccoon)) { if (sim.AssignedRole == null) { AttemptServiceDisposal(sim, false, "Roleless"); } else if (sim.Elder) { AttemptServiceDisposal(sim, true, "Elder"); } } else { bool noPool; PetPoolType pool = SimTypes.GetPetPool(sim, out noPool); if ((!noPool) && (pool == PetPoolType.None)) { AttemptServiceDisposal(sim, false, "Not Pooled"); } } } catch (Exception e) { Common.Exception(sim, e); } } }
protected override bool PrivateUpdate(ScenarioFrame frame) { if (mNewSim != null) { return(base.PrivateUpdate(frame)); } if (GetValue <PetAdoptionScenario.UsePetPoolOption, bool>()) { PetPoolType poolType = PetPoolType.None; switch (Species) { case CASAgeGenderFlags.Dog: case CASAgeGenderFlags.LittleDog: poolType = PetPoolType.AdoptDog; break; case CASAgeGenderFlags.Cat: poolType = PetPoolType.AdoptCat; break; case CASAgeGenderFlags.Horse: poolType = PetPoolType.AdoptHorse; break; } List <SimDescription> choices = PetPoolManager.GetPetsByType(poolType); if ((choices != null) && (choices.Count > 0)) { CASAgeGenderFlags ages = Ages; for (int i = choices.Count - 1; i >= 0; i--) { if ((ages & choices[i].Age) != choices[i].Age) { choices.RemoveAt(i); } else if (choices[i].Species != Species) { choices.RemoveAt(i); } } if (choices.Count == 0) { IncStat("No Matching In Pool"); } else { mNewSim = RandomUtil.GetRandomObjectFromList(choices); PetPoolManager.RemovePet(poolType, mNewSim, true); } return(base.PrivateUpdate(frame)); } else { IncStat("Pool Empty: " + poolType); } } if (Manager.GetValue <ScheduledImmigrationScenario.GaugeOption, int>() > 0) { return(base.PrivateUpdate(frame)); } else { IncStat("Immigration Disabled"); return(false); } }
public int GetMaximumPoolSize(PetPoolType type) { switch (type) { case PetPoolType.NPCDeer: return mMaximumDeer; case PetPoolType.NPCRaccoon: return mMaximumRaccoon; case PetPoolType.StrayCat: return mMaximumStrayCats; case PetPoolType.StrayDog: return mMaximumStrayDogs; case PetPoolType.Unicorn: return mMaximumUnicorns; case PetPoolType.WildHorse: return mMaximumWildHorses; default: return -1; } }
protected static string GetJob(SimDescription me) { bool bSeparator = true; string msg = null; try { if (me.AssignedRole != null) { msg += Common.Localize("Status:Role", me.IsFemale, new object[] { Roles.GetLocalizedName(me.AssignedRole) }); DateAndTime start = DateAndTime.Invalid; DateAndTime end = DateAndTime.Invalid; if (Roles.GetRoleHours(me, ref start, ref end)) { msg += Common.Localize("Status:CareerHours", me.IsFemale, new object[] { start.ToString(), end.ToString() }); } } if (SimTypes.InServicePool(me)) { msg += Common.Localize("Status:TypeService", me.IsFemale, new object[] { Common.LocalizeEAString("Ui/Caption/Services/Service:" + me.CreatedByService.ServiceType.ToString()) }); } NpcDriversManager.NpcDrivers driverType; if (SimTypes.InCarPool(me, out driverType)) { msg += Common.Localize("Status:TypeService", me.IsFemale, new object[] { Common.Localize("CarpoolType:" + driverType.ToString()) }); } PetPoolType pool = SimTypes.GetPetPool(me); if (pool != PetPoolType.None) { msg += Common.NewLine + Common.Localize("Status:PetPool", me.IsFemale, new object[] { Common.Localize("PetPool:" + pool) }); } if (me.Occupation != null) { msg += Common.Localize("Status:Career", me.IsFemale, new object[] { me.Occupation.CareerName }); bSeparator = false; msg += Common.Localize("Status:CareerLevel", me.IsFemale, new object[] { me.Occupation.CurLevelJobTitle, me.Occupation.CareerLevel }); int payPerHourBase = 0; int payPerHourExtra = 0; Sims3.Gameplay.Careers.Career career = me.Occupation as Sims3.Gameplay.Careers.Career; if (career != null) { if (career.CurLevel != null) { payPerHourBase = (int)career.CurLevel.PayPerHourBase; } payPerHourExtra = (int)(career.mPayPerHourExtra + career.mBonusPayFromDegreePerHour); } else { payPerHourBase = (int)me.Occupation.PayPerHourOrStipend; } msg += Common.Localize("Status:CareerExtra", me.IsFemale, new object[] { payPerHourBase, payPerHourExtra, me.Occupation.AverageTimeToReachWork }); string days = DaysToString(me.Occupation.DaysOfWeekToWork); msg += Common.Localize("Status:CareerDays", me.IsFemale, new object[] { days }); msg += Common.Localize("Status:CareerHours", me.IsFemale, new object[] { me.Occupation.StartTimeText, me.Occupation.FinishTimeText }); msg += Common.Localize("Status:CareerDaysOff", me.IsFemale, new object[] { me.Occupation.PaidDaysOff, me.Occupation.mUnpaidDaysOff }); float performance = StatusJobPerformance.GetPerformance(me); if (performance != 0f) { msg += Common.Localize("Status:Performance", me.IsFemale, new object[] { (int)performance }); } if (me.Occupation.Boss != null) { msg += Common.Localize("Status:Boss", me.IsFemale, new object[] { me.Occupation.Boss }); } if (me.Occupation.Coworkers != null) { msg += Common.Localize("Status:Coworkers", me.IsFemale, new object[] { me.Occupation.Coworkers.Count }); foreach (SimDescription sim in me.Occupation.Coworkers) { if (sim == null) { continue; } msg += Common.NewLine + sim.FullName; } } } else if (me.TeenOrAbove) { msg += Common.Localize("Status:Career", me.IsFemale, new object[] { Common.Localize("Status:Notemployed") }); bSeparator = false; } if (me.CareerManager != null) { if (me.CareerManager.RetiredCareer != null) { if (bSeparator) { msg += Common.NewLine; } msg += Common.Localize("Status:Retired", me.IsFemale, new object[] { me.CareerManager.RetiredCareer.CurLevelJobTitle }); msg += Common.Localize("Status:Pension", me.IsFemale, new object[] { me.CareerManager.RetiredCareer.PensionAmount() }); } } } catch (Exception e) { msg += "EXCEPTION"; Common.Exception(me, null, msg, e); } return(msg); }