mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Few small optimizations here and there
This commit is contained in:
@@ -1219,6 +1219,7 @@ void WorldSession::HandleCharRenameCallback(std::shared_ptr<CharacterRenameInfo>
|
||||
SendCharRename(RESPONSE_SUCCESS, renameInfo.get());
|
||||
|
||||
sWorld->UpdateCharacterInfo(renameInfo->Guid, renameInfo->Name);
|
||||
sWorld->UpdateCharacterGuidByName(renameInfo->Guid, oldName, renameInfo->Name);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
@@ -1477,7 +1478,7 @@ void WorldSession::HandleCharCustomizeCallback(std::shared_ptr<CharacterCustomiz
|
||||
}
|
||||
|
||||
// character with this name already exist
|
||||
if (ObjectGuid newGuid = sObjectMgr->GetPlayerGUIDByName(customizeInfo->Name))
|
||||
if (ObjectGuid newGuid = sWorld->GetCharacterGuidByName(customizeInfo->Name))
|
||||
{
|
||||
if (newGuid != customizeInfo->Guid)
|
||||
{
|
||||
@@ -1512,6 +1513,7 @@ void WorldSession::HandleCharCustomizeCallback(std::shared_ptr<CharacterCustomiz
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
sWorld->UpdateCharacterInfo(customizeInfo->Guid, customizeInfo->Name, customizeInfo->Gender);
|
||||
sWorld->UpdateCharacterGuidByName(customizeInfo->Guid, oldName, customizeInfo->Name);
|
||||
|
||||
SendCharCustomize(RESPONSE_SUCCESS, customizeInfo.get());
|
||||
|
||||
@@ -1695,6 +1697,7 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptr<Charact
|
||||
uint8 oldRace = characterInfo->Race;
|
||||
uint8 playerClass = characterInfo->Class;
|
||||
uint8 level = characterInfo->Level;
|
||||
std::string oldName = characterInfo->Name;
|
||||
|
||||
if (!sObjectMgr->GetPlayerInfo(factionChangeInfo->Race, playerClass))
|
||||
{
|
||||
@@ -1759,7 +1762,7 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptr<Charact
|
||||
}
|
||||
|
||||
// character with this name already exist
|
||||
ObjectGuid newGuid = sObjectMgr->GetPlayerGUIDByName(factionChangeInfo->Name);
|
||||
ObjectGuid newGuid = sWorld->GetCharacterGuidByName(factionChangeInfo->Name);
|
||||
if (!newGuid.IsEmpty())
|
||||
{
|
||||
if (newGuid != factionChangeInfo->Guid)
|
||||
@@ -1812,6 +1815,7 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptr<Charact
|
||||
}
|
||||
|
||||
sWorld->UpdateCharacterInfo(factionChangeInfo->Guid, factionChangeInfo->Name, factionChangeInfo->Gender, factionChangeInfo->Race);
|
||||
sWorld->UpdateCharacterGuidByName(factionChangeInfo->Guid, oldName, factionChangeInfo->Name);
|
||||
|
||||
if (oldRace != factionChangeInfo->Race)
|
||||
{
|
||||
@@ -1910,15 +1914,11 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptr<Charact
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
/// @todo: make this part async
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
|
||||
{
|
||||
// Reset guild
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER);
|
||||
stmt->setUInt32(0, lowGuid);
|
||||
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
|
||||
if (Guild* guild = sGuildMgr->GetGuildById((result->Fetch()[0]).GetUInt32()))
|
||||
guild->DeleteMember(trans, factionChangeInfo->Guid, false, false, true);
|
||||
if (Guild* guild = sGuildMgr->GetGuildById(characterInfo->GuildId))
|
||||
guild->DeleteMember(trans, factionChangeInfo->Guid, false, false, true);
|
||||
|
||||
Player::LeaveAllArenaTeams(factionChangeInfo->Guid);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user