/// <summary>
 /// Determines which tables should be visible based on the input substring
 /// </summary>
 /// <param name="filter">substring to check table names against</param>
 public void TrimTablesTree(string filter)
 {
     if (filter == string.Empty)
     {
         trimmedListOfTables = listOfTables;
     }
     else
     {
         trimmedListOfTables.SubCategories.Clear();
         foreach (RandomTableCategory category in listOfTables.SubCategories)
         {
             if (category.SubCategories.Count == 0)
             {
                 if (category.Name.ToLower().Contains(filter.ToLower()))
                 {
                     trimmedListOfTables.SubCategories.Add(category);
                 }
             }
             else
             {
                 trimmedListOfTables.SubCategories.Add(TrimTablesTreeHelper(category, filter));
             }
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// Creates the Magic Effects submenu
        /// </summary>
        /// <returns>Magic Effects category with all subcategories</returns>
        private RandomTableCategory InitializeMagicEffectsList()
        {
            RandomTableCategory magicEffects = new RandomTableCategory("Magic Effects");

            magicEffects.SubCategories.Add(new RandomTableCategory("Potions"));
            magicEffects.SubCategories.Add(new RandomTableCategory("Necromancy"));
            magicEffects.SubCategories.Add(new RandomTableCategory("Wild Magic Surge"));

            return(magicEffects);
        }
Beispiel #3
0
        /// <summary>
        /// Creates the Artobjects submenu
        /// </summary>
        /// <returns>Art Objects category with all subcategories</returns>
        private RandomTableCategory InitializeArtObjectsList()
        {
            RandomTableCategory artObjects = new RandomTableCategory("Art Objects");

            artObjects.SubCategories.Add(new RandomTableCategory("25 GP Art Objects"));
            artObjects.SubCategories.Add(new RandomTableCategory("250 GP Art Objects"));
            artObjects.SubCategories.Add(new RandomTableCategory("750 GP Art Objects"));
            artObjects.SubCategories.Add(new RandomTableCategory("2,500 GP Art Objects"));
            artObjects.SubCategories.Add(new RandomTableCategory("7,500 GP Art Objects"));

            return(artObjects);
        }
Beispiel #4
0
        /// <summary>
        /// Establishes the menu structure for the user interface
        /// </summary>
        /// <returns>List of lists of tables to be displayed to the user in
        /// menu/submenu structure</returns>
        public RandomTableCategory InitializeRandomTableList()
        {
            RandomTableCategory listOfTables = new RandomTableCategory("Random Tables");

            listOfTables.SubCategories.Add(InitializeArtObjectsList());
            listOfTables.SubCategories.Add(InitializeGemstonesList());
            listOfTables.SubCategories.Add(InitializeMagicEffectsList());
            listOfTables.SubCategories.Add(InitializeMagicItemsList());
            listOfTables.SubCategories.Add(new RandomTableCategory("Trinkets"));

            return(listOfTables);
        }
Beispiel #5
0
        /// <summary>
        /// Creates the Gemstones submenu
        /// </summary>
        /// <returns>Gemstones category with all subcategories</returns>
        private RandomTableCategory InitializeGemstonesList()
        {
            RandomTableCategory gemstones = new RandomTableCategory("Gemstones");

            gemstones.SubCategories.Add(new RandomTableCategory("10 GP Gemstones"));
            gemstones.SubCategories.Add(new RandomTableCategory("50 GP Gemstones"));
            gemstones.SubCategories.Add(new RandomTableCategory("100 GP Gemstones"));
            gemstones.SubCategories.Add(new RandomTableCategory("500 GP Gemstones"));
            gemstones.SubCategories.Add(new RandomTableCategory("1,000 GP Gemstones"));
            gemstones.SubCategories.Add(new RandomTableCategory("5,000 GP Gemstones"));

            return(gemstones);
        }
Beispiel #6
0
        /// <summary>
        /// Creates the Magic Items submenu
        /// </summary>
        /// <returns>Magic Items category with all subcategories</returns>
        private RandomTableCategory InitializeMagicItemsList()
        {
            RandomTableCategory magicItems = new RandomTableCategory("Magic Items");

            magicItems.SubCategories.Add(new RandomTableCategory("Magic Items Table A"));
            magicItems.SubCategories.Add(new RandomTableCategory("Magic Items Table B"));
            magicItems.SubCategories.Add(new RandomTableCategory("Magic Items Table C"));
            magicItems.SubCategories.Add(new RandomTableCategory("Magic Items Table D"));
            magicItems.SubCategories.Add(new RandomTableCategory("Magic Items Table E"));
            magicItems.SubCategories.Add(new RandomTableCategory("Magic Items Table F"));
            magicItems.SubCategories.Add(new RandomTableCategory("Magic Items Table G"));
            magicItems.SubCategories.Add(new RandomTableCategory("Magic Items Table H"));
            magicItems.SubCategories.Add(new RandomTableCategory("Magic Items Table I"));

            return(magicItems);
        }
        /// <summary>
        /// Helper to determine if tables should be visible based on input substring
        /// </summary>
        /// <param name="currentNode">parent node of tables to be checked</param>
        /// <param name="filter">substring to check table names against</param>
        /// <returns>the subtree with tables applicable to the substring</returns>
        public RandomTableCategory TrimTablesTreeHelper(RandomTableCategory currentNode, string filter)
        {
            RandomTableCategory newCategory = new RandomTableCategory(currentNode.Name);

            foreach (RandomTableCategory node in currentNode.SubCategories)
            {
                if (node.SubCategories.Count == 0)
                {
                    if (node.Name.ToLower().Contains(filter.ToLower()))
                    {
                        newCategory.SubCategories.Add(node);
                    }
                }
                else
                {
                    newCategory.SubCategories.Add(TrimTablesTreeHelper(node, filter));
                }
            }

            return(newCategory);
        }
 public RandomGeneratorModel()
 {
     listOfTables = randomTables_Gen.InitializeRandomTableList();
 }