public override bool Test(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                try
                {
                    HotairBalloon.InBalloonPosture posture = actor.Posture as HotairBalloon.InBalloonPosture;
                    if (posture == null)
                    {
                        return(false);
                    }

                    if (posture.Balloon.GetOtherSim(actor) == null)
                    {
                        return(false);
                    }

                    // Custom
                    return(HotAirBalloonProposal.ProposalTest(posture.Balloon, actor, target, isAutonomous, ref greyedOutTooltipCallback));
                }
                catch (ResetException)
                {
                    throw;
                }
                catch (Exception e)
                {
                    Common.Exception(actor, target, e);
                    return(false);
                }
            }
示例#2
0
            public void OnCompleted(Sim a, float value)
            {
                try
                {
                    List <Sim> sims = new List <Sim>();
                    sims.Add(mObject.GetLeftSim());
                    sims.Add(mObject.GetRightSim());

                    if ((sims.Contains(mActor)) && (sims.Contains(mTarget)))
                    {
                        Common.DebugNotify("OnCompleted C");

                        Sim actor  = mActor;
                        Sim target = mTarget;

                        HotairBalloon.InBalloonPosture posture = mActor.Posture as HotairBalloon.InBalloonPosture;
                        if ((posture == null) || (!posture.IsXActor))
                        {
                            actor  = mTarget;
                            target = mActor;
                        }

                        InteractionInstance instance = HotairBalloon.Raise.Singleton.CreateInstanceWithCallbacks(mObject, actor, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true, null, null, OnFailed2);
                        actor.InteractionQueue.Add(instance);

                        instance = mDefinition.CreateInstanceWithCallbacks(target, actor, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true, null, null, OnFailed2);
                        actor.InteractionQueue.Add(instance);
                    }
                    else
                    {
                        Common.DebugNotify("OnCompleted A");
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(mActor, mTarget, e);
                }
            }
示例#3
0
        public override bool Run()
        {
            try
            {
                if (!SafeToSync())
                {
                    Common.Notify("Fail D");
                    return(false);
                }

                IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                if (LinkedInteractionInstance == null)
                {
                    HotairBalloon.WooHooSocial entry = definition.ProxyClone(Target).CreateInstance(Actor, Target, GetPriority(), Autonomous, CancellableByPlayer) as HotairBalloon.WooHooSocial;
                    if (entry == null)
                    {
                        Common.Notify("Fail A");
                        return(false);
                    }

                    entry.mIsSocialTarget     = true;
                    LinkedInteractionInstance = entry;
                    Target.InteractionQueue.AddNext(entry);
                }

                HotairBalloon.InBalloonPosture posture = Actor.Posture as HotairBalloon.InBalloonPosture;
                if (posture == null)
                {
                    Common.Notify("Fail B");
                    return(false);
                }

                if (!StartSync(!mIsSocialTarget))
                {
                    Common.Notify("Fail C");
                    return(false);
                }

                StandardEntry();
                BeginCommodityUpdates();
                if (mIsSocialTarget)
                {
                    DoLoop(ExitReason.Finished);
                }
                else
                {
                    StartSocial(CommonWoohoo.GetSocialName(definition.GetStyle(this), Actor));

                    Animation.ForceAnimation(Actor.ObjectId, true);
                    Animation.ForceAnimation(Target.ObjectId, true);

                    if (Rejected)
                    {
                        Target.Posture.CurrentStateMachine.RequestState(true, "x", "ToFromSocial");
                        posture.CurrentStateMachine.RequestState(true, "x", "ToFromSocial");
                        posture.CurrentStateMachine.SetActor("y", Target);
                        CreateProps(posture.CurrentStateMachine);
                        posture.CurrentStateMachine.SetParameter("XSimR", posture.IsXActor ? YesOrNo.no : YesOrNo.yes);
                        posture.CurrentStateMachine.EnterState("x", "EnterSocial");
                        posture.CurrentStateMachine.EnterState("y", "EnterSocial");
                        ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.DoubleBalloonData("balloon_woohoo", "balloon_question");
                        bd.BalloonType = ThoughtBalloonTypes.kSpeechBalloon;
                        Actor.ThoughtBalloonManager.ShowBalloon(bd);
                        posture.CurrentStateMachine.RequestState(false, "y", "woohoo rejected");
                        posture.CurrentStateMachine.RequestState(true, "x", "woohoo rejected");
                        bd             = new ThoughtBalloonManager.BalloonData("balloon_woohoo");
                        bd.BalloonType = ThoughtBalloonTypes.kSpeechBalloon;
                        bd.LowAxis     = ThoughtBalloonAxis.kDislike;
                        Target.ThoughtBalloonManager.ShowBalloon(bd);
                        posture.CurrentStateMachine.RequestState(false, "y", "ExitSocial");
                        posture.CurrentStateMachine.RequestState(true, "x", "ExitSocial");
                        posture.CurrentStateMachine.RemoveActor(Target);
                        Target.Posture.CurrentStateMachine.EnterState("x", "ToFromSocial");
                        posture.CurrentStateMachine.EnterState("x", "ToFromSocial");
                        Target.Posture.CurrentStateMachine.EnterState("x", "IdleStand");
                        posture.CurrentStateMachine.EnterState("x", "IdleStand");
                        Actor.GetRelationship(Target, true).LTR.UpdateLiking(HotairBalloon.kWoohooRejectLtrChange);
                        SocialComponent.SetSocialFeedbackForActorAndTarget(CommodityTypes.Friendly, Actor, Target, false, 0x0, LongTermRelationshipTypes.Undefined, LongTermRelationshipTypes.Undefined);
                        SocialCallback.AddRejectedByEx(Actor, Target, GetInteractionName(), null, this);
                    }
                    else
                    {
                        switch (posture.Balloon.mCurrentHeight)
                        {
                        case HotairBalloon.BalloonHeight.OnGround:
                            posture.CurrentStateMachine.SetParameter("Height", SkillLevel.poor);
                            break;

                        case HotairBalloon.BalloonHeight.Height1:
                            posture.CurrentStateMachine.SetParameter("Height", SkillLevel.novice);
                            break;
                        }

                        Sim actor = posture.IsXActor ? Actor : Target;
                        Sim sim2  = posture.IsXActor ? Target : Actor;
                        actor.Posture.CurrentStateMachine.RequestState(true, "x", "ToFromSocial");
                        sim2.Posture.CurrentStateMachine.RequestState(true, "x", "ToFromSocial");
                        sim2.Posture.CurrentStateMachine.SetActor("y", actor);
                        CreateProps(sim2.Posture.CurrentStateMachine);
                        sim2.Posture.CurrentStateMachine.EnterState("x", "EnterSocial");
                        sim2.Posture.CurrentStateMachine.EnterState("y", "EnterSocial");
                        ThoughtBalloonManager.BalloonData data2 = new ThoughtBalloonManager.DoubleBalloonData("balloon_woohoo", "balloon_question");
                        data2.BalloonType = ThoughtBalloonTypes.kSpeechBalloon;
                        Actor.ThoughtBalloonManager.ShowBalloon(data2);
                        sim2.Posture.CurrentStateMachine.RequestState(false, "y", "woohoo");
                        sim2.Posture.CurrentStateMachine.RequestState(true, "x", "woohoo");
                        sim2.Posture.CurrentStateMachine.RequestState(false, "y", "ExitSocial");
                        sim2.Posture.CurrentStateMachine.RequestState(true, "x", "ExitSocial");
                        sim2.Posture.CurrentStateMachine.RemoveActor(actor);
                        actor.Posture.CurrentStateMachine.EnterState("x", "ToFromSocial");
                        sim2.Posture.CurrentStateMachine.EnterState("x", "ToFromSocial");
                        Relationship relationship = Actor.GetRelationship(Target, true);
                        relationship.STC.Update(Actor, Target, CommodityTypes.Amorous, HotairBalloon.kSTCIncreaseAfterWoohoo);
                        relationship.LTR.UpdateLiking(-HotairBalloon.kWoohooRejectLtrChange);

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

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

                        actor.Posture.CurrentStateMachine.EnterState("x", "IdleStand");
                        sim2.Posture.CurrentStateMachine.EnterState("x", "IdleStand");

                        Actor.BuffManager.AddElement((BuffNames)(0x9a7f5f1919df0036L), Origin.None);
                        Target.BuffManager.AddElement((BuffNames)(0x9a7f5f1919df0036L), Origin.None);
                    }

                    FinishSocial(CommonWoohoo.GetSocialName(definition.GetStyle(this), Actor), Rejected);
                    Target.AddExitReason(ExitReason.Finished);
                }

                FinishLinkedInteraction(mIsSocialTarget);
                EndCommodityUpdates(Rejected);
                StandardExit();
                WaitForSyncComplete();
                posture.Balloon.PushIdleInteractionOnSim(Actor);
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception exception)
            {
                Woohooer.Settings.AddChange(Actor);
                Woohooer.Settings.AddChange(Target);

                Common.Exception(Actor, Target, exception);
                return(false);
            }
        }
示例#4
0
        public override bool Run()
        {
            try
            {
                Sim linkedActor = GetSelectedObject() as Sim;
                if (linkedActor == Actor)
                {
                    linkedActor = null;
                }

                if (linkedActor != null)
                {
                    HotAirBalloonSit entry = Singleton.CreateInstance(Target, linkedActor, GetPriority(), Autonomous, CancellableByPlayer) as HotAirBalloonSit;
                    entry.LinkedInteractionInstance = this;
                    linkedActor.InteractionQueue.Add(entry);
                }

                HotAirBalloonSit linked = LinkedInteractionInstance as HotAirBalloonSit;
                if (linked != null)
                {
                    linkedActor = linked.Actor;
                }

                bool isXActor = Target.mLeftActorId == 0x0L;
                if (!isXActor && (Target.mRightActorId != 0x0L))
                {
                    return false;
                }

                if (isXActor)
                {
                    Target.mLeftActorId = Actor.SimDescription.SimDescriptionId;
                }
                else
                {
                    Target.mRightActorId = Actor.SimDescription.SimDescriptionId;
                }

                Route r = Actor.CreateRoute();

                if (linkedActor != null)
                {
                    r.AddObjectToIgnoreForRoute(linkedActor.ObjectId);
                }

                if (!r.PlanToSlot(Target, Slot.RoutingSlot_7).Succeeded())
                {
                    if (isXActor)
                    {
                        Target.mLeftActorId = 0x0L;
                    }
                    else
                    {
                        Target.mRightActorId = 0x0L;
                    }
                    return false;
                }

                if ((Target.mTargetHeight != HotairBalloon.BalloonHeight.OnGround) || (Target.mCurrentHeight != HotairBalloon.BalloonHeight.OnGround))
                {
                    Actor.PlayRouteFailure();

                    if (isXActor)
                    {
                        Target.mLeftActorId = 0x0L;
                    }
                    else
                    {
                        Target.mRightActorId = 0x0L;
                    }
                    return false;
                }

                r = Actor.CreateRoute();
                if (linkedActor != null)
                {
                    r.AddObjectToIgnoreForRoute(linkedActor.ObjectId);
                }

                r.AddObjectToIgnoreForRoute(Target.ObjectId);
                if (!r.PlanToSlot(Target, isXActor ? Slot.RoutingSlot_5 : Slot.RoutingSlot_2).Succeeded())
                {
                    Target.ResetParentingHierarchy(true);
                    r.PlanToSlot(Target, isXActor ? Slot.RoutingSlot_5 : Slot.RoutingSlot_2);
                }

                if (!Actor.DoRoute(r))
                {
                    if (isXActor)
                    {
                        Target.mLeftActorId = 0x0L;
                    }
                    else
                    {
                        Target.mRightActorId = 0x0L;
                    }
                    return false;
                }

                StandardEntry();
                BeginCommodityUpdates();
                Animation.ForceAnimation(Actor.ObjectId, true);
                if (Target.mFlyStateMachine == null)
                {
                    Target.mFlyStateMachine = StateMachineClient.Acquire(Target, "hotairballoon_store", AnimationPriority.kAPDefault);
                    Target.mFlyStateMachine.SetActor("hotairBalloonX", Target);
                    Target.mFlyStateMachine.EnterState("hotairBalloonX", "BalloonLiftOff");
                }

                AcquireStateMachine("hotairballoon_store");
                mCurrentStateMachine.SetActor("x", Actor);
                mCurrentStateMachine.SetActor("hotairBalloonX", Target);
                mCurrentStateMachine.SetParameter("XSimR", isXActor ? YesOrNo.no : YesOrNo.yes);
                mCurrentStateMachine.EnterState("x", "EnterBalloon");
                Slot slotName = isXActor ? ((Slot)(0xa820f8a5)) : ((Slot)(0xa820f8a2));
                float f = (float)Math.Acos((double)(Target.ForwardVector * Actor.ForwardVector));
                if (float.IsNaN(f))
                {
                    f = 3.141593f;
                }

                Actor.ParentToSlot(Target, slotName, f, false);
                mCurrentStateMachine.RequestState("x", "IdleStand");
                EndCommodityUpdates(true);

                HotairBalloon.InBalloonPosture posture = new HotairBalloon.InBalloonPosture(Actor, Target, isXActor, mCurrentStateMachine);
                Actor.Posture = posture;

                if ((Autonomous) && (RandomUtil.RandomChance(HotairBalloon.kChanceToCallOverRomanticInterest)))
                {
                    Sim actor = Target.FindRomanticSimToRideWith(Actor);
                    if ((actor != null) && !actor.InteractionQueue.HasInteractionOfType(Singleton))
                    {
                        InteractionInstance entry = Singleton.CreateInstance(Target, actor, new InteractionPriority(InteractionPriorityLevel.Autonomous), true, true);
                        actor.InteractionQueue.Add(entry);
                        mCurrentStateMachine.RequestState("x", "CallOver");
                        mCurrentStateMachine.RequestState("x", "IdleStand");
                        mCurrentStateMachine.RequestState("x", "CallOver");
                        mCurrentStateMachine.RequestState("x", "IdleStand");
                    }
                }

                StandardExit();
                return true;
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return false;
            }
        }
示例#5
0
        public override bool Run()
        {
            try
            {
                Sim linkedActor = GetSelectedObject() as Sim;
                if (linkedActor == Actor)
                {
                    linkedActor = null;
                }

                if (linkedActor != null)
                {
                    HotAirBalloonSit entry = Singleton.CreateInstance(Target, linkedActor, GetPriority(), Autonomous, CancellableByPlayer) as HotAirBalloonSit;
                    entry.LinkedInteractionInstance = this;
                    linkedActor.InteractionQueue.Add(entry);
                }

                HotAirBalloonSit linked = LinkedInteractionInstance as HotAirBalloonSit;
                if (linked != null)
                {
                    linkedActor = linked.Actor;
                }

                bool isXActor = Target.mLeftActorId == 0x0L;
                if (!isXActor && (Target.mRightActorId != 0x0L))
                {
                    return(false);
                }

                if (isXActor)
                {
                    Target.mLeftActorId = Actor.SimDescription.SimDescriptionId;
                }
                else
                {
                    Target.mRightActorId = Actor.SimDescription.SimDescriptionId;
                }

                Route r = Actor.CreateRoute();

                if (linkedActor != null)
                {
                    r.AddObjectToIgnoreForRoute(linkedActor.ObjectId);
                }

                if (!r.PlanToSlot(Target, Slot.RoutingSlot_7).Succeeded())
                {
                    if (isXActor)
                    {
                        Target.mLeftActorId = 0x0L;
                    }
                    else
                    {
                        Target.mRightActorId = 0x0L;
                    }
                    return(false);
                }

                if ((Target.mTargetHeight != HotairBalloon.BalloonHeight.OnGround) || (Target.mCurrentHeight != HotairBalloon.BalloonHeight.OnGround))
                {
                    Actor.PlayRouteFailure();

                    if (isXActor)
                    {
                        Target.mLeftActorId = 0x0L;
                    }
                    else
                    {
                        Target.mRightActorId = 0x0L;
                    }
                    return(false);
                }

                r = Actor.CreateRoute();
                if (linkedActor != null)
                {
                    r.AddObjectToIgnoreForRoute(linkedActor.ObjectId);
                }

                r.AddObjectToIgnoreForRoute(Target.ObjectId);
                if (!r.PlanToSlot(Target, isXActor ? Slot.RoutingSlot_5 : Slot.RoutingSlot_2).Succeeded())
                {
                    Target.ResetParentingHierarchy(true);
                    r.PlanToSlot(Target, isXActor ? Slot.RoutingSlot_5 : Slot.RoutingSlot_2);
                }

                if (!Actor.DoRoute(r))
                {
                    if (isXActor)
                    {
                        Target.mLeftActorId = 0x0L;
                    }
                    else
                    {
                        Target.mRightActorId = 0x0L;
                    }
                    return(false);
                }

                StandardEntry();
                BeginCommodityUpdates();
                Animation.ForceAnimation(Actor.ObjectId, true);
                if (Target.mFlyStateMachine == null)
                {
                    Target.mFlyStateMachine = StateMachineClient.Acquire(Target, "hotairballoon_store", AnimationPriority.kAPDefault);
                    Target.mFlyStateMachine.SetActor("hotairBalloonX", Target);
                    Target.mFlyStateMachine.EnterState("hotairBalloonX", "BalloonLiftOff");
                }

                AcquireStateMachine("hotairballoon_store");
                mCurrentStateMachine.SetActor("x", Actor);
                mCurrentStateMachine.SetActor("hotairBalloonX", Target);
                mCurrentStateMachine.SetParameter("XSimR", isXActor ? YesOrNo.no : YesOrNo.yes);
                mCurrentStateMachine.EnterState("x", "EnterBalloon");
                Slot  slotName = isXActor ? ((Slot)(0xa820f8a5)) : ((Slot)(0xa820f8a2));
                float f        = (float)Math.Acos((double)(Target.ForwardVector * Actor.ForwardVector));
                if (float.IsNaN(f))
                {
                    f = 3.141593f;
                }

                Actor.ParentToSlot(Target, slotName, f, false);
                mCurrentStateMachine.RequestState("x", "IdleStand");
                EndCommodityUpdates(true);

                HotairBalloon.InBalloonPosture posture = new HotairBalloon.InBalloonPosture(Actor, Target, isXActor, mCurrentStateMachine);
                Actor.Posture = posture;

                if ((Autonomous) && (RandomUtil.RandomChance(HotairBalloon.kChanceToCallOverRomanticInterest)))
                {
                    Sim actor = Target.FindRomanticSimToRideWith(Actor);
                    if ((actor != null) && !actor.InteractionQueue.HasInteractionOfType(Singleton))
                    {
                        InteractionInstance entry = Singleton.CreateInstance(Target, actor, new InteractionPriority(InteractionPriorityLevel.Autonomous), true, true);
                        actor.InteractionQueue.Add(entry);
                        mCurrentStateMachine.RequestState("x", "CallOver");
                        mCurrentStateMachine.RequestState("x", "IdleStand");
                        mCurrentStateMachine.RequestState("x", "CallOver");
                        mCurrentStateMachine.RequestState("x", "IdleStand");
                    }
                }

                StandardExit();
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }