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
import { data, takaro } from '@takaro/helpers'; async function main() { const { gameServerId, eventData } = data; const namePattern = /entityKilled: (\w+) \(Steam_/; const nameMatch = eventData.msg.match(namePattern); const playerName = nameMatch ? nameMatch[1] : "Unknown"; const pattern = /Steam_(\d+)/; const match = data.eventData.msg.match(pattern); const steamIdx = match[1]; const playerid = (await takaro.player.playerControllerSearch({ filters: { steamId: [steamIdx] } })).data.data[0].id; // Send the message with backticks await takaro.gameserver.gameServerControllerSendMessage(gameServerId, { message: `[FFFF33]${playerName} just killed a [-][00FEED]Devourer[-] and received 300 [D49F69]Twinkies[-]` }); // Grant currency to the player await takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(gameServerId, playerid, { currency: 300 }); } await main();