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

dndTrolls.js (1880B)


      1 var nm1 = ["", "ch", "d", "bl", "br", "d", "dr", "g", "gl", "gr", "k", "p", "pr", "r", "sr", "t", "tr", "z"];
      2 var nm2 = ["a", "e", "o", "a", "e", "o", "i", "u"];
      3 var nm3 = ["dd", "dr", "dk", "ff", "fk", "fr", "fs", "k", "kk", "kt", "pr", "ps", "r", "rr", "rl", "rk", "rp", "z", "zk", "zt", "ztr"];
      4 var nm4 = ["i", "i", "a", "e"];
      5 var nm5 = ["d", "g", "k", "n", "r", "t", "d", "g", "k", "n", "r", "t", "dd", "dt", "gt", "kt", "nd", "nk", "rk", "rr", "rrk", "rt", "tt"];
      6 var br = "";
      7 
      8 function nameGen(type) {
      9     $('#placeholder').css('textTransform', 'capitalize');
     10     var tp = type;
     11     var element = document.createElement("div");
     12     element.setAttribute("id", "result");
     13     for (i = 0; i < 10; i++) {
     14         nameMas();
     15         while (nMs === "") {
     16             nameMas();
     17         }
     18         br = document.createElement('br');
     19         element.appendChild(document.createTextNode(nMs));
     20         element.appendChild(br);
     21     }
     22     if (document.getElementById("result")) {
     23         document.getElementById("placeholder").removeChild(document.getElementById("result"));
     24     }
     25     document.getElementById("placeholder").appendChild(element);
     26 }
     27 
     28 function nameMas() {
     29     nTp = Math.random() * 7 | 0;
     30     rnd = Math.random() * nm1.length | 0;
     31     rnd2 = Math.random() * nm2.length | 0;
     32     rnd5 = Math.random() * nm5.length | 0;
     33     if (nTp < 4) {
     34         while (nm5[rnd5] < 12 && nm1[rnd] === "") {
     35             rnd5 = Math.random() * nm5.length | 0;
     36         }
     37         nMs = nm1[rnd] + nm2[rnd2] + nm5[rnd5];
     38     } else {
     39         rnd3 = Math.random() * nm3.length | 0;
     40         rnd4 = Math.random() * nm4.length | 0;
     41         while (nm3[rnd3] === nm5[rnd5] || nm3[rnd3] === nm1[rnd]) {
     42             rnd3 = Math.random() * nm3.length | 0;
     43         }
     44         rnd5 = Math.random() * 12 | 0;
     45         nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm5[rnd5];
     46     }
     47     testSwear(nMs);
     48 }