コード例 #1
0
        public static WoohooLocationControl GetControl(CommonWoohoo.WoohooLocation location)
        {
            if (sControls == null)
            {
                sControls = new Dictionary <CommonWoohoo.WoohooLocation, WoohooLocationControl>();

                foreach (WoohooLocationControl control in Common.DerivativeSearch.Find <WoohooLocationControl>())
                {
                    sControls.Add(control.Location, control);
                }
            }

            WoohooLocationControl result;

            if (sControls.TryGetValue(location, out result))
            {
                return(result);
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
 public static void RunPostWoohoo(Sim actor, Sim target, IGameObject obj, CommonWoohoo.WoohooStyle style, CommonWoohoo.WoohooLocation location, bool fireDisgraceEvents)
 {
     EventTracker.SendEvent(new NRaasWooHooEvent(EventTypeId.kWooHooed, actor, target, obj, style, location));
     EventTracker.SendEvent(new NRaasWooHooEvent(EventTypeId.kWooHooed, target, actor, obj, style, location));
     RunPostWhoohooInternal(actor, target, obj, fireDisgraceEvents);
 }
コード例 #4
0
 public NRaasWooHooEvent(EventTypeId id, Sim actor, Sim target, IGameObject obj, CommonWoohoo.WoohooStyle style, CommonWoohoo.WoohooLocation location)
     : base(id, actor, target, obj)
 {
     mStyle    = style;
     mLocation = location;
 }
コード例 #5
0
        public static void OnWoohooed(Event e)
        {
            using (Common.TestSpan span = new Common.TestSpan(ScoringLookup.Stats, "Duration CommonWoohoo:OnWoohooed"))
            {
                WooHooEvent wEvent = e as WooHooEvent;
                if (wEvent == null)
                {
                    return;
                }

                Sim actor = wEvent.Actor as Sim;
                if (actor == null)
                {
                    return;
                }

                SimDescription targetDesc = null;

                Sim target = wEvent.TargetObject as Sim;
                if (target != null)
                {
                    targetDesc = target.SimDescription;
                }
                else if (actor.SimDescription.IsPregnant)
                {
                    targetDesc = SimDescription.Find(actor.SimDescription.Pregnancy.DadDescriptionId);
                }

                if (targetDesc == null)
                {
                    return;
                }

                CommonWoohoo.WoohooLocation location = WoohooLocation.Bed;

                CommonWoohoo.WoohooStyle style = WoohooStyle.Safe;

                IWooHooDefinition woohoo = null;

                NRaasWooHooEvent customEvent = wEvent as NRaasWooHooEvent;
                if (customEvent != null)
                {
                    location = customEvent.Location;
                    style    = customEvent.Style;
                }
                else
                {
                    if (actor.CurrentInteraction != null)
                    {
                        woohoo = actor.CurrentInteraction.InteractionDefinition as IWooHooDefinition;
                        if (woohoo == null)
                        {
                            if (actor.CurrentInteraction is Shower.TakeShower)
                            {
                                foreach (Sim sim in actor.LotCurrent.GetAllActors())
                                {
                                    if ((sim.CurrentInteraction != null) && (sim.CurrentInteraction.Target == actor))
                                    {
                                        woohoo = sim.CurrentInteraction.InteractionDefinition as IWooHooDefinition;
                                        if (woohoo != null)
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                        }

                        if (woohoo != null)
                        {
                            location = woohoo.GetLocation(wEvent.ObjectUsed);

                            style = woohoo.GetStyle(actor.CurrentInteraction);
                            if ((style == WoohooStyle.Safe) && (Woohooer.Settings.ReplaceWithRisky))
                            {
                                style = WoohooStyle.Risky;
                            }
                        }
                    }

                    if (wEvent.BedUsed != null)
                    {
                        if (wEvent.BedUsed is Tent)
                        {
                            location = WoohooLocation.Tent;
                        }
                        else if (wEvent.BedUsed is Igloo)
                        {
                            location = WoohooLocation.Igloo;
                        }
                        else if (wEvent.BedUsed is FairyHouse)
                        {
                            location = WoohooLocation.FairyHouse;
                        }
                    }
                    else if ((woohoo == null) && (wEvent.ObjectUsed != null))
                    {
                        foreach (WoohooLocationControl check in Common.DerivativeSearch.Find <WoohooLocationControl>())
                        {
                            if (check.Matches(wEvent.ObjectUsed))
                            {
                                location = check.Location;
                                break;
                            }
                        }
                    }
                }

                KamaSimtra.AddNotch(actor.SimDescription, targetDesc, actor.LotCurrent, location, style);

                Woohooer.Settings.AddCount(actor);

                WoohooBuffs.Apply(actor, target, style == WoohooStyle.Risky);

                KamaSimtraSettings.ServiceData data = KamaSimtra.Settings.GetServiceData(targetDesc.SimDescriptionId, true);
                if (data != null)
                {
                    data.Dispose();
                }
            }
        }
コード例 #6
0
        public static void GettingItOnInRabbitHole(InteractionInstance instance, Sim wooHooer, Sim wooHooee, RabbitHoleRomanticType romanticType, RabbitHole.VisitRabbitHoleTuningClass visitTuning, CommonWoohoo.WoohooStyle style, CommonWoohoo.WoohooLocation location, bool impregnate)
        {
            RabbitHole target = instance.Target as RabbitHole;

            if (instance.InstanceActor == wooHooer)
            {
                switch (romanticType)
                {
                case RabbitHoleRomanticType.TryForBaby:
                case RabbitHoleRomanticType.WooHoo:
                    CommonWoohoo.RunPostWoohoo(wooHooer, wooHooee, target, style, location, true);
                    break;
                }

                Relationship relationship = Relationship.Get(wooHooer, wooHooee, true);
                if (relationship != null)
                {
                    relationship.UpdateSTCFromOutsideConversation(wooHooer, wooHooee, visitTuning.WooHooingCommodity, visitTuning.WooHooingSTCIncrement);
                }
            }

            if ((impregnate) && (CommonPregnancy.IsSuccess(wooHooer, wooHooee, instance.Autonomous, style)))
            {
                CommonPregnancy.Impregnate(wooHooer, wooHooee, instance.Autonomous, style);
            }

            target.RabbitHoleProxy.TurnOffWooHooEffect();
        }