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