// *************************************************************** // Function: GSCreateCharacter.cpp // *************************************************************** #include "Main.h" #include "LocalData.h" #include "../../src/SharedStructures.h" int CreateNewCharacter(QUERY_RESULT* pResult, LOCAL_DATA* pLir); //************************************ // Name: ProcessGSCreateCharacter // // Handles the create character request from the game server. Queries for the character's temporary items. // // Parameters: // pData - Network data // // Return: // //************************************ void ProcessGSCreateCharacter(NetMessage* pData) { gCoreLog.debug("Making a new character."); CREATE_CHARACTER *p_char_msg=new CREATE_CHARACTER; Read_Struct(pData->pData+2, p_char_msg, sizeof(CREATE_CHARACTER)); LOCAL_DATA* pLir=0; unsigned long accountID=p_char_msg->accountId; //Find the lir id we need hash_map::iterator itr; for (itr=gLoginInfo.begin(); itr!=gLoginInfo.end(); itr++) { if (BIT_TEST(itr->second.bitfield, LD_AUTHENTICATED) && (itr)->second.accountId==accountID) { pLir=&itr->second; } } assert(pLir!=NULL); //set-up a query for all the items needed. char query[200]; sprintf(query, "SELECT ID, Data, ItemLocType FROM items WHERE OwnerCID=1 AND OwnerAID=%u", pLir->accountId); pLir->queryId=gDatabase.Query(query, (long)strlen(query)); //Set the accountID to the game server id xD p_char_msg->accountId=pData->networkId; pLir->pTempData=p_char_msg; pLir->QueryProcess=CreateNewCharacter; }