Fix bug important

This commit is contained in:
2025-12-14 10:26:49 +01:00
parent 754d2a082b
commit 0eab1f25fa
3 changed files with 10 additions and 12 deletions
+7 -9
View File
@@ -10,7 +10,7 @@ let isEditing = false;
//fetch operatives data from JSON //fetch operatives data from JSON
function fetchOperativesData() { function fetchOperativesData() {
fetch('/trlstats/static/json/operative.json') fetch('static/json/operative.json')
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
populateOperatives(data.operatives); populateOperatives(data.operatives);
@@ -283,15 +283,10 @@ function applyModifiers() {
return; return;
} }
if (mod.dataset.type === 'multiplicative-headshot') { if (mod.dataset.type === 'multiplicative-headshot') {
if (!headshotBaseApplied) { // Only apply headshot multipliers if the base headshot modifier is active
const baseHeadshotModifier = document.querySelector("#modifiers input[data-type='multiplicative-headshot-base']"); if (headshotBaseApplied) {
if (baseHeadshotModifier && !baseHeadshotModifier.checked) {
baseHeadshotModifier.checked = true;
headshotMultiplier += parseFloat(baseHeadshotModifier.value) - 1;
headshotBaseApplied = true;
}
}
headshotMultiplier += parseFloat(mod.value) - 1; headshotMultiplier += parseFloat(mod.value) - 1;
}
} else if (mod.dataset.type === 'multiplicative-headshot-base') { } else if (mod.dataset.type === 'multiplicative-headshot-base') {
if (!headshotBaseApplied) { if (!headshotBaseApplied) {
headshotMultiplier += parseFloat(mod.value) - 1; headshotMultiplier += parseFloat(mod.value) - 1;
@@ -396,7 +391,10 @@ function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier) {
return; return;
} }
if (buffType === 'multiplicative-headshot') { if (buffType === 'multiplicative-headshot') {
// Only apply if base headshot modifier is active
if (headshotBaseApplied) {
headshotMultiplier += value - 1; headshotMultiplier += value - 1;
}
return; return;
} }
if (type === 'rpm') { if (type === 'rpm') {
+1 -1
View File
@@ -107,7 +107,7 @@
"rpm": 60, "rpm": 60,
"mag_size": 8, "mag_size": 8,
"reload_time": 2.8, "reload_time": 2.8,
"guntype": ["RIFLE", "SEMI-AUTO", "PRIMARY"] "guntype": ["RIFLE", "SEMI-AUTO", "PRIMARY", "WW2"]
}, },
{ {
"id": 12, "id": 12,
+1 -1
View File
@@ -85,7 +85,7 @@
</div> </div>
<h3 class="about_us_text" style="text-align: center; margin-top: 2rem;"> <h3 class="about_us_text" style="text-align: center; margin-top: 2rem;">
Thanks for using <b>TRL Stats</b> <3 Thanks for using <b>TRL Stats</b>
</h3> </h3>
</main> </main>