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

mgtMoonfolk.js (5836B)


      1 var nm1 = ["b", "d", "h", "l", "m", "n", "r", "t", "v", "z"];
      2 var nm2 = ["e", "o", "u", "e", "o", "u", "a", "i"];
      3 var nm3 = ["b", "d", "k", "l", "m", "n", "s", "t", "z"];
      4 var nm4 = ["e", "a", "o", "e", "a", "o", "e", "a", "o", "e", "a", "o", "i", "i", "u"];
      5 var nm5 = ["b", "d", "f", "g", "l", "m", "n", "r", "s", "t", "v", "y", "z"];
      6 var nm6 = ["b", "d", "g", "h", "l", "m", "n", "r", "s", "t", "y", "z"];
      7 var nm7 = ["Ambassador", "Ascendant", "Breezecaller", "Cerberus", "Cloud-Conjurer", "Floodbringer", "Cloudchaser", "Cloudguard", "Cloudkeeper", "Cloudskater", "Cloudwatcher", "Conjurer", "Conservator", "Consul", "Custodian", "Defender", "Delegate", "Diplomat", "Diviner", "Emissary", "Enchanter", "Envoy", "Guard", "Guardian", "Gustcaller", "Illusionist", "Keeper", "Legate", "Mage", "Messenger", "Mindsweeper", "Mirror-Mage", "Overseer", "Prophet", "Protector", "Raincaller", "Rainchaser", "Rainmaker", "Rainshaper", "Sage", "Savant", "Sear", "Seer", "Sentinel", "Sentry", "Shepherd", "Soothsayer", "Sorcerer", "Spellbinder", "Vicar", "Ward", "Warden", "Watch", "Windcaller"];
      8 var nm8 = ["", "", "", "", "", "b", "d", "h", "l", "m", "n", "r", "t", "v", "z"];
      9 var br = "";
     10 
     11 function nameGen(type) {
     12     $('#placeholder').css('textTransform', 'capitalize');
     13     var tp = type;
     14     var element = document.createElement("div");
     15     element.setAttribute("id", "result");
     16     for (i = 0; i < 10; i++) {
     17         rnd9 = Math.floor(Math.random() * nm7.length);
     18         if (tp === 1) {
     19             if (i < 6) {
     20                 rnd = Math.floor(Math.random() * nm4.length);
     21                 rnd2 = Math.floor(Math.random() * nm5.length);
     22                 rnd3 = Math.floor(Math.random() * nm4.length);
     23                 if (i < 3) {
     24                     names = nm4[rnd] + nm5[rnd2] + nm4[rnd3] + ", " + nm7[rnd9];
     25                 } else {
     26                     rnd4 = Math.floor(Math.random() * nm6.length);
     27                     rnd5 = Math.floor(Math.random() * nm4.length);
     28                     names = nm4[rnd] + nm5[rnd2] + nm4[rnd3] + nm6[rnd4] + nm4[rnd5] + ", " + nm7[rnd9];
     29                 }
     30             } else {
     31                 rnd = Math.floor(Math.random() * nm8.length);
     32                 rnd2 = Math.floor(Math.random() * nm4.length);
     33                 rnd3 = Math.floor(Math.random() * nm3.length);
     34                 rnd4 = Math.floor(Math.random() * nm4.length);
     35                 rnd5 = Math.floor(Math.random() * nm3.length);
     36                 rnd6 = Math.floor(Math.random() * nm4.length);
     37                 while (nm8[rnd] === nm3[rnd3]) {
     38                     rnd3 = Math.floor(Math.random() * nm3.length);
     39                 }
     40                 while (nm3[rnd5] === nm3[rnd3]) {
     41                     rnd5 = Math.floor(Math.random() * nm3.length);
     42                 }
     43                 if (i < 8) {
     44                     names = nm8[rnd] + nm4[rnd2] + nm3[rnd3] + nm4[rnd4] + nm3[rnd5] + nm4[rnd6] + " " + nm7[rnd9];
     45                 } else {
     46                     rnd7 = Math.floor(Math.random() * nm3.length);
     47                     rnd8 = Math.floor(Math.random() * nm4.length);
     48                     while (nm3[rnd5] === nm3[rnd7]) {
     49                         rnd7 = Math.floor(Math.random() * nm3.length);
     50                     }
     51                     names = nm8[rnd] + nm4[rnd2] + nm3[rnd3] + nm4[rnd4] + nm3[rnd5] + nm4[rnd6] + nm3[rnd7] + nm4[rnd8] + " " + nm7[rnd9];
     52                 }
     53             }
     54         } else {
     55             if (i < 6) {
     56                 rnd = Math.floor(Math.random() * nm1.length);
     57                 rnd2 = Math.floor(Math.random() * nm2.length);
     58                 rnd3 = Math.floor(Math.random() * nm3.length);
     59                 rnd4 = Math.floor(Math.random() * nm2.length);
     60                 rnd5 = Math.floor(Math.random() * nm3.length);
     61                 rnd6 = Math.floor(Math.random() * nm2.length);
     62                 while (nm3[rnd3] === nm1[rnd]) {
     63                     rnd3 = Math.floor(Math.random() * nm3.length);
     64                 }
     65                 while (nm3[rnd3] === nm3[rnd5]) {
     66                     rnd5 = Math.floor(Math.random() * nm3.length);
     67                 }
     68                 names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd4] + nm3[rnd5] + nm2[rnd6] + ", " + nm7[rnd9];
     69             } else {
     70                 rnd = Math.floor(Math.random() * nm8.length);
     71                 rnd2 = Math.floor(Math.random() * nm4.length);
     72                 rnd3 = Math.floor(Math.random() * nm3.length);
     73                 rnd4 = Math.floor(Math.random() * nm4.length);
     74                 rnd5 = Math.floor(Math.random() * nm3.length);
     75                 rnd6 = Math.floor(Math.random() * nm4.length);
     76                 while (nm8[rnd] === nm3[rnd3]) {
     77                     rnd3 = Math.floor(Math.random() * nm3.length);
     78                 }
     79                 while (nm3[rnd5] === nm3[rnd3]) {
     80                     rnd5 = Math.floor(Math.random() * nm3.length);
     81                 }
     82                 if (i < 8) {
     83                     names = nm8[rnd] + nm4[rnd2] + nm3[rnd3] + nm4[rnd4] + nm3[rnd5] + nm4[rnd6] + " " + nm7[rnd9];
     84                 } else {
     85                     rnd7 = Math.floor(Math.random() * nm3.length);
     86                     rnd8 = Math.floor(Math.random() * nm4.length);
     87                     while (nm3[rnd5] === nm3[rnd7]) {
     88                         rnd7 = Math.floor(Math.random() * nm3.length);
     89                     }
     90                     names = nm8[rnd] + nm4[rnd2] + nm3[rnd3] + nm4[rnd4] + nm3[rnd5] + nm4[rnd6] + nm3[rnd7] + nm4[rnd8] + " " + nm7[rnd9];
     91                 }
     92             }
     93         }
     94         br = document.createElement('br');
     95         element.appendChild(document.createTextNode(names));
     96         element.appendChild(br);
     97     }
     98     if (document.getElementById("result")) {
     99         document.getElementById("placeholder").removeChild(document.getElementById("result"));
    100     }
    101     document.getElementById("placeholder").appendChild(element);
    102 }