// ==UserScript==
// @name Improbable Island Xp Bar
// @namespace http://www.shadedraco.com/improbabletruancy
// @description Improbable Island Truancy Meter. Credit to Devin, modified by Tahvohck, Maniak, and CloudySky
// @include https://*improbableisland.com/*
// @grant none
// @version 3.2
// ==/UserScript==
var CharInfo = document.evaluate("//table[@class='charinfo']", document, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
var StatTable = document.evaluate("//table[@class='stat_table']", document, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
if (CharInfo) {
var LevelRow = document.evaluate("//td[@class='charinfo']/b/span[@class='colLtWhite'][text()='Level']/../../..", CharInfo, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
var ExperienceRow = document.evaluate("//td[@class='charinfo']/b/span[@class='colLtWhite'][text()='Experience']/../../..", CharInfo, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
}
if (StatTable) {
var LevelRow = document.evaluate("//td[@class='stat_tablecell stat_tablecell_stat']/b/span[@class='colLtWhite'][text()='Level']/../../..", StatTable, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
var ExperienceRow = document.evaluate("//td[@class='stat_tablecell stat_tablecell_stat']/b/span[@class='colLtWhite'][text()='Experience']/../../..", StatTable, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
}
if (LevelRow) {
var Level = Number(LevelRow.cells[1].childNodes[0].childNodes[0].textContent);
//var ExperienceMatch = ExperienceRow.cells[1].childNodes[0].childNodes[0].textContent.match(/^([\d,]+) \/ ([\d,]+)$/);
var ExperienceMatch = ExperienceRow.cells[1].childNodes[0].textContent.match(/^([\d,]+) \/ ([\d,]+)$/);
var Experience = Number(ExperienceMatch[1].replace(/,/g,''));
var ExperienceNextLevel = Number(ExperienceMatch[2].replace(/,/g,''));
var ExperienceTable = {
1 : 0,
2 : 100, //800
3 : 400, // 1800
4 : 1002,
5 : 1912,
6 : 3140,
7 : 4707,
8 : 6641,
9 : 8985,
10 : 11795,
11 : 15143,
12 : 19121,
13 : 23840,
14 : 29437,
15 : 36071,
16 : 43930,
17 : 43930, // Doesn't actually exist, but I needed to put something here
};
var DKs = (ExperienceNextLevel - ExperienceTable[Level+1]) / Level / 25;
//The various bars.------------------------------------------------
//Truancy
var ExperienceThisLevel = ExperienceTable[Level] + ((Level-1) * DKs * 25);
var ExperienceTruancy = ExperienceTable[Level+2] + ((Level+1) * DKs * 25);
var TruancyBarWidth = ((Experience - ExperienceNextLevel) / (ExperienceTruancy - ExperienceNextLevel)) * 100;
if (TruancyBarWidth < 0) TruancyBarWidth = 0;
if (TruancyBarWidth > 100) TruancyBarWidth = 100;
var RemainderWidth = 100 - TruancyBarWidth;
if(Experience >= ExperienceNextLevel) {
ExperienceRow.cells[1].innerHTML +=
//"" +
""
//+ ""
;}
//Next Truancy
var ExperienceNextTruancy = ExperienceTable[Level+2] + ((Level+2) * DKs * 25);
var ExperienceLevelAfterThat = ExperienceTable[Level+3] + ((Level+2) * DKs * 25);
var NextTruancyBarWidth = ((Experience - ExperienceNextTruancy) / (ExperienceLevelAfterThat - ExperienceNextTruancy)) * 100;
if (NextTruancyBarWidth < 0) NextTruancyBarWidth = 0;
if (NextTruancyBarWidth > 100) NextTruancyBarWidth = 100;
if(Experience >= ExperienceTruancy) {
ExperienceRow.cells[1].innerHTML +=
//"" +
""
// + ""
;}
/* //Overall
var ExperienceWin = ExperienceTable[15] + (14 * DKs * 25);
var OverallWidth = (Experience / (ExperienceWin)) * 100;
var OverRemaining = 100 - OverallWidth;
LevelRow.cells[1].innerHTML +=
"" +
"" +
"
";
//alert(ExperienceWin); */
}