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

avatarEarthKingdomPlaces.js (3156B)


      1 var nm1 = ["b", "ch", "g", "h", "l", "m", "n", "s", "sh", "w", "y", "z"];
      2 var nm2 = ["ao", "ai", "ia", "a", "i", "o", "u", "a", "i", "o", "u"];
      3 var nm3 = ["f", "j", "l", "p", "sh", "y", "z"];
      4 var nm4 = ["", "", "", "", "", "n", "ng"];
      5 var nm5 = ["", "", "", "d", "g", "h", "k", "n", "r", "t", "z"];
      6 var nm6 = ["a", "e", "i", "o", "u", "a", "i", "o", "u"];
      7 var nm7 = ["ch", "d", "k", "n", "s", "r", "t", "y", "z"];
      8 var nm8 = ["Island", "Village"];
      9 var nm9 = ["North", "South", "East", "West"];
     10 
     11 function nameGen() {
     12     $('#placeholder').css('textTransform', 'capitalize');
     13     var br = "";
     14     var element = document.createElement("div");
     15     element.setAttribute("id", "result");
     16     for (i = 0; i < 10; i++) {
     17         nameMas()
     18         while (nMs === "") {
     19             nameMas();
     20         }
     21         nTp = Math.random() * 6 | 0;
     22         if (nTp === 0) {
     23             rnd = Math.random() * nm8.length | 0;
     24             nMs = nMs + " " + nm8[rnd];
     25         } else if (nTp === 1) {
     26             rnd = Math.random() * nm9.length | 0;
     27             nMs = nm9[rnd] + " " + nMs;
     28         }
     29         br = document.createElement('br');
     30         element.appendChild(document.createTextNode(nMs));
     31         element.appendChild(br);
     32     }
     33     if (document.getElementById("result")) {
     34         document.getElementById("placeholder").removeChild(document.getElementById("result"));
     35     }
     36     document.getElementById("placeholder").appendChild(element);
     37 }
     38 
     39 function nameMas() {
     40     nTp = Math.random() * 4 | 0;
     41     if (nTp === 0) {
     42         rnd = Math.random() * nm5.length | 0;
     43         rnd2 = Math.random() * nm6.length | 0;
     44         rnd3 = Math.random() * nm7.length | 0;
     45         rnd4 = Math.random() * nm6.length | 0;
     46         rnd5 = Math.random() * nm7.length | 0;
     47         rnd6 = Math.random() * nm6.length | 0;
     48         while (nm7[rnd3] === nm5[rnd] || nm7[rnd3] === nm7[rnd5]) {
     49             rnd3 = Math.random() * nm7.length | 0;
     50         }
     51         nMs = nm5[rnd] + nm6[rnd2] + nm7[rnd3] + nm6[rnd4] + nm7[rnd5] + nm6[rnd6];
     52     } else {
     53         nTp = Math.random() * 6 | 0;
     54         rnd = Math.random() * nm1.length | 0;
     55         rnd2 = Math.random() * nm2.length | 0;
     56         rnd3 = Math.random() * nm4.length | 0;
     57         if (nTp < 4) {
     58             if (nTp === 0) {
     59                 nMs = nm1[rnd] + nm2[rnd2] + nm4[rnd3]
     60             } else {
     61                 rnd4 = Math.random() * nm1.length | 0;
     62                 rnd5 = Math.random() * nm2.length | 0;
     63                 rnd6 = Math.random() * nm4.length | 0;
     64                 if (nTp < 3) {
     65                     nMs = nm1[rnd] + nm2[rnd2] + nm4[rnd3] + " " + nm1[rnd4] + nm2[rnd5] + nm4[rnd6];
     66                 } else {
     67                     rnd7 = Math.random() * nm1.length | 0;
     68                     rnd8 = Math.random() * nm2.length | 0;
     69                     nMs = nm1[rnd] + nm2[rnd2] + nm4[rnd3] + " " + nm1[rnd4] + nm2[rnd5] + nm4[rnd6] + " " + nm1[rnd7] + nm2[rnd8];
     70                 }
     71             }
     72         } else {
     73             rnd4 = Math.random() * nm3.length | 0;
     74             rnd5 = Math.random() * nm2.length | 0;
     75             nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd4] + nm2[rnd5] + nm4[rnd3];
     76         }
     77     }
     78     testSwear(nMs);
     79 }