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

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