public string GetSpellBonusAbility(string ClassName) { if (!Classes.Any()) { Type ClassInst = Assemb.GetType("ClassDetails." + ClassName); if (ClassInst != null) { object obj = Activator.CreateInstance(ClassInst); CW = new ClassWrapper(); ClassFoundation Class = (ClassFoundation)obj; return(Class.GetSpellBonusAbility()); } } else { ClassWrapper one_class = FindClassWrapper(ClassName); if (one_class != null) { return(one_class.ClassInstance.GetSpellBonusAbility()); } } return(string.Empty); }
private void ParseClassList(ClassMasterInput classMasterInput) { List <string> tempClasses = classMasterInput.ClassList.Split('/').ToList(); tempClasses.RemoveAll(x => x == string.Empty); string className, classLevel, archetype; string diety = string.Empty; int Pos, Pos2; foreach (string tempclass in tempClasses) { archetype = string.Empty; string holdClass = tempclass.ToLower(); Pos = tempclass.IndexOf(" ("); if (Pos == -1) { Pos = tempclass.Length; } else { archetype = tempclass.Substring(Pos); archetype = Utility.RemoveSuperScripts(archetype); Pos2 = archetype.IndexOf(PathfinderConstants.PAREN_RIGHT); archetype = archetype.Substring(0, Pos2 + 1); holdClass = holdClass.Replace(archetype, string.Empty).Trim(); archetype = archetype.Replace("*", string.Empty); archetype = Utility.RemoveParentheses(archetype); archetype = Utility.RemoveSuperScripts(archetype); archetype = archetype.ProperCase().Trim(); Pos = holdClass.IndexOf(" ("); if (Pos == -1) { Pos = holdClass.Length; } } Pos = holdClass.LastIndexOf(PathfinderConstants.SPACE, Pos); className = holdClass.Substring(0, Pos).Trim().ToLower(); classLevel = holdClass.Replace(className, string.Empty).Trim(); Pos = className.IndexOf(" of "); if (Pos >= 0) { var IgnoreOfs = new List <string> { "arclord of", "knight of", "prophet of", "brother of", "zealot of", "disciple of" }; bool foundIgnoreOf = false; foreach (var oneIgnore in IgnoreOfs) { if (className.Contains(oneIgnore)) { foundIgnoreOf = true; break; } } if (!foundIgnoreOf) { diety = className.Substring(Pos); diety = diety.Replace("of ", string.Empty).Trim(); className = className.Substring(0, Pos); } } if (className.IndexOf("Ex-") >= 0 || className.IndexOf("ex-") >= 0) { className = className.Replace("Ex-", string.Empty); className = className.Replace("ex-", string.Empty); className = className.ProperCase(); className = "Ex" + className; } else { className = className.ProperCase(); } className = className.Replace(PathfinderConstants.SPACE, string.Empty); Type ClassInst = Assemb.GetType("ClassDetails." + className); if (ClassInst == null) { throw new Exception("Class " + className + " not defined"); } try { object obj = Activator.CreateInstance(ClassInst); CW = new ClassWrapper(); ClassFoundation Class = (ClassFoundation)obj; CW.ClassInstance = Class; CW.ClassInstance.ClassDiety = diety; int classlevel; if (!int.TryParse(classLevel, out classlevel)) { throw new Exception("classLevel not int -" + classLevel + " for class " + Class); } CW.Level = classlevel; Class.ProcessPowers(CW.Level); CW.Archetype = archetype; List <string> archetypes = archetype.Split(',').ToList(); archetypes.RemoveAll(x => x == string.Empty);; foreach (string oneArchetype in archetypes) { if (oneArchetype.Length > 0 && !CW.ClassInstance.ClassArchetypes.Contains(oneArchetype.Trim())) { throw new Exception(className + " does not have archetype " + oneArchetype + " defined."); } } if (Class.DomainSpellUse) { if (classMasterInput.Domians.Contains("subdomain") || classMasterInput.Domians.Contains(PathfinderConstants.PAREN_LEFT) || classMasterInput.Domians.Contains(",")) { List <string> tempDomains = classMasterInput.Domians.Split(',').ToList(); for (int a = 0; a < tempDomains.Count; a++) { Pos = tempDomains[a].IndexOf(PathfinderConstants.PAREN_LEFT); if (Pos >= 0) { tempDomains[a] = tempDomains[a].Substring(Pos); tempDomains[a] = tempDomains[a].Replace("subdomain", string.Empty); } tempDomains[a] = Utility.RemoveParentheses(tempDomains[a]); tempDomains[a] = Utility.RemoveSuperScripts(tempDomains[a]); } classMasterInput.Domians = string.Join(",", tempDomains.ToArray()); } classMasterInput.Domians = Utility.RemoveSuperScripts(classMasterInput.Domians); classMasterInput.Domians = Utility.RemoveParentheses(classMasterInput.Domians); Class.ProcessDomains(classMasterInput.Domians); } if (Class.MysteryUse) { Class.ProcessMysteries(classMasterInput.Mysteries); } if (Class.BloodlineUse) { Class.ProcessBloodline(classMasterInput.Bloodline); } if (Class.PatronUse) { Class.ProcessPatron(classMasterInput.Patron.ProperCase()); } } catch (Exception ex) { throw new Exception("Initalize Class Issue with " + className + PathfinderConstants.SPACE + ex.Message, ex); } Classes.Add(CW); } }