#include "AutoGG.h"

#include "Client.h"

auto AutoGG::onEnabled() -> void {
	auto clientinstance = Client::clientinstance;
	if (!clientinstance) return;

	auto localplayer = clientinstance->getLocalPlayer();
	if (!localplayer) return;

	auto loopbackpacketsender = clientinstance->getLoopbackPacketSender();
	if (!loopbackpacketsender) return;

	std::shared_ptr<Packet> packet = Packet::CreatePacket(PacketID::Text);
	auto* text = reinterpret_cast<TextPacket*>(packet.get());

	text->setType(TextPacket::Type::Raw);
	text->setName(localplayer->getNameTag());
	text->setMessage(_("hehe"));
	
	loopbackpacketsender->sendToServer(packet.get());
	Client::notifications.push_back({ _("Information"), _("Sended"), 5.f });
}

auto AutoGG::onClient() -> void {
	name = Datas::Language::get().module.other.autogg.name;
	description = Datas::Language::get().module.other.autogg.description;
}
