using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {

	public Player(int _charID, int _roleID){
		SetCharacter(_charID);
		SetRole(_roleID);
	}


	public void DebugInfo() {
		Debug.Log(charname+" is a "+Rdb.GetStrRef(rolename_strref)+" with "+hp.ToString()+" hit points");
	}

	void SetCharacter(int _charID){
		charID = _charID;

		var ct = Rdb.GetTable("characters");
		charname = ct.GetValue<string>(charID, "name");
		spellID = ct.GetValue<int>(charID, "spell");
		hp = ct.GetValue<int>(charID, "hp");
	}

	void SetRole(int _roleID){
		roleID = _roleID;

		var rt = Rdb.GetTable("roles");
		rolename_strref = rt.GetValue<int>(roleID, "name_strref");
		ultiID = rt.GetValue<int>(roleID, "ulti");
		align = rt.GetValue<string>(roleID, "alignment");
	}

	public int charID;
	public string charname;
	public int spellID;
	public int hp;

	public int roleID;
	public int rolename_strref;
	public int ultiID;
	public string align;
}
