Skip to main content

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

Dalamud.Plugin.Services

Properties

Language

public ClientLanguage Language { get; }
Gets the current game client language.
Language
ClientLanguage
The client’s language setting

GameData

public GameData GameData { get; }
Gets a Lumina GameData object which gives access to any excel/game data.
GameData
GameData
Lumina GameData instance

Excel

public ExcelModule Excel { get; }
Gets an ExcelModule object which gives access to any of the game’s sheet data.
Excel
ExcelModule
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.
HasModifiedGameDataFiles
bool
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
ClientLanguage?
Language of the sheet to get. Leave null to use the default language
name
string?
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
return
ExcelSheet<T>
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
ClientLanguage?
Language of the sheet to get. Leave null to use the default language
name
string?
Explicitly provide the name of the sheet to get. Leave null to use T’s sheet name
return
SubrowExcelSheet<T>
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.
path
string
required
The path inside of the game files
return
FileResource | T
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.
path
string
required
The path inside of the game files
cancellationToken
CancellationToken
required
Cancellation token
return
Task<T>
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.
path
string
required
The path inside of the game files
return
bool
True if the file exists

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);

Remarks

  • 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

Build docs developers (and LLMs) love