Bosskills
- community
- events
- by Mad
- Takaro v0.0.21
- all
Pay and Announcement for Bosses
Configuration 2
Settings you fill in when installing the module on a server.
| Setting | Type | Default | Description |
|---|---|---|---|
coinAmountDevourer required coinAmountDevourer | number | 0 | Amoint of Coin to award |
announceDevourer announceDevourer | string | — | Post in chat Boss Kill |
Raw config schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": [
"coinAmountDevourer"
],
"additionalProperties": false,
"properties": {
"coinAmountDevourer": {
"title": "coinAmountDevourer",
"description": "Amoint of Coin to award",
"default": 0,
"type": "number"
},
"announceDevourer": {
"title": "announceDevourer",
"description": "Post in chat Boss Kill",
"type": "string"
}
}
} Raw UI schema
{} Hooks 1
Code that runs in reaction to a game or Takaro event.
-
Devourer
Hook for log events
Hook source
// Hook function for detecting boss kills and sending congratulatory PM import { data, takaro } from '@takaro/helpers'; async function main() { const { gameServerId, eventData } = data; // Check if eventData exists and contains the message if (!eventData || !eventData.msg) { console.log("Error: Expected log message not found in data structure"); return; } // Get the log message from the correct path in the data object const logLine = eventData.msg; console.log("Processing log line:", logLine); // Check if this is a bossDevourer kill line if (!logLine.includes("killed animal bossDevourer")) { console.log("Not a bossDevourer kill"); return; } // Extract player name using regex // Format: [CSMM_Patrons]entityKilled: Mad (Steam_76561198041959712) killed animal bossDevourer with Dev: Instant Death Pistol const playerMatch = logLine.match(/entityKilled: (\w+) \(Steam_/); if (!playerMatch || !playerMatch[1]) { console.log("Could not extract player name from kill log"); return; } const playerName = playerMatch[1]; console.log("Extracted player name:", playerName); try { // Search for the player to get their ID const playerSearchResult = await takaro.player.playerControllerSearch({ filters: { name: [playerName] } }); if (playerSearchResult.data.data.length === 0) { console.log("Player not found in database:", playerName); return; } const playerId = playerSearchResult.data.data[0].id; // Send the message using the player ID await takaro.gameserver.gameServerControllerSendMessage(gameServerId, { message: `good kill on that animal bossDevourer!`, }); console.log("Successfully sent message about player:", playerName); } catch (error) { console.log("Error:", error.message); } } await main();