void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32 accountId) { if(!result) return; WorldSession * session = sWorld.FindSession(accountId); if(!session) { delete result; return; } Field *fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); std::string name = fields[1].GetCppString(); uint8 pRace = 0, pGender = 0, pClass = 0; if(name == "") name = session->GetMangosString(LANG_NON_EXIST_CHARACTER); else { pRace = fields[2].GetUInt8(); pGender = fields[3].GetUInt8(); pClass = fields[4].GetUInt8(); } // guess size WorldPacket data( SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+1+10) ); data.appendPackGUID(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)); data << uint8(0); // added in 3.1 data << name; data << uint8(0); // realm name for cross realm BG usage data << uint8(pRace); // race data << uint8(pGender); // gender data << uint8(pClass); // class // if the first declined name field (5) is empty, the rest must be too if(sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) && fields[5].GetCppString() != "") { data << uint8(1); // is declined for(int i = 5; i < MAX_DECLINED_NAME_CASES+5; ++i) data << fields[i].GetCppString(); } else data << uint8(0); // is not declined session->SendPacket( &data ); delete result; }
void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult* result, uint32 accountId) { if (!result) { return; } WorldSession* session = sWorld.FindSession(accountId); if (!session) { delete result; return; } Field* fields = result->Fetch(); uint32 lowguid = fields[0].GetUInt32(); std::string name = fields[1].GetCppString(); uint8 pRace = 0, pGender = 0, pClass = 0; if (name == "") { name = session->GetMangosString(LANG_NON_EXIST_CHARACTER); } else { pRace = fields[2].GetUInt8(); pGender = fields[3].GetUInt8(); pClass = fields[4].GetUInt8(); } // guess size WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8 + 1 + 4 + 4 + 4 + 10)); data << ObjectGuid(HIGHGUID_PLAYER, lowguid); data << name; data << uint8(0); // realm name for cross realm BG usage data << uint32(pRace); // race data << uint32(pGender); // gender data << uint32(pClass); // class session->SendPacket(&data); delete result; }