User:Kiokurashi/common.js: Difference between revisions

From IdleOn MMO Wiki
imported>Kiokurashi
No edit summary
imported>Kiokurashi
No edit summary
Line 8: Line 8:
     var i = 18;
     var i = 18;
     do {
     do {
         var expo = 10 ** i;
         var expo = Math.pow(10, i);
         if (n > expo) {  
         if (n > expo) {  
             var num = Math.floor(n/expo);
             var num = Math.floor(n/expo);

Revision as of 02:26, 6 October 2021

function coindisplay(coins) {
    var n = coins;
    var ret = "";
    var imgs = ["4/43/Copper", "4/4e/Silver", "1/1f/Gold", "2/2c/Platinum", "5/53/Dementia", 
    "d/d5/Void_Coin.png/22px-Void", "1/11/Lustre_Coin.png/22px-Lustre", 
    "8/83/Starfire_Coin.png/22px-Starfire", "8/8b/Dreadlo_Coin.png/22px-Dreadlo", 
    "e/e6/Godshard_Coin.png/22px-Godshard"];
    var i = 18;
    do {
        var expo = Math.pow(10, i);
        if (n > expo) { 
            var num = Math.floor(n/expo);
                ret += "<img src=https://static.miraheze.org/idleonwiki/" + imgs[(i/2)] + 
                "_Coin.png>" + num;
            n = n % expo;
        }
        i = i - 2;
    } while(i > 0);
    return ret;
}