mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Core/World
* Update character name cache after player rename * Add character name data for characters loaded with PlayerDump Closes #3653 Closes #3970
This commit is contained in:
@@ -443,6 +443,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||
typedef PetIds::value_type PetIdsPair;
|
||||
PetIds petids;
|
||||
|
||||
uint8 gender;
|
||||
uint8 race;
|
||||
uint8 playerClass;
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
while (!feof(fin))
|
||||
{
|
||||
@@ -512,6 +515,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||
if (!changenth(line, 2, chraccount)) // characters.account update
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
|
||||
race = uint8(atol(getnth(line, 4).c_str()));
|
||||
playerClass = uint8(atol(getnth(line, 5).c_str()));
|
||||
gender = uint8(atol(getnth(line, 6).c_str()));
|
||||
if (name == "")
|
||||
{
|
||||
// check if the original name already exists
|
||||
@@ -520,10 +526,8 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||
|
||||
result = CharacterDatabase.PQuery("SELECT 1 FROM characters WHERE name = '%s'", name.c_str());
|
||||
if (result)
|
||||
{
|
||||
if (!changenth(line, 37, "1")) // characters.at_login set to "rename on login"
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
}
|
||||
else if (!changenth(line, 3, name.c_str())) // characters.name
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
@@ -654,6 +658,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
// in case of name conflict player has to rename at login anyway
|
||||
sWorld->AddCharacterNameData(guid, name, gender, race, playerClass);
|
||||
|
||||
sObjectMgr->m_hiItemGuid += items.size();
|
||||
sObjectMgr->m_mailid += mails.size();
|
||||
|
||||
@@ -664,4 +671,3 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||
|
||||
return DUMP_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user