Example #1
0
            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);
            }
Example #2
0
            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);
            }
        protected bool SmeltMetal(Metal metal)
        {
            if (!metal.mCollected)
            {
                return(false);
            }

            if (Sim.FamilyFunds < Metal.GetSmelt.kCostToSmelt)
            {
                IncStat("Smelt Cost");
                return(false);
            }

            Money.AdjustFunds(Sim, "Smelting", -Metal.GetSmelt.kCostToSmelt);

            float chanceOfExtraIngot = Metal.GetSmelt.kChanceOfExtraIngot;

            Collecting skill = Sim.SkillManager.AddElement(SkillNames.Collecting) as Collecting;

            if (skill.IsMetalCollector())
            {
                chanceOfExtraIngot = Metal.GetSmelt.kMetalCollectorExtraIngotChance;
            }

            int num2 = 0x1;

            while ((num2 < Metal.GetSmelt.kMaxNumberOfIngots) && RandomUtil.RandomChance01(chanceOfExtraIngot))
            {
                num2++;
                Metal metal2 = RockGemMetalBase.Make(metal.Guid, true) as Metal;
                MetalEx.SmeltMetal(metal2, Sim);
                IncreaseIngotsCreatedForMetal(skill, metal2.Guid);

                Inventories.TryToMove(metal2, Sim.CreatedSim);
            }

            MetalEx.SmeltMetal(metal, Sim);
            IncreaseIngotsCreatedForMetal(skill, metal.Guid);

            skill.MetalSmelt();

            IncStat("Metal Smelt");

            return(true);
        }
Example #4
0
            private static IGameObject MakeHuntableFromData(WeightedHuntingData data)
            {
                IGameObject huntable = null;

                if (data != null)
                {
                    if (string.IsNullOrEmpty(data.StringID))
                    {
                        huntable = RockGemMetalBase.Make((RockGemMetal)data.ID, true);
                    }
                    else
                    {
                        huntable = GlobalFunctions.CreateObjectOutOfWorld(data.StringID, ProductVersion.EP5);
                    }
                }

                return(huntable);
            }
Example #5
0
 public override void Cleanup()
 {
     if (this.isWooHooing)
     {
         RockGemMetalBase.HandleNearbyWoohoo(base.Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);
         this.isWooHooing = false;
     }
     AlarmManager.Global.RemoveAlarm(this.mJealousyAlarm);
     if (this.mWooHooEffect != null)
     {
         this.mWooHooEffect.Stop();
         this.mWooHooEffect.Dispose();
         this.mWooHooEffect = null;
     }
     if (this.mReactToSocialBroadcaster != null)
     {
         this.mReactToSocialBroadcaster.Dispose();
         this.mReactToSocialBroadcaster = null;
     }
     if (this.mHelperX != null)
     {
         this.mHelperX.Dispose();
         this.mHelperX = null;
     }
     if (this.mHelperY != null)
     {
         this.mHelperY.Dispose();
         this.mHelperY = null;
     }
     if (this.mbInvisible)
     {
         this.UpdateVisibility(true);
     }
     this.CleanupSituation();
     base.Cleanup();
 }
Example #6
0
        public override bool Run()
        {
            try
            {
                mLinkedActor = LinkedInteractionInstance.InstanceActor;
                if (!StartSync(mIsMaster))
                {
                    Treehouse.PushGetOutAsContinuation(Actor);
                    return(false);
                }

                StandardEntry(false);
                BeginCommodityUpdates();
                if (mIsMaster)
                {
                    RockGemMetalBase.HandleNearbyWoohoo(Target, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                    mCurrentStateMachine = Actor.Posture.CurrentStateMachine;
                    SetActor("y", mLinkedActor);
                    AnimateSim("WooHoo");
                    AnimateSim("Idle");
                    RemoveActor("y");

                    IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                    CommonWoohoo.RunPostWoohoo(Actor, mLinkedActor, Target, definition.GetStyle(this), definition.GetLocation(Target), true);

                    if (CommonPregnancy.IsSuccess(Actor, mLinkedActor, Autonomous, definition.GetStyle(this)))
                    {
                        Pregnancy pregnancy = CommonPregnancy.Impregnate(Actor, mLinkedActor, Autonomous, definition.GetStyle(this));
                        if (pregnancy != null)
                        {
                            pregnancy.SetForcedBabyTrait(RandomUtil.GetRandomObjectFromList(Target.RandomPregnancyTraits));
                        }
                    }

                    RockGemMetalBase.HandleNearbyWoohoo(Target, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);
                }
                else
                {
                    DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                }

                float splinterChance = Treehouse.WooHoo.kSplinterChance;
                if (Actor.TraitManager.HasAnyElement(kSplinterChanceTraitsIncrease))
                {
                    splinterChance *= kSplinterChanceMultiplierIncrease;
                }
                if (Actor.TraitManager.HasAnyElement(kSplinterChanceTraitsDecrease) || Actor.BuffManager.HasElement(BuffNames.LuckyLime))
                {
                    splinterChance *= kSplinterChanceMultiplierDecrease;
                }
                if (RandomUtil.RandomChance01(splinterChance))
                {
                    Actor.BuffManager.AddElement(BuffNames.Splinter, Origin.None);
                }

                EndCommodityUpdates(true);
                StandardExit(false, false);
                FinishLinkedInteraction(mIsMaster);
                WaitForSyncComplete();
                Treehouse.PushGetOutAsContinuation(Actor);
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception exception)
            {
                Common.Exception(Actor, Target, exception);
                return(false);
            }
        }
Example #7
0
        public override bool Run()
        {
            try
            {
                ProxyDefinition definition = InteractionDefinition as ProxyDefinition;

                if (mIsMaster)
                {
                    Actor.SynchronizationRole   = Sim.SyncRole.Initiator;
                    Actor.SynchronizationTarget = WooHooee;
                }
                else
                {
                    Actor.SynchronizationRole   = Sim.SyncRole.Receiver;
                    Actor.SynchronizationTarget = WooHooer;
                }

                bool success = false;
                try
                {
                    if (mIsMaster && !Actor.HasExitReason())
                    {
                        ElevatorWooHoo entry = definition.ProxyClone(WooHooer).CreateInstance(Target, WooHooee, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true) as ElevatorWooHoo;
                        entry.LinkedInteractionInstance = this;
                        entry.WooHooer = WooHooer;
                        entry.WooHooee = WooHooee;

                        if (!WooHooee.InteractionQueue.AddNext(entry))
                        {
                            return(false);
                        }
                    }

                    if (!SafeToSync())
                    {
                        return(false);
                    }

                    Actor.LoopIdle();
                    Actor.SynchronizationLevel = Sim.SyncLevel.NotStarted;
                    if (!Actor.WaitForSynchronizationLevelWithSim(Actor.SynchronizationTarget, Sim.SyncLevel.NotStarted, ElevatorDoors.kWooHooSyncTime))
                    {
                        FinishLinkedInteraction(mIsMaster);
                        return(false);
                    }

                    if (!Target.RouteToElevator(Actor))
                    {
                        FinishLinkedInteraction(mIsMaster);
                        return(false);
                    }

                    Target.InteriorObj.AddElevatorColumnToUseList(Actor);
                    Actor.RouteTurnToFace(Target.Position);
                    Actor.LoopIdle();
                    Actor.SynchronizationLevel = Sim.SyncLevel.Started;
                    if (!Actor.WaitForSynchronizationLevelWithSim(Actor.SynchronizationTarget, Sim.SyncLevel.Started, ElevatorDoors.kWooHooSyncTime))
                    {
                        FinishLinkedInteraction(mIsMaster);
                        return(false);
                    }

                    if (!Target.SimLine.WaitForTurn(this, SimQueue.WaitBehavior.CutToHeadOfLine, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), ElevatorDoors.kWooHooSyncTime))
                    {
                        FinishLinkedInteraction(mIsMaster);
                        return(false);
                    }

                    IsDoneRouting       = true;
                    CancellableByPlayer = false;
                    Slot slotName = Slot.RoutingSlot_0;
                    if (!mIsMaster)
                    {
                        slotName = Slot.RoutingSlot_1;
                    }
                    Actor.SimRoutingComponent.DisallowBeingPushed      = true;
                    Actor.SimRoutingComponent.ShouldIgnoreAllObstacles = true;
                    if (!Actor.RouteToSlot(Target.InteriorObj, slotName))
                    {
                        WanderOut();
                        FinishLinkedInteraction(mIsMaster);
                        return(false);
                    }
                    Target.SimLine.RemoveFromQueue(Actor);
                    Actor.LoopIdle();
                    Actor.SynchronizationLevel = Sim.SyncLevel.Routed;
                    if (!Actor.WaitForSynchronizationLevelWithSim(Actor.SynchronizationTarget, Sim.SyncLevel.Routed, ElevatorDoors.kWooHooSyncTime))
                    {
                        WanderOut();
                        FinishLinkedInteraction(mIsMaster);
                        return(false);
                    }
                    IsInsideElevator = true;
                    StandardEntry(false);
                    Actor.LoopIdle();
                    Actor.SimDescription.Contactable = false;
                    if (!StartSync(mIsMaster))
                    {
                        WanderOut();
                        StandardExit(false);
                        return(false);
                    }

                    success = true;
                }
                finally
                {
                    if (!success)
                    {
                        definition.Definition.Restart(mIsMaster, WooHooer, WooHooee, Autonomous, Target);
                    }
                }

                BeginCommodityUpdates();

                try
                {
                    if (mIsMaster)
                    {
                        AcquireStateMachine("Elevator");
                        SetActorAndEnter("x", Actor, "Enter");
                        SetActorAndEnter("y", WooHooee, "Enter");
                        SetActor("elevatorExterior", Target);

                        success = true;

                        if (Woohooer.Settings.UsingTraitScoring)
                        {
                            if (ScoringLookup.GetScore("ElevatorSuccess", Actor.SimDescription) < 0)
                            {
                                success = false;
                            }
                            else if (ScoringLookup.GetScore("ElevatorSuccess", WooHooee.SimDescription) < 0)
                            {
                                success = false;
                            }
                        }

                        if (success)
                        {
                            isWooHooing = true;
                            RockGemMetalBase.HandleNearbyWoohoo(Target, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                            AddOneShotScriptEventHandler(0x6e, WooHooTurnOnCensorBars);
                            AddOneShotScriptEventHandler(0x6f, WooHooTurnOffCensorBars);
                            mJealousyAlarm = AlarmManager.Global.AddAlarm(4f, TimeUnit.Minutes, StartJealousyBroadcaster, "StartJealousyBroadcaster", AlarmType.DeleteOnReset, Target);
                            AnimateJoinSims("WooHooAccept");

                            CommonWoohoo.RunPostWoohoo(Actor, WooHooee, Target, definition.GetStyle(this), definition.GetLocation(Target), true);

                            CommonWoohoo.TestNakedOutfit(Woohooer.Settings.mNakedOutfitElevator, WooHooer, WooHooee);

                            if (CommonPregnancy.IsSuccess(WooHooer, WooHooee, Autonomous, definition.GetStyle(this)))
                            {
                                CommonPregnancy.Impregnate(WooHooer, WooHooee, Autonomous, definition.GetStyle(this));
                            }

                            RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);
                            isWooHooing = false;
                        }
                        else
                        {
                            ElevatorDoors.WooHoo linkedInteractionInstance = LinkedInteractionInstance as ElevatorDoors.WooHoo;
                            if (linkedInteractionInstance != null)
                            {
                                linkedInteractionInstance.IsFail = true;
                            }
                            AddOneShotScriptEventHandler(0x65, new SacsEventHandler(WooHooRejectCallback));
                            AnimateJoinSims("WooHooReject");
                            SpeedTrap.Sleep((uint)SimClock.ConvertToTicks(RandomUtil.RandomFloatGaussianDistribution(ElevatorDoors.kWooHooFailWaitTime[0x0], ElevatorDoors.kWooHooFailWaitTime[0x1]), TimeUnit.Minutes));
                            if (WooHooer.LotHome != Target.LotCurrent)
                            {
                                WooHooer.BuffManager.AddElement(BuffNames.WalkOfShame, Origin.FromRejectedWooHooOffHome);
                            }
                            Relationship.Get(WooHooee, WooHooer, true).LTR.UpdateLiking(ElevatorDoors.kWooHooRejectRelHit);
                        }
                        AnimateNoYield("y", "Exit");
                        AnimateSim("Exit");
                    }
                    Actor.SynchronizationLevel = Sim.SyncLevel.Committed;
                    Actor.WaitForSynchronizationLevelWithSim(Actor.SynchronizationTarget, Sim.SyncLevel.Committed, ElevatorDoors.kWooHooSyncTime);
                    if (IsFail && !mIsMaster)
                    {
                        Actor.SetPosition(Target.InteriorObj.GetPositionOfSlot(Slot.RoutingSlot_0));
                        SpeedTrap.Sleep((uint)SimClock.ConvertToTicks(RandomUtil.RandomFloatGaussianDistribution(ElevatorDoors.kWooHooFailKickerOutWaitTime[0x0], ElevatorDoors.kWooHooFailKickerOutWaitTime[0x1]), TimeUnit.Minutes));
                    }
                    Target.RouteToElevator(Actor);
                    Actor.SynchronizationLevel = Sim.SyncLevel.Completed;
                    Actor.WaitForSynchronizationLevelWithSim(Actor.SynchronizationTarget, Sim.SyncLevel.Completed, ElevatorDoors.kWooHooSyncTime);
                    FinishLinkedInteraction(mIsMaster);
                    WaitForSyncComplete();
                }
                finally
                {
                    EndCommodityUpdates(true);
                }

                StandardExit(false);
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #8
0
        public override bool Run()
        {
            try
            {
                int num;
                if ((WoohooObject == null) || !WoohooObject.CanWooHooIn())
                {
                    return(false);
                }
                if (!SafeToSync())
                {
                    return(false);
                }

                LeafPile.WoohooInPileOrStackB entry = LeafPile.WoohooInPileOrStackB.Singleton.CreateInstance(Actor, Target, GetPriority(), Autonomous, CancellableByPlayer) as LeafPile.WoohooInPileOrStackB;
                entry.LinkedInteractionInstance = this;
                if (!Target.InteractionQueue.Add(entry))
                {
                    Common.DebugNotify("LeafPileBaseWoohoo Add Fail");
                    return(false);
                }

                Actor.SynchronizationLevel  = Sim.SyncLevel.Started;
                Actor.SynchronizationTarget = Target;
                Actor.SynchronizationRole   = Sim.SyncRole.Initiator;
                if (!WoohooObject.SimLine.WaitForTurn(this, SimQueue.WaitBehavior.Default, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), 10f))
                {
                    return(false);
                }

                Slot[] routingSlots = WoohooObject.GetRoutingSlots();
                if (!Actor.RouteToSlotListAndCheckInUse(WoohooObject, routingSlots, out num))
                {
                    return(false);
                }

                if (!WoohooObject.CanWooHooIn())
                {
                    return(false);
                }

                CommonWoohoo.TestNakedOutfit(UsingNakedOutfit, Actor, Target);

                mActorXRoutingSlot = routingSlots[num];
                StandardEntry();
                WoohooObject.AddToUseList(Actor);
                WoohooObject.AddToUseList(Target);
                BeginCommodityUpdates();
                EnterStateMachine(WoohooObject.JazzFileName, "Enter", "x");
                AddOneShotScriptEventHandler(0x65, PlayEffectsHandlerX);
                AddOneShotScriptEventHandler(0x78, AnimCallbackSimX);
                SetActor(WoohooObject.JazzObjectName, WoohooObject);
                Animate("x", "GetInStackX");
                WoohooObject.SimLine.RemoveFromQueue(Actor);
                if (!Actor.WaitForSynchronizationLevelWithSim(Target, Sim.SyncLevel.Routed, 30f))
                {
                    AddOneShotScriptEventHandler(0x65, PlayEffectsHandlerX);
                    AddOneShotScriptEventHandler(0x66, PlayEffectsHandlerX);
                    AddOneShotScriptEventHandler(0x6e, AnimCallbackSimX);
                    AddOneShotScriptEventHandler(0x79, AnimCallbackSimX);
                    Animate("x", "GetOut");
                    Animate("x", "Exit");
                    WoohooObject.RemoveFromUseList(Actor);
                    WoohooObject.RemoveFromUseList(Target);
                    EndCommodityUpdates(false);
                    StandardExit();
                    return(false);
                }

                mActorYRoutingSlot = (Slot)(LinkedInteractionInstance as LeafPile.WoohooInPileOrStackB).RoutedSlot;

                RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                SetActor("y", Target);
                EnterState("y", "Enter");
                AddOneShotScriptEventHandler(0x65, PlayEffectsHandlerY);
                AddOneShotScriptEventHandler(0x78, AnimCallbackSimY);
                Animate("y", "GetInStackY");
                if (mReactToSocialBroadcasterActor == null)
                {
                    mReactToSocialBroadcasterActor = new ReactionBroadcaster(Actor, Conversation.ReactToSocialParams, SocialComponentEx.ReactToJealousEventHigh);
                    CommonWoohoo.CheckForWitnessedCheating(Actor, Target, true);
                }

                if (mReactToSocialBroadcasterTarget == null)
                {
                    mReactToSocialBroadcasterTarget = new ReactionBroadcaster(Target, Conversation.ReactToSocialParams, SocialComponentEx.ReactToJealousEventHigh);
                    CommonWoohoo.CheckForWitnessedCheating(Target, Actor, true);
                }

                AnimateJoinSims("Woohoo");
                (WoohooObject as GameObject).PushSimsFromFootprint((uint)mActorXRoutingSlot, Actor, null, true);
                AddOneShotScriptEventHandler(0x65, PlayEffectsHandlerX);
                AddOneShotScriptEventHandler(0x66, PlayEffectsHandlerX);
                AddOneShotScriptEventHandler(0x6e, AnimCallbackSimX);
                AddOneShotScriptEventHandler(0x79, AnimCallbackSimX);
                AnimateJoinSims("GetOutX");
                List <Sim> exceptions = new List <Sim>();
                exceptions.Add(Actor);
                (WoohooObject as GameObject).PushSimsFromFootprint((uint)mActorYRoutingSlot, Target, exceptions, true);
                if (mActorYRoutingSlot == mActorXRoutingSlot)
                {
                    Actor.Wander(1f, 2f, false, RouteDistancePreference.PreferFurthestFromRouteOrigin, true);
                }
                AddOneShotScriptEventHandler(0x65, PlayEffectsHandlerY);
                AddOneShotScriptEventHandler(0x66, PlayEffectsHandlerY);
                AddOneShotScriptEventHandler(0x6e, AnimCallbackSimY);
                AddOneShotScriptEventHandler(0x79, AnimCallbackSimY);
                AnimateJoinSims("GetOutY");
                AnimateJoinSims("Exit");
                RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);

                IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                CommonWoohoo.RunPostWoohoo(Actor, Target, WoohooObject, definition.GetStyle(this), definition.GetLocation(WoohooObject), true);

                if (CommonPregnancy.IsSuccess(Actor, Target, Autonomous, definition.GetStyle(this)))
                {
                    Pregnancy pregnancy = CommonPregnancy.Impregnate(Actor, Target, Autonomous, definition.GetStyle(this));
                    if (pregnancy != null)
                    {
                        if (RandomUtil.RandomChance(WoohooObject.ChanceBabyGetsLovesOutdoorsTrait))
                        {
                            pregnancy.SetForcedBabyTrait(TraitNames.LovesTheOutdoors);
                        }
                    }
                }

                WoohooObject.RemoveFromUseList(Actor);
                WoohooObject.RemoveFromUseList(Target);
                EndCommodityUpdates(true);
                StandardExit();

                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 (RandomUtil.RandomChance(WoohooObject.ChanceGetRollInHayBuff))
                {
                    Actor.BuffManager.AddElement(BuffNames.RolledInTheHay, Origin.FromWooHooInHayStack);
                    Target.BuffManager.AddElement(BuffNames.RolledInTheHay, Origin.FromWooHooInHayStack);
                }

                Relationship.Get(Actor, Target, true).LTR.UpdateLiking(WoohooObject.LTRGain);
                EventTracker.SendEvent(WoohooObject.WooHooEventID, Actor, Target);
                EventTracker.SendEvent(WoohooObject.WooHooEventID, Target, Actor);
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception exception)
            {
                Common.Exception(Actor, Target, exception);
                return(false);
            }
        }
Example #9
0
        public override bool Run()
        {
            try
            {
                if (WoohooHouse == null)
                {
                    return(false);
                }
                if (!SafeToSync())
                {
                    return(false);
                }
                PetHouse.WoohooPetHouseB entry = PetHouse.WoohooPetHouseB.Singleton.CreateInstance(Actor, Target, GetPriority(), Autonomous, CancellableByPlayer) as PetHouse.WoohooPetHouseB;
                entry.LinkedInteractionInstance = this;
                Target.InteractionQueue.Add(entry);
                Actor.SynchronizationLevel  = Sim.SyncLevel.Started;
                Actor.SynchronizationTarget = Target;
                Actor.SynchronizationRole   = Sim.SyncRole.Initiator;
                if (!WoohooHouse.SimLine.WaitForTurn(this, SimQueue.WaitBehavior.Default, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), 10f))
                {
                    return(false);
                }
                if (!Actor.RouteToSlotAndCheckInUse(WoohooHouse, Slot.RoutingSlot_3))
                {
                    if (!Actor.HasExitReason(ExitReason.RouteFailed))
                    {
                        WoohooHouse.SimLine.RemoveFromQueue(Actor);
                        WoohooHouse.PlayRouteFailAndWanderAway(Actor);
                        return(false);
                    }
                    Actor.RemoveExitReason(ExitReason.RouteFailed);
                    if (!Actor.RouteToSlotAndCheckInUse(WoohooHouse, Slot.RoutingSlot_3))
                    {
                        WoohooHouse.SimLine.RemoveFromQueue(Actor);
                        WoohooHouse.PlayRouteFailAndWanderAway(Actor);
                        return(false);
                    }
                }
                StandardEntry();
                WoohooHouse.AddToUseList(Actor);
                WoohooHouse.AddToUseList(Target);
                EnterStateMachine("PetHouse", "enter", "x");
                SetActor("petHouse", WoohooHouse);
                SetActor("y", Target);
                Animate("x", "getInWoohooX");
                Actor.ParentToSlot(WoohooHouse, WoohooHouse.GetContainmentSlotForActor(Actor));
                WoohooHouse.SimLine.RemoveFromQueue(Actor);
                if (!Actor.WaitForSynchronizationLevelWithSim(Target, Sim.SyncLevel.Routed, 30f))
                {
                    Actor.UnParent();
                    Animate("x", "inHouseNeutral");
                    Animate("x", "exit");
                    StandardExit();
                    WoohooHouse.RemoveFromUseList(Actor);
                    WoohooHouse.RemoveFromUseList(Target);
                    return(false);
                }
                BeginCommodityUpdates();
                (LinkedInteractionInstance as PetHouse.WoohooPetHouseB).BeginCommodityUpdates();
                RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                EnterState("y", "enter");
                Animate("y", "getInWoohooY");
                AnimateJoinSims("woohoo");
                Actor.UnParent();
                AnimateSim("exitWoohoo");
                RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);

                IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                CommonWoohoo.RunPostWoohoo(Actor, Target, WoohooHouse, definition.GetStyle(this), definition.GetLocation(WoohooHouse), true);

                if (CommonPregnancy.IsSuccess(Actor, Target, Autonomous, definition.GetStyle(this)))
                {
                    CommonPregnancy.Impregnate(Actor, Target, Autonomous, definition.GetStyle(this));
                }

                StateMachineClient smc = StateMachineClient.Acquire(Actor, "PetHouse");
                smc.SetActor("petHouse", WoohooHouse);
                smc.SetActor("x", Actor);
                smc.EnterState("x", "inHouseNeutral");
                PetHouse.PetHousePosture posture = new PetHouse.PetHousePosture(WoohooHouse, Actor, smc);
                Actor.Posture       = posture;
                ActorStayingInHouse = Actor.InteractionQueue.PushAsContinuation(PetHouse.LieDown.Singleton.CreateInstance(WoohooHouse, Actor, GetPriority(), Autonomous, CancellableByPlayer), true);
                if (!ActorStayingInHouse)
                {
                    posture.CancelPosture(Actor);
                }
                EndCommodityUpdates(true);
                (LinkedInteractionInstance as PetHouse.WoohooPetHouseB).EndCommodityUpdates(true);
                PlumbBob.Reparent();
                StandardExit();
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception exception)
            {
                Common.Exception(Actor, Target, exception);
                return(false);
            }
        }
