User Tools

Site Tools


greasemonkey:ii-truancy-meter

ii-truancy-meter

ii-truancy-meter.user.js
// ==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 +=
      //"<span class='colLtYellow'>" +
      "<table style='border: solid 1px #000000;' title='"+ExperienceTruancy+"' bgcolor='red' cellpadding='0' cellspacing='0' width='70' height='5'><tr><td width='"+TruancyBarWidth+"%' bgcolor='"+(Experience>=ExperienceTruancy?'#00FF00':'white')+"'></td><td width='"+RemainderWidth+"%'></td></tr></table>" 
      //+ "</span>"
      ;}
 
                //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 +=
      //"<span class='colLtYellow'>" +
          "<table style='border: solid 1px #000000;' title='"+ExperienceLevelAfterThat+"' bgcolor='red' cellpadding='0' cellspacing='0' width='70' height='5'><tr><td width='"+NextTruancyBarWidth+"%' bgcolor='"+(Experience>=ExperienceLevelAfterThat?'#00FF00':'white')+"'></td><td width='"+RemainderWidth+"%'></td></tr></table>"
      // + "</span>"
      ;}
 
     /*   //Overall
        var ExperienceWin = ExperienceTable[15] + (14 * DKs * 25);
        var OverallWidth = (Experience / (ExperienceWin)) * 100;
        var OverRemaining = 100 - OverallWidth;
    LevelRow.cells[1].innerHTML +=
      "<span class='colLtYellow'>" +
      "<table style='border: solid 1px #000000;' title='"+ExperienceWin+"' bgcolor='red' cellpadding='0' cellspacing='0' width='70' height='5'><tr><td width='"+OverallWidth+"%' bgcolor='"+(Experience>=ExperienceWin?'#00D000':'white')+"'></td><td width='"+OverRemaining+"%'></td></tr></table>" +
      "<br/></span>";
    //alert(ExperienceWin);  */
 
}

Version 1.0 (discussion thread link)

I made a Greasemonkey script that adds a second experience bar below the first, which fills up toward the point where you get hunted down by your dojo master. It works on my system, so I figured I'd share.

Version 1.1
Version 2.0 (discussion thread link)

I ended up adding a bit to it so it only shows the second bar if you've gone past what you need for the level you're on, and fiddled with the colors. The part commented out near the bottom–/*//Overall...Win);*/–adds a bar below your level number, showing you how far you have to go to level 15. Just remove the /* and */ to turn that part on.

Version 2.1
Version 3.0 (discussion thread link)

I tinkered with the Truancy Bar a bit. Don't you love open-source?

New features:
An extra truancy bar starts filling up after you filled the first truancy bar.
Mouse-over the truancy bar and it shows you how much experience is required to fill it.

Tinkered with the colors a bit. The truancy bar fills white on a red background, then turns green once it's filled. It's the same color green that is used for the stamina and health bar, to give it a more unified look.

Code below. Remove the /* */ to activate the Overall exp bar.
greasemonkey/ii-truancy-meter.txt · Last modified: 2023/11/21 18:04 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki