Get Team Id by group Leader instead of random player

This commit is contained in:
Yehonal
2016-08-08 11:51:02 +02:00
parent 9cf50f7c87
commit 2ee9fb4eb3

View File

@@ -91,9 +91,11 @@ public:
if (TeamIdInInstance == TEAM_NEUTRAL)
{
Map::PlayerList const &players = instance->GetPlayers();
if( !players.isEmpty() )
if( Player* pPlayer = players.begin()->GetSource() )
TeamIdInInstance = pPlayer->GetTeamId();
if (!players.isEmpty())
if (Player* pPlayer = players.begin()->GetSource())
if (Group * group = pPlayer->GetGroup())
if(Player* groupLeader = ObjectAccessor::GetPlayer(*pPlayer,group->GetLeaderGUID()))
TeamIdInInstance = groupLeader->GetTeamId();
}
switch( creature->GetEntry() )