コード例 #1
0
        protected override bool OnTarget(Item item)
        {
            Mobile player = World.Player;

            if (player != null)
            {
                Item backpack = player.Backpack;
                if (backpack != null)
                {
                    if (item.InWorld)
                    {
                        return(false);
                    }
                    int x = item.X + this.m_xOffset;
                    int y = item.Y + this.m_yOffset;
                    foreach (Item pickUp in backpack.GetItems((IItemValidator) new ItemIDValidator(new int[1] {
                        item.ID
                    })))
                    {
                        if (pickUp != item)
                        {
                            if (pickUp.X != x || pickUp.Y != y)
                            {
                                MoveContext moveContext = new MoveContext(pickUp, pickUp.Amount, (IEntity)item.Parent, false);
                                moveContext.Locate(x, y);
                                moveContext.Enqueue();
                            }
                            x += this.m_xOffset;
                            y += this.m_yOffset;
                        }
                    }
                }
            }
            return(true);
        }
コード例 #2
0
        protected override bool OnTarget(Item item)
        {
            Mobile player = World.Player;

            if (player != null)
            {
                Item backpack = player.Backpack;
                if (backpack != null)
                {
                    foreach (Item pickUp in backpack.GetItems((IItemValidator) new ItemIDValidator(new int[1] {
                        item.ID
                    })))
                    {
                        if (pickUp != item)
                        {
                            MoveContext moveContext = new MoveContext(pickUp, pickUp.Amount, (IEntity)item, false);
                            moveContext.Locate(item.X, item.Y);
                            moveContext.Enqueue();
                        }
                    }
                }
            }
            return(true);
        }