Exemplo n.º 1
0
        static string name(bool male)
        {
            string name = "";

            switch (Session.Random.Next(8))
            {
            case 0:
                name = prefix() + (male ? suffix_male() : suffix_female());
                break;

            case 1:
            case 2:
            case 3:
            case 4:
                name = prefix() + (male ? suffix_male() : suffix_female()) + " " + thing(true) + thing(false);
                break;

            case 5:
            case 6:
                name = prefix() + (male ? suffix_male() : suffix_female()) + " " + prefix() + (male ? suffix_male() : suffix_female());
                break;

            case 7:
                name = prefix() + (male ? suffix_male() : suffix_female()) + " " + prefix() + (male ? suffix_male() : suffix_female()) + " '" + thing(true) + "-" + thing(false) + "'";
                break;
            }

            return(TextHelper.Capitalise(name, true));
        }
Exemplo n.º 2
0
        public static string FullName()
        {
            string first  = TextHelper.Capitalise(get_word(), true);
            string second = TextHelper.Capitalise(get_word(), true);

            return(first + " " + second);
        }
Exemplo n.º 3
0
        private static string get_values(string[] array)
        {
            int _number = NPCBuilder.get_number();
            BinarySearchTree <string> binarySearchTree = new BinarySearchTree <string>();

            while (binarySearchTree.Count != _number)
            {
                string str = array[Session.Random.Next((int)array.Length)];
                binarySearchTree.Add(str);
            }
            List <string> sortedList = binarySearchTree.SortedList;
            string        str1       = "";

            foreach (string str2 in sortedList)
            {
                if (str1 != "")
                {
                    str1 = (str2 != sortedList[sortedList.Count - 1] ? string.Concat(str1, ", ") : string.Concat(str1, " and "));
                }
                str1 = string.Concat(str1, str2);
            }
            if (str1 != "")
            {
                str1 = TextHelper.Capitalise(str1, false);
            }
            return(str1);
        }
Exemplo n.º 4
0
        static string name(bool male)
        {
            string name = "";

            switch (Session.Random.Next(10))
            {
            case 0:
            case 1:
            case 2:
            case 3:
                name = prefix() + suffix(male);
                break;

            case 4:
            case 5:
            case 6:
                name = prefix() + suffix(male) + suffix(male);
                break;

            case 7:
            case 8:
                name = prefix() + suffix(male) + " " + prefix() + suffix(male);
                break;

            case 9:
                name = suffix(male) + "'" + prefix() + suffix(male) + suffix(male);
                break;
            }

            return(TextHelper.Capitalise(name, true));
        }
Exemplo n.º 5
0
        public static string FullName()
        {
            string str  = TextHelper.Capitalise(ExoticName.get_word(), true);
            string str1 = TextHelper.Capitalise(ExoticName.get_word(), true);

            return(string.Concat(str, " ", str1));
        }
Exemplo n.º 6
0
        private static string name(bool male)
        {
            string str = "";

            switch (Session.Random.Next(8))
            {
            case 0:
            {
                str = string.Concat(DwarfName.prefix(), (male ? DwarfName.suffix_male() : DwarfName.suffix_female()));
                break;
            }

            case 1:
            case 2:
            case 3:
            case 4:
            {
                string[] strArrays = new string[] { DwarfName.prefix(), null, null, null, null };
                strArrays[1] = (male ? DwarfName.suffix_male() : DwarfName.suffix_female());
                strArrays[2] = " ";
                strArrays[3] = DwarfName.thing(true);
                strArrays[4] = DwarfName.thing(false);
                str          = string.Concat(strArrays);
                break;
            }

            case 5:
            case 6:
            {
                string[] strArrays1 = new string[] { DwarfName.prefix(), null, null, null, null };
                strArrays1[1] = (male ? DwarfName.suffix_male() : DwarfName.suffix_female());
                strArrays1[2] = " ";
                strArrays1[3] = DwarfName.prefix();
                strArrays1[4] = (male ? DwarfName.suffix_male() : DwarfName.suffix_female());
                str           = string.Concat(strArrays1);
                break;
            }

            case 7:
            {
                string[] strArrays2 = new string[] { DwarfName.prefix(), null, null, null, null, null, null, null, null, null };
                strArrays2[1] = (male ? DwarfName.suffix_male() : DwarfName.suffix_female());
                strArrays2[2] = " ";
                strArrays2[3] = DwarfName.prefix();
                strArrays2[4] = (male ? DwarfName.suffix_male() : DwarfName.suffix_female());
                strArrays2[5] = " '";
                strArrays2[6] = DwarfName.thing(true);
                strArrays2[7] = "-";
                strArrays2[8] = DwarfName.thing(false);
                strArrays2[9] = "'";
                str           = string.Concat(strArrays2);
                break;
            }
            }
            return(TextHelper.Capitalise(str, true));
        }
