Exemplo n.º 1
0
 public GItemCounter(ItemIDValidator v)
     : base(0, 0, 100, 20)
 {
     this.m_Validator = (IItemValidator)v;
     this.m_Image     = new GItemArt(3, 3, v.List[0]);
     this.m_Label     = new GLabel("", Engine.DefaultFont, Hues.Bright, 0, 0);
     this.m_Image.X  -= this.m_Image.Image.xMin;
     this.m_Image.Y  -= this.m_Image.Image.yMin;
     this.m_Children.Add((Gump)this.m_Image);
     this.m_Children.Add((Gump)this.m_Label);
     this.m_LastAmount = int.MinValue;
 }
Exemplo n.º 2
0
        private void OrganizeStackableItem(int itemID, Point destination, Item targetContainer)
        {
            Mobile player = World.Player;

            if (player == null)
            {
                return;
            }
            Item backpack = player.Backpack;

            if (backpack == null)
            {
                return;
            }
            ItemIDValidator itemIdValidator = new ItemIDValidator(new int[1] {
                itemID
            });
            Item pickUp1 = (Item)null;

            Item[] items1 = backpack.FindItems((IItemValidator)itemIdValidator);
            Item[] items2 = targetContainer.FindItems((IItemValidator)itemIdValidator);
            if (items1 == null || items1.Length <= 0)
            {
                return;
            }
            if (items2 != null)
            {
                foreach (Item obj in items2)
                {
                    if (obj.Parent == targetContainer && obj.X == destination.X && obj.Y == destination.Y)
                    {
                        pickUp1 = obj;
                        break;
                    }
                }
            }
            if (pickUp1 == null)
            {
                pickUp1 = items1[0];
                MoveContext moveContext = new MoveContext(pickUp1, pickUp1.Amount, (IEntity)targetContainer, false);
                moveContext.Locate(destination.X, destination.Y);
                moveContext.Enqueue();
            }
            foreach (Item pickUp2 in items1)
            {
                if (pickUp2 != pickUp1)
                {
                    new MoveContext(pickUp2, pickUp2.Amount, (IEntity)pickUp1, false).Enqueue();
                }
            }
        }