User:Kiokurashi/common.js: Difference between revisions

From IdleOn MMO Wiki
imported>Kiokurashi
No edit summary
imported>Kiokurashi
No edit summary
Line 9: Line 9:
         if (n > expo) {  
         if (n > expo) {  
             var num = Math.floor(n/expo);
             var num = Math.floor(n/expo);
                 ret += "<img src=https://static.miraheze.org/idleonwiki/" + imgs[(i/2)] + "_Coin.png>" + num;
                 ret += "<img src=https://static.miraheze.org/idleonwiki/" + imgs[(i/2)] + "_Coin.png>" + num + " ";
             n = n % expo;
             n = n % expo;
         }
         }
         i = i - 2;
         i -= 2;
     } while(i >= 0);
     } while(i >= 0);
     return ret;
     return ret;
}
}

Revision as of 04:44, 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", "1/11/Lustre", "8/83/Starfire", "8/8b/Dreadlo", "e/e6/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 -= 2;
    } while(i >= 0);
    return ret;
}