HordeNightWarnings
- community
- administration
- by trevor
- Takaro v0.0.24
- all
Periodic warnings to log out early if players aren't planning to fight through blood moon.
Configuration 8
Settings you fill in when installing the module on a server.
| Setting | Type | Default | Description |
|---|---|---|---|
StartTime1 required StartTime1 | number | 0 | In-game time that 'soft' warnings should begin. Hour only. e.g. 9 or 15 Default: 0 - Will play all day leading up to blood moon |
StartTime2 required StartTime2 | number | 17 | In-game time that 'serious' warnings should begin. Hour only. e.g. 9 or 15 Default: 17 - Will broadcast from 5pm in-game. If everyone logs out by 5pm, BM fighters will have 5 in-game hours to do last minute prep. |
SoftWarningText required SoftWarningText | string | "Blood moon tonight. Please log out before 17:00 if you're not going to fight the horde." | Text for 'soft' warning message. e.g. "Blood moon tonight. Please log out before 17:00 if you're not going to fight the horde." |
SeriousWarningText required SeriousWarningText | string | "Blood moon soon! Log out NOW if you're not going to fight the horde." | Text for 'serious' warning message. e.g. "[FF1111]Blood moon soon![-] Log out NOW if you're not going to fight the horde." |
discordChannel discordChannel | string | "" | Specify the target discord Channel ID for alerts |
debugChannel debugChannel | string | "" | Specify the target discord Channel ID for debug messages |
bloodMoonOverText required bloodMoonOverText | string | "Blood moon is over!" | Text to display when bloodmoon ends. |
enableDebugMessages enableDebugMessages | boolean | false | If enabled, the script will send debug messages to the specified debugChannel |
Raw config schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": [
"StartTime1",
"StartTime2",
"SoftWarningText",
"SeriousWarningText",
"bloodMoonOverText"
],
"additionalProperties": false,
"properties": {
"StartTime1": {
"title": "StartTime1",
"description": "In-game time that 'soft' warnings should begin. Hour only. e.g. 9 or 15\nDefault: 0 - Will play all day leading up to blood moon",
"default": 0,
"type": "number",
"maximum": 22
},
"StartTime2": {
"title": "StartTime2",
"description": "In-game time that 'serious' warnings should begin. Hour only. e.g. 9 or 15\nDefault: 17 - Will broadcast from 5pm in-game. If everyone logs out by 5pm, BM fighters will have 5 in-game hours to do last minute prep.",
"default": 17,
"type": "number",
"maximum": 22
},
"SoftWarningText": {
"title": "SoftWarningText",
"description": "Text for 'soft' warning message. e.g. \"Blood moon tonight. Please log out before 17:00 if you're not going to fight the horde.\"",
"default": "Blood moon tonight. Please log out before 17:00 if you're not going to fight the horde.",
"type": "string"
},
"SeriousWarningText": {
"title": "SeriousWarningText",
"description": "Text for 'serious' warning message. e.g. \"[FF1111]Blood moon soon![-] Log out NOW if you're not going to fight the horde.\"",
"default": "Blood moon soon! Log out NOW if you're not going to fight the horde.",
"type": "string"
},
"discordChannel": {
"title": "discordChannel",
"description": "Specify the target discord Channel ID for alerts",
"default": "",
"type": "string"
},
"debugChannel": {
"title": "debugChannel",
"description": "Specify the target discord Channel ID for debug messages",
"default": "",
"type": "string"
},
"bloodMoonOverText": {
"title": "bloodMoonOverText",
"description": "Text to display when bloodmoon ends.",
"default": "Blood moon is over!",
"type": "string"
},
"enableDebugMessages": {
"title": "enableDebugMessages",
"description": "If enabled, the script will send debug messages to the specified debugChannel",
"default": false,
"type": "boolean"
}
}
} Raw UI schema
{} Hooks 1
Code that runs in reaction to a game or Takaro event.
-
BM_is_over
Hook for log events
Hook source
import { data, takaro } from '@takaro/helpers'; async function main() { const { module: mod } = data; const discordChannel = mod.userConfig.discordChannel; const debugChannel = mod.userConfig.debugChannel; const bloodMoonOverText = mod.userConfig.bloodMoonOverText; await takaro.discord.discordControllerSendMessage(discordChannel, { message: `${bloodMoonOverText}` }); } await main();
Cron jobs 1
Work the module runs on a schedule.
-
horde_night_warning
Cron job source
import { data, takaro } from '@takaro/helpers'; async function main() { const gametimeRaw = await takaro.gameserver.gameServerControllerExecuteCommand(data.gameServerId, { command: `gt` }); const gametime = JSON.stringify(gametimeRaw.data.data.rawResult.slice(0, -2)); // Access your custom config values const { module: mod } = data; const startTime1 = mod.userConfig.StartTime1; const startTime2 = mod.userConfig.StartTime2; const softWarningText = mod.userConfig.SoftWarningText; const seriousWarningText = mod.userConfig.SeriousWarningText; const discordChannel = mod.userConfig.discordChannel; const debugChannel = mod.userConfig.debugChannel; const enableDebugMessages = mod.userConfig.enableDebugMessages; const notBMDayText = "Not a BM day"; // helper async function sendDebugMessage(msg) { if (enableDebugMessages) { await takaro.discord.discordControllerSendMessage(debugChannel, { message: msg }); } } // main process const [fullstring, day, time] = gametime.match(/Day (\d+), (\d+)/); sendDebugMessage(`Day: ${day}, Hour: ${time}, Begin BM check.`); // get BM day from server const bmDayRaw = (await takaro.gameserver.gameServerControllerExecuteCommand(data.gameServerId, { command: `ggs BloodMoonDay` })).data.data.rawResult;; const bmDay = (bmDayRaw.match(/GameStat\.BloodMoonDay\s*=\s*(.+?)\s*$/))[1]; sendDebugMessage(`getGameStat BloodMoonDay = ${bmDay}`); if (Number(day) == Number(bmDay)) { sendDebugMessage(`Day: ${day}, Hour: ${time}, Step 1.`); // Is BM day if (Number(time) >= 22) { // BM already started sendDebugMessage(`Day: ${day}, Hour: ${time}, Step 2.`); await takaro.discord.discordControllerSendMessage(discordChannel, { message: `Day: ${day}, Hour: ${time}, The horde is attacking!` }); return; } if (Number(time) >= Number(startTime2)) { // We are past startTime2, send message 2 sendDebugMessage(`Day: ${day}, Hour: ${time}, Step 3.`); await takaro.gameserver.gameServerControllerExecuteCommand(data.gameServerId, { command: `say "${seriousWarningText}"` }); await takaro.discord.discordControllerSendMessage(discordChannel, { message: `Day: ${day}, Hour: ${time}, ${seriousWarningText}` }); return; } if (Number(time) >= Number(startTime1)) { // We are past startTime2, send message 2 sendDebugMessage(`Day: ${day}, Hour: ${time}, Step 4.`); await takaro.gameserver.gameServerControllerExecuteCommand(data.gameServerId, { command: `say "${softWarningText}"` }); await takaro.discord.discordControllerSendMessage(discordChannel, { message: `Day: ${day}, Hour: ${time}, ${softWarningText}` }); return; } } else if ((Number(day) - 1) == Number(bmDay)) { sendDebugMessage(`Day: ${day}, Hour: ${time}, Step 5.`); // trigger only on the day after bloodmoon if (Number(time) < 4) { // We are past startTime2, send message 2 sendDebugMessage(`Day: ${day}, Hour: ${time}, Step 6.`); await takaro.discord.discordControllerSendMessage(discordChannel, { message: `Day: ${day}, Hour: ${time}, The horde is attacking!` }); return; } else { sendDebugMessage(`Day: ${day}, Hour: ${time}, Step 7.`); await takaro.discord.discordControllerSendMessage(discordChannel, { message: `Day: ${day}, Hour: ${time}, ${notBMDayText}.` }); } } else { sendDebugMessage(`Day: ${day}, Hour: ${time}, Step 8.`); await takaro.discord.discordControllerSendMessage(discordChannel, { message: `Day: ${day}, Hour: ${time}, ${notBMDayText}.` }); } sendDebugMessage(`Day: ${day}, Hour: ${time}, End BM check.`); } await main();