Fixes and optimizations to the item_merge.lua converter.

- Special thanks to QQfoolsorellina

Signed-off-by: Haru <haru@dotalux.com>