예제 #1
0
        private void btnAddItem_Click(object sender, RoutedEventArgs e)
        {
            string name    = this.cmbItemName.Text;
            string type    = this.cmbItemType.Text;
            int    quanity = (int)this.slItemQuanity.Value;

            switch (type)
            {
            case "Items":
                Classes.Item item = new Classes.Item(name, type, quanity);
                this.ListOfItems.Add(item);
                break;

            case "Weapons":
                Classes.Weapon weapon = new Classes.Weapon(name, type, quanity);
                this.ListOfItems.Add(weapon);
                break;

            case "Armor":
                Classes.Armor armor = new Classes.Armor(name, type, quanity);
                this.ListOfItems.Add(armor);
                break;

            default:
                break;
            }

            PrepareForm();
        }
예제 #2
0
        public creativeInventory(Wrapped.Wrapped socket, Form1 mainform, short slot, Classes.Item clicked)
        {
            functions helper = new functions();

            socket.SendByte(0x6b);
            socket.writeShort(slot);
            helper.writeSlot(clicked, socket);
        }
예제 #3
0
        public void PosicionarCombo(object id)
        {
            Classes.Item item = new Classes.Item("", id);

            for (int i = 0; i < this.Items.Count; i++)
            {
                if ((int)((Classes.Item) this.Items[i]).Value == (int)item.Value)
                {
                    this.SelectedIndex = i;
                    return;
                }
            }
        }
예제 #4
0
        public creativeInventory(Wrapped.Wrapped socket, Form1 mainform)
        {
            functions helper = new functions();

            int slot = socket.readShort();

            Classes.Item thisitem = helper.returnSlot(socket);

            if (slot == -1)
            {
                ClickWindow click2 = new ClickWindow(socket, mainform, -999, 0, 0, thisitem);
            }
        }
예제 #5
0
        public int PegarComboSelecionado()
        {
            int comb;

            try
            {
                Classes.Item i = (Classes.Item) this.SelectedItem;
                if (i == null)
                {
                    return(0);
                }

                comb = (int)i.Value;
                return(comb);
            }
            catch (Exception)
            {
                return(-1);
            }
        }
예제 #6
0
        //Client-to-Server only

        public ClickWindow(Wrapped.Wrapped socket, Form1 MainForm, short slot, byte mouse, byte mode, Classes.Item clicked)
        {
            socket.writeByte(0x66);
            socket.writeByte(0);
            socket.writeShort(slot);
            socket.writeByte(mouse);
            socket.writeShort(13);
            socket.writeByte(mode);

            if (clicked == null)
            {
                socket.writeShort(-1);
            }
            else
            {
                socket.writeShort((short)clicked.itemID);
                socket.writeByte(clicked.itemCount);
                socket.writeShort(clicked.itemDamage);
                socket.writeShort(-1);
            }

            if (slot == -999 && clicked != null)
            {
                MainForm.inventory.Remove(clicked); // Just to make sure, pretty sure that minecraft will send a setwindowitem for it to clear anyway.
            }
        }