Check if player's account has max level character?

Hi there,

I’m trying to figure out how to check that the player’s account already has a max level character. Ideally, this would be implemented in the course of a gossip interaction with a NPC.

Any help would be appreciated, thanks in advance!

You can retrieve the account id by using player->GetSession()->GetAccountId(); when the player interacts with the npc

Then you would have to either do a direct execute of a sql query using CharacterDatabase.PQuery() or check how prepared statements work. Something like “select max(level) from characters where account = x”.

Finally compare the result of that to your maximum level, either hardcoded or retrieving it from worldserver.cfg with sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); and act accordingly.

​Bitchin’. Many thanks.