Guilds, closes #377

Basic guild infrastructure and API functions. Guild perks TBD.