public static int DivineSpellLevelCanCast(this GameObject obj) { var spellLvlMax = 0; foreach (var classEnum in D20ClassSystem.Classes.Keys) { if (D20ClassSystem.IsDivineCastingClass(classEnum)) { spellLvlMax = Math.Max(spellLvlMax, GameSystems.Spell.GetMaxSpellLevel(obj, classEnum, 0)); } } return(spellLvlMax); }