It's really unoptimized unfortunately, with memory corruption all around.
You're better off forking the EQMac emulator project as it uses the same protocol as Trilogy's boxset, with almost all of the opcodes being the same minus 0x20. (0x4040 becomes 0x4020, etc) and the structures being slightly different as well.
EQClassic has most if not all structures outlined for use in Trilogy, so it's just a matter of copy and pasting and fitting encodes/decodes for the time being.
https://github.com/cavedude00/Server/commits/master