that’s not a code problem. imho, it’s some “we don’t wanna do it for whatever reason… but we just don’t want to admit it” problem.
there is already the way to change class for 50 gems. so - it’s not like there are some hash related issues, weird data management or hacking-proof hardcoding - hence, there is no reason for not being able to use functionality that’s already there and just make a few interface adjustments and correction in requirements validation part (24h+), to make all requests proceed free-of-charge. if they are that bad with code - they could just save the number of gems before proceeding with totally unchanged logic, and if needed - restore the original amount after that.