From 941f2ba3bd9db766ccd1672ce4bc0a48996f45c9 Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Sat, 7 Oct 2023 16:04:26 -0700 Subject: [PATCH] update/better killfeed vehicle death message --- package.json | 2 +- util/KillfeedHandler.js | 37 ++++++++++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 14d6540..e11a1d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dayzr-bot", - "version": "10.3.4", + "version": "10.3.5", "description": "A General Purpose Discord Bot for DayZ Nitrado Servers.", "main": "index.js", "nodemonConfig": { diff --git a/util/KillfeedHandler.js b/util/KillfeedHandler.js index aeba1d3..cccce98 100644 --- a/util/KillfeedHandler.js +++ b/util/KillfeedHandler.js @@ -5,15 +5,37 @@ const { destinations } = require('../config/destinations'); const { calculateVector } = require('./vector'); const Templates = { - Killed: 1, - HitBy: 2, + Killed: 1, + HitBy: 2, HitByAndDead: 3, - Explosion: 4, - LandMine: 5, - Melee: 6, - Vehicle: 7, + Explosion: 4, + LandMine: 5, + Melee: 6, + Vehicle: 7, }; +const Vehicles = { + CivilianSedan: 'White Olga', + CivilianSedan_Black: 'Black Olga', + CivilianSedan_Wine: 'Wine Olga', + + Hatchback_02: 'Red Gunter', + Hatchback_02_Black: 'Black Gunter', + Hatchback_02_Blue: 'Blue Gunter', + + OffroadHatchBack: 'Green ADA 4x4', + OffroadHatchBack_Blue: 'Blue ADA 4x4', + OffroadHatchBack_White: 'White ADA 4x4', + + Sedan_02: 'Yellow Sarka', + Sedan_02_Grey: 'Grey Sarka', + Sedan_02_Red: 'Red Sarka', + + Truck_01_Covered: 'Green V3S Truck', + Truck_01_Covered_Blue: 'Blue V3S Truck', + Truck_01_Covered_Orange: 'Orange V3S Truck', +} + module.exports = { HandleKillfeed: async (client, guildId, stats, line) => { @@ -93,7 +115,8 @@ module.exports = { const destination = lastDist > 500 ? `${destination_dir} of ${tempDest}` : `Near ${tempDest}`; if (killedBy == Templates.LandMine || killedBy == Templates.Explosion || killedBy == Templates.Vehicle) { - const cod = killedBy == Templates.LandMine ? `Land Mine Trap` : info.causeOfDeath; + const cod = killedBy == Templates.LandMine ? `Land Mine Trap` : + killedBy == Templates.Vehicle ? Vehicles[info.causeOfDeath] : info.causeOfDeath; const coord = showCoords ? `\n***Location [${info.victimPOS[0]}, ${info.victimPOS[1]}](https://www.izurvive.com/chernarusplussatmap/#location=${info.victimPOS[0]};${info.victimPOS[1]})***\n${destination}` : ''; const killMessage = killedBy == Templates.Vehicle ? 'run over by' : 'blew up from';