Few small optimizations here and there

This commit is contained in:
Aokromes
2017-02-01 16:51:21 +01:00
parent 0f9c7106ce
commit 8bb777ef5c
35 changed files with 366 additions and 373 deletions

View File

@@ -445,15 +445,16 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
}
else
{
// Invitee offline, get data from database
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_RACE_ACC_BY_NAME);
stmt->setString(0, name);
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
// Invitee offline, get data from storage
ObjectGuid guid = sWorld->GetCharacterGuidByName(name);
if (!guid.IsEmpty())
{
Field* fields = result->Fetch();
inviteeGuid = ObjectGuid(HighGuid::Player, fields[0].GetUInt32());
inviteeTeam = Player::TeamForRace(fields[1].GetUInt8());
inviteeGuildId = Player::GetGuildIdFromDB(inviteeGuid);
if (CharacterInfo const* characterInfo = sWorld->GetCharacterInfo(guid))
{
inviteeGuid = guid;
inviteeTeam = Player::TeamForRace(characterInfo->Race);
inviteeGuildId = characterInfo->GuildId;
}
}
}