update/include general location in location command output

This commit is contained in:
SowinskiBraeden committed 2024-01-27 15:04:16 -08:00
1 parent 0a78c92d63
commit dfe384c9b8
2 files changed
+20 -2

No files matched your search

+19 -1
View File
@@ -1,4 +1,6 @@
const { EmbedBuilder } = require('discord.js');
const { destinations } = require('../database/destinations');
const { calculateVector } = require('../util/Vector');
module.exports = {
name: "location",
@@ -25,9 +27,25 @@ module.exports = {
let newDt = await client.getDateEST(playerStat.time);
let unixTime = Math.floor(newDt.getTime()/1000);
let tempDest;
let lastDist = 1000000;
let destination_dir;
if (showCoords) { // Only calculate if showing coords, very tiny minor optimization... probably amounts to nothing.
for (let i = 0; i < destinations.length; i++) {
let { distance, theta, dir } = calculateVector(info.victimPOS, destinations[i].coord);
if (distance < lastDist) {
tempDest = destinations[i].name;
lastDist = distance;
destination_dir = dir;
}
}
}
const destination = lastDist > 500 ? `${destination_dir} of ${tempDest}` : `Near ${tempDest}`;
let lastLocation = new EmbedBuilder()
.setColor(client.config.Colors.Default)
.setDescription(`**Location - <t:${unixTime}>**\nYour last location was detected at **[${playerStat.pos[0]}, ${playerStat.pos[1]}](https://www.izurvive.com/chernarusplussatmap/#location=${playerStat.pos[0]};${playerStat.pos[1]})**`)
.setDescription(`**Location - <t:${unixTime}>**\nYour last location was detected at **[${playerStat.pos[0]}, ${playerStat.pos[1]}](https://www.izurvive.com/chernarusplussatmap/#location=${playerStat.pos[0]};${playerStat.pos[1]})**\n${destination}`)
return interaction.send({ embeds: [lastLocation], flags: (1 << 6) });
},
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "dayzr-bot",
"version": "12.5.13",
"version": "12.6.0",
"description": "A General Purpose Discord Bot for DayZ Nitrado Servers.",
"main": "index.js",
"nodemonConfig": {