change/combat rank graph

This commit is contained in:
SowinskiBraeden committed 2023-11-04 20:02:02 -07:00
1 parent d88af57447
commit 19f56f890c
3 files changed
+36 -13

No files matched your search

+34 -11
View File
@@ -208,22 +208,45 @@ module.exports = {
statsEmbed.addFields({ name: 'Combat Rating', value: `${query.combatRating}`, inline: true }); statsEmbed.addFields({ name: 'Combat Rating', value: `${query.combatRating}`, inline: true });
const chart = { const chart = {
type: 'bar', type: 'line',
data: { data: {
labels: new Array(query.combatRatingHistory), labels: new Array(query.combatRatingHistory),
datasets: [ datasets: [{
{ data: query.combatRating,
type: 'line', label: 'Combat Rating Over Time',
label: 'Combat Rating over time', }],
borderColor: 'rgb(54, 162, 235)', },
borderWidth: 2, options: {
fill: false, layout: {
data: query.combatRatingHistory, padding: {
right: 40,
}, },
], },
plugins: {
datalabels: {
display: true,
align: 'top',
color: '#000',
backgroundColor: '#ccc',
borderRadius: 4,
offset: 10,
display: (context) => {
const index = context.dataIndex;
const value = context.dataset.data[index];
const min = Math.min.apply(null, context.dataset.data);
const max = Math.max.apply(null, context.dataset.data);
return (
index == 0 ||
index == context.dataset.data.length - 1 ||
value == min ||
value == max
);
},
},
},
}, },
} }
const encodedChart = encodeURIComponent(JSON.stringify(chart)); const encodedChart = encodeURIComponent(JSON.stringify(chart));
const chartURL = `https://quickchart.io/chart?c=${encodedChart}`; const chartURL = `https://quickchart.io/chart?c=${encodedChart}`;
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "dayzr-bot", "name": "dayzr-bot",
"version": "12.2.3", "version": "12.2.4",
"description": "A General Purpose Discord Bot for DayZ Nitrado Servers.", "description": "A General Purpose Discord Bot for DayZ Nitrado Servers.",
"main": "index.js", "main": "index.js",
"nodemonConfig": { "nodemonConfig": {
+1 -1
View File
@@ -178,7 +178,7 @@ module.exports = {
if (!client.exists(playerStat.shotsLanded)) playerStat = insertPVPstats(playerStat); if (!client.exists(playerStat.shotsLanded)) playerStat = insertPVPstats(playerStat);
if (!client.exists(attackerStat.shotsLanded)) attackerStat = insertPVPstats(attackerStat); if (!client.exists(attackerStat.shotsLanded)) attackerStat = insertPVPstats(attackerStat);
// Update in depth PVP stats if non Melee weapon\ // Update in depth PVP stats if non Melee weapon
if (info.weapon.includes("Sawed-off")) info.weapon = info.weapon.split("Sawed-off ")[1]; if (info.weapon.includes("Sawed-off")) info.weapon = info.weapon.split("Sawed-off ")[1];
if (info.weapon in playerStat.weaponStats) { if (info.weapon in playerStat.weaponStats) {
playerStat.timesShot++; playerStat.timesShot++;