// *************************************************************** // Function: InterfacePositionData.cpp // *************************************************************** #include "Main.h" #include "LocalData.h" //************************************ // Name: HandleOpcode_INTERFACE_POSITION_DATA // // Updates the account's user interface positioning data with the data from the client. // // Parameters: // pData - Network data // pLir - Player's local data // // Return: // size of packet //************************************ int HandleOpcode_INTERFACE_POSITION_DATA(NetMessage* pData, LOCAL_DATA* pLir) { if (!BIT_TEST(pLir->bitfield, LD_AUTHENTICATED)) { return pData->dataSize; } pLir->loginAttempts=Read_uLong(pData->pData+2); if (pData->dataSize>700) { gCoreLog.warning("Oversize InterfaceData detected. Not writing to db!"); return pData->dataSize; } int offset=10; //Convert the data into a hex string char hex_string[1450]; Util::BinToHex(pData->pData+offset, pData->dataSize-offset, hex_string); //Save this to the database =p char query[5000]; sprintf(query, "UPDATE accounts SET InterfaceDataSize=%u, InterfaceData=%s WHERE AccountID=%u LIMIT 1@NOSTATUS", pData->dataSize-offset, hex_string, pLir->accountId); gDatabase.Query(query, (long)strlen(query)); //Reply to it? o_O CompiledPacket pck; pck.AddShort(ServerOpcode(11)); pck.AddLong(Read_uLong(pData->pData+2)); pck.AddLong(0); Util::SendCompiledPacket(&pck, pData->networkId, gpLoginServer); return pData->dataSize; }