Jump to content

Problem Db Empires


Recommended Posts

I have a problem , i send to the db empire 6, example:

net.SendSelectEmpirePacket(6)

I send to the player_index empire = 6, but when i send this, the client closed in the game revision r40250, but in the game r2089m function.

 

My problem is, how can change in the db core this , i need send another number no only 1 to 3.

 

it may be here?

 

db/ClientManager.cpp

void CClientManager::QUERY_EMPIRE_SELECT(CPeer * pkPeer, DWORD dwHandle, TEmpireSelectPacket * p)

}

Sorry my bad english, i'm spanish xD

 

Thanks.

Link to comment
Share on other sites

void CClientManager::QUERY_EMPIRE_SELECT(CPeer * pkPeer, DWORD dwHandle, TEmpireSelectPacket * p)
{
	char szQuery[QUERY_MAX_LEN];

	snprintf(szQuery, sizeof(szQuery), "UPDATE player_index%s SET empire=%u WHERE id=%u", GetTablePostfix(), p->bEmpire, p->dwAccountID);
	delete CDBManager::instance().DirectQuery(szQuery);

	sys_log(0, "EmpireSelect: %s", szQuery);
	{
		snprintf(szQuery, sizeof(szQuery),
				"SELECT pid1, pid2, pid3, pid4 FROM player_index%s WHERE id=%u", GetTablePostfix(), p->dwAccountID);

		std::auto_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));

		SQLResult * pRes = pmsg->Get();

		if (pRes->uiNumRows)
		{
			sys_log(0, "EMPIRE %lu", pRes->uiNumRows);

			MYSQL_ROW row = mysql_fetch_row(pRes->pSQLResult);
			DWORD pids[3];

			UINT g_start_map[6] =
			{
				0,  // reserved
				1,  // ½Å¼ö±¹
				21, // õÁ¶±¹
				41,  // Áø³ë±¹
				61, // Asmodian
				81, // Elgoria
			};

			// FIXME share with game
			DWORD g_start_position[6][2]=
			{
				{      0,      0 },
				{ 469300, 964200 }, // ½Å¼ö±¹
				{  55700, 157900 }, // õÁ¶±¹
				{ 969600, 278400 },  // Áø³ë±¹
				{ 989600, 298400 }, // Asmodian
				{ 942400, 258200 } // Elgoria
			};

			for (int i = 0; i < 3; ++i)
			{
				str_to_number(pids[i], row[i]);
				sys_log(0, "EMPIRE PIDS[%d]", pids[i]);

				if (pids[i])
				{
					sys_log(0, "EMPIRE move to pid[%d] to villiage of %u, map_index %d", 
							pids[i], p->bEmpire, g_start_map[p->bEmpire]);

					snprintf(szQuery, sizeof(szQuery), "UPDATE player%s SET map_index=%u,x=%u,y=%u WHERE id=%u", 
							GetTablePostfix(),
							g_start_map[p->bEmpire],
							g_start_position[p->bEmpire][0],
							g_start_position[p->bEmpire][1],
							pids[i]);

					std::auto_ptr<SQLMsg> pmsg2(CDBManager::instance().DirectQuery(szQuery));
				}
			}
		}
	}

	pkPeer->EncodeHeader(HEADER_DG_EMPIRE_SELECT, dwHandle, sizeof(BYTE));
	pkPeer->EncodeBYTE(p->bEmpire);
}

 

Like this?

 

Regards.

  • Love 1

Plain logic saves lives.

Link to comment
Share on other sites

Yes HaveBeen, but my problem no is start in a map when you select another empire, my problem is send the packet ( Number of empire ) to the game or db.

 

In the game 2089m i could send the empire 4, empire 5.... but in this game, only can send empire 1 2, and 3, when i send the empire packet 4, or 5 ... the client go to the loginwindow.

 

I can modified the map start with a trigger in the database but i can't put the number of empire in the player_index.

 

Thanks.

 

Sorry my bad english.

Link to comment
Share on other sites

I deleted al sysser and syslog, and i create new account and select new empire, only create syslog in db folder .

Feb 23 15:01:06 :: [    18100] return 0/0/0 async 0/0/0
Feb 23 15:01:11 :: AUTH_LOGIN id(231321312) login(test) social_id() login_key(1831686121), client_key(377632999 1063637308 898357928 1891657486)
Feb 23 15:01:11 :: [    18150] return 0/0/0 async 0/0/0
Feb 23 15:01:12 :: LOGIN_BY_KEY success test 1831686121 25.187.228.86
Feb 23 15:01:12 :: RESULT_LOGIN: login success test rows: 0
Feb 23 15:01:16 :: [    18200] return 0/0/0 async 0/0/0
Feb 23 15:01:21 :: [    18250] return 0/0/0 async 0/0/0

Only this , nothing in sysser auth and game, and client.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.