{
  "name": "Bosskills",
  "author": "Mad",
  "supportedGames": [
    "all"
  ],
  "takaroVersion": "v0.0.21",
  "versions": [
    {
      "tag": "latest",
      "description": "Pay and Announcement for Bosses",
      "configSchema": "{\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"type\":\"object\",\"required\":[\"coinAmountMiniBoss\"],\"additionalProperties\":false,\"properties\":{\"coinAmountMiniBoss\":{\"title\":\"coinAmountMiniBoss\",\"description\":\"Amount of Coin to award for a miniboss\",\"default\":0,\"type\":\"number\"},\"coinAmountBoss\":{\"title\":\"coinAmountBoss\",\"description\":\"Amount of Coin to award for a Boss\",\"default\":0,\"type\":\"number\"},\"announceDevourer\":{\"title\":\"announceDevourer\",\"description\":\"Use {pname} for player name and {amount} for currency\",\"type\":\"string\"},\"announceGargul\":{\"title\":\"announceGargul\",\"description\":\"Use {pname} for player name and {amount} for currency\",\"type\":\"string\"},\"announceBear\":{\"title\":\"announceBear\",\"description\":\"Use {pname} for player name and {amount} for currency\",\"type\":\"string\"},\"announceBitch\":{\"title\":\"announceBitch\",\"description\":\"Use {pname} for player name and {amount} for currency\",\"type\":\"string\"},\"announceBurningFlesh\":{\"title\":\"announceBurningFlesh\",\"description\":\"Use {pname} for player name and {amount} for currency\",\"type\":\"string\"},\"announceCholera\":{\"title\":\"announceCholera\",\"description\":\"Use {pname} for player name and {amount} for currency\",\"type\":\"string\"},\"announceBull\":{\"title\":\"announceBull\",\"description\":\"Use {pname} for player name and {amount} for currency\",\"default\":\"\",\"type\":\"string\"},\"announceShocker\":{\"title\":\"announceShocker\",\"description\":\"Use {pname} for player name and {amount} for currency\",\"type\":\"string\"},\"coinAmountTinyBoss\":{\"title\":\"coinAmountTinyBoss\",\"description\":\"Amount of Coin to award for a tinyboss\",\"type\":\"string\"},\"announceVeteran\":{\"title\":\"announceVeteran\",\"description\":\"Use {pname} for player name and {amount} for currency\",\"type\":\"string\"},\"announceCarrier\":{\"title\":\"announceCarrier\",\"description\":\"Use {pname} for player name and {amount} for currency\",\"type\":\"string\"},\"announceOstiarius\":{\"title\":\"announceOstiarius\",\"description\":\"Use {pname} for player name and {amount} for currency\",\"type\":\"string\"}}}",
      "uiSchema": "{}",
      "commands": [],
      "hooks": [
        {
          "name": "Cholera",
          "eventType": "entity-killed",
          "description": "Announce Cholera Kill",
          "regex": null,
          "function": "import { data, takaro } from '@takaro/helpers';\n\nasync function main() {\n    const { gameServerId, eventData } = data;\n\n    const namePattern = /entityKilled: (\\w+) \\(Steam_/;\n    const nameMatch = eventData.msg.match(namePattern);\n    const amountx = data.module.userConfig.coinAmountTinyBoss;\n    const message = data.module.userConfig.announceCholera;\n    const playerName = nameMatch ? nameMatch[1] : \"Unknown\";\n    const formattedMessage = message\n        .replace('{pname}', playerName)\n        .replace('{amount}', amountx);\n\n\n    const pattern = /Steam_(\\d+)/;\n    const match = data.eventData.msg.match(pattern);\n    const steamIdx = match[1];\n    const playerid = (await takaro.player.playerControllerSearch({ filters: { steamId: [steamIdx] } })).data.data[0].id;\n\n    // Send the message with backticks\n    await takaro.gameserver.gameServerControllerSendMessage(gameServerId, {\n        message: formattedMessage\n    });\n\n    // Grant currency to the player\n    await takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(gameServerId, playerid, {\n        currency: amountx\n    });\n}\n\nawait main();"
        },
        {
          "name": "Bull",
          "eventType": "entity-killed",
          "description": "Announce Bull Kill",
          "regex": null,
          "function": "import { data, takaro } from '@takaro/helpers';\n\nasync function main() {\n    const { gameServerId, eventData } = data;\n\n    const namePattern = /entityKilled: (\\w+) \\(Steam_/;\n    const nameMatch = eventData.msg.match(namePattern);\n    const amountx = data.module.userConfig.coinAmountBoss;\n    const message = data.module.userConfig.announceBull;\n    const playerName = nameMatch ? nameMatch[1] : \"Unknown\";\n    const formattedMessage = message\n        .replace('{pname}', playerName)\n        .replace('{amount}', amountx);\n\n\n    const pattern = /Steam_(\\d+)/;\n    const match = data.eventData.msg.match(pattern);\n    const steamIdx = match[1];\n    const playerid = (await takaro.player.playerControllerSearch({ filters: { steamId: [steamIdx] } })).data.data[0].id;\n\n    // Send the message with backticks\n    await takaro.gameserver.gameServerControllerSendMessage(gameServerId, {\n        message: formattedMessage\n    });\n\n    // Grant currency to the player\n    await takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(gameServerId, playerid, {\n        currency: amountx\n    });\n}\n\nawait main();"
        },
        {
          "name": "Shocker",
          "eventType": "entity-killed",
          "description": "Kill Boss Shocker",
          "regex": null,
          "function": "import { data, takaro } from '@takaro/helpers';\n\nasync function main() {\n    const { gameServerId, eventData } = data;\n\n    const namePattern = /entityKilled: (\\w+) \\(Steam_/;\n    const nameMatch = eventData.msg.match(namePattern);\n    const amountx = data.module.userConfig.coinAmountBoss;\n    const message = data.module.userConfig.announceShocker;\n    const playerName = nameMatch ? nameMatch[1] : \"Unknown\";\n    const formattedMessage = message\n        .replace('{pname}', playerName)\n        .replace('{amount}', amountx);\n\n\n    const pattern = /Steam_(\\d+)/;\n    const match = data.eventData.msg.match(pattern);\n    const steamIdx = match[1];\n    const playerid = (await takaro.player.playerControllerSearch({ filters: { steamId: [steamIdx] } })).data.data[0].id;\n\n    // Send the message with backticks\n    await takaro.gameserver.gameServerControllerSendMessage(gameServerId, {\n        message: formattedMessage\n    });\n\n    // Grant currency to the player\n    await takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(gameServerId, playerid, {\n        currency: amountx\n    });\n}\n\nawait main();"
        },
        {
          "name": "Bear",
          "eventType": "entity-killed",
          "description": "Boss Bear Kill",
          "regex": null,
          "function": "import { data, takaro } from '@takaro/helpers';\n\nasync function main() {\n    const { gameServerId, eventData } = data;\n\n    const namePattern = /entityKilled: (\\w+) \\(Steam_/;\n    const nameMatch = eventData.msg.match(namePattern);\n    const amountx = data.module.userConfig.coinAmountMiniBoss;\n    const message = data.module.userConfig.announceBear;\n    const playerName = nameMatch ? nameMatch[1] : \"Unknown\";\n    const formattedMessage = message\n        .replace('{pname}', playerName)\n        .replace('{amount}', amountx);\n\n\n    const pattern = /Steam_(\\d+)/;\n    const match = data.eventData.msg.match(pattern);\n    const steamIdx = match[1];\n    const playerid = (await takaro.player.playerControllerSearch({ filters: { steamId: [steamIdx] } })).data.data[0].id;\n\n    // Send the message with backticks\n    await takaro.gameserver.gameServerControllerSendMessage(gameServerId, {\n        message: formattedMessage\n    });\n\n    // Grant currency to the player\n    await takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(gameServerId, playerid, {\n        currency: amountx\n    });\n}\n\nawait main();"
        },
        {
          "name": "Ostiarius",
          "eventType": "entity-killed",
          "description": "Kill Boss Ostiarius",
          "regex": null,
          "function": "import { data, takaro } from '@takaro/helpers';\n\nasync function main() {\n    const { gameServerId, eventData } = data;\n\n    const namePattern = /entityKilled: (\\w+) \\(Steam_/;\n    const nameMatch = eventData.msg.match(namePattern);\n    const amountx = data.module.userConfig.coinAmountBoss;\n    const message = data.module.userConfig.announceOstiarius;\n    const playerName = nameMatch ? nameMatch[1] : \"Unknown\";\n    const formattedMessage = message\n        .replace('{pname}', playerName)\n        .replace('{amount}', amountx);\n\n\n    const pattern = /Steam_(\\d+)/;\n    const match = data.eventData.msg.match(pattern);\n    const steamIdx = match[1];\n    const playerid = (await takaro.player.playerControllerSearch({ filters: { steamId: [steamIdx] } })).data.data[0].id;\n\n    // Send the message with backticks\n    await takaro.gameserver.gameServerControllerSendMessage(gameServerId, {\n        message: formattedMessage\n    });\n\n    // Grant currency to the player\n    await takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(gameServerId, playerid, {\n        currency: amountx\n    });\n}\n\nawait main();"
        },
        {
          "name": "Bitch",
          "eventType": "entity-killed",
          "description": "Boss Bitch Kill",
          "regex": null,
          "function": "import { data, takaro } from '@takaro/helpers';\n\nasync function main() {\n    const { gameServerId, eventData } = data;\n\n    const namePattern = /entityKilled: (\\w+) \\(Steam_/;\n    const nameMatch = eventData.msg.match(namePattern);\n    const amountx = data.module.userConfig.coinAmountTinyBoss;\n    const message = data.module.userConfig.announceBitch;\n    const playerName = nameMatch ? nameMatch[1] : \"Unknown\";\n    const formattedMessage = message\n        .replace('{pname}', playerName)\n        .replace('{amount}', amountx);\n\n\n    const pattern = /Steam_(\\d+)/;\n    const match = data.eventData.msg.match(pattern);\n    const steamIdx = match[1];\n    const playerid = (await takaro.player.playerControllerSearch({ filters: { steamId: [steamIdx] } })).data.data[0].id;\n\n    // Send the message with backticks\n    await takaro.gameserver.gameServerControllerSendMessage(gameServerId, {\n        message: formattedMessage\n    });\n\n    // Grant currency to the player\n    await takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(gameServerId, playerid, {\n        currency: amountx\n    });\n}\n\nawait main();"
        },
        {
          "name": "Devourer",
          "eventType": "entity-killed",
          "description": "Boss Devourer Kill",
          "regex": null,
          "function": "import { data, takaro } from '@takaro/helpers';\n\nasync function main() {\n    const { gameServerId, eventData } = data;\n\n    const namePattern = /entityKilled: (\\w+) \\(Steam_/;\n    const nameMatch = eventData.msg.match(namePattern);\n    const amountx = data.module.userConfig.coinAmountMiniBoss;\n    const message = data.module.userConfig.announceDevourer;\n    const playerName = nameMatch ? nameMatch[1] : \"Unknown\";\n    const formattedMessage = message\n        .replace('{pname}', playerName)\n        .replace('{amount}', amountx);\n\n\n    const pattern = /Steam_(\\d+)/;\n    const match = data.eventData.msg.match(pattern);\n    const steamIdx = match[1];\n    const playerid = (await takaro.player.playerControllerSearch({ filters: { steamId: [steamIdx] } })).data.data[0].id;\n\n    // Send the message with backticks\n    await takaro.gameserver.gameServerControllerSendMessage(gameServerId, {\n        message: formattedMessage\n    });\n\n    // Grant currency to the player\n    await takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(gameServerId, playerid, {\n        currency: amountx\n    });\n}\n\nawait main();"
        },
        {
          "name": "Gargul",
          "eventType": "entity-killed",
          "description": "Boss Gargul Kill",
          "regex": null,
          "function": "import { data, takaro } from '@takaro/helpers';\n\nasync function main() {\n    const { gameServerId, eventData } = data;\n\n    const namePattern = /entityKilled: (\\w+) \\(Steam_/;\n    const nameMatch = eventData.msg.match(namePattern);\n    const amountx = data.module.userConfig.coinAmountMiniBoss;\n    const message = data.module.userConfig.announceGargul;\n    const playerName = nameMatch ? nameMatch[1] : \"Unknown\";\n    const formattedMessage = message\n        .replace('{pname}', playerName)\n        .replace('{amount}', amountx);\n\n\n    const pattern = /Steam_(\\d+)/;\n    const match = data.eventData.msg.match(pattern);\n    const steamIdx = match[1];\n    const playerid = (await takaro.player.playerControllerSearch({ filters: { steamId: [steamIdx] } })).data.data[0].id;\n\n    // Send the message with backticks\n    await takaro.gameserver.gameServerControllerSendMessage(gameServerId, {\n        message: formattedMessage\n    });\n\n    // Grant currency to the player\n    await takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(gameServerId, playerid, {\n        currency: amountx\n    });\n}\n\nawait main();"
        },
        {
          "name": "Veteran",
          "eventType": "entity-killed",
          "description": "Kill Boss Veteran",
          "regex": null,
          "function": "import { takaro, data, TakaroUserError } from '@takaro/helpers';\n\n// Card representation\nclass Card {\n    constructor(suit, value, numericValue) {\n        this.suit = suit;\n        this.value = value;\n        this.numericValue = numericValue;\n    }\n}\n\n// Card utilities\nconst CardUtils = {\n    // Create a full deck of 52 cards\n    createDeck() {\n        const suits = ['S', 'H', 'D', 'C']; // Spades, Hearts, Diamonds, Clubs\n        const values = [\n            { value: '2', numericValue: 2 },\n            { value: '3', numericValue: 3 },\n            { value: '4', numericValue: 4 },\n            { value: '5', numericValue: 5 },\n            { value: '6', numericValue: 6 },\n            { value: '7', numericValue: 7 },\n            { value: '8', numericValue: 8 },\n            { value: '9', numericValue: 9 },\n            { value: '10', numericValue: 10 },\n            { value: 'J', numericValue: 10 },\n            { value: 'Q', numericValue: 10 },\n            { value: 'K', numericValue: 10 },\n            { value: 'A', numericValue: 11 }\n        ];\n\n        const deck = [];\n        suits.forEach(suit => {\n            values.forEach(val => {\n                deck.push(new Card(suit, val.value, val.numericValue));\n            });\n        });\n\n        return this.shuffleDeck(deck);\n    },\n\n    // Shuffle the deck using Fisher-Yates algorithm\n    shuffleDeck(deck) {\n        for (let i = deck.length - 1; i > 0; i--) {\n            const j = Math.floor(Math.random() * (i + 1));\n            [deck[i], deck[j]] = [deck[j], deck[i]];\n        }\n        return deck;\n    },\n\n    // Calculate the total value of a hand, accounting for Aces\n    calculateHandValue(hand) {\n        let total = hand.reduce((sum, card) => sum + card.numericValue, 0);\n        const aces = hand.filter(card => card.value === 'A').length;\n\n        // Adjust for Aces\n        for (let i = 0; i < aces; i++) {\n            if (total > 21) {\n                total -= 10;\n            }\n        }\n\n        return total;\n    },\n\n    // Convert hand to a readable string\n    handToString(hand) {\n        return hand.map(card => `${card.value}${card.suit}`).join(', ');\n    }\n};\n\n// Game logic\nconst GameLogic = {\n    // Variable key for game state\n    getGameKey(playerId) {\n        return `bj_game_${playerId}`;\n    },\n\n    // Save game state\n    async saveGame(game) {\n        const key = this.getGameKey(game.playerId);\n        const gameData = JSON.stringify(game);\n\n        try {\n            // Search for existing game variable\n            const existingVar = await takaro.variable.variableControllerSearch({\n                filters: {\n                    key: [key],\n                    playerId: [game.playerId]\n                }\n            });\n\n            if (existingVar.data.data.length > 0) {\n                // Update existing variable\n                await takaro.variable.variableControllerUpdate(existingVar.data.data[0].id, {\n                    value: gameData\n                });\n            } else {\n                // Create new variable\n                await takaro.variable.variableControllerCreate({\n                    key,\n                    value: gameData,\n                    playerId: game.playerId\n                });\n            }\n        } catch (error) {\n            console.error('Failed to save game state:', error);\n            throw new Error('Failed to save game state');\n        }\n    },\n\n    // Load game state\n    async loadGame(playerId) {\n        const key = this.getGameKey(playerId);\n\n        try {\n            const gameVar = await takaro.variable.variableControllerSearch({\n                filters: {\n                    key: [key],\n                    playerId: [playerId]\n                }\n            });\n\n            if (gameVar.data.data.length > 0) {\n                return JSON.parse(gameVar.data.data[0].value);\n            }\n\n            return null;\n        } catch (error) {\n            console.error('Failed to load game state:', error);\n            throw new Error('Failed to load game state');\n        }\n    },\n\n    // Start a new game\n    async startGame(playerId, bet) {\n        // Check if player already has a game\n        const existingGame = await this.loadGame(playerId);\n        if (existingGame && existingGame.status === 'active') {\n            throw new Error('You already have an active game. Use /bjstatus to see your current game.');\n        }\n\n        // Create deck and deal initial cards\n        const deck = CardUtils.createDeck();\n        const playerHand = [deck.pop(), deck.pop()];\n        const dealerHand = [deck.pop(), deck.pop()];\n\n        // Create new game state\n        const game = {\n            playerId,\n            playerHand,\n            dealerHand,\n            bet,\n            status: 'active',\n            lastActivity: Date.now()\n        };\n\n        // Check for immediate blackjack\n        const playerValue = CardUtils.calculateHandValue(playerHand);\n        const dealerValue = CardUtils.calculateHandValue(dealerHand);\n\n        if (playerValue === 21) {\n            // Player has blackjack\n            if (dealerValue === 21) {\n                // Both have blackjack - push\n                game.result = 'push';\n                game.status = 'complete';\n            } else {\n                // Player wins with blackjack\n                game.result = 'win';\n                game.status = 'complete';\n            }\n        }\n\n        // Save game state\n        await this.saveGame(game);\n        return game;\n    }\n};\n\nexport async function main() {\n    const { player, arguments: args } = data;\n    const gameServerId = data.gameServerId;\n\n    // Return object required by Takaro\n    const result = {\n        success: true,\n        message: 'Game started successfully'\n    };\n\n    try {\n        // Validate bet\n        if (!args || !args.bet) {\n            await player.pm('Please provide a bet amount. Usage: /BJplay [amount]');\n            result.success = false;\n            result.message = 'Missing bet amount';\n            return result;\n        }\n\n        const bet = parseInt(args.bet);\n        if (isNaN(bet) || bet <= 0) {\n            await player.pm('Please provide a valid bet amount (a positive number).');\n            result.success = false;\n            result.message = 'Invalid bet amount';\n            return result;\n        }\n\n        // Get module config\n        const config = await takaro.getModuleConfig();\n        const minBet = config.minBet || 10;\n        const maxBet = config.maxBet || 1000;\n\n        if (bet < minBet) {\n            await player.pm(`Minimum bet is ${minBet}.`);\n            result.success = false;\n            result.message = `Bet below minimum (${minBet})`;\n            return result;\n        }\n\n        if (bet > maxBet) {\n            await player.pm(`Maximum bet is ${maxBet}.`);\n            result.success = false;\n            result.message = `Bet above maximum (${maxBet})`;\n            return result;\n        }\n\n        // Get current player balance\n        const playerInfo = await takaro.playerOnGameserver.playerOnGameServerControllerGetOne(gameServerId, player.id);\n        const playerBalance = playerInfo.data.currency;\n\n        // Check balance\n        if (playerBalance < bet) {\n            await player.pm(`You don't have enough currency. Your balance: ${playerBalance}`);\n            result.success = false;\n            result.message = 'Insufficient funds';\n            return result;\n        }\n\n        // Deduct bet using the correct currency API\n        await takaro.playerOnGameserver.playerOnGameServerControllerDeductCurrency(gameServerId, player.id, {\n            currency: bet\n        });\n\n        // Start the game using variable storage\n        const game = await GameLogic.startGame(player.id, bet);\n\n        // Construct game status message\n        const playerHandString = CardUtils.handToString(game.playerHand);\n        const playerHandValue = CardUtils.calculateHandValue(game.playerHand);\n        const dealerUpCardString = `${game.dealerHand[0].value}${game.dealerHand[0].suit}`;\n\n        // Check for immediate game over\n        if (game.status === 'complete') {\n            const dealerHandString = CardUtils.handToString(game.dealerHand);\n            const dealerHandValue = CardUtils.calculateHandValue(game.dealerHand);\n\n            let resultMessage = '';\n            let winnings = 0;\n\n            switch (game.result) {\n                case 'win':\n                    // Check for blackjack bonus\n                    if (playerHandValue === 21 && game.playerHand.length === 2) {\n                        const blackjackPayout = config.blackjackPayout || 1.5;\n                        winnings = bet + Math.floor(bet * blackjackPayout);\n                        resultMessage = `BLACKJACK! You win ${winnings}!`;\n                    } else {\n                        winnings = bet * 2;\n                        resultMessage = `You win ${winnings}!`;\n                    }\n\n                    // Add winnings using correct currency API\n                    await takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(gameServerId, player.id, {\n                        currency: winnings\n                    });\n                    break;\n\n                case 'push':\n                    // Return bet using correct currency API\n                    await takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(gameServerId, player.id, {\n                        currency: bet\n                    });\n                    resultMessage = 'It\\'s a tie (Push). Your bet has been returned.';\n                    break;\n\n                case 'lose':\n                    resultMessage = `You lose ${bet}.`;\n                    break;\n            }\n\n            await player.pm(`GAME OVER\\nYour Hand: ${playerHandString} (Total: ${playerHandValue})\\nDealer's Hand: ${dealerHandString} (Total: ${dealerHandValue})\\n${resultMessage}`);\n        } else {\n            await player.pm(`BLACKJACK GAME STARTED!\\nBet: ${bet}\\nYour Hand: ${playerHandString} (Total: ${playerHandValue})\\nDealer's Visible Card: ${dealerUpCardString}\\n\\nUse /bjhit to take another card\\nUse /bjstand to end your turn`);\n        }\n\n        return result;\n    } catch (error) {\n        console.error('BJplay error:', error);\n        result.success = false;\n        result.message = error.message;\n\n        try {\n            await player.pm(`Error: ${error.message}`);\n        } catch {\n            // Ignore messaging errors\n        }\n\n        return result;\n    }\n}"
        },
        {
          "name": "Carrier",
          "eventType": "entity-killed",
          "description": "Kill Boss Carrier",
          "regex": null,
          "function": "import { data, takaro } from '@takaro/helpers';\n\nasync function main() {\n    const { gameServerId, eventData } = data;\n\n    const namePattern = /entityKilled: (\\w+) \\(Steam_/;\n    const nameMatch = eventData.msg.match(namePattern);\n    const amountx = data.module.userConfig.coinAmountBoss;\n    const message = data.module.userConfig.announceCarrier;\n    const playerName = nameMatch ? nameMatch[1] : \"Unknown\";\n    const formattedMessage = message\n        .replace('{pname}', playerName)\n        .replace('{amount}', amountx);\n\n\n    const pattern = /Steam_(\\d+)/;\n    const match = data.eventData.msg.match(pattern);\n    const steamIdx = match[1];\n    const playerid = (await takaro.player.playerControllerSearch({ filters: { steamId: [steamIdx] } })).data.data[0].id;\n\n    // Send the message with backticks\n    await takaro.gameserver.gameServerControllerSendMessage(gameServerId, {\n        message: formattedMessage\n    });\n\n    // Grant currency to the player\n    await takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(gameServerId, playerid, {\n        currency: amountx\n    });\n}\n\nawait main();"
        },
        {
          "name": "BurningFlesh",
          "eventType": "entity-killed",
          "description": "Burning Flesh Kill",
          "regex": null,
          "function": "import { data, takaro } from '@takaro/helpers';\n\nasync function main() {\n    const { gameServerId, eventData } = data;\n\n    const namePattern = /entityKilled: (\\w+) \\(Steam_/;\n    const nameMatch = eventData.msg.match(namePattern);\n    const amountx = data.module.userConfig.coinAmountTinyBoss;\n    const message = data.module.userConfig.announceBurningFlesh;\n    const playerName = nameMatch ? nameMatch[1] : \"Unknown\";\n    const formattedMessage = message\n        .replace('{pname}', playerName)\n        .replace('{amount}', amountx);\n\n\n    const pattern = /Steam_(\\d+)/;\n    const match = data.eventData.msg.match(pattern);\n    const steamIdx = match[1];\n    const playerid = (await takaro.player.playerControllerSearch({ filters: { steamId: [steamIdx] } })).data.data[0].id;\n\n    // Send the message with backticks\n    await takaro.gameserver.gameServerControllerSendMessage(gameServerId, {\n        message: formattedMessage\n    });\n\n    // Grant currency to the player\n    await takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(gameServerId, playerid, {\n        currency: amountx\n    });\n}\n\nawait main();"
        }
      ],
      "cronJobs": [],
      "functions": [],
      "permissions": []
    }
  ]
}