public override void CleanUp() { base.CleanUp(); Parent.Cop.RemoveAlarm(mAlarmHandle); mAlarmHandle = AlarmHandle.kInvalidHandle; }
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); }
protected void StartHomeworkAlarm() { try { if ((OwnerDescription.TeenOrBelow) && (OwnerDescription.CareerManager.School is HomeSchooling)) { if (mHomeworkCheck != AlarmHandle.kInvalidHandle) { AlarmManager.Global.RemoveAlarm(mHomeworkCheck); mHomeworkCheck = AlarmHandle.kInvalidHandle; } float hoursPassedOfDay = SimClock.HoursPassedOfDay; float time = CurLevel.StartTime - hoursPassedOfDay; if (time < 0f) { time += 24f; } mHomeworkCheck = AlarmManager.Global.AddAlarm(time, TimeUnit.Hours, OnHomeworkCheck, "NRaasHomeworkCheck", AlarmType.NeverPersisted, OwnerDescription); } } catch (ResetException) { throw; } catch (Exception exception) { Common.Exception(OwnerDescription, exception); } }
private static void SetEvents() { messageAlarmHandle = AlarmManager.Global.AddAlarmRepeating(0.0f, TimeUnit.Seconds, new AlarmTimerCallback(ProcessMessages), 10.0f, TimeUnit.Seconds, "MessageReader", Sims3.Gameplay.Utilities.AlarmType.AlwaysPersisted, null); Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.QueueChanged += new Sims3.Gameplay.ActorSystems.InteractionQueue.QueueChangedCallback(QueueChanged); }
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); }
private static void AddAlarm() { if (Debugger.sWorldLoaded && Debugger.sReporterHandle == AlarmHandle.kInvalidHandle) { Debugger.sReporterHandle = AlarmManager.Global.AddAlarmRepeating(1f, TimeUnit.Minutes, new AlarmTimerCallback(Debugger.Report), 1f, TimeUnit.Minutes, "Debugger Reporter Alarm", AlarmType.NeverPersisted, null); } }
public override void Init(GoToLotSituation parent) { AlarmManager.RemoveAlarm(mAlarmHandle); mAlarmHandle = AlarmManager.AddAlarm(Sims3.Gameplay.Situations.InviteToLotSituation.kNumHoursForBothGoToLotToWaitBeforeGivingUp, TimeUnit.Hours, TimeOut, "Waiting for Sims to get to lot", AlarmType.NeverPersisted, Parent.mSimA); ForceSituationSpecificInteraction(parent.Lot, parent.mSimA, ManagerSituation.GetVisitInteraction(parent.mSimA, parent.Lot), null, OnRouteToLotSucceeded, OnRouteToLotFailed, InteractionPriorityLevel.UserDirected); ForceSituationSpecificInteraction(parent.Lot, parent.mSimB, ManagerSituation.GetVisitInteraction(parent.mSimB, parent.Lot), null, OnRouteToLotSucceeded, OnRouteToLotFailed, InteractionPriorityLevel.UserDirected); }
public override void Dispose(BuffManager bm) { if (mSymptomAlarm != AlarmHandle.kInvalidHandle) { bm.Actor.RemoveAlarm(mSymptomAlarm); mSymptomAlarm = AlarmHandle.kInvalidHandle; } }
private void SetupStipendAlarm() { if (OwnerDescription.Occupation == this) { AlarmManager.Global.RemoveAlarm(mStipendAlarm); mStipendAlarm = AlarmManager.Global.AddAlarmDay(23.9f, DaysOfTheWeek.All, StipendAlarmCallback, "Daily stipend.", AlarmType.NeverPersisted, OwnerDescription); } }
public override void Init(GoToLotSituation parent) { AlarmManager.RemoveAlarm(mAlarmHandle); mAlarmHandle = AlarmManager.AddAlarm(Sims3.Gameplay.Situations.InviteToLotSituation.kNumHoursForHangingOutToWaitBeforeExiting, TimeUnit.Hours, TimeOut, "Waiting for Sims to hang out before leaving", AlarmType.NeverPersisted, Parent.mSimA); parent.mSimA.SocialComponent.AddShortTermDesireToSocializeWith(parent.mSimB, Sims3.Gameplay.Situations.InviteToLotSituation.kDesireToSocialize); parent.mSimB.SocialComponent.AddShortTermDesireToSocializeWith(parent.mSimA, Sims3.Gameplay.Situations.InviteToLotSituation.kDesireToSocialize); }
private static void SetEvents() { messageAlarmHandle = AlarmManager.Global.AddAlarmRepeating(0.0f, TimeUnit.Seconds, new AlarmTimerCallback(ProcessMessages), 10.0f, TimeUnit.Seconds, "MessageReader", Sims3.Gameplay.Utilities.AlarmType.AlwaysPersisted, null); EventTracker.AddListener(EventTypeId.kCalledSim, new ProcessEventDelegate(OnCalledSims)); EventTracker.AddListener(EventTypeId.kAdoptedChild, new ProcessEventDelegate(OnAddoptChild)); }
private static void SetEvents() { messageAlarmHandle = AlarmManager.Global.AddAlarmRepeating(0.0f, TimeUnit.Seconds, new AlarmTimerCallback(ProcessMessages), 10.0f, TimeUnit.Seconds, "MessageReader", Sims3.Gameplay.Utilities.AlarmType.AlwaysPersisted, null); EventTracker.AddListener(EventTypeId.kAdoptedChild, new ProcessEventDelegate(OnAddoptChild)); Sims3.Gameplay.EventSystem.EventTracker.AddListener(EventTypeId.kWatchedTv, new ProcessEventDelegate(OnWatchedTv)); Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.QueueChanged += new Sims3.Gameplay.ActorSystems.InteractionQueue.QueueChangedCallback(QueueChanged); }
public void StartMapTagAlarm() { if (mRemoveMapTagsHandle != AlarmHandle.kInvalidHandle) { mSkillOwner.CreatedSim.RemoveAlarm(mRemoveMapTagsHandle); } mRemoveMapTagsHandle = mSkillOwner.CreatedSim.AddAlarm(CatHuntingComponent.kMinsUntilMaptagsFade, TimeUnit.Minutes, RemoveMapTagsAlarmCallback, "Remove cathunting map tags", AlarmType.AlwaysPersisted); }
public void SetAnotherAlarm(Business business) { Sim createdSim = business.SimConspiringPrank.CreatedSim; AlarmHandle sureShotEventAlarmHandle = business.CareerEventManager.SureShotEventAlarmHandle; createdSim.RemoveAlarm(sureShotEventAlarmHandle); float time = (float)Math.Max(0.0, (double)Math.Min(Business.kTimeToWaitForNextPrankAttempt, this.GetTimeUntilEvent(business))); business.CareerEventManager.SureShotEventAlarmHandle = createdSim.AddAlarm(time, TimeUnit.Hours, new AlarmTimerCallback(business.CareerEventManager.SureShotEventDelegate), "SureShotCareerEventAlarmTwo", AlarmType.AlwaysPersisted); }
public override void OnDispose() { if (mHomeworkCheck != AlarmHandle.kInvalidHandle) { AlarmManager.Global.RemoveAlarm(mHomeworkCheck); mHomeworkCheck = AlarmHandle.kInvalidHandle; } base.OnDispose(); }
public void OnWorldLoadFinished() { foreach (ISprinkler sprinkler in Sims3.Gameplay.Queries.GetObjects <ISprinkler>()) { RemoveEAAlarms(sprinkler); } new Common.AlarmTask(Sprinkler.kAutoWaterTimeOfDay, ~DaysOfTheWeek.None, TurnOnUpgradedSprinklers); processAlarm = AlarmManager.Global.AddAlarmRepeating(Sprinkler.kProcessDelay, TimeUnit.Minutes, new AlarmTimerCallback(ProcessSprinklersCallback), Sprinkler.kProcessPeriod, TimeUnit.Minutes, "Sprinkler Processing Alarm", AlarmType.DeleteOnReset, null); AlarmManager.Global.AlarmWillYield(processAlarm); }
public void HideMeter() { this.mChunkGrowthAlarm = AlarmHandle.kInvalidHandle; base.RemoveAlarm(this.mPlusPlusAlarm); if (this.mSmc != null && this.mSmc.IsValid) { this.mSmc.RequestState(false, "SkillMeter", "Exit"); } this.StopGlow(); this.Destroy(); }
public static void Report() { if (Debugger.sLog != null) { foreach (string current in Debugger.sLog) { StyledNotification.Show(new StyledNotification.Format(current, StyledNotification.NotificationStyle.kDebugAlert)); } } AlarmManager.Global.RemoveAlarm(Debugger.sReporterHandle); Debugger.sReporterHandle = AlarmHandle.kInvalidHandle; }
private void ShowMeter() { Animation.CreateTransformController(base.ObjectId); this.mSmc = StateMachineClient.Acquire(this.mSim.Proxy.ObjectId, "SkillMeter", AnimationPriority.kAPDefault, false); this.mSmc.SetActor("x", this.mSim); this.mSmc.SetActor("SkillMeter", this); this.mSmc.EnterState("SkillMeter", "Enter"); this.mSmc.AddOneShotScriptEventHandler(100u, new SacsEventHandler(this.StartGlow)); this.mSmc.RequestState(false, "SkillMeter", "Open"); this.UpdateProgress(true); this.mPlusPlusAlarm = base.AddAlarmRepeating(this.mProgress.kMinutesPerPlusPlusEffect, TimeUnit.Minutes, new AlarmTimerCallback(this.ShowPlusPlus), this.mProgress.kMinutesPerPlusPlusEffect, TimeUnit.Minutes, "Plus Plus Alarm", AlarmType.AlwaysPersisted); }
public static bool CheckAlarm(AlarmHandle handle, AlarmTimerCallback callback) { List <AlarmManager.Timer> list = AlarmManager.Global.mTimers[handle]; foreach (AlarmManager.Timer current in list) { if (current.CallBack == callback) { return(true); } } return(false); }
public static void OnWorldLoadFinishedHandler(object sender, EventArgs e) { List <Sims3.Gameplay.Objects.Electronics.Computer> others = new List <Sims3.Gameplay.Objects.Electronics.Computer>(Sims3.Gameplay.Queries.GetObjects <Sims3.Gameplay.Objects.Electronics.Computer>()); foreach (Sims3.Gameplay.Objects.Electronics.Computer obj in others) { AddInteractions(obj); } sBoughtObjectLister = EventTracker.AddListener(EventTypeId.kBoughtObject, new ProcessEventDelegate(OnObjectBought)); sFirstAlarm = true; sAlarmHandle = AlarmManager.Global.AddAlarmDay(8f, DaysOfTheWeek.All, new AlarmTimerCallback(OnAlarm), "NRaasHomeWorker", AlarmType.NeverPersisted, null); }
private void OnArrestFailed(Sim sim, float x) { UnrequestWalkStyle(Parent.Cop, Sim.WalkStyle.Run); if (++mNumTries <= 0x3) { Parent.Cop.RemoveAlarm(mAlarmHandle); mAlarmHandle = Parent.Cop.AddAlarm(1f, TimeUnit.Minutes, DoArrest, "Arrest retry alarm", AlarmType.DeleteOnReset); } else { Parent.SetState(new RideOffIntoTheSunset(Parent)); } }
public override bool Run() { try { if (!Target.RouteToChairControls(Actor)) { return(false); } EnterStateMachine(Target.StateMachineName, "Enter", "x"); SetActor("tattooChair", Target); SetActor("y", Actor); AnimateSim("Tattoo Self Stand"); AddPersistentScriptEventHandler(0x0, new SacsEventHandler(Target.OnSound)); bool succeeded = DoTimedLoop(TattooChair.kTimeToPrepareSelfTattoo); AnimateSim("Exit"); if (!succeeded || !Target.RouteToChair(Actor)) { return(false); } EnterState("x", "Enter"); EnterState("tattooChair", "Enter"); Actor.SkillManager.AddElement(SkillNames.Tattooing); StandardEntry(); BeginCommodityUpdates(); SetParameter("isScared", TattooChair.ShouldPlayScaredReaction(Actor)); AnimateSim("Tattoo Self"); float timeToTattoo = Tattooing.GetTimeToTattoo(Actor); AlarmHandle handle = Target.AddAlarm(timeToTattoo * TattooChair.kTimeAtWhichToPerformAction, TimeUnit.Minutes, new AlarmTimerCallback(OnDisplayCas), "Tattoo Chair - Display Cas", AlarmType.DeleteOnReset); succeeded = DoTimedLoop(timeToTattoo); if (!succeeded) { Target.RemoveAlarm(handle); } AnimateSim("Exit"); Target.Repairable.UpdateBreakage(Actor); EndCommodityUpdates(succeeded); StandardExit(); return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
/// <summary> /// Start up things when the game is loaded or a new controller is added /// </summary> public void StartUpOrSwitch() { try { //Only do this part for the active family if (this.LotCurrent.Household != null && this.LotCurrent.Household.IsActive) { // List<Abstracts.Door> doors = ApartmentController.ReturnLockedDoors(this); //set the active households rent ApartmentFamily activeFamily = this.Families.Find( delegate(ApartmentFamily f) { return(f.IsActive == true); }); if (activeFamily != null) { if (firstLoad) { firstLoad = false; if (ControllerSettings.alwaysDisableRoommateService) { //Event Hanlders World.OnAddLotPostLoadCallback += new System.EventHandler(World_OnWorldQuitEventHandler); ApartmentController.StopAcceptingRoommates(); } // ApartmentController.LoadActiveHousehold(activeFamily, this); } } } //Handle rent payment DaysOfTheWeek daysOfTheWeek = DaysOfTheWeek.None; DaysOfTheWeek[] array = Mailbox.kBillingDaysOfWeek; for (int i = 0; i < array.Length; i++) { DaysOfTheWeek daysOfTheWeek2 = array[i]; daysOfTheWeek |= daysOfTheWeek2; } if (this.mBills == AlarmHandle.kInvalidHandle) { this.mBills = AlarmManager.Global.AddAlarmDay(ControllerSettings.timeOfRent, ControllerSettings.rentDay, new AlarmTimerCallback(RentAlarm), "anisBillAndRentAlarm", AlarmType.NeverPersisted, null); } } catch (System.Exception ex) { CommonMethods.PrintMessage("bill handling: " + ex.Message); } }
public override void Init(GoToLotSituation parent) { parent.mHaveBothSimsArrivedAtTheLot = true; if (parent.mFirstAction != null) { if (!parent.mFirstAction(parent, this)) { Exit(); } } AlarmManager.RemoveAlarm(mAlarmHandle); mAlarmHandle = AlarmManager.AddAlarm(Sims3.Gameplay.Situations.InviteToLotSituation.kNumHoursForMeetUpToWaitBeforeGivingUp, TimeUnit.Hours, TimeOut, "Waiting for Sims to get to lot", AlarmType.NeverPersisted, Parent.mSimA); }
public static void InWorldSubStateChanged(InWorldState.SubState previousState, InWorldState.SubState newState) { try { if (newState == InWorldState.SubState.LiveMode) { AlarmHandle handle = AlarmManager.Global.AddAlarm(3, TimeUnit.Seconds, removeGlow, "VampireGlowRemoval", AlarmType.NeverPersisted, Singleton); } } catch (Exception ex) { // Just let the show continue } }
public static void OnWorldLoadFinishedHandler(object sender, EventArgs e) { List <Sims3.Gameplay.Objects.Electronics.Computer> others = new List <Sims3.Gameplay.Objects.Electronics.Computer>(Sims3.Gameplay.Queries.GetObjects <Sims3.Gameplay.Objects.Electronics.Computer>()); foreach (Sims3.Gameplay.Objects.Electronics.Computer obj in others) { AddInteractions(obj); } sBoughtObjectLister = EventTracker.AddListener(EventTypeId.kBoughtObject, new ProcessEventDelegate(OnObjectBought)); sFirstAlarm = true; sAlarmHandle = AlarmManager.Global.AddAlarmRepeating(1f, TimeUnit.Minutes, new AlarmTimerCallback(OnAlarm), 1f, TimeUnit.Hours, "NRaasWorkPusher", AlarmType.NeverPersisted, null); sCarPoolers.Clear(); sBusPoolers.Clear(); }
public GoToLotSituation(Sim simA, Sim simB, Lot lot, FirstActionDelegate firstAction) : base(lot) { Sim.sOnLotChangedDelegates += OnLotChanged; mFirstAction = firstAction; foreach (Situation situation in new List <Situation>(simA.Autonomy.SituationComponent.Situations)) { if (situation is GroupingSituation) { try { situation.Exit(); } catch (Exception e) { Common.DebugException(mSimA, e); } } } foreach (Situation situation in new List <Situation>(simB.Autonomy.SituationComponent.Situations)) { if (situation is GroupingSituation) { try { situation.Exit(); } catch (Exception e) { Common.DebugException(mSimB, e); } } } mSimA = simA.AssignRole(this); mSimB = simB.AssignRole(this); AlarmManager.RemoveAlarm(mPulse); mPulse = AlarmManager.AddAlarmRepeating((float)Sims3.Gameplay.Situations.InviteToLotSituation.kPulseMinutes, TimeUnit.Minutes, Pulse, (float)Sims3.Gameplay.Situations.InviteToLotSituation.kPulseMinutes, TimeUnit.Minutes, "InviteToLot pulse", AlarmType.NeverPersisted, mSimA); SetState(new BothGoToLot(this)); }
public void SetAlarms(float startTime, float endTime) { int num = this.Data.StartTime.Length; for (int i = 0; i < num; i++) { if (startTime != endTime) { Lazy.Allocate <List <AlarmHandle> >(ref this.mAlarmHandles); AlarmHandle alarmHandle2 = AlarmManager.Global.AddAlarmDay(startTime, DaysOfTheWeek.All, new AlarmTimerCallback(this.StartRoleAlarmHandler), "Start NPC Role alarm index: " + i, AlarmType.AlwaysPersisted, this); AlarmManager.Global.AlarmWillYield(alarmHandle2); this.mAlarmHandles.Add(alarmHandle2); this.mAlarmHandles.Add(AlarmManager.Global.AddAlarmDay(endTime, DaysOfTheWeek.All, new AlarmTimerCallback(this.EndRole), "End NPC Role alarm index: " + i, AlarmType.AlwaysPersisted, this)); } } }
protected static void OnReplaceAlarm() { try { if ((SimUpdate.sCurfewCheckPoliceAlarmHandle != AlarmHandle.kInvalidHandle) && (SimUpdate.sCurfewCheckPoliceAlarmHandle != sMyHandle)) { AlarmManager.Global.RemoveAlarm(SimUpdate.sCurfewCheckPoliceAlarmHandle); SimUpdate.sCurfewCheckPoliceAlarmHandle = AlarmManager.Global.AddAlarmRepeating(1, TimeUnit.Days, OnDoNothing, 1, TimeUnit.Days, "Police curfew check", AlarmType.NeverPersisted, null); sMyHandle = SimUpdate.sCurfewCheckPoliceAlarmHandle; } } catch (Exception e) { Common.Exception("OnReplaceAlarm", e); } }
/// <summary> /// Start up things when the game is loaded or a new controller is added /// </summary> public void StartUpOrSwitch() { try { //Only do this part for the active family if (this.LotCurrent.Household != null && this.LotCurrent.Household.IsActive) { // List<Abstracts.Door> doors = ApartmentController.ReturnLockedDoors(this); //set the active households rent ApartmentFamily activeFamily = this.Families.Find( delegate(ApartmentFamily f) { return f.IsActive == true; }); if (activeFamily != null) { if (firstLoad) { firstLoad = false; if (ControllerSettings.alwaysDisableRoommateService) { //Event Hanlders World.OnAddLotPostLoadCallback += new System.EventHandler(World_OnWorldQuitEventHandler); ApartmentController.StopAcceptingRoommates(); } // ApartmentController.LoadActiveHousehold(activeFamily, this); } } } //Handle rent payment DaysOfTheWeek daysOfTheWeek = DaysOfTheWeek.None; DaysOfTheWeek[] array = Mailbox.kBillingDaysOfWeek; for (int i = 0; i < array.Length; i++) { DaysOfTheWeek daysOfTheWeek2 = array[i]; daysOfTheWeek |= daysOfTheWeek2; } if (this.mBills == AlarmHandle.kInvalidHandle) this.mBills = AlarmManager.Global.AddAlarmDay(ControllerSettings.timeOfRent, ControllerSettings.rentDay, new AlarmTimerCallback(RentAlarm), "anisBillAndRentAlarm", AlarmType.NeverPersisted, null); } catch (System.Exception ex) { CommonMethods.PrintMessage("bill handling: " + ex.Message); } }
public void OnWorldLoadFinished() { foreach (ISprinkler sprinkler in Sims3.Gameplay.Queries.GetObjects<ISprinkler>()) { RemoveEAAlarms(sprinkler); } new Common.AlarmTask(Sprinkler.kAutoWaterTimeOfDay, ~DaysOfTheWeek.None, TurnOnUpgradedSprinklers); processAlarm = AlarmManager.Global.AddAlarmRepeating(Sprinkler.kProcessDelay, TimeUnit.Minutes, new AlarmTimerCallback(ProcessSprinklersCallback), Sprinkler.kProcessPeriod, TimeUnit.Minutes, "Sprinkler Processing Alarm", AlarmType.DeleteOnReset, null); AlarmManager.Global.AlarmWillYield(processAlarm); }