Ejemplo n.º 1
0
            public override bool Run()
            {
                if (this.Target.Parent != this.Actor && !CarrySystem.PickUp(this.Actor, this.Target))
                {
                    return(false);
                }
                if (this.Actor.GetObjectInRightHand() == null)
                {
                    return(false);
                }
                if (this.mJT == null)
                {
                    Food.PutHeldObjectDownOnCounterTableOrFloor(this.Actor, SurfaceType.Normal);
                    return(false);
                }
                if (!this.Actor.RouteToObjectRadialRange(this.mJT, 0.5f, 1.5f))
                {
                    Food.PutHeldObjectDownOnCounterTableOrFloor(this.Actor, SurfaceType.Normal);
                    return(false);
                }
                ObjectGuid containedObject = Slots.GetContainedObject(this.mJT.ObjectId, 2820733094u);

                if (containedObject != ObjectGuid.InvalidObjectGuid)
                {
                    Food.PutHeldObjectDownOnCounterTableOrFloor(this.Actor, SurfaceType.Normal);
                    return(false);
                }
                if (this.Target.ParentToSlot(this.mJT, 2820733094u))
                {
                    CarrySystem.ExitCarry(this.Actor);
                    return(true);
                }
                Food.PutHeldObjectDownOnCounterTableOrFloor(this.Actor, SurfaceType.Normal);
                return(false);
            }
