User:Kiokurashi/common.js: Difference between revisions

From IdleOn MMO Wiki
imported>Kiokurashi
(Replaced content with "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/...")
imported>Kiokurashi
No edit summary
Line 13: Line 13:
             var num = parseInt(n.substring(0, len - i));
             var num = parseInt(n.substring(0, len - i));
             if (num > 0) {
             if (num > 0) {
                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 + " "
             }
             }
             n = n.substring(len - i);
             n = n.substring(len - i);
         }
         }
         i -= 2;
         i = i - 2;
     }
     }
     while(i > 0);
     while(i > 0);


     return ret + "Something";
     return ret;
}
}

Revision as of 01:49, 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 += i + " "
            }
            n = n.substring(len - i);
        }
        i = i - 2;
    }
    while(i > 0);

    return ret;
}