mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[8073] Use new database fields in offline player answer to CMSG_NAME_QUERY.
Signed-off-by: hunuza <hunuza@gmail.com>
This commit is contained in:
parent
8a32a19bad
commit
517697768a
2 changed files with 21 additions and 17 deletions
|
|
@ -63,17 +63,17 @@ void WorldSession::SendNameQueryOpcodeFromDB(uint64 guid)
|
||||||
CharacterDatabase.AsyncPQuery(&WorldSession::SendNameQueryOpcodeFromDBCallBack, GetAccountId(),
|
CharacterDatabase.AsyncPQuery(&WorldSession::SendNameQueryOpcodeFromDBCallBack, GetAccountId(),
|
||||||
!sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) ?
|
!sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) ?
|
||||||
// ------- Query Without Declined Names --------
|
// ------- Query Without Declined Names --------
|
||||||
// 0 1 2
|
// 0 1 2 3 4
|
||||||
"SELECT guid, name, SUBSTRING(data, LENGTH(SUBSTRING_INDEX(data, ' ', '%u'))+2, LENGTH(SUBSTRING_INDEX(data, ' ', '%u')) - LENGTH(SUBSTRING_INDEX(data, ' ', '%u'))-1) "
|
"SELECT guid, name, race, gender, class "
|
||||||
"FROM characters WHERE guid = '%u'"
|
"FROM characters WHERE guid = '%u'"
|
||||||
:
|
:
|
||||||
// --------- Query With Declined Names ---------
|
// --------- Query With Declined Names ---------
|
||||||
// 0 1 2
|
// 0 1 2 3 4
|
||||||
"SELECT characters.guid, name, SUBSTRING(data, LENGTH(SUBSTRING_INDEX(data, ' ', '%u'))+2, LENGTH(SUBSTRING_INDEX(data, ' ', '%u')) - LENGTH(SUBSTRING_INDEX(data, ' ', '%u'))-1), "
|
"SELECT characters.guid, name, race, gender, class, "
|
||||||
// 3 4 5 6 7
|
// 5 6 7 8 9
|
||||||
"genitive, dative, accusative, instrumental, prepositional "
|
"genitive, dative, accusative, instrumental, prepositional "
|
||||||
"FROM characters LEFT JOIN character_declinedname ON characters.guid = character_declinedname.guid WHERE characters.guid = '%u'",
|
"FROM characters LEFT JOIN character_declinedname ON characters.guid = character_declinedname.guid WHERE characters.guid = '%u'",
|
||||||
UNIT_FIELD_BYTES_0, UNIT_FIELD_BYTES_0+1, UNIT_FIELD_BYTES_0, GUID_LOPART(guid));
|
GUID_LOPART(guid));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32 accountId)
|
void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32 accountId)
|
||||||
|
|
@ -91,31 +91,35 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32
|
||||||
Field *fields = result->Fetch();
|
Field *fields = result->Fetch();
|
||||||
uint32 guid = fields[0].GetUInt32();
|
uint32 guid = fields[0].GetUInt32();
|
||||||
std::string name = fields[1].GetCppString();
|
std::string name = fields[1].GetCppString();
|
||||||
uint32 field = 0;
|
uint8 pRace = 0, pGender = 0, pClass = 0;
|
||||||
if(name == "")
|
if(name == "")
|
||||||
name = session->GetMangosString(LANG_NON_EXIST_CHARACTER);
|
name = session->GetMangosString(LANG_NON_EXIST_CHARACTER);
|
||||||
else
|
else
|
||||||
field = fields[2].GetUInt32();
|
{
|
||||||
|
pRace = fields[2].GetUInt8();
|
||||||
|
pGender = fields[3].GetUInt8();
|
||||||
|
pClass = fields[4].GetUInt8();
|
||||||
|
}
|
||||||
|
|
||||||
// guess size
|
// guess size
|
||||||
WorldPacket data( SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+1+10) );
|
WorldPacket data( SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+1+10) );
|
||||||
data.appendPackGUID(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER));
|
data.appendPackGUID(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER));
|
||||||
data << uint8(0); // added in 3.1
|
data << uint8(0); // added in 3.1
|
||||||
data << name;
|
data << name;
|
||||||
data << uint8(0);
|
data << uint8(0); // realm name for cross realm BG usage
|
||||||
data << uint8(field & 0xFF);
|
data << uint8(pRace); // race
|
||||||
data << uint8((field >> 16) & 0xFF);
|
data << uint8(pGender); // gender
|
||||||
data << uint8((field >> 8) & 0xFF);
|
data << uint8(pClass); // class
|
||||||
|
|
||||||
// if the first declined name field (3) is empty, the rest must be too
|
// if the first declined name field (5) is empty, the rest must be too
|
||||||
if(sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) && fields[3].GetCppString() != "")
|
if(sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) && fields[5].GetCppString() != "")
|
||||||
{
|
{
|
||||||
data << uint8(1); // is declined
|
data << uint8(1); // is declined
|
||||||
for(int i = 3; i < MAX_DECLINED_NAME_CASES+3; ++i)
|
for(int i = 5; i < MAX_DECLINED_NAME_CASES+5; ++i)
|
||||||
data << fields[i].GetCppString();
|
data << fields[i].GetCppString();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
data << uint8(0); // is declined
|
data << uint8(0); // is not declined
|
||||||
|
|
||||||
session->SendPacket( &data );
|
session->SendPacket( &data );
|
||||||
delete result;
|
delete result;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8072"
|
#define REVISION_NR "8073"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue