protected override void PrivatePerform(StateMachineClient smc, InteractionInstance.LoopData loopData) { if (SimClock.ElapsedTime(TimeUnit.Minutes, mInteraction.mLastLTRUpdateDateAndTime) >= GoToSchoolInRabbitHole.kSimMinutesBetweenLTRUpdates) { if (RandomUtil.RandomChance(kExplorerClubCollectChance)) { IGameObject huntable = GetHuntable(); if (huntable != null) { if (Inventories.TryToMove(huntable, mInteraction.Actor)) { RockGemMetalBase rock = huntable as RockGemMetalBase; if (rock != null) { rock.RegisterCollected(mInteraction.Actor, false); } string msg = Common.Localize("AfterschoolFoundObject:Notice", mInteraction.Actor.IsFemale, new object[] { mInteraction.Actor, huntable.GetLocalizedName() }); mInteraction.Actor.ShowTNSIfSelectable(msg, StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, huntable.ObjectId); } else { huntable.Destroy(); } } } } mInteraction.AfterschoolActivityLoopDelegate(smc, loopData); }
public static bool SatisfiesCooldown(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback callback) { if (!isAutonomous) { return(true); } DateAndTime time; if (Woohooer.Settings.mLastWoohoo.TryGetValue(actor.SimDescription.SimDescriptionId, out time)) { if (SimClock.ElapsedTime(TimeUnit.Minutes, time, SimClock.CurrentTime()) < Woohooer.Settings.mWoohooCooldown[PersistedSettings.GetSpeciesIndex(actor)]) { callback = Common.DebugTooltip("Actor Cooldown"); return(false); } } if (Woohooer.Settings.mLastWoohoo.TryGetValue(target.SimDescription.SimDescriptionId, out time)) { if (SimClock.ElapsedTime(TimeUnit.Minutes, time, SimClock.CurrentTime()) < Woohooer.Settings.mWoohooCooldown[PersistedSettings.GetSpeciesIndex(target)]) { callback = Common.DebugTooltip("Target Cooldown"); return(false); } } return(true); }
public override void Init(HousePartySituation parent) { float howLongUntilPreparations = SimClock.ElapsedTime(TimeUnit.Hours, SimClock.CurrentTime(), Parent.StartTime) - parent.GetParams().PreparationTime; float time = HowLongUntilDeliveringInvitations(howLongUntilPreparations); mAlarmHandle = AlarmManager.AddAlarm(time, TimeUnit.Hours, TimeToDeliverInvitations, "Deliver Invitations", AlarmType.AlwaysPersisted, Parent.Host); }
public override void Init(HousePartySituation parent) { if (parent.Host.IsSelectable) { string titleText = Common.LocalizeEAString(parent.Host.SimDescription.IsFemale, "Gameplay/Situations/HouseParty:GoPrepare", new object[] { parent.Host.SimDescription }); if (parent.Lot != parent.Host.LotHome) { titleText = titleText + Common.NewLine + Common.NewLine + Common.LocalizeEAString(false, "Gameplay/Situations/HouseParty:Venue", new object[] { parent.Lot.Name }); } StyledNotification.Show(new StyledNotification.Format(titleText, ObjectGuid.InvalidObjectGuid, parent.Host.ObjectId, StyledNotification.NotificationStyle.kGameMessagePositive), "w_party"); } if (!parent.Host.IsSelectable && (parent.Host.LotCurrent != parent.Lot)) { ForceSituationSpecificInteraction(parent.Lot, parent.Host, GoToLot.Singleton, null, null, null); } parent.Host.Motives.CreateMotive(parent.PreparationMotive()); parent.OnPreparation(); float time = SimClock.ElapsedTime(TimeUnit.Hours, SimClock.CurrentTime(), Parent.StartTime); float num2 = time - parent.GetParams().HoursBeforePartyToInvite; if (num2 <= 0f) { TimeToInviteGuests(); } else { mAlarmGuestInvite = AlarmManager.AddAlarm(num2, TimeUnit.Hours, TimeToInviteGuests, "Invite Guests To Party", AlarmType.AlwaysPersisted, Parent.Host); } mAlarmHandle = AlarmManager.AddAlarm(time, TimeUnit.Hours, TimeToStart, "Waiting for Party to start", AlarmType.AlwaysPersisted, Parent.Host); }
public override void FinishWorking() { try { if (mOther.mPaySims) { float dayLength = SimClock.ElapsedTime(TimeUnit.Hours, mTimeStartedWork); mTimeStartedWork.Ticks = 0x0L; if (dayLength >= 24f) { dayLength = DayLength; } int amount = (int)(PayPerHourOrStipend * dayLength); PayOwnerSim(amount, GotPaidEvent.PayType.kCareerNormalPay); } base.FinishWorking(); } catch (Exception e) { Common.Exception(OwnerDescription, e); } }
protected override void PrivatePerform(StateMachineClient smc, InteractionInstance.LoopData loopData) { if (SimClock.ElapsedTime(TimeUnit.Minutes, mInteraction.mLastLTRUpdateDateAndTime) >= GoToSchoolInRabbitHole.kSimMinutesBetweenLTRUpdates) { if (RandomUtil.RandomChance(kBugClubCollectChance)) { List <InsectJig> insects = new List <InsectJig>(Sims3.Gameplay.Queries.GetObjects <InsectJig>()); if (insects.Count > 0) { InsectJig insect = RandomUtil.GetRandomObjectFromList(insects); Terrarium terrarium = InsectTerrarium.Create(insect, mInteraction.Actor); if (terrarium != null) { string msg = Common.Localize("AfterschoolFoundObject:Notice", mInteraction.Actor.IsFemale, new object[] { mInteraction.Actor, terrarium.GetLocalizedName() }); mInteraction.Actor.ShowTNSIfSelectable(msg, StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, terrarium.ObjectId); } } } } mInteraction.AfterschoolActivityLoopDelegate(smc, loopData); }
private void LoopCallback(StateMachineClient smc, InteractionInstance.LoopData ld) { if (!JapLowDinnerTable.CheckIfHasFood(this.mServingContainer)) { this.Actor.AddExitReason(ExitReason.Finished); return; } if (this.mServingContainer is ServingContainerSingle) { ServingContainerSingle servingContainerSingle = this.mServingContainer as ServingContainerSingle; servingContainerSingle.DecrementFoodUnits(); } else if (this.mServingContainer is Snack) { Snack snack = this.mServingContainer as Snack; snack.DecrementFoodUnits(); } this.Actor.Motives.ChangeValue(CommodityKind.Hunger, 10f); if (this.Actor.ShouldDoGroupTalk()) { this.Actor.DoGroupTalk(new Sim.GroupTalkDelegate(this.PauseSim), new Sim.GroupTalkDelegate(this.UnpauseSim), true); } if (SimClock.ElapsedTime(TimeUnit.Minutes) - this.mLastReactionTime > this.mEatingDuration) { this.Actor.AddExitReason(ExitReason.Finished); if (this.mServingContainer is ServingContainerGroup) { ServingContainerGroup servingContainerGroup = this.mServingContainer as ServingContainerGroup; servingContainerGroup.DecrementServings(); } } }
public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { try { if (a.FamilyFunds < CollegeOfBusiness.kCostOfBudgetClass) { return(false); } if (!SimClock.IsTimeBetweenTimes(CollegeOfBusiness.AttendBudgetClass.kStartAvailibilityTime, CollegeOfBusiness.AttendBudgetClass.kEndAvailibilityTime)) { return(false); } /* * if (!GameUtils.IsUniversityWorld()) * { * return false; * } */ float num = 0f; if (CollegeOfBusiness.AttendBudgetClass.sCooldownDict.TryGetValue(a.SimDescription.SimDescriptionId, out num)) { return((SimClock.ElapsedTime(TimeUnit.Hours) - num) > CollegeOfBusiness.AttendBudgetClass.kInteractionCooldown); } return(true); } catch (Exception e) { Common.Exception(a, target, e); return(false); } }
public override void BeginCareerTone(InteractionInstance interactionInstance) { try { foreach (SkillRate skill in mSkills) { Skill element = Career.OwnerDescription.SkillManager.AddElement(skill.mSkill); if (element != null) { Career.OwnerDescription.SkillManager.StartSkillGain(skill.mSkill, skill.mRate); } } foreach (MotiveRate motive in mMotives) { motive.mStored = interactionInstance.AddMotiveDelta(motive.mKind, motive.mRate); } foreach (MetricRate rate in mMetrics) { rate.mStartTime = SimClock.ElapsedTime(TimeUnit.Hours); } Career.PerformanceBonusPerHour += mPerformanceModifier; } catch (Exception e) { Common.Exception(Career.OwnerDescription, e); } }
protected override void PrivatePerform(StateMachineClient smc, InteractionInstance.LoopData loopData) { if (SimClock.ElapsedTime(TimeUnit.Minutes, mInteraction.mLastLTRUpdateDateAndTime) >= GoToSchoolInRabbitHole.kSimMinutesBetweenLTRUpdates) { if (RandomUtil.RandomChance(kGeologyClubCollectChance)) { List <RockGemMetalBase> rocks = new List <RockGemMetalBase>(Sims3.Gameplay.Queries.GetObjects <RockGemMetalBase>()); if (rocks.Count > 0) { RockGemMetalBase rock = RandomUtil.GetRandomObjectFromList(rocks); if (Inventories.TryToMove(rock, mInteraction.Actor)) { rock.RegisterCollected(mInteraction.Actor, false); rock.RemoveFromWorld(); string msg = Common.Localize("AfterschoolFoundObject:Notice", mInteraction.Actor.IsFemale, new object[] { mInteraction.Actor, rock.GetLocalizedName() }); mInteraction.Actor.ShowTNSIfSelectable(msg, StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, rock.ObjectId); } } } } mInteraction.AfterschoolActivityLoopDelegate(smc, loopData); }
public override void Init(ForeignVisitorsSituation parent) { try { if (parent.Host.IsSelectable) { StyledNotification.Show(new StyledNotification.Format(Localization.LocalizeString("Gameplay/Situations/InviteForeignVisitors:GoPrepare", new object[] { parent.Host }), StyledNotification.NotificationStyle.kGameMessagePositive)); } parent.Host.Motives.CreateMotive(parent.PreparationMotive()); parent.OnPreparation(); float time = SimClock.ElapsedTime(TimeUnit.Hours, SimClock.CurrentTime(), Parent.StartTime) - parent.GetParams().HoursBeforePartyToInvite; if (time <= 0f) { Parent.SetState(new TryInviteEx(Parent)); } else { mAlarmGuestInvite = AlarmManager.AddAlarm(time, TimeUnit.Hours, TimeToInviteGuestsEx, "Invite Guests To Foreign Visitors Situation", AlarmType.AlwaysPersisted, Parent.Host); AlarmManager.AlarmWillYield(mAlarmGuestInvite); } } catch (Exception e) { Common.Exception("PrepareEx:Init", e); } }
public override bool InRabbitHole() { try { LotManager.SetAutoGameSpeed(); bool succeeded = false; BeginCommodityUpdates(); // Custom if (IsAllowedToWork(mCareer) || mCareer.ShouldBeAtWork()) { DateAndTime previousDateAndTime = SimClock.CurrentTime(); float num2 = SimClock.HoursUntil(mCareer.CurLevel.FinishTime()) + mCareer.OvertimeHours; while (!Actor.WaitForExitReason(1f, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)) && !mCareer.IsSpecialWorkTime) { if (mCareer.IsRegularWorkTime()) { break; } } if (Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached))) { EndCommodityUpdates(false); return(false); } mCareer.StartWorking(); succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(LoopDelegate), null); mCareer.FinishWorking(); if (!succeeded) { EventTracker.SendEvent(EventTypeId.kWorkCanceled, Actor); } float num3 = SimClock.ElapsedTime(TimeUnit.Hours, previousDateAndTime); if ((num3 > num2) || (Math.Abs((float)(num3 - num2)) <= kStayLateThreshold)) { EventTracker.SendEvent(EventTypeId.kCareerOpportunity_StayedLate, Actor); } } EndCommodityUpdates(succeeded); ActiveTopic.AddToSim(Actor, "After Work"); return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
public static float GetInterestInBook(Sim actor, Book book) { if ((book is BookGeneral) || (book is BookWritten)) { float num = 0f; float num2 = 0f; if (book.Data == null) { return(num); } if (ReadBookData.HasSimStartedBook(actor, book.Data.ID, false)) { num += 10f; } DateAndTime previousDateAndTime = ReadBookData.WhenSimFinishedBook(actor, book.Data.ID); float num3 = SimClock.ElapsedTime(TimeUnit.Days, previousDateAndTime); if (num3 >= 1f) { num3 = 1f + Math.Min(num3, 4f); num += num3; } if (actor.SimDescription.TraitManager.HasAnyPreferredGenres) { string genreLocalizedString = null; if (book.Data is BookGeneralData) { genreLocalizedString = (book.Data as BookGeneralData).GenreLocalizedString; } else if (book.Data is BookWrittenData) { genreLocalizedString = (book.Data as BookWrittenData).GenreString; } if (actor.SimDescription.TraitManager.PrefersGenre(genreLocalizedString)) { num++; } } num2 = 0.5f + ((num * 6.25f) * 0.01f); if (actor.TraitManager.HasElement(TraitNames.NightOwlTrait) && actor.BuffManager.HasElement(BuffNames.PastBedTime)) { num2 += TraitTuning.NightOwlFunModifier; } return(num2); } else { return(0f); } }
public static bool CantBeDisgraced(CelebrityManager This) { if (This.Level >= 1) { if (This.mClearNameCooldown > 0f) { return(SimClock.ElapsedTime(TimeUnit.Minutes) - This.mClearNameCooldown < CelebrityManager.kCooldownAfterClearingName); } return(false); } return(true); }
// Methods public override void BeginCareerTone(InteractionInstance interactionInstance) { base.BeginCareerTone(interactionInstance); mTimeForStartOfTone = SimClock.ElapsedTime(TimeUnit.Hours); Education career = OmniCareer.Career <Education>(Career); if (career != null) { mLecturesHeldBeforeStartOfTone = career.LecturesGivenToday; } }
// Methods public override void BeginCareerTone(InteractionInstance interactionInstance) { base.BeginCareerTone(interactionInstance); mTimeForStartOfTone = SimClock.ElapsedTime(TimeUnit.Hours); Business career = OmniCareer.Career <Business> (Career); if (career != null) { mMeetingsHeldBeforeStartOfTone = career.MeetingsHeldToday; } }
public override bool Run() { //mPriority = new InteractionPriority(InteractionPriorityLevel.MaxDeath); //CancellableByPlayer = false; Target.BuffManager.RemoveElement(BuffEWGraveWound.buffName); Target.BuffManager.RemoveElement(BuffEWSeriousWound.buffName); Target.BuffManager.RemoveElement(BuffEWMinorWound.buffName); if (Loader.kAllowPetDeath) { StyledNotification.Show(new StyledNotification.Format(Localization.LocalizeString("Echoweaver/PetFighting/EWFightPet:PetFightDie", Target.Name), StyledNotification.NotificationStyle.kGameMessageNegative)); Target.Kill(Loader.fightDeathType); } else { if (!Target.IsSleeping) { EnterStateMachine("PetPassOut", "Enter", "x"); AnimateSim("PassOutLoop"); Target.SetIsSleeping(value: true); } StyledNotification.Show(new StyledNotification.Format(Localization.LocalizeString("Echoweaver/PetFighting/EWFightPet:PetFightRecuperate", Target.Name), StyledNotification.NotificationStyle.kGameMessageNegative)); // TODO: Needs an origin for succumb to wounds Target.BuffManager.AddElement(BuffEWRecuperateCat.StaticGuid, Origin.FromFight); Target.Motives.FreezeDecay(CommodityKind.Hunger, false); Target.Motives.FreezeDecay(CommodityKind.Energy, true); float passOutMinutes = 720f; ExitReason acceptedExitReasons = ~(ExitReason.Finished); float startTime = SimClock.ElapsedTime(TimeUnit.Minutes); while (!Target.WaitForExitReason(1f, acceptedExitReasons)) { float currentTime = SimClock.ElapsedTime(TimeUnit.Minutes); if (currentTime - startTime > passOutMinutes) { AnimateSim(kJazzStateSleep); break; } } Target.Motives.RestoreDecay(CommodityKind.Hunger); Target.Motives.RestoreDecay(CommodityKind.Energy); AnimateSim("Exit"); Target.SetIsSleeping(false); } return(true); }
private static void CalculateDateTimeOfHoliday(HolidayManager ths, ref Season season) { DateAndTime startTime = SimClock.Subtract(SimClock.CurrentTime(), TimeUnit.Hours, SimClock.CurrentTime().Hour); startTime = SimClock.Subtract(startTime, TimeUnit.Days, Tempest.GetCurrentSeasonDay() - 1); List <Pair <Season, uint> > days = new List <Pair <Season, uint> >(); HolidaySettings settings = Tempest.Settings.GetHolidays(season); Common.StringBuilder result = new Common.StringBuilder("Season: " + season); result += Common.NewLine + "CurrentTime: " + SimClock.CurrentTime(); result += Common.NewLine + "StartTime: " + startTime; result += Common.NewLine + "ExpectedEndTime: " + SeasonsManager.ExpectedEndTime; result += Common.NewLine + "GetCurrentSeasonDay: " + Tempest.GetCurrentSeasonDay(); result += Common.NewLine + SimClock.ElapsedTime(TimeUnit.Days, startTime); foreach (HolidaySettings.Holiday day in settings.Days) { uint actualDay = day.GetActualDay(season); if (actualDay == 0) { continue; } days.Add(new Pair <Season, uint>(day.mSeason, actualDay - 1)); } days.Sort(SortByDay); foreach (Pair <Season, uint> day in days) { ths.mStartDateTimeOfHoliday = SimClock.Add(startTime, TimeUnit.Days, day.Second); result += Common.NewLine + "Days: " + day.Second + " Time: " + ths.mStartDateTimeOfHoliday; if (ths.mStartDateTimeOfHoliday.Ticks < SimClock.CurrentTicks) { ths.mStartDateTimeOfHoliday = DateAndTime.Invalid; } else { result += Common.NewLine + " Success"; season = day.First; break; } } Common.DebugNotify(result); }
public static int GetCurrentSeasonDay() { if (!SeasonsManager.Enabled) { return(0); } DateAndTime currentTime = SimClock.Subtract(SimClock.CurrentTime(), TimeUnit.Hours, SimClock.CurrentTime().Hour); // Number of remaining days int num = ((int)SimClock.ElapsedTime(TimeUnit.Days, currentTime, SeasonsManager.ExpectedEndTime)); return((int)SeasonsManager.GetSeasonLength(SeasonsManager.CurrentSeason) - num); }
public ResortManagerCareerProtection(List <Sim> sims, float days) { mStore = new List <SafeStore>(); float num = SimClock.ElapsedTime(TimeUnit.Hours, SimClock.CurrentTime()); float num2 = days * 24f; mHours = num2 - num; foreach (Sim sim in sims) { mStore.Add(new SafeStore(sim.SimDescription, SafeStore.Flag.School)); } }
public override bool Run() { try { StandardEntry(); if (!Target.StartComputing(this, SurfaceHeight.Table, true)) { StandardExit(); return(false); } DateAndTime firstDate = SimClock.CurrentTime(); Target.StartVideo(Computer.VideoType.WordProcessor); StartStages(); BeginCommodityUpdates(); bool succeeded = false; try { AnimateSim("WorkTyping"); succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); } finally { EndCommodityUpdates(succeeded); } LawEnforcement job = OmniCareer.Career <LawEnforcement>(Actor.Occupation); float minutes = SimClock.ElapsedTime(TimeUnit.Minutes, firstDate, SimClock.CurrentTime()); job.UpdateTimeSpentOnForensicAnalysis(minutes); Target.StopComputing(this, Computer.StopComputingAction.TurnOff, false); if (job.IsForensicAnalysisComplete(Computer.RunForensicAnalysis.kTotalTimeToFinishAnalysis)) { job.ResetForensicAnalysisStatistics(); Actor.ModifyFunds(Computer.RunForensicAnalysis.kRewardOnFinishingAnalysis); Actor.ShowTNSIfSelectable(LocalizeString(Actor.SimDescription, "AnalysisComplete", new object[] { Actor, Computer.RunForensicAnalysis.kRewardOnFinishingAnalysis }), StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, Actor.ObjectId); } StandardExit(); return(true); } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
public static bool MoveToNewLot(FoodTruck ths) { /* * if ((ths.RoutingComponent != null) && ths.RoutingComponent.IsRouting) * { * return true; * } */ if (ths.ReferenceList.Count > 0x0) { return(false); } return(SimClock.ElapsedTime(TimeUnit.Hours, ths.mTimeAtCurrentLot) >= ths.FoodTruckTuning.HoursToStayOnLot); }
public override void OnTimePassed(InteractionInstance interactionInstance, float totalTime, float deltaTime) { base.OnTimePassed(interactionInstance, totalTime, deltaTime); Business career = OmniCareer.Career <Business>(Career); if (career != null) { float num = SimClock.ElapsedTime(TimeUnit.Hours) - mTimeForStartOfTone; if (((int)Math.Floor((double)(num / Business.kSimHoursToCallMeetingWothwhile))) > (career.MeetingsHeldToday - mMeetingsHeldBeforeStartOfTone)) { career.MeetingsHeldToday++; } } }
public static bool WasWithinTheDay(SimDescription sim) { ulong simId = sim.SimDescriptionId; DateAndTime lastTime; if (sLastPerformed.TryGetValue(simId, out lastTime)) { if (SimClock.ElapsedTime(TimeUnit.Hours, lastTime) <= 23) { return(true); } } return(false); }
public override void OnTimePassed(InteractionInstance interactionInstance, float totalTime, float deltaTime) { base.OnTimePassed(interactionInstance, totalTime, deltaTime); Education career = OmniCareer.Career <Education>(Career); if (career != null) { float num = SimClock.ElapsedTime(TimeUnit.Hours) - mTimeForStartOfTone; if (((int)Math.Floor((double)(num / Education.kSimHoursGiveLecturesWorthwhile))) > (career.LecturesGivenToday - mLecturesHeldBeforeStartOfTone)) { career.LecturesGivenToday++; if ((Career.OwnerDescription != null) && (Career.OwnerDescription.CreatedSim != null)) { EventTracker.SendEvent(EventTypeId.kGaveEducationLecture, Career.OwnerDescription.CreatedSim); } } } }
public override void Init(ForeignVisitorsSituation parent) { try { base.Init(parent); AlarmManager.RemoveAlarm(mAlarmHandle); float time = SimClock.ElapsedTime(TimeUnit.Hours, SimClock.CurrentTime(), Parent.StartTime) - parent.GetParams().PreparationTime; if (time <= 0) { Parent.SetState(new PrepareEx(Parent)); } else { mAlarmHandle = AlarmManager.AddAlarm(time, TimeUnit.Hours, TimeToPrepareEx, "Prepare Foreign Visit", AlarmType.AlwaysPersisted, Parent.Host); } } catch (Exception e) { Common.Exception("WaitForPreparationsEx:Init", e); } }
// Methods public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (!(a.Occupation is OmniCareer)) { return(false); } GreyedOutTooltipCallback callback = null; LawEnforcement job = OmniCareer.Career <LawEnforcement>(a.Occupation); if ((job != null) && job.CanRaidCriminalWarehouses) { Hideout hideout = target as Hideout; if (hideout != null) { DateAndTime time; if (!hideout.mSimToLastRaidTimestamp.TryGetValue(a, out time)) { return(true); } if (SimClock.ElapsedTime(TimeUnit.Hours, time, SimClock.CurrentTime()) >= Hideout.kMinimumDurationBetweenCriminalRaids) { return(true); } if (callback == null) { callback = delegate { return(Hideout.RaidCriminals.LocalizeString("CannotUseHideout", new object[] { a })); }; } greyedOutTooltipCallback = callback; return(false); } } return(false); }
public static bool ControlLoop(LoopingAnimationBase interaction) { try { float start = SimClock.ElapsedTime(TimeUnit.Seconds); while (((interaction.Paused) || (interaction.Timing > (SimClock.ElapsedTime(TimeUnit.Seconds) - start))) && (!interaction.TargetSim.HasExitReason())) { SpeedTrap.Sleep(); } interaction.Iterations--; return(interaction.Iterations > 0); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(interaction.TargetSim, interaction.TargetSim, e); return(false); } }
protected static Sim ShouldHaveMyLove(Sim sim) { if (sim.LotCurrent == null) { return(null); } if (sim.LotCurrent.IsWorldLot) { return(null); } if (Woohooer.Settings.mMyLoveBuffLevel == Options.Romance.MyLoveBuffLevel.Default) { return(null); } Sim found = null; foreach (Sim other in sim.LotCurrent.GetAllActors()) { if (other == sim) { continue; } if (other.RoomId != sim.RoomId) { continue; } Relationship relation = Relationship.Get(sim, other, false); if (relation == null) { continue; } if ((relation.AreRomantic()) && (relation.LTR.Liking > BuffMyLove.LikingValueForBuff)) { if ((relation.MarriedInGame) && (SimClock.ElapsedTime(TimeUnit.Days, relation.LTR.WhenStateStarted) < BuffMyLove.DaysSinceLTRChangeForBuff)) { return(null); } switch (Woohooer.Settings.mMyLoveBuffLevel) { case Options.Romance.MyLoveBuffLevel.Partner: if (sim.Partner != other.SimDescription) { continue; } break; case Options.Romance.MyLoveBuffLevel.Spouse: if (sim.Partner != other.SimDescription) { continue; } if (!sim.IsMarried) { continue; } break; } found = other; break; } } return(found); }
public static void Update(DreamsAndPromisesManager ths) { if (!ths.mFullUpdate) { PartialUpdate(ths); } else { ths.mFullUpdate = false; float num = SimClock.ElapsedTime(TimeUnit.Minutes); float simMinutesPassed = num - ths.mLastUpdateTime; ths.mLastUpdateTime = num; Dictionary <Event, List <DreamsAndPromisesManager.ScoredNode> > completedNodes = new Dictionary <Event, List <DreamsAndPromisesManager.ScoredNode> >(); List <ActiveNodeBase> timeoutList = new List <ActiveNodeBase>(); List <ActiveNodeBase> completedList = new List <ActiveNodeBase>(); foreach (ActiveNodeBase base2 in new List <ActiveNodeBase>(ths.mActiveNodes)) { if (DreamerTuning.kNoTimeOut) { ActiveDreamNode node = base2 as ActiveDreamNode; if (node != null) { node.mTimeActive = 0; } } try { switch (base2.Update(simMinutesPassed)) { case ActiveNodeBase.UpdateStatus.TimedOut: timeoutList.Add(base2); break; case ActiveNodeBase.UpdateStatus.Completed: { ActiveDreamNode node = base2 as ActiveDreamNode; if (((node != null) && (node.CompletionEvent != null)) && !completedNodes.ContainsKey(node.CompletionEvent)) { completedNodes.Add(node.CompletionEvent, new List <DreamsAndPromisesManager.ScoredNode>()); } completedList.Add(base2); break; } } } catch (Exception e) { Common.Exception(ths.Actor, e); ths.RemoveActiveNode(base2); } } ths.RetestVisibleNodes(timeoutList, completedList); foreach (ActiveNodeBase base3 in completedList) { List <DreamsAndPromisesManager.ScoredNode> list3; if ((base3.PromiseParent != null) && (base3.PromiseParent.WasPromisedAndBroken || base3.PromiseParent.IsComplete)) { continue; } ActiveDreamNode node2 = base3 as ActiveDreamNode; if (((node2 == null) || (node2.CompletionEvent == null)) || !completedNodes.TryGetValue(node2.CompletionEvent, out list3)) { list3 = new List <DreamsAndPromisesManager.ScoredNode>(); completedNodes.Add(new Event(EventTypeId.kEventNone), list3); } if (node2 != null) { ths.RemoveCompletedNode(node2); } try { list3.AddRange(ths.ScoreChildren(base3, completedNodes, false, base3.GetNonPromiseLinkChildren())); } catch (Exception e) { Common.DebugException(ths.Actor, e); } } bool flag = ths.SelectDreamsToDisplay(completedNodes); foreach (ActiveNodeBase base4 in timeoutList) { ths.RemoveActiveNode(base4); flag = true; } List <ActiveDreamNode> list4 = new List <ActiveDreamNode>(); foreach (ActiveDreamNode node3 in ths.mSleepingNodes) { if (node3.UpdateSleeping(simMinutesPassed)) { node3.Reset(true); ths.mActiveNodes.Add(node3); ths.AddToReferenceList(node3); list4.Add(node3); } } foreach (ActiveDreamNode node4 in list4) { ths.mSleepingNodes.Remove(node4); } foreach (ActiveNodeBase base5 in completedList) { ActiveDreamNode node5 = base5 as ActiveDreamNode; ActiveTimerNode node6 = base5 as ActiveTimerNode; bool flag2 = true; if (node5 != null) { if (!ActiveDreamNodeEx.OnCompletion(node5)) { flag2 = false; } else if ((node5.IsRepeatable) && (ths.IsNotSpecialCaseNode(node5.NodeInstance.PrimitiveId) && ((node5.DebugCompleteFlags & ActiveDreamNode.DebugCompleteReasons.kStartNode) == ActiveDreamNode.DebugCompleteReasons.kNone))) { if (node5.NodeInstance.TimeBetweenRepeats <= 0f) { ths.CancelDream(node5); node5.Reset(true); flag2 = false; } else { node5.Reset(false); ths.mSleepingNodes.Add(node5); } } } if ((node6 != null) && !node6.IsComplete) { flag2 = false; } if (flag2) { ths.RemoveActiveNode(base5); } } List <ActiveDreamNode> list5 = new List <ActiveDreamNode>(); foreach (ActiveDreamNode node7 in ths.mDreamNodes) { if (node7.TimeActive > node7.NodeInstance.DisplayTime) { list5.Add(node7); } } foreach (ActiveDreamNode node8 in list5) { if ((ths.mDisplayedDreamNodes.Remove(node8) && (ths == DreamsAndPromisesManager.ActiveDreamsAndPromisesManager)) && (DreamsAndPromisesModel.Singleton != null)) { DreamsAndPromisesModel.Singleton.FireRemoveDream(node8); } ths.mDreamNodes.Remove(node8); } if ((flag && (ths == DreamsAndPromisesManager.ActiveDreamsAndPromisesManager)) && (DreamsAndPromisesModel.Singleton != null)) { ths.RefreshDisplayedDreams(); } if (ths.mShouldRefreshOnUpdate) { ths.mShouldRefreshOnUpdate = false; try { ths.Refresh(); } catch (Exception e) { Common.Exception(ths.Actor, e); } } } }