An open API service indexing awesome lists of open source software.

https://github.com/divadretlaw/lskit

Tools for manipulating Baldur's Gate 3 files
https://github.com/divadretlaw/lskit

baldurs-gate baldurs-gate-3 larian lsx modding modding-tools pak swift-package-manager

Last synced: 10 months ago
JSON representation

Tools for manipulating Baldur's Gate 3 files

Awesome Lists containing this project

README

          

# LSKit

[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdivadretlaw%2FLSKit%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/divadretlaw/LSKit) [![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdivadretlaw%2FLSKit%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/divadretlaw/LSKit)

Tools for manipulating Baldur's Gate 3 files

## Examples

### Load information from a mod

```swift
let bg3 = URL.homeDirectory.appending(path: "Library/Application Support/Baldur's Gate 3/")
let url = bg3.appending(path: "Mods/.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

```swift
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](https://github.com/Norbyte)'s [LSLib](https://github.com/Norbyte/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](LICENSE)