Exemplo n.º 7
0
        static List <string> create_from_gp(int gp)
        {
            List <string> items = new List <string>();

            if (Session.Random.Next() % 4 == 0)
            {
                // Just coins
                items.Add(coins(gp));
            }
            else
            {
                // Split into [gems, art objects, potions] and leftover coins
                int current = gp;
                while (current != 0)
                {
                    int value = get_value(current);
                    if (value == 0)
                    {
                        break;
                    }

                    // How many of these will fit?
                    int count = current / value;

                    // What sort of item is it?
                    string type = random_item_type(count != 1, true);

                    if (count == 1)
                    {
                        string start = TextHelper.StartsWithVowel(type) ? "an" : "a";
                        items.Add(start + " " + type + " (worth " + value + " GP)");
                    }
                    else
                    {
                        items.Add(count + " " + type + " (worth " + value + " GP each)");
                    }

                    current -= (value * count);
                }

                if (current != 0)
                {
                    // Add leftover as coins
                    items.Add(coins(current));
                }
            }

            for (int n = 0; n != items.Count; ++n)
            {
                items[n] = TextHelper.Capitalise(items[n], false);
            }

            return(items);
        }
Exemplo n.º 8
0
        public static string Sentence()
        {
            string str = "";
            int    num = Session.Dice(3, 6);

            for (int i = 0; i != num; i++)
            {
                if (str != "")
                {
                    str = string.Concat(str, " ");
                }
                str = string.Concat(str, ExoticName.get_word());
            }
            str = string.Concat(str, ".");
            return(TextHelper.Capitalise(str, false));
        }
Exemplo n.º 9
0
        private static List <string> create_from_gp(int gp)
        {
            int           i;
            int           _value = 0;
            int           num    = 0;
            List <string> strs   = new List <string>();

            if (Session.Random.Next() % 4 != 0)
            {
                for (i = gp; i != 0; i = i - _value * num)
                {
                    _value = Treasure.get_value(i);
                    if (_value == 0)
                    {
                        break;
                    }
                    num = i / _value;
                    string str = Treasure.random_item_type(num != 1, true);
                    if (num != 1)
                    {
                        object[] objArray = new object[] { num, " ", str, " (worth ", _value, " GP each)" };
                        strs.Add(string.Concat(objArray));
                    }
                    else
                    {
                        string   str1      = (TextHelper.StartsWithVowel(str) ? "an" : "a");
                        object[] objArray1 = new object[] { str1, " ", str, " (worth ", _value, " GP)" };
                        strs.Add(string.Concat(objArray1));
                    }
                }
                if (i != 0)
                {
                    strs.Add(Treasure.coins(i));
                }
            }
            else
            {
                strs.Add(Treasure.coins(gp));
            }
            for (int j = 0; j != strs.Count; j++)
            {
                strs[j] = TextHelper.Capitalise(strs[j], false);
            }
            return(strs);
        }
Exemplo n.º 10
0
        public static string Sentence()
        {
            string sentence = "";

            int words = Session.Dice(3, 6);

            for (int n = 0; n != words; ++n)
            {
                if (sentence != "")
                {
                    sentence += " ";
                }

                sentence += get_word();
            }

            sentence += ".";

            return(TextHelper.Capitalise(sentence, false));
        }