Ejemplo n.º 2
0
 public override bool Run()
 {
     if (!CarrySystem.PickUp(base.Actor, base.Target))
     {
         return(false);
     }
     if (!CarrySystem.PutInSimInventory(base.Actor))
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 3
0
            public override bool Run()
            {
                Route r = base.Actor.CreateRoute();

                r.SetOption(Route.RouteOption.DoLineOfSightCheckUserOverride, true);
                r.PlanToPointRadialRange(base.Target.Position, 0.5f, 3f, Vector3.UnitZ, 360f, RouteDistancePreference.PreferNearestToRouteOrigin, RouteOrientationPreference.TowardsObject);
                if (!base.Actor.DoRoute(r))
                {
                    base.Actor.AddExitReason(ExitReason.RouteFailed);
                    return(false);
                }
                if (!base.Target.SimLine.WaitForTurn(this, SimQueue.WaitBehavior.Default, ~(ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), BarTray.kTimeToWaitInLine))
                {
                    return(false);
                }
                List <Sims3.Gameplay.Objects.Appliances.HotBeverageMachine.Cup> randomList = new List <Sims3.Gameplay.Objects.Appliances.HotBeverageMachine.Cup>();

                foreach (Slot slot in base.Target.GetContainmentSlots())
                {
                    Sims3.Gameplay.Objects.Appliances.HotBeverageMachine.Cup containedObject = base.Target.GetContainedObject(slot) as Sims3.Gameplay.Objects.Appliances.HotBeverageMachine.Cup;
                    if ((containedObject != null) && !containedObject.InUse)
                    {
                        randomList.Add(containedObject);
                    }
                }
                if (randomList.Count == 0)
                {
                    return(false);
                }
                Sims3.Gameplay.Objects.Appliances.HotBeverageMachine.Cup randomObjectFromList = RandomUtil.GetRandomObjectFromList <Sims3.Gameplay.Objects.Appliances.HotBeverageMachine.Cup>(randomList);
                if ((randomObjectFromList != null) && CarrySystem.PickUp(base.Actor, randomObjectFromList))
                {
                    //Pay for the coffee
                    CommonMethods.PayForCoffee(base.Actor, base.Target.LotCurrent);

                    InteractionInstance instance = EatHeldFood.Singleton.CreateInstance(randomObjectFromList, base.Actor, base.Actor.InheritedPriority(), false, true);
                    return(Actor.InteractionQueue.PushAsContinuation(instance, false));
                }
                return(false);
            }
Ejemplo n.º 4
0
            protected override bool Run()
            {
                if (!base.Actor.RouteToObjectRadius(base.Target, 0.3f))
                {
                    return(false);
                }  //move in close to the object and if not possible quit the interaction.

                if (!CarrySystem.PickUp(base.Actor, base.Target))
                {
                    return(false);
                }  //pick up object and then bring it to a surface.

                CAS.SimDescription receiver = getSimSelection();

                if (receiver != null)
                {
                    String samount = StringInputDialog.Show("Amount:", "(Must be round number) §", "100");
                    //must parse the string into an integer
                    int amount = 0;
                    if (int.TryParse(samount, out amount) && receiver != null)
                    {
                        transferFunds(base.Actor.SimDescription, receiver, amount);
                    }

                    else
                    {
                        base.Actor.ShowTNSIfSelectable("Woops! Messed up the check...I can't send this one!", StyledNotification.NotificationStyle.kSimTalking);
                        return(false);  //exit interaction when user enters invalid value
                    }
                }
                else
                {
                    return(false);
                }
                checkAnimation();  //end with animation

                return(true);
                //CarrySystem.PutDown(base.Actor, SurfaceType.Normal, true);
            }
Ejemplo n.º 5
0
            protected override bool Run()
            {
                if (base.Actor.Inventory.Contains(base.Target))
                {
                    if (!CarrySystem.PickUpFromSimInventory(base.Actor, this.Target))
                    {
                        return(false);
                    }
                }
                else if (!base.Actor.RouteToObjectRadius(base.Target, 0.3f))
                {
                    if (!CarrySystem.PickUp(base.Actor, base.Target))
                    {
                        return(false);
                    } //pick up object and then bring it to a surface.

                    return(false);
                } //move in close to the object and if not possible quit the interaction.
                  //alternate path depending on whether the checkbook is already in the inventory.

                //place on surface and then enter the chair

                placeOnSurface();

                /*
                 * if (this.mCheckBookSurface != null) {
                 *  SurfaceSlot surfaceSlotFramContainedObject = this.mCheckBookSurface.Surface.GetSurfaceSlotFromContainedObject(this.Target);
                 *  this.mChecBookSlot = surfaceSlotFramContainedObject.ContainmentSlot;
                 *  Slot chairslot = surfaceSlotFramContainedObject.ChairSlots[0];
                 *  ISittable Chair = (ISittable) mCheckBookSurface.GetContainedObject(chairslot);
                 *  InteractionInstance sitOnChair = Chair.RouteToForSitting(base.Actor, chairslot, true,;
                 *  //base.Actor.RouteToSlot(this.Target, mChecBookSlot);
                 *  ChildUtils.SetPosturePrecondition(this, CommodityKind.Sitting, new CommodityKind[]
                 *  {
                 *      CommodityKind.InFrontOfSurfaceForTarget,
                 *      CommodityKind.ChairScootedIntoSurface
                 *  });
                 *
                 * }
                 *
                 */

                CAS.SimDescription receiver = getSimSelection();

                if (receiver != null)
                {
                    String samount = StringInputDialog.Show("Amount:", "(Must be round number) §", "100");
                    //must parse the string into an integer
                    int amount = 0;
                    if (int.TryParse(samount, out amount) && receiver != null)
                    {
                        transferFunds(base.Actor.SimDescription, receiver, amount);
                    }

                    else
                    {
                        base.Actor.ShowTNSIfSelectable("Woops! Messed up the check...I can't send this one!", StyledNotification.NotificationStyle.kSimTalking);
                        return(false);  //exit interaction when user enters invalid value
                    }
                }
                else
                {
                    return(false);
                }
                checkAnimation(); //end with animation
                base.Actor.ShowTNSIfSelectable("Ended animation.", StyledNotification.NotificationStyle.kSimTalking);
                //CarrySystem.AnimateIntoSimInventory(base.Actor);  animation errors out in null. Probably because of table
                base.Actor.ShowTNSIfSelectable("Ended animate into.", StyledNotification.NotificationStyle.kSimTalking);
                base.Actor.Inventory.TryToAdd(this.Target);
                base.Actor.ShowTNSIfSelectable("Ended method", StyledNotification.NotificationStyle.kSimTalking);
                return(true);
                //CarrySystem.PutDown(base.Actor, SurfaceType.Normal, true);
            }
Ejemplo n.º 6
0
 public override bool Run()
 {
     if (this.Target.Parent != this.Actor && !(CarrySystem.PickUp(this.Actor, (ICustomCarryable)this.Target, new SacsEventHandler(this.Target.OnPickUp), 0U)))
     {
         Alive.WriteLog("Alive_debugInfo_LOG:NOT_ERROR\nCannot_Do_Laundry:cannot_pickUp_clothingPile");
         return(false);
     }
     this.Actor.PlayRouteFailFrequency = Sim.RouteFailFrequency.NeverPlayRouteFail;
     this.BeginCommodityUpdates();
     if (this.ActiveStage != null)
     {
         ClothingPileDry currentPile;
         do
         {
             currentPile = (this.ActiveStage as RoomVsLotStage <ClothingPileDry>).GetNext();
             if (currentPile != null)
             {
                 if (this.Actor.RouteToObjectRadiusAndCheckInUse((IGameObject)currentPile, currentPile.CarryRouteToObjectRadius) && currentPile.Parent == null)
                 {
                     this.Actor.CarryStateMachine.AddOneShotScriptEventHandler(113U, (SacsEventHandler)((A_1, A_2) => currentPile.FadeOut(false)));
                     this.Actor.CarryStateMachine.RequestState("x", "PickUpAnother");
                     this.Actor.CarryStateMachine.RequestState("x", "Carry");
                     this.Target.AddClothingPile(currentPile);
                     currentPile.Destroy();
                 }
                 this.Actor.RemoveExitReason(ExitReason.RouteFailed | ExitReason.ObjectInUse);
             }
         }while(currentPile != null && !this.Actor.HasExitReason());
     }
     this.Actor.PlayRouteFailFrequency = Sim.RouteFailFrequency.AlwaysPlayRouteFail;
     this.Stages = (List <Sims3.Gameplay.Interactions.Stage>)null;
     this.Actor.InteractionQueue.FireQueueChanged();
     if (!this.Actor.HasExitReason())
     {
         this.EndCommodityUpdates(true);
         Hamper closestObject1 = GlobalFunctions.GetClosestObject <Hamper>((IEnumerable <Hamper>)Sims3.Gameplay.Queries.GetObjects <Hamper>(this.Actor.Position, ClothingPileDry.kRadiusToConsiderHampers), (IGameObject)this.Actor, new Predicate <Hamper>(ClothingPileDry.CleanUp.DoesHamperHaveSpaceLeft));
         if (closestObject1 != null)
         {
             this.Actor.InteractionQueue.PushAsContinuation(Hamper.DropClothes.Singleton, (IGameObject)closestObject1, true);
             return(true);
         }
         if (!this.Autonomous || !this.Target.LotCurrent.LaundryManager.GivesFreshClothingBuff)
         {
             WashingMachine closestObject2 = GlobalFunctions.GetClosestObject <WashingMachine>((IEnumerable <WashingMachine>)Sims3.Gameplay.Queries.GetObjects <WashingMachine>(this.Actor.LotCurrent), (IGameObject)this.Actor, new Predicate <WashingMachine>(ClothingPileDry.CleanUp.IsWashingMachineUsable));
             if (closestObject2 != null)
             {
                 this.Actor.InteractionQueue.PushAsContinuation(WashingMachine.DoLaundry.SingletonNoStages, (IGameObject)closestObject2, true);
                 return(true);
             }
         }
         Hamper closestObject3 = GlobalFunctions.GetClosestObject <Hamper>((IEnumerable <Hamper>)Sims3.Gameplay.Queries.GetObjects <Hamper>(this.Actor.LotCurrent), (IGameObject)this.Actor);
         if (closestObject3 != null)
         {
             this.Actor.InteractionQueue.PushAsContinuation(Hamper.DropClothes.Singleton, (IGameObject)closestObject3, true);
             return(true);
         }
         WashingMachine closestObject4 = GlobalFunctions.GetClosestObject <WashingMachine>((IEnumerable <WashingMachine>)Sims3.Gameplay.Queries.GetObjects <WashingMachine>(this.Actor.LotCurrent), (IGameObject)this.Actor);
         if (closestObject4 == null)
         {
             return(this.Target.PutInInventory(this.Actor));
         }
         this.Actor.InteractionQueue.PushAsContinuation(WashingMachine.DoLaundry.SingletonNoStages, (IGameObject)closestObject4, false);
         return(true);
     }
     Alive.WriteLog("Alive_debugInfo_LOG:NOT_ERROR\nCannot_Do_Laundry:this.Actor.HasExitReason():" + this.Actor.ExitReason);
     this.EndCommodityUpdates(false);
     return(false);
 }
Ejemplo n.º 7
0
        public override bool Run()
        {
            try
            {
                if ((Book == null) || Book.HasBeenDestroyed)
                {
                    return(false);
                }

                Book.AddToReferenceList(Actor);
                mAddedToReferenceList = true;
                InteractionDefinition readToSleepSingleton   = null;
                InteractionDefinition beReadToSleepSingleton = null;

                // Custom
                IReadToSleepObject myBed = Target.Bed as IReadToSleepObject;
                if (myBed != null)
                {
                    if (myBed.TestReadToSleep(Actor, Target))
                    {
                        readToSleepSingleton   = myBed.GetReadToSleepSingleton();
                        beReadToSleepSingleton = myBed.GetBeReadToSleepSingleton();
                    }
                }

                if (beReadToSleepSingleton == null)
                {
                    for (int i = 0; i < 2; i++)
                    {
                        foreach (IReadToSleepObject obj2 in Target.LotCurrent.GetObjects <IReadToSleepObject>())
                        {
                            if ((i == 0) && (myBed != null))
                            {
                                if (myBed.RoomId != obj2.RoomId)
                                {
                                    continue;
                                }
                            }

                            if (obj2.TestReadToSleep(Actor, Target))
                            {
                                readToSleepSingleton   = obj2.GetReadToSleepSingleton();
                                beReadToSleepSingleton = obj2.GetBeReadToSleepSingleton();
                                break;
                            }
                        }

                        if (beReadToSleepSingleton != null)
                        {
                            break;
                        }
                    }
                }

                if ((readToSleepSingleton == null) && (beReadToSleepSingleton == null))
                {
                    return(false);
                }
                InteractionInstance entry = null;
                if (beReadToSleepSingleton != null)
                {
                    entry = beReadToSleepSingleton.CreateInstanceWithCallbacks(Actor, Target, GetPriority(), Autonomous, CancellableByPlayer, new Callback(OnChildStarted), new Callback(OnChildCompleted), new Callback(OnChildFailed));
                    entry.LinkedInteractionInstance = this;
                    if (!Target.InteractionQueue.Add(entry))
                    {
                        return(false);
                    }
                }
                if (Book.InInventory)
                {
                    if (!Actor.Inventory.Contains(Book))
                    {
                        IGameObject closestBookshelf;
                        Bookshelf_GetBook.Definition definition3 = new Bookshelf_GetBook.Definition(Book);
                        if (kAlwaysUseClosestBookshelf && (ClosestBookshelf != null))
                        {
                            closestBookshelf = ClosestBookshelf;
                        }
                        else
                        {
                            closestBookshelf = Book.ItemComp.InventoryParent.Owner;
                        }
                        if (!definition3.CreateInstance(closestBookshelf, Actor, GetPriority(), Autonomous, CancellableByPlayer).RunInteraction())
                        {
                            return(false);
                        }
                    }
                }
                else
                {
                    if (!CarrySystem.PickUp(Actor, Book))
                    {
                        return(false);
                    }
                    if (!CarrySystem.PutInSimInventory(Actor))
                    {
                        return(false);
                    }
                }

                if (!Actor.Inventory.Contains(Book))
                {
                    return(false);
                }

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

                LinkedInteractionInstance = null;
                InteractionInstance instance = readToSleepSingleton.CreateInstance(Target, Actor, GetPriority(), Autonomous, CancellableByPlayer);
                instance.LinkedInteractionInstance = entry;
                (instance as IReadToSleepInteraction).ReservedBook = Book;
                return(Actor.InteractionQueue.PushAsContinuation(instance, true));
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }