dndKobolds.js (2033B)
1 var nm1 = ["", "", "", "", "d", "g", "h", "k", "m", "n", "r", "s", "sn", "t", "v", "z"]; 2 var nm2 = ["a", "e", "i", "o", "u"]; 3 var nm3 = ["b", "bl", "d", "dr", "g", "gg", "gl", "gn", "gr", "hz", "hr", "hl", "hs", "k", "kk", "kr", "kl", "kb", "kd", "l", "ld", "lb", "lt", "ll", "lp", "lg", "p", "pl", "pp", "r", "rt", "rp", "rb", "rk", "t", "tr", "tl", "v", "vl", "vn"]; 4 var nm4 = ["", "", "", "", "", "d", "g", "gs", "k", "ks", "m", "n", "r", "rn", "s", "ss", "tt", "v", "x"]; 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 nameMas(); 13 while (nMs === "") { 14 nameMas(); 15 } 16 names = nMs; 17 br = document.createElement('br'); 18 element.appendChild(document.createTextNode(names)); 19 element.appendChild(br); 20 } 21 if (document.getElementById("result")) { 22 document.getElementById("placeholder").removeChild(document.getElementById("result")); 23 } 24 document.getElementById("placeholder").appendChild(element); 25 } 26 27 function nameMas() { 28 rnd = Math.random() * nm1.length | 0; 29 rnd2 = Math.random() * nm2.length | 0; 30 rnd4 = Math.random() * nm4.length | 0; 31 if (i < 4) { 32 while (rnd < 4) { 33 rnd = Math.random() * nm1.length | 0; 34 } 35 while (rnd4 < 5 || nm4[rnd4] === nm1[rnd]) { 36 rnd4 = Math.random() * nm4.length | 0; 37 } 38 nMs = nm1[rnd] + nm2[rnd2] + nm4[rnd4]; 39 } else { 40 rnd3 = Math.random() * nm3.length | 0; 41 rnd5 = Math.random() * nm2.length | 0; 42 if (rnd < 4) { 43 while (rnd4 < 5) { 44 rnd4 = Math.random() * nm4.length | 0; 45 } 46 } 47 while (nm3[rnd3] === nm1[rnd] || nm3[rnd3] === nm4[rnd4]) { 48 rnd3 = Math.random() * nm3.length | 0; 49 } 50 nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd5] + nm4[rnd2]; 51 } 52 testSwear(nMs); 53 }