Fix refer a friend Summon

This commit is contained in:
h0rs
2017-02-10 20:24:17 +00:00
committed by lee1991
parent b6d1d5dd56
commit 57b8cf0235
3 changed files with 42 additions and 4 deletions

View File

@@ -1136,6 +1136,26 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
// Load pet if any (if player not alive and in taxi flight or another then pet will remember as temporary unsummoned)
pCurrChar->LoadPet();
if (pCurrChar->GetSession()->GetRecruiterId() != 0 || pCurrChar->GetSession()->IsARecruiter())
{
bool isReferrer = pCurrChar->GetSession()->IsARecruiter();
for (SessionMap::const_iterator itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr)
{
if (!itr->second->GetRecruiterId() && !itr->second->IsARecruiter())
continue;
if (isReferrer && pCurrChar->GetSession()->GetAccountId() == itr->second->GetRecruiterId() || !isReferrer && pCurrChar->GetSession()->GetRecruiterId() == itr->second->GetAccountId())
{
Player * rf = itr->second->GetPlayer();
if (rf != NULL)
{
pCurrChar->SendUpdateToPlayer(rf);
rf->SendUpdateToPlayer(pCurrChar);
}
}
}
}
sScriptMgr->OnPlayerLogin(pCurrChar);
delete holder;
}