Exemplo n.º 11
0
        static string get_values(string[] array)
        {
            int count = get_number();

            BinarySearchTree <string> bst = new BinarySearchTree <string>();

            while (bst.Count != count)
            {
                string value = array[Session.Random.Next(array.Length)];
                bst.Add(value);
            }

            List <string> values = bst.SortedList;

            string result = "";

            foreach (string value in values)
            {
                if (result != "")
                {
                    if (value == values[values.Count - 1])
                    {
                        result += " and ";
                    }
                    else
                    {
                        result += ", ";
                    }
                }

                result += value;
            }

            if (result != "")
            {
                result = TextHelper.Capitalise(result, false);
            }

            return(result);
        }
Exemplo n.º 12
0
        private static string name(bool male)
        {
            string str = "";

            switch (Session.Random.Next(10))
            {
            case 0:
            case 1:
            case 2:
            case 3:
            {
                str = string.Concat(ElfName.prefix(), ElfName.suffix(male));
                break;
            }

            case 4:
            case 5:
            case 6:
            {
                str = string.Concat(ElfName.prefix(), ElfName.suffix(male), ElfName.suffix(male));
                break;
            }

            case 7:
            case 8:
            {
                string[] strArrays = new string[] { ElfName.prefix(), ElfName.suffix(male), " ", ElfName.prefix(), ElfName.suffix(male) };
                str = string.Concat(strArrays);
                break;
            }

            case 9:
            {
                string[] strArrays1 = new string[] { ElfName.suffix(male), "'", ElfName.prefix(), ElfName.suffix(male), ElfName.suffix(male) };
                str = string.Concat(strArrays1);
                break;
            }
            }
            return(TextHelper.Capitalise(str, true));
        }
Exemplo n.º 13
0
        public static string Title()
        {
            string title = "";

            switch (Session.Random.Next(5))
            {
            case 0:
            {
                // The NOUN's NOUN
                bool concrete1 = (Session.Random.Next(2) == 0);
                bool concrete2 = (Session.Random.Next(2) == 0);
                title = noun_phrase(concrete1, concrete1) + "'s " + noun_phrase(concrete2, false);
            }
            break;

            case 1:
            {
                // The NOUN and the NOUN
                bool concrete1 = (Session.Random.Next(2) == 0);
                bool concrete2 = (Session.Random.Next(2) == 0);
                title = noun_phrase(concrete1, concrete1) + " " + preposition() + " " + noun_phrase(concrete2, concrete2);
            }
            break;

            case 2:
            {
                // VERBING the NOUN
                bool concrete = (Session.Random.Next(2) == 0);
                title = gerund() + " the " + noun_phrase(concrete, false);
            }
            break;

            case 3:
            {
                if (Session.Random.Next(2) == 0)
                {
                    // About CONCRETE_NOUNs
                    title = about() + " " + noun(true) + "s";
                }
                else
                {
                    // About ABTRACT_NOUN
                    title = about() + " " + noun(false);
                }
            }
            break;

            case 4:
            {
                // The NOUN
                bool concrete = (Session.Random.Next(2) == 0);
                title = noun_phrase(concrete, true);
            }
            break;
            }

            if (Session.Random.Next(10) == 0)
            {
                // Append a volume number

                string type = "";
                switch (Session.Random.Next(2))
                {
                case 0:
                    type = "volume";
                    break;

                case 1:
                    type = "part";
                    break;
                }

                int volume = Session.Random.Next(5);
                switch (volume)
                {
                case 0:
                    title += ", " + type + " one";
                    break;

                case 1:
                    title += ", " + type + " two";
                    break;

                case 2:
                    title += ", " + type + " three";
                    break;

                case 3:
                    title += ", " + type + " four";
                    break;

                case 4:
                    title += ", " + type + " five";
                    break;
                }
            }

            // Capitalise
            title = TextHelper.Capitalise(title, true);

            return(title);
        }
Exemplo n.º 14
0
 public static string SingleName()
 {
     return(TextHelper.Capitalise(ExoticName.get_word(), true));
 }
