BG3-Community-Library-Team / BG3-Compatibility-Framework

An API-based Driven Compatibility Framework for Baldur's Gate 3 Mods
MIT License
38 stars 13 forks source link

Dictionary Support with JSON #79

Open RandoRuda opened 8 months ago

RandoRuda commented 8 months ago

One of the compatibility issues that comes along with various mods is that they still need to be aware of each other for different aspects. This is very much highlighted with Warlock Subclasses each having their own spell lists, so a mod that might add a new 'base' spell needs to consider all the other mods out there. This made me wonder if we could potentially use introduce something like this mock up.

(Excuse the rough mock up, but an idea came to me so I thought I'd quickly mock it out before I lost it.)

{
    "FileVersion": 1,
    "Subclass": 
    [
        {
            "SubclassHandle": "Sample",
            "BaseClass": "Warlock",
            "ClassDescription": "32883748-7bd8-4675-8d14-1c3a5f67da10",
            "SpellsList":
            {
                "Scrolls": "b747b321-89c0-45c6-a6d6-4846d98848b7",
                "One":     "040537bf-5d9f-48da-a8bd-a596d72e099a",
                "Two":     "9394fb7b-9a79-449f-b30a-7f98cb3cb531",
                "Three":   "98101bf9-9a5d-4480-aaae-8735484005f1",
                "Four":    "9ff2e3d1-ebfd-4f94-bf7c-9477b9511e00",
                "Five":    "0bd7337c-7ae2-45c5-876e-dbf74f5195bd"
            },
            "Features":
            {
                "SampleFeature": "6ad49b93-5705-4bc7-b899-7770fbb7fb0b"
            },
            "Levels":
            {
                "One ":   "2330105f-ecb2-4ce5-965c-4e57fea7a269",
                "Two ":   "cc8330e8-ebf2-42d4-8a46-4ad1d941a6f9",
                "Three":  "fbc18de0-f997-4dc8-8867-669cb57de932",
                "Four":   "58ae7ee6-8668-4da0-abe5-0ea95202ed12",
                "Five":   "66e45be5-d180-4712-b609-fecd7e8322f7",
                "Six":    "2a101beb-5446-4224-8d42-c66e7b00c55e",
                "Seven":  "4054b467-f72b-4434-a827-d11443330d7d",
                "Eight":  "d5409e6e-3502-42b3-98b3-b485e80a1935",
                "Nine":   "f8e29324-8829-4d58-ab09-c4db021dd9ff",
                "Ten":    "5c3e4d3b-6c10-4cd1-8469-372acb5c768e",
                "Eleven": "176b567e-7546-4f01-8773-1ba67060fff8",
                "Twelve": "645670e2-1fba-4bae-b45c-5e7fc5b2fbb7"
            }
        }
    ],
    "Lists": 
    [
        {
            "Type": "SpellList",
            "Action": "Insert",
            "Dictionaries": [
                "FeatMagicInitiateWarlock or whatever we defined it as",
                "Spells.Warlock.Base.Scrolls",
                "Spells.Warlock.All.One",
                "Spells.Warlock.All.Two",
                "Spells.Warlock.All.Three",
                "Spells.Warlock.All.Four",
                "Spells.Warlock.All.Five"
            ],
            "Items":
            [
                "Shout_SpeakWithAnimals",
                "Target_Bane"
            ]
        }
    ]
}

The idea being the subclass section would do the following: 1) Use the ClassDescription UUID to add the subclass to the BaseClass like normal. 2) Insert the SpellList entries into "BaseClass"."SubclassHandle".Spells."One/Two/Etc" 3) Follow the same with Features. 4) Insert the Levels entries into "BaseClass"."SubclassHandle".Levels."One/Two/Etc"

We could then also add a new Dictionary array under each class called All as a way of holding multiple UUIDs, which is formed from every subclass.

The list section is just a quick mock-up referencing dictionaries, with the idea being the Selectors/Lists/Boosts/Bools/etc would not be run until after the Dictionaries had finished.


I'm not sure of any of the feasibility due to my lack of experience in this particular language, but I'm hopeful my general programming transferable knowledge is at least pointing in the right direction.