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 static void InviteToVIP(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i) { try { ResortManagerCareerProtection protection = null; try { Lot lotCurrent = actor.LotCurrent; if (!lotCurrent.ResortManager.IsCheckedIn(target)) { DateAndTime time2 = lotCurrent.ResortManager.GetCheckOutDateAndTime(actor) - SimClock.CurrentTime(); int days = ((int)SimClock.ConvertFromTicks(time2.Ticks, TimeUnit.Days)) + 0x1; List <Sim> simsInGroup = new List <Sim>(); simsInGroup.Add(target); protection = new ResortManagerCareerProtection(simsInGroup, days); } SocialCallback.InviteToVIP(actor, target, interaction, topic, i); } finally { if (protection != null) { protection.Dispose(); } } } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(actor, target, e); } }
public static Urnstone CreateGrave(SimDescription me, SimDescription.DeathType deathType, bool ignoreExisting, bool report) { Urnstone urnstone = FindGhostsGrave(me); if ((urnstone != null) && (!ignoreExisting)) { if ((urnstone.InInventory) || (urnstone.InWorld)) { return(urnstone); } } Household originalHousehold = me.Household; bool addOnly = false; if (urnstone == null) { urnstone = PrivateCreateGrave(me); if (urnstone == null) { return(null); } } else { addOnly = true; } bool success = MoveToMausoleum(urnstone); if (!success) { if (me.CreatedSim != null) { if (Inventories.TryToMove(urnstone, me.CreatedSim.Inventory)) { success = true; } } if ((!success) && (Sim.ActiveActor != null)) { if (Inventories.TryToMove(urnstone, Sim.ActiveActor.Inventory)) { success = true; } } if (!success) { return(null); } } if (report) { Common.Notify(Common.Localize("ForceKill:Success", me.IsFemale, new object[] { me })); } if ((addOnly) && (!ignoreExisting)) { return(urnstone); } if ((originalHousehold == Household.ActiveHousehold) && (me.CreatedSim != null)) { HudModel model = HudController.Instance.Model as HudModel; foreach (SimInfo info in model.mSimList) { if (info.mGuid == me.CreatedSim.ObjectId) { model.RemoveSimInfo(info); model.mSimList.Remove(info); break; } } } if (me.CreatedSim != null) { me.CreatedSim.Destroy(); } if (originalHousehold != null) { originalHousehold.Remove(me, !originalHousehold.IsSpecialHousehold); } if (me.DeathStyle == SimDescription.DeathType.None) { if (me.IsHuman) { switch (deathType) { case SimDescription.DeathType.None: case SimDescription.DeathType.PetOldAgeBad: case SimDescription.DeathType.PetOldAgeGood: deathType = SimDescription.DeathType.OldAge; break; } } else { switch (deathType) { case SimDescription.DeathType.None: case SimDescription.DeathType.OldAge: deathType = SimDescription.DeathType.PetOldAgeGood; break; } } me.SetDeathStyle(deathType, true); } me.IsNeverSelectable = true; me.Contactable = false; me.Marryable = false; if (me.CreatedSim == PlumbBob.SelectedActor) { LotManager.SelectNextSim(); } if (me.CareerManager != null) { me.CareerManager.LeaveAllJobs(Sims3.Gameplay.Careers.Career.LeaveJobReason.kDied); } urnstone.OnHandToolMovement(); Urnstone.FinalizeSimDeath(me, originalHousehold); int num = ((int)Math.Floor((double)SimClock.ConvertFromTicks(SimClock.CurrentTime().Ticks, TimeUnit.Minutes))) % 60; urnstone.MinuteOfDeath = num; return(urnstone); }
public void ReturnChildren() { Lot lot = LotManager.GetLot(mLot); if (lot.Household == null) { return; } foreach (KeyValuePair <ulong, DateAndTime> pair in mOfflotChildren) { SimDescription simDesc = lot.Household.FindMember(pair.Key); if (simDesc == null) { continue; } try { DaycareWorkdaySituation situation = null; foreach (Situation sit in Situation.sAllSituations) { situation = sit as DaycareWorkdaySituation; if (situation == null) { continue; } if (situation.mChildMonitors.ContainsKey(pair.Key)) { break; } situation = null; } if (situation != null) { Daycare career = situation.Daycare; if (career != null) { DateAndTime duration = SimClock.CurrentTime() - pair.Value; float hours = SimClock.ConvertFromTicks(duration.Ticks, TimeUnit.Hours); float careerLength = (career.FinishTime - career.StartTime); float ratio = hours / careerLength; string debuggingLog; float xp = 0; DaycareWorkdaySituation priorSituation = career.mDaycareSituation; try { if (career.mDaycareSituation == null) { career.mDaycareSituation = situation; } xp = career.GetExperience(pair.Key, Rating.Neutral, out debuggingLog); } finally { career.mDaycareSituation = priorSituation; } xp *= ratio; career.UpdateXp(xp); int amount = career.GetMoney(pair.Key, Rating.Neutral, out debuggingLog); amount = (int)(amount * ratio); career.PayOwnerSim(amount, GotPaidEvent.PayType.kCareerBonus); if (simDesc.Household != null) { simDesc.ModifyFunds(-amount); } } if ((situation.mChildMonitors != null) && (situation.mChildMonitors.Count == 1) && (situation.mChildMonitors.ContainsKey(simDesc.SimDescriptionId))) { for (int i = situation.mSimDescIds.Count - 1; i >= 0; i--) { if (!situation.mChildMonitors.ContainsKey(situation.mSimDescIds[i])) { situation.mSimDescIds.RemoveAt(i); } } } DaycareWorkdaySituation.ScoringRecord oldRecord; if (!situation.ScoringRecords.TryGetValue(simDesc.SimDescriptionId, out oldRecord)) { oldRecord = null; } // ScoringRecord will be added by RemovePerson() so remove it now situation.ScoringRecords.Remove(simDesc.SimDescriptionId); situation.RemovePerson(simDesc.CreatedSim); if (oldRecord != null) { DaycareWorkdaySituation.ScoringRecord newRecord; if (situation.ScoringRecords.TryGetValue(simDesc.SimDescriptionId, out newRecord)) { newRecord.Score += oldRecord.Score; newRecord.ScoreDebugString += Common.NewLine + oldRecord.ScoreDebugString; } } } } catch (Exception e) { Common.Exception(simDesc, e); } Common.DebugNotify("Remove:" + Common.NewLine + simDesc.FullName); if (simDesc.CreatedSim != null) { simDesc.CreatedSim.InteractionQueue.CancelAllInteractions(); /* * while (simDesc.CreatedSim.InteractionQueue.GetCurrentInteraction() != null) * { * Common.Sleep(5); * } */ GoHereEx.Teleport.Perform(simDesc.CreatedSim, simDesc.LotHome, false); } } mOfflotChildren.Clear(); GoHere.Settings.mCaregivers.Remove(mLot); }
// Token: 0x06006FBE RID: 28606 RVA: 0x0026D010 File Offset: 0x0026C010 public void FinalizeDeath() { this.MakeHouseholdHorsesGoHome(); if (this.Target.SimDescription.IsEnrolledInBoardingSchool()) { this.Target.SimDescription.BoardingSchool.OnRemovedFromSchool(); } Urnstone.FinalizeSimDeath(this.Target.SimDescription, this.Target.Household, this.mSituation.PetSavior == null); int minuteOfDeath = (int)Math.Floor((double)SimClock.ConvertFromTicks(SimClock.CurrentTime().Ticks, TimeUnit.Minutes)) % 60; this.mGrave.MinuteOfDeath = minuteOfDeath; if (this.Target.DeathReactionBroadcast != null) { this.Target.DeathReactionBroadcast.Dispose(); this.Target.DeathReactionBroadcast = null; } this.Target.SetHiddenFlags((HiddenFlags)4294967295u); Household household = this.Target.Household; if (household != null) { if (household.IsActive) { this.Target.MoveInventoryItemsToAFamilyMember(); } this.Target.LotCurrent.LastDiedSim = this.Target.SimDescription; this.Target.LotCurrent.NumDeathsOnLot++; this.Actor.ClearSynchronizationData(); this.mSituation.DeathCheckForAbandonedChildren(this.Target); if (this.Target.SimDescription.DeathStyle != SimDescription.DeathType.OldAge) { this.Actor.RemoveInteractionByType(GrimReaperSituation.ChessChallenge.Singleton); } if (BoardingSchool.ShouldSimsBeRemovedFromBoardingSchool(household)) { BoardingSchool.RemoveAllSimsFromBoardingSchool(household); } if (household.IsActive && !this.Target.BuffManager.HasElement(BuffNames.Ensorcelled)) { int num = 0; foreach (Sim sim in household.AllActors) { if (sim.BuffManager.HasElement(BuffNames.Ensorcelled)) { num++; } } if (household.AllActors.Count == num + 1) { foreach (Sim sim2 in household.AllActors) { if (sim2.BuffManager.HasElement(BuffNames.Ensorcelled)) { sim2.BuffManager.RemoveElement(BuffNames.Ensorcelled); } } } } int num2 = household.AllActors.Count - household.GetNumberOfRoommates(); if (household.IsActive && num2 == 1 && !Household.RoommateManager.IsNPCRoommate(this.Target)) { this.mSituation.LastSimOfHousehold = this.Target; } else { if (this.Target.IsActiveSim) { LotManager.SelectNextSim(); } if (this.mWasMemberOfActiveHousehold) { household.RemoveSim(this.Target); } } } this.mGrave.RemoveFromUseList(this.Actor); Ocean singleton = Ocean.Singleton; if (singleton != null && singleton.IsActorUsingMe(this.Target)) { singleton.RemoveFromUseList(this.Target); this.Target.Posture = null; } }
protected override bool InitialPrep(T ths, bool twoPerson, IMagicalDefinition definition, MagicControl control, bool spellCastingSucceeded, bool spellCastingEpiclyFailed) { ths.mSpellCastingSucceeded = spellCastingSucceeded; ths.mSpellCastingEpiclyFailed = spellCastingEpiclyFailed; if (twoPerson) { ths.mJig = GlobalFunctions.CreateObjectOutOfWorld("practiceSpell_jig", ProductVersion.EP7) as SocialJig; if (ths.mJig == null) { return(false); } ths.mJig.RegisterParticipants(ths.Actor, null); } else if (!ths.Actor.HasExitReason()) { mEntry = MagicWand.BeTargetOfSpell.Singleton.CreateInstance(ths.Actor, ths.Target, ths.GetPriority(), false, false) as MagicWand.BeTargetOfSpell; mEntry.LinkedInteractionInstance = ths as InteractionInstance; mEntry.Caster = ths.Actor; ths.Target.InteractionQueue.AddNext(mEntry); if ((ths.Actor.GetDistanceToObjectSquared(ths.Target) > (MagicWand.CastSpell.kCloseEnoughToPlaceJig * MagicWand.CastSpell.kCloseEnoughToPlaceJig)) && !ths.Actor.RouteToPointRadius(ths.Target.Position, MagicWand.CastSpell.kCloseEnoughToPlaceJig)) { return(false); } ths.mJig = GlobalFunctions.CreateObjectOutOfWorld("castSpell_jig", ProductVersion.EP7) as SocialJig; ths.mJig.RegisterParticipants(ths.Actor, ths.Target); } else { return(false); } ths.mJig.SetOpacity(0f, 0f); Vector3 position = ths.Actor.Position; Vector3 forwardVector = ths.Actor.ForwardVector; if (!GlobalFunctions.FindGoodLocationNearby(ths.mJig, ref position, ref forwardVector)) { return(false); } ths.mJig.SetPosition(position); ths.mJig.SetForward(forwardVector); ths.mJig.AddToWorld(); if (!twoPerson) { long currentTicks = SimClock.CurrentTicks; mEntry.Jig = ths.mJig as SocialJigTwoPerson; while (!ths.mJig.RouteComplete && !ths.Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached))) { if ((SimClock.ConvertFromTicks(SimClock.CurrentTicks - currentTicks, TimeUnit.Minutes) > 15f) && (ths.Actor.GetDistanceToObject(ths.mJig) < MagicWand.CastSpell.kDistanceToForceRouteAway)) { ths.Actor.RouteToObjectRadialRange(ths.mJig, MagicWand.CastSpell.kDistanceToForceRouteAway, MagicWand.CastSpell.kDistanceToForceRouteAway); } SpeedTrap.Sleep(0x0); } } if (!ths.Actor.DoRoute(ths.mJig.RouteToJigA(ths.Actor))) { return(false); } mSucceeded = ths.AdditionalInteractionPreparation(); if (!mSucceeded) { return(false); } return(true); }
private static void SetUpHolidayManager(Season currentSeason, bool clear) { HolidayManager ths = HolidayManager.sInstance; if (ths == null) { return; } if (SeasonsManager.sInstance == null) { return; } if (clear) { ths.ClearCurrentHoliday(); } if (SeasonsManager.GetSeasonEnabled(currentSeason)) { if (ths.mStartDateTimeOfHoliday == DateAndTime.Invalid) { ths.OnHolidayDone(); CalculateDateTimeOfHoliday(ths, ref currentSeason); if (ths.mStartDateTimeOfHoliday != DateAndTime.Invalid) { ths.mCurrentSeason = currentSeason; ths.SetHoliday(); } if (TrickOrTreatSituation.NPCTrickOrTreatAlarm != AlarmHandle.kInvalidHandle) { AlarmManager.Global.RemoveAlarm(TrickOrTreatSituation.NPCTrickOrTreatAlarm); TrickOrTreatSituation.NPCTrickOrTreatAlarm = AlarmHandle.kInvalidHandle; } } if (ths.mStartDateTimeOfHoliday != DateAndTime.Invalid) { DateAndTime time = SimClock.CurrentTime(); long ticks = (ths.mStartDateTimeOfHoliday - time).Ticks; Common.DebugNotify("Initiate Holiday Alarm: " + Common.NewLine + SimClock.CurrentTime() + Common.NewLine + ths.mStartDateTimeOfHoliday + Common.NewLine + ticks); if (ticks > 0) { ths.ClearAllAlarms(); //ths.StartAlarms(); if (sHolidayAlarm != null) { sHolidayAlarm.Dispose(); } sHolidayAlarm = new Common.AlarmTask(SimClock.ConvertFromTicks(ticks, TimeUnit.Hours), TimeUnit.Hours, OnHolidayStarted); long ticksToWarning = ticks - SimClock.ConvertToTicks((float)HolidayManager.kDaysBeforeHolidayToShowWarningTNS, TimeUnit.Days); if (ticksToWarning > 0) { ths.mShowWarningAlarm = AlarmManager.Global.AddAlarm(SimClock.ConvertFromTicks(ticksToWarning, TimeUnit.Hours), TimeUnit.Hours, ths.OnShowWarningTns, "ShowWarningTns", AlarmType.AlwaysPersisted, null); } } } } }
protected void FinishedMakingNectarCallback() { string msg = null; try { List <Ingredient> fruitsUsed = Inventories.QuickFind <Ingredient>(Target.Inventory); foreach (GameObject obj2 in fruitsUsed) { Target.Inventory.SetNotInUse(obj2); } msg += "1"; if (((fruitsUsed != null) && (fruitsUsed.Count > 0x0)) && (Target.mLastSimToMake != null)) { float num = 0f; float num2 = (((float)RandomGen.NextDouble()) * (NectarMaker.kMaxGlobalValueVariance - NectarMaker.kMinGlobalValueVariance)) + NectarMaker.kMinGlobalValueVariance; int skillLevel = Target.mLastSimToMake.SkillManager.GetSkillLevel(SkillNames.Nectar); float num4 = ((NectarMaker.kLevel10Multiplier - NectarMaker.kLevel0Multiplier) * (((float)skillLevel) / 10f)) + NectarMaker.kLevel0Multiplier; fruitsUsed.Sort(); string str = ""; bool flag = true; Ingredient ingredient = fruitsUsed[0x0]; string key = ""; Dictionary <string, int> ingredients = new Dictionary <string, int>(); if (ingredient != null) { key = ingredient.Data.Key; } msg += "2"; float num5 = 0f; foreach (Ingredient ingredient2 in fruitsUsed) { if (flag && !key.Equals(ingredient2.Data.Key)) { flag = false; } str = str + ingredient2.Data.Key; if (!ingredients.ContainsKey(ingredient2.Data.Key)) { ingredients.Add(ingredient2.Data.Key, 0x1); } else { ingredients[ingredient2.Data.Key]++; } num += ingredient2.Data.NectarValue; num5 += (float)ingredient2.GetQuality(); Target.Inventory.TryToRemove(ingredient2); } msg += "3"; num5 /= (float)fruitsUsed.Count; uint hash = ResourceUtils.HashString32(str); float num7 = 1f; if (!flag) { num7 = NectarMaker.CalculateHashMultiplier(hash); } msg += "4"; float makeStyleValueModifier = Target.GetMakeStyleValueModifier(Target.mLastUsedMakeStyle); int makeStyleBottleModifier = Target.GetMakeStyleBottleModifier(Target.mLastUsedMakeStyle); float baseValue = ((((((num * num2) * num4) * Target.mFlavorMultiplier) * num7) * NectarMaker.kQualityLevelMultiplier[((int)num5) - 0x1]) * Target.mMultiplierFromFeet) * makeStyleValueModifier; int numBottles = (NectarMaker.kNumBottlesPerBatch + Target.mBottleDifference) + makeStyleBottleModifier; NectarSkill skill = Target.mLastSimToMake.SkillManager.GetSkill <NectarSkill>(SkillNames.Nectar); if ((skill != null) && skill.IsNectarMaster()) { numBottles += NectarSkill.kExtraBottlesNectarMaster; } msg += "5"; List <NectarMaker.IngredientNameCount> list2 = new List <NectarMaker.IngredientNameCount>(); foreach (string str3 in ingredients.Keys) { list2.Add(new NectarMaker.IngredientNameCount(str3, ((float)ingredients[str3]) / ((float)fruitsUsed.Count))); } msg += "6"; list2.Sort(); string str4 = ""; string str5 = ""; if (list2.Count > 0x0) { str4 = IngredientData.NameToDataMap[list2[0x0].IngredientName].Name; } if (list2.Count > 0x1) { str5 = IngredientData.NameToDataMap[list2[0x1].IngredientName].Name; } msg += "7"; List <NectarSkill.NectarBottleInfo> topNectarsMade = new List <NectarSkill.NectarBottleInfo>(); if (skill != null) { topNectarsMade = skill.mTopNectarsMade; } msg += "8"; string defaultEntryText = ""; if (string.IsNullOrEmpty(str5)) { defaultEntryText = Common.LocalizeEAString(false, "Gameplay/Objects/CookingObjects/NectarBottle:NectarNameOneFruit", new object[] { str4 }); } else { defaultEntryText = Common.LocalizeEAString(false, "Gameplay/Objects/CookingObjects/NectarBottle:NectarName", new object[] { str4, str5 }); if (defaultEntryText.Length > 0x28) { defaultEntryText = Common.LocalizeEAString(false, "Gameplay/Objects/CookingObjects/NectarBottle:NectarNameOneFruit", new object[] { str4 }); } } msg += "9"; bool nameFound = false; foreach (NectarSkill.NectarBottleInfo info in topNectarsMade) { if (info.mFruitHash == hash) { defaultEntryText = info.mBottleName; nameFound = true; } } msg += "A"; bool promptName = false; string entryKey = "Gameplay/Objects/HobbiesSkills/NectarMaker:"; if (flag) { entryKey = entryKey + "NameBottleDialogJustOneFruit"; } else if (num7 < NectarMaker.kPoorComboThreshold) { entryKey = entryKey + "NameBottleDialogTerribly"; } else if (num7 < NectarMaker.kWellComboThreshold) { entryKey = entryKey + "NameBottleDialogPoor"; } else if (num7 < NectarMaker.kGreatComboThreshold) { entryKey = entryKey + "NameBottleDialogWell"; } else if (num7 < NectarMaker.kAmazingComboThreshold) { entryKey = entryKey + "NameBottleDialogGreat"; promptName = true; } else { entryKey = entryKey + "NameBottleDialogAmazing"; promptName = true; } msg += "B"; string name = defaultEntryText; if (promptName) { if ((!nameFound) && (NRaas.StoryProgression.Main.GetValue <NectarPushScenario.NameGreatNectarOption, bool>())) { name = StringInputDialog.Show(Actor.SimDescription.FullName, Common.LocalizeEAString(entryKey), defaultEntryText, 0x28, StringInputDialog.Validation.ObjectRequireName); } else { List <object> parameters = StoryProgression.Main.Stories.AddGenderNouns(Actor.SimDescription); parameters.Add(defaultEntryText); Common.Notify(Common.Localize("MadeNectar:Results", Actor.IsFemale, parameters.ToArray()), Actor.ObjectId); } } msg += "C"; bool flag2 = false; if (skill != null) { skill.MadeXBottles(numBottles); skill.UsedFruits(fruitsUsed); skill.NectarTypeMade(new NectarSkill.NectarBottleInfo(hash, name, ingredients, (int)baseValue)); flag2 = skill.ReachedMaxLevel(); } msg += "D"; int dateNum = ((int)SimClock.ConvertFromTicks(GameStates.TimeInHomeworld.Ticks, TimeUnit.Weeks)) + 0x1; for (int i = 0x0; i < numBottles; i++) { NectarBottle item = GlobalFunctions.CreateObjectOutOfWorld("NectarBottle", null, new NectarBottleObjectInitParams(hash, name, list2, "Gameplay/Objects/HobbiesSkills/NectarMaker:Weeks", dateNum, baseValue, baseValue, Target.mLastSimToMake, flag2)) as NectarBottle; Target.mBottles.Add(item); EventTracker.SendEvent(EventTypeId.kMadeNectar, Target.mLastSimToMake.CreatedSim, item); } if (Target.mBottles.Count > 0x0) { Target.mCurrentStateMachine.SetActor("nectarBottle", Target.mBottles[0x0]); } msg += "E"; Target.mCurrentStateMachine.RequestState("nectarMaker", "Exit"); Target.mCurrentStateMachine.Dispose(); Target.mCurrentStateMachine = null; Target.mMultiplierFromFeet = 1f; Target.mLastUsedMakeStyle = NectarMaker.MakeNectarStyle.Basic; Target.mLastSimToMake = null; Target.CurrentState = NectarMaker.NectarMakerState.FruitAddable; msg += "F"; } } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, msg, e); } }