extends Node2D

export var character = "01Vivi"
export var price = 100
export var artwork = "image.jpg"
export var locked = true

signal treasure_hover
signal treasure_click

func init_treasure(_character, _artwork, _price):
	self.character = _character
	self.price = _price
	self.artwork = _artwork
	
	var file_found = false	
	if Utils.file_exist("res://@content/" + self.character + "/treasures/mini/" + self.artwork): file_found = true
	if Utils.file_exist("res://@content/" + self.character + "/treasures/original/" + self.artwork): file_found = true
	if not file_found: return
	
	self.get_node("Sprite").texture = Utils.load_file("res://@content/" + self.character + "/treasures/mini/" + self.artwork.replace(".import", ""))

func get_original_dir():
	#if not Utils.file_exist("res://@content/" + self.character + "/treasures/original/" + self.artwork): return ""
	return "res://@content/" + self.character + "/treasures/original/" + self.artwork


func get_mini_dir():
	#if not Utils.file_exist("res://@content/" + self.character + "/treasures/mini/" + self.artwork): return ""
	return "res://@content/" + self.character + "/treasures/mini/" + self.artwork

func unlock():
	self.locked = false
	Utils.fade_out(self.get_node("Locked"), 0.5)
	Utils.fade_out(self.get_node("Price"), 0.5)
