public override bool InRabbitHole() { try { ActiveStage.Start(); SimDescription choice = null; if (mMaster) { if (!AcceptCancelDialog.Show(Common.Localize("Rendezvous:Prompt", Actor.IsFemale, new object[] { KamaSimtra.Settings.mRendezvousCostPerLevel }))) { return(false); } Dictionary <int, List <SimDescription> > potentials = KamaSimtra.GetPotentials(Woohooer.Settings.AllowTeen(true)); List <SimDescription> choices = new List <SimDescription>(); for (int i = 1; i <= 10; i++) { List <SimDescription> fullList; if (!potentials.TryGetValue(i, out fullList)) { continue; } bool needFemale = false; if (Actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Male)) { if (Actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Female)) { if (RandomUtil.CoinFlip()) { needFemale = true; } } else { needFemale = false; } } else if (Actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Female)) { needFemale = true; } else { needFemale = !Actor.IsFemale; } List <SimDescription> randomList = new List <SimDescription>(); foreach (SimDescription sim in fullList) { if (sim.IsFemale != needFemale) { continue; } if (sim.Household == Actor.Household) { continue; } string reason; GreyedOutTooltipCallback callback = null; if (!CommonSocials.CanGetRomantic(Actor.SimDescription, sim, false, true, true, ref callback, out reason)) { if (callback != null) { Common.DebugNotify(sim.FullName + Common.NewLine + callback()); } continue; } if (choices.Contains(sim)) { continue; } randomList.Add(sim); } if (randomList.Count > 0) { choices.Add(RandomUtil.GetRandomObjectFromList(randomList)); } } if (choices.Count == 0) { Common.Notify(Common.Localize("Rendezvous:NoneAvailable", Actor.IsFemale)); return(false); } choice = new SimSelection(Common.Localize("Rendezvous:MenuName"), Actor.SimDescription, choices, SimSelection.Type.Rendezvous, -1000).SelectSingle(); if (choice == null) { Common.Notify(Common.Localize("Rendezvous:NoSelect", Actor.IsFemale)); return(false); } if (Instantiation.PerformOffLot(choice, Target.LotCurrent, null) == null) { Common.Notify(Common.Localize("Rendezvous:BadSim", Actor.IsFemale, new object[] { choice })); return(false); } Rendezvous interaction = Singleton.CreateInstance(Target, choice.CreatedSim, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true) as Rendezvous; interaction.mMaster = false; interaction.LinkedInteractionInstance = this; choice.CreatedSim.InteractionQueue.CancelAllInteractions(); if (!choice.CreatedSim.InteractionQueue.AddNext(interaction)) { Common.Notify(Common.Localize("Rendezvous:BadSim", Actor.IsFemale, new object[] { choice })); return(false); } if (!DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), WaitPeriodLoop, null)) { Common.Notify(Common.Localize("Rendezvous:BadSim", Actor.IsFemale, new object[] { choice })); return(false); } if (!mBegin) { Common.Notify(Common.Localize("Rendezvous:BadSim", Actor.IsFemale, new object[] { choice })); return(false); } else { Actor.ClearExitReasons(); TimedStage stage = new TimedStage(GetInteractionName(), KamaSimtra.Settings.mRendezvousDuration, false, false, true); Stages = new List <Stage>(new Stage[] { stage }); ActiveStage = stage; ActiveStage.Start(); } } else { Rendezvous interaction = LinkedInteractionInstance as Rendezvous; if (interaction == null) { return(false); } interaction.mBegin = true; } if (mMaster) { if (!CelebrityManager.TryModifyFundsWithCelebrityDiscount(Actor, Target, KamaSimtra.Settings.mRendezvousCostPerLevel * choice.SkillManager.GetSkillLevel(KamaSimtra.StaticGuid), true)) { Common.Notify(Common.Localize("Rendezvous:CannotPay", Actor.IsFemale)); return(false); } Common.Notify(choice.CreatedSim, Common.Localize("Rendezvous:Success", Actor.IsFemale, choice.IsFemale, new object[] { choice })); KamaSimtra skill = KamaSimtra.EnsureSkill(Actor); if (skill != null) { skill.RendezvousActive = true; } } BeginCommodityUpdates(); bool succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); EndCommodityUpdates(succeeded); if (KamaSimtra.Settings.mRandomRendezvousMoodlet) { Actor.BuffManager.AddElement(RandomUtil.GetRandomObjectFromList(sRandomBuffs), WoohooBuffs.sWoohooOrigin); } if (mMaster) { CommonWoohoo.WoohooLocation location = CommonWoohoo.WoohooLocation.RabbitHole; List <WoohooLocationControl> choices = CommonWoohoo.GetValidLocations(Actor.SimDescription); if (choices.Count > 0) { location = RandomUtil.GetRandomObjectFromList(choices).Location; } CommonWoohoo.RunPostWoohoo(Actor, choice.CreatedSim, Target, CommonWoohoo.WoohooStyle.Safe, location, false); } return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
protected static Dictionary <int, SimDescription> GetPotentials(Sim actor) { CASAgeGenderFlags allow = CASAgeGenderFlags.None; if ((actor.SimDescription.Teen && Woohooer.Settings.AllowTeen(true)) || (actor.SimDescription.YoungAdultOrAbove && Woohooer.Settings.AllowTeenAdult(true))) { allow |= CASAgeGenderFlags.Teen; } if (actor.SimDescription.Teen && Woohooer.Settings.AllowTeen(true) && Woohooer.Settings.AllowTeenAdult(true)) { allow |= CASAgeGenderFlags.YoungAdult | CASAgeGenderFlags.Adult | CASAgeGenderFlags.Elder; } if (actor.SimDescription.YoungAdultOrAbove) { allow |= CASAgeGenderFlags.YoungAdult | CASAgeGenderFlags.Adult | CASAgeGenderFlags.Elder; } Dictionary <int, List <SimDescription> > potentials = KamaSimtra.GetPotentials(allow, true); Dictionary <int, SimDescription> choices = new Dictionary <int, SimDescription>(); for (int i = 1; i <= 10; i++) { List <SimDescription> fullList; if (!potentials.TryGetValue(i, out fullList)) { continue; } bool needFemale = false; if (actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Male)) { if (actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Female)) { if (RandomUtil.CoinFlip()) { needFemale = true; } } else { needFemale = false; } } else if (actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Female)) { needFemale = true; } else { needFemale = !actor.IsFemale; } List <SimDescription> randomList = new List <SimDescription>(); foreach (SimDescription sim in fullList) { if (sim.IsFemale != needFemale) { continue; } if (sim.Household == actor.Household) { continue; } string reason; GreyedOutTooltipCallback callback = null; if (!CommonSocials.CanGetRomantic(actor.SimDescription, sim, false, true, true, ref callback, out reason)) { if (callback != null) { Common.Notify(sim.FullName + Common.NewLine + callback()); } continue; } if (choices.ContainsValue(sim)) { continue; } randomList.Add(sim); } if (randomList.Count > 0) { choices.Add(i, RandomUtil.GetRandomObjectFromList(randomList)); } } return(choices); }