Overview
IDataManager provides access to Dalamud-internal features and game data. It allows plugins to access Excel sheets, game files, and check for modified game data.
Namespace
Properties
Language
public ClientLanguage Language { get; }
Gets the current game client language.
The client’s language setting
GameData
public GameData GameData { get; }
Gets a Lumina GameData object which gives access to any excel/game data.
Excel
public ExcelModule Excel { get; }
Gets an ExcelModule object which gives access to any of the game’s sheet data.
Lumina ExcelModule instance
HasModifiedGameDataFiles
public bool HasModifiedGameDataFiles { get; }
Gets a value indicating whether the game data files have been modified by another third-party tool.
True if game files are modified
Methods
GetExcelSheet
public ExcelSheet<T> GetExcelSheet<T>(ClientLanguage? language = null, string? name = null)
where T : struct, IExcelRow<T>;
Gets an ExcelSheet with the given Excel sheet row type.
Language of the sheet to get. Leave null to use the default language
Explicitly provide the name of the sheet to get. Leave null to use T’s sheet name. Explicit names are necessary for quest/dungeon/cutscene sheets
The ExcelSheet, giving access to game rows
GetSubrowExcelSheet
public SubrowExcelSheet<T> GetSubrowExcelSheet<T>(ClientLanguage? language = null, string? name = null)
where T : struct, IExcelSubrow<T>;
Gets a SubrowExcelSheet with the given Excel sheet row type.
Language of the sheet to get. Leave null to use the default language
Explicitly provide the name of the sheet to get. Leave null to use T’s sheet name
The SubrowExcelSheet, giving access to game rows with subrows
GetFile
public FileResource? GetFile(string path);
public T? GetFile<T>(string path) where T : FileResource;
Gets a FileResource with the given path.
The path inside of the game files
The FileResource of the file, or null if not found
GetFileAsync
public Task<T> GetFileAsync<T>(string path, CancellationToken cancellationToken)
where T : FileResource;
Gets a FileResource with the given path, of the given type asynchronously.
The path inside of the game files
cancellationToken
CancellationToken
required
Cancellation token
A Task containing the FileResource of the file on success
FileExists
public bool FileExists(string path);
Checks if the file with the given path exists within the game’s index files.
The path inside of the game files
Example Usage
public class MyPlugin : IDalamudPlugin
{
private readonly IDataManager dataManager;
public MyPlugin(IDataManager dataManager)
{
this.dataManager = dataManager;
// Get item sheet
var itemSheet = this.dataManager.GetExcelSheet<Item>();
if (itemSheet != null)
{
foreach (var item in itemSheet)
{
if (item.RowId > 0 && !string.IsNullOrEmpty(item.Name))
{
Log.Information($"Item {item.RowId}: {item.Name}");
}
}
}
// Get sheet in specific language
var itemSheetJP = this.dataManager.GetExcelSheet<Item>(ClientLanguage.Japanese);
// Check for modified files
if (this.dataManager.HasModifiedGameDataFiles)
{
Log.Warning("Game files have been modified!");
}
// Check if a file exists
if (this.dataManager.FileExists("common/graphics/texture/dummy.tex"))
{
// Load the file
var file = this.dataManager.GetFile<TexFile>("common/graphics/texture/dummy.tex");
}
}
}
Advanced Usage
Working with Subrow Sheets
var questSheet = this.dataManager.GetSubrowExcelSheet<Quest>();
if (questSheet != null)
{
foreach (var quest in questSheet)
{
Log.Information($"Quest {quest.RowId}/{quest.SubRowId}: {quest.Name}");
}
}
Async File Loading
public async Task LoadFileAsync()
{
try
{
var file = await this.dataManager.GetFileAsync<TexFile>(
"common/graphics/texture/dummy.tex",
CancellationToken.None);
// Use file
}
catch (Exception ex)
{
Log.Error(ex, "Failed to load file");
}
}
Accessing Different Languages
// Get the same sheet in all languages
var itemEN = this.dataManager.GetExcelSheet<Item>(ClientLanguage.English);
var itemJP = this.dataManager.GetExcelSheet<Item>(ClientLanguage.Japanese);
var itemDE = this.dataManager.GetExcelSheet<Item>(ClientLanguage.German);
var itemFR = this.dataManager.GetExcelSheet<Item>(ClientLanguage.French);
- Excel sheets are cached internally for performance
- Use the appropriate language parameter when you need localized data
- For sheets with subrows (like Quest), use
GetSubrowExcelSheet<T>()
- The
HasModifiedGameDataFiles property can help detect texture mods or other file modifications
- File paths use forward slashes and are case-sensitive