Core/Protocol:

- Correct the use of first byte in SMSG_NAME_QUERY_RESPONSE
- Send guid and name in SMSG_CHAR_RENAME for failing results too
This commit is contained in:
kaelima
2012-03-28 04:02:02 +02:00
parent 820f45c424
commit 6613cbafa6
2 changed files with 27 additions and 28 deletions
@@ -1119,8 +1119,10 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data)
uint8 res = ObjectMgr::CheckPlayerName(newName, true);
if (res != CHAR_NAME_SUCCESS)
{
WorldPacket data(SMSG_CHAR_RENAME, 1);
WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1));
data << uint8(res);
data << uint64(guid);
data << newName;
SendPacket(&data);
return;
}
@@ -1451,6 +1453,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
std::string oldname = result->Fetch()[0].GetString();
sLog->outChar("Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str());
}
Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_NAME_AT_LOGIN);
+19 -23
View File
@@ -33,42 +33,39 @@
void WorldSession::SendNameQueryOpcode(uint64 guid)
{
Player* player = NULL;
const CharacterNameData* nameData = sWorld->GetCharacterNameData(GUID_LOPART(guid));
if (nameData)
player = ObjectAccessor::FindPlayer(guid);
Player* player = ObjectAccessor::FindPlayer(guid);
CharacterNameData const* nameData = sWorld->GetCharacterNameData(GUID_LOPART(guid));
// guess size
WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+10));
data.appendPackGUID(guid);
data << uint8(0); // added in 3.1
if (nameData)
if (!player)
{
data << uint8(1); // player unknown
SendPacket(&data);
return;
}
if (!nameData)
{
data << uint8(2); // name unknown
SendPacket(&data);
return;
}
data << uint8(0); // name known
data << nameData->m_name; // played name
data << uint8(0); // realm name for cross realm BG usage
data << uint8(0); // realm name - only set for cross realm interaction (such as Battlegrounds)
data << uint8(nameData->m_race);
data << uint8(nameData->m_gender);
data << uint8(nameData->m_class);
}
else
{
data << std::string(GetTrinityString(LANG_NON_EXIST_CHARACTER));
data << uint32(0);
}
if (player)
{
if (DeclinedName const* names = player->GetDeclinedNames())
{
data << uint8(1); // is declined
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
data << uint8(1); // Name is declined
for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
data << names->name[i];
}
else
data << uint8(0); // is not declined
}
else //TODO: decline names may also need to be stored in char name data
data << uint8(0);
data << uint8(0); // Name is not declined
SendPacket(&data);
}
@@ -76,7 +73,6 @@ void WorldSession::SendNameQueryOpcode(uint64 guid)
void WorldSession::HandleNameQueryOpcode(WorldPacket& recv_data)
{
uint64 guid;
recv_data >> guid;
// This is disable by default to prevent lots of console spam