Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Core/World: Add character name data after loading PlayerDump

Closes #3653

Note: Manual changes in database while the server is running are not advised thus not supported
  • Loading branch information...
commit d9451cedd8e3cc9a09b12a96075b91ba8a6ad496 1 parent 3831e76
@Shauren Shauren authored
View
3  src/server/game/Handlers/CharacterHandler.cpp
@@ -653,8 +653,6 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
LoginDatabase.CommitTransaction(trans);
- newChar.CleanupsBeforeDelete();
-
WorldPacket data(SMSG_CHAR_CREATE, 1);
data << uint8(CHAR_CREATE_SUCCESS);
SendPacket(&data);
@@ -665,6 +663,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
sScriptMgr->OnPlayerCreate(&newChar);
sWorld->AddCharacterNameData(newChar.GetGUIDLow(), std::string(newChar.GetName()), newChar.getGender(), newChar.getRace(), newChar.getClass());
+ newChar.CleanupsBeforeDelete();
delete createInfo;
_charCreateCallback.Reset();
}
View
2  src/server/game/World/World.cpp
@@ -2926,7 +2926,7 @@ void World::LoadCharacterNameData()
{
sLog->outString("Loading character name data");
- QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class FROM characters");
+ QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class FROM characters WHERE deleteDate IS NULL");
if (!result)
{
sLog->outError("No character name data loaded, empty query");
View
1  src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -48,6 +48,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_SEL_CHAR_RACE, "SELECT race FROM characters WHERE guid = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_CHAR_LEVEL, "SELECT level FROM characters WHERE guid = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_CHAR_ZONE, "SELECT zone FROM characters WHERE guid = ?", CONNECTION_SYNCH);
+ PREPARE_STATEMENT(CHAR_SEL_CHARACTER_NAME_DATA, "SELECT race, class, gender FROM characters WHERE guid = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_CHAR_POSITION_XYZ, "SELECT map, position_x, position_y, position_z FROM characters WHERE guid = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_CHAR_POSITION, "SELECT position_x, position_y, position_z, orientation, map, taxi_path FROM characters WHERE guid = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_DEL_QUEST_STATUS_DAILY, "DELETE FROM character_queststatus_daily", CONNECTION_ASYNC);
View
1  src/server/shared/Database/Implementation/CharacterDatabase.h
@@ -68,6 +68,7 @@ enum CharacterDatabaseStatements
CHAR_SEL_CHAR_RACE,
CHAR_SEL_CHAR_LEVEL,
CHAR_SEL_CHAR_ZONE,
+ CHAR_SEL_CHARACTER_NAME_DATA,
CHAR_SEL_CHAR_POSITION_XYZ,
CHAR_SEL_CHAR_POSITION,
CHAR_DEL_QUEST_STATUS_DAILY,
View
5 src/server/worldserver/CommandLine/CliRunnable.cpp
@@ -314,6 +314,11 @@ void ChatHandler::HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo
stmt->setUInt32(2, delInfo.lowguid);
CharacterDatabase.Execute(stmt);
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA);
+ stmt->setUInt32(0, delInfo.lowguid);
+ if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
+ sWorld->AddCharacterNameData(delInfo.lowguid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8());
}
/**

1 comment on commit d9451ce

@Shauren
Owner

erm, the commit message should be "after undeleting character"

Please sign in to comment.
Something went wrong with that request. Please try again.