private void pic_DragDrop(object sender, DragEventArgs e) { PictureBox currentTarget = (PictureBox)sender; if (currentSource.Name.Contains("invPic")) { int i1 = Convert.ToInt32(currentSource.Name.Substring(6, 1)); int j1 = Convert.ToInt32(currentSource.Name.Substring(8, currentSource.Name.Length - 8)); int i2 = Convert.ToInt32(currentTarget.Name.Substring(6, 1)); int j2 = Convert.ToInt32(currentTarget.Name.Substring(8, currentTarget.Name.Length - 8)); playerCharacter.SwapInventory(i1, j1, i2, j2); currentSource.Image = currentTarget.Image; currentTarget.Image = (Bitmap)e.Data.GetData(DataFormats.Bitmap, true); if (currentSource.Image == null) { currentSource.MouseDown -= pic_MouseDown; currentSource.MouseClick -= invPic_Click; currentSource.Cursor = Cursors.Default; currentTarget.MouseDown += new MouseEventHandler(pic_MouseDown); currentTarget.MouseClick += new MouseEventHandler(invPic_Click); currentTarget.Cursor = Cursors.Hand; } } else if (currentSource.Name.Contains("MainHand")) { int i = Convert.ToInt32(currentTarget.Name.Substring(6, 1)); int j = Convert.ToInt32(currentTarget.Name.Substring(8, currentTarget.Name.Length - 8)); playerCharacter.EquipMainHand(i, j); if (!playerCharacter.SuccessfulEquip) { return; } updatePlayerAttack(); picMainHand.Image = currentTarget.Image; currentTarget.Image = (Bitmap)e.Data.GetData(DataFormats.Bitmap, true); if (picMainHand.Image == null) { picMainHand.MouseDown -= pic_MouseDown; picMainHand.MouseClick -= mainHand_Click; picMainHand.Cursor = Cursors.Default; currentTarget.MouseDown += new MouseEventHandler(pic_MouseDown); currentTarget.MouseClick += new MouseEventHandler(invPic_Click); currentTarget.Cursor = Cursors.Hand; } } else if (currentSource.Name.Contains("Armour")) { int i = Convert.ToInt32(currentTarget.Name.Substring(6, 1)); int j = Convert.ToInt32(currentTarget.Name.Substring(8, currentTarget.Name.Length - 8)); playerCharacter.EquipArmour(i, j); if (!playerCharacter.SuccessfulEquip) { return; } updateArmour(); picArmour.Image = currentTarget.Image; currentTarget.Image = (Bitmap)e.Data.GetData(DataFormats.Bitmap, true); if (picArmour.Image == null) { picArmour.MouseDown -= pic_MouseDown; picArmour.MouseClick -= armour_Click; picArmour.Cursor = Cursors.Default; currentTarget.MouseDown += new MouseEventHandler(pic_MouseDown); currentTarget.MouseClick += new MouseEventHandler(invPic_Click); currentTarget.Cursor = Cursors.Hand; } } }