async processTextTableEntry(complexText, img) {
        /**extract currency first */
        complexText = this.processTextAsCurrency(complexText);

        if (complexText.trim().length == 0) {
            return;
        }

        /** check for commands @command[arg]
         * commands are then passed along the item name so during creation (in loot-creator.js) we can set some property of the item, for example we can set the price of an
         * item with @price[1d4]  the command is price, the arg is 1d4
        */
        let itemName;
        let commands = [];
        let compendiumName;

        let input = complexText;
        let regex = /([^@]*)@(\w+)\[([^\]]+)\]/g;

        let matches;
        while (matches = regex.exec(input)) {
            if (!itemName) {
                itemName = matches[1].trim(); //the name of the object is the first group [1]. match [0] is the entire match
            }
            /**If an Compendium command is specified (e.g. @Compendium[compendiumName]) i use that as compendium name and i dont add it to command list */
            if (matches[2].toLowerCase() === "compendium") {
                compendiumName = matches[3]
            } else {
                commands.push({ "command": matches[2], "arg": matches[3] });
            }
        }

        if (commands.length > 0 || compendiumName) {
            this.loot.createLootTextItem(itemName, commands, img, compendiumName);
            return;
        }

        /** if no command was found, we check if a simple [table name to roll match is found] 
         * matching formula [table name to roll]
        */
        const match = /([^\[]*)\[([^\]]+)\]/g.exec(complexText);
        //no table in brakets [table] is specified, so we create an item out of the text
        if (!match || match.length < 3) {
            this.loot.createLootTextItem(complexText.trim(), [], img, undefined);
            return;
        }

        const rollFormula = match[1];

        const out = Utils.separateIdComendiumName(match[2]);
        const tableName = out.nameOrId;
        const tableCompendiumName = out.compendiumName;

        let table;
        /**table is inside a compendium , syntax is [comp.endium.name.Table name]*/
        if (tableCompendiumName) {
            table = await Utils.findInCompendiumByName(tableCompendiumName, tableName);
        } else {
            table = game.tables.getName(tableName);
        }

        if (!table) { 
            ui.notifications.warn(`no table named ${tableName} found in compendium ${tableCompendiumName}, did you misspell your table name in brackets?`); 
            return; 
        }

        let numberItems = BRTHelper.tryRoll(rollFormula);
        this.rollManyOnTable(numberItems, table);
    }
/**
     * We do most of the custom rolltable handling with the Text field, this method is processing the table entry text
     * @param {String} complexText the text of a table entry of type Text
     * @param {String} img the image path assigned to the text table Entry selected
     */
We do most of the custom rolltable handling with the Text field, this method is processing the table entry text
@param {String} complexText the text of a table entry of type Text
@param {String} img the image path assigned to the text table Entry selected
We do most of the custom rolltable handling with the Text field this method is processing the table entry text @param { String } complexText the text of a table entry of type Text @param { String } img the image path assigned to the text table Entry selected
async processTextTableEntry(complexText, img) {
        complexText = this.processTextAsCurrency(complexText);
        if (complexText.trim().length == 0) {
            return;
        }
        let itemName;
        let commands = [];
        let compendiumName;
        let input = complexText;
        let regex = /([^@]*)@(\w+)\[([^\]]+)\]/g;
        let matches;
        while (matches = regex.exec(input)) {
            if (!itemName) {
                itemName = matches[1].trim(); 
            }
            if (matches[2].toLowerCase() === "compendium") {
                compendiumName = matches[3]
            } else {
                commands.push({ "command": matches[2], "arg": matches[3] });
            }
        }
        if (commands.length > 0 || compendiumName) {
            this.loot.createLootTextItem(itemName, commands, img, compendiumName);
            return;
        }
        const match = /([^\[]*)\[([^\]]+)\]/g.exec(complexText);
        if (!match || match.length < 3) {
            this.loot.createLootTextItem(complexText.trim(), [], img, undefined);
            return;
        }
        const rollFormula = match[1];
        const out = Utils.separateIdComendiumName(match[2]);
        const tableName = out.nameOrId;
        const tableCompendiumName = out.compendiumName;
        let table;
        if (tableCompendiumName) {
            table = await Utils.findInCompendiumByName(tableCompendiumName, tableName);
        } else {
            table = game.tables.getName(tableName);
        }
        if (!table) { 
            ui.notifications.warn(`no table named ${tableName} found in compendium ${tableCompendiumName}, did you misspell your table name in brackets?`); 
            return; 
        }
        let numberItems = BRTHelper.tryRoll(rollFormula);
        this.rollManyOnTable(numberItems, table);
    }
async processTextTableEntry ( complexText , img ) { complexText = this . processTextAsCurrency ( complexText ) ; if ( complexText . trim ( ) . length == 0 ) { return ; } let itemName ; let commands = [ ] ; let compendiumName ; let input = complexText ; let regex = / ([^@]*)@(\w+)\[([^\]]+)\] / g ; let matches ; while ( matches = regex . exec ( input ) ) { if ( ! itemName ) { itemName = matches [ 1 ] . trim ( ) ; } if ( matches [ 2 ] . toLowerCase ( ) === "compendium" ) { compendiumName = matches [ 3 ] } else { commands . push ( { "command" : matches [ 2 ] , "arg" : matches [ 3 ] } ) ; } } if ( commands . length > 0 || compendiumName ) { this . loot . createLootTextItem ( itemName , commands , img , compendiumName ) ; return ; } const match = / ([^\[]*)\[([^\]]+)\] / g . exec ( complexText ) ; if ( ! match || match . length < 3 ) { this . loot . createLootTextItem ( complexText . trim ( ) , [ ] , img , undefined ) ; return ; } const rollFormula = match [ 1 ] ; const out = Utils . separateIdComendiumName ( match [ 2 ] ) ; const tableName = out . nameOrId ; const tableCompendiumName = out . compendiumName ; let table ; if ( tableCompendiumName ) { table = await Utils . findInCompendiumByName ( tableCompendiumName , tableName ) ; } else { table = game . tables . getName ( tableName ) ; } if ( ! table ) { ui . notifications . warn ( ` ${ tableName } ${ tableCompendiumName } ` ) ; return ; } let numberItems = BRTHelper . tryRoll ( rollFormula ) ; this . rollManyOnTable ( numberItems , table ) ; }
We do most of the custom rolltable handling with the Text field, this method is processing the table entry text
 @param {String} complexText the text of a table entry of type Text
 @param {String} img the image path assigned to the text table Entry selected
We do most of the custom rolltable handling with the Text field this method is processing the table entry text @param { String } complexText the text of a table entry of type Text @param { String } img the image path assigned to the text table Entry selected
/**extract currency first */ /** check for commands @command[arg]
         * commands are then passed along the item name so during creation (in loot-creator.js) we can set some property of the item, for example we can set the price of an
         * item with @price[1d4]  the command is price, the arg is 1d4
        */ //the name of the object is the first group [1]. match [0] is the entire match /**If an Compendium command is specified (e.g. @Compendium[compendiumName]) i use that as compendium name and i dont add it to command list */ /** if no command was found, we check if a simple [table name to roll match is found] 
         * matching formula [table name to roll]
        */ //no table in brakets [table] is specified, so we create an item out of the text /**table is inside a compendium , syntax is [comp.endium.name.Table name]*/