// *************************************************************** // Function: ActiveCharacter.cpp // *************************************************************** #include "Main.h" #include "LocalData.h" void BuildAccountPermissions(CompiledPacket* pPck, LOCAL_DATA* pLir); //************************************ // Name: HandleOpcode_CHARACTER_PLAYNAME // // Handles changing the active character name when it is changed at character selection. // // Parameters: // pData - Network data that has this opcode // pLir - Player's local data // // Return: // Size of packet //************************************ int HandleOpcode_CHARACTER_PLAYNAME(NetMessage* pData, LOCAL_DATA* pLir) { //Extract the name of the character to be played unsigned char name[39]; memset(name, 0, 39); memcpy(name, pData->pData+8, (int)pData->pData[6]*2); Util::StripUnicode(name); //Extract the login/play attempts pLir->loginAttempts=Read_uLong(pData->pData+2); strcpy(pLir->name, (char*)name); CompiledPacket pck; //Add the first section of the packet pck.AddShort(ServerOpcode(4)); pck.AddLong(pLir->loginAttempts); pck.AddLong(1); //Add the account info BuildAccountPermissions(&pck, pLir); //Add the stream terminator pck.AddShort(ServerOpcode(11)); pck.AddLong(pLir->loginAttempts); pck.AddLong(0); //Send a packet containing unknown information in response Util::SendCompiledPacket(&pck, pData->networkId, gpLoginServer); return pData->dataSize; }