User:Kiokurashi/common.js: Difference between revisions

From IdleOn MMO Wiki
imported>Kiokurashi
No edit summary
imported>Kiokurashi
No edit summary
Line 15: Line 15:
               // ret += "<img src=https://static.miraheze.org/idleonwiki/" + imgs[(i/2)] +  
               // ret += "<img src=https://static.miraheze.org/idleonwiki/" + imgs[(i/2)] +  
               // "_Coin.png>" + num
               // "_Coin.png>" + num
               ret += i + " "
               ret = ret + i + " "
             }
             }
             n = n.substring(len - i);
             n = n.substring(len - i);

Revision as of 01:50, 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 len = n.length;
        if (len > i) {
            var num = parseInt(n.substring(0, len - i));
            if (num > 0) {
               // ret += "<img src=https://static.miraheze.org/idleonwiki/" + imgs[(i/2)] + 
               // "_Coin.png>" + num
               ret = ret + i + " "
            }
            n = n.substring(len - i);
        }
        i = i - 2;
    }
    while(i > 0);

    return ret;
}