Exemplo n.º 1
0
        private void RemoveItemFromSlot(int slot, int count = 1)
        {
            EOInventoryItem control = m_childItems.Find(_control => _control.Slot == slot);

            if (control == null || slot < 0)
            {
                return;
            }

            int numLeft = control.Inventory.amount - count;

            if (numLeft <= 0)
            {
                ItemSize sz = control.ItemData.Size;
                List <Tuple <int, int> > points = _getTakenSlots(control.Slot, sz);
                points.ForEach(_p => m_filledSlots[_p.Item1, _p.Item2] = false);

                m_inventoryKey.SetValue(string.Format("item{0}", slot), 0, RegistryValueKind.String);
                m_childItems.Remove(control);
                control.Visible = false;
                control.Close();
            }
            else
            {
                control.Inventory = new InventoryItem {
                    amount = numLeft, id = control.Inventory.id
                }
            };
        }
Exemplo n.º 2
0
        private void _removeItemFromSlot(int slot, int count = 1)
        {
            EOInventoryItem control = m_childItems.Find(_control => _control.Slot == slot);

            if (control == null || slot < 0)
            {
                return;
            }

            int numLeft = control.Inventory.amount - count;

            if (numLeft <= 0 && control.Inventory.id != 1)
            {
                ItemSize sz = control.ItemData.Size;
                _unmarkItemSlots(m_filledSlots, _getTakenSlots(control.Slot, sz));

                m_inventoryKey.SetValue(string.Format("item{0}", slot), 0, RegistryValueKind.String);
                m_childItems.Remove(control);
                control.Visible = false;
                control.Close();
            }
            else
            {
                control.Inventory = new InventoryItem {
                    amount = numLeft, id = control.Inventory.id
                };
                control.UpdateItemLabel();
            }
        }