Giter Site home page Giter Site logo

vscode-bg3-modding's Introduction

BG3 Modding support for Visual Studio Code

This VS Code extension contains useful tools, snippets and helpers for creating mods for Baldur's Gate 3.

Table of Contents

⚡ Activation Events

  • workspaceContains:/**/meta.lsx

    The extension activates for a workspace that contains the meta.lsx file.

⭐ Features

📄 Snippets

The extension contributes the following snippets:

Name Activation Description
BG3 UUID uuid Generate a random UUID
BG3 Handle handle Generates a random UUID handle used in localization files
Ext.Utils.Print() print, eup Ext.Utils.Print()
Ext.Osiris.RegisterListener() rl, orl, eorl Ext.Osiris.RegisterListener()
Override Stat Entry new, override Create an override for an existing Stat Entry
Script-Extender Config cfg, Config.json Generates the boilerplate Script-Extender Config.json
meta.lsx meta Generates the boilerplate template for meta.lsx

⌨️ Commands

The extension contributes the following commands:

Generate UUID

Generate a random UUID and insert at the current selection.

b7b98e25-ff34-40dd-b019-ab25521ae5a0

Generate Handle

Generate Handle and insert at the current selection.

hb7b98e25gff34g40ddgb019gab25521ae5a0

Copy Mod UUID

Copies the Mod's UUID to the clipboard.

Convert Version Number

Convert between BG3 version numbers.

1.0.0.0 --> 36028797018963968
36028797018963968 --> 1.0.0.0
Input: Version Number

Takes the version number as input in either the string format (e.g. 1.0.0.0) or bigint format (e.g. 36028797018963968).

Bump Version Number

Bumps the version number in the meta.lsx by the specified type.

1.0.0.0 --- Bump Minor Version --> 1.1.0.0
1.2.0.7 --- Bump Major Version --> 2.0.0.0
Input: Kind
  • Major
  • Minor
  • Revision
  • Build

✅ JSON Validation

The extension contributes JSON validation schemas for:

This will enable intellisense and provide validation for these files.

⚙️ Default Configurations

The extension provides default configuration settings for:

files.associations

"files.associations": {
    "*.lsx": "xml",
    "*.lsj": "json"
},

search.exclude

"search.exclude": {
    "**/*.raw": true,
    "**/Story/*.div": true,
    "**/*.osi": true,
    "**/*.dat": true
}

⚙️ Extension Settings

Include if your extension adds any VS Code settings through the contributes.configuration extension point.

For example:

This extension contributes the following settings:

  • myExtension.enable: Enable/disable this extension.
  • myExtension.thing: Set to blah to do something.

📄 License

This project is licensed under the MIT License.

vscode-bg3-modding's People

Contributors

shresht7 avatar

Watchers

 avatar

vscode-bg3-modding's Issues

Refactor: Consolidate regular expressions

Regular expressions (like UUID and Handle) are peppered throughout the code. Consider just how many times they are used; it might be wise to define them in one place. (and have tests!)

Contribute `configurationDefaults`

Contribute default configuration settings like:

{
    // Create file associations for Larian Studios specific files
    "files.associations": {
        "*.lsx": "xml",
        "*.lsj": "json"
    },
    // Tells the VS Code search to ignore Osiris compiled files
    "search.exclude": {
        "**/*.raw": true,
        "**/Story/*.div": true,
        "**/*.osi": true,
        "**/*.dat": true
    }
}

Add `IDEHelpers`

Add the IDEHelper references.

The infrastructure to provide Lua reference files is set, all I need to do is to put in the actual IDEHelper files.
See #27 for more context.

Create configuration settings to selectively enable/disable features

Allow the user to selectively enable/disable the features provided by the extension.

This can be a simple if block surrounding the initializer for that feature when activating the extension. May have to figure out how to "activate"/"deactivate" a feature if the setting is changed (without having to restart the extension).

Create snippets for Stat Entries

Create snippets to generate stat entries in stats files.

for example, override to generate something like this:

new data "$1"
type "SpellData"
using "$1"
data $0

or new for the entire thing:

new data "$1"
type "SpellData"
data ...
data ...
data ...

Change urls to the `main` branch

"xml.fileAssociations": [
{
"pattern": "**/meta.lsx",
"systemId": "https://raw.githubusercontent.com/Shresht7/vscode-bg3-modding/xsd/Schema/meta.lsx.schema.xsd"
},
{
"pattern": "**/Localization/**/*.xml",
"systemId": "https://raw.githubusercontent.com/Shresht7/vscode-bg3-modding/xsd/Schema/localization.xml.schema.xsd"
},
{
"pattern": "modsettings.lsx",
"systemId": "https://raw.githubusercontent.com/Shresht7/vscode-bg3-modding/xsd/Schema/modsettings.lsx.schema.xsd"
}
],

The xsd branch no longer exists, change the schema urls to point to the main branch instead.

Provide IDEHelpers

Providing IDEHelpers with the extension will eliminate the need to manually download them and set the Lua.workspace.library.

Something like this should work:

const setting = vscode.workspace.getConfiguration().get("Lua.workspace.library") as string[];
setting.push(path.join(context.extensionPath, "References"));
vscode.workspace.getConfiguration().update('Lua.workspace.library', setting, vscode.ConfigurationTarget.Workspace);

where References is a folder containing the IDEHelpers in the extension root path.

Parse `meta.lsx` for Mod metadata

lsx (xml) files are common when working with BG3 mods. Sooner or later we'll need a proper xml parser (instead of the usual regex shenanigans).

Starting with meta.lsx for the mod metadata sounds like a good idea.

Consolidate `meta.lsx` related logic

Because of 9dca9ac, bumpVersionNumber command now fails as it cannot find the lsx version regex. I can point it to the VersionHoverProvider but this will need a proper solution eventually.

Originally posted by @Shresht7 in #35 (comment)

meta.lsx code is all over the place. It should probably be consolidated.

Fix: Broken Links

Links here are broken! (all because of the emojis! 😡)

- [Snippets](#snippets)
- [Commands](#commands)
- [`Generate UUID`](#generate-uuid)
- [`Generate Handle`](#generate-handle)
- [`Convert Version Number`](#convert-version-number)
- [JSON Validation](#json-validation)
- [Default Configurations](#default-configurations)
- [`files.associations`](#filesassociations)
- [`search.exclude`](#searchexclude)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.