Exemple #1
0
 protected internal override void OnDragDrop(Gump g)
 {
     if (g != null && g.GetType() == typeof(GDraggedItem))
     {
         GDraggedItem gdraggedItem = (GDraggedItem)g;
         Item         toEquip      = gdraggedItem.Item;
         Item         obj          = (Item)null;
         Gump[]       array        = this.m_Children.ToArray();
         Point        client       = this.PointToClient(new Point(Engine.m_xMouse, Engine.m_yMouse));
         for (int index = array.Length - 1; index >= 0; --index)
         {
             if (array[index] is GPaperdollItem && array[index].HitTest(client.X - array[index].X, client.Y - array[index].Y))
             {
                 obj = ((GPaperdollItem)array[index]).Item;
                 break;
             }
         }
         if (obj != null && Map.m_ItemFlags[obj.ID & 16383][(TileFlag)2097152L])
         {
             Network.Send((Packet) new PDropItem(toEquip.Serial, -1, -1, 0, obj.Serial));
         }
         else if (Map.m_ItemFlags[toEquip.ID & 16383][(TileFlag)4194304L])
         {
             Network.Send((Packet) new PEquipItem(toEquip, this.m_Mobile));
         }
         else
         {
             Network.Send((Packet) new PDropItem(toEquip.Serial, -1, -1, 0, World.Serial));
         }
         Gumps.Destroy((Gump)gdraggedItem);
     }
     this._dragPreview = (Item)null;
 }
Exemple #2
0
        protected internal override void OnDragStart()
        {
            int num = (int)this._item.Layer;

            if (this._canLift && num >= 1 && (num <= 24 && num != 11) && num != 16 && num != 21)
            {
                this.m_IsDragging = false;
                Gumps.LastOver    = (Gump)null;
                Gumps.Drag        = (Gump)null;
                Gump gump = this._item.OnBeginDrag();
                if (gump.GetType() == typeof(GDragAmount))
                {
                    ((GDragAmount)gump).ToDestroy = (object)this;
                }
                else
                {
                    this._item.RestoreInfo = new RestoreInfo(this._item);
                    World.Remove(this._item);
                    Gumps.Destroy((Gump)this);
                }
            }
            else
            {
                this.m_IsDragging = false;
                Gumps.Drag        = (Gump)null;
                Point point = this.PointToScreen(new Point(0, 0)) - this.m_Parent.PointToScreen(new Point(0, 0));
                this.m_Parent.m_OffsetX    = point.X + this.m_OffsetX;
                this.m_Parent.m_OffsetY    = point.Y + this.m_OffsetY;
                this.m_Parent.m_IsDragging = true;
                Gumps.Drag = this.m_Parent;
            }
        }
Exemple #3
0
 protected internal override void OnDragDrop(Gump g)
 {
     if (!this.m_HitTest)
     {
         this.m_Parent.OnDragDrop(g);
     }
     else
     {
         if (g == null || !(g.GetType() == typeof(GDraggedItem)))
         {
             return;
         }
         GDraggedItem gdraggedItem = (GDraggedItem)g;
         Point        point        = this.Clip(gdraggedItem.Image, gdraggedItem.Double, this.PointToClient(new Point(Engine.m_xMouse - g.m_OffsetX, Engine.m_yMouse - g.m_OffsetY)), g.m_OffsetX, g.m_OffsetY);
         int          num          = gdraggedItem.Item.ID & 16383;
         if (num >= 13701 && num <= 13706)
         {
             point.Y += 20;
         }
         else if (num >= 13708 && num <= 13713)
         {
             point.Y += 20;
         }
         Gumps.Destroy((Gump)gdraggedItem);
         Network.Send((Packet) new PDropItem(gdraggedItem.Item.Serial, (int)(short)point.X, (int)(short)point.Y, 0, this.m_Item.Serial));
     }
 }
        protected internal override void OnDragDrop(Gump g)
        {
            if (g == null || !(g.GetType() == typeof(GDraggedItem)))
            {
                return;
            }
            GDraggedItem gdraggedItem = (GDraggedItem)g;
            Item         obj          = gdraggedItem.Item;

            if (((GContainer)this.m_Parent).m_HitTest)
            {
                TileFlags tileFlags = Map.m_ItemFlags[this.m_Item.ID & 16383];
                if (tileFlags[(TileFlag)2097152L])
                {
                    Network.Send((Packet) new PDropItem(obj.Serial, -1, -1, 0, this.m_Item.Serial));
                    Gumps.Destroy((Gump)gdraggedItem);
                }
                else if (tileFlags[(TileFlag)2048L] && obj.ID == this.m_Item.ID && (int)obj.Hue == (int)this.m_Item.Hue)
                {
                    Point point = ((GContainer)this.m_Parent).Clip(gdraggedItem.Image, gdraggedItem.Double, this.m_Parent.PointToClient(new Point(Engine.m_xMouse - gdraggedItem.m_OffsetX, Engine.m_yMouse - gdraggedItem.m_OffsetY)), gdraggedItem.m_OffsetX, gdraggedItem.m_OffsetY);
                    Network.Send((Packet) new PDropItem(obj.Serial, (int)(short)point.X, (int)(short)point.Y, 0, this.m_Item.Serial));
                    Gumps.Destroy((Gump)gdraggedItem);
                }
                else
                {
                    this.m_Parent.OnDragDrop((Gump)gdraggedItem);
                }
            }
            else
            {
                this.m_Parent.OnDragDrop((Gump)gdraggedItem);
            }
        }
        protected internal override void OnDragStart()
        {
            if (this.m_Item == null)
            {
                return;
            }
            this.m_IsDragging = false;
            Gumps.LastOver    = (Gump)null;
            Gumps.Drag        = (Gump)null;
            this.State        = 0;
            Gump gump = this.m_Item.OnBeginDrag();

            if (gump.GetType() == typeof(GDragAmount))
            {
                ((GDragAmount)gump).ToDestroy = (object)this;
            }
            else
            {
                this.m_Item.RestoreInfo = new RestoreInfo(this.m_Item);
                World.Remove(this.m_Item);
                gump.m_OffsetX = this.m_OffsetX;
                gump.m_OffsetY = this.m_OffsetY;
                gump.X         = Engine.m_xMouse - this.m_OffsetX;
                gump.Y         = Engine.m_yMouse - this.m_OffsetY;
                if (this.m_Parent is GContainer)
                {
                    ((GContainer)this.m_Parent).m_Hash[(object)this.m_Item] = (object)null;
                }
                Gumps.Destroy((Gump)this);
            }
        }
Exemple #6
0
 protected internal override void OnDragEnter(Gump g)
 {
     if (g == null || !(g.GetType() == typeof(GDraggedItem)))
     {
         return;
     }
     this._dragPreview = ((GDraggedItem)g).Item;
 }