fixed some bugs
This commit is contained in:
@@ -401,7 +401,6 @@ function updateModifiedWeaponStats(damage, rpm, reloadTime) {
|
||||
`;
|
||||
}
|
||||
|
||||
// Function to filter weapons in the dropdown based on search input
|
||||
function filterWeapons() {
|
||||
const input = document.getElementById('weapon-search').value.toLowerCase();
|
||||
const weaponSelect = document.getElementById('weapon-select');
|
||||
@@ -426,6 +425,8 @@ function filterWeapons() {
|
||||
// Automatically select the first visible matching option
|
||||
if (firstVisibleOption) {
|
||||
weaponSelect.value = firstVisibleOption.value;
|
||||
// Manually trigger the 'change' event after auto-selecting the first option
|
||||
weaponSelect.dispatchEvent(new Event('change'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -454,6 +455,8 @@ function filterOperatives() {
|
||||
// Automatically select the first visible matching option
|
||||
if (firstVisibleOption) {
|
||||
operativeSelect.value = firstVisibleOption.value;
|
||||
// Manually trigger the 'change' event after auto-selecting the first option
|
||||
operativeSelect.dispatchEvent(new Event('change'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-10
@@ -4,12 +4,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
.then(data => {
|
||||
const updatedGuns = data.map(gun => {
|
||||
const original_damage = gun['damage'];
|
||||
const rps = gun['rpm'] / 60;
|
||||
const dps = original_damage * rps;
|
||||
const reload_time_min = gun['reload_time'] / 60;
|
||||
const dpm = (gun['mag_size'] * original_damage) / (reload_time_min + (gun['mag_size'] / gun['rpm']));
|
||||
const avg_dps = dpm / 60;
|
||||
const total_damage = original_damage * gun['damage_multiplier'];
|
||||
const rps = gun['rpm'] / 60;
|
||||
const dps = total_damage * rps;
|
||||
const reload_time_min = gun['reload_time'] / 60;
|
||||
const dpm = (gun['mag_size'] * total_damage) / (reload_time_min + (gun['mag_size'] / gun['rpm']));
|
||||
const avg_dps = dpm / 60;
|
||||
|
||||
// Add the calculated stats to the gun object
|
||||
return {
|
||||
@@ -37,10 +37,9 @@ function populateTable(data) {
|
||||
row.insertCell(3).innerText = gun.rpm;
|
||||
row.insertCell(4).innerText = gun.mag_size;
|
||||
row.insertCell(5).innerText = gun.reload_time;
|
||||
row.insertCell(6).innerText = gun.guntype;
|
||||
row.insertCell(7).innerText = gun.rps.toFixed(2);
|
||||
row.insertCell(8).innerText = gun.dps.toFixed(2);
|
||||
row.insertCell(9).innerText = gun.dpm.toFixed(2);
|
||||
row.insertCell(10).innerText = gun.avg_dps.toFixed(2);
|
||||
row.insertCell(6).innerText = gun.rps.toFixed(2);
|
||||
row.insertCell(7).innerText = gun.dps.toFixed(2);
|
||||
row.insertCell(8).innerText = gun.dpm.toFixed(2);
|
||||
row.insertCell(9).innerText = gun.avg_dps.toFixed(2);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@
|
||||
<th>Rounds per minute</th>
|
||||
<th>Magazine Size</th>
|
||||
<th>Reload time</th>
|
||||
<th>Gun type</th>
|
||||
<th>RPS</th>
|
||||
<th>DPS</th>
|
||||
<th>DPM</th>
|
||||
|
||||
Reference in New Issue
Block a user