Пример #1
0
        public static void CreateCreaturesXML(string directory, string xlsxName)
        {
            var creatures = CreaturesParser.GetCreaturesListFromExcel(@"C:\Users\ZiCold\OneDrive\TRPGs - Numenera\HexCampaign\", @"Creatures and Events Table.xlsx");
            var xdoc      = new XDocument();
            var elements  = new XElement("Creatures");

            foreach (var creature in creatures)
            {
                var curElem = new XElement("Creature");
                curElem.Add(new XElement(nameof(creature.Name), creature.Name));
                curElem.Add(new XElement(nameof(creature.Source), creature.Source));
                curElem.Add(new XElement(nameof(creature.UsedInEndlessLegendCampaign), creature.UsedInEndlessLegendCampaign));
                curElem.Add(new XElement(nameof(creature.RuinsUnderground), creature.RuinsUnderground));
                curElem.Add(new XElement(nameof(creature.PlainsHills), creature.PlainsHills));
                curElem.Add(new XElement(nameof(creature.Desert), creature.Desert));
                curElem.Add(new XElement(nameof(creature.Woods), creature.Woods));
                curElem.Add(new XElement(nameof(creature.Mountains), creature.Mountains));
                curElem.Add(new XElement(nameof(creature.Swamp), creature.Swamp));
                curElem.Add(new XElement(nameof(creature.Dimensions), creature.Dimensions));
                curElem.Add(new XElement(nameof(creature.Water), creature.Water));
                elements.Add(curElem);
            }
            xdoc.Add(elements);
            xdoc.Save(@"C:\Users\ZiCold\OneDrive\TRPGs - Numenera\zicold.github.io\events_system\creatures.xml");
            return;
        }
Пример #2
0
        public static CreaturesGenerator GetDefaultGenerator()
        {
            var gen = new CreaturesGenerator();

            gen.Rand = new Random(Guid.NewGuid().GetHashCode());
            gen.CreaturesFullList = CreaturesParser.GetCreaturesListFromExcel(@"C:\Users\ZiCold\OneDrive\TRPGs - Numenera\NumeneraAppFiles\", @"Creatures and Events Table.xlsx");
            gen.Creatures         = gen.CreaturesFullList.Where(x => x.UsedInEndlessLegendCampaign).ToList();
            gen.TerrainList       = new List <string>()
            {
                "Ruins/Underground",
                "Plains/Hills",
                "Desert",
                "Woods",
                "Mountains",
                "Swamp",
                "Dimensions",
                "Water"
            };
            return(gen);
        }
Пример #3
0
        public static void GenerateCreatures(string directory, string filename)
        {
            var creatures        = CreaturesParser.GetCreaturesListFromExcel(directory, filename);
            var endlessCreatures = creatures.Where(x => x.UsedInEndlessLegendCampaign).ToList();

            Console.WriteLine($"Creatures loaded: {creatures.Count}");
            Console.WriteLine($"Of which EndlessLegends creatures: {endlessCreatures.Count}");

            var rand             = new Random(Guid.NewGuid().GetHashCode());
            var currentCreatures = new List <Creature>();

            var c = new ConsoleKeyInfo();

            while (c.Key != ConsoleKey.Escape)
            {
                var terrainList = new List <string>()
                {
                    "Ruins/Underground",
                    "Plains/Hills",
                    "Desert",
                    "Woods",
                    "Mountains",
                    "Swamp",
                    "Dimensions",
                    "Water"
                };
                Console.WriteLine("Choose terrain type: ");
                for (int i = 0; i < terrainList.Count; i++)
                {
                    Console.Write($"{i + 1} - {terrainList[i]}");
                    if (i != terrainList.Count - 1)
                    {
                        Console.Write(", ");
                    }
                    else
                    {
                        Console.WriteLine();
                    }
                }
                Console.WriteLine();

                c = Console.ReadKey(true);
                switch (c.KeyChar)
                {
                case '1':
                    currentCreatures = endlessCreatures.Where(x => x.RuinsUnderground).ToList();
                    break;

                case '2':
                    currentCreatures = endlessCreatures.Where(x => x.PlainsHills).ToList();
                    break;

                case '3':
                    currentCreatures = endlessCreatures.Where(x => x.Desert).ToList();
                    break;

                case '4':
                    currentCreatures = endlessCreatures.Where(x => x.Woods).ToList();
                    break;

                case '5':
                    currentCreatures = endlessCreatures.Where(x => x.Mountains).ToList();
                    break;

                case '6':
                    currentCreatures = endlessCreatures.Where(x => x.Swamp).ToList();
                    break;

                case '7':
                    currentCreatures = endlessCreatures.Where(x => x.Dimensions).ToList();
                    break;

                case '8':
                    currentCreatures = endlessCreatures.Where(x => x.Water).ToList();
                    break;
                }

                if (currentCreatures.Count != 0)
                {
                    ShowCurrentRandomCreature(currentCreatures, terrainList[int.Parse(c.KeyChar.ToString()) - 1]);
                }
                currentCreatures.Clear();
            }
        }