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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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()); }