The equations used to decide the mana or hit points are stored in the server database, I don't know what the ones used on laanx are, as they are obviously not the same as the test database.
As far as creating a character with -1 or 400+ mana, I don't think it's a bug, it's just how the math script works... it may be changed quite easily to a better formula some day, if necessary.