triggers.sql patch

Post Reply
PrBlahBlahtson
Developer
Posts: 539
Joined: Sun Jul 22, 2012 12:17 am

triggers.sql patch

Post by PrBlahBlahtson » Thu Oct 11, 2012 8:08 pm

Created from r1904

When conquest points were moved to their own table (char_points,) triggers.sql wasn't updated accordingly. As a result, creating a character that used a previous character's ID would drive the creation process insane, and lead to that whole Error 3301 nonsense until the server got it all sorted out.

At least on my first test, characters are now able to log in on the first try.
Attachments
triggers.sql.patch
(448 Bytes) Downloaded 177 times

User avatar
whasf
Site Admin
Posts: 1312
Joined: Thu Jul 19, 2012 9:11 pm

Re: triggers.sql patch

Post by whasf » Thu Oct 11, 2012 9:20 pm

I think the charid increments? It should never try to re-use a number, afaik...
-- Whasf

PrBlahBlahtson
Developer
Posts: 539
Joined: Sun Jul 22, 2012 12:17 am

Re: triggers.sql patch

Post by PrBlahBlahtson » Thu Oct 11, 2012 9:57 pm

I kept deleting and recreating two characters, and it just kept going back to 21835 and 21836. There was a lot of server restarting in there, but after deleting a character the server was definitely recycling old IDs.

Edit:
Was looking for if connect_server determined the initial level cap, although I can think of a way to get around that. Found the culprit to ID re-use instead.

Code: Select all

	const int8* fmtQuery = "SELECT max(charid) FROM chars";

	if( Sql_Query(SqlHandle,fmtQuery) == SQL_ERROR )
	{
		return -1;
	}

	uint32 CharID = 0;

	if( Sql_NumRows(SqlHandle) != 0 )
	{
		Sql_NextRow(SqlHandle);
		
		CharID = (uint32)Sql_GetUIntData(SqlHandle,0) + 1;
	}

	CharID = (CharID < 21828 ? 21828 : CharID);
Find highest charid, new character's charid is max + 1.

Also, connect_server does not. char_jobs defaults to 50.

Post Reply