following change to unequip CharacterClass.gd fixes inventory issues, at least those I found:
func unequip(item):#NEEDS REMAKING!!!!
var duplicate = globals.check_duplicates(item.itembase, item.parts)
if duplicate != null:
var duplicate_item = state.items[duplicate]
if duplicate_item.owner == null:
if duplicate != item.id:
duplicate_item.amount += 1
item.amount = 0
item.owner = null
else:
item.amount += 1
duplicate_item.owner = null
else:
item.amount = 1
item.owner = null
for i in gear:
if gear[i] == item.id:
gear[i] = null
#removing bonuses
remove_stat_bonuses(item.bonusstats)
# for i in item.bonusstats:
# #self[i] -= item.bonusstats[i]
# set(i, get(i) - item.bonusstats[i])
var arr = find_eff_by_item(item.id)
for e in arr:
var eff = effects_pool.get_effect_by_id(e)
eff.remove()
recheck_effect_tag('recheck_item')
#checkequipmenteffects