Пример #1
0
        public override bool Run()
        {
            if (mSimToPresent == null)
            {
                mSimToPresent = (GetSelectedObject() as Sim);
                if (mSimToPresent == null)
                {
                    return(false);
                }
            }

            string modelname;

            if (Target.Plantable.PlantDef.GetModelName(out modelname))
            {
                if (!EWPetPickUpPlantable.PickUpFromSimInventory(Actor, Target, modelname, true))
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }

            if (mSimToPresent != null && !mSimToPresent.HasBeenDestroyed)
            {
                mSimToPresent.InteractionQueue.CancelAllInteractions();
                EWWait.Definition waitDefinition = new EWWait.Definition();
                EWWait            waitInstance   = waitDefinition.CreateInstance(mSimToPresent, mSimToPresent,
                                                                                 new InteractionPriority(InteractionPriorityLevel.UserDirected), false,
                                                                                 CancellableByPlayer) as EWWait;
                waitInstance.SetInteractionName("Wait for Medicine");
                mSimToPresent.InteractionQueue.AddNext(waitInstance);

                Route val = Actor.CreateRoute();
                val.DoRouteFail = true;
                val.SetOption(RouteOption.MakeDynamicObjectAdjustments, true);
                val.PlanToPointRadialRange(mSimToPresent, mSimToPresent.Position, kDistanceFromSimToPresent,
                                           kDistanceFromSimToPresent, Vector3.UnitZ, 360f, RouteDistancePreference.PreferNearestToRouteDestination,
                                           RouteOrientationPreference.TowardsObject, mSimToPresent.LotCurrent.LotId,
                                           new int[1]
                {
                    mSimToPresent.RoomId
                });
                if (Actor.DoRoute(val))
                {
                    val.SetOption(RouteOption.MakeDynamicObjectAdjustments, false);
                    val.PlanToPointRadialRange(mSimToPresent, mSimToPresent.Position,
                                               kDistanceFromSimToPresent, kDistanceFromSimToPresent, Vector3.UnitZ, 360f,
                                               RouteDistancePreference.PreferNearestToRouteDestination, RouteOrientationPreference.TowardsObject,
                                               mSimToPresent.LotCurrent.LotId, new int[1]
                    {
                        mSimToPresent.RoomId
                    });
                    Actor.DoRoute(val);
                }
                waitInstance.waitComplete = true;
            }

            EWPetPickUpPlantable.PutDownOnFloor(Actor);
            if (Actor.HasExitReason())
            {
                return(false);
            }
            BeginCommodityUpdates();

            EWPetBeTreated.Definition treatDefinition = new EWPetBeTreated.Definition();
            EWPetBeTreated            treatInstance   = treatDefinition.CreateInstance(Target, mSimToPresent,
                                                                                       new InteractionPriority(InteractionPriorityLevel.UserDirected), false,
                                                                                       CancellableByPlayer) as EWPetBeTreated;

            treatInstance.SetParams(isSuccessfulTreatment(mSimToPresent), BuffNames.NauseousPet,
                                    Actor, true);
            mSimToPresent.InteractionQueue.AddNext(treatInstance);

            EndCommodityUpdates(succeeded: true);

            return(true);
        }
Пример #2
0
        public override bool Run()
        {
            if (mSimToPresent == null)
            {
                mSimToPresent = (GetSelectedObject() as Sim);
                if (mSimToPresent == null)
                {
                    return(false);
                }
            }

            Fish fish = Target as Fish;

            //fish.UpdateVisualState(Sims3.Gameplay.ObjectComponents.CatHuntingComponent.CatHuntingModelState.InInventory);
            if (!EWPetPickUpPlantable.PickUpFromSimInventory(Actor, Target, fish.MedatorName, true))
            {
                return(false);
            }

            if (mSimToPresent != null && !mSimToPresent.HasBeenDestroyed)
            {
                mSimToPresent.InteractionQueue.CancelAllInteractions();
                EWWait.Definition waitDefinition = new EWWait.Definition();
                EWWait            waitInstance   = waitDefinition.CreateInstance(mSimToPresent, mSimToPresent,
                                                                                 new InteractionPriority(InteractionPriorityLevel.UserDirected), false,
                                                                                 CancellableByPlayer) as EWWait;
                waitInstance.SetInteractionName("Wait for Fish");
                mSimToPresent.InteractionQueue.AddNext(waitInstance);

                Route val = Actor.CreateRoute();
                val.DoRouteFail = true;
                val.SetOption(RouteOption.MakeDynamicObjectAdjustments, true);
                val.PlanToPointRadialRange(mSimToPresent, mSimToPresent.Position, kDistanceFromSimToPresent,
                                           kDistanceFromSimToPresent, Vector3.UnitZ, 360f, RouteDistancePreference.PreferNearestToRouteDestination,
                                           RouteOrientationPreference.TowardsObject, mSimToPresent.LotCurrent.LotId,
                                           new int[1]
                {
                    mSimToPresent.RoomId
                });
                if (Actor.DoRoute(val))
                {
                    val.SetOption(RouteOption.MakeDynamicObjectAdjustments, false);
                    val.PlanToPointRadialRange(mSimToPresent, mSimToPresent.Position,
                                               kDistanceFromSimToPresent, kDistanceFromSimToPresent, Vector3.UnitZ, 360f,
                                               RouteDistancePreference.PreferNearestToRouteDestination, RouteOrientationPreference.TowardsObject,
                                               mSimToPresent.LotCurrent.LotId, new int[1]
                    {
                        mSimToPresent.RoomId
                    });
                    Actor.DoRoute(val);
                }
                waitInstance.waitComplete = true;
            }

            EWPetPickUpPlantable.PutDownOnFloor(Actor);
            if (Actor.HasExitReason())
            {
                return(false);
            }

            return(true);
        }