void Arena::OnAddPlayer(PlayerPointer plr)
{
	plr->m_deathVision = true;

	if( plr->m_isGmInvisible )
		return;

	// remove all buffs (exclude talents, include flasks)
	for(uint32 x=0;x<MAX_AURAS;x++)
	{
		if(plr->m_auras[x])
		{
			if(plr->m_auras[x] && !plr->m_auras[x]->GetSpellProto()->DurationIndex && plr->m_auras[x]->GetSpellProto()->Flags4 & CAN_PERSIST_AND_CASTED_WHILE_DEAD)
				continue;
			else
			{
				plr->m_auras[x]->Remove();
			}
		}
	}
	plr->GetItemInterface()->RemoveAllConjured();
	plr->ResetAllCooldowns();

	if( !m_started )
		plr->CastSpell(plr, ARENA_PREPARATION, true);

	m_playersCount[plr->GetTeam()]++;
	UpdatePlayerCounts();

	/* Add the green/gold team flag */
	AuraPointer aura(new Aura(dbcSpell.LookupEntry(32724+plr->m_bgTeam), -1, plr, plr));
	plr->AddAura(aura);
	
	/* Set FFA PvP Flag */
	plr->SetFFAPvPFlag();

	hashmap_put(m_playersAlive, plr->GetLowGUID(), (any_t)1);
	if(Rated())
	{
		// Store the players who join so that we can change their rating even if they leave before arena finishes
		hashmap_put(m_players2[plr->GetTeam()], plr->GetLowGUID(), (any_t)1);
		if(m_teams[plr->GetTeam()] == -1 && plr->m_playerInfo && plr->m_playerInfo->arenaTeam[m_arenateamtype] != NULL)
		{
			m_teams[plr->GetTeam()] = plr->m_playerInfo->arenaTeam[m_arenateamtype]->m_id;
		}
	}
}