#include "Battleground.h"

class FastArenaCrystal : public GameObjectScript
{
public:

	FastArenaCrystal()
		: GameObjectScript("FastArenaCrystal") { }

	bool OnGossipHello(Player* player, GameObject* go)
	{

		if (Battleground *bg = player->GetBattleground())
		{
			// Don't let spectators to use arena crystal
			if (player->IsSpectator())
			{
				player->GetSession()->SendAreaTriggerMessage("Vous ne pouvez pas faire ca en tant que spectateur !");
				return false;
			}

			if (player->IsGameMaster()) // Can cause bug if GM clicks the crystal. Lets avoid that.
			{
				player->GetSession()->SendAreaTriggerMessage("Vous ne pouvez pas faire cela en mode GM !");
				return false;
			}

			if (bg->isArena())
				//player->GetSession()->SendAreaTriggerMessage("Players marked as ready: %u/2", bg->ClickFastStart(player, go));
			{
				if (bg->isArena() && bg->GetArenaType() == ARENA_TYPE_3v3_SOLO) // 3v3 solo queue
					player->GetSession()->SendAreaTriggerMessage("Joueurs marques comme pret: %u/6", bg->ClickFastStart(player, go));

				if (bg->isArena() && bg->GetArenaType() == ARENA_TYPE_5v5) // 1v1
					player->GetSession()->SendAreaTriggerMessage("Joueurs marques comme pret: %u/10", bg->ClickFastStart(player, go));

				if (bg->isArena() && bg->GetArenaType() == ARENA_TYPE_2v2) // 2v2
					player->GetSession()->SendAreaTriggerMessage("Joueurs marques comme pret: %u/4", bg->ClickFastStart(player, go));

				if (bg->isArena() && bg->GetArenaType() == ARENA_TYPE_3v3) // 3v3
					player->GetSession()->SendAreaTriggerMessage("Joueurs marques comme pret: %u/6", bg->ClickFastStart(player, go));
			}
		}
		player->PlayerTalkClass->SendCloseGossip();
		return false;
	}
};

void AddSC_fast_arena_start()
{
	new FastArenaCrystal();
}