offline-fantasy-name-generators

Offline version of www.fantasynamegenerators.com
git clone https://git.neptards.moe/neptards/offline-fantasy-name-generators.git
Log | Files | Refs | README

orcTowns.js (2806B)


      1 var nm1 = ["", "", "", "", "", "b", "br", "bh", "ch", "d", "dr", "dh", "g", "gr", "gh", "k", "kr", "kh", "l", "m", "n", "q", "r", "v", "z", "vr", "zr"];
      2 var nm2 = ["a", "e", "i", "o", "u", "a", "o", "u"];
      3 var nm3 = ["b", "cc", "d", "dd", "gg", "g", "r", "rr", "z", "zz", "b", "cc", "d", "dd", "gg", "g", "r", "rr", "z", "zz", "br", "cr", "dr", "dg", "dz", "dgr", "dk", "gr", "gh", "gk", "gz", "gm", "gn", "gv", "lb", "lg", "lgr", "ldr", "lbr", "lk", "lz", "mm", "rg", "rm", "rdr", "rbr", "rd", "rk", "rkr", "rgr", "rz", "shb", "shn", "zg", "zgr", "zd", "zr", "zdr"];
      4 var nm4 = ["", "kh", "d", "dh", "g", "gh", "l", "n", "r", "rd", "z"];
      5 var br = "";
      6 
      7 function nameGen() {
      8     $('#placeholder').css('textTransform', 'capitalize');
      9     var element = document.createElement("div");
     10     element.setAttribute("id", "result");
     11     for (i = 0; i < 10; i++) {
     12         rnd = Math.floor(Math.random() * nm1.length);
     13         rnd2 = Math.floor(Math.random() * nm2.length);
     14         rnd3 = Math.floor(Math.random() * nm3.length);
     15         rnd4 = Math.floor(Math.random() * nm2.length);
     16         rnd5 = Math.floor(Math.random() * nm4.length);
     17         if (i < 2) {
     18             rnd6 = Math.floor(Math.random() * nm1.length);
     19             rnd7 = Math.floor(Math.random() * nm2.length);
     20             rnd8 = Math.floor(Math.random() * nm4.length);
     21             if (rnd < 5) {
     22                 while (rnd5 === 0) {
     23                     rnd5 = Math.floor(Math.random() * nm4.length);
     24                 }
     25             }
     26             names = nm1[rnd] + nm2[rnd2] + nm4[rnd5] + "  " + nm1[rnd6] + nm2[rnd4] + nm3[rnd3] + nm2[rnd7] + nm4[rnd8];
     27         } else if (i < 6) {
     28             names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd4] + nm4[rnd5];
     29         } else if (i < 8) {
     30             rnd6 = Math.floor(Math.random() * nm3.length);
     31             rnd7 = Math.floor(Math.random() * nm2.length);
     32             names = nm1[rnd] + nm2[rnd2] + nm3[rnd6] + nm2[rnd7] + nm3[rnd3] + nm2[rnd4] + nm4[rnd5];
     33         } else {
     34             rnd6 = Math.floor(Math.random() * nm1.length);
     35             rnd7 = Math.floor(Math.random() * nm2.length);
     36             rnd8 = Math.floor(Math.random() * nm4.length);
     37             if (rnd < 5) {
     38                 while (rnd5 === 0) {
     39                     rnd5 = Math.floor(Math.random() * nm4.length);
     40                 }
     41             }
     42             names = nm1[rnd6] + nm2[rnd4] + nm3[rnd3] + nm2[rnd7] + nm4[rnd8] + "  " + nm1[rnd] + nm2[rnd2] + nm4[rnd5];
     43         }
     44         br = document.createElement('br');
     45         element.appendChild(document.createTextNode(names));
     46         element.appendChild(br);
     47     }
     48     if (document.getElementById("result")) {
     49         document.getElementById("placeholder").removeChild(document.getElementById("result"));
     50     }
     51     document.getElementById("placeholder").appendChild(element);
     52 }