public static void AfterMoochMoney(Sim actor, Sim target, float moochSkillPoints, int moochSkillLevel) { try { Skill skill = actor.SkillManager.AddElement(SkillNames.Mooch); if (actor.SimDescription.Child) { skill.AddSkillPointsLevelClamped(moochSkillPoints, TraitTuning.MoochTraitChildSkill); } else if (actor.SimDescription.Teen) { skill.AddSkillPointsLevelClamped(moochSkillPoints, TraitTuning.MoochTraitTeenSkill); } else { skill.AddPoints(moochSkillPoints); } int delta = Mooch.MoochAmounts[moochSkillLevel]; if (RandomUtil.RandomChance01(TraitTuning.MoochTraitMoneyQuadChance)) { delta *= 0x4; } else if (RandomUtil.RandomChance01(TraitTuning.MoochTraitMoneyDoubleChance)) { delta *= 0x2; } delta = (int)(delta * RandomUtil.RandomFloatGaussianDistribution(TraitTuning.MoochTraitMoneyRandomBegin, TraitTuning.MoochTraitMoneyRandomEnd)); NRaas.StoryProgression.Main.Money.AdjustFunds(target.SimDescription, "GiveAway", -delta); NRaas.StoryProgression.Main.Money.AdjustFunds(actor.SimDescription, "GiveAway", delta); actor.ShowTNSIfSelectable(SocialCallback.LocalizeString(actor.IsFemale, "MoochMoney", new object[] { actor, delta, target }), StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, target.ObjectId); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(actor, target, e); } }
public static void OnMoveInWith(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i) { try { bool isFemale = actor.IsFemale && target.IsFemale; if (actor.Household == target.Household) { if (actor.IsSelectable && Household.RoommateManager.IsNPCRoommate(target)) { Household.RoommateManager.MakeRoommateSelectable(target.SimDescription); } if (target.IsSelectable && Household.RoommateManager.IsNPCRoommate(actor)) { Household.RoommateManager.MakeRoommateSelectable(actor.SimDescription); } actor.ShowTNSIfSelectable(SocialCallback.LocalizeString(isFemale, "MarriedSameHousehold", new object[] { actor, target }), StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, actor.ObjectId); } else { int value = RandomUtil.GetInt(MovingSituation.kMarriageGiftAndTaxBenefits[0x0], MovingSituation.kMarriageGiftAndTaxBenefits[0x1]); if (actor.IsSelectable || target.IsSelectable) { MovingDialogEx.Show(new GameplayMovingModelEx(actor, target)); } actor.ModifyFunds(value); actor.ShowTNSIfSelectable(SocialCallback.LocalizeString(isFemale, "MarriedDifferentHouseholds", new object[] { value, actor, target }), StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, actor.ObjectId); } } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(actor, target, e); } }
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 override bool Run() // Run TODO { try { List <Sim> list = new List <Sim>(); foreach (Sim sim in LotManager.Actors) { if (sim.IsNPC && !sim.IsInActiveHousehold && !(sim.Service is GrimReaper)) { list.Add(sim); } } //if (list != null) if (list.Count > 0) { foreach (Sim nlist in list) { nlist.MoveInventoryItemsToAFamilyMember(); nlist.EnableInteractions(); BuffMourning.BuffInstanceMourning buffInstanceMourning; buffInstanceMourning = (nlist.BuffManager.GetElement(BuffNames.Mourning) as BuffMourning.BuffInstanceMourning); if (buffInstanceMourning == null) { nlist.BuffManager.AddElement(BuffNames.Mourning, Origin.FromWitnessingDeath); } buffInstanceMourning = (nlist.BuffManager.GetElement(BuffNames.Mourning) as BuffMourning.BuffInstanceMourning); if (buffInstanceMourning != null) { buffInstanceMourning.MissedSim = Actor.SimDescription; } foreach (Relationship relationship in Relationship.Get(Actor.SimDescription)) { if (Actor.SimDescription.Partner == nlist.SimDescription) { if (relationship.LTR.HasInteractionBit(LongTermRelationship.InteractionBits.Marry)) { relationship.LTR.RemoveInteractionBit(LongTermRelationship.InteractionBits.Marry); relationship.LTR.AddInteractionBit(LongTermRelationship.InteractionBits.Divorce); WeddingAnniversary weddingAnniversary = relationship.WeddingAnniversary; if (weddingAnniversary != null) { AlarmManager.Global.RemoveAlarm(weddingAnniversary.AnniversaryAlarm); relationship.WeddingAnniversary = null; } SocialCallback.BreakUpDescriptionsShared(Actor.SimDescription, nlist.SimDescription); } else if (relationship.LTR.HasInteractionBit(LongTermRelationship.InteractionBits.Propose)) { relationship.LTR.RemoveInteractionBit(LongTermRelationship.InteractionBits.Propose); relationship.LTR.AddInteractionBit(LongTermRelationship.InteractionBits.BreakUp); } else if (relationship.LTR.HasInteractionBit(LongTermRelationship.InteractionBits.MakeCommitment)) { relationship.LTR.RemoveInteractionBit(LongTermRelationship.InteractionBits.MakeCommitment); relationship.LTR.AddInteractionBit(LongTermRelationship.InteractionBits.BreakUp); } Actor.SimDescription.ClearPartner(); } } if (nlist.Occupation != null) { nlist.Occupation.FireSim(false); } } } return(true); } catch (Exception ex) { NiecException.PrintMessage(ex.Message + " " + ex.StackTrace); return(false); } }
public void MaxFeaturedStat(string statId, float value, SocialCallback callback = null, ExecutionContext ctx = null) { }
private static void RunPostWhoohooInternal(Sim actor, Sim target, IGameObject obj, bool fireDisgraceEvents) { SimDescription actorSim = actor.SimDescription; if (!actorSim.HadFirstWooHoo) { actorSim.SetFirstWooHoo(); EventTracker.SendEvent(EventTypeId.kHadFirstWoohoo, actor, target); } Woohooer.Settings.mLastWoohoo[actorSim.SimDescriptionId] = SimClock.CurrentTime(); SimDescription targetSim = target.SimDescription; if (!targetSim.HadFirstWooHoo) { targetSim.SetFirstWooHoo(); EventTracker.SendEvent(EventTypeId.kHadFirstWoohoo, target, actor); } Woohooer.Settings.mLastWoohoo[targetSim.SimDescriptionId] = SimClock.CurrentTime(); Relationship relationship = Relationship.Get(actor, target, true); if (relationship != null) { relationship.LTR.AddInteractionBit(LongTermRelationship.InteractionBits.Kissed); relationship.LTR.AddInteractionBit(LongTermRelationship.InteractionBits.WooHoo); } if ((obj != null) && (obj.LotCurrent.LotType == LotType.Commercial)) { actor.BuffManager.AddElement(BuffNames.PublicWooHoo, Origin.FromWooHooInPublic); target.BuffManager.AddElement(BuffNames.PublicWooHoo, Origin.FromWooHooInPublic); } if (actor.IsHuman) { if (fireDisgraceEvents) { CommonWoohoo.CheckForWitnessedCheating(actor, target, true); } actor.SimDescription.SetFirstKiss(target.SimDescription); target.SimDescription.SetFirstKiss(actor.SimDescription); if (fireDisgraceEvents) { CommonWoohoo.WoohooDisgraceChecks(actor, target); } if ((actor.Household != target.Household) && !Relationship.AreFianceeOrSpouse(actor, target)) { if (Woohooer.Settings.mAllowStrideOfPride) { actor.BuffManager.AddElement(BuffNames.StrideOfPride, Origin.FromWooHooOffHome); target.BuffManager.AddElement(BuffNames.StrideOfPride, Origin.FromWooHooOffHome); } } SocialCallback.AddIncredibleTimeBuffIfNecessary(actor, target); SocialCallback.AddIncredibleTimeBuffIfNecessary(target, actor); } else { EventTracker.SendEvent(EventTypeId.kPetWooHooed, actor, target); EventTracker.SendEvent(EventTypeId.kPetWooHooed, target, actor); if (((actor.Partner == null) && (target.Partner == null)) || (Woohooer.Settings.mForcePetMate[PersistedSettings.GetSpeciesIndex(actor)])) { Relationship.RemoveAllPetMateFlags(actor); Relationship.RemoveAllPetMateFlags(target); Relationship.Get(actor, target, false).LTR.AddInteractionBit(LongTermRelationship.InteractionBits.Marry); } } }
public void SetFeaturedStat(string statId, object value, SocialCallback callback = null, ExecutionContext ctx = null) { }
public void MinFeaturedStat(string statId, long value, SocialCallback callback = null, ExecutionContext ctx = null) { }
protected bool Run(Sim client, Sim solicitor) { bool flag3 = false; ObjectGuid bedId = new ObjectGuid(); #region Initialize relationship data //Increase the relationship for a moment, so sims can relax on the same bed Relationship rRelationship = Relationship.Get(base.Actor, base.Target, true); float originalLTR = 0; Boolean changeLTR = false; Boolean lover = false; Boolean clientHasLFMoodlet = CommonMethods.HasMoodlet(client, BuffNames.LostAFriend, Origin.FromSocialization); Boolean soliciterHasLFMoodlet = CommonMethods.HasMoodlet(solicitor, BuffNames.LostAFriend, Origin.FromSocialization); #endregion try { this.Actor.GreetSimOnMyLotIfPossible(this.Target); if (StartBedCuddleA.GetCuddleType(this.Actor, this.Target) == StartBedCuddleA.CuddleType.CuddleTargetOnDifferentBed) { ChildUtils.SetPosturePrecondition(this, CommodityKind.Relaxing, new CommodityKind[] { CommodityKind.NextToTarget }); this.Actor.InteractionQueue.PushAsContinuation(this, true); return(true); } if (!this.Actor.Posture.Satisfies(CommodityKind.Relaxing, null)) { return(false); } if (!base.SafeToSync()) { return(false); } BedMultiPart bedMultiPart = this.Actor.Posture.Container as BedMultiPart; bedId = bedMultiPart.ObjectId; if (this.IsMaster && this.ReturnInstance == null) { base.EnterStateMachine("BedSocials", "FromRelax", "x", "y"); base.AddPersistentScriptEventHandler(0u, new SacsEventHandler(this.EventCallbackChangeVisibility)); base.SetActor("bed", bedMultiPart); BedData partSimIsIn = bedMultiPart.PartComp.GetPartSimIsIn(this.Actor); partSimIsIn.SetPartParameters(this.mCurrentStateMachine); WooHoo wooHoo = base.InteractionDefinition.CreateInstance(this.Actor, this.Target, base.GetPriority(), false, base.CancellableByPlayer) as WooHoo; wooHoo.IsMaster = false; wooHoo.LinkedInteractionInstance = this; ChildUtils.SetPosturePrecondition(wooHoo, CommodityKind.Relaxing, new CommodityKind[] { CommodityKind.NextToTarget }); this.Target.InteractionQueue.AddNext(wooHoo); if (this.Target.Posture.Container != this.Actor.Posture.Container) { this.Actor.LookAtManager.SetInteractionLookAt(this.Target, 200, LookAtJointFilter.TorsoBones); this.Actor.Posture.CurrentStateMachine.RequestState("x", "callOver"); } this.Actor.SynchronizationLevel = Sim.SyncLevel.Started; this.Actor.SynchronizationTarget = this.Target; this.Actor.SynchronizationRole = Sim.SyncRole.Initiator; if (!base.StartSync(this.IsMaster)) { return(false); } if (!this.Actor.WaitForSynchronizationLevelWithSim(this.Target, Sim.SyncLevel.Routed, 30f)) { return(false); } base.StartSocialContext(); } else { if (!base.StartSync(this.IsMaster)) { return(false); } } base.StandardEntry(false); base.BeginCommodityUpdates(); if (this.IsMaster) { if (!bedMultiPart.InherentlyProvidesPrivacy) { this.mSituation = new WooHoo.WooHooPrivacySituation(this); if (!this.mSituation.Start()) { base.FinishLinkedInteraction(); base.PostLoop(); if (this.ReturnInstance == null) { InteractionInstance instance = BedRelax.Singleton.CreateInstance(this.Actor.Posture.Container, this.Actor, base.GetPriority(), true, true); this.Actor.InteractionQueue.PushAsContinuation(instance, true); } else { base.DoResume(); } WooHoo wooHoo2 = this.LinkedInteractionInstance as WooHoo; if (wooHoo2 != null) { if (this.ReturnInstance == null) { InteractionInstance instance2 = BedRelax.Singleton.CreateInstance(this.Target.Posture.Container, this.Target, base.GetPriority(), true, true); this.Target.InteractionQueue.PushAsContinuation(instance2, true); } else { wooHoo2.DoResume(); } wooHoo2.Failed = true; } base.WaitForSyncComplete(); base.EndCommodityUpdates(false); base.StandardExit(false, false); return(false); } } this.Actor.LookAtManager.ClearInteractionLookAt(); this.Target.LookAtManager.ClearInteractionLookAt(); if (this.ReturnInstance != null) { this.ReturnInstance.EnsureMaster(); this.mCurrentStateMachine = this.ReturnInstance.mCurrentStateMachine; } base.StartSocial(this.SocialName); base.InitiateSocialUI(this.Actor, this.Target); this.Rejected = false; (this.LinkedInteractionInstance as WooHoo).Rejected = this.Rejected; if (this.Rejected) { if (this.Actor.Posture.Container == this.Target.Posture.Container) { ThoughtBalloonManager.BalloonData balloonData = new ThoughtBalloonManager.DoubleBalloonData("balloon_woohoo", "balloon_question"); balloonData.BalloonType = ThoughtBalloonTypes.kSpeechBalloon; this.Actor.ThoughtBalloonManager.ShowBalloon(balloonData); base.AddOneShotScriptEventHandler(404u, new SacsEventHandler(this.ShowRejectBalloonAndEnqueueRouteAway)); this.mCurrentStateMachine.RequestState(false, "x", "WooHooReject"); this.mCurrentStateMachine.RequestState(true, "y", "WooHooReject"); this.mCurrentStateMachine.RequestState(true, null, "ToRelax"); } this.Actor.BuffManager.AddElement(BuffNames.WalkOfShame, Origin.FromRejectedWooHooOffHome); } else { if (this.BabyMade()) { this.mCurrentStateMachine.AddOneShotScriptEventHandler(110u, new SacsEventHandler(this.EventCallbackPlayBabySound)); } this.mCurrentStateMachine.AddOneShotScriptEventHandler(110u, new SacsEventHandler(this.EventCallbackChangeClothes)); string wooHooEffectName = bedMultiPart.TuningBed.WooHooEffectName; if (!string.IsNullOrEmpty(wooHooEffectName)) { this.mWooHooEffect = VisualEffect.Create(wooHooEffectName); this.mWooHooEffect.ParentTo(bedMultiPart, Slots.Hash("_FX_0")); base.AddOneShotScriptEventHandler(200u, new SacsEventHandler(this.EventCallbackWooHoo)); base.AddOneShotScriptEventHandler(201u, new SacsEventHandler(this.EventCallbackWooHoo)); } this.mHelperX = new Sim.SwitchOutfitHelper(this.Actor, Sim.ClothesChangeReason.GoingToBed); this.mHelperY = new Sim.SwitchOutfitHelper(this.Target, Sim.ClothesChangeReason.GoingToBed); this.mHelperX.Start(); this.mHelperY.Start(); this.mJealousyAlarm = AlarmManager.Global.AddAlarm(WooHoo.kJealousyBroadcasterDelay, TimeUnit.Minutes, new AlarmTimerCallback(this.StartJealousyBroadcaster), "StartJealousyBroadcaster", AlarmType.DeleteOnReset, bedMultiPart); bedMultiPart.PreWooHooBehavior(this.Actor, this.Target, this); this.mCurrentStateMachine.RequestState(false, "x", "WooHoo"); this.mCurrentStateMachine.RequestState(true, "y", "WooHoo"); bedMultiPart.PostWooHooBehavior(this.Actor, this.Target, this); Relationship relationship = Relationship.Get(this.Actor, this.Target, true); relationship.STC.Update(this.Actor, this.Target, CommodityTypes.Amorous, WooHoo.kSTCIncreaseAfterWoohoo); InteractionInstance nextInteraction = this.Actor.InteractionQueue.GetNextInteraction(); bool flag = nextInteraction != null; bool flag2 = flag && nextInteraction.PosturePreconditions != null && nextInteraction.PosturePreconditions.ContainsPosture(CommodityKind.Sleeping); nextInteraction = this.Target.InteractionQueue.GetNextInteraction(); flag = (flag || nextInteraction != null); flag2 = (flag2 && nextInteraction != null && nextInteraction.PosturePreconditions != null && nextInteraction.PosturePreconditions.ContainsPosture(CommodityKind.Sleeping)); if ((this.mSituation != null && this.mSituation.SomeoneDidIntrude) || (flag && !flag2)) { this.SleepAfter = false; } else { this.SleepAfter = (BedSleep.CanSleep(this.Actor, true) && BedSleep.CanSleep(this.Target, true)); } (this.LinkedInteractionInstance as WooHoo).SleepAfter = this.SleepAfter; if (this.SleepAfter) { this.mCurrentStateMachine.RequestState(null, "ToSleep"); } else { this.mCurrentStateMachine.RequestState(null, "ToRelax"); bedMultiPart.PartComp.GetPartSimIsIn(this.Actor).BedMade = true; bedMultiPart.PartComp.GetPartSimIsIn(this.Target).BedMade = true; } SocialCallback.RunPostWoohoo(this.Actor, this.Target, bedMultiPart); if (bedMultiPart is BedDoubleHover) { this.Actor.BuffManager.AddElement(BuffNames.MeterHighClub, Origin.FromWooHooOnHoverBed); this.Target.BuffManager.AddElement(BuffNames.MeterHighClub, Origin.FromWooHooOnHoverBed); } } base.FinishSocial(this.SocialName, true); this.CleanupSituation(); this.Actor.AddExitReason(ExitReason.Finished); } else { bedMultiPart = (this.Target.Posture.Container as BedMultiPart); if (bedMultiPart == null) { return(false); } PartComponent <BedData> partComp = bedMultiPart.PartComp; if (partComp.GetSimInOtherPart(this.Target) == null) { BedData otherPart = partComp.GetOtherPart(partComp.GetPartSimIsIn(this.Target)); int num; if (!this.Actor.RouteToSlotListAndCheckInUse(bedMultiPart, otherPart.RoutingSlot, out num)) { this.Actor.AddExitReason(ExitReason.RouteFailed); return(false); } this.Actor.SynchronizationLevel = Sim.SyncLevel.Routed; if (this.Rejected) { this.Actor.PlaySoloAnimation("a2a_bed_relax_cuddle_reject_standing_y", true); this.Actor.RouteAway(WooHoo.kMinDistanceToMoveAwayWhenRejected, WooHoo.kMaxDistanceToMoveAwayWhenRejected, true, new InteractionPriority(InteractionPriorityLevel.Zero), false, true, true, RouteDistancePreference.NoPreference); return(true); } if (!otherPart.RelaxOnBed(this.Actor, "Enter_BedRelax_" + otherPart.StateNameSuffix)) { return(false); } } else { this.Actor.SynchronizationLevel = Sim.SyncLevel.Routed; } base.DoLoop(ExitReason.Default); if (!this.Actor.HasExitReason(ExitReason.Finished)) { base.PostLoop(); base.WaitForMasterInteractionToFinish(); } } base.PostLoop(); base.WaitForSyncComplete(); flag3 = true;// !this.Failed && !this.Rejected; base.EndCommodityUpdates(flag3); base.StandardExit(false, false); if (flag3) { VisitSituation visitSituation = VisitSituation.FindVisitSituationInvolvingGuest(this.Actor); VisitSituation visitSituation2 = VisitSituation.FindVisitSituationInvolvingGuest(this.Target); if (visitSituation != null && visitSituation2 != null) { visitSituation.GuestStartingInappropriateAction(this.Actor, 3.5f); visitSituation2.GuestStartingInappropriateAction(this.Target, 3.5f); } } if (flag3 && this.SleepAfter) { bedMultiPart.GetPartContaining(this.Actor).StateMachine = null; if (!this.Actor.InteractionQueue.HasInteractionOfType(BedSleep.Singleton)) { InteractionInstance instance3 = BedSleep.Singleton.CreateInstance(bedMultiPart, this.Actor, base.GetPriority(), base.Autonomous, base.CancellableByPlayer); this.Actor.InteractionQueue.PushAsContinuation(instance3, true); } VisitSituation visitSituation3 = VisitSituation.FindVisitSituationInvolvingGuest(this.Target); if (visitSituation3 != null && this.Actor.IsAtHome) { SocialCallback.OnStayOver(this.Actor, this.Target, false); } else { visitSituation3 = VisitSituation.FindVisitSituationInvolvingGuest(this.Actor); if (visitSituation3 != null && this.Target.IsAtHome) { SocialCallback.OnStayOver(this.Target, this.Actor, false); } } } } catch (Exception ex) { StyledNotification.Show(new StyledNotification.Format(ex.ToString(), StyledNotification.NotificationStyle.kGameMessageNegative)); } finally { try { if (flag3) { #region Ge Payed and such CommonMethods.HandlePostWoohoo(client, solicitor, bedId); #endregion } #region Restore LTR if (rRelationship != null && changeLTR) { rRelationship.LTR.SetLiking(originalLTR); //Remove the lost friend moodlets if we didn't have them before, but have them now if (!clientHasLFMoodlet && CommonMethods.HasMoodlet(client, BuffNames.LostAFriend, Origin.FromSocialization)) { client.BuffManager.RemoveElement(BuffNames.LostAFriend); } if (!soliciterHasLFMoodlet && CommonMethods.HasMoodlet(solicitor, BuffNames.LostAFriend, Origin.FromSocialization)) { solicitor.BuffManager.RemoveElement(BuffNames.LostAFriend); } //If we were not lovers, before but are now, remove the icon if (lover) { rRelationship.LTR.RemoveInteractionBit(LongTermRelationship.InteractionBits.Romantic); } } } catch (Exception ex) { StyledNotification.Show(new StyledNotification.Format("finally: " + ex.Message, StyledNotification.NotificationStyle.kGameMessageNegative)); } #endregion } return(flag3); }
public void StopAchievements(SocialCallback callback = null, ExecutionContext ctx = null) { _manager.StopAchievements(callback, ctx); }
public void StopAchievements(SocialCallback callback = null, ExecutionContext ctx = null) { }
public static void OnMarried(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i) { try { string failReason = null; if ((actor.Household == target.Household) || (!MovingSituation.MovingInProgress && ((Household.ActiveHousehold == null) || InWorldSubState.IsEditTownValid(Household.ActiveHousehold.LotHome, ref failReason)))) { Sim actorSim; Sim targetSim; BuffManager actorBuffManager = actor.BuffManager; BuffManager targetBuffManager = target.BuffManager; actorBuffManager.AddElement(BuffNames.JustMarried, Origin.FromSocialization); targetBuffManager.AddElement(BuffNames.JustMarried, Origin.FromSocialization); BuffJustMarried.BuffInstanceJustMarried element = actorBuffManager.GetElement(BuffNames.JustMarried) as BuffJustMarried.BuffInstanceJustMarried; if (element != null) { element.CreateGiftAlarm(actorBuffManager); } actorBuffManager.RemoveElement(BuffNames.NewlyEngaged); actorBuffManager.RemoveElement(BuffNames.ParentsBlessing); targetBuffManager.RemoveElement(BuffNames.NewlyEngaged); targetBuffManager.RemoveElement(BuffNames.ParentsBlessing); ActiveTopic.AddToSim(actor, "Wedding"); ActiveTopic.AddToSim(target, "Wedding"); Relationship relationship = Relationship.Get(actor, target, true); relationship.LTR.RemoveInteractionBit(LongTermRelationship.InteractionBits.Divorce); relationship.LTR.AddInteractionBit(LongTermRelationship.InteractionBits.Marry); if (actor.IsNPC && !target.IsNPC) { actorSim = target; targetSim = actor; } else if (!actor.IsNPC && target.IsNPC) { actorSim = actor; targetSim = target; } else { SimDescription proposerDesc = relationship.ProposerDesc; actorSim = (proposerDesc == null) ? null : proposerDesc.CreatedSim; if (actorSim == null) { if (RandomUtil.CoinFlip()) { actorSim = actor; } else { actorSim = target; } } targetSim = target; if (actorSim == target) { targetSim = actor; } } SocialCallback.GiveDaysOffIfRequired(actorSim, targetSim); MidlifeCrisisManager.OnBecameMarried(actor.SimDescription, target.SimDescription); relationship.SetMarriedInGame(); if (SeasonsManager.Enabled) { relationship.WeddingAnniversary = new WeddingAnniversary(SeasonsManager.CurrentSeason, (int)SeasonsManager.DaysElapsed); relationship.WeddingAnniversary.SimA = relationship.SimDescriptionA; relationship.WeddingAnniversary.SimB = relationship.SimDescriptionB; relationship.WeddingAnniversary.CreateAlarm(); } if (sStoryProgressionHandleMarriageName.Valid) { sStoryProgressionHandleMarriageName.Invoke <bool>(new object[] { actorSim.SimDescription, targetSim.SimDescription }); } else { targetSim.SimDescription.LastName = actorSim.SimDescription.LastName; foreach (Genealogy genealogy in targetSim.Genealogy.Children) { SimDescription simDescription = genealogy.SimDescription; if (((simDescription != null) && simDescription.TeenOrBelow) && (simDescription.CreatedSim != null)) { simDescription.LastName = actorSim.SimDescription.LastName; } } } actor.Genealogy.Marry(target.Genealogy); OnMoveInWith(actor, target, interaction, topic, i); SocialCallback.EndServiceForActor(actor); SocialCallback.EndServiceForActor(target); actorBuffManager.RemoveElement(BuffNames.MissedWedding); targetBuffManager.RemoveElement(BuffNames.MissedWedding); } } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(actor, target, e); } }
public void SetFeaturedStat(string statId, object value, SocialCallback onResult = null, ExecutionContext ctx = null) { _manager.SetFeaturedStat(statId, value, onResult, ctx); }
public void IncrementFeaturedStat(string statId, long value, SocialCallback onResult = null, ExecutionContext ctx = null) { _manager.IncrementFeaturedStat(statId, value, onResult, ctx); }
public void SetPresence(string presenceId, SocialCallback onResult = null, ExecutionContext ctx = null) { _manager.SetPresence(presenceId, onResult, ctx); }
public void AchievementIncrementByTag(string achievementTag, uint value = 1, SocialCallback onResult = null, ExecutionContext ctx = null) { _manager.AchievementIncrementByTag(achievementTag, value, onResult, ctx); }
public void StopFeaturedStats(SocialCallback callback = null, ExecutionContext ctx = null) { _manager.StopFeaturedStats(callback, ctx); }
public override bool Run() { try { Actor.GreetSimOnMyLotIfPossible(Target); if (StartBedCuddleA.GetCuddleType(Actor, Target) == StartBedCuddleA.CuddleType.CuddleTargetOnDifferentBed) { ChildUtils.SetPosturePrecondition(this, CommodityKind.Relaxing, new CommodityKind[] { CommodityKind.NextToTarget }); Actor.InteractionQueue.PushAsContinuation(this, true); return(true); } BedMultiPart container = null; try { if (Actor.Posture == null) { return(false); } if (!Actor.Posture.Satisfies(CommodityKind.Relaxing, null)) { return(false); } if (!SafeToSync()) { return(false); } container = Actor.Posture.Container as BedMultiPart; if (container == null) { return(false); } if (IsMaster && ReturnInstance == null) { EnterStateMachine("BedSocials", "FromRelax", "x", "y"); AddPersistentScriptEventHandler(0x0, EventCallbackChangeVisibility); SetActor("bed", container); container.PartComp.GetPartSimIsIn(Actor).SetPartParameters(mCurrentStateMachine); WooHoo interaction = InteractionDefinition.CreateInstance(Actor, Target, GetPriority(), false, CancellableByPlayer) as WooHoo; interaction.IsMaster = false; interaction.LinkedInteractionInstance = this; ChildUtils.SetPosturePrecondition(interaction, CommodityKind.Relaxing, new CommodityKind[] { CommodityKind.NextToTarget }); Target.InteractionQueue.AddNext(interaction); if (Target.Posture.Container != Actor.Posture.Container) { Actor.LookAtManager.SetInteractionLookAt(Target, 0xc8, LookAtJointFilter.TorsoBones); Actor.Posture.CurrentStateMachine.RequestState("x", "callOver"); } Actor.SynchronizationLevel = Sim.SyncLevel.Started; Actor.SynchronizationTarget = Target; Actor.SynchronizationRole = Sim.SyncRole.Initiator; if (!StartSync(IsMaster)) { return(false); } if (!Actor.WaitForSynchronizationLevelWithSim(Target, Sim.SyncLevel.Routed, 30f)) { return(false); } Actor.SocialComponent.StartSocializingWith(Target); } else if (!StartSync(IsMaster)) { return(false); } } catch (ResetException) { throw; } catch (Exception e) { Common.DebugException(Actor, Target, e); return(false); } StandardEntry(false); BeginCommodityUpdates(); bool succeeded = false; try { if (IsMaster) { if (CommonWoohoo.NeedPrivacy(container.InherentlyProvidesPrivacy, Actor, Target)) { mSituation = new WooHooPrivacySituation(this); if (!mSituation.Start()) { FinishLinkedInteraction(); PostLoop(); if (ReturnInstance == null) { InteractionInstance instance = BedRelax.Singleton.CreateInstance(Actor.Posture.Container, Actor, GetPriority(), true, true); Actor.InteractionQueue.PushAsContinuation(instance, true); } else { DoResume(); } WooHoo linkedInteractionInstance = LinkedInteractionInstance as WooHoo; if (linkedInteractionInstance != null) { if (ReturnInstance == null) { InteractionInstance instance2 = BedRelax.Singleton.CreateInstance(Target.Posture.Container, Target, GetPriority(), true, true); Target.InteractionQueue.PushAsContinuation(instance2, true); } else { linkedInteractionInstance.DoResume(); } linkedInteractionInstance.Failed = true; } WaitForSyncComplete(); return(false); } } IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition; Actor.LookAtManager.ClearInteractionLookAt(); Target.LookAtManager.ClearInteractionLookAt(); if (ReturnInstance != null) { ReturnInstance.EnsureMaster(); mCurrentStateMachine = ReturnInstance.mCurrentStateMachine; } StartSocial(CommonSurrogate.GetSocialName(definition.GetStyle(this))); InitiateSocialUI(Actor, Target); WooHoo linked = LinkedInteractionInstance as WooHoo; if (linked != null) { linked.Rejected = Rejected; } if (Rejected) { if (Actor.Posture.Container == Target.Posture.Container) { ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.DoubleBalloonData("balloon_woohoo", "balloon_question"); bd.BalloonType = ThoughtBalloonTypes.kSpeechBalloon; Actor.ThoughtBalloonManager.ShowBalloon(bd); AddOneShotScriptEventHandler(0x194, ShowRejectBalloonAndEnqueueRouteAway); mCurrentStateMachine.RequestState(false, "x", "WooHooReject"); mCurrentStateMachine.RequestState(true, "y", "WooHooReject"); mCurrentStateMachine.RequestState(true, null, "ToRelax"); } } else { mCurrentStateMachine.AddOneShotScriptEventHandler(0x6e, OnPregnancyEvent); mCurrentStateMachine.AddOneShotScriptEventHandler(0x6e, EventCallbackChangeClothes); string wooHooEffectName = container.TuningBed.WooHooEffectName; if (!string.IsNullOrEmpty(wooHooEffectName)) { mWooHooEffect = VisualEffect.Create(wooHooEffectName); mWooHooEffect.ParentTo(container, Slots.Hash("_FX_0")); AddOneShotScriptEventHandler(0xc8, EventCallbackWooHoo); AddOneShotScriptEventHandler(0xc9, EventCallbackWooHoo); } if (container is BedDreamPod) { AddOneShotScriptEventHandler(0xc8, EventCallbackDreamPodWooHoo); AddOneShotScriptEventHandler(0xc9, EventCallbackDreamPodWooHoo); } Sim.ClothesChangeReason reason = Sim.ClothesChangeReason.GoingToBed; if ((Woohooer.Settings.mNakedOutfitBed) && (!container.IsOutside)) { reason = Sim.ClothesChangeReason.GoingToBathe; Woohooer.Settings.AddChange(Actor); Woohooer.Settings.AddChange(Target); } mHelperX = new Sim.SwitchOutfitHelper(Actor, reason); mHelperY = new Sim.SwitchOutfitHelper(Target, reason); mHelperX.Start(); mHelperY.Start(); mJealousyAlarm = AlarmManager.Global.AddAlarm(kJealousyBroadcasterDelay, TimeUnit.Minutes, StartJealousyBroadcaster, "StartJealousyBroadcaster", AlarmType.DeleteOnReset, container); container.PreWooHooBehavior(Actor, Target, this); mCurrentStateMachine.RequestState(false, "x", "WooHoo"); mCurrentStateMachine.RequestState(true, "y", "WooHoo"); container.PostWooHooBehavior(Actor, Target, this); Relationship.Get(Actor, Target, true).STC.Update(Actor, Target, CommodityTypes.Amorous, kSTCIncreaseAfterWoohoo); if (CanSleep(Actor, container)) { SleepAfter = true; } else { SleepAfter = false; container.PartComp.GetPartSimIsIn(Actor).BedMade = true; } if (CanSleep(Target, container)) { (LinkedInteractionInstance as WooHoo).SleepAfter = true; } else { (LinkedInteractionInstance as WooHoo).SleepAfter = false; container.PartComp.GetPartSimIsIn(Target).BedMade = true; } /* * if (SleepAfter) * { * mCurrentStateMachine.RequestState(null, "ToSleep"); * } * else*/ { mCurrentStateMachine.RequestState(null, "ToRelax"); } CommonWoohoo.RunPostWoohoo(Actor, Target, container, definition.GetStyle(this), definition.GetLocation(container), true); if (container is BedDoubleHover) { Actor.BuffManager.AddElement(BuffNames.MeterHighClub, Origin.FromWooHooOnHoverBed); Target.BuffManager.AddElement(BuffNames.MeterHighClub, Origin.FromWooHooOnHoverBed); } if (container is BedDreamPod) { Actor.BuffManager.AddElement(BuffNames.DoubleDreaming, Origin.FromWooHooInDreamPod); Target.BuffManager.AddElement(BuffNames.DoubleDreaming, Origin.FromWooHooInDreamPod); } } FinishSocial(CommonSurrogate.GetSocialName(definition.GetStyle(this)), true); CleanupSituation(); Actor.AddExitReason(ExitReason.Finished); } else { container = Target.Posture.Container as BedMultiPart; if (container == null) { return(false); } PartComponent <BedData> partComp = container.PartComp; if (partComp.GetSimInOtherPart(Target) == null) { int num; BedData otherPart = partComp.GetOtherPart(partComp.GetPartSimIsIn(Target)); if (!Actor.RouteToSlotListAndCheckInUse(container, otherPart.RoutingSlot, out num)) { Actor.AddExitReason(ExitReason.RouteFailed); return(false); } Actor.SynchronizationLevel = Sim.SyncLevel.Routed; if (Rejected) { Actor.PlaySoloAnimation("a2a_bed_relax_cuddle_reject_standing_y", true); Actor.RouteAway(kMinDistanceToMoveAwayWhenRejected, kMaxDistanceToMoveAwayWhenRejected, true, new InteractionPriority(InteractionPriorityLevel.Zero), false, true, true, RouteDistancePreference.NoPreference); return(true); } if (!otherPart.RelaxOnBed(Actor, "Enter_BedRelax_" + otherPart.StateNameSuffix)) { return(false); } } else { Actor.SynchronizationLevel = Sim.SyncLevel.Routed; } DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); if (!Actor.HasExitReason(ExitReason.Finished)) { PostLoop(); WaitForMasterInteractionToFinish(); } } PostLoop(); WaitForSyncComplete(); succeeded = !Failed && !Rejected; } finally { EndCommodityUpdates(succeeded); StandardExit(false, false); } if (succeeded) { VisitSituation situation = VisitSituation.FindVisitSituationInvolvingGuest(Actor); VisitSituation situation2 = VisitSituation.FindVisitSituationInvolvingGuest(Target); if (situation != null && situation2 != null) { situation.GuestStartingInappropriateAction(Actor, 3.5f); situation2.GuestStartingInappropriateAction(Target, 3.5f); } } if (succeeded && SleepAfter) { if (!Actor.InteractionQueue.HasInteractionOfType(BedSleep.Singleton)) { InteractionInstance instance = BedSleep.Singleton.CreateInstance(container, Actor, GetPriority(), Autonomous, CancellableByPlayer); Actor.InteractionQueue.PushAsContinuation(instance, true); } if (VisitSituation.FindVisitSituationInvolvingGuest(Target) != null && Actor.IsAtHome) { SocialCallback.OnStayOver(Actor, Target, false); } else if (VisitSituation.FindVisitSituationInvolvingGuest(Actor) != null && Target.IsAtHome) { SocialCallback.OnStayOver(Target, Actor, false); } } else if (!IsOwner(Actor, container)) { InteractionInstance instance = Actor.Posture.GetStandingTransition(); if (instance != null) { Actor.InteractionQueue.Add(instance); } } return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Woohooer.Settings.AddChange(Actor); Woohooer.Settings.AddChange(Target); Common.Exception(Actor, Target, e); return(false); } }
public void StartAchievements(SocialCallback onResult = null, ExecutionContext ctx = null) { _manager.StartAchievements(onResult, ctx); }
public bool BumpToHighestState(Common.IStatGenerator stats, SimDescription a, SimDescription b) { while (BumpToHigherState(stats, a, b)) { ; } if ((!a.IsMarried) && (!b.IsMarried)) { IncStat("BumpUp: Not Married"); stats.IncStat("BumpUp: Not Married"); return(false); } if (a.CreatedSim != null) { a.CreatedSim.BuffManager.AddElement(BuffNames.JustMarried, Origin.FromSocialization); a.CreatedSim.BuffManager.RemoveElement(BuffNames.NewlyEngaged); ActiveTopic.AddToSim(a.CreatedSim, "Wedding"); } if (b.CreatedSim != null) { b.CreatedSim.BuffManager.AddElement(BuffNames.JustMarried, Origin.FromSocialization); b.CreatedSim.BuffManager.RemoveElement(BuffNames.NewlyEngaged); ActiveTopic.AddToSim(b.CreatedSim, "Wedding"); } if ((a.CreatedSim != null) && (b.CreatedSim != null)) { SocialCallback.GiveDaysOffIfRequired(a.CreatedSim, b.CreatedSim); } a.Genealogy.Marry(b.Genealogy); Relationship relationship = ManagerSim.GetRelationship(a, b); if (relationship != null) { MidlifeCrisisManager.OnBecameMarried(a, b); relationship.LTR.RemoveInteractionBit(LongTermRelationship.InteractionBits.Divorce); relationship.LTR.AddInteractionBit(LongTermRelationship.InteractionBits.Marry); relationship.SetMarriedInGame(); if (SeasonsManager.Enabled) { relationship.WeddingAnniversary = new WeddingAnniversary(SeasonsManager.CurrentSeason, (int)SeasonsManager.DaysElapsed); relationship.WeddingAnniversary.SimA = relationship.SimDescriptionA; relationship.WeddingAnniversary.SimB = relationship.SimDescriptionB; relationship.WeddingAnniversary.CreateAlarm(); } return(true); } else { IncStat("BumpUp: Relation Fail"); stats.IncStat("BumpUp: Relation Fail"); return(false); } }
public void MaxFeaturedStat(string statId, float value, SocialCallback onResult = null, ExecutionContext ctx = null) { _manager.MaxFeaturedStat(statId, value, onResult, ctx); }
public void StopFeaturedStats(SocialCallback callback = null, ExecutionContext ctx = null) { }
public void StartFeaturedStats(SocialCallback onResult = null, ExecutionContext ctx = null) { _manager.StartFeaturedStats(onResult, ctx); }
public override string GetInteractionName(Sim actor, ToiletStall target, InteractionObjectPair iop) { return(SocialCallback.PartyAnimalFunction(null, actor, null, null)); }
public void AchievementIncrementByTag(string achievementTag, uint value = 1, SocialCallback callback = null, ExecutionContext ctx = null) { }
public override bool Run() { try { if (!SafeToSync()) { Common.Notify("Fail D"); return(false); } IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition; if (LinkedInteractionInstance == null) { HotairBalloon.WooHooSocial entry = definition.ProxyClone(Target).CreateInstance(Actor, Target, GetPriority(), Autonomous, CancellableByPlayer) as HotairBalloon.WooHooSocial; if (entry == null) { Common.Notify("Fail A"); return(false); } entry.mIsSocialTarget = true; LinkedInteractionInstance = entry; Target.InteractionQueue.AddNext(entry); } HotairBalloon.InBalloonPosture posture = Actor.Posture as HotairBalloon.InBalloonPosture; if (posture == null) { Common.Notify("Fail B"); return(false); } if (!StartSync(!mIsSocialTarget)) { Common.Notify("Fail C"); return(false); } StandardEntry(); BeginCommodityUpdates(); if (mIsSocialTarget) { DoLoop(ExitReason.Finished); } else { StartSocial(CommonWoohoo.GetSocialName(definition.GetStyle(this), Actor)); Animation.ForceAnimation(Actor.ObjectId, true); Animation.ForceAnimation(Target.ObjectId, true); if (Rejected) { Target.Posture.CurrentStateMachine.RequestState(true, "x", "ToFromSocial"); posture.CurrentStateMachine.RequestState(true, "x", "ToFromSocial"); posture.CurrentStateMachine.SetActor("y", Target); CreateProps(posture.CurrentStateMachine); posture.CurrentStateMachine.SetParameter("XSimR", posture.IsXActor ? YesOrNo.no : YesOrNo.yes); posture.CurrentStateMachine.EnterState("x", "EnterSocial"); posture.CurrentStateMachine.EnterState("y", "EnterSocial"); ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.DoubleBalloonData("balloon_woohoo", "balloon_question"); bd.BalloonType = ThoughtBalloonTypes.kSpeechBalloon; Actor.ThoughtBalloonManager.ShowBalloon(bd); posture.CurrentStateMachine.RequestState(false, "y", "woohoo rejected"); posture.CurrentStateMachine.RequestState(true, "x", "woohoo rejected"); bd = new ThoughtBalloonManager.BalloonData("balloon_woohoo"); bd.BalloonType = ThoughtBalloonTypes.kSpeechBalloon; bd.LowAxis = ThoughtBalloonAxis.kDislike; Target.ThoughtBalloonManager.ShowBalloon(bd); posture.CurrentStateMachine.RequestState(false, "y", "ExitSocial"); posture.CurrentStateMachine.RequestState(true, "x", "ExitSocial"); posture.CurrentStateMachine.RemoveActor(Target); Target.Posture.CurrentStateMachine.EnterState("x", "ToFromSocial"); posture.CurrentStateMachine.EnterState("x", "ToFromSocial"); Target.Posture.CurrentStateMachine.EnterState("x", "IdleStand"); posture.CurrentStateMachine.EnterState("x", "IdleStand"); Actor.GetRelationship(Target, true).LTR.UpdateLiking(HotairBalloon.kWoohooRejectLtrChange); SocialComponent.SetSocialFeedbackForActorAndTarget(CommodityTypes.Friendly, Actor, Target, false, 0x0, LongTermRelationshipTypes.Undefined, LongTermRelationshipTypes.Undefined); SocialCallback.AddRejectedByEx(Actor, Target, GetInteractionName(), null, this); } else { switch (posture.Balloon.mCurrentHeight) { case HotairBalloon.BalloonHeight.OnGround: posture.CurrentStateMachine.SetParameter("Height", SkillLevel.poor); break; case HotairBalloon.BalloonHeight.Height1: posture.CurrentStateMachine.SetParameter("Height", SkillLevel.novice); break; } Sim actor = posture.IsXActor ? Actor : Target; Sim sim2 = posture.IsXActor ? Target : Actor; actor.Posture.CurrentStateMachine.RequestState(true, "x", "ToFromSocial"); sim2.Posture.CurrentStateMachine.RequestState(true, "x", "ToFromSocial"); sim2.Posture.CurrentStateMachine.SetActor("y", actor); CreateProps(sim2.Posture.CurrentStateMachine); sim2.Posture.CurrentStateMachine.EnterState("x", "EnterSocial"); sim2.Posture.CurrentStateMachine.EnterState("y", "EnterSocial"); ThoughtBalloonManager.BalloonData data2 = new ThoughtBalloonManager.DoubleBalloonData("balloon_woohoo", "balloon_question"); data2.BalloonType = ThoughtBalloonTypes.kSpeechBalloon; Actor.ThoughtBalloonManager.ShowBalloon(data2); sim2.Posture.CurrentStateMachine.RequestState(false, "y", "woohoo"); sim2.Posture.CurrentStateMachine.RequestState(true, "x", "woohoo"); sim2.Posture.CurrentStateMachine.RequestState(false, "y", "ExitSocial"); sim2.Posture.CurrentStateMachine.RequestState(true, "x", "ExitSocial"); sim2.Posture.CurrentStateMachine.RemoveActor(actor); actor.Posture.CurrentStateMachine.EnterState("x", "ToFromSocial"); sim2.Posture.CurrentStateMachine.EnterState("x", "ToFromSocial"); Relationship relationship = Actor.GetRelationship(Target, true); relationship.STC.Update(Actor, Target, CommodityTypes.Amorous, HotairBalloon.kSTCIncreaseAfterWoohoo); relationship.LTR.UpdateLiking(-HotairBalloon.kWoohooRejectLtrChange); CommonWoohoo.RunPostWoohoo(Actor, Target, posture.Balloon, definition.GetStyle(this), definition.GetLocation(posture.Balloon), true); if (CommonPregnancy.IsSuccess(Actor, Target, Autonomous, definition.GetStyle(this))) { CommonPregnancy.Impregnate(Actor, Target, Autonomous, definition.GetStyle(this)); } actor.Posture.CurrentStateMachine.EnterState("x", "IdleStand"); sim2.Posture.CurrentStateMachine.EnterState("x", "IdleStand"); Actor.BuffManager.AddElement((BuffNames)(0x9a7f5f1919df0036L), Origin.None); Target.BuffManager.AddElement((BuffNames)(0x9a7f5f1919df0036L), Origin.None); } FinishSocial(CommonWoohoo.GetSocialName(definition.GetStyle(this), Actor), Rejected); Target.AddExitReason(ExitReason.Finished); } FinishLinkedInteraction(mIsSocialTarget); EndCommodityUpdates(Rejected); StandardExit(); WaitForSyncComplete(); posture.Balloon.PushIdleInteractionOnSim(Actor); return(true); } catch (ResetException) { throw; } catch (Exception exception) { Woohooer.Settings.AddChange(Actor); Woohooer.Settings.AddChange(Target); Common.Exception(Actor, Target, exception); return(false); } }
public void SetPresence(string presenceId, SocialCallback callback = null, ExecutionContext ctx = null) { }