Esempio n. 1
0
 public static ItemBase GetItemBaseInstanceByKeyword(SearchTerm searchTerm, Assembly ass)
 {
     foreach (var i in ass.GetTypes())
     {
         if (i.IsSubclassOf(typeof(ItemBase)) && i.GetCustomAttribute <SearchTerm>() != null)
         {
             if (searchTerm == i.GetCustomAttribute <SearchTerm>())
             {
                 return((ItemBase)ass.CreateInstance(i.FullName));
             }
         }
     }
     return(null);
 }
Esempio n. 2
0
 public static InventoryBase GetInventoryBySearchTerm(SearchTerm searchTerm, Assembly ass)
 {
     foreach (var i in ass.GetTypes())
     {
         if (i.IsSubclassOf(typeof(InventoryBase)) && i.GetCustomAttribute <SearchTerm>() != null)
         {
             if (i.GetCustomAttribute <SearchTerm>() == searchTerm)
             {
                 return((InventoryBase)ass.CreateInstance(i.FullName));
             }
         }
     }
     return(null);
 }
Esempio n. 3
0
 public static Player GetPlayerInstanceBySearchterm(SearchTerm searchTerm, Assembly ass)
 {
     foreach (var i in ass.GetTypes())
     {
         if (i.GetCustomAttribute <SearchTerm>() != null && i.IsSubclassOf(typeof(Player)))
         {
             if (i.GetCustomAttribute <SearchTerm>() == searchTerm)
             {
                 return((Player)ass.CreateInstance(i.FullName));
             }
         }
     }
     return(null);
 }
Esempio n. 4
0
 public SkillTreeElement GetElementByTargetSkillSearchTerm(SearchTerm searchTerm)
 {
     foreach (var i in skills)
     {
         Type type = i.Target.GetType();
         if (type.GetCustomAttribute <SearchTerm>() != null)
         {
             if (type.GetCustomAttribute <SearchTerm>() == searchTerm)
             {
                 return(i);
             }
         }
     }
     return(null);
 }
Esempio n. 5
0
        public static ClassBase GetClassBaseBySearchTerm(SearchTerm searchTerm)
        {
            Assembly ass = Assembly.GetCallingAssembly();

            foreach (var i in ass.GetTypes())
            {
                if (i.IsSubclassOf(typeof(ClassBase)) && i.GetCustomAttribute <SearchTerm>() != null)
                {
                    if (i.GetCustomAttribute <SearchTerm>() == searchTerm)
                    {
                        return((ClassBase)ass.CreateInstance(i.FullName));
                    }
                }
            }
            return(null);
        }
Esempio n. 6
0
        public static Type GetMaterialBySearchterm(SearchTerm searchTerm)
        {
            Assembly ass = Assembly.GetCallingAssembly();

            foreach (var i in ass.GetTypes())
            {
                if (i.GetCustomAttribute <SearchTerm>() != null && i.IsSubclassOf(typeof(MaterialBase)))
                {
                    if (i.GetCustomAttribute <SearchTerm>() == searchTerm)
                    {
                        return(i);
                    }
                }
            }
            return(null);
        }
Esempio n. 7
0
        public static MonsterInventory GetMonsterInventory(SearchTerm keyword)
        {
            Assembly ass = Assembly.GetCallingAssembly();

            foreach (var i in ass.GetTypes())
            {
                if (i.GetCustomAttribute <SearchTerm>() != null && i.IsSubclassOf(typeof(MonsterInventory)))
                {
                    if (i.GetCustomAttribute <SearchTerm>() == keyword)
                    {
                        return((MonsterInventory)ass.CreateInstance(i.FullName));
                    }
                }
            }
            return(null);
        }
Esempio n. 8
0
        public static Type GetItemTypeByKeyword(SearchTerm searchTerm)
        {
            Assembly ass = Assembly.GetCallingAssembly();

            foreach (var i in ass.GetTypes())
            {
                if (i.IsSubclassOf(typeof(ItemBase)) && i.GetCustomAttribute <SearchTerm>() != null)
                {
                    if (searchTerm == i.GetCustomAttribute <SearchTerm>())
                    {
                        return(i);
                    }
                }
            }
            return(null);
        }
Esempio n. 9
0
        public ClassBase GetClassBySearchTerm(SearchTerm st)
        {
            Assembly ass = Assembly.GetCallingAssembly();

            foreach (var i in Classes)
            {
                if (i.GetType().GetCustomAttribute <SearchTerm>() != null)
                {
                    if (i.GetType().GetCustomAttribute <SearchTerm>() == st)
                    {
                        return(i);
                    }
                }
            }
            return(null);
        }
Esempio n. 10
0
        public static Type GetEffectByName(SearchTerm searchTerm)
        {
            Assembly ass = Assembly.GetCallingAssembly();

            foreach (var i in ass.GetTypes())
            {
                if (i.IsSubclassOf(typeof(EffectBase)) && i.GetCustomAttribute <SearchTerm>() != null)
                {
                    if (i.GetCustomAttribute <SearchTerm>() == searchTerm)
                    {
                        return(i);
                    }
                }
            }
            return(null);
        }
Esempio n. 11
0
        public static LimitBase GetLimitInstanceByName(SearchTerm searchTerm)
        {
            Assembly ass = Assembly.GetCallingAssembly();

            foreach (var i in ass.GetTypes())
            {
                if (i.IsSubclassOf(typeof(LimitBase)) && i.GetCustomAttribute <SearchTerm>() != null)
                {
                    if (i.GetCustomAttribute <SearchTerm>() == searchTerm)
                    {
                        LimitBase buffer = (LimitBase)ass.CreateInstance(i.FullName);
                        return(buffer);
                    }
                }
            }
            return(null);
        }
Esempio n. 12
0
        public static Monster GetMonsterInstanceBySearchterm(SearchTerm searchTerm)
        {
            Assembly ass = Assembly.GetCallingAssembly();

            foreach (var i in ass.GetTypes())
            {
                if (i.GetCustomAttribute <SearchTerm>() != null && i.IsSubclassOf(typeof(Monster)))
                {
                    if (i.GetCustomAttribute <SearchTerm>() == searchTerm)
                    {
                        return((Monster)ass.CreateInstance(i.FullName, false, BindingFlags.Public | BindingFlags.Instance, null, new object[] {
                            GetMonsterInventory(i)
                        }, null, null));
                    }
                }
            }
            return(null);
        }
Esempio n. 13
0
        public static Type[] GetAllItems()
        {
            Assembly    ass    = Assembly.GetCallingAssembly();
            List <Type> result = new List <Type>();

            foreach (var i in ass.GetTypes())
            {
                if (i.IsSubclassOf(typeof(ItemBase)))
                {
                    SearchTerm sk = i.GetCustomAttribute <SearchTerm>();
                    if (sk != null)
                    {
                        result.Add(i);
                    }
                }
            }
            return(result.ToArray());
        }