wakfuSacrier.js (2325B)
1 var nm1 = ["ch", "cr", "g", "gl", "gr", "k", "kr", "n", "q", "qr", "r", "rh", "t", "tr", "v", "vr", "z", "zh", "zr"]; 2 var nm2 = ["i", "e", "a", "o", "i", "e"]; 3 var nm3 = ["qq", "q", "r", "rs", "sh", "ss", "t", "tt", "th", "x", "z"]; 4 var nm4 = ["b", "c", "ch", "d", "g", "k", "m", "n", "r", "t", "v", "z"]; 5 var nm5 = ["a", "a", "e", "i", "o"]; 6 var nm6 = ["d", "h", "k", "l", "ll", "lm", "ln", "lf", "lk", "m", "n", "ng", "ph", "r", "rl", "rm", "s", "sh", "ss", "v", "y", "z"]; 7 var nm7 = ["i", "i", "e", "a", "o", "i"]; 8 var br = ""; 9 10 function nameGen(type) { 11 var tp = type; 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 (tp === 1) { 17 nameFem(); 18 while (nMs === "") { 19 nameFem(); 20 } 21 } else { 22 nameMas(); 23 while (nMs === "") { 24 nameMas(); 25 } 26 } 27 br = document.createElement('br'); 28 element.appendChild(document.createTextNode(nMs)); 29 element.appendChild(br); 30 } 31 if (document.getElementById("result")) { 32 document.getElementById("placeholder").removeChild(document.getElementById("result")); 33 } 34 document.getElementById("placeholder").appendChild(element); 35 } 36 37 function nameMas() { 38 nTp = Math.random() * 2 | 0; 39 rnd = Math.random() * nm1.length | 0; 40 rnd2 = Math.random() * nm2.length | 0; 41 rnd3 = Math.random() * nm3.length | 0; 42 while (nm1[rnd] === nm3[rnd3]) { 43 rnd3 = Math.random() * nm3.length | 0; 44 } 45 nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3]; 46 if (nTp === 0) { 47 rnd4 = Math.random() * nm2.length | 0; 48 while (nm2[rnd4] === nm2[rnd2]) { 49 rnd4 = Math.random() * nm2.length | 0; 50 } 51 nMs = nMs + " " + nm1[rnd] + nm2[rnd4] + nm3[rnd3]; 52 } 53 testSwear(nMs); 54 } 55 56 function nameFem() { 57 nTp = Math.random() * 4 | 0; 58 rnd = Math.random() * nm4.length | 0; 59 rnd2 = Math.random() * nm5.length | 0; 60 rnd3 = Math.random() * nm6.length | 0; 61 rnd4 = Math.random() * nm7.length | 0; 62 while (nm4[rnd] === nm6[rnd3]) { 63 rnd3 = Math.random() * nm6.length | 0; 64 } 65 nMs = nm4[rnd] + nm5[rnd2] + nm6[rnd3] + nm7[rnd4]; 66 testSwear(nMs); 67 }