diff --git a/src/Lumina/Excel/BaseExcelSheet.cs b/src/Lumina/Excel/BaseExcelSheet.cs index de57fbc1..68f1cba9 100644 --- a/src/Lumina/Excel/BaseExcelSheet.cs +++ b/src/Lumina/Excel/BaseExcelSheet.cs @@ -208,7 +208,7 @@ public static BaseExcelSheet From< T >( ExcelModule module, Language language ) /// public static BaseSubrowExcelSheet FromSubrow< T >( ExcelModule module, Language language ) where T : struct, IExcelSubrow< T > { - var attribute = typeof( T ).GetCustomAttribute() ?? + var attribute = typeof( T ).GetCustomAttribute< SheetAttribute >() ?? throw new InvalidOperationException( $"{nameof( T )} has no {nameof( SheetAttribute )}. Use the overload of {nameof( From )} with 4 parameters." ); return FromSubrow< T >( module, language, attribute.Name, attribute.ColumnHash ); @@ -254,7 +254,7 @@ public static BaseSubrowExcelSheet FromSubrow< T >( ExcelModule module, Language private static ExcelHeaderFile VerifySheet( ExcelModule module, Language language, string sheetName, uint? columnHash = null ) { - var headerFile = module.GameData.GetFile( $"exd/{sheetName}.exh" ) ?? + var headerFile = module.GameData.GetFile< ExcelHeaderFile >( $"exd/{sheetName}.exh" ) ?? throw new ArgumentException( "Invalid sheet name", nameof( sheetName ) ); if( module.VerifySheetChecksums && columnHash is { } hash && headerFile.GetColumnsHash() != hash ) diff --git a/src/Lumina/Excel/ExcelModule.cs b/src/Lumina/Excel/ExcelModule.cs index f5cf4b07..8bb489a3 100644 --- a/src/Lumina/Excel/ExcelModule.cs +++ b/src/Lumina/Excel/ExcelModule.cs @@ -91,7 +91,7 @@ public BaseExcelSheet GetBaseSheet< T >( Language? language = null ) where T : s /// [EditorBrowsable( EditorBrowsableState.Advanced )] public BaseSubrowExcelSheet GetBaseSubrowSheet< T >( Language? language = null ) where T : struct, IExcelSubrow< T > => - (BaseSubrowExcelSheet)GetBaseSheet( typeof( T ), language ); + (BaseSubrowExcelSheet) GetBaseSheet( typeof( T ), language ); /// Loads an . /// Type of the rows in the sheet. @@ -145,7 +145,7 @@ public BaseExcelSheet GetBaseSheet( Type rowType, Language? language = null ) { // Exception thrown here will propagate outside ConcurrentDictionary<>.GetOrAdd without touching the data stored inside dictionary. throw new ArgumentException( - $"{key.Type.Name} must implement either {typeof( IExcelRow<> ).Name.Split( '`', 2 )[ 0 ]}<{key.Type.Name}> or {typeof( IExcelSubrow<> ).Name.Split( '`', 2 )[0]}<{key.Type.Name}>.", + $"{key.Type.Name} must implement either {typeof( IExcelRow<> ).Name.Split( '`', 2 )[ 0 ]}<{key.Type.Name}> or {typeof( IExcelSubrow<> ).Name.Split( '`', 2 )[ 0 ]}<{key.Type.Name}>.", nameof( rowType ), e ); } diff --git a/src/Lumina/Excel/IExcelRow.cs b/src/Lumina/Excel/IExcelRow.cs index 274e2571..6d6735d2 100644 --- a/src/Lumina/Excel/IExcelRow.cs +++ b/src/Lumina/Excel/IExcelRow.cs @@ -17,4 +17,4 @@ public interface IExcelRow< out T > where T : struct /// /// A newly created row object. abstract static T Create( ExcelPage page, uint offset, uint row ); -} +} \ No newline at end of file diff --git a/src/Lumina/Excel/RowRef.cs b/src/Lumina/Excel/RowRef.cs index d0042625..6271f1a1 100644 --- a/src/Lumina/Excel/RowRef.cs +++ b/src/Lumina/Excel/RowRef.cs @@ -40,4 +40,4 @@ public readonly struct RowRef< T >( ExcelModule? module, uint rowId ) where T : /// /// The to convert. public static explicit operator RowRef( RowRef< T > row ) => row.ToGeneric(); -} +} \ No newline at end of file diff --git a/src/Lumina/Excel/SubrowRef.cs b/src/Lumina/Excel/SubrowRef.cs index 5120322b..a3566b65 100644 --- a/src/Lumina/Excel/SubrowRef.cs +++ b/src/Lumina/Excel/SubrowRef.cs @@ -10,7 +10,7 @@ namespace Lumina.Excel; /// The referenced row id. public readonly struct SubrowRef< T >( ExcelModule? module, uint rowId ) where T : struct, IExcelSubrow< T > { - private readonly SubrowExcelSheet< T >? _sheet = module?.GetSubrowSheet(); + private readonly SubrowExcelSheet< T >? _sheet = module?.GetSubrowSheet< T >(); /// /// The row id of the referenced row. diff --git a/src/Lumina/Excel/UntypedRowRef.cs b/src/Lumina/Excel/UntypedRowRef.cs index f37f927e..4a103bb8 100644 --- a/src/Lumina/Excel/UntypedRowRef.cs +++ b/src/Lumina/Excel/UntypedRowRef.cs @@ -76,7 +76,7 @@ public bool TryGetValue< T >( out T row ) where T : struct, IExcelRow< T > } /// - public bool TryGetValueSubrow< T >( out SubrowCollection< T > row ) where T : struct, IExcelSubrow + public bool TryGetValueSubrow< T >( out SubrowCollection< T > row ) where T : struct, IExcelSubrow< T > { if( new SubrowRef< T >( module, rowId ).ValueNullable is { } v ) { @@ -127,4 +127,4 @@ public static RowRef GetFirstValidRowOrUntyped( ExcelModule module, uint rowId, /// The referenced row id. /// An untyped . public static RowRef CreateUntyped( uint rowId ) => new( null, rowId, null ); -} +} \ No newline at end of file