#include "HurtColor.h"
#include "Client.h"

#include "Utils/ColorUtils.h"

auto HurtColor::onGetActorOverlayColor(ImColor* color) -> void {
	auto clientinstance = Client::clientinstance;
	if (!clientinstance) return;

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

	if (interfaceColor) {
		*color = Utils::Color::getColor(3.f, 0, color->Value.w);
	}
	else {
		color->Value.x = r;
		color->Value.y = g;
		color->Value.z = b;
	}

	if (nocolor) {
		color->Value.w = 0.f;
	}
}

auto HurtColor::onClient() -> void {
	for (Setting* setting : Client::findSetting(this, _("Interface Color"))) {
		setting->visible = !nocolor;
	}
	for (Setting* setting : Client::findSetting(this, _("Red"))) {
		setting->visible = !interfaceColor && !nocolor;
	}
	for (Setting* setting : Client::findSetting(this, _("Green"))) {
		setting->visible = !interfaceColor && !nocolor;
	}
	for (Setting* setting : Client::findSetting(this, _("Blue"))) {
		setting->visible = !interfaceColor && !nocolor;
	}
}
