if( new Rect(WIDTHOFFSET, HEIGHTOFFSET+ (cnt * BUTTONSIZE), BUTTONSIZE,BUTTONSIZE).Contains(e.mousePosition)) {
if(e.type == EventType.mouseDown && e.button == 1){
IShortcut item = _inventPlayer1W[cnt];
c1.Inventory.Remove(c1.Inventory.GetEquipment(item.ID, itemDropType.Weapon),1, true, true);
_inventPlayer1W.Remove(_inventPlayer1W[cnt]); //removes item from the display list
//even if there is still an item with that "ID" in the inventory
_inventPlayer1W = c1.Inventory.GetContent(c1, false, false, true, false);
}
}
It looks like you're new here. If you want to get involved, click one of these buttons!
You can use Inventory.GetWeaponCount(int index) to get the quantity of a weapon in the inventory - you get a null exception because the weapon you're looking for isn't in the inventory and you try to access a property on it.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!