File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
NWN.Anvil/src/main/API/Ruleset Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 11using System ;
22using System . Collections . Generic ;
33using System . Linq ;
4+ using NWN . Core ;
45using NWN . Native . API ;
56
67namespace Anvil . API
@@ -333,9 +334,30 @@ public SpellComponents SpellComponents
333334 /// </summary>
334335 /// <param name="nwClass">The class to query.</param>
335336 /// <returns>The spell level for the specified class.</returns>
337+ [ Obsolete ( "Use GetSpellLevelByClass instead." ) ]
336338 public byte GetSpellLevelForClass ( NwClass nwClass )
337339 {
338340 return spellInfo . GetSpellLevel ( nwClass . Id ) ;
339341 }
342+
343+ /// <summary>
344+ /// Gets the spell class level for the specified class.
345+ /// </summary>
346+ /// <param name="classType">The class to query.</param>
347+ /// <param name="includeMasterSpell">If true, will use the <see cref="MasterSpell"/> class level if this spell has no class level configured.</param>
348+ /// <returns>The spell level for the specified class. Returns null if no spell level is defined for the specified class.</returns>
349+ public int ? GetSpellLevelByClass ( NwClass classType , bool includeMasterSpell = true )
350+ {
351+ if ( includeMasterSpell )
352+ {
353+ int retVal = NWScript . GetSpellLevelByClass ( classType . Id , Id ) ;
354+ return retVal == - 1 ? null : retVal ;
355+ }
356+ else
357+ {
358+ byte retVal = spellInfo . GetSpellLevel ( classType . Id ) ;
359+ return retVal == byte . MaxValue ? null : retVal ;
360+ }
361+ }
340362 }
341363}
You can’t perform that action at this time.
0 commit comments