server/core/tools/namegen.c

245 lines
7.9 KiB
C
Raw Normal View History

2010-08-08 10:06:34 +02:00
/* vi: set ts=2:
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea.de>
2010-08-08 10:06:34 +02:00
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2001 | Henning Peters <faroul@beyond.kn-bremen.de>
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.de>
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#include <stdio.h>
#include <config.h>
#include <eressea.h>
2011-03-07 08:02:35 +01:00
static char *dwarf_syllable1[] = {
"B", "D", "F", "G", "Gl", "H", "K", "L", "M", "N", "R", "S", "T", "Th", "V",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *dwarf_syllable2[] = {
"a", "e", "i", "o", "oi", "u",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *dwarf_syllable3[] = {
"bur", "fur", "gan", "gnus", "gnar", "li", "lin", "lir", "mli", "nar", "nus",
"rin", "ran", "sin", "sil", "sur",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *elf_syllable1[] = {
"Al", "An", "Bal", "Bel", "Cal", "Cel", "El", "Elr", "Elv", "Eow", "Ear", "F",
"Fal", "Fel", "Fin", "G", "Gal", "Gel", "Gl", "Is", "Lan", "Leg", "Lom",
"N", "Nal", "Nel", "S", "Sal", "Sel", "T", "Tal", "Tel", "Thr", "Tin",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *elf_syllable2[] = {
"a", "adrie", "ara", "e", "ebri", "ele", "ere", "i", "io", "ithra", "ilma",
"il-Ga", "ili", "o", "orfi", "u", "y",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *elf_syllable3[] = {
"l", "las", "lad", "ldor", "ldur", "linde", "lith", "mir", "n", "nd", "ndel",
"ndil", "ndir", "nduil", "ng", "mbor", "r", "rith", "ril", "riand", "rion",
"s", "thien", "viel", "wen", "wyn",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *gnome_syllable1[] = {
"Aar", "An", "Ar", "As", "C", "H", "Han", "Har", "Hel", "Iir", "J", "Jan",
"Jar", "K", "L", "M", "Mar", "N", "Nik", "Os", "Ol", "P", "R", "S", "Sam",
"San", "T", "Ter", "Tom", "Ul", "V", "W", "Y",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *gnome_syllable2[] = {
"a", "aa", "ai", "e", "ei", "i", "o", "uo", "u", "uu",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *gnome_syllable3[] = {
"ron", "re", "la", "ki", "kseli", "ksi", "ku", "ja", "ta", "na", "namari",
"neli", "nika", "nikki", "nu", "nukka", "ka", "ko", "li", "kki", "rik",
"po", "to", "pekka", "rjaana", "rjatta", "rjukka", "la", "lla", "lli", "mo",
"nni",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *hobbit_syllable1[] = {
"B", "Ber", "Br", "D", "Der", "Dr", "F", "Fr", "G", "H", "L", "Ler", "M",
"Mer", "N", "P", "Pr", "Per", "R", "S", "T", "W",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *hobbit_syllable2[] = {
"a", "e", "i", "ia", "o", "oi", "u",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *hobbit_syllable3[] = {
"bo", "ck", "decan", "degar", "do", "doc", "go", "grin", "lba", "lbo", "lda",
"ldo", "lla", "ll", "lo", "m", "mwise", "nac", "noc", "nwise", "p", "ppin",
"pper", "tho", "to",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *human_syllable1[] = {
"Ab", "Ac", "Ad", "Af", "Agr", "Ast", "As", "Al", "Adw", "Adr", "Ar", "B",
"Br", "C", "Cr", "Ch", "Cad", "D", "Dr", "Dw", "Ed", "Eth", "Et", "Er",
"El", "Eow", "F", "Fr", "G", "Gr", "Gw", "Gal", "Gl", "H", "Ha", "Ib",
"Jer", "K", "Ka", "Ked", "L", "Loth", "Lar", "Leg", "M", "Mir", "N", "Nyd",
"Ol", "Oc", "On", "P", "Pr", "R", "Rh", "S", "Sev", "T", "Tr", "Th", "V",
"Y", "Z", "W", "Wic",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *human_syllable2[] = {
"a", "ae", "au", "ao", "are", "ale", "ali", "ay", "ardo", "e", "ei", "ea",
"eri", "era", "ela", "eli", "enda", "erra", "i", "ia", "ie", "ire", "ira",
"ila", "ili", "ira", "igo", "o", "oa", "oi", "oe", "ore", "u", "y",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *human_syllable3[] = {
"a", "and", "b", "bwyn", "baen", "bard", "c", "ctred", "cred", "ch", "can",
"d", "dan", "don", "der", "dric", "dfrid", "dus", "f", "g", "gord", "gan",
"l", "li", "lgrin", "lin", "lith", "lath", "loth", "ld", "ldric", "ldan",
"m", "mas", "mos", "mar", "mond", "n", "nydd", "nidd", "nnon", "nwan",
"nyth", "nad", "nn", "nnor", "nd", "p", "r", "ron", "rd", "s", "sh", "seth",
"sean", "t", "th", "tha", "tlan", "trem", "tram", "v", "vudd", "w", "wan",
"win", "wyn", "wyr", "wyr", "wyth",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *orc_syllable1[] = {
"B", "Er", "G", "Gr", "H", "P", "Pr", "R", "V", "Vr", "T", "Tr", "M", "Dr",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *orc_syllable2[] = {
"a", "i", "o", "oo", "u", "ui",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *orc_syllable3[] = {
"dash", "dish", "dush", "gar", "gor", "gdush", "lo", "gdish", "k", "lg",
"nak", "rag", "rbag", "rg", "rk", "ng", "nk", "rt", "ol", "urk", "shnak",
"mog", "mak", "rak",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *entish_syllable1[] = {
"Baum", "Wurzel", "Rinden", "Ast", "Blatt",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *entish_syllable2[] = {
"-",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *entish_syllable3[] = {
"H<EFBFBD>ter", "Pflanzer", "Hirte", "W<EFBFBD>chter", "Wachser", "Besch<EFBFBD>tzer",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *cthuloid_syllable1[] = {
"Cth", "Az", "Fth", "Ts", "Xo", "Q'N", "R'L", "Ghata", "L", "Zz", "Fl", "Cl",
"S", "Y",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *cthuloid_syllable2[] = {
"nar", "loi", "ul", "lu", "noth", "thon", "ath", "'N", "rhy", "oth", "aza",
"agn", "oa", "og",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *cthuloid_syllable3[] = {
"l", "a", "u", "oa", "oggua", "oth", "ath", "aggua", "lu", "lo", "loth",
"lotha", "agn", "axl",
2010-08-08 10:06:34 +02:00
};
2011-03-07 08:02:35 +01:00
static char *create_random_name(race_t race)
2010-08-08 10:06:34 +02:00
{
2011-03-07 08:02:35 +01:00
static char name[64];
switch (race) {
case RC_DWARF:
strcpy(name,
dwarf_syllable1[rng_int() % (sizeof(dwarf_syllable1) /
sizeof(char *))]);
strcat(name,
dwarf_syllable2[rand() % (sizeof(dwarf_syllable2) / sizeof(char *))]);
strcat(name,
dwarf_syllable3[rand() % (sizeof(dwarf_syllable3) / sizeof(char *))]);
break;
case RC_ELF:
strcpy(name,
elf_syllable1[rand() % (sizeof(elf_syllable1) / sizeof(char *))]);
strcat(name,
elf_syllable2[rand() % (sizeof(elf_syllable2) / sizeof(char *))]);
strcat(name,
elf_syllable3[rand() % (sizeof(elf_syllable3) / sizeof(char *))]);
break;
2010-08-08 10:06:34 +02:00
/*
case RACE_GNOME:
strcpy(name, gnome_syllable1[rand()%(sizeof(gnome_syllable1) / sizeof(char*))]);
strcat(name, gnome_syllable2[rand()%(sizeof(gnome_syllable2) / sizeof(char*))]);
strcat(name, gnome_syllable3[rand()%(sizeof(gnome_syllable3) / sizeof(char*))]);
break;
*/
2011-03-07 08:02:35 +01:00
case RC_HALFLING:
strcpy(name,
hobbit_syllable1[rand() % (sizeof(hobbit_syllable1) / sizeof(char *))]);
strcat(name,
hobbit_syllable2[rand() % (sizeof(hobbit_syllable2) / sizeof(char *))]);
strcat(name,
hobbit_syllable3[rand() % (sizeof(hobbit_syllable3) / sizeof(char *))]);
break;
case RC_HUMAN:
case RC_AQUARIAN:
case RC_CAT:
strcpy(name,
human_syllable1[rand() % (sizeof(human_syllable1) / sizeof(char *))]);
strcat(name,
human_syllable2[rand() % (sizeof(human_syllable2) / sizeof(char *))]);
strcat(name,
human_syllable3[rand() % (sizeof(human_syllable3) / sizeof(char *))]);
break;
case RC_ORC:
case RC_TROLL:
case RC_GOBLIN:
strcpy(name,
orc_syllable1[rand() % (sizeof(orc_syllable1) / sizeof(char *))]);
strcat(name,
orc_syllable2[rand() % (sizeof(orc_syllable2) / sizeof(char *))]);
strcat(name,
orc_syllable3[rand() % (sizeof(orc_syllable3) / sizeof(char *))]);
break;
2010-08-08 10:06:34 +02:00
/*
case RC_TREEMAN:
strcpy(name, entish_syllable1[rand()%(sizeof(entish_syllable1) / sizeof(char*))]);
strcat(name, entish_syllable2[rand()%(sizeof(entish_syllable2) / sizeof(char*))]);
strcat(name, entish_syllable3[rand()%(sizeof(entish_syllable3) / sizeof(char*))]);
break;
*/
2011-03-07 08:02:35 +01:00
case RC_DAEMON:
case RC_INSECT:
strcpy(name,
cthuloid_syllable1[rand() % (sizeof(cthuloid_syllable1) /
sizeof(char *))]);
strcat(name,
cthuloid_syllable2[rand() % (sizeof(cthuloid_syllable2) /
sizeof(char *))]);
strcat(name,
cthuloid_syllable3[rand() % (sizeof(cthuloid_syllable3) /
sizeof(char *))]);
break;
default:
name[0] = 0;
break;
}
2010-08-08 10:06:34 +02:00
2011-03-07 08:02:35 +01:00
return name;
2010-08-08 10:06:34 +02:00
}
2011-03-07 08:02:35 +01:00
int main(void)
2010-08-08 10:06:34 +02:00
{
race_t race;
2011-03-07 08:02:35 +01:00
for (race = 0; race < 11; race++) {
2010-08-08 10:06:34 +02:00
int i;
printf("%d:", (int)race);
2011-03-07 08:02:35 +01:00
for (i = 0; i < 20; i++) {
2010-08-08 10:06:34 +02:00
printf(" %s", create_random_name(race));
}
printf("\n");
}
return 0;
}