Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 1.84 KB

README.md

File metadata and controls

55 lines (39 loc) · 1.84 KB

LSKit

Tools for manipulating Baldur's Gate 3 files

Examples

Load information from a mod

let bg3 = URL.homeDirectory.appending(path: "Library/Application Support/Baldur's Gate 3/")
let url = bg3.appending(path: "Mods/<mod>.pak")
let pak = try ModLSPK(url: url)

guard let moduleInfo = pak.meta.moduleInfo else {
    return // File does not contain a meta.lsx with ModuleInfo
}
guard let moduleInfo = moduleInfo.publishVersion else {
    return // ModuleInfo does not contain publish version info
}

// Access desired information e.g.
print(moduleInfo.uuid) // UUID
print(moduleInfo.name) // Name
print(moduleInfo.folder) // Folder

Load mod settings

let bg3 = URL.homeDirectory.appending(path: "Library/Application Support/Baldur's Gate 3/")
let url = bg3.appending(path: "PlayerProfiles/Public/modsettings.lsx")

guard let lsx = LSX(url: url) else {
    return // Unable to read or parse given LSX file
}
guard let moduleSettings = LSX.ModuleSettings(lsx: lsx) else {
    return // LSX is not in the correct format
}

// Access desired information e.g.
print(moduleSettings.modOrder) // Mod Order
print(moduleSettings.mods) // Mods

Acknowledgment

This is package couldn't exist without Norbyte's LSLib.

This package aims to provide a small subset of LSLib's features, re-implemented in Swift to make them available on Apple platforms.

License

See LICENSE