Example #10
0
        public override bool Run()
        {
            try
            {
                IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                if (WoohooObject == null)
                {
                    return(false);
                }

                if (!SafeToSync())
                {
                    return(false);
                }

                AllInOneBathroom.WoohooInAllInOneBathroomB entry = AllInOneBathroom.WoohooInAllInOneBathroomB.Singleton.CreateInstance(Actor, Target, GetPriority(), Autonomous, CancellableByPlayer) as AllInOneBathroom.WoohooInAllInOneBathroomB;
                entry.TryForBaby = TryForBaby;
                entry.LinkedInteractionInstance = this;
                Target.InteractionQueue.Add(entry);
                Actor.SynchronizationLevel  = Sim.SyncLevel.Started;
                Actor.SynchronizationTarget = Target;
                Actor.SynchronizationRole   = Sim.SyncRole.Initiator;
                if (!WoohooObject.SimLine.WaitForTurn(this, SimQueue.WaitBehavior.Default, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), 10f))
                {
                    return(false);
                }

                if (!Actor.RouteToSlotAndCheckInUse(WoohooObject, Slot.RoutingSlot_1))
                {
                    return(false);
                }

                StandardEntry();
                WoohooObject.AddToUseList(Actor);
                WoohooObject.AddToUseList(Target);
                BeginCommodityUpdates();

                if (!Actor.WaitForSynchronizationLevelWithSim(Target, Sim.SyncLevel.Routed, 30f))
                {
                    WoohooObject.RemoveFromUseList(Actor);
                    WoohooObject.RemoveFromUseList(Target);
                    EndCommodityUpdates(false);
                    StandardExit();
                    return(false);
                }

                EnterStateMachine("AllInOneBathroom", "Enter", "x");
                SetActor("bathroom", WoohooObject);
                SetActor("y", Target);
                AddOneShotScriptEventHandler(0x64, AnimationCallback);
                AddOneShotScriptEventHandler(0x65, AnimationCallback);
                RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);

                if (mReactToSocialBroadcasterActor == null)
                {
                    mReactToSocialBroadcasterActor = new ReactionBroadcaster(Actor, Conversation.ReactToSocialParams, SocialComponentEx.ReactToJealousEventHigh);
                }

                if (mReactToSocialBroadcasterTarget == null)
                {
                    mReactToSocialBroadcasterTarget = new ReactionBroadcaster(Target, Conversation.ReactToSocialParams, SocialComponentEx.ReactToJealousEventHigh);
                }

                Animate("x", "WooHoo");

                List <Sim> exceptions = new List <Sim>();
                exceptions.Add(Target);
                WoohooObject.PushSimsFromFootprint(0x31229a4d, Actor, exceptions, true);
                WoohooObject.PushSimsFromFootprint(0x31229a4e, Actor, exceptions, true);
                Animate("x", "Exit");

                RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);

                CommonWoohoo.RunPostWoohoo(Actor, Target, WoohooObject, definition.GetStyle(this), definition.GetLocation(WoohooObject), true);

                if (CommonPregnancy.IsSuccess(Actor, Target, Autonomous, definition.GetStyle(this)))
                {
                    Pregnancy pregnancy = CommonPregnancy.Impregnate(Actor, Target, Autonomous, definition.GetStyle(this));
                    if (pregnancy != null)
                    {
                        if (RandomUtil.RandomChance(AllInOneBathroom.kChanceOfHydrophobicTrait))
                        {
                            pregnancy.SetForcedBabyTrait(TraitNames.Hydrophobic);
                        }
                    }
                }

                WoohooObject.RemoveFromUseList(Actor);
                WoohooObject.RemoveFromUseList(Target);
                WoohooObject.SimLine.RemoveFromQueue(Actor);
                EndCommodityUpdates(true);
                StandardExit();

                EventTracker.SendEvent(EventTypeId.kWooHooInAllInOneBathroom, Actor, Target);

                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);
                }

                Relationship.Get(Actor, Target, true).LTR.UpdateLiking(AllInOneBathroom.kLTRGainFromWoohooInAllInOneBathroom);
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception exception)
            {
                Common.Exception(Actor, Target, exception);
                return(false);
            }
        }
        public override bool Run()
        {
            try
            {
                ISaunaWooHooDefinition definition = InteractionDefinition as ISaunaWooHooDefinition;

                if (!StartSync())
                {
                    DoResume();
                    return(false);
                }

                StandardEntry(false);
                mSauna = Actor.Posture.Container as SaunaClassic;
                if (Actor == mSauna.GetLeftSim())
                {
                    IHasSeatingGroup container = Actor.Posture.Container as IHasSeatingGroup;
                    Seat             seat      = container.SeatingGroup[Actor];
                    Seat             seat2     = container.SeatingGroup[Target];
                    if ((seat == null) || (seat2 == null))
                    {
                        Actor.AddExitReason(ExitReason.FailedToStart);
                        return(false);
                    }

                    // Custom
                    string socialName = CommonWoohoo.GetSocialName(definition.GetStyle(this), Actor);

                    ReturnInstance.EnsureMaster();
                    mCurrentStateMachine = ReturnInstance.mCurrentStateMachine;
                    StartSocial(socialName);
                    InitiateSocialUI(Actor, Target);
                    SaunaClassic.CuddleSeatedWooHooSauna linkedInteractionInstance = LinkedInteractionInstance as SaunaClassic.CuddleSeatedWooHooSauna;
                    linkedInteractionInstance.Rejected = Rejected;
                    if (Rejected)
                    {
                        mCurrentStateMachine.RequestState(null, "Woo Hoo Reject");
                        mCurrentStateMachine.RequestState(null, "ExitSitting");
                        FinishSocial(socialName, true);
                        FinishSocialContext();
                        Actor.BuffManager.AddElement(BuffNames.WalkOfShame, Origin.FromRejectedWooHooOffHome);
                    }
                    else
                    {
                        mCurrentStateMachine.RequestState(null, "ExitSitting");

                        // Custom
                        CommonWoohoo.TestNakedOutfit(Woohooer.Settings.mNakedOutfitSaunaWoohoo, Actor, Target);

                        if (Stand.Singleton.CreateInstance(mSauna, Actor, Actor.InheritedPriority(), false, false).RunInteraction())
                        {
                            // Custom
                            if (CommonWoohoo.NeedPrivacy(false, Actor, Target))
                            {
                                mSituation     = new WooHoo.WooHooPrivacySituation(this);
                                mPrivacyFailed = !mSituation.Start();
                            }
                            else
                            {
                                mPrivacyFailed = false;
                            }

                            linkedInteractionInstance.mPrivacyFailed = mPrivacyFailed;
                            if (!mPrivacyFailed && Actor.RouteToSlot(mSauna, Slot.RoutingSlot_14))
                            {
                                EnterStateMachine("Sauna_store", "SimEnter", "x");
                                SetActor("saunaX", seat.Host);
                                SetActor("saunaY", seat2.Host);
                                AddOneShotScriptEventHandler(0x384, OnAnimationEvent);
                                AnimateSim("PourWater");
                                AnimateSim("SimExit");

                                if (SaunaSit.WoohooSingleton.CreateInstance(mSauna, Actor, Actor.InheritedPriority(), false, false).RunInteraction())
                                {
                                    RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                                    EnterStateMachine("sauna_store", "SimEnter", "x", "y");
                                    SetActor("saunaX", mSauna);
                                    mCurrentStateMachine.AddOneShotScriptEventHandler(0x6e, OnAnimationEvent);
                                    mCurrentStateMachine.AddOneShotScriptEventHandler(0x6f, OnAnimationEvent);
                                    mCurrentStateMachine.AddOneShotScriptEventHandler(0x78, OnAnimationEvent);
                                    mCurrentStateMachine.AddOneShotScriptEventHandler(0x79, OnAnimationEvent);
                                    mCurrentStateMachine.AddOneShotScriptEventHandler(0x70, OnBabyCheckEventEx);

                                    SetActor("saunaX", seat.Host);
                                    SetActor("saunaY", seat2.Host);
                                    if (Actor == mSauna.GetLeftSim())
                                    {
                                        SetParameter("IsMirrored", true);
                                        SetParameter("SuffixX", mSauna.mSeatingGroup[Actor].IKSuffix);
                                        SetParameter("SuffixY", mSauna.mSeatingGroup[Target].IKSuffix);
                                    }
                                    else
                                    {
                                        SetParameter("IsMirrored", false);
                                        SetParameter("SuffixY", mSauna.mSeatingGroup[Actor].IKSuffix);
                                        SetParameter("SuffixX", mSauna.mSeatingGroup[Target].IKSuffix);
                                    }

                                    AnimateJoinSims("Woohoo");
                                    AnimateJoinSims("SimExit");
                                    RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);

                                    // Custom
                                    CommonWoohoo.RunPostWoohoo(Actor, Target, mSauna, definition.GetStyle(this), definition.GetLocation(mSauna), true);

                                    Target.Motives.ChangeValue(CommodityKind.Fun, SaunaClassic.kWooHooFunBump);
                                    Target.Motives.ChangeValue(CommodityKind.Social, SaunaClassic.kWooHooSocialBump);
                                    Target.Motives.ChangeValue(CommodityKind.Hygiene, SaunaClassic.kWooHooHygieneBump);
                                    Actor.Motives.ChangeValue(CommodityKind.Fun, SaunaClassic.kWooHooFunBump);
                                    Actor.Motives.ChangeValue(CommodityKind.Social, SaunaClassic.kWooHooSocialBump);
                                    Actor.Motives.ChangeValue(CommodityKind.Hygiene, SaunaClassic.kWooHooHygieneBump);
                                }
                            }
                        }

                        FinishSocial(socialName, true);
                        Actor.AddExitReason(ExitReason.StageComplete);
                        Target.AddExitReason(ExitReason.StageComplete);
                    }
                }
                else
                {
                    DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                }

                FinishLinkedInteraction(IsMaster);
                bool succeeded = !Rejected && !mPrivacyFailed;
                EndCommodityUpdates(succeeded);
                StandardExit(false, false);
                InvokeDoResumeOnCleanup = false;
                if (!mPrivacyFailed)
                {
                    Actor.SimDescription.SetFirstWooHoo();
                }

                if ((Rejected && !IsMaster) && Stand.Singleton.CreateInstance(mSauna, Actor, Actor.InheritedPriority(), false, false).RunInteraction())
                {
                    Actor.PlayReaction(ReactionTypes.Embarrassed, ReactionSpeed.AfterInteraction);
                }

                WaitForSyncComplete();
                return(!Rejected);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #12
0
        public static GameObject ReturnShoppingObject(RestockItem rItem, SimDescription actor, StoreSetRegister register)
        {
            GameObject o           = null;
            bool       keepLooping = true;

            switch (rItem.info.Type)
            {
            case ItemType.Herb:
            case ItemType.Ingredient:
                foreach (KeyValuePair <string, List <StoreItem> > kvp in Grocery.mItemDictionary)
                {
                    foreach (StoreItem item in kvp.Value)
                    {
                        if (item.Name.Equals(rItem.info.Name))
                        {
                            keepLooping = false;
                            IngredientData data = (IngredientData)item.CustomData;
                            if (rItem.info.Type == ItemType.Ingredient)
                            {
                                o = Ingredient.Create(data);
                            }
                            else
                            {
                                o = Herb.Create(data);
                                //PlantableNonIngredientData data = (PlantableNonIngredientData)item.CustomData;
                                //o = (GameObject)PlantableNonIngredient.Create(data);
                            }
                            break;
                        }
                    }
                    if (!keepLooping)
                    {
                        break;
                    }
                }

                break;

            case ItemType.Fish:
                o = Fish.CreateFishOfRandomWeight(rItem.info.FType);
                break;

            case ItemType.Craftable:
                break;

            case ItemType.Gem:
            case ItemType.Metal:

                o = (GameObject)RockGemMetalBase.Make(rItem.info.RockData, false);
                break;

            case ItemType.Nectar:

                NectarBottle bottle = (NectarBottle)GlobalFunctions.CreateObjectOutOfWorld("NectarBottle");
                NectarBottleObjectInitParams nectarBottleObjectInitParams = bottle.CreateAncientBottle(rItem.info.NectarAge, rItem.info.Price);

                if (nectarBottleObjectInitParams != null)
                {
                    bottle.mBottleInfo.FruitHash   = nectarBottleObjectInitParams.FruitHash;
                    bottle.mBottleInfo.Ingredients = nectarBottleObjectInitParams.Ingredients;
                    bottle.mBottleInfo.Name        = rItem.info.Name;             //nectarBottleObjectInitParams.Name;
                    bottle.mDateString             = nectarBottleObjectInitParams.DateString;
                    bottle.mBottleInfo.DateNum     = nectarBottleObjectInitParams.DateNum;
                    bottle.mBaseValue                   = rItem.info.Price;  // nectarBottleObjectInitParams.BaseValue;
                    bottle.ValueModifier                = (int)(nectarBottleObjectInitParams.CurrentValue - rItem.info.Price);
                    bottle.mBottleInfo.mCreator         = nectarBottleObjectInitParams.Creator;
                    bottle.mBottleInfo.NectarQuality    = Sims3.Gameplay.Objects.Quality.Neutral;                 //NectarBottle.GetQuality((float)rItem.info.Price);
                    bottle.mBottleInfo.MadeByLevel10Sim = nectarBottleObjectInitParams.MadeByLevel10Sim;
                    bottle.UpdateVisualState();
                }

                o = bottle;

                break;

            case ItemType.AlchemyPotion:

                foreach (AlchemyRecipe recipe in AlchemyRecipe.GetAllAwardPotionRecipes())
                {
                    if (rItem.info.Name.Equals(recipe.Name))
                    {
                        string[] array = new string[] { recipe.Key };

                        AlchemyRecipe randomAwardPotionRecipe = AlchemyRecipe.GetRandomAwardPotionRecipe();
                        PotionShopConsignmentRegister.PotionShopConsignmentRegisterData potionShopConsignmentRegisterData = new PotionShopConsignmentRegister.PotionShopConsignmentRegisterData();

                        potionShopConsignmentRegisterData.mParameters             = array;
                        potionShopConsignmentRegisterData.mObjectName             = randomAwardPotionRecipe.MedatorName;
                        potionShopConsignmentRegisterData.mGuid                   = potionShopConsignmentRegisterData.mObjectName.GetHashCode();
                        potionShopConsignmentRegisterData.mSellerAge              = CASAgeGenderFlags.None;
                        potionShopConsignmentRegisterData.mWeight                 = 100f;
                        potionShopConsignmentRegisterData.mSellPriceMinimum       = 0.75f;
                        potionShopConsignmentRegisterData.mSellPriceMaximum       = 1.25f;
                        potionShopConsignmentRegisterData.mDepreciationAgeMinimum = 0;
                        potionShopConsignmentRegisterData.mDepreciationAgeMaximum = 5;
                        potionShopConsignmentRegisterData.mLifespan               = 3f;
                        string text = string.Empty;
                        if (!string.IsNullOrEmpty(randomAwardPotionRecipe.CustomClassName))
                        {
                            text = randomAwardPotionRecipe.CustomClassName;
                        }
                        else
                        {
                            text = "Sims3.Gameplay.Objects.Alchemy.AlchemyPotion";
                        }
                        potionShopConsignmentRegisterData.mScriptClass = text;
                        potionShopConsignmentRegisterData.mIsRotatable = true;

                        PotionShopConsignmentRegister.PotionShopConsignmentRegisterObjectData potionShopConsignmentRegisterObjectData2 = PotionShopConsignmentRegister.PotionShopConsignmentRegisterObjectData.Create(potionShopConsignmentRegisterData);
                        potionShopConsignmentRegisterObjectData2.ShowTooltip = true;

                        o = (GameObject)potionShopConsignmentRegisterObjectData2.mObject;


                        break;
                    }
                }

                break;

            case ItemType.Bug:
                Terrarium t = Terrarium.Create(rItem.info.BugType);
                if (t != null)
                {
                    t.StartVfx();
                }
                o = t;
                break;

            case ItemType.Food:
                int servingPrice = 25;
                if (register != null)
                {
                    servingPrice = register.Info.ServingPrice;
                }

                IFoodContainer container = rItem.info.cookingProcess.Recipe.CreateFinishedFood(rItem.info.cookingProcess.Quantity, rItem.info.cookingProcess.Quality);

                if (rItem.info.cookingProcess.Quantity == Recipe.MealQuantity.Group)
                {
                    ((ServingContainerGroup)container).mPurchasedPrice = StoreHelperClass.ReturnPriceByQuality(rItem.info.cookingProcess.Quality, servingPrice * ((ServingContainerGroup)container).mNumServingsLeft);
                    ((ServingContainerGroup)container).RemoveSpoilageAlarm();
                }
                else
                {
                    ((ServingContainerSingle)container).mPurchasedPrice = StoreHelperClass.ReturnPriceByQuality(rItem.info.cookingProcess.Quality, servingPrice);
                    ((ServingContainerSingle)container).RemoveSpoilageAlarm();
                }

                o = (GameObject)container;

                break;

            case ItemType.Flowers:
                o = Wildflower.CreateWildflowerOfType(rItem.info.TypeOfWildFlower, Wildflower.WildflowerState.InVase);
                break;

            case ItemType.BookAlchemyRecipe_:
            case ItemType.BookComic_:
            case ItemType.BookFish_:
            case ItemType.BookGeneral_:
            case ItemType.BookRecipe_:
            case ItemType.BookSkill_:
            case ItemType.BookToddler_:
            case ItemType.SheetMusic_:
            case ItemType.AcademicTextBook_:

                foreach (KeyValuePair <string, List <StoreItem> > kvp in Bookstore.sItemDictionary)
                {
                    foreach (StoreItem item in kvp.Value)
                    {
                        if (item.Name.Equals(rItem.info.Name))
                        {
                            keepLooping = false;

                            if (rItem.info.Type == ItemType.BookGeneral_)
                            {
                                o = (GameObject)BookGeneral.CreateOutOfWorld(item.CustomData as BookGeneralData);
                            }
                            if (rItem.info.Type == ItemType.BookSkill_)
                            {
                                o = (GameObject)BookSkill.CreateOutOfWorld(item.CustomData as BookSkillData);
                            }
                            if (rItem.info.Type == ItemType.BookRecipe_)
                            {
                                o = (GameObject)BookRecipe.CreateOutOfWorld(item.CustomData as BookRecipeData);
                            }
                            if (rItem.info.Type == ItemType.SheetMusic_)
                            {
                                o = (GameObject)SheetMusic.CreateOutOfWorld(item.CustomData as SheetMusicData);
                            }
                            if (rItem.info.Type == ItemType.BookToddler_)
                            {
                                o = (GameObject)BookToddler.CreateOutOfWorld(item.CustomData as BookToddlerData);
                            }
                            if (rItem.info.Type == ItemType.BookFish_)
                            {
                                o = (GameObject)BookFish.CreateOutOfWorld(item.CustomData as BookFishData);
                            }
                            if (rItem.info.Type == ItemType.BookAlchemyRecipe_)
                            {
                                o = (GameObject)BookAlchemyRecipe.CreateOutOfWorld(item.CustomData as BookAlchemyRecipeData);
                            }
                            if (rItem.info.Type == ItemType.AcademicTextBook_)
                            {
                                o = (GameObject)AcademicTextBook.CreateOutOfWorld(item.CustomData as AcademicTextBookData, actor);
                            }
                            if (rItem.info.Type == ItemType.BookComic_)
                            {
                                o = (GameObject)BookComic.CreateOutOfWorld(item.CustomData as BookComicData);
                            }

                            break;
                        }
                    }
                    if (!keepLooping)
                    {
                        break;
                    }
                }


                break;

            case ItemType.JamJar:
                JamJar jamJar = GlobalFunctions.CreateObjectOutOfWorld("canningJarJam", ProductVersion.Store) as JamJar;

                if (jamJar != null)
                {
                    Type         tInfo = jamJar.GetType();
                    BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
                    FieldInfo    ingredientDataField = tInfo.GetField("mData", flags);
                    FieldInfo    ingredientKeyField  = tInfo.GetField("mIngredientKey", flags);
                    FieldInfo    qualityField        = tInfo.GetField("mQuality", flags);
                    FieldInfo    preservesField      = tInfo.GetField("mIsPreserves", flags);
                    MethodInfo   materialStateMethod = tInfo.GetMethod("SetMaterialState", flags);

                    ingredientDataField.SetValue(jamJar, rItem.info.IngData);
                    ingredientKeyField.SetValue(jamJar, rItem.info.IngredientKey);
                    qualityField.SetValue(jamJar, rItem.info.JamQuality);
                    preservesField.SetValue(jamJar, rItem.info.JamIsPreserve);
                    materialStateMethod.Invoke(jamJar, null);
                }
                o = (GameObject)jamJar;
                break;

            default:
                break;
            }

            return(o);
        }
Example #13
0
        public override bool Run()
        {
            try
            {
                IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                bool flag2 = false;
                if (mIsMaster)
                {
                    WooHooee.InteractionQueue.AddNext(new RouteToObject.Definition(WooHooer).CreateInstance(Target, WooHooee, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true));

                    flag2 = Target.RouteToSarcaphagus(Actor, null);
                }
                else
                {
                    flag2 = Target.RouteToSarcaphagus(Actor, WooHooer);
                }

                if (!flag2)
                {
                    Actor.AddExitReason(ExitReason.Finished);
                    return(false);
                }

                if (mIsMaster && Target.ActorsUsingMe.Contains(WooHooee))
                {
                    return(false);
                }

                StandardEntry();
                EnterStateMachine("Sarcophagus", "Enter", "x", "sarcophagus");
                SetParameter("isMummy", Actor.SimDescription.IsMummy);
                RegisterForHidingEvents();
                AnimateSim("Open");
                if (mIsMaster && !Actor.HasExitReason())
                {
                    SarcophagusWooHoo entry = definition.ProxyClone(WooHooer).CreateInstance(Target, WooHooee, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true) as SarcophagusWooHoo;
                    entry.LinkedInteractionInstance = this;
                    entry.WooHooer = WooHooer;
                    entry.WooHooee = WooHooee;
                    WooHooee.InteractionQueue.AddNext(entry);
                }

                AnimateSim("WooHooWait");
                if (StartSync(mIsMaster))
                {
                    BeginCommodityUpdates();

                    try
                    {
                        if (mIsMaster)
                        {
                            CommonWoohoo.TestNakedOutfit(Woohooer.Settings.mNakedOutfitSarcophagus, WooHooer, WooHooee);

                            mWooHooFX = VisualEffect.Create("sarcophagusCairoWoohooPetals");
                            mWooHooFX.ParentTo(Target, Slot.FXJoint_0);
                            mWooHooFX.Start();
                            Audio.StartObjectSound(Target.ObjectId, "sarcoph_woohoo", false);
                        }
                        isWooHooing = true;
                        RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                        AnimateSim("WooHoo");
                        RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);
                        isWooHooing = false;
                    }
                    finally
                    {
                        EndCommodityUpdates(true);
                    }

                    if (mIsMaster)
                    {
                        mWooHooFX.Stop();

                        CommonWoohoo.RunPostWoohoo(Actor, WooHooee, Target, definition.GetStyle(this), definition.GetLocation(Target), true);

                        do
                        {
                            SpeedTrap.Sleep(0xa);
                        }while (Target.UseCount > 0x1);
                    }
                }
                else if (mIsMaster)
                {
                    if (LinkedInteractionInstance != null)
                    {
                        LinkedInteractionInstance.InstanceActor.AddExitReason(ExitReason.CanceledByScript);
                    }

                    do
                    {
                        SpeedTrap.Sleep(0xa);
                    }while (Target.UseCount > 0x1);
                }

                PrepSimForExit(true);
                Target.EnableRoutingFootprint(Actor);
                AnimateSim("Exit");
                StandardExit();
                if (mIsMaster)
                {
                    if (CommonPregnancy.IsSuccess(WooHooer, WooHooee, Autonomous, definition.GetStyle(this)))
                    {
                        CommonPregnancy.Impregnate(WooHooer, WooHooee, Autonomous, definition.GetStyle(this));
                    }
                }
                else
                {
                    Actor.RouteAway(1f, 3f, false, GetPriority(), Autonomous, false, true, RouteDistancePreference.PreferNearestToRouteOrigin);
                }

                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #14
0
        protected override Scenario.GatherResult Gather(List <Scenario> list, ref int continueChance, ref int maximum, ref bool random)
        {
            if (mCollectables == null)
            {
                mCollectables = new List <GameObject>();
                foreach (GameObject obj in Sims3.Gameplay.Queries.GetObjects <GameObject>())
                {
                    if (obj.InInventory)
                    {
                        continue;
                    }

                    if (!obj.InWorld)
                    {
                        continue;
                    }

                    if (obj.LotCurrent == null)
                    {
                        continue;
                    }

                    RockGemMetalBase rock = obj as RockGemMetalBase;
                    if (rock != null)
                    {
                        if (rock.mCollected)
                        {
                            continue;
                        }

                        if (rock.IsOnSpawner)
                        {
                            continue;
                        }

                        mCollectables.Add(obj);
                    }
                    else if (obj is InsectJig)
                    {
                        mCollectables.Add(obj);
                    }
                    else if (obj is MinorPet)
                    {
                        MinorPet pet = obj as MinorPet;

                        if (pet.IsUnconscious)
                        {
                            continue;
                        }

                        if (pet.Captured)
                        {
                            if (!pet.Escaped)
                            {
                                continue;
                            }
                        }

                        mCollectables.Add(obj);
                    }
                    else
                    {
                        DigSite site = obj as DigSite;
                        if ((site != null) && (site.NumTreasuresRemaining > 0))
                        {
                            mCollectables.Add(obj);
                        }
                    }
                }

                if (mCollectables.Count == 0)
                {
                    return(GatherResult.Failure);
                }
            }

            return(base.Gather(list, ref continueChance, ref maximum, ref random));
        }
Example #15
0
        public override bool Run()
        {
            try
            {
                IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                if (Target.IsBroken)
                {
                    return(false);
                }

                int num;
                if (mIsMaster)
                {
                    if (!Actor.RouteToSlotListAndCheckInUse(Target, TimePortal.kRoutingSlots, out num))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!Actor.RouteToSlotList(Target, TimePortal.kRoutingSlots, out num))
                    {
                        return(false);
                    }
                }

                if (Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                {
                    return(false);
                }

                StandardEntry();

                EnterStateMachine("timeportal", "Enter", "x", "portal");
                AddPersistentScriptEventHandler(0xc9, CameraShakeEventEx);

                if (mIsMaster && !Actor.HasExitReason())
                {
                    TimePortalWooHoo entry = definition.ProxyClone(Actor).CreateInstance(Target, mWoohooee, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true) as TimePortalWooHoo;
                    entry.LinkedInteractionInstance = this;
                    entry.mWoohooee = mWoohooee;
                    mWoohooee.InteractionQueue.AddNext(entry);
                }

                Skill futureSkill = Actor.SkillManager.AddElement(SkillNames.Future);
                if (futureSkill.SkillLevel >= 0x3)
                {
                    AnimateSim("Jump In");
                }
                else
                {
                    AnimateSim("Apprehensive");
                }

                bool succeeded = true;

                if (StartSync(mIsMaster))
                {
                    BeginCommodityUpdates();

                    RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);

                    if (mIsMaster)
                    {
                        CommonWoohoo.TestNakedOutfit(Woohooer.Settings.mNakedOutfitTimePortal, Actor, mWoohooee);

                        TimePortal.PortalState previousState = Target.State;

                        List <TimePortal.PortalState> choices = new List <TimePortal.PortalState>();
                        foreach (TimePortal.PortalState state in Enum.GetValues(typeof(TimePortal.PortalState)))
                        {
                            if (state == TimePortal.PortalState.Invalid_State)
                            {
                                continue;
                            }

                            choices.Add(state);
                        }

                        int count = 0;
                        while (Target.ActorsUsingMe.Contains(mWoohooee))
                        {
                            TimePortalWooHoo interaction = LinkedInteractionInstance as TimePortalWooHoo;
                            if (interaction == null)
                            {
                                break;
                            }

                            if (mWoohooee.HasExitReason(ExitReason.Canceled))
                            {
                                break;
                            }

                            if (mIsMaster)
                            {
                                if (count > 30)
                                {
                                    break;
                                }
                                count++;

                                Target.UpdateState(RandomUtil.GetRandomObjectFromList(choices));

                                if (RandomUtil.RandomChance(5))
                                {
                                    CameraShakeEventEx(null, null);
                                }
                            }

                            SpeedTrap.Sleep(10);
                        }

                        CommonWoohoo.RunPostWoohoo(Actor, mWoohooee, Target, definition.GetStyle(this), definition.GetLocation(Target), true);

                        Target.UpdateState(previousState);
                    }
                    else
                    {
                        do
                        {
                            SpeedTrap.Sleep(0xa);
                        }while (Target.UseCount > 0x1);
                    }

                    RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);
                }
                else if (mIsMaster)
                {
                    if (LinkedInteractionInstance != null)
                    {
                        LinkedInteractionInstance.InstanceActor.AddExitReason(ExitReason.CanceledByScript);
                    }
                }

                if (((succeeded && Actor.TraitManager.HasElement(TraitNames.Unstable)) && (!Actor.BuffManager.HasElement(BuffNames.FeelingOutOfSorts) && !Actor.BuffManager.HasElement(BuffNames.ImpendingEpisode))) && (!Actor.BuffManager.HasElement(BuffNames.Delusional) && RandomUtil.RandomChance01(kUnstableTraitChance)))
                {
                    Actor.BuffManager.AddElement(BuffNames.FeelingOutOfSorts, Origin.FromUnstableTrait);
                }

                if (futureSkill.SkillLevel >= 0x3)
                {
                    AnimateSim("Exit");
                }
                else
                {
                    AnimateSim("Spit Out");
                }

                EndCommodityUpdates(succeeded);
                StandardExit();

                if (!mIsMaster)
                {
                    if (CommonPregnancy.IsSuccess(Actor, mWoohooee, Autonomous, definition.GetStyle(this)))
                    {
                        CommonPregnancy.Impregnate(Actor, mWoohooee, Autonomous, definition.GetStyle(this));
                    }

                    Actor.RouteAway(1f, 3f, false, GetPriority(), Autonomous, false, true, RouteDistancePreference.PreferNearestToRouteOrigin);
                }
                else
                {
                    Target.StopActiveFX();
                }

                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #16
0
        public override bool Run()
        {
            try
            {
                if (!SafeToSync())
                {
                    return(false);
                }
                else if (BoxStallToUse == null)
                {
                    return(false);
                }
                else if (!StartSync(IsMaster))
                {
                    return(false);
                }

                if (!IsMaster)
                {
                    SpeedTrap.Sleep();
                }

                try
                {
                    Slot destinationSlot = IsMaster ? BoxStall.kRoutingSlot_SnuggleA : BoxStall.kRoutingSlot_SnuggleB;
                    if (Actor.IsHuman)
                    {
                        if (IsMaster)
                        {
                            (BoxStallToUse.PortalComponent as BoxStall.BoxStallPortalComponent).AddPortals();
                        }

                        if (!BoxStallToUse.TryRouteToSlot(Actor, BoxStall.kRoutingSlot_EnterA, BoxStall.RouteOptions.IgnoreOrientation | BoxStall.RouteOptions.IgnoreExitReasons))
                        {
                            return(false);
                        }

                        if (!BoxStallToUse.TryRouteToSlot(Actor, destinationSlot))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        if (!BoxStallToUse.RouteToAndEnter(Actor, destinationSlot, this))
                        {
                            return(false);
                        }
                    }

                    Actor.SynchronizationLevel = Sim.SyncLevel.Routed;
                    if (!Actor.WaitForSynchronizationLevelWithSim(Target, Sim.SyncLevel.Routed, 30f))
                    {
                        return(false);
                    }

                    BeginCommodityUpdates();

                    IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                    if (IsMaster)
                    {
                        try
                        {
                            RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                            Actor.EnableCensor(Sim.CensorType.FullBody);
                            Target.EnableCensor(Sim.CensorType.FullBody);
                            EnterStateMachine("BoxStallWooHoo", "Enter", "x", "y");
                            AddPersistentSynchronousScriptEventHandler(0x65, StartEffects);
                            AddPersistentSynchronousScriptEventHandler(0x66, StopEffects);
                            mCurrentStateMachine.RequestState(false, "x", "WooHoo");
                            mCurrentStateMachine.RequestState(true, "y", "WooHoo");
                            mCurrentStateMachine.RequestState(false, "x", "Exit");
                            mCurrentStateMachine.RequestState(true, "y", "Exit");
                        }
                        finally
                        {
                            Actor.AutoEnableCensor();
                            Target.AutoEnableCensor();
                            RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);
                        }

                        CommonWoohoo.RunPostWoohoo(Actor, Target, TargetBoxStall(), definition.GetStyle(this), definition.GetLocation(TargetBoxStall()), true);

                        if (RandomUtil.RandomChance(HayStack.kChanceOfRolledInHayMoodlet))
                        {
                            Actor.BuffManager.AddElement(BuffNames.RolledInTheHay, WoohooBuffs.sWoohooOrigin);
                            Target.BuffManager.AddElement(BuffNames.RolledInTheHay, WoohooBuffs.sWoohooOrigin);
                        }

                        if (Actor.IsHuman)
                        {
                            BoxStallToUse.TryRouteToSlot(Actor, BoxStall.kRoutingSlot_EnterB, BoxStall.RouteOptions.IgnoreOrientation | BoxStall.RouteOptions.IgnoreExitReasons);
                            BoxStallToUse.TryRouteToSlot(Actor, BoxStall.kRoutingSlot_Exit, BoxStall.RouteOptions.IgnoreExitReasons);
                        }
                    }

                    if (IsMaster)
                    {
                        if (CommonPregnancy.IsSuccess(Actor, Target, Autonomous, definition.GetStyle(this)))
                        {
                            CommonPregnancy.Impregnate(Actor, Target, Autonomous, definition.GetStyle(this));
                        }
                    }

                    if (Actor.IsHuman)
                    {
                        BoxStallToUse.TryRouteToSlot(Actor, BoxStall.kRoutingSlot_EnterB, BoxStall.RouteOptions.IgnoreOrientation | BoxStall.RouteOptions.IgnoreExitReasons);
                        BoxStallToUse.TryRouteToSlot(Actor, BoxStall.kRoutingSlot_Exit, BoxStall.RouteOptions.IgnoreExitReasons);
                    }

                    Actor.SynchronizationLevel = Sim.SyncLevel.Completed;
                    if (!Actor.WaitForSynchronizationLevelWithSim(Target, Sim.SyncLevel.Completed, ExitReason.None, 30f))
                    {
                        EndCommodityUpdates(false);
                        return(false);
                    }

                    if ((!IsMaster) && (!Actor.IsHuman))
                    {
                        TryPushAsContinuation(BoxStall.Exit.Singleton, BoxStallToUse);
                    }

                    EndCommodityUpdates(true);
                    FinishLinkedInteraction();
                    WaitForSyncComplete();
                    return(true);
                }
                finally
                {
                    if ((Actor.IsHuman) && (IsMaster))
                    {
                        (BoxStallToUse.PortalComponent as BoxStall.BoxStallPortalComponent).RemovePortals();
                    }
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception exception)
            {
                Common.Exception(Actor, Target, exception);
                return(false);
            }
        }
Example #17
0
        public override bool Run()
        {
            try
            {
                string          str2;
                ProxyDefinition definition = InteractionDefinition as ProxyDefinition;

                bool flag2 = false;
                if (mIsMaster)
                {
                    WooHooee.InteractionQueue.AddNext(new RouteToObject.Definition(WooHooer).CreateInstance(Target, WooHooee, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true));

                    flag2 = Target.RouteToMachine(Actor, false, null);
                }
                else
                {
                    flag2 = Target.RouteToMachine(Actor, false, WooHooer);
                }

                if (!flag2)
                {
                    Actor.AddExitReason(ExitReason.Finished);
                    return(false);
                }

                if (mIsMaster && Target.ActorsUsingMe.Contains(WooHooee))
                {
                    return(false);
                }

                Actor.SimDescription.Contactable = false;
                StandardEntry();
                EnterStateMachine("TimeMachine", "Enter", "x");
                SetActor("timeMachine", Target);
                SetParameter("isFuture", definition.Definition.TimePeriod == TimeMachine.TravelTimePeriod.Future);
                Target.SetMaterial("InUse");
                AddOneShotScriptEventHandler(0x66, ToggleHiddenAnimationEvent);
                if (mIsMaster)
                {
                    AddOneShotScriptEventHandler(0x3ee, OnEnterAnimationEvent);
                }
                else
                {
                    Target.EnableRoutingFootprint(Actor);
                }

                AnimateSim("GetIn");
                if ((WooHooee == null) || WooHooee.HasBeenDestroyed)
                {
                    AnimateSim("WooHoo");
                    Target.PushSimsFromFootprint(TimeMachine.sFootprintPathingHash, Actor, null, true);
                    SpeedTrap.Sleep(0x64);

                    string str;
                    Target.PickExitStateAndSound(definition.Definition.TimePeriod, out str, out mExitSound);
                    if (mIsMaster)
                    {
                        AddOneShotScriptEventHandler(0x3e9, OnExitAnimationEvent);
                        AddOneShotScriptEventHandler(0x3ef, OnExitAnimationEvent);
                    }
                    AddOneShotScriptEventHandler(0x67, ToggleHiddenAnimationEvent);
                    AnimateSim(str);
                    Target.SetMaterial("default");
                    AnimateSim("Exit");
                    StandardExit();
                    return(true);
                }
                if (mIsMaster && !Actor.HasExitReason())
                {
                    TimeMachineWooHoo entry = definition.ProxyClone(WooHooer).CreateInstance(Target, WooHooee, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true) as TimeMachineWooHoo;
                    entry.LinkedInteractionInstance = this;
                    entry.WooHooer = WooHooer;
                    entry.WooHooee = WooHooee;
                    WooHooee.InteractionQueue.AddNext(entry);
                }
                isWooHooing = true;
                RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                AnimateSim("WooHoo");
                if (StartSync(mIsMaster))
                {
                    BeginCommodityUpdates();

                    try
                    {
                        DoTimedLoop(RandomUtil.GetFloat(TimeMachine.kWooHooMinutesMin, TimeMachine.kWooHooMinutesMax));
                    }
                    finally
                    {
                        EndCommodityUpdates(true);
                    }

                    if (mIsMaster)
                    {
                        CommonWoohoo.TestNakedOutfit(Woohooer.Settings.mNakedOutfitTimeMachine, WooHooer, WooHooee);

                        CommonWoohoo.RunPostWoohoo(Actor, WooHooee, Target, definition.GetStyle(this), definition.GetLocation(Target), true);

                        do
                        {
                            SpeedTrap.Sleep(0xa);
                        }while (Target.UseCount > 0x1);

                        if (CommonPregnancy.IsSuccess(WooHooee, WooHooer, Autonomous, definition.GetStyle(this)))
                        {
                            if (WooHooer.IsMale)
                            {
                                Target.AddTryForBabyAlarm(WooHooer.SimDescription.SimDescriptionId, WooHooee.SimDescription.SimDescriptionId, definition.Definition.TimePeriod);
                            }
                            else
                            {
                                Target.AddTryForBabyAlarm(WooHooee.SimDescription.SimDescriptionId, WooHooer.SimDescription.SimDescriptionId, definition.Definition.TimePeriod);
                            }
                        }
                    }
                }
                else if (mIsMaster)
                {
                    Target.PushSimsFromFootprint(TimeMachine.sFootprintPathingHash, Actor, null, true);
                    SpeedTrap.Sleep(0x64);
                    if (LinkedInteractionInstance != null)
                    {
                        LinkedInteractionInstance.InstanceActor.AddExitReason(ExitReason.CanceledByScript);
                    }
                    do
                    {
                        SpeedTrap.Sleep(0xa);
                    }while (Target.UseCount > 0x1);
                }
                Target.PickExitStateAndSound(definition.Definition.TimePeriod, out str2, out mExitSound);
                if (mIsMaster)
                {
                    AddOneShotScriptEventHandler(0x3e9, new SacsEventHandler(OnExitAnimationEvent));
                    AddOneShotScriptEventHandler(0x3ef, new SacsEventHandler(OnExitAnimationEvent));
                }
                AddOneShotScriptEventHandler(0x67, new SacsEventHandler(ToggleHiddenAnimationEvent));
                AnimateSim(str2);
                Target.SetMaterial("default");
                AnimateSim("Exit");
                RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);
                isWooHooing = false;
                StandardExit();
                if (!mIsMaster)
                {
                    Actor.RouteAway(1f, 3f, false, GetPriority(), Autonomous, false, true, RouteDistancePreference.PreferNearestToRouteOrigin);
                }
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #18
0
        public override bool Run()
        {
            try
            {
                if (!StartSync())
                {
                    return(false);
                }

                bool flag2 = false;

                StandardEntry(false);
                BeginCommodityUpdates();

                bool succeeded = false;

                try
                {
                    if (IsMaster)
                    {
                        HotTubBase container = Actor.Posture.Container as HotTubBase;
                        container.mSimsAreWooHooing = true;
                        ReturnInstance.EnsureMaster();
                        mCurrentStateMachine = ReturnInstance.mCurrentStateMachine;

                        IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;;

                        string socialName = CommonWoohoo.GetSocialName(definition.GetStyle(this), Actor);
                        StartSocial(socialName);

                        Actor.SocialComponent.StartSocializingWith(Target);

                        Dictionary <Sim, SocialRule> effects = new Dictionary <Sim, SocialRule>();
                        SocialEffect = Actor.Conversation.UpdateOnSelectingInteraction(Actor, Target, Autonomous, CommonWoohoo.GetSocialName(definition.GetStyle(this), Actor), null, null, effects);
                        Rejected     = (SocialEffect == null) || (!SocialEffect.LHS.IsSocialAccepted());

                        InitiateSocialUI(Actor, Target);
                        (LinkedInteractionInstance as NestedCuddleInteraction).Rejected = Rejected;
                        if (Rejected)
                        {
                            mCurrentStateMachine.RequestState(null, "Woo Hoo Reject");
                            mCurrentStateMachine.RequestState(null, "ExitSitting");
                            FinishSocial(socialName, true);
                            FinishSocialContext();
                            Actor.BuffManager.AddElement(BuffNames.WalkOfShame, Origin.FromRejectedWooHooOffHome);
                        }
                        else
                        {
                            if (CommonWoohoo.NeedPrivacy(false, Actor, Target))
                            {
                                mSituation = new WooHoo.WooHooPrivacySituation(this);
                                flag2      = !mSituation.Start();
                            }

                            if (!flag2)
                            {
                                RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                                mCurrentStateMachine.AddOneShotScriptEventHandler(0x6e, OnAnimationEvent);
                                mCurrentStateMachine.AddOneShotScriptEventHandler(0x6f, OnAnimationEvent);
                                mCurrentStateMachine.AddOneShotScriptEventHandler(0x78, OnAnimationEvent);
                                mCurrentStateMachine.AddOneShotScriptEventHandler(0x79, OnAnimationEvent);
                                mCurrentStateMachine.AddOneShotScriptEventHandler(0x70, OnBabyCheck);

                                mCurrentStateMachine.RequestState(null, "Woo Hoo Accept");
                                PuddleManager.AddPuddle(Actor.Posture.Container.Position);
                                RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);

                                CommonWoohoo.RunPostWoohoo(Actor, Target, container, definition.GetStyle(this), definition.GetLocation(container), true);
                            }

                            FinishSocial(socialName, true);
                        }
                    }
                    else
                    {
                        DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                    }
                    FinishLinkedInteraction(IsMaster);
                    succeeded = !Rejected && !flag2;
                }
                finally
                {
                    EndCommodityUpdates(succeeded);
                    StandardExit(false, false);
                }

                if (Rejected)
                {
                    InvokeDoResumeOnCleanup = false;
                }
                else if (!mPrivacyFailed)
                {
                    Actor.SimDescription.SetFirstWooHoo();
                }

                WaitForSyncComplete();
                return(!Rejected);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #19
0
        public override bool Run()
        {
            try
            {
                if (!(Actor.Posture is FairyHouse.FairyHousePosture))
                {
                    return(false);
                }

                mLinkedActor = LinkedInteractionInstance.InstanceActor;
                if (!StartSync(mIsMaster))
                {
                    if (!Target.IsNextInteractionAFairyHouseInteraction(Actor))
                    {
                        Target.PushGetOutAsContinuation(Actor);
                    }
                    return(false);
                }

                StandardEntry(false);
                BeginCommodityUpdates();
                mCurrentStateMachine = Actor.Posture.CurrentStateMachine;
                if (mIsMaster)
                {
                    SetActorAndEnter("y", Actor, "WooHoo");
                    SetActorAndEnter("fairyHouse", Target, "Enter");
                    RockGemMetalBase.HandleNearbyWoohoo(Target, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                    Animate("fairyHouse", "WooHoo");
                    Animate("fairyHouse", "Exit");

                    IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                    CommonWoohoo.RunPostWoohoo(Actor, mLinkedActor, Target, definition.GetStyle(this), definition.GetLocation(Target), true);

                    if (CommonPregnancy.IsSuccess(Actor, mLinkedActor, Autonomous, definition.GetStyle(this)))
                    {
                        CommonPregnancy.Impregnate(Actor, mLinkedActor, Autonomous, definition.GetStyle(this));
                    }
                }
                else
                {
                    DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                }

                EventTracker.SendEvent(EventTypeId.kWooHooedInTheFairyHouse, Actor, mLinkedActor);
                EndCommodityUpdates(true);
                StandardExit(false, false);
                FinishLinkedInteraction(mIsMaster);
                WaitForSyncComplete();

                LongTermRelationshipTypes longTermRelationship = Relationship.GetLongTermRelationship(Actor, mLinkedActor);
                Relationship relationship = Relationship.Get(Actor, mLinkedActor, true);
                if (mIsMaster && (relationship != null))
                {
                    relationship.LTR.UpdateLiking(FairyHouse.kLTRIncreaseOnWoohoo);
                    LongTermRelationshipTypes currentLTR = relationship.CurrentLTR;
                    SocialComponent.SetSocialFeedback(CommodityTypes.Friendly, Actor, true, 0x0, longTermRelationship, currentLTR);
                    SocialComponent.SetSocialFeedback(CommodityTypes.Friendly, mLinkedActor, true, 0x0, longTermRelationship, currentLTR);
                }

                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception exception)
            {
                Common.Exception(Actor, Target, exception);
                return(false);
            }
        }
Example #20
0
        public override bool Run()
        {
            try
            {
                mLinkedActor = LinkedInteractionInstance.InstanceActor;

                IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                bool succeeded = true;
                if (mIsMaster)
                {
                    Target.mRoutingSims.Add(Actor);
                    Target.mRoutingSims.Add(mLinkedActor);
                }

                if (!mIsMaster)
                {
                    bool success = false;

                    Actor.RouteToObjectRadialRange(Target, 1.5f, 4f);
                    while (Target.mRoutingSims.Contains(mLinkedActor))
                    {
                        AncientPortalWooHoo interaction = LinkedInteractionInstance as AncientPortalWooHoo;
                        if (interaction == null)
                        {
                            break;
                        }

                        if (mLinkedActor.HasExitReason(ExitReason.Canceled))
                        {
                            break;
                        }

                        if (interaction.mNowWaiting)
                        {
                            success = true;
                            break;
                        }

                        SpeedTrap.Sleep(0xa);
                    }

                    if (!success)
                    {
                        Actor.AddExitReason(ExitReason.RouteFailed);
                        return(false);
                    }
                }

                bool routeSuccess = false;

                Route r = Actor.CreateRoute();
                r.AddObjectToIgnoreForRoute(mLinkedActor.ObjectId);
                r.PlanToSlot(Target, Target.GetRoutingSlots());
                routeSuccess = Actor.DoRoute(r);

                if ((mIsMaster) && (routeSuccess))
                {
                    routeSuccess = !Actor.InUse;
                }

                if (!routeSuccess)
                {
                    Actor.AddExitReason(ExitReason.RouteFailed);
                    return(false);
                }

                CommonWoohoo.TestNakedOutfit(Woohooer.Settings.mNakedOutfitAncientPortal, Actor);

                StandardEntry();

                EnterStateMachine("AncientPortal", "Enter", "x", "portal");

                AddOneShotScriptEventHandler(0x65, HideSim);
                AddOneShotScriptEventHandler(0x66, ShowSim);
                AnimateSim("InsidePortal");

                if (mIsMaster)
                {
                    Target.RemoveFromUseList(Actor);

                    mNowWaiting = true;

                    RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                }

                BeginCommodityUpdates();

                if (mReactToSocialBroadcaster == null)
                {
                    mReactToSocialBroadcaster = new ReactionBroadcaster(Actor, Conversation.ReactToSocialParams, SocialComponentEx.ReactToJealousEventHigh);
                    CommonWoohoo.CheckForWitnessedCheating(Actor, mLinkedActor, !Rejected);
                }

                if ((Target.BoobyTrapComponent != null) ? Target.BoobyTrapComponent.CanTriggerTrap(Actor.SimDescription) : false)
                {
                    Target.TriggerTrap(Actor);
                }

                int count = 0;

                while (Target.mRoutingSims.Contains(mLinkedActor))
                {
                    AncientPortalWooHoo interaction = LinkedInteractionInstance as AncientPortalWooHoo;
                    if (interaction == null)
                    {
                        break;
                    }

                    if (mLinkedActor.HasExitReason(ExitReason.Canceled))
                    {
                        break;
                    }

                    if (!mIsMaster)
                    {
                        interaction.mWasSuccess = true;

                        if (count > 30)
                        {
                            break;
                        }
                        count++;

                        Target.SetOpacity(RandomUtil.GetFloat(0f, 1f), 0.25f);
                    }

                    SpeedTrap.Sleep(10);
                }

                if (!mIsMaster)
                {
                    Target.SetOpacity(1f, 1f);
                }

                AnimateSim("Exit");

                for (int i = 0; i < AncientPortal.CatchABeam.kPotentialTravelBuffs.Length; i++)
                {
                    if (RandomUtil.RandomChance(AncientPortal.CatchABeam.kChanceForEachBuff))
                    {
                        Actor.BuffManager.AddElement(AncientPortal.CatchABeam.kPotentialTravelBuffs[i], Origin.FromAncientPortal);
                    }
                }

                if (mIsMaster)
                {
                    RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);
                }

                EndCommodityUpdates(succeeded);
                StandardExit();

                if ((mWasSuccess) && (mIsMaster))
                {
                    CommonWoohoo.RunPostWoohoo(Actor, mLinkedActor, Target, definition.GetStyle(this), definition.GetLocation(Target), true);

                    if (CommonPregnancy.IsSuccess(Actor, mLinkedActor, Autonomous, definition.GetStyle(this)))
                    {
                        CommonPregnancy.Impregnate(Actor, mLinkedActor, Autonomous, definition.GetStyle(this));
                    }
                }

                Actor.Wander(1f, 2f, false, RouteDistancePreference.PreferNearestToRouteOrigin, false);
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
            finally
            {
                Target.mRoutingSims.Remove(Actor);
            }
        }
Example #21
0
        public override bool InRabbitHole()
        {
            try
            {
                IWooHooDefinition woohooDefinition = InteractionDefinition as IWooHooDefinition;

                Definition interactionDefinition = InteractionDefinition as Definition;
                bool       shouldBeMaster        = false;
                if (Actor == mWooHooer)
                {
                    shouldBeMaster = true;
                }

                if (Actor.IsActiveSim)
                {
                    PlumbBob.HidePlumbBob();
                }

                if (StartSync(shouldBeMaster, false, null, 0f, false))
                {
                    BeginCommodityUpdates();
                    StartStages();
                    if (shouldBeMaster)
                    {
                        Target.TurnOnWooHooEffect();
                    }

                    mStartedWooHooing = true;
                    RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                    bool succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                    EndCommodityUpdates(succeeded);
                    FinishLinkedInteraction(shouldBeMaster);
                    WaitForSyncComplete();
                    if (shouldBeMaster)
                    {
                        Target.TurnOffWooHooEffect();
                        if (Actor.HasExitReason(ExitReason.StageComplete))
                        {
                            CommonWoohoo.RunPostWoohoo(Actor, mWooHooee, Target, woohooDefinition.GetStyle(this), woohooDefinition.GetLocation(Target), true);

                            if (CommonPregnancy.IsSuccess(Actor, mWooHooee, Autonomous, woohooDefinition.GetStyle(this)))
                            {
                                CommonPregnancy.Impregnate(Actor, mWooHooee, Autonomous, woohooDefinition.GetStyle(this));
                            }
                        }
                    }
                }
                else if (shouldBeMaster && (LinkedInteractionInstance != null))
                {
                    LinkedInteractionInstance.InstanceActor.AddExitReason(ExitReason.CanceledByScript);
                }

                if (Actor.IsActiveSim)
                {
                    PlumbBob.ShowPlumbBob();
                }
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #22
0
        public override bool Run()
        {
            Common.StringBuilder msg = new Common.StringBuilder("ShowerWoohoo:Run" + Common.NewLine);

            try
            {
                IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                Actor.BuffManager.RemoveElement(BuffNames.RobotForm);

                mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToBathe);
                mSwitchOutfitHelper.Start();
                if (WaitForBToEnterShower)
                {
                    //Actor.RouteToObjectRadialRange(Shower, 1.5f, 4f);
                    SpeedTrap.Sleep(0xa);
                    while (Shower.SimInShower != Target)
                    {
                        if ((Target.InteractionQueue.GetCurrentInteraction() != TakeShowerInst) || Target.HasExitReason(ExitReason.Canceled))
                        {
                            mSwitchOutfitHelper.Dispose();
                            return(false);
                        }
                        SpeedTrap.Sleep(0xa);
                    }
                }

                msg += "A";

                if (!Actor.RouteToSlot(Shower, Slot.RoutingSlot_0))
                {
                    mSwitchOutfitHelper.Dispose();
                    return(false);
                }

                msg += "B";

                mSwitchOutfitHelper.Wait(true);
                bool flag = Actor.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Singed;
                Shower.AddToUseList(Actor);
                mInUseList           = true;
                mCurrentStateMachine = TakeShowerInst.mCurrentStateMachine;
                SetActorAndEnter("y", Actor, "Enter");
                if (!WaitForBToEnterShower)
                {
                    mCurrentStateMachine.RequestState("y", "Ask");
                }

                msg += "C";

                string socialName = CommonWoohoo.GetSocialName(definition.GetStyle(this), Actor);
                StartSocial(socialName);

                if (WaitForBToEnterShower)
                {
                    Rejected = false;
                }

                InitiateSocialUI(Actor, Target);

                msg += "D";

                bool succeeded = true;
                if (Rejected)
                {
                    succeeded = false;
                    mCurrentStateMachine.RequestState("y", "Reject");
                    mCurrentStateMachine.RemoveActor(Actor);
                    FinishSocial(socialName, true);
                    Actor.BuffManager.AddElement(BuffNames.WalkOfShame, Origin.FromRejectedWooHooOffHome);
                }
                else
                {
                    mCurrentStateMachine.RequestState("y", "ShooSims");
                    SetParameter("SimShouldClothesChange", !flag && !Actor.OccultManager.DisallowClothesChange());
                    mSwitchOutfitHelper.AddScriptEventHandler(this);
                    Actor.LoopIdle();

                    msg += "E";

                    if (CommonWoohoo.NeedPrivacy(Shower.IsOutside, Actor, Target))
                    {
                        mSituation = new BedWoohoo.WooHooPrivacySituation(this);
                        if (!mSituation.Start())
                        {
                            mSwitchOutfitHelper.Dispose();
                            succeeded = false;
                        }
                    }

                    msg += "F";

                    if ((succeeded) && (Actor.RouteToSlot(Shower, Slot.RoutingSlot_0)))
                    {
                        MotiveDelta[] deltaArray = new MotiveDelta[6];
                        deltaArray[0] = AddMotiveDelta(CommodityKind.Fun, 1500f);
                        deltaArray[1] = TakeShowerInst.AddMotiveDelta(CommodityKind.Fun, 1500f);
                        deltaArray[2] = AddMotiveDelta(CommodityKind.Social, 50f);
                        deltaArray[3] = TakeShowerInst.AddMotiveDelta(CommodityKind.Social, 50f);
                        if (Actor.SimDescription.IsPlantSim)
                        {
                            deltaArray[4] = AddMotiveDelta(CommodityKind.Hygiene, 800f * Sims3.Gameplay.Objects.Plumbing.Shower.kPlantSimHygieneModifier);
                        }
                        else
                        {
                            deltaArray[4] = AddMotiveDelta(CommodityKind.Hygiene, 800f);
                        }

                        if (Actor.SimDescription.IsMermaid)
                        {
                            deltaArray[5] = AddMotiveDelta(CommodityKind.MermaidDermalHydration, 800f);
                        }

                        Target.EnableCensor(Sim.CensorType.FullHeight);
                        RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                        mCurrentStateMachine.AddOneShotScriptEventHandler(0x65, OnJealousyEvent);
                        mCurrentStateMachine.AddOneShotScriptEventHandler(0x66, OnAnimationEvent);

                        if (CommonPregnancy.IsSuccess(Actor, Target, Autonomous, definition.GetStyle(this)))
                        {
                            mCurrentStateMachine.AddOneShotScriptEventHandler(0x67, OnPregnancyEvent);
                        }

                        msg += "G";

                        mSteamVfx = VisualEffect.Create(Shower.SteamVfxName);
                        mSteamVfx.ParentTo(Shower, Shower.IsShowerTub ? Slot.FXJoint_2 : Slot.FXJoint_0);
                        mSteamVfx.Start();
                        mCurrentStateMachine.RequestState(null, "BreatheIdle");
                        RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);

                        CommonWoohoo.RunPostWoohoo(Actor, Target, Shower, definition.GetStyle(this), definition.GetLocation(Shower), true);

                        msg += "H";

                        Sims3.Gameplay.Objects.Plumbing.Shower.WaitToLeaveShower(Actor, Shower);

                        // Custom
                        ShowerEx.ApplyPostShowerEffects(Actor, Shower);
                        if (flag)
                        {
                            mSwitchOutfitHelper.Dispose();
                            mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToBathe);
                            mSwitchOutfitHelper.Start();
                            mSwitchOutfitHelper.Wait(false);
                            mSwitchOutfitHelper.ChangeOutfit();
                        }

                        msg += "I";

                        mSwitchOutfitHelper.Dispose();
                        mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GettingOutOfBath);
                        mSwitchOutfitHelper.Start();
                        mSwitchOutfitHelper.AddScriptEventHandler(this);
                        mSwitchOutfitHelper.Wait(false);
                        RemoveMotiveDelta(deltaArray[0x0]);
                        TakeShowerInst.RemoveMotiveDelta(deltaArray[0x1]);
                        RemoveMotiveDelta(deltaArray[0x2]);
                        TakeShowerInst.RemoveMotiveDelta(deltaArray[0x3]);
                        RemoveMotiveDelta(deltaArray[0x4]);

                        if (Actor.SimDescription.IsMermaid)
                        {
                            RemoveMotiveDelta(deltaArray[0x5]);
                        }

                        mCurrentStateMachine.RequestState("y", "Exit Working Y");
                        Target.AutoEnableCensor();

                        msg += "J";
                    }

                    mCurrentStateMachine.RemoveActor(Actor);
                    FinishSocial(socialName, true);
                }

                msg += "K";

                Shower.RemoveFromUseList(Actor);
                mInUseList = false;
                Actor.RouteAway(Sims3.Gameplay.Objects.Plumbing.Shower.kMinDistanceToMoveAwayFromShower, Sims3.Gameplay.Objects.Plumbing.Shower.kMaxDistanceToMoveAwayFromShower, false, GetPriority(), true, true, true, RouteDistancePreference.PreferFurthestFromRouteOrigin);
                if (mSteamVfx != null)
                {
                    mSteamVfx.Stop();
                    mSteamVfx = null;
                }

                msg += "L";

                EndCommodityUpdates(succeeded);
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception exception)
            {
                Common.Exception(Actor, Target, exception);
                return(false);
            }
            finally
            {
                if (TakeShowerInst != null)
                {
                    TakeShowerInst.HavingWooHoo = false;
                }
            }
        }
Example #23
0
        public override bool Run()
        {
            try
            {
                IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                if (mIsMaster && !Actor.HasExitReason())
                {
                    if (!Target.mEnterLine.WaitForTurn(this, Actor, SimQueue.WaitBehavior.Default, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), 30f))
                    {
                        return(false);
                    }

                    List <Sim> exceptionsList = new List <Sim>();
                    exceptionsList.Add(WooHooer);
                    exceptionsList.Add(WooHooee);
                    Target.RemoveSimsExceptFor(exceptionsList);

                    ActorTrailerWooHoo entry = definition.ProxyClone(WooHooer).CreateInstance(Target, WooHooee, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true) as ActorTrailerWooHoo;
                    entry.LinkedInteractionInstance = this;
                    entry.WooHooer = WooHooer;
                    entry.WooHooee = WooHooee;

                    WooHooee.InteractionQueue.AddNext(entry);
                }

                if (!SafeToSync())
                {
                    return(false);
                }

                if (!Target.RouteToAndEnterActorTrailer(Actor, this, false))
                {
                    return(false);
                }

                StandardEntry(false);
                Actor.LoopIdle();
                if (!StartSync(mIsMaster))
                {
                    StandardExit(false, false);
                    return(false);
                }

                BeginCommodityUpdates();

                try
                {
                    if (mIsMaster)
                    {
                        AcquireStateMachine("ActorTrailerSocials");
                        SetActorAndEnter("x", Actor, "FromRestOrSleep");
                        SetActorAndEnter("y", WooHooee, "FromRestOrSleep");
                        SetActor("Trailer", Target);
                        isWooHooing = true;
                        mWooHooReactionBroadcast = new ReactionBroadcaster(Target, ActorTrailer.kWooHooReactionBroadcastParams, PublicWooHooReactionCallback);
                        RockGemMetalBase.HandleNearbyWoohoo(Target, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                        AnimateJoinSims("WooHoo");

                        CommonWoohoo.TestNakedOutfit(Woohooer.Settings.mNakedOutfitActorTrailer, WooHooer, WooHooee);

                        CommonWoohoo.RunPostWoohoo(WooHooer, WooHooee, Target, definition.GetStyle(this), definition.GetLocation(Target), true);

                        if (CommonPregnancy.IsSuccess(WooHooer, WooHooee, Autonomous, definition.GetStyle(this)))
                        {
                            CommonPregnancy.Impregnate(WooHooer, WooHooee, Autonomous, definition.GetStyle(this));
                        }
                        RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);
                        isWooHooing = false;

                        AnimateNoYield("y", "ToRestOrSleep");
                        AnimateSim("ToRestOrSleep");
                    }
                    FinishLinkedInteraction(mIsMaster);
                    WaitForSyncComplete();
                }
                finally
                {
                    EndCommodityUpdates(true);
                }

                StandardExit(false, false);

                if (mIsMaster)
                {
                    //WooHooer.InteractionQueue.PushAsContinuation(ActorTrailer.Relax.Singleton.CreateInstance(Target, WooHooer, new InteractionPriority(InteractionPriorityLevel.Autonomous), true, true), true);
                    //WooHooee.InteractionQueue.PushAsContinuation(ActorTrailer.Relax.Singleton.CreateInstance(Target, WooHooee, new InteractionPriority(InteractionPriorityLevel.Autonomous), true, true), true);

                    if (mWooHooReactionBroadcast != null)
                    {
                        mWooHooReactionBroadcast.Dispose();
                        mWooHooReactionBroadcast = null;
                    }

                    foreach (Sim sim in Sims3.Gameplay.Queries.GetObjects <Sim>(Target.Position, ActorTrailer.kWooHooReactionBroadcastParams.PulseRadius))
                    {
                        if (sim.RoomId == Target.RoomId)
                        {
                            sim.PlayReaction(ReactionTypes.Cheer, Target, ReactionSpeed.NowOrLater);
                        }
                    }
                }
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #24
0
        public static IGameObject FetchRandomOccultTreat(OccultTypes type, bool isAlien)
        {
            if (isAlien)
            {
                InteractionDefinition      instance  = RabbitHole.StealSpaceRocks.Singleton;
                RabbitHole.StealSpaceRocks instance2 = instance as RabbitHole.StealSpaceRocks;
                if (instance2 != null)
                {
                    RabbitHole.StealSpaceRocks.SpaceRockSize weightedIndex = (RabbitHole.StealSpaceRocks.SpaceRockSize)RandomUtil.GetWeightedIndex(instance2.SSRTuning.SpaceRockWeights);
                    RockGemMetal spaceRockSize = RockGemMetal.SpaceRockSmall;
                    switch (weightedIndex)
                    {
                    case RabbitHole.StealSpaceRocks.SpaceRockSize.Small:
                        spaceRockSize = RockGemMetal.SpaceRockSmall;
                        break;

                    case RabbitHole.StealSpaceRocks.SpaceRockSize.Medium:
                        spaceRockSize = RockGemMetal.SpaceRockMedium;
                        break;

                    case RabbitHole.StealSpaceRocks.SpaceRockSize.Large:
                        spaceRockSize = RockGemMetal.SpaceRockLarge;
                        break;
                    }

                    return(RockGemMetalBase.Make(spaceRockSize, false));
                }
            }

            switch (type)
            {
            case OccultTypes.Fairy:
                PlantRarity      rarity  = (PlantRarity)RandomUtil.GetInt(0, 3);
                Quality          quality = (Quality)RandomUtil.GetInt(4, 9);
                PlayerDisclosure playerKnowledgeOfPlantableType = (rarity == PlantRarity.Common) ? PlayerDisclosure.Exposed : PlayerDisclosure.Concealed;
                IGameObject      seed = PlantHelper.CreateRandomPlantable(rarity, quality, true, playerKnowledgeOfPlantableType);

                return(seed);

            case OccultTypes.Frankenstein:
                ScrapInitParameters initData = new ScrapInitParameters(1);
                IGameObject         scrap    = GlobalFunctions.CreateObjectOutOfWorld("scrapPile", ProductVersion.EP2, null, initData);
                return(scrap);

            case OccultTypes.Genie:
                IGameObject lamp = GlobalFunctions.CreateObjectOutOfWorld("GenieLamp", ProductVersion.EP6);
                return(lamp);

            case OccultTypes.Mermaid:
                IGameObject kelp = MermadicKelp.MakeMermadicKelp(RandomUtil.CoinFlip());
                return(kelp);

            case OccultTypes.PlantSim:
                string     randomHerb = RandomUtil.GetRandomObjectFromList <string>(new List <string>(Herb.sIngredientToHerbDataMap.Keys));
                Ingredient herb       = Ingredient.Create(IngredientData.NameToDataMap[randomHerb]);
                return(herb as IGameObject);

            case OccultTypes.Robot:
                TraitChipStaticData data = RandomUtil.GetRandomObjectFromDictionary <ulong, TraitChipStaticData>(GenericManager <TraitChipName, TraitChipStaticData, TraitChip> .sDictionary);
                if (data != null)
                {
                    TraitChip chip = TraitChipManager.CreateTraitChip(data.Guid);
                    return(chip);
                }
                return(null);

            case OccultTypes.Vampire:
                IGameObject vampireTreat = null;
                if (!GameUtils.IsInstalled(ProductVersion.EP3))
                {
                    vampireTreat = Recipe.NameToRecipeHash["VampireJuiceEP7"].CreateFinishedFood(Recipe.MealQuantity.Single, Quality.Perfect);
                }
                else
                {
                    bool coinToss = RandomUtil.CoinFlip();
                    if (coinToss)
                    {
                        vampireTreat = Recipe.NameToRecipeHash["VampireJuice"].CreateFinishedFood(Recipe.MealQuantity.Single, Quality.Perfect);
                    }
                    else
                    {
                        vampireTreat = Ingredient.Create(IngredientData.NameToDataMap["VampireFruit"]);
                    }
                }
                return(vampireTreat);

            case OccultTypes.Werewolf:
                List <FishType> fish    = new List <FishType>();
                List <float>    weights = new List <float>(fish.Count);
                foreach (FishType fishType in Fish.sFishData.Keys)
                {
                    FishData data2 = Fish.sFishData[fishType];
                    if (((data2.IngredientData != null) && data2.IngredientData.CanBuyFromStore) && (data2.Level >= 0))
                    {
                        fish.Add(fishType);
                        weights.Add(1f);
                    }
                }
                int  weightedIndexFish = RandomUtil.GetWeightedIndex(weights.ToArray());
                Fish obj2 = Fish.CreateFishOfRandomWeight(fish[weightedIndexFish]);
                return(obj2 as IGameObject);

            case OccultTypes.Witch:
                if (RandomUtil.CoinFlip())
                {
                    ISoloInteractionDefinition  cdef     = TraitFunctions.ConjureApple.Singleton;
                    TraitFunctions.ConjureApple appleDef = cdef as TraitFunctions.ConjureApple;
                    if (appleDef != null)
                    {
                        return(appleDef.CreateAppleForInventory(RandomUtil.CoinFlip(), Quality.Perfect));
                    }
                }
                else
                {
                    AlchemyPotion potion = AlchemyPotion.CreateARandomPotion(RandomUtil.CoinFlip(), 0);
                    return(potion as IGameObject);
                }
                return(null);

            case OccultTypes.None:
            default:
                return(null);
            }
        }