Improved ScriptMgr with more hooks

This commit is contained in:
Yehonal
2016-08-08 11:46:34 +02:00
parent 9d3f4767c0
commit 2636b90869
5 changed files with 118 additions and 4 deletions

View File

@@ -6946,6 +6946,12 @@ TeamId Player::TeamIdForRace(uint8 race)
void Player::setFactionForRace(uint8 race)
{
m_team = TeamIdForRace(race);
sScriptMgr->OnPlayerUpdateFaction(this);
if (GetTeamId(true) != GetTeamId())
return;
ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race);
setFaction(rEntry ? rEntry->FactionID : 0);
}