// level.js
// Brutal Force XP Per Level Insert
// I can't find a function to do it. *guilty*

var XPTable = [
	, // 0 index defined
	0, // 1
	1000,
	2250,
	3750,
	5500,	// 5
	7500,
	10000,
	13000,
	16500,
	20500,	// 10
	26000,
	32000,
	39000,
	47000,
	57000,	//15
	69000,
	83000,
	99000,
	119000,
	143000,	//20
	175000,
	210000,
	255000,
	310000,
	375000,	//25
	450000,
	550000,
	675000,
	825000,
	1000000 	//30
]

function NextXP() {
	var nextlevel = parseInt(sheet().Level.value) + 1;
	
	sheet().XPNext.value = XPTable[nextlevel];
}

function XPCheck() {
	var XP = parseInt(sheet().XPCurrent.value);
	
	if (XP >= parseInt(sheet().XPNext.value)) {
		sheet().Level.value = parseInt(sheet().Level.value) + 1;
		OnLevelChanged();
		NextXP();
	}
}