package client.gui.container;

import client.gui.element.Label;
import common.color.TextColor;
import common.inventory.ContainerRepair;
import common.inventory.InventoryPlayer;
import common.world.World;

public class GuiRepair extends GuiContainer {
	private ContainerRepair anvil;
	private Label info;
	private InventoryPlayer playerInv;

	public GuiRepair(InventoryPlayer inv, World world) {
		super(new ContainerRepair(inv, world));
		this.playerInv = inv;
		this.anvil = (ContainerRepair)this.inventorySlots;
	}

	public void updateScreen() {
		super.updateScreen();
		if(this.anvil.maximumCost >= 40)
			this.info.setText(TextColor.DRED + "Zu teuer!");
		else if(this.anvil.maximumCost <= 0 || !this.anvil.getSlot(2).getHasStack())
			this.info.setText("");
		else if(!this.anvil.getSlot(2).canTakeStack(this.playerInv.player))
			this.info.setText(TextColor.RED + "Manakosten: " + this.anvil.maximumCost);
		else
			this.info.setText(TextColor.GREEN + "Manakosten: " + this.anvil.maximumCost);
	}

	public void addElements() {
		this.label("Amboss", 60, 6);
		this.info = this.label("", 60, 67);
	}
}
