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

hpHouseElfNames.js (2113B)


      1 var nm1 = ["B", "C", "D", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "V", "W", "Z"];
      2 var nm2 = ["oo", "a", "o"];
      3 var nm3 = ["", "d", "n", "r", "l", "b", "k"];
      4 var nm4 = ["b", "d", "k", "p", "r"];
      5 var nm5 = ["y", "ey"];
      6 var nm6 = ["ee", "i", "o"];
      7 var nm7 = ["", "n", "s", "l", "b", "m", "p"];
      8 var nm8 = ["k", "n", "s", "l", "m", "p"];
      9 
     10 function nameGen(type) {
     11     var tp = type;
     12     var br = "";
     13     var element = document.createElement("div");
     14     element.setAttribute("id", "result");
     15     for (i = 0; i < 10; i++) {
     16         if (tp === 1) {
     17             rnd = Math.floor(Math.random() * nm1.length);
     18             rnd2 = Math.floor(Math.random() * nm6.length);
     19             rnd3 = Math.floor(Math.random() * nm7.length);
     20             if (rnd2 === 0) {
     21                 rnd3 = 0;
     22             } else {
     23                 while (rnd3 === 0) {
     24                     rnd3 = Math.floor(Math.random() * nm7.length);
     25                 }
     26             }
     27             rnd4 = Math.floor(Math.random() * nm8.length);
     28             rnd5 = Math.floor(Math.random() * nm5.length);
     29             names = nm1[rnd] + nm6[rnd2] + nm7[rnd3] + nm8[rnd4] + nm5[rnd5];
     30         } else {
     31             rnd = Math.floor(Math.random() * nm1.length);
     32             rnd2 = Math.floor(Math.random() * nm2.length);
     33             rnd3 = Math.floor(Math.random() * nm3.length);
     34             if (rnd2 === 0) {
     35                 rnd3 = 0;
     36             } else {
     37                 while (rnd3 === 0) {
     38                     rnd3 = Math.floor(Math.random() * nm3.length);
     39                 }
     40             }
     41             rnd4 = Math.floor(Math.random() * nm4.length);
     42             rnd5 = Math.floor(Math.random() * nm5.length);
     43             names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm5[rnd5];
     44         }
     45         br = document.createElement('br');
     46         element.appendChild(document.createTextNode(names));
     47         element.appendChild(br);
     48     }
     49     if (document.getElementById("result")) {
     50         document.getElementById("placeholder").removeChild(document.getElementById("result"));
     51     }
     52     document.getElementById("placeholder").appendChild(element);
     53 }