mirror of
https://github.com/AsgardEternal/SquadJS.git
synced 2024-09-28 16:24:25 -05:00
Update Round Winner
This commit is contained in:
parent
6555ec7b8b
commit
83b2033b0f
@ -681,7 +681,8 @@ Grafana:
|
||||
<h6>Description</h6>
|
||||
<p>The ID of the channel to log admin broadcasts to.</p>
|
||||
<h6>Default</h6>
|
||||
<pre><code>Discord Channel ID</code></pre>
|
||||
<pre><code>Discord Channel ID</code></pre><h6>Example</h6>
|
||||
<pre><code>667741905228136459</code></pre>
|
||||
<h4>color</h4>
|
||||
<h6>Description</h6>
|
||||
<p>The color of the embed.</p>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { COPYRIGHT_MESSAGE } from 'core/constants';
|
||||
import { ROUND_WINNER } from 'squad-server/events';
|
||||
import { NEW_GAME } from 'squad-server/events';
|
||||
|
||||
export default {
|
||||
name: 'discord-round-winner',
|
||||
@ -8,29 +8,27 @@ export default {
|
||||
defaultEnabled: true,
|
||||
optionsSpec: {
|
||||
discordClient: {
|
||||
type: 'DiscordConnector',
|
||||
required: true,
|
||||
default: 'discord',
|
||||
description: 'The name of the Discord Connector to use.'
|
||||
description: 'The name of the Discord Connector to use.',
|
||||
default: 'discord'
|
||||
},
|
||||
channelID: {
|
||||
type: 'Discord Channel ID',
|
||||
required: true,
|
||||
description: 'The ID of the channel to log admin broadcasts to.',
|
||||
default: 'Discord Channel ID',
|
||||
description: 'The ID of the channel to log admin broadcasts to.'
|
||||
example: '667741905228136459'
|
||||
},
|
||||
color: {
|
||||
type: 'Discord Color Code',
|
||||
required: false,
|
||||
default: 16761867,
|
||||
description: 'The color of the embed.'
|
||||
description: 'The color of the embed.',
|
||||
default: 16761867
|
||||
}
|
||||
},
|
||||
|
||||
init: async (server, options) => {
|
||||
const channel = await options.discordClient.channels.fetch(options.channelID);
|
||||
|
||||
server.on(ROUND_WINNER, async (info) => {
|
||||
server.on(NEW_GAME, async (info) => {
|
||||
channel.send({
|
||||
embed: {
|
||||
title: 'Round Winner',
|
||||
|
@ -1,11 +1,3 @@
|
||||
/** Occurs when the round ends.
|
||||
*
|
||||
* Data:
|
||||
* - winner - Winning Team
|
||||
* - layer - layer that was just played
|
||||
*/
|
||||
const ROUND_WINNER = 'ROUND_WINNER';
|
||||
|
||||
/** Occurs when the player list is updated via RCON.
|
||||
*
|
||||
* Data:
|
||||
@ -208,6 +200,5 @@ export {
|
||||
PLAYER_DIED,
|
||||
PLAYER_REVIVED,
|
||||
TICK_RATE,
|
||||
RCON_ERROR,
|
||||
ROUND_WINNER
|
||||
RCON_ERROR
|
||||
};
|
||||
|
@ -9,6 +9,7 @@ import PlayerUnPossess from './player-un-possess.js';
|
||||
import PlayerWounded from './player-wounded.js';
|
||||
import ServerTickRate from './server-tick-rate.js';
|
||||
import SteamIDConnected from './steamid-connected.js';
|
||||
import RoundWinner from './round-winner.js';
|
||||
|
||||
export default [
|
||||
AdminBroadcast,
|
||||
@ -21,5 +22,6 @@ export default [
|
||||
PlayerUnPossess,
|
||||
PlayerWounded,
|
||||
ServerTickRate,
|
||||
SteamIDConnected
|
||||
SteamIDConnected,
|
||||
RoundWinner
|
||||
];
|
||||
|
@ -8,6 +8,7 @@ export default {
|
||||
const layer = SquadLayers.getLayerByLayerClassname(args[5]);
|
||||
|
||||
const data = {
|
||||
...logParser.eventStore.WON,
|
||||
raw: args[0],
|
||||
time: args[1],
|
||||
chainID: args[2],
|
||||
@ -18,6 +19,8 @@ export default {
|
||||
layer: layer ? layer.layer : null
|
||||
};
|
||||
|
||||
delete logParser.eventStore.WON;
|
||||
|
||||
/* Emit new game event */
|
||||
logParser.server.emit(NEW_GAME, data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user