Exemplo n.º 15
0
        public static string Title()
        {
            string str = "";

            switch (Session.Random.Next(5))
            {
            case 0:
            {
                bool flag  = Session.Random.Next(2) == 0;
                bool flag1 = Session.Random.Next(2) == 0;
                str = string.Concat(Book.noun_phrase(flag, flag), "'s ", Book.noun_phrase(flag1, false));
                break;
            }

            case 1:
            {
                bool     flag2     = Session.Random.Next(2) == 0;
                bool     flag3     = Session.Random.Next(2) == 0;
                string[] strArrays = new string[] { Book.noun_phrase(flag2, flag2), " ", Book.preposition(), " ", Book.noun_phrase(flag3, flag3) };
                str = string.Concat(strArrays);
                break;
            }

            case 2:
            {
                bool flag4 = Session.Random.Next(2) == 0;
                str = string.Concat(Book.gerund(), " the ", Book.noun_phrase(flag4, false));
                break;
            }

            case 3:
            {
                if (Session.Random.Next(2) != 0)
                {
                    str = string.Concat(Book.about(), " ", Book.noun(false));
                    break;
                }
                else
                {
                    str = string.Concat(Book.about(), " ", Book.noun(true), "s");
                    break;
                }
            }

            case 4:
            {
                bool flag5 = Session.Random.Next(2) == 0;
                str = Book.noun_phrase(flag5, true);
                break;
            }
            }
            if (Session.Random.Next(10) == 0)
            {
                string str1 = "";
                switch (Session.Random.Next(2))
                {
                case 0:
                {
                    str1 = "volume";
                    break;
                }

                case 1:
                {
                    str1 = "part";
                    break;
                }
                }
                switch (Session.Random.Next(5))
                {
                case 0:
                {
                    str = string.Concat(str, ", ", str1, " one");
                    break;
                }

                case 1:
                {
                    str = string.Concat(str, ", ", str1, " two");
                    break;
                }

                case 2:
                {
                    str = string.Concat(str, ", ", str1, " three");
                    break;
                }

                case 3:
                {
                    str = string.Concat(str, ", ", str1, " four");
                    break;
                }

                case 4:
                {
                    str = string.Concat(str, ", ", str1, " five");
                    break;
                }
                }
            }
            str = TextHelper.Capitalise(str, true);
            return(str);
        }
Exemplo n.º 16
0
        private static string name(bool male)
        {
            string str  = "";
            string str1 = "";

            switch (Session.Random.Next(20))
            {
            case 0:
            case 1:
            case 2:
            {
                str = HalflingName.simple(true);
                break;
            }

            case 3:
            case 4:
            case 5:
            case 6:
            {
                str = string.Concat(HalflingName.simple(true), HalflingName.simple(false));
                break;
            }

            case 7:
            case 8:
            case 9:
            case 10:
            {
                str  = HalflingName.simple(true);
                str1 = string.Concat(HalflingName.simple(true), HalflingName.simple(false));
                break;
            }

            case 11:
            case 12:
            case 13:
            case 14:
            case 15:
            {
                str  = string.Concat(HalflingName.simple(true), HalflingName.simple(false));
                str1 = HalflingName.simple(true);
                break;
            }

            case 16:
            case 17:
            case 18:
            case 19:
            {
                str  = string.Concat(HalflingName.simple(true), HalflingName.simple(false));
                str1 = string.Concat(HalflingName.earned(true), HalflingName.earned(false));
                break;
            }
            }
            if (!male)
            {
                char chr = str[str.Length - 1];
                if (!TextHelper.IsVowel(chr))
                {
                    str = string.Concat(str, chr);
                    str = string.Concat(str, "a");
                }
            }
            string str2 = str;

            if (str1 != "")
            {
                str2 = string.Concat(str2, " ", str1);
            }
            return(TextHelper.Capitalise(str2, true));
        }
Exemplo n.º 17
0
        static string name(bool male)
        {
            string first_name = "";
            string last_name  = "";

            switch (Session.Random.Next(20))
            {
            case 0:
            case 1:
            case 2:
                first_name = simple(true);
                break;

            case 3:
            case 4:
            case 5:
            case 6:
                first_name = simple(true) + simple(false);
                break;

            case 7:
            case 8:
            case 9:
            case 10:
                first_name = simple(true);
                last_name  = simple(true) + simple(false);
                break;

            case 11:
            case 12:
            case 13:
            case 14:
            case 15:
                first_name = simple(true) + simple(false);
                last_name  = simple(true);
                break;

            case 16:
            case 17:
            case 18:
            case 19:
                first_name = simple(true) + simple(false);
                last_name  = earned(true) + earned(false);
                break;
            }

            if (!male)
            {
                // Feminise the first name
                char last = first_name[first_name.Length - 1];
                if (!TextHelper.IsVowel(last))
                {
                    first_name += last;
                    first_name += "a";
                }
            }

            string name = first_name;

            if (last_name != "")
            {
                name += " " + last_name;
            }

            return(TextHelper.Capitalise(name, true));
        }
Exemplo n.º 18
0
        public static string Sentence()
        {
            string str = "";
            int    num = Session.Dice(4, 8);

            for (int i = 0; i != num; i++)
            {
                string lower = "";
                int    num1  = 0;
                switch (Session.Random.Next(4))
                {
                case 0:
                {
                    num1 = 1;
                    break;
                }

                case 1:
                case 2:
                {
                    num1 = 2;
                    break;
                }

                case 3:
                {
                    num1 = 3;
                    break;
                }
                }
                for (int j = 0; j != num1; j++)
                {
                    switch (Session.Random.Next(2))
                    {
                    case 0:
                    {
                        lower = string.Concat(lower, DwarfName.prefix());
                        break;
                    }

                    case 1:
                    {
                        lower = string.Concat(lower, DwarfName.suffix_male());
                        break;
                    }
                    }
                    if (j != num1 && Session.Random.Next(10) == 0)
                    {
                        List <string> strs = new List <string>()
                        {
                            "k",
                            "z",
                            "g",
                            "-",
                            "'"
                        };
                        int num2 = Session.Random.Next(strs.Count);
                        lower = string.Concat(lower, strs[num2]);
                    }
                }
                lower = lower.ToLower();
                if (str != "")
                {
                    str = string.Concat(str, " ");
                    if (Session.Random.Next(20) == 0)
                    {
                        lower = TextHelper.Capitalise(lower, false);
                    }
                }
                else
                {
                    lower = TextHelper.Capitalise(lower, false);
                }
                str = string.Concat(str, lower);
            }
            str = string.Concat(str, ".");
            return(str);
        }
Exemplo n.º 19
0
        public static string Sentence()
        {
            string sentence = "";

            int words = Session.Dice(4, 8);

            for (int n = 0; n != words; ++n)
            {
                string word = "";

                int syllables = 0;
                switch (Session.Random.Next(4))
                {
                case 0:
                    syllables = 1;
                    break;

                case 1:
                case 2:
                    syllables = 2;
                    break;

                case 3:
                    syllables = 3;
                    break;
                }

                for (int x = 0; x != syllables; ++x)
                {
                    switch (Session.Random.Next(2))
                    {
                    case 0:
                        word += prefix();
                        break;

                    case 1:
                        word += suffix_male();
                        break;
                    }

                    if ((x != syllables) && (Session.Random.Next(10) == 0))
                    {
                        List <string> extras = new List <string>();
                        extras.Add("k");
                        extras.Add("z");
                        extras.Add("g");
                        extras.Add("-");
                        extras.Add("'");

                        int index = Session.Random.Next(extras.Count);
                        word += extras[index];
                    }
                }

                word = word.ToLower();
                if (sentence == "")
                {
                    word = TextHelper.Capitalise(word, false);
                }
                else
                {
                    sentence += " ";

                    if (Session.Random.Next(20) == 0)
                    {
                        word = TextHelper.Capitalise(word, false);
                    }
                }

                sentence += word;
            }

            sentence += ".";

            return(sentence);
        }