Get Team Id by group Leader instead of random player
This commit is contained in:
parent
9cf50f7c87
commit
2ee9fb4eb3
1 changed files with 5 additions and 3 deletions
|
|
@ -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() )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue