enhance/combat log detection
This commit is contained in:
3 files changed
+10
-4
No files matched your search
+1
-1
@@ -3,7 +3,7 @@ require('dotenv').config();
|
||||
|
||||
module.exports = {
|
||||
Dev: process.env.Dev || "DEV.",
|
||||
Version: package.version, // (major).(feature).(revision/bug/refactoring)
|
||||
Version: package.version, // (major).(feature).(patch)
|
||||
Admins: ["362791661274660874", "329371697570381824"], // Admins of the bot
|
||||
ServerID: "1050215624053374976",
|
||||
GuildID: process.env.GuildID || "",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "dayzr-bot",
|
||||
"version": "10.1.2",
|
||||
"version": "10.1.3",
|
||||
"description": "A General Purpose Discord Bot for DayZ Nitrado Servers.",
|
||||
"main": "index.js",
|
||||
"nodemonConfig": {
|
||||
|
||||
@@ -28,6 +28,9 @@ module.exports = {
|
||||
DetectCombatLog: async (client, guildId, data) => {
|
||||
if (!client.exists(data.lastDamageDate)) return;
|
||||
|
||||
let guild = await client.GetGuild(guildId);
|
||||
if (!client.exists(guild.connectionLogsChannel)) return;
|
||||
|
||||
const newDt = await client.getDateEST(data.time);
|
||||
const diffSeconds = Math.round((newDt.getTime() - data.lastDamageDate.getTime()) / 1000);
|
||||
|
||||
@@ -36,8 +39,11 @@ module.exports = {
|
||||
if (diffSeconds > (data.combatLogTimer * 60)) return;
|
||||
if (data.lastDamageDate <= data.lastDeathDate) return;
|
||||
|
||||
let guild = await client.GetGuild(guildId);
|
||||
if (!client.exists(guild.connectionLogsChannel)) return;
|
||||
// If lastHitBy (attacker) died to this player or another,
|
||||
// then it does not count as combat logging, (the combat ended)
|
||||
let attacker = guild.playerstats.find(stat => stat.gamertag = data.lastHitBy);
|
||||
if (attacker.lastDeathDate > data.lastDamageDate) return;
|
||||
|
||||
const channel = client.GetChannel(guild.connectionLogsChannel);
|
||||
if (!channel) return;
|
||||
|
||||
|
||||
Reference in new issue
Block a user