package client.gui.container;

import client.gui.element.Label;
import common.entity.npc.EntityNPC;
import common.inventory.ContainerRepair;
import common.util.Color;
import common.world.World;

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

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

	public void updateScreen() {
		super.updateScreen();
		if(this.anvil.maximumCost >= 40)
			this.info.setText(Color.DARK_RED + "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))
			this.info.setText(Color.RED + "Manakosten: " + this.anvil.maximumCost);
		else
			this.info.setText(Color.GREEN + "Manakosten: " + this.anvil.maximumCost);
	}

	public void addElements() {
		this.label("Amboss", 8, 16);
		this.info = this.label("", 60, 77);
		this.label("Inventar", 8, 90 - 8);
	}
}
