protected bool PayProfessor(AcademicCareer career) { Sim createdSim = career.OwnerDescription.CreatedSim; if ((createdSim != null) && (!career.SpecialWorkDay) && (!(createdSim.CurrentInteraction is Pregnancy.GoToHospital))) { DateAndTime time = SimClock.CurrentTime(); //AcademicCareer.CourseCreationSpec spec = career.GetNextCourse(SimClock.CurrentDayOfWeek, 0); // this needs more work because the above returns the first days course which the below fails to match if sim is attending later day course // but I'm not sure if passing the current hour would return the current course or the one after it... if (career.IsAtWork /*&& (spec != null && (SimClock.IsTimeBetweenTimes(time.Hour, spec.mCourseStartTime, spec.mCourseStartTime + spec.mJobCreationSpec.JobStaticData.HoursAvailable)*/ || career.IsSpecialWorkTime)//)) { int payPerHour = GetValue <ProfessorPayPerHour, int>(); if (payPerHour > 0) { payPerHour /= 6; career.PayOwnerSim(payPerHour, GotPaidEvent.PayType.kCareerNormalPay); } } return(true); } return(false); }
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 static string TimeTooltipString() { /* * if (GameUtils.IsOnVacation()) * { * return Localization.LocalizeString("Gameplay/Utilities/SimClock:DayOfVacation", new object[] { this.CurrentTripDay, this.MaxTripDays }); * } */ int week = SimClock.ElapsedCalendarWeeks() + 0x1; int day = (SimClock.ElapsedCalendarDays() + 0x1) - (0x7 * (week - 0x1)); long priorWorldTicksPlayed = GameStates.PriorWorldTicksPlayed; if (priorWorldTicksPlayed != 0x0L) { int num4 = (int)SimClock.ConvertFromTicks(priorWorldTicksPlayed, TimeUnit.Weeks); int num5 = ((int)SimClock.ConvertFromTicks(priorWorldTicksPlayed, TimeUnit.Days)) - (0x7 * num4); week += num4; day += num5; if (day > 0x7) { week++; day -= 0x7; } } return(Localization.LocalizeString("Gameplay/Utilities/SimClock:TimePlayed", new object[] { week, day })); }
public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { try { if (a.FamilyFunds < CollegeOfBusiness.kCostOfResumeInterviewClass) { return(false); } if (!SimClock.IsTimeBetweenTimes(CollegeOfBusiness.AttendResumeWritingAndInterviewTechniquesClass.kStartAvailibilityTime, CollegeOfBusiness.AttendResumeWritingAndInterviewTechniquesClass.kEndAvailibilityTime)) { return(false); } /* * if (!GameUtils.IsUniversityWorld()) * { * return false; * } */ return(true); } catch (Exception e) { Common.Exception(a, target, e); return(false); } }
protected override bool Allow(SimDescription sim) { if (sim.Household == null) { IncStat("No Home"); return(false); } else if (SimTypes.IsSpecial(sim)) { IncStat("Special"); return(false); } else if (CommuteAlarmRunning()) { IncStat("Running"); return(false); } Career job = Job; DateAndTime queryTime = SimClock.CurrentTime(); queryTime.Ticks += SimClock.ConvertToTicks(2f, TimeUnit.Hours); if (!job.IsWorkHour(queryTime)) { IncStat("Too Early"); return(false); } return(base.Allow(sim)); }
protected override bool Allow(SimDescription sim) { if (sim.ChildOrBelow) { IncStat("Too Young"); return(false); } else if (sim.LotHome == null) { IncStat("Homeless"); return(false); } else if (sim.CreatedByService != null) { IncStat("Service"); return(false); } else if (sim.CreatedSim == null) { IncStat("Hibernating"); return(false); } else if (sim.AssignedRole != null) { IncStat("Role"); return(false); } else if (!(sim.Occupation is Career)) { IncStat("Not Career"); return(false); } try { if (sim.CreatedSim.CurrentOutfitCategory != Sims3.SimIFace.CAS.OutfitCategories.Career) { IncStat("Not Career"); return(false); } } catch (Exception e) { Common.DebugException(sim, e); IncStat("Exception"); return(false); } DateAndTime queryTime = SimClock.CurrentTime(); queryTime.Ticks += SimClock.ConvertToTicks(2f, TimeUnit.Hours); if (sim.Occupation.IsWorkHour(queryTime)) { IncStat("Too Close"); return(false); } return(base.Allow(sim)); }
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 Dictionary<ulong, DoorPortalComponentEx.DoorLotSettings> mDoorLotSettings = new Dictionary<ulong, DoorPortalComponentEx.DoorLotSettings>(); public bool AllowPush(Sim sim, Lot lot) { if (!GoHere.ExternalAllowPush(sim.SimDescription, lot)) { return(false); } if (SimClock.IsNightTime()) { if (!mAllowNightVisitLot) { return(false); } } else { if (SimTypes.IsOccult(sim.SimDescription, Sims3.UI.Hud.OccultTypes.Vampire)) { if (!mAllowVampireDayPush) { return(false); } } } return(true); }
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); } }
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); } }
public NewBimDesc(SimOutfit defaultOutfit) { if (dontCall) { return; } var _this = (SimDescription)(object)this; Create.AddNiecSimDescription(_this); NiecException.NewSendTextExceptionToDebugger(); _this.mSkinToneKey = default(ResourceKey); _this.mSecondaryNormalMapWeights = new float[2]; _this.mFlags = SimDescription.FlagField.Marryable | SimDescription.FlagField.CanBeKilledOnJob | SimDescription.FlagField.ShowSocialsOnSim | SimDescription.FlagField.Contactable | SimDescription.FlagField.CanStartFires | SimDescription.FlagField.WasCasCreated; _this.mAlmaMaterName = string.Empty; _this.UserDaysInCurrentAge = int.MaxValue; _this.CharismaStats = default(SimDescription.Charisma); _this.mShapeDeltaMultiplier = 1f; _this.mPreferredVehicleGuid = ObjectGuid.InvalidObjectGuid; _this.mPreferredBoatGuid = ObjectGuid.InvalidObjectGuid; _this.LastMakeoverReceivedUserDirected = SimClock.CurrentTime() - new DateAndTime(4, DaysOfTheWeek.Sunday, 0, 0, 0); _this.mStoredSlot = PASSPORTSLOT.PASSPORTSLOT_NUM; _this.mReturnSimAlarm = AlarmHandle.kInvalidHandle; if (defaultOutfit != null && defaultOutfit.IsValid) { _this.mIsValidDescription = true; _this.Init(defaultOutfit); _this.InitHairColors(defaultOutfit); } }
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 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); }
private static float HowLongUntilDeliveringInvitations(float howLongUntilPreparations) { float num2; float num3; float hour = SimClock.CurrentTime().Hour; if (hour > PhoneService.HourItsTooLateToCall) { num2 = (PhoneService.HourItsOkayToCall - hour) + 24f; num3 = (PhoneService.HourItsTooLateToCall - hour) + 24f; } else if (hour < PhoneService.HourItsOkayToCall) { num2 = PhoneService.HourItsOkayToCall - hour; num3 = PhoneService.HourItsTooLateToCall - hour; } else { num2 = 0f; num3 = PhoneService.HourItsTooLateToCall - hour; } if (num3 > howLongUntilPreparations) { num3 = howLongUntilPreparations; } if (num2 > howLongUntilPreparations) { num2 = howLongUntilPreparations; } return(RandomUtil.GetFloat(num2, num3)); }
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(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 void AddSummaryToLog(string localizedText, string[] extended) { Common.StringBuilder extendedText = new Common.StringBuilder(); extendedText += EAText.GetNumberString(SimClock.ElapsedCalendarDays()) + " "; extendedText += SimClock.CurrentTime().ToString() + ": "; extendedText += localizedText; if (extended != null) { extendedText += " ("; bool first = true; foreach (string text in extended) { if (!first) { extendedText += " "; } extendedText += text; first = false; } extendedText += ")"; } AddValue <DumpStoryLogOption, string>(extendedText.ToString()); }
protected override bool Allow(SimDescription me, IMiniSimDescription actor) { if (me.CareerManager != null) { DateAndTime TwoHourTime = SimClock.CurrentTime(); TwoHourTime.Ticks += SimClock.ConvertToTicks(2f, TimeUnit.Hours); if (me.Occupation != null) { if (me.Occupation.IsWorkHour(TwoHourTime)) { return(false); } } if (me.CareerManager.School != null) { if (me.CareerManager.School.IsWorkHour(TwoHourTime)) { return(false); } } } return(true); }
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); }
public void UpdateJournal(Career job) { if (!mUpdatedToday) { if (job.SharedData == null) { return; } mUpdatedToday = true; OmniJournalData data = OmniJournalData.GetJournalData(job.SharedData.Name, job.CareerLevel); if (data != null) { data = data.Clone(); if (data != null) { mJournalEdition = data.CurrentEdition + SimClock.ElapsedCalendarDays(); base.Data = data; base.Data.ID = data.ID + mJournalEdition; base.BookId = base.Data.ID; mBookCareer = job.SharedData.Name; mBookLevelId = job.CareerLevel; } } } }
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); }
// Methods public static OmniJournal CreateOutOfWorld(OmniJournalData data, SimDescription Actor) { OmniJournal journal = ObjectCreation.CreateObject(0x6694B72C99D44369, ProductVersion.BaseGame, null) as OmniJournal; if (journal == null) { return(null); } journal.Data = data.Clone(); journal.mJournalEdition = data.CurrentEdition + SimClock.ElapsedCalendarDays(); journal.Data.ID = data.ID + journal.mJournalEdition; Career career = Actor.Occupation as Career; if (career != null) { journal.mBookCareer = career.SharedData.Name; } journal.mBookLevelId = Actor.Occupation.CareerLevel; journal.mBookId = journal.Data.ID; journal.mOwner = Actor; journal.mUpdatedToday = true; journal.SetGeometryState(journal.Data.GeometryState); journal.SetMaterial(journal.Data.MaterialState); return(journal); }
public void DebugError(object sender, string msg, Exception ex) { try { if (mLogXmlWriter != null) { CustomXmlAttribute[] attributes = new CustomXmlAttribute[] { new CustomXmlAttribute("Time", SimClock.CurrentTime().ToString()), new CustomXmlAttribute("Sender", sender.GetType().Name), new CustomXmlAttribute("Id", GetId(sender)) }; mLogXmlWriter.WriteElementString("Log", ScriptError.Escape(msg), attributes); if (ex != null) { mLogXmlWriter.WriteElementString("Error", ex.Message + Message.NewLine + ex.StackTrace, attributes); } mLogXmlWriter.FlushBufferToFile(); } } catch (Exception e) { Message.Sender.Show("Cannot write debug log"); } }
protected override float GetTime() { Career job = Job; DateAndTime nowTime = SimClock.CurrentTime(); AddStat("StartTime", job.CurLevel.StartTime); AddStat("NowTime", nowTime.Hour); AddStat("AvgTime", job.AverageTimeToReachWork); float oneHourAhead = (job.AverageTimeToReachWork + 1) + RandomUtil.GetFloat(StaggerTime); float time = ((job.CurLevel.StartTime - oneHourAhead) - nowTime.Hour); if (time < 0f) { time += 24f; if (time > oneHourAhead) { time = 0f; } } return(time); }
public static bool GetRoleHours(SimDescription sim, ref DateAndTime start, ref DateAndTime end) { if ((sim != null) && (sim.AssignedRole != null)) { IRoleGiverExtended roleGivingObject = sim.AssignedRole.RoleGivingObject as IRoleGiverExtended; if (roleGivingObject != null) { float startTime; float endTime; roleGivingObject.GetRoleTimes(out startTime, out endTime); start = new DateAndTime(SimClock.ConvertToTicks((float)SimClock.DayToInt(SimClock.CurrentDayOfWeek), TimeUnit.Days)); end = new DateAndTime(SimClock.ConvertToTicks((float)SimClock.DayToInt(SimClock.CurrentDayOfWeek), TimeUnit.Days)); if (SimClock.HoursPassedOfDay >= endTime) { start = SimClock.Add(start, TimeUnit.Hours, startTime); end = SimClock.Add(end, TimeUnit.Hours, endTime + 24f); } else { start = SimClock.Add(start, TimeUnit.Hours, startTime); end = SimClock.Add(end, TimeUnit.Hours, endTime); } return(true); } } return(false); }
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 void Dispose() { if ((mOpportunities != null) && (mSim.OpportunityHistory != null)) { mSim.OpportunityHistory.mCurrentOpportunities = mOpportunities; mSim.NeedsOpportunityImport = (true); if (mSim.CreatedSim != null) { if (mSim.CreatedSim.mOpportunityManager == null) { mSim.CreatedSim.mOpportunityManager = new OpportunityManager(mSim.CreatedSim); mSim.CreatedSim.mOpportunityManager.SetupLocationBasedOpportunities(); } try{ // [NRaas:]Due to an odd bit of coding at the bottom of AcceptOpportunityFromTravel(), // the expiration time for non-expirying opportunities is checked foreach (OpportunityHistory.OpportunityExportInfo info in mSim.OpportunityHistory.GetCurrentOpportunities()) { if (info.ExpirationTime < SimClock.CurrentTime()) { Opportunity opp = OpportunityManager.GetStaticOpportunity(info.Guid); if (opp != null) { bool requiresTimeout = (false); switch (opp.Timeout) { case Opportunity.OpportunitySharedData.TimeoutCondition.SimDays: case Opportunity.OpportunitySharedData.TimeoutCondition.SimHours: case Opportunity.OpportunitySharedData.TimeoutCondition.SimTime: case Opportunity.OpportunitySharedData.TimeoutCondition.Gig: case Opportunity.OpportunitySharedData.TimeoutCondition.AfterschoolRecitalOrAudition: requiresTimeout = (true); break; } if (!requiresTimeout) { info.ExpirationTime = SimClock.Add(SimClock.CurrentTime(), TimeUnit.Hours, 1); } } } } mSim.CreatedSim.OpportunityManager.TravelFixup(); }catch (Exception exception) { // Get stack trace for the exception. with source file information var st = new StackTrace(exception, true); // Get the top stack frame var frame = st.GetFrame(0); // Get the line number from the stack frame var line = frame.GetFileLineNumber(); Alive.WriteLog(exception.Message + "\n\n" + exception.StackTrace + "\n\n" + exception.Source + "\n\n" + line); }finally{ } mSim.NeedsOpportunityImport = (false); } } }
public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { HomeSchooling school = a.School as HomeSchooling; if (school == null) { return(false); } if (isAutonomous) { if ((school.OwnersHomework != null) && (school.OwnersHomework.PercentComplete == 100f)) { if (school.mLastHomeworkDay < SimClock.ElapsedCalendarDays()) { return(true); } } return(false); } else { return(true); } }
static float GetImpregnationChance(Sim abductee, SimDescription alien) { float result = Abductor.Settings.mImpregnantionChance; if (result <= 0) { Logger.Append("Alien Pregnancy: Disabled"); return(0); } if (Abductor.Settings.mUseFertility) { if ((abductee.BuffManager != null && abductee.BuffManager.HasElement(BuffNames.ATwinkleInTheEye)) || abductee.TraitManager.HasElement(TraitNames.FertilityTreatment)) { result += TraitTuning.kFertilityBabyMakingChanceIncrease; } if (abductee.BuffManager != null && abductee.BuffManager.HasElement(BuffNames.MagicInTheAir)) { result += BuffMagicInTheAir.kBabyMakingChanceIncrease; } if (abductee.TraitManager.HasElement(TraitNames.WishedForLargeFamily)) { result += 100f; abductee.BuffManager.RemoveElement(BuffNames.WishForLargeFamily); } if ((alien.CreatedSim != null && alien.CreatedSim.BuffManager != null && alien.CreatedSim.BuffManager.HasElement(BuffNames.ATwinkleInTheEye)) || alien.TraitManager.HasElement(TraitNames.FertilityTreatment)) { result += TraitTuning.kFertilityBabyMakingChanceIncrease; } if (alien.CreatedSim != null && alien.CreatedSim.BuffManager != null && alien.CreatedSim.BuffManager.HasElement(BuffNames.MagicInTheAir)) { result += BuffMagicInTheAir.kBabyMakingChanceIncrease; } if (alien.TraitManager.HasElement(TraitNames.WishedForLargeFamily)) { result += 100f; if (alien.CreatedSim != null) { alien.CreatedSim.BuffManager.RemoveElement(BuffNames.WishForLargeFamily); } } if (GameUtils.IsInstalled(ProductVersion.EP7) && SimClock.IsNightTime() && SimClock.IsFullMoon()) { result += Pregnancy.kFullMoonImprovedBabyChance * 100f; } } return(result); }
public override void OnDelayedWorldLoadFinished() { if (!GameUtils.IsInstalled(ProductVersion.EP7)) { return; } Overwatch.Log("HandleLunarCycle"); float hourOfDay = World.GetSunriseTime() + 2.6f; HudModel model = Sims3.UI.Responder.Instance.HudModel as HudModel; AlarmManager.Global.RemoveAlarm(model.mLunarUpdateAlram); model.mLunarUpdateAlram = AlarmManager.Global.AddAlarmDay(hourOfDay, ~DaysOfTheWeek.None, OnLunarUpdate, "LunarUpdateAlarm", AlarmType.NeverPersisted, null); if (Overwatch.Settings.mCurrentPhaseIndex < 0) { InitializeLunarPhase(); } LunarUpdate(false); if (SimClock.IsNightTime()) { // Reactivates any alarms that were not persisted to save EventTracker.SendEvent(new LunarCycleEvent(EventTypeId.kMoonRise, (LunarCycleManager.LunarPhase)World.GetLunarPhase())); if (SimClock.HoursPassedOfDay >= (World.GetSunsetTime() + LunarCycleManager.kLunarEffectsDelayHours)) { if (!Overwatch.Settings.mDisableFullMoonLighting) { LunarCycleManager.TriggerLunarLighting(); } } } if (Overwatch.Settings.mDisableFullMoonLighting) { AlarmManager.Global.RemoveAlarm(LunarCycleManager.mLunarEffectsAlarm); LunarCycleManager.mLunarEffectsAlarm = AlarmHandle.kInvalidHandle; } foreach (MoonDial dial in Sims3.Gameplay.Queries.GetObjects <MoonDial>()) { try { if (dial.mLunarFXLookUp.Length > Overwatch.Settings.mCurrentPhaseIndex) { dial.StartLunarFX(dial.mLunarFXLookUp[Overwatch.Settings.mCurrentPhaseIndex]); } } catch { } } Sims3.UI.Responder.Instance.OptionsModel.OptionsChanged += OnOptionsChanged; }