mgtDryads.js (3903B)
1 var nm1 = ["c", "f", "h", "l", "m", "n", "ph", "r", "s", "th", "w"]; 2 var nm2 = ["a", "e", "i", "a", "e", "i", "o", "a", "e", "i", "a", "e", "i", "o", "a", "e", "i", "a", "e", "i", "o", "a", "e", "i", "a", "e", "i", "o", "a", "e", "i", "a", "e", "i", "o", "ya", "ae", "ea", "ia", "ye", "ie"]; 3 var nm3 = ["h", "l", "ll", "m", "n", "r", "rr", "s", "ss", "t", "v"]; 4 var nm4 = ["fn", "fr", "hn", "ln", "lm", "ls", "mn", "mr", "nm", "n", "nn", "nr", "ns", "nph", "ph", "r", "rr", "sn", "st", "sh", "th", "thr"]; 5 var nm5 = ["fn", "fr", "h", "hn", "l", "ll", "lm", "ln", "ls", "m", "mn", "mr", "n", "nn", "nr", "r", "rr", "s", "sn", "sh", "ss", "thr"]; 6 var nm6 = ["acorn", "alder", "ash", "beech", "birch", "cedar", "cherry", "cypress", "elm", "fir", "juniper", "larch", "locust", "maple", "oak", "peach", "pine", "poplar", "spruce", "walnut", "willow", "yew", "tree", "hazel", "thistle", "autumn", "bare", "bark", "bitter", "blade", "blossom", "bramble", "brow", "bush", "copse", "covert", "dawn", "deep", "fall", "fern", "gentle", "gnarl", "grove", "hard", "heart", "husk", "leaf", "limb", "mild", "nettle", "oak", "pad", "root", "scrub", "shadow", "silver", "snow", "somber", "splinter", "spring", "sprout", "summer", "tangle", "tendril", "thorn", "trunk", "twig", "vine", "wild", "winter", "wise", "worm"]; 7 var nm7 = ["", "", "", "", "", "", "", "", "bark", "bellow", "blade", "blossom", "bramble", "brow", "copse", "covert", "crown", "fern", "fir", "flower", "glade", "grove", "heart", "husk", "leaf", "limb", "limbs", "root", "scrub", "shade", "shrub", "spine", "sprout", "stalk", "stand", "strider", "stump", "tendril", "thorn", "trunk", "twig", "wald", "walker", "wood"]; 8 var nm8 = ["Chorus", "Dancer", "Dryad", "Dryad", "Dryad", "Dryad", "Dryad", "Dryad", "Elder", "Emissary", "Enchantress", "Guardian", "Legate", "Mage", "Militant", "Naturalist", "Outrider", "Pathfinder", "Ranger", "Scout", "Sentinel", "Sophisticate", "Stalker", "Trickster", "Vanguard", "Walker"]; 9 var br = ""; 10 11 function nameGen() { 12 $('#placeholder').css('textTransform', 'capitalize'); 13 var element = document.createElement("div"); 14 element.setAttribute("id", "result"); 15 for (i = 0; i < 10; i++) { 16 if (i < 6) { 17 rnd = Math.floor(Math.random() * nm1.length); 18 rnd2 = Math.floor(Math.random() * nm2.length); 19 rnd3 = Math.floor(Math.random() * nm5.length); 20 rnd4 = Math.floor(Math.random() * nm2.length); 21 if (i < 2) { 22 names = nm1[rnd] + nm2[rnd2] + nm5[rnd3] + nm2[rnd4]; 23 } else { 24 rnd3 = Math.floor(Math.random() * nm3.length); 25 rnd5 = Math.floor(Math.random() * nm4.length); 26 rnd6 = Math.floor(Math.random() * nm2.length); 27 while (nm3[rnd3] === nm4[rnd5]) { 28 rnd5 = Math.floor(Math.random() * nm4.length); 29 } 30 if (i < 4) { 31 names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd4] + nm5[rnd5] + nm2[rnd6]; 32 } else { 33 names = nm1[rnd] + nm2[rnd4] + nm5[rnd5] + nm2[rnd2] + nm3[rnd3] + nm2[rnd6]; 34 } 35 } 36 } else { 37 rnd = Math.floor(Math.random() * nm6.length); 38 rnd2 = Math.floor(Math.random() * nm7.length); 39 while (nm6[rnd] === nm7[rnd2]) { 40 rnd2 = Math.floor(Math.random() * nm7.length); 41 } 42 rnd3 = Math.floor(Math.random() * nm8.length); 43 names = nm6[rnd] + nm7[rnd2] + " " + nm8[rnd3]; 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 }