Exemple #1
0
        private static void GenerateDevices(string directory)
        {
            var cyphersFileName = Path.Combine(directory, "Cyphers_AllSources.xml");
            var cyphersList     = NumeneraXML.DeserializeCyphersListFromXML(cyphersFileName);

            Console.WriteLine("Cyphers loaded: " + cyphersList.Count);

            var artefactsFileName = Path.Combine(directory, "Artefacts_AllSources.xml");
            var artefactsList     = NumeneraXML.DeserializeArtefactsListFromXML(artefactsFileName);

            Console.WriteLine("Artefacts loaded: " + artefactsList.Count);

            var odditiesFilename = Path.Combine(directory, "Oddities_AllSources.xml");
            var odditiesList     = NumeneraXML.DeserializeOdditiesListFromXML(odditiesFilename);

            Console.WriteLine("Oddities loaded: " + odditiesList.Count);

            var rand = new Random(Guid.NewGuid().GetHashCode());
            int randomIndex = 0, diceRandom = 1;

            ConsoleKeyInfo c = new ConsoleKeyInfo();

            // TODO: D6/D10 random
            // TODO: Calculate final level automatically
            // TODO: RollTable Random (find maximum number in the last element)
            // TODO: Owerwrite ToString() specific to device? Or create custom output for each device?
            while (c.Key != ConsoleKey.Escape)
            {
                Console.WriteLine("******** Choose device to generate: 1 - Cypher; 2 - Artefact; 3 - Oddity;");
                c = Console.ReadKey(true);
                switch (c.KeyChar)
                {
                case '1':
                    Console.WriteLine($"Generating from {cyphersList.Count} cyphers\n");
                    randomIndex = rand.Next(cyphersList.Count);
                    diceRandom  = rand.Next(1, 6);
                    var device = cyphersList[randomIndex];
                    //device.Level += $" [D6 = {diceRandom}]";
                    Console.WriteLine(device.ToString());
                    break;

                case '2':
                    Console.WriteLine($"Generatring from {artefactsList.Count} artefacts\n");
                    randomIndex = rand.Next(artefactsList.Count);
                    diceRandom  = rand.Next(1, 6);
                    artefactsList[randomIndex].Level += $" [D6 = {diceRandom}]";
                    Console.WriteLine(artefactsList[randomIndex].ToString());
                    break;

                case '3':
                    Console.WriteLine($"Generating from {odditiesList.Count} oddities\n");
                    randomIndex = rand.Next(odditiesList.Count);
                    Console.WriteLine(odditiesList[randomIndex].ToString());
                    break;
                }
            }
        }
Exemple #2
0
        public static void ParseCyphersToXML()
        {
            var directory    = @"E:\Documents\Tabletop RPGs\Numenera\APPs\Cyphers\";
            var name         = "RAW_Cyphers_Discovery.txt";
            var fileName     = Path.Combine(directory, name);
            var fileNameXml  = fileName + "_xml.xml";
            var deviceParser = new DevicesParser("Discovery", DeviceType.Cypher);

            deviceParser.CreateXMLFromRawCyphersText(fileName, fileNameXml);
            var cyphers = NumeneraXML.DeserializeCyphersListFromXML(fileNameXml);

            cyphers.ForEach(x => Console.WriteLine(x));
        }
Exemple #3
0
        public void TestPDFParsing_Cyphers()
        {
            var directory    = @"..\..\..\ExampleFiles";
            var name         = "Test_Cyphers.txt";
            var fileName     = Path.Combine(directory, name);
            var fileNameXml  = Path.Combine(directory, Path.GetFileNameWithoutExtension(fileName) + ".xml");
            var deviceParser = new DevicesParser("Discovery", DeviceType.Cypher);

            deviceParser.CreateXMLFromRawCyphersText(fileName, fileNameXml);
            var cyphers = NumeneraXML.DeserializeCyphersListFromXML(fileNameXml);

            cyphers.Should().BeEquivalentTo(CyphersExample.List);
        }
Exemple #4
0
        public static void CombineAllCyphers()
        {
            // combine them all
            var directory = @"E:\Documents\Tabletop RPGs\Numenera\NumeneraAppFiles\Devices\Cyphers_";
            var files     = new List <string>()
            {
                "Discovery.xml", "Destiny.xml", "Compendium.xml"
            };

            var allCyphers = new List <Cypher>();

            foreach (var file in files)
            {
                var filename = directory + file;
                var cyphers  = NumeneraXML.DeserializeCyphersListFromXML(filename);
                NumeneraXML.SerializeToXml(cyphers, directory + $"{cyphers[0].Source}.xml");
                allCyphers.AddRange(cyphers);
            }

            var cyphersToSerialize = new NumeneraDevices(allCyphers);

            NumeneraXML.SerializeToXml(cyphersToSerialize.Cyphers, directory + $"AllSources_{cyphersToSerialize.Cyphers.Count}.xml");
        }