From b0d74ddf6a8659422a23ae220c3935700ceba0e3 Mon Sep 17 00:00:00 2001 From: IM23a-bachmannj2 Date: Mon, 16 Sep 2024 11:24:21 +0200 Subject: [PATCH 01/50] changed directory for json files --- app.py | 2 +- static/filterWeapons.js | 4 ++-- static/{ => json}/data.json | 0 static/{ => json}/modifiers.json | 0 static/{ => json}/operative.json | 0 5 files changed, 3 insertions(+), 3 deletions(-) rename static/{ => json}/data.json (100%) rename static/{ => json}/modifiers.json (100%) rename static/{ => json}/operative.json (100%) diff --git a/app.py b/app.py index ba63391..e638851 100644 --- a/app.py +++ b/app.py @@ -4,7 +4,7 @@ import json app = Flask(__name__) # Load the data from the JSON file -with open('static/data.json') as f: +with open('static/json/data.json') as f: guns = json.load(f) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 19340c9..25bc225 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -3,7 +3,7 @@ let weapons = []; // This will be populated by the fetched JSON data // Function to fetch weapons data from JSON function fetchWeaponsData() { - fetch('static/data.json') // Adjust the path to the actual location of your JSON file + fetch('static/json/data.json') // Adjust the path to the actual location of your JSON file .then(response => response.json()) .then(data => { weapons = data; // Store the fetched data in the global 'weapons' variable @@ -57,7 +57,7 @@ function updateWeaponStats(weapon) { // Function to fetch and populate modifiers from the JSON file function fetchModifiers() { - fetch('static/modifiers.json') // Adjust the path to your JSON file + fetch('static/json/modifiers.json') // Adjust the path to your JSON file .then(response => response.json()) .then(data => { populateModifiers(data); diff --git a/static/data.json b/static/json/data.json similarity index 100% rename from static/data.json rename to static/json/data.json diff --git a/static/modifiers.json b/static/json/modifiers.json similarity index 100% rename from static/modifiers.json rename to static/json/modifiers.json diff --git a/static/operative.json b/static/json/operative.json similarity index 100% rename from static/operative.json rename to static/json/operative.json From d80a1fb0ed3a35b93c21cd79e6c1a7acbceb5659 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Mon, 16 Sep 2024 14:48:52 +0200 Subject: [PATCH 02/50] Changed operative.json and added Selector Population for the Operatives. --- static/filterWeapons.js | 91 ++++++++++++------ static/operative.json | 195 +++----------------------------------- templates/calculator.html | 14 ++- 3 files changed, 85 insertions(+), 215 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 19340c9..e72f08c 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -1,5 +1,38 @@ let selectedWeapon = null; // Store the selected weapon's data let weapons = []; // This will be populated by the fetched JSON data +let selectedOperative = null; // Store the selected operative's data + +// Function to fetch operatives data from JSON +function fetchOperativesData() { + fetch('static/operative.json') // Adjust the path to the actual location of your JSON file + .then(response => response.json()) + .then(data => { + populateOperatives(data.operatives); // Populate the operative dropdown once data is loaded + }) + .catch(error => console.error('Error fetching operatives data:', error)); +} + +// Function to populate the select element with operatives +function populateOperatives(operatives) { + const select = document.getElementById('operative-select'); + select.innerHTML = ""; // Clear any existing options + + operatives.forEach(operative => { + const option = document.createElement('option'); + option.value = operative.id; + option.text = operative.name; + select.appendChild(option); + }); + + // Attach event listener to detect when an operative is selected + select.addEventListener('change', (event) => { + const selectedOperativeId = event.target.value; + selectedOperative = operatives.find(op => op.id === selectedOperativeId); + if (selectedOperative) { + updateOperativeBuffs(selectedOperative) + } + }); +} // Function to fetch weapons data from JSON function fetchWeaponsData() { @@ -70,33 +103,33 @@ function populateModifiers(modifiers) { const modifiersContainer = document.getElementById('modifiers'); const createModifierSection = (title, modifierList) => { - const section = document.createElement('div'); - const header = document.createElement('h3'); - header.textContent = title; - section.appendChild(header); + const section = document.createElement('div'); + const header = document.createElement('h3'); + header.textContent = title; + section.appendChild(header); - modifierList.forEach(mod => { - const label = document.createElement('label'); - const input = document.createElement('input'); - input.type = 'checkbox'; - input.id = mod.id; + modifierList.forEach(mod => { + const label = document.createElement('label'); + const input = document.createElement('input'); + input.type = 'checkbox'; + input.id = mod.id; - // Check if the modifier has multiple buffs - if (mod.buffs) { - input.dataset.buffs = JSON.stringify(mod.buffs); // Store buffs data as a string in data-buffs - } else { - input.value = mod.value; - input.dataset.type = mod.type; // Store if it's additive or multiplicative - } + // Check if the modifier has multiple buffs + if (mod.buffs) { + input.dataset.buffs = JSON.stringify(mod.buffs); // Store buffs data as a string in data-buffs + } else { + input.value = mod.value; + input.dataset.type = mod.type; // Store if it's additive or multiplicative + } - label.appendChild(input); - label.appendChild(document.createTextNode(mod.label)); - section.appendChild(label); - section.appendChild(document.createElement('br')); - }); + label.appendChild(input); + label.appendChild(document.createTextNode(mod.label)); + section.appendChild(label); + section.appendChild(document.createElement('br')); + }); - return section; -}; + return section; + }; // Clear any existing modifiers @@ -127,9 +160,9 @@ function applyModifiers() { let baseReloadTime = selectedWeapon.reload_time; // Initialize the modifier objects - let damageModifier = { additive: 0, multiplicative: 1 }; - let rpmModifier = { additive: 0, multiplicative: 1 }; - let reloadTimeModifier = { additive: 0, multiplicative: 1 }; + let damageModifier = {additive: 0, multiplicative: 1}; + let rpmModifier = {additive: 0, multiplicative: 1}; + let reloadTimeModifier = {additive: 0, multiplicative: 1}; // Collect checked modifier values document.querySelectorAll('#modifiers input:checked').forEach(mod => { @@ -184,10 +217,9 @@ function applyModifiers() { } - // Helper function to apply individual buffs function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier = null) { - const { type, buffType, value } = buff; + const {type, buffType, value} = buff; // Apply buffs based on type if (type === 'rpm') { @@ -235,4 +267,5 @@ function updateModifiedWeaponStats(damage, rpm, reloadTime) { // Call the fetch function to load the data and populate the dropdown on page load fetchWeaponsData(); -fetchModifiers(); \ No newline at end of file +fetchModifiers(); +fetchOperativesData() \ No newline at end of file diff --git a/static/operative.json b/static/operative.json index e4d5d54..45f5482 100644 --- a/static/operative.json +++ b/static/operative.json @@ -3,236 +3,67 @@ { "id": "Classic-Guard", "name": "Guard", - "buffs": [ - { - "label": "[SMG] (+15% Damage)", - "type": "damage", - "value": 1.15, - "affectedWeapons": "SMG", - "buffType": "multiplicative" - } - ] + "category": "Classic" }, { "id": "Classic-Scout", "name": "Scout", - "buffs": [ - { - "label": "None", - "type": "damage", - "value": 1, - "affectedWeapons": "", - "buffType": "multiplicative" - } - ] + "category": "Classic" }, { "id": "Classic-RCU", "name": "RCU", - "buffs": [ - { - "label": "[SHOTGUN] +25% Damage", - "type": "damage", - "value": 1.25, - "affectedWeapons": "SHOTGUN", - "buffType": "multiplicative" - } - ] + "category": "Classic" }, { "id": "Classic-Viper", "name": "Viper", - "buffs": [ - { - "label": "None", - "type": "damage", - "value": 1, - "affectedWeapons": "", - "buffType": "multiplicative" - } - ] + "category": "Classic" }, { "id": "Classic-SD-Sergeant", "name": "SD Sergeant", - "buffs": [ - { - "label": "Max Corruption (+30% Damage)", - "type": "damage", - "value": 1.3, - "affectedWeapons": "", - "buffType": "multiplicative" - } - ] + "category": "Classic" }, { "id": "Classic-ISD", "name": "ISD", - "buffs": [ - { - "label": "[Chaos Insurgency] +50% Damage", - "type": "damage", - "value": 1.5, - "affectedWeapons": "", - "buffType": "multiplicative" - } - ] + "category": "Classic" }, { "id": "Classic-TRU", "name": "TRU", - "buffs": [ - { - "label": "None", - "type": "damage", - "value": 1, - "affectedWeapons": "", - "buffType": "multiplicative" - } - ] + "category": "Classic" }, { "id": "Classic-SD-Captain", "name": "SD Captain", - "buffs": [ - { - "label": "None", - "type": "damage", - "value": 1, - "affectedWeapons": "", - "buffType": "multiplicative" - } - ] + "category": "Classic" }, { "id": "Classic-Vanguard", "name": "Vanguard", - "buffs": [ - { - "label": "[Not LMG] Bad Experience (+25% Damage, +25% Reload Speed)", - "buffs": [ - { - "type": "damage", - "value": 1.25, - "affectedWeapons": "NOT LMG", - "buffType": "multiplicative" - }, - { - "type": "reloadTime", - "value": 0.75, - "affectedWeapons": "NOT LMG", - "buffType": "multiplicative" - } - ] - }, - { - "label": "[LMG] LMG User (+35% Damage)", - "buffs": [ - { - "type": "damage", - "value": 1.35, - "affectedWeapons": "LMG", - "buffType": "multiplicative" - } - ] - } - ] + "category": "Classic" }, { "id": "Classic-Demolitionist", "name": "Demolitionist", - "buffs": [ - { - "label": "None", - "type": "damage", - "value": 1, - "affectedWeapons": "", - "buffType": "multiplicative" - } - ] - }, - { - "id": "Classic-Juggernaut", - "name": "Juggernaut", - "buffs": [ - { - "label": "Hold the Line (+90% Damage)", - "type": "damage", - "value": 1.9, - "affectedWeapons": "", - "buffType": "multiplicative" - } - ] + "category": "Classic" }, { "id": "Classic-Mercenary", "name": "Mercenary", - "buffs": [ - { - "label": "All Upgrades (+25% Damage, +15% Reload Speed)", - "buffs": [ - { - "type": "damage", - "value": 1.25, - "affectedWeapons": "", - "buffType": "multiplicative" - }, - { - "type": "reloadTime", - "value": 0.85, - "affectedWeapons": "", - "buffType": "multiplicative" - } - ] - }, - { - "label": "MCD Sandevistan (+?% Damage", - "type": "damage", - "value": 1.5, - "affectedWeapons": "", - "buffType": "multiplicative" - } - ] + "category": "Classic" }, { "id": "Classic-CRT", "name": "CRT", - "buffs": [ - { - "label": "None", - "type": "damage", - "value": 1, - "affectedWeapons": "", - "buffType": "multiplicative" - } - ] + "category": "Classic" }, { "id": "Classic-Anarchist", "name": "Anarchist", - "buffs": [ - { - "label": "Last Stand (+150% Damage)", - "type": "damage", - "value": 2.5, - "affectedWeapons": "", - "buffType": "multiplicative" - }, - { - "label": "World On Fire (+150% Damage)", - "type": "damage", - "value": 2.5, - "affectedWeapons": "", - "buffType": "multiplicative" - }, - { - "label": "Adrenaline (+30% Damage)", - "type": "damage", - "value": 2.5, - "affectedWeapons": "", - "buffType": "multiplicative" - } - ] + "category": "Classic" } ] } diff --git a/templates/calculator.html b/templates/calculator.html index 1b9080c..29c543f 100644 --- a/templates/calculator.html +++ b/templates/calculator.html @@ -59,15 +59,21 @@ - -
+ + + - + + +
- +
+ From 11518ceee99f77867423a5ad74b58e3a875f6e4c Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Mon, 16 Sep 2024 14:50:13 +0200 Subject: [PATCH 03/50] minor change --- static/filterWeapons.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 0e577b4..cc3311f 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -4,7 +4,7 @@ let selectedOperative = null; // Store the selected operative's data // Function to fetch operatives data from JSON function fetchOperativesData() { - fetch('static/operative.json') // Adjust the path to the actual location of your JSON file + fetch('static/json/operative.json') // Adjust the path to the actual location of your JSON file .then(response => response.json()) .then(data => { populateOperatives(data.operatives); // Populate the operative dropdown once data is loaded From 9fba57f1e66adea8adc820b0b3dbc5afedbd647a Mon Sep 17 00:00:00 2001 From: IM23a-bachmannj2 Date: Tue, 17 Sep 2024 14:22:41 +0200 Subject: [PATCH 04/50] Added Suggestion page cooldown and design. --- static/style.css | 87 +++++++++++++++++++++++++++++++++++ static/suggestion.js | 96 +++++++++++++++++++++++++++++++++++++++ templates/about_us.html | 2 +- templates/suggestion.html | 31 ++----------- 4 files changed, 188 insertions(+), 28 deletions(-) create mode 100644 static/suggestion.js diff --git a/static/style.css b/static/style.css index 050a752..0b1bfff 100644 --- a/static/style.css +++ b/static/style.css @@ -229,3 +229,90 @@ nav { .button1 { background-color: black; } + +/* Suggestion Form Enhancements */ +main h1 { + font-size: 2.5em; + color: black; + text-align: center; + margin-bottom: 20px; +} + +.suggestion-title { + font-size: 1.5em; + color: black; + text-align: center; + margin-bottom: 30px; +} + +article label { + font-weight: bold; + font-size: 1.1em; + color: #333; + margin-bottom: 10px; + display: block; +} + +input[type="text"], input[type="number"], textarea { + width: 95%; + padding: 12px; + font-size: 1em; + border: 1px solid #ccc; + border-radius: 8px; + margin-bottom: 20px; + background-color: #f9f9f9; + transition: border-color 0.3s, box-shadow 0.3s; +} + +/* Focus effect to highlight the active input field */ +input[type="text"]:focus, input[type="number"]:focus, textarea:focus { + border-color: black; + box-shadow: 0 0 5px darkred; + background-color: #fff; + outline: none; +} + +textarea { + resize: none; + height: 150px; +} + +/* Submit button improvements */ +.button1 { + background-color: darkred; + color: white; + font-size: 1.2em; + padding: 12px 24px; + border: none; + border-radius: 8px; + cursor: pointer; + display: block; + margin: 0 auto; + transition: background-color 0.3s ease, transform 0.3s ease; +} + +/* Button hover effect */ +.button1:hover { + background-color: #45a049; + transform: scale(1.05); +} + +/* Success message styling */ +#successMessage { + font-size: 1.1em; + color: green; + text-align: center; + margin-top: 20px; +} + +/* Adjustments for mobile responsiveness */ +@media screen and (max-width: 600px) { + input[type="text"], input[type="number"], textarea { + width: 80%; + font-size: 0.95em; + } + + .suggestion-title { + font-size: 1.2em; + } +} diff --git a/static/suggestion.js b/static/suggestion.js new file mode 100644 index 0000000..e527439 --- /dev/null +++ b/static/suggestion.js @@ -0,0 +1,96 @@ +const cooldownDuration = 10 * 360000; +const prohibitedWords = ['fuck', 'shit', 'asshole', 'bitch', 'bastard', 'damn', 'crap', 'dick', 'piss', 'cunt', 'motherfucker', 'douche', +'prick', 'whore', 'slut', 'fag', 'nigger', 'spic', 'retard', 'twat', 'bollocks', 'wanker', 'bugger', 'arse', +'shithead', 'dumbass', 'jackass', 'dipshit', 'dildo', 'knobhead', 'ballsack', 'buttfucker', 'cum', 'jizz', +'cocksucker', 'fucker', 'skank', 'pussy', 'tits', 'clit', 'schlong', 'dickhead', 'goddamn', 'hell', 'bitchass', +'fuckface', 'shitfaced', 'asshat', 'bint', 'chink', 'gook', 'jap', 'negro', 'dyke', 'queer', 'tranny', 'tosser', +'spaz', 'mong', 'coon', 'beaner', 'cracker', 'wetback', 'homo', 'fudgepacker', 'tard', 'cocks', 'bollocks', +'numbnuts', 'knob', 'muppet', 'git', 'shag', 'minge', 'git', 'bugger', 'tosser', 'nonce', 'plonker', 'pillock'] +; // Example word filtering + +// Function to get the last submission time from localStorage +function getLastSubmissionTime() { + const storedTime = localStorage.getItem('lastSubmissionTime'); + return storedTime ? parseInt(storedTime, 10) : 0; +} + +// Function to save the last submission time to localStorage +function setLastSubmissionTime(time) { + localStorage.setItem('lastSubmissionTime', time.toString()); +} + +function sendMessage() { + // Get the current time + const currentTime = Date.now(); + + // Retrieve the last submission time from localStorage + const lastSubmissionTime = getLastSubmissionTime(); + + // Cooldown logic to prevent spamming + if (currentTime - lastSubmissionTime < cooldownDuration) { + alert(`Please wait for ${cooldownDuration / 1000} seconds between submissions.`); + return; + } + + // Get the values from the input fields + const pseudoname = document.getElementById("name").value || "Anonymous"; + const rating = parseInt(document.getElementById("rate").value, 10); + const comment = document.getElementById("text").value.trim(); + + // Validation: Rating should be between 1 and 10 + if (isNaN(rating) || rating < 1 || rating > 10) { + alert("Rating must be a number between 1 and 10."); + return; + } + + // Validation: Comment length (min 5, max 500) and simple prohibited word check + if (comment.length < 5 || comment.length > 500) { + alert("Comment must be between 5 and 500 characters."); + return; + } + + // Check for prohibited words (basic check) + for (const word of prohibitedWords) { + if (comment.toLowerCase().includes(word)) { + alert("Your comment contains inappropriate content."); + return; + } + } + + // If all checks pass, send the message to the Discord webhook + const request = new XMLHttpRequest(); + request.open("POST", "https://discord.com/api/webhooks/1284936894890901649/Zi-2ZV12L1v1OSBoM-DluE1V1LECXilrNNRZYJcxelnwO7rGgXNH47dxvfFEOK7Fe9_J"); + request.setRequestHeader('Content-type', 'application/json'); + + // Create the content to send to the Discord webhook + const content = `**Rating:** ${rating}\n**Comment:**\n${comment}`; + + // Debugging information + console.log('Sending message with content:', content); + + // Send the message payload to the Discord webhook + const params = { + username: pseudoname, // Pseudoname will appear as the username + content: content // The combined content (pseudoname, rating, and comment) + }; + + request.send(JSON.stringify(params)); + + // Update the last submission time to the current time + setLastSubmissionTime(currentTime); + + // Optionally, you can reset the form after sending + document.getElementById("name").value = ""; + document.getElementById("rate").value = ""; + document.getElementById("text").value = ""; + + // Display the success message + const successMessage = document.getElementById("successMessage"); + successMessage.textContent = "Successfully sent the message!"; + successMessage.style.display = "block"; // Ensure the message is visible + + // Optionally hide the message after a few seconds + setTimeout(() => { + successMessage.style.display = "none"; // Hide message after 3 seconds + }, 3000); +} diff --git a/templates/about_us.html b/templates/about_us.html index d31efde..837e593 100644 --- a/templates/about_us.html +++ b/templates/about_us.html @@ -57,7 +57,7 @@ TRL Community with an easy go-to way to calculate DPS and DPM values to help players make informed decisions about their gameplay. Whether you're fine-tuning your new Deathwish Strategy or simply curious about firearm performance, we’ve got you covered. If you have suggestions, feedback, or want to contribute new stats or - features, we’d love to hear from you, just contact us on Discord! + features, we’d love to hear from you, just contact us on Discord or on the Suggestion Page!

Our Story

diff --git a/templates/suggestion.html b/templates/suggestion.html index 554eb30..66fd282 100644 --- a/templates/suggestion.html +++ b/templates/suggestion.html @@ -63,34 +63,11 @@

+ + +

- + From 40a1c628f8f15b20e438970518b26c463d90a679 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Tue, 17 Sep 2024 14:25:31 +0200 Subject: [PATCH 05/50] minor change --- static/filterWeapons.js | 132 ++++++++++++++++---------- static/json/modifiers.json | 60 ++++++++---- static/json/operative.json | 189 +++++++++++++++++++++++++++++++++++-- templates/calculator.html | 3 +- 4 files changed, 307 insertions(+), 77 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index cc3311f..66fb089 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -1,6 +1,7 @@ let selectedWeapon = null; // Store the selected weapon's data let weapons = []; // This will be populated by the fetched JSON data let selectedOperative = null; // Store the selected operative's data +let globalModifiers = []; // Function to fetch operatives data from JSON function fetchOperativesData() { @@ -34,6 +35,41 @@ function populateOperatives(operatives) { }); } +function updateOperativeBuffs(operative) { + const operativeModifiers = operative.modifiers || []; + + // Remove previously added operative-specific modifiers + const operativeSection = document.getElementById('operative-modifiers'); + operativeSection.innerHTML = ''; // Clear existing operative modifiers + + // If the operative has specific modifiers, show them + if (operativeModifiers.length > 0) { + operativeModifiers.forEach(mod => { + const label = document.createElement('label'); + const input = document.createElement('input'); + input.type = 'checkbox'; + input.id = mod.id; + input.value = mod.value; + input.dataset.type = mod.type; + + // Automatically check the box if you want it enabled by default + input.checked = true; + + label.appendChild(input); + label.appendChild(document.createTextNode(mod.label)); + operativeSection.appendChild(label); + operativeSection.appendChild(document.createElement('br')); + }); + } + + // Make sure that each operative-specific modifier checkbox triggers recalculation when changed + operativeSection.addEventListener('change', applyModifiers); + + // Trigger recalculation once the operative buffs are displayed + applyModifiers(); +} + + // Function to fetch weapons data from JSON function fetchWeaponsData() { fetch('static/json/data.json') // Adjust the path to the actual location of your JSON file @@ -93,7 +129,8 @@ function fetchModifiers() { fetch('static/json/modifiers.json') // Adjust the path to your JSON file .then(response => response.json()) .then(data => { - populateModifiers(data); + globalModifiers = data; // Save global modifiers for future use + populateModifiers(data); // Populate the modifiers in the UI }) .catch(error => console.error('Error fetching modifiers:', error)); } @@ -154,88 +191,85 @@ function populateModifiers(modifiers) { function applyModifiers() { if (!selectedWeapon) return; - // Get the base stats from the selected weapon + // Base stats let baseDamage = selectedWeapon.damage * selectedWeapon.damage_multiplier; let baseRpm = selectedWeapon.rpm; let baseReloadTime = selectedWeapon.reload_time; - // Initialize the modifier objects - let damageModifier = {additive: 0, multiplicative: 1}; - let rpmModifier = {additive: 0, multiplicative: 1}; - let reloadTimeModifier = {additive: 0, multiplicative: 1}; + // Modifiers initialization + let damageModifier = { additive: 0, multiplicative: 1 }; + let rpmModifier = { additive: 0, multiplicative: 1 }; + let reloadTimeModifier = { additive: 0, multiplicative: 1 }; - // Collect checked modifier values - document.querySelectorAll('#modifiers input:checked').forEach(mod => { - const modType = mod.dataset.type; - const modValue = parseFloat(mod.value); - - // Handle multi-buff modifiers (like Bloxy Cola or Firefight) + // Function to process individual modifiers + const processModifier = (mod, rpmModifier, reloadTimeModifier, damageModifier) => { + // Handle multi-buff modifiers if (mod.dataset.buffs) { - const buffs = JSON.parse(mod.dataset.buffs); // Parse buffs data from the data-buffs attribute + const buffs = JSON.parse(mod.dataset.buffs); buffs.forEach(buff => { - // Apply each buff applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier); }); } else { - // Handle single-buff modifiers + // Single buff modifier const singleBuff = { - type: modType === 'multiplicative' ? 'multiplicative' : 'additive', // Use the proper modifier type - buffType: modType, - value: modValue + type: mod.dataset.type === 'multiplicative' ? 'multiplicative' : 'additive', + value: parseFloat(mod.value) }; - if (mod.id.includes('damage')) { - singleBuff.type = 'damage'; // This mod applies to damage - } else if (mod.id.includes('rpm')) { - singleBuff.type = 'rpm'; // This mod applies to RPM - } else if (mod.id.includes('reload')) { - singleBuff.type = 'reloadTime'; // This mod applies to reload time - } - - // Apply the single buff - applyBuff(singleBuff, rpmModifier, reloadTimeModifier, damageModifier); + // Apply the single buff depending on its stat + if (mod.id.includes('damage')) applyBuff({ stat: 'damage', ...singleBuff }, rpmModifier, reloadTimeModifier, damageModifier); + if (mod.id.includes('rpm')) applyBuff({ stat: 'rpm', ...singleBuff }, rpmModifier, reloadTimeModifier, damageModifier); + if (mod.id.includes('reload')) applyBuff({ stat: 'reloadTime', ...singleBuff }, rpmModifier, reloadTimeModifier, damageModifier); } + }; + + // Process global modifiers + document.querySelectorAll('#modifiers input:checked').forEach(mod => { + processModifier(mod, rpmModifier, reloadTimeModifier, damageModifier); }); - // Apply the damage modifiers - let damage = baseDamage * damageModifier.multiplicative; // First apply multiplicative modifiers - damage += damageModifier.additive; // Then apply percentage-based additive modifiers + // Process operative-specific modifiers + if (selectedOperative) { + document.querySelectorAll('#operative-modifiers input:checked').forEach(mod => { + processModifier(mod, rpmModifier, reloadTimeModifier, damageModifier); + }); + } + + // Recalculate with applied modifiers + let damage = baseDamage * damageModifier.multiplicative; + damage += damageModifier.additive; - // Apply the RPM modifiers let rpm = baseRpm * rpmModifier.multiplicative; - rpm = rpm + (rpm * rpmModifier.additive); + rpm += rpm * rpmModifier.additive; - // Apply the reload time modifiers let reloadTime = baseReloadTime * reloadTimeModifier.multiplicative; - reloadTime = reloadTime + (reloadTime * reloadTimeModifier.additive); + reloadTime += reloadTime * reloadTimeModifier.additive; - // Recalculate DPS and DPM with the modified stats calculateDPSAndDPM(damage, rpm, selectedWeapon.mag_size, reloadTime); - - // Update the displayed weapon stats with the modified values updateModifiedWeaponStats(damage, rpm, reloadTime); } + // Helper function to apply individual buffs function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier = null) { - const {type, buffType, value} = buff; + const {stat, type, value} = buff; - // Apply buffs based on type - if (type === 'rpm') { - if (buffType === 'multiplicative') rpmModifier.multiplicative *= value; - else if (buffType === 'additive') rpmModifier.additive += value; + // Apply buffs based on the stat being modified + if (stat === 'rpm') { + if (type === 'multiplicative') rpmModifier.multiplicative *= value; + else if (type === 'additive') rpmModifier.additive += value; } - if (type === 'reloadTime') { - if (buffType === 'multiplicative') reloadTimeModifier.multiplicative *= value; - else if (buffType === 'additive') reloadTimeModifier.additive += value; + if (stat === 'reloadTime') { + if (type === 'multiplicative') reloadTimeModifier.multiplicative *= value; + else if (type === 'additive') reloadTimeModifier.additive += value; } // Apply damage buffs - if (type === 'damage' && damageModifier) { - if (buffType === 'multiplicative') damageModifier.multiplicative *= value; - else if (buffType === 'additive') damageModifier.additive += value; + if (stat === 'damage' && damageModifier) { + if (type === 'multiplicative') damageModifier.multiplicative *= value; + else if (type === 'additive') damageModifier.additive += value; } } diff --git a/static/json/modifiers.json b/static/json/modifiers.json index 95c290c..140b8a9 100644 --- a/static/json/modifiers.json +++ b/static/json/modifiers.json @@ -4,25 +4,29 @@ "id": "damage-item-additive-elite-he-rounds", "label": "Elite HE Rounds (+14 damage)", "value": 14, - "type": "additive" + "type": "additive", + "operatives": [] }, { "id": "damage-item-additive-he-rounds", "label": "HE Rounds (+8 damage)", "value": 8, - "type": "additive" + "type": "additive", + "operatives": [] }, { "id": "damage-item-multiplicative-strength-mixture", "label": "Strength Mixture (+20% damage)", "value": 1.2, - "type": "multiplicative" + "type": "multiplicative", + "operatives": [] }, { "id": "damage-item-multiplicative-fortunos-necklace", "label": "Fortunos Necklace (+15% damage)", "value": 1.15, - "type": "multiplicative" + "type": "multiplicative", + "operatives": [] }, { "id": "multiple-buffs-bloxy-cola", @@ -38,19 +42,22 @@ "value": 0, "buffType": "multiplicative" } - ] + ], + "operatives": [] }, { "id": "damage-item-multiplicative-enhancer", "label": "Enhancer (+10% damage)", "value": 1.1, - "type": "multiplicative" + "type": "multiplicative", + "operatives": [] }, { "id": "damage-item-multiplicative-teleport-device", "label": "Teleport Device (+25% damage)", "value": 1.25, - "type": "multiplicative" + "type": "multiplicative", + "operatives": [] } ], "operativePerks": [ @@ -58,25 +65,29 @@ "id": "damage-perk-multiplicative-fbi-badge", "label": "FBI Badge (+10% Damage)", "value": 1.1, - "type": "multiplicative" + "type": "multiplicative", + "operatives": [] }, { "id": "damage-perk-multiplicative-anatomy-book", "label": "Anatomy Book (+5% Damage)", "value": 1.05, - "type": "multiplicative" + "type": "multiplicative", + "operatives": [] }, { "id": "damage-perk-multiplicative-silly-soldier", "label": "Silly Soldier (+10% Damage)", "value": 1.10, - "type": "multiplicative" + "type": "multiplicative", + "operatives": [] }, { "id": "damage-perk-multiplicative-precise-shots", "label": "Precise Shots (+15% Damage)", - "value": 1.15, - "type": "multiplicative" + "value": 1.40, + "type": "multiplicative", + "operatives": [] }, { "id": "damage-perk-multiplicative-goc-insignia", @@ -92,7 +103,8 @@ "value": 0.85, "buffType": "multiplicative" } - ] + ], + "operatives": [] } ], "abilityPerks": [ @@ -110,17 +122,20 @@ "value": 0.6, "buffType": "multiplicative" } - ] + ], + "operatives": [] }, { "id": "damage-ability-multiplicative-heath-spawn", "label": "[All Operatives] Heath Spawn (+30% Damage)", "value": 1.3, - "type": "multiplicative" + "type": "multiplicative", + "operatives": [] }, { "id": "multiple-buffs-warcry", "label": "[All Operatives] War Cry(+25% Damage, +?% Reload Speed)", + "operatives": [], "buffs": [ { "type": "damage", @@ -138,31 +153,36 @@ "id": "damage-ability-multiplicative-blackout", "label": "[All Operatives] Blackout (+30% Damage)", "value": 1.3, - "type": "multiplicative" + "type": "multiplicative", + "operatives": [] }, { "id": "damage-ability-multiplicative-red-scan", "label": "[All Operatives] Red Scan (+30% Damage)", "value": 1.3, - "type": "multiplicative" + "type": "multiplicative", + "operatives": [] }, { "id": "damage-ability-multiplicative-red-scan", "label": "[All Operatives] Green Scan (+50% Damage)", "value": 1.5, - "type": "multiplicative" + "type": "multiplicative", + "operatives": [] }, { "id": "damage-ability-multiplicative-point-out", "label": "[All Operatives] Point Out (+50% Damage)", "value": 1.5, - "type": "multiplicative" + "type": "multiplicative", + "operatives": [] }, { "id": "damage-item-additive-5-uiu-elite", "label": "[All Operatives] 5 UIU Elite nearby (+25 damage)", "value": 25, - "type": "additive" + "type": "additive", + "operatives": [] } ] } diff --git a/static/json/operative.json b/static/json/operative.json index 45f5482..d8f0a15 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -3,7 +3,16 @@ { "id": "Classic-Guard", "name": "Guard", - "category": "Classic" + "category": "Classic", + "modifiers": [ + { + "id": "smg-user-damage-perk", + "label": "SMG User (+15% Damage)", + "value": 1.15, + "type": "multiplicative", + "appliesTo": "SMG" + } + ] }, { "id": "Classic-Scout", @@ -13,7 +22,16 @@ { "id": "Classic-RCU", "name": "RCU", - "category": "Classic" + "category": "Classic", + "modifiers": [ + { + "id": "shotgun-expert-damage-perk", + "label": "Shotgun Expert (+25% Damage)", + "value": 1.25, + "type": "multiplicative", + "appliesTo": "SHOTGUN" + } + ] }, { "id": "Classic-Viper", @@ -23,7 +41,16 @@ { "id": "Classic-SD-Sergeant", "name": "SD Sergeant", - "category": "Classic" + "category": "Classic", + "modifiers": [ + { + "id": "max-corruption-damage-perk", + "label": "Max Corruption (+30% Damage)", + "value": 1.30, + "type": "multiplicative", + "appliesTo": "" + } + ] }, { "id": "Classic-ISD", @@ -43,17 +70,73 @@ { "id": "Classic-Vanguard", "name": "Vanguard", - "category": "Classic" + "category": "Classic", + "modifiers": [ + { + "id": "bad-experience-damage-perk", + "label": "Bad Experience (+25% Damage, +25% Reload Speed)", + "buffs": [ + { + "type": "damage", + "value": 1.25, + "buffType": "multiplicative" + }, + { + "type": "reloadTime", + "value": 0.75, + "buffType": "multiplicative" + } + ], + "appliesNotTo": "LMG" + }, + { + "id": "lmg-user-damage-perk", + "label": "LMG User (+35% Damage)", + "value": 1.35, + "type": "multiplicative", + "appliesNotTo": "LMG" + } + ] }, { "id": "Classic-Demolitionist", "name": "Demolitionist", "category": "Classic" }, + { + "id": "Classic-Juggernaut", + "name": "Juggernaut", + "category": "Classic", + "modifiers": [ + { + "id": "hold-the-line-damage-perk", + "label": "Hold The Line (+90% Damage)", + "value": 1.90, + "type": "multiplicative", + "appliesTo": "" + } + ] + }, { "id": "Classic-Mercenary", "name": "Mercenary", - "category": "Classic" + "category": "Classic", + "modifiers": [ + { + "id": "all-upgrades-damage-perk", + "label": "All Upgrades (+25% Damage, +15% Reload Speed)", + "value": 1.25, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "mcd-sandevistan-damage-perk", + "label": "All Upgrades (+75% Damage)", + "value": 1.75, + "type": "multiplicative", + "appliesTo": "" + } + ] }, { "id": "Classic-CRT", @@ -63,7 +146,99 @@ { "id": "Classic-Anarchist", "name": "Anarchist", - "category": "Classic" + "category": "Classic", + "modifiers": [ + { + "id": "last-stand-damage-perk", + "label": "Last Stand (+150% Damage)", + "value": 2.5, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "world-on-fire-damage-perk", + "label": "World on fire (+150% Damage)", + "value": 2.5, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "adrenaline-damage-perk", + "label": "All Upgrades (+30% Damage)", + "value": 1.3, + "type": "multiplicative", + "appliesTo": "" + } + ] + }, + { + "id": "Special-Squid-Guard", + "name": "Squid Guard", + "category": "Special", + "modifiers": [ + { + "id": "smg-user-damage-perk", + "label": "SMG User (+15% Damage)", + "value": 1.15, + "type": "multiplicative", + "appliesTo": "SMG" + } + ] + }, + { + "id": "Special-Researcher", + "name": "Researcher", + "category": "Special", + "modifiers": [] + }, + { + "id": "Special-RRT", + "name": "RRT", + "category": "Special", + "modifiers": [ + { + "id": "smg-user-damage-perk", + "label": "SMG User (+15% Damage)", + "value": 1.15, + "type": "multiplicative", + "appliesTo": "SMG" + }, + { + "id": "weapon-expert-reload-perk", + "label": "Weapon Expert (-1s Reload Time)", + "value": -1, + "type": "additive", + "appliesTo": "" + }, + { + "id": "rrt-mastery-damage-rpm-perk", + "label": "Mastery (+25% Firerate, +25% Damage)", + "value": 1.25, + "type": "multiplicative", + "appliesTo": "" + } + ] + }, + { + "id": "Special-Private", + "name": "Private", + "category": "Special", + "modifiers": [ + { + "id": "nostalgia-reload-perk", + "label": "Nostalgia (+10% Reload Speed)", + "value": 0.9, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "adrenaline-damage-reload-perk", + "label": "Adrenaline (+30% Damage, +40% Reload Speed)", + "value": 1.3, + "type": "multiplicative", + "appliesTo": "" + } + ] } ] -} +} \ No newline at end of file diff --git a/templates/calculator.html b/templates/calculator.html index 29c543f..034a2c0 100644 --- a/templates/calculator.html +++ b/templates/calculator.html @@ -72,7 +72,8 @@
- +

Operative Specific Modifiers

+
From 10499b570208a15e5c63139e8ce451e05497cb6e Mon Sep 17 00:00:00 2001 From: IM23a-bachmannj2 Date: Tue, 17 Sep 2024 18:19:53 +0200 Subject: [PATCH 06/50] updated operative.json --- static/json/operative.json | 100 +++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/static/json/operative.json b/static/json/operative.json index d8f0a15..30c09f4 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -237,6 +237,106 @@ "value": 1.3, "type": "multiplicative", "appliesTo": "" + }, + { + "id": "private-mastery-damage-perk", + "label": "Mastery (+32% Damage)", + "value": 1.32, + "type": "multiplicative", + "appliesTo": "WW2" + } + ] + }, + { + "id": "Special-Delta", + "name": "Delta", + "category": "Special", + "modifiers": [ + { + "id": "weakpoints-damage-perk", + "label": "Weakpoints (+50% Damage)", + "value": 1.5, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "mastery-resurrection-damage-perk", + "label": "Resurrection (+100% Damage)", + "value": 2, + "type": "multiplicative", + "appliesTo": "" + } + ] + }, + { + "id": "Special-Engineer", + "name": "Engineer", + "category": "Special", + "modifiers": [] + }, + { + "id": "Special-Hunter", + "name": "Hunter", + "category": "Special", + "modifiers": [ + { + "id": "camper-damage-perk", + "label": "Camper (+25% Damage)", + "value": 1.25, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "detect-damage-perk", + "label": "Detect (+25% Damage)", + "value": 1.25, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "reaper-ammunition-damage-perk", + "label": "Reaper ammunition (+30% Damage)", + "value": 1.3, + "type": "multiplicative", + "appliesTo": "" + } + ] + }, + { + "id": "Special-Agent-X", + "name": "Agent X", + "category": "Special", + "modifiers": [ + { + "id": "agent-training-rifle-damage-perk", + "label": "Agent training [RIFLE] (+15% Damage)", + "value": 1.15, + "type": "multiplicative", + "appliesTo": "RIFLE" + }, + { + "id": "agent-training-smg-damage-perk", + "label": "Agent training [SMG] (+25% Damage, 30% Reload Speed)", + "buffs": [ + { + "type": "damage", + "value": 1.25, + "buffType": "multiplicative" + }, + { + "type": "reloadTime", + "value": 0.7, + "buffType": "multiplicative" + } + ], + "appliesTo": "SMG" + }, + { + "id": "sandevistan-damage-perk", + "label": "Sandevistan (+75% Damage)", + "value": 1.75, + "type": "multiplicative", + "appliesTo": "" } ] } From 96622eae771a9a50f2c584007eb7e3327c7d26f5 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Tue, 17 Sep 2024 20:51:15 +0200 Subject: [PATCH 07/50] fixed bloxy cola (critical error) lol --- static/filterWeapons.js | 64 ++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 66fb089..e921faa 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -168,7 +168,6 @@ function populateModifiers(modifiers) { return section; }; - // Clear any existing modifiers modifiersContainer.innerHTML = ''; @@ -197,45 +196,51 @@ function applyModifiers() { let baseReloadTime = selectedWeapon.reload_time; // Modifiers initialization - let damageModifier = { additive: 0, multiplicative: 1 }; - let rpmModifier = { additive: 0, multiplicative: 1 }; - let reloadTimeModifier = { additive: 0, multiplicative: 1 }; + let damageModifier = {additive: 0, multiplicative: 1}; + let rpmModifier = {additive: 0, multiplicative: 1}; + let reloadTimeModifier = {additive: 0, multiplicative: 1}; // Function to process individual modifiers - const processModifier = (mod, rpmModifier, reloadTimeModifier, damageModifier) => { - // Handle multi-buff modifiers + const processModifier = (mod) => { + const modType = mod.dataset.type; + const modValue = parseFloat(mod.value); if (mod.dataset.buffs) { - const buffs = JSON.parse(mod.dataset.buffs); + const buffs = JSON.parse(mod.dataset.buffs); // Parse buffs data from the data-buffs attribute buffs.forEach(buff => { + // Apply each buff applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier); }); } else { - // Single buff modifier const singleBuff = { - type: mod.dataset.type === 'multiplicative' ? 'multiplicative' : 'additive', - value: parseFloat(mod.value) + type: modType === 'multiplicative' ? 'multiplicative' : 'additive', // Use the proper modifier type + buffType: modType, + value: modValue }; - // Apply the single buff depending on its stat - if (mod.id.includes('damage')) applyBuff({ stat: 'damage', ...singleBuff }, rpmModifier, reloadTimeModifier, damageModifier); - if (mod.id.includes('rpm')) applyBuff({ stat: 'rpm', ...singleBuff }, rpmModifier, reloadTimeModifier, damageModifier); - if (mod.id.includes('reload')) applyBuff({ stat: 'reloadTime', ...singleBuff }, rpmModifier, reloadTimeModifier, damageModifier); + if (mod.id.includes('damage')) { + singleBuff.type = 'damage'; // This mod applies to damage + } else if (mod.id.includes('rpm')) { + singleBuff.type = 'rpm'; // This mod applies to RPM + } else if (mod.id.includes('reload')) { + singleBuff.type = 'reloadTime'; // This mod applies to reload time + } + applyBuff(singleBuff, rpmModifier, reloadTimeModifier, damageModifier); } }; - // Process global modifiers +// Process global modifiers document.querySelectorAll('#modifiers input:checked').forEach(mod => { - processModifier(mod, rpmModifier, reloadTimeModifier, damageModifier); + processModifier(mod); }); - // Process operative-specific modifiers +// Process operative-specific modifiers if (selectedOperative) { document.querySelectorAll('#operative-modifiers input:checked').forEach(mod => { - processModifier(mod, rpmModifier, reloadTimeModifier, damageModifier); + processModifier(mod); }); } - // Recalculate with applied modifiers +// Recalculate with applied modifiers let damage = baseDamage * damageModifier.multiplicative; damage += damageModifier.additive; @@ -250,26 +255,25 @@ function applyModifiers() { } - // Helper function to apply individual buffs function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier = null) { - const {stat, type, value} = buff; + const {type, buffType, value} = buff; // Apply buffs based on the stat being modified - if (stat === 'rpm') { - if (type === 'multiplicative') rpmModifier.multiplicative *= value; - else if (type === 'additive') rpmModifier.additive += value; + if (type === 'rpm') { + if (buffType === 'multiplicative') rpmModifier.multiplicative *= value; + else if (buffType === 'additive') rpmModifier.additive += value; } - if (stat === 'reloadTime') { - if (type === 'multiplicative') reloadTimeModifier.multiplicative *= value; - else if (type === 'additive') reloadTimeModifier.additive += value; + if (type === 'reloadTime') { + if (buffType === 'multiplicative') reloadTimeModifier.multiplicative *= value; + else if (buffType === 'additive') reloadTimeModifier.additive += value; } // Apply damage buffs - if (stat === 'damage' && damageModifier) { - if (type === 'multiplicative') damageModifier.multiplicative *= value; - else if (type === 'additive') damageModifier.additive += value; + if (type === 'damage' && damageModifier) { + if (buffType === 'multiplicative') damageModifier.multiplicative *= value; + else if (buffType === 'additive') damageModifier.additive += value; } } From a120cd7e37964ef26f542e64372fc74f1ca54c4f Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Wed, 18 Sep 2024 22:31:50 +0200 Subject: [PATCH 08/50] everything is done, now we need to add all operatives --- static/filterWeapons.js | 92 +++++++++++++++++++++++++++++--------- static/json/operative.json | 57 +++++++++++++++++++---- 2 files changed, 119 insertions(+), 30 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index e921faa..166505f 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -51,9 +51,10 @@ function updateOperativeBuffs(operative) { input.id = mod.id; input.value = mod.value; input.dataset.type = mod.type; + input.dataset.buffs = mod.buffs ? JSON.stringify(mod.buffs) : ''; // Store buffs if available - // Automatically check the box if you want it enabled by default - input.checked = true; + // Set checkbox to be unchecked by default + input.checked = false; label.appendChild(input); label.appendChild(document.createTextNode(mod.label)); @@ -200,47 +201,97 @@ function applyModifiers() { let rpmModifier = {additive: 0, multiplicative: 1}; let reloadTimeModifier = {additive: 0, multiplicative: 1}; - // Function to process individual modifiers + // Function to process global modifiers const processModifier = (mod) => { - const modType = mod.dataset.type; - const modValue = parseFloat(mod.value); + if (mod.appliesNotTo && mod.appliesNotTo === selectedWeapon.guntype) { + return; // Skip this modifier + } + if (mod.appliesTo && mod.appliesTo !== selectedWeapon.guntype) { + return; // Skip this modifier + } + + // Handle modifiers with multiple buffs if (mod.dataset.buffs) { - const buffs = JSON.parse(mod.dataset.buffs); // Parse buffs data from the data-buffs attribute + const buffs = JSON.parse(mod.dataset.buffs); buffs.forEach(buff => { - // Apply each buff applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier); }); } else { + const modType = mod.dataset.type; + const modValue = parseFloat(mod.value); + const singleBuff = { - type: modType === 'multiplicative' ? 'multiplicative' : 'additive', // Use the proper modifier type + type: modType === 'multiplicative' ? 'multiplicative' : 'additive', buffType: modType, value: modValue }; if (mod.id.includes('damage')) { - singleBuff.type = 'damage'; // This mod applies to damage + singleBuff.type = 'damage'; } else if (mod.id.includes('rpm')) { - singleBuff.type = 'rpm'; // This mod applies to RPM + singleBuff.type = 'rpm'; } else if (mod.id.includes('reload')) { - singleBuff.type = 'reloadTime'; // This mod applies to reload time + singleBuff.type = 'reloadTime'; } applyBuff(singleBuff, rpmModifier, reloadTimeModifier, damageModifier); } }; -// Process global modifiers + // Function to process operative-based modifiers + const processOperativeModifier = (mod) => { + if (mod.appliesNotTo && mod.appliesNotTo === selectedWeapon.guntype) { + return; // Skip this modifier for this weapon type + } + if (mod.appliesTo && mod.appliesTo !== selectedWeapon.guntype) { + return; // Skip if the modifier does not apply to this weapon type + } + + // Handle operative modifiers with multiple buffs + if (mod.buffs) { + mod.buffs.forEach(buff => { + applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier); + }); + } else { + const modValue = parseFloat(mod.value); + const modType = mod.type || 'additive'; + + const singleBuff = { + type: mod.id.includes('damage') ? 'damage' : mod.id.includes('rpm') ? 'rpm' : 'reloadTime', + buffType: modType === 'multiplicative' ? 'multiplicative' : 'additive', + value: modValue + }; + + applyBuff(singleBuff, rpmModifier, reloadTimeModifier, damageModifier); + } + }; + + // Clear out listeners and avoid re-adding + const modifiersContainer = document.getElementById('modifiers'); + modifiersContainer.removeEventListener('change', applyModifiers); + + // Process global modifiers document.querySelectorAll('#modifiers input:checked').forEach(mod => { processModifier(mod); }); -// Process operative-specific modifiers - if (selectedOperative) { - document.querySelectorAll('#operative-modifiers input:checked').forEach(mod => { - processModifier(mod); - }); - } -// Recalculate with applied modifiers + // Re-apply listener after change + modifiersContainer.addEventListener('change', applyModifiers); + + // Process operative-specific modifiers + // Process operative-specific modifiers that are checked + const operativeSection = document.getElementById('operative-modifiers'); + operativeSection.querySelectorAll('input:checked').forEach(mod => { + if (selectedOperative && selectedOperative.modifiers) { + const modObj = selectedOperative.modifiers.find(m => m.id === mod.id); + if (modObj) { + processOperativeModifier(modObj); + } + } + }); + + + // Recalculate with applied modifiers let damage = baseDamage * damageModifier.multiplicative; damage += damageModifier.additive; @@ -254,8 +305,7 @@ function applyModifiers() { updateModifiedWeaponStats(damage, rpm, reloadTime); } - -// Helper function to apply individual buffs +// Function to apply individual buffs (simplified to avoid mistakes) function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier = null) { const {type, buffType, value} = buff; diff --git a/static/json/operative.json b/static/json/operative.json index 30c09f4..2593143 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -55,7 +55,16 @@ { "id": "Classic-ISD", "name": "ISD", - "category": "Classic" + "category": "Classic", + "modifiers": [ + { + "id": "chaos-insurgency-damage-perk", + "label": "Chaos Insurgency (+50% Damage)", + "value": 1.50, + "type": "multiplicative", + "appliesTo": "" + } + ] }, { "id": "Classic-TRU", @@ -94,7 +103,7 @@ "label": "LMG User (+35% Damage)", "value": 1.35, "type": "multiplicative", - "appliesNotTo": "LMG" + "appliesTo": "LMG" } ] }, @@ -125,13 +134,23 @@ { "id": "all-upgrades-damage-perk", "label": "All Upgrades (+25% Damage, +15% Reload Speed)", - "value": 1.25, - "type": "multiplicative", + "buffs": [ + { + "type": "damage", + "value": 1.25, + "buffType": "multiplicative" + }, + { + "type": "reloadTime", + "value": 0.85, + "buffType": "multiplicative" + } + ], "appliesTo": "" }, { "id": "mcd-sandevistan-damage-perk", - "label": "All Upgrades (+75% Damage)", + "label": "MCD Sandevistan (+75% Damage)", "value": 1.75, "type": "multiplicative", "appliesTo": "" @@ -213,8 +232,18 @@ { "id": "rrt-mastery-damage-rpm-perk", "label": "Mastery (+25% Firerate, +25% Damage)", - "value": 1.25, - "type": "multiplicative", + "buffs": [ + { + "type": "damage", + "value": 1.25, + "buffType": "multiplicative" + }, + { + "type": "rpm", + "value": 1.25, + "buffType": "multiplicative" + } + ], "appliesTo": "" } ] @@ -234,8 +263,18 @@ { "id": "adrenaline-damage-reload-perk", "label": "Adrenaline (+30% Damage, +40% Reload Speed)", - "value": 1.3, - "type": "multiplicative", + "buffs": [ + { + "type": "damage", + "value": 1.30, + "buffType": "multiplicative" + }, + { + "type": "reloadTime", + "value": 0.6, + "buffType": "multiplicative" + } + ], "appliesTo": "" }, { From c2c51fe8be2309e8dd1582519d2dd4ba30218c34 Mon Sep 17 00:00:00 2001 From: IM23a-bachmannj2 Date: Thu, 19 Sep 2024 09:35:45 +0200 Subject: [PATCH 09/50] changed the way how data.json is called --- app.py | 30 ------------------------------ static/populateTable.js | 28 ++++++++++++++++++++++++---- templates/calculator.html | 16 ++++++++++++++++ 3 files changed, 40 insertions(+), 34 deletions(-) diff --git a/app.py b/app.py index e638851..4e2db2e 100644 --- a/app.py +++ b/app.py @@ -3,42 +3,12 @@ import json app = Flask(__name__) -# Load the data from the JSON file -with open('static/json/data.json') as f: - guns = json.load(f) - @app.route('/') def index(): return render_template('index.html') -@app.route('/api/guns', methods=['GET']) -def get_guns(): - updated_guns = [] - for gun in guns: - original_damage = gun['damage'] - # Calculate RPS, DPS, DPM, avgDPS - rps = gun['rpm'] / 60 - dps = original_damage * rps - reload_time_min = gun['reload_time'] / 60 - dpm = (gun['mag_size'] * original_damage) / (reload_time_min + (gun['mag_size'] / gun['rpm'])) - avg_dps = dpm / 60 - total_damage = original_damage * gun['damage_multiplier'] - - # Add calculated stats to the gun data - gun.update({ - 'total_damage': total_damage, - 'rps': rps, - 'dps': dps, - 'dpm': dpm, - 'avg_dps': avg_dps - }) - updated_guns.append(gun) - - return jsonify(updated_guns) - - @app.route('/calculator') def calculator(): return render_template('calculator.html') diff --git a/static/populateTable.js b/static/populateTable.js index 5fb55e9..b8c35a6 100644 --- a/static/populateTable.js +++ b/static/populateTable.js @@ -1,8 +1,28 @@ document.addEventListener('DOMContentLoaded', () => { - fetch('/api/guns') + fetch('/static/json/data.json') // Fetch the JSON file directly .then(response => response.json()) .then(data => { - populateTable(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']; + + // Add the calculated stats to the gun object + return { + ...gun, + total_damage: total_damage, + rps: rps, + dps: dps, + dpm: dpm, + avg_dps: avg_dps + }; + }); + + populateTable(updatedGuns); }); }); @@ -13,7 +33,7 @@ function populateTable(data) { const row = table.insertRow(); row.insertCell(0).innerText = gun.id; row.insertCell(1).innerText = gun.name; - row.insertCell(2).innerText = gun.total_damage; + row.insertCell(2).innerText = gun.total_damage.toFixed(2); row.insertCell(3).innerText = gun.rpm; row.insertCell(4).innerText = gun.mag_size; row.insertCell(5).innerText = gun.reload_time; @@ -23,4 +43,4 @@ function populateTable(data) { row.insertCell(9).innerText = gun.dpm.toFixed(2); row.insertCell(10).innerText = gun.avg_dps.toFixed(2); }); -} \ No newline at end of file +} diff --git a/templates/calculator.html b/templates/calculator.html index 034a2c0..125850b 100644 --- a/templates/calculator.html +++ b/templates/calculator.html @@ -26,6 +26,22 @@ dropdownContent.style.display = "block"; } } + + // Collapsible functionality for perks, buffs, etc. + document.addEventListener('DOMContentLoaded', function () { + var coll = document.getElementsByClassName("collapsible-header"); + for (var i = 0; i < coll.length; i++) { + coll[i].addEventListener("click", function() { + this.classList.toggle("active"); + var content = this.nextElementSibling; + if (content.style.display === "block") { + content.style.display = "none"; + } else { + content.style.display = "block"; + } + }); + } + });
From 45947aaf843aefb13f333f256b28d9b2a2d2f865 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Thu, 19 Sep 2024 11:37:29 +0200 Subject: [PATCH 10/50] expanded on operatives --- static/json/operative.json | 328 +++++++++++++++++++++++++++++++++++++ 1 file changed, 328 insertions(+) diff --git a/static/json/operative.json b/static/json/operative.json index 2593143..697b9ba 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -378,6 +378,334 @@ "appliesTo": "" } ] + }, + { + "id": "Special-Hacker", + "name": "Hacker", + "category": "Special" + }, + { + "id": "Special-Accountant", + "name": "Accountant", + "category": "Special" + }, + { + "id": "Special-Hogrider", + "name": "Hog Rider", + "category": "Special" + }, + { + "id": "Special-IA", + "name": "Intelligence Agency", + "category": "Special", + "modifiers": [ + { + "id": "field-intelligence-damage-perk", + "label": "Field Intelligence (+20% Damage)", + "value": 1.2, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "front-runner-damage-perk", + "label": "Front Runner (+?% Damage)", + "value": 1, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "front-runner-damage-perk", + "label": "Front Runner (+?% Damage)", + "buffs": [ + { + "type": "reloadTime", + "value": 0, + "buffType": "multiplicative" + } + ], + "appliesTo": "SMG" + }, + { + "id": "IA-smg-damage-perk", + "label": "SMG User (+15% Damage)", + "value": 1.15, + "type": "multiplicative", + "appliesTo": "SMG" + } + ] + }, + { + "id": "Special-High-Roller", + "name": "High Roller", + "category": "Special", + "modifiers": [ + { + "id": "lucky-shot-damage-perk", + "label": "Lucky Shot (+100% Damage)", + "value": 2, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "risk-taker-damage-perk", + "label": "4 Experiments (+10% Damage, +10% Firerate)", + "buffs": [ + { + "type": "damage", + "value": 1.1, + "buffType": "multiplicative" + }, + { + "type": "rpm", + "value": 1.1, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "coinflip-damage-perk", + "label": "Coinflip (+20% Damage)", + "value": 1.20, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "coinflip-reload-perk", + "label": "Coinflip (+20% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.8, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "coinflip-damage-perk-2", + "label": "Coinflip (+100% Damage)", + "value": 2, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "maxed-stat-roll-damage-perk", + "label": "Maxed Stat Roll (+20% Damage, +20% Reload Speed)", + "buffs": [ + { + "type": "damage", + "value": 1.2, + "buffType": "multiplicative" + }, + { + "type": "reloadTime", + "value": 1.2, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "points-damage-perk", + "label": "6000 Points (+20% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.20, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "light-armor-damage-perk", + "label": "Light Armor [RIFLE] (+25% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.25, + "buffType": "multiplicative" + } + ], + "appliesTo": "RIFLE" + }, + { + "id": "heavy-armor-damage-perk", + "label": "Heavy Armor [LMG] (+25% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.25, + "buffType": "multiplicative" + } + ], + "appliesTo": "LMG" + }, + { + "id": "fireproof-armor-damage-perk", + "label": "Fireproof Armor [SHOTGUN] (+25% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.25, + "buffType": "multiplicative" + } + ], + "appliesTo": "SHOTGUN" + }, + { + "id": "hazmat-armor-damage-perk", + "label": "Hazmat Armor [SMG] (+25% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.25, + "buffType": "multiplicative" + } + ], + "appliesTo": "SMG" + }, + { + "id": "no-armor-damage-perk", + "label": "Armorless [SEMI-AUTO] (+25% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.25, + "buffType": "multiplicative" + } + ], + "appliesTo": "SEMI-AUTO" + } + ] + }, + { + "id": "Special-Veteran", + "name": "Veteran", + "category": "Special", + "modifiers": [ + { + "id": "advanced-ammo-damage-perk", + "label": "Advanced Ammo (+8 Damage)", + "value": 8, + "type": "additive", + "appliesTo": "" + }, + { + "id": "high-velocity-bullets-damage-perk", + "label": "High Velocity Bullets (+25% Damage)", + "value": 1.25, + "type": "multiplicative", + "appliesTo": "" + } + ] + }, + { + "id": "MTF-Epsilon-9", + "name": "Epsilon-9", + "category": "MTF" + }, + { + "id": "MTF-Nu-7", + "name": "Nu-7", + "category": "MTF", + "modifiers": [ + { + "id": "deadly-bullets-damage-perk", + "label": "Deadly Bullets (+30% Damage)", + "value": 1.3, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "weapon-expert-reload-perk", + "label": "Weapon Expert (-1s Reload Time)", + "value": -1, + "type": "additive", + "appliesTo": "" + } + ] + }, + { + "id": "MTF-Sigma-9", + "name": "Sigma-9", + "category": "MTF" + }, + { + "id": "MTF-Beta-7", + "name": "Beta-7", + "category": "MTF" + }, + { + "id": "MTF-Commander", + "name": "MTF Commander", + "category": "MTF", + "modifiers": [ + { + "id": "advanced-ammo-damage-perk", + "label": "Advanced Ammo (+8 Damage)", + "value": 8, + "type": "additive", + "appliesTo": "" + } + ] + }, + { + "id": "UIU-Assault", + "name": "UIU Assault", + "category": "UIU", + "modifiers": [ + { + "id": "uiu-assault-ar-user", + "label": "AR User [RIFLE] (+30% Damage)", + "value": 1.3, + "type": "multiplicative", + "appliesTo": "RIFLE" + } + ] + }, + { + "id": "UIU-HRU", + "name": "UIU HRU", + "category": "UIU", + "modifiers": [ + { + "id": "uiu-hru-full-metal-jacket", + "label": "Full Metal Jacket (+10% Damage)", + "value": 1.3, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "uiu-hru-skull-cracker", + "label": "Skull Cracker (+20% Damage)", + "value": 1.2, + "type": "multiplicative", + "appliesTo": "" + } + ] + }, + { + "id": "UIU-Marksman", + "name": "UIU Marksman", + "category": "UIU", + "modifiers": [ + { + "id": "camper-damage-perk", + "label": "Camper (+25% Damage)", + "value": 1.25, + "type": "multiplicative", + "appliesTo": "SEMI-AUTO" + }, + { + "id": "uiu-marksman-skull-cracker", + "label": "Skull Cracker (+20% Damage)", + "value": 1.2, + "type": "multiplicative", + "appliesTo": "" + } + ] } ] } \ No newline at end of file From 8a919dc24719aefe407418ba33b33929617c4563 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Thu, 19 Sep 2024 11:39:04 +0200 Subject: [PATCH 11/50] expanded on operatives --- static/json/operative.json | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/static/json/operative.json b/static/json/operative.json index 697b9ba..7007e59 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -693,7 +693,7 @@ "modifiers": [ { "id": "camper-damage-perk", - "label": "Camper (+25% Damage)", + "label": "Camper [SEMI-AUTO] (+25% Damage)", "value": 1.25, "type": "multiplicative", "appliesTo": "SEMI-AUTO" @@ -706,6 +706,27 @@ "appliesTo": "" } ] + }, + { + "id": "UIU-Elite", + "name": "UIU Elite", + "category": "UIU", + "modifiers": [ + { + "id": "uiu-elite-ar-user", + "label": "AR User [RIFLE] (+30% Damage)", + "value": 1.3, + "type": "multiplicative", + "appliesTo": "RIFLE" + }, + { + "id": "uiu-elite-moral-boost", + "label": "Moral Boost (+20% Damage)", + "value": 1.2, + "type": "multiplicative", + "appliesTo": "" + } + ] } ] } \ No newline at end of file From 6575c850d6b7d6d493bdcb0a8a733077dc87be2e Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Thu, 19 Sep 2024 11:40:44 +0200 Subject: [PATCH 12/50] expanded on operatives --- static/json/operative.json | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/static/json/operative.json b/static/json/operative.json index 7007e59..06391a3 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -414,8 +414,8 @@ "appliesTo": "" }, { - "id": "front-runner-damage-perk", - "label": "Front Runner (+?% Damage)", + "id": "SMG-Pro-reload-perk", + "label": "SMG Pro (+100% Reload Speed)", "buffs": [ { "type": "reloadTime", @@ -725,6 +725,25 @@ "value": 1.2, "type": "multiplicative", "appliesTo": "" + }, + { + "id": "uiu-elite-master-teamwork", + "label": "Moral Boost (+30% Damage)", + "value": 1.3, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "uiu-elite-reload-perk", + "label": "Mastery (+30% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.7, + "buffType": "multiplicative" + } + ], + "appliesTo": "RIFLE" } ] } From 56b6f98ded8b14d9e8ebd17865a5a236f83f1325 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Thu, 19 Sep 2024 16:39:57 +0200 Subject: [PATCH 13/50] expanded on operatives --- static/json/operative.json | 47 +++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/static/json/operative.json b/static/json/operative.json index 06391a3..3afb590 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -320,10 +320,10 @@ "modifiers": [ { "id": "camper-damage-perk", - "label": "Camper (+25% Damage)", + "label": "Camper [SEMI-AUTO] (+25% Damage)", "value": 1.25, "type": "multiplicative", - "appliesTo": "" + "appliesTo": "SEMI-AUTO" }, { "id": "detect-damage-perk", @@ -422,7 +422,7 @@ "value": 0, "buffType": "multiplicative" } - ], + ], "appliesTo": "SMG" }, { @@ -434,7 +434,7 @@ } ] }, - { + { "id": "Special-High-Roller", "name": "High Roller", "category": "Special", @@ -479,7 +479,7 @@ "value": 0.8, "buffType": "multiplicative" } - ], + ], "appliesTo": "" }, { @@ -503,7 +503,7 @@ "value": 1.2, "buffType": "multiplicative" } - ], + ], "appliesTo": "" }, { @@ -515,7 +515,7 @@ "value": 1.20, "buffType": "multiplicative" } - ], + ], "appliesTo": "" }, { @@ -527,7 +527,7 @@ "value": 1.25, "buffType": "multiplicative" } - ], + ], "appliesTo": "RIFLE" }, { @@ -539,7 +539,7 @@ "value": 1.25, "buffType": "multiplicative" } - ], + ], "appliesTo": "LMG" }, { @@ -551,7 +551,7 @@ "value": 1.25, "buffType": "multiplicative" } - ], + ], "appliesTo": "SHOTGUN" }, { @@ -563,7 +563,7 @@ "value": 1.25, "buffType": "multiplicative" } - ], + ], "appliesTo": "SMG" }, { @@ -575,7 +575,7 @@ "value": 1.25, "buffType": "multiplicative" } - ], + ], "appliesTo": "SEMI-AUTO" } ] @@ -742,10 +742,31 @@ "value": 0.7, "buffType": "multiplicative" } - ], + ], "appliesTo": "RIFLE" } ] + }, + { + "id": "UIU-Detective", + "name": "UIU Detective", + "category": "UIU", + "modifiers": [ + { + "id": "uiu-detective-sense", + "label": "Sense (+100% Damage)", + "value": 2, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "uiu-detective-secondaries-boost", + "label": "Moral Boost (+50% Damage)", + "value": 1.5, + "type": "multiplicative", + "appliesTo": "SECONDARY" + } + ] } ] } \ No newline at end of file From 4d068ca7a610d80d645524cff0839c4b93d74b75 Mon Sep 17 00:00:00 2001 From: IM23a-bachmannj2 Date: Thu, 19 Sep 2024 17:41:03 +0200 Subject: [PATCH 14/50] IUI Bulldozer made in data.json --- static/json/operative.json | 108 +++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/static/json/operative.json b/static/json/operative.json index 3afb590..e17b82a 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -767,6 +767,114 @@ "appliesTo": "SECONDARY" } ] + }, + { + "id": "UIU-Bulldozer", + "name": "UIU Bulldozer", + "category": "UIU", + "modifiers": [ + { + "id": "shotgun-specialist-damage-perk", + "label": "Shotgun Specialist (+30% Damage)", + "value": 1.30, + "type": "multiplicative", + "appliesTo": "SHOTGUNS" + }, + { + "id": "goc-experience-damage-perk", + "label": "GOC Experience (+20% Damage)", + "value": 1.2, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "double-reload-reload-perk", + "label": "Double Reload [SHOTGUN] (+50% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.5, + "buffType": "multiplicative" + } + ], + "appliesTo": "SHOTGUN" + }, + { + "id": "buckshot--damage-rpm-perk", + "label": "Buckshot Bullet-type [R870-B] (+20% Firerate, +15% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.15, + "buffType": "multiplicative" + }, + { + "type": "rpm", + "value": 1.20, + "buffType": "multiplicative" + } + ], + "appliesTo": "R870-B" + }, + { + "id": "anger-issues-damage-perk", + "label": "Agression bar (+20% Firerate, +20% Reload Speed)", + "buffs": [ + { + "type": "rpm", + "value": 1.2, + "buffType": "multiplicative" + }, + { + "type": "reloadTime", + "value": 0.8, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "deadly-rush-damage-perk", + "label": "Deadly Rush Ability (+20% Damage, 25% RPM)", + "buffs": [ + { + "type": "rpm", + "value": 1.25, + "buffType": "multiplicative" + }, + { + "type": "damage", + "value": 1.2, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "bulldozer-time-damage-perk", + "label": "Bulldozer Time Ability (+50% Reload Speed, 50% RPM)", + "buffs": [ + { + "type": "rpm", + "value": 1.5, + "buffType": "multiplicative" + }, + { + "type": "reloadTime", + "value": 0.5, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "mastery-damage-perk", + "label": "Mastery (+20% Reload Speed)", + "value": 0.8, + "type": "multiplicative", + "appliesTo": "" + } + ] } ] } \ No newline at end of file From 7eca20e2625690b6f84c338588ae2e25d85be74d Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Thu, 19 Sep 2024 18:12:14 +0200 Subject: [PATCH 15/50] expanded on operatives --- static/filterWeapons.js | 9 ++++++++ static/json/data.json | 10 ++++++++ static/json/modifiers.json | 47 ++++++++++++++++++++++---------------- static/json/operative.json | 8 +++---- 4 files changed, 50 insertions(+), 24 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 166505f..d9f6894 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -210,6 +210,11 @@ function applyModifiers() { return; // Skip this modifier } + // If modifier is operative-specific, ensure the selected operative matches the modifier category + if (mod.operatives && selectedOperative && mod.operatives !== selectedOperative.category) { + return; // Skip this modifier if it doesn't apply to the current operative's category + } + // Handle modifiers with multiple buffs if (mod.dataset.buffs) { const buffs = JSON.parse(mod.dataset.buffs); @@ -246,6 +251,10 @@ function applyModifiers() { return; // Skip if the modifier does not apply to this weapon type } + if (mod.operatives && selectedOperative && mod.operatives !== selectedOperative.category) { + return; // Skip this modifier if it doesn't apply to the current operative's category + } + // Handle operative modifiers with multiple buffs if (mod.buffs) { mod.buffs.forEach(buff => { diff --git a/static/json/data.json b/static/json/data.json index b5b36bc..5f0d167 100644 --- a/static/json/data.json +++ b/static/json/data.json @@ -119,6 +119,16 @@ "reload_time": 12, "guntype": "SHOTGUN" }, + { + "id": 87, + "name": "R870-B", + "damage": 92, + "damage_multiplier": 6, + "rpm": 70, + "mag_size": 12, + "reload_time": 12, + "guntype": "R870-B" + }, { "id": 14, "name": "Scattergun", diff --git a/static/json/modifiers.json b/static/json/modifiers.json index 140b8a9..0974533 100644 --- a/static/json/modifiers.json +++ b/static/json/modifiers.json @@ -5,28 +5,28 @@ "label": "Elite HE Rounds (+14 damage)", "value": 14, "type": "additive", - "operatives": [] + "operatives": "" }, { "id": "damage-item-additive-he-rounds", "label": "HE Rounds (+8 damage)", "value": 8, "type": "additive", - "operatives": [] + "operatives": "" }, { "id": "damage-item-multiplicative-strength-mixture", "label": "Strength Mixture (+20% damage)", "value": 1.2, "type": "multiplicative", - "operatives": [] + "operatives": "" }, { "id": "damage-item-multiplicative-fortunos-necklace", "label": "Fortunos Necklace (+15% damage)", "value": 1.15, "type": "multiplicative", - "operatives": [] + "operatives": "" }, { "id": "multiple-buffs-bloxy-cola", @@ -43,21 +43,21 @@ "buffType": "multiplicative" } ], - "operatives": [] + "operatives": "" }, { "id": "damage-item-multiplicative-enhancer", "label": "Enhancer (+10% damage)", "value": 1.1, "type": "multiplicative", - "operatives": [] + "operatives": "" }, { "id": "damage-item-multiplicative-teleport-device", "label": "Teleport Device (+25% damage)", "value": 1.25, "type": "multiplicative", - "operatives": [] + "operatives": "" } ], "operativePerks": [ @@ -66,28 +66,28 @@ "label": "FBI Badge (+10% Damage)", "value": 1.1, "type": "multiplicative", - "operatives": [] + "operatives": "UIU" }, { "id": "damage-perk-multiplicative-anatomy-book", "label": "Anatomy Book (+5% Damage)", "value": 1.05, "type": "multiplicative", - "operatives": [] + "operatives": "" }, { "id": "damage-perk-multiplicative-silly-soldier", "label": "Silly Soldier (+10% Damage)", "value": 1.10, "type": "multiplicative", - "operatives": [] + "operatives": "" }, { "id": "damage-perk-multiplicative-precise-shots", "label": "Precise Shots (+15% Damage)", "value": 1.40, "type": "multiplicative", - "operatives": [] + "operatives": "" }, { "id": "damage-perk-multiplicative-goc-insignia", @@ -104,7 +104,7 @@ "buffType": "multiplicative" } ], - "operatives": [] + "operatives": "GOC" } ], "abilityPerks": [ @@ -123,19 +123,19 @@ "buffType": "multiplicative" } ], - "operatives": [] + "operatives": "" }, { "id": "damage-ability-multiplicative-heath-spawn", "label": "[All Operatives] Heath Spawn (+30% Damage)", "value": 1.3, "type": "multiplicative", - "operatives": [] + "operatives": "" }, { "id": "multiple-buffs-warcry", "label": "[All Operatives] War Cry(+25% Damage, +?% Reload Speed)", - "operatives": [], + "operatives": "", "buffs": [ { "type": "damage", @@ -154,35 +154,42 @@ "label": "[All Operatives] Blackout (+30% Damage)", "value": 1.3, "type": "multiplicative", - "operatives": [] + "operatives": "" }, { "id": "damage-ability-multiplicative-red-scan", "label": "[All Operatives] Red Scan (+30% Damage)", "value": 1.3, "type": "multiplicative", - "operatives": [] + "operatives": "" }, { "id": "damage-ability-multiplicative-red-scan", "label": "[All Operatives] Green Scan (+50% Damage)", "value": 1.5, "type": "multiplicative", - "operatives": [] + "operatives": "" }, { "id": "damage-ability-multiplicative-point-out", "label": "[All Operatives] Point Out (+50% Damage)", "value": 1.5, "type": "multiplicative", - "operatives": [] + "operatives": "" }, { "id": "damage-item-additive-5-uiu-elite", "label": "[All Operatives] 5 UIU Elite nearby (+25 damage)", "value": 25, "type": "additive", - "operatives": [] + "operatives": "" + }, + { + "id": "damage-item-additive-field-support", + "label": "[All Operatives] MTF Commander Field Support (+8 damage)", + "value": 8, + "type": "additive", + "operatives": "" } ] } diff --git a/static/json/operative.json b/static/json/operative.json index e17b82a..12b4ac6 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -761,7 +761,7 @@ }, { "id": "uiu-detective-secondaries-boost", - "label": "Moral Boost (+50% Damage)", + "label": "Secondaries Boost (+50% Damage)", "value": 1.5, "type": "multiplicative", "appliesTo": "SECONDARY" @@ -818,7 +818,7 @@ }, { "id": "anger-issues-damage-perk", - "label": "Agression bar (+20% Firerate, +20% Reload Speed)", + "label": "Aggression bar (+20% Firerate, +20% Reload Speed)", "buffs": [ { "type": "rpm", @@ -852,11 +852,11 @@ }, { "id": "bulldozer-time-damage-perk", - "label": "Bulldozer Time Ability (+50% Reload Speed, 50% RPM)", + "label": "Bulldozer Time Ability (2x Firerate, 2x Reload Speed)", "buffs": [ { "type": "rpm", - "value": 1.5, + "value": 2, "buffType": "multiplicative" }, { From 1371dfbc890efcd6c4acdb7d6da28d6bd4adf42d Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Thu, 19 Sep 2024 20:40:17 +0200 Subject: [PATCH 16/50] expanded on operatives --- static/filterWeapons.js | 9 -- static/json/operative.json | 300 ++++++++++++++++++++++++++++++++----- 2 files changed, 261 insertions(+), 48 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index d9f6894..166505f 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -210,11 +210,6 @@ function applyModifiers() { return; // Skip this modifier } - // If modifier is operative-specific, ensure the selected operative matches the modifier category - if (mod.operatives && selectedOperative && mod.operatives !== selectedOperative.category) { - return; // Skip this modifier if it doesn't apply to the current operative's category - } - // Handle modifiers with multiple buffs if (mod.dataset.buffs) { const buffs = JSON.parse(mod.dataset.buffs); @@ -251,10 +246,6 @@ function applyModifiers() { return; // Skip if the modifier does not apply to this weapon type } - if (mod.operatives && selectedOperative && mod.operatives !== selectedOperative.category) { - return; // Skip this modifier if it doesn't apply to the current operative's category - } - // Handle operative modifiers with multiple buffs if (mod.buffs) { mod.buffs.forEach(buff => { diff --git a/static/json/operative.json b/static/json/operative.json index 12b4ac6..f7d6f43 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -657,10 +657,15 @@ "category": "UIU", "modifiers": [ { - "id": "uiu-assault-ar-user", + "id": "uiu-assault-ar-user-damage-perk", "label": "AR User [RIFLE] (+30% Damage)", - "value": 1.3, - "type": "multiplicative", + "buffs": [ + { + "type": "damage", + "value": 1.3, + "buffType": "multiplicative" + } + ], "appliesTo": "RIFLE" } ] @@ -671,17 +676,27 @@ "category": "UIU", "modifiers": [ { - "id": "uiu-hru-full-metal-jacket", + "id": "uiu-hru-full-metal-jacket-damage-perk", "label": "Full Metal Jacket (+10% Damage)", - "value": 1.3, - "type": "multiplicative", + "buffs": [ + { + "type": "damage", + "value": 1.1, + "buffType": "multiplicative" + } + ], "appliesTo": "" }, { - "id": "uiu-hru-skull-cracker", + "id": "uiu-hru-skull-cracker-damage-perk", "label": "Skull Cracker (+20% Damage)", - "value": 1.2, - "type": "multiplicative", + "buffs": [ + { + "type": "damage", + "value": 1.2, + "buffType": "multiplicative" + } + ], "appliesTo": "" } ] @@ -692,17 +707,27 @@ "category": "UIU", "modifiers": [ { - "id": "camper-damage-perk", + "id": "camper-damage-perk-damage-perk", "label": "Camper [SEMI-AUTO] (+25% Damage)", - "value": 1.25, - "type": "multiplicative", + "buffs": [ + { + "type": "damage", + "value": 1.25, + "buffType": "multiplicative" + } + ], "appliesTo": "SEMI-AUTO" }, { - "id": "uiu-marksman-skull-cracker", + "id": "uiu-marksman-skull-cracker-damage-perk", "label": "Skull Cracker (+20% Damage)", - "value": 1.2, - "type": "multiplicative", + "buffs": [ + { + "type": "damage", + "value": 1.2, + "buffType": "multiplicative" + } + ], "appliesTo": "" } ] @@ -713,24 +738,39 @@ "category": "UIU", "modifiers": [ { - "id": "uiu-elite-ar-user", + "id": "uiu-elite-ar-user-damage-perk", "label": "AR User [RIFLE] (+30% Damage)", - "value": 1.3, - "type": "multiplicative", + "buffs": [ + { + "type": "damage", + "value": 1.3, + "buffType": "multiplicative" + } + ], "appliesTo": "RIFLE" }, { - "id": "uiu-elite-moral-boost", + "id": "uiu-elite-moral-boost-damage-perk", "label": "Moral Boost (+20% Damage)", - "value": 1.2, - "type": "multiplicative", + "buffs": [ + { + "type": "damage", + "value": 1.2, + "buffType": "multiplicative" + } + ], "appliesTo": "" }, { - "id": "uiu-elite-master-teamwork", + "id": "uiu-elite-master-teamwork-damage-perk", "label": "Moral Boost (+30% Damage)", - "value": 1.3, - "type": "multiplicative", + "buffs": [ + { + "type": "damage", + "value": 1.3, + "buffType": "multiplicative" + } + ], "appliesTo": "" }, { @@ -753,18 +793,40 @@ "category": "UIU", "modifiers": [ { - "id": "uiu-detective-sense", + "id": "uiu-detective-sense-damage-perk", "label": "Sense (+100% Damage)", - "value": 2, - "type": "multiplicative", + "buffs": [ + { + "type": "damage", + "value": 2, + "buffType": "multiplicative" + } + ], "appliesTo": "" }, { - "id": "uiu-detective-secondaries-boost", + "id": "uiu-detective-secondaries-boost-damage-perk", "label": "Secondaries Boost (+50% Damage)", - "value": 1.5, - "type": "multiplicative", + "buffs": [ + { + "type": "damage", + "value": 1.5, + "buffType": "multiplicative" + } + ], "appliesTo": "SECONDARY" + }, + { + "id": "search-expert-reload-perk", + "label": "Search Expert (+50% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.5, + "buffType": "multiplicative" + } + ], + "appliesTo": "" } ] }, @@ -776,15 +838,25 @@ { "id": "shotgun-specialist-damage-perk", "label": "Shotgun Specialist (+30% Damage)", - "value": 1.30, - "type": "multiplicative", - "appliesTo": "SHOTGUNS" + "buffs": [ + { + "type": "damage", + "value": 1.3, + "buffType": "multiplicative" + } + ], + "appliesTo": "SHOTGUN" }, { - "id": "goc-experience-damage-perk", - "label": "GOC Experience (+20% Damage)", - "value": 1.2, - "type": "multiplicative", + "id": "cqc-experience-damage-perk", + "label": "CQC Experience (+20% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.2, + "buffType": "multiplicative" + } + ], "appliesTo": "" }, { @@ -800,7 +872,7 @@ "appliesTo": "SHOTGUN" }, { - "id": "buckshot--damage-rpm-perk", + "id": "buckshot-damage-rpm-perk", "label": "Buckshot Bullet-type [R870-B] (+20% Firerate, +15% Damage)", "buffs": [ { @@ -870,11 +942,161 @@ { "id": "mastery-damage-perk", "label": "Mastery (+20% Reload Speed)", - "value": 0.8, + "buffs": [ + { + "type": "reloadTime", + "value": 0.8, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + } + ] + }, + { + "id": "UIU-Cloaker", + "name": "UIU Cloaker", + "category": "UIU", + "modifiers": [ + { + "id": "uiu-cloaker-ambusher-perk-damage-perk", + "label": "Ambusher (+50% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.5, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "quick-movements-reload-perk", + "label": "Quick Movements (+50% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.5, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + } + ] + }, + { + "id": "UIU-Captain", + "name": "UIU Captain", + "category": "UIU", + "modifiers": [ + { + "id": "agent-training-rifle-damage-perk", + "label": "Agent training [RIFLE] (+15% Damage)", + "value": 1.15, + "type": "multiplicative", + "appliesTo": "RIFLE" + }, + { + "id": "agent-training-smg-damage-perk", + "label": "Agent training [SMG] (+25% Damage, 30% Reload Speed)", + "buffs": [ + { + "type": "damage", + "value": 1.25, + "buffType": "multiplicative" + }, + { + "type": "reloadTime", + "value": 0.7, + "buffType": "multiplicative" + } + ], + "appliesTo": "SMG" + } + ] + }, + { + "id": "UIU-MOOT", + "name": "UIU MOOT", + "category": "UIU", + "modifiers": [ + { + "id": "uiu-moot-ar-user-damage-perk", + "label": "AR User [RIFLE] (+30% Damage)", + "value": 1.3, + "type": "multiplicative", + "appliesTo": "RIFLE" + }, + { + "id": "uiu-moot-anchoring-ammunition-damage-perk", + "label": "Anchoring Ammunition (+40% Damage)", + "value": 1.4, "type": "multiplicative", "appliesTo": "" } ] + }, + { + "id": "UIU-Technician", + "name": "UIU Technician", + "category": "UIU", + "modifiers": [ + { + "id": "agent-training-rifle-damage-perk", + "label": "Agent training [RIFLE] (+15% Damage)", + "value": 1.15, + "type": "multiplicative", + "appliesTo": "RIFLE" + }, + { + "id": "agent-training-smg-damage-perk", + "label": "Agent training [SMG] (+25% Damage, 30% Reload Speed)", + "buffs": [ + { + "type": "damage", + "value": 1.25, + "buffType": "multiplicative" + }, + { + "type": "reloadTime", + "value": 0.7, + "buffType": "multiplicative" + } + ], + "appliesTo": "SMG" + } + ] + }, + { + "id": "UIU-Oathbreaker", + "name": "UIU Oathbreaker", + "category": "UIU", + "modifiers": [ + { + "id": "agent-training-rifle-damage-perk", + "label": "Agent training [RIFLE] (+15% Damage)", + "value": 1.15, + "type": "multiplicative", + "appliesTo": "RIFLE" + }, + { + "id": "agent-training-smg-damage-perk", + "label": "Agent training [SMG] (+25% Damage, 30% Reload Speed)", + "buffs": [ + { + "type": "damage", + "value": 1.25, + "buffType": "multiplicative" + }, + { + "type": "reloadTime", + "value": 0.7, + "buffType": "multiplicative" + } + ], + "appliesTo": "SMG" + } + ] } ] } \ No newline at end of file From 2acac5813122e9a93c5a354817ddb6d6e5bcb604 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Thu, 19 Sep 2024 22:22:52 +0200 Subject: [PATCH 17/50] added default value for selectors --- static/filterWeapons.js | 33 +++++++++++++++++++++++++++++++-- templates/calculator.html | 9 ++++----- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 166505f..1ec9706 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -14,10 +14,17 @@ function fetchOperativesData() { } // Function to populate the select element with operatives +// Function to populate the operative dropdown function populateOperatives(operatives) { const select = document.getElementById('operative-select'); select.innerHTML = ""; // Clear any existing options + // Add the placeholder option + const placeholderOption = document.createElement('option'); + placeholderOption.value = ""; // Empty value for the placeholder + placeholderOption.text = "Select an operative"; + select.appendChild(placeholderOption); // Add the placeholder option + operatives.forEach(operative => { const option = document.createElement('option'); option.value = operative.id; @@ -28,9 +35,16 @@ function populateOperatives(operatives) { // Attach event listener to detect when an operative is selected select.addEventListener('change', (event) => { const selectedOperativeId = event.target.value; + + // If placeholder is selected, don't proceed + if (!selectedOperativeId) { + document.getElementById('operative-modifiers').innerHTML = ''; + return; // Do nothing when the placeholder is selected + } + selectedOperative = operatives.find(op => op.id === selectedOperativeId); if (selectedOperative) { - updateOperativeBuffs(selectedOperative) + updateOperativeBuffs(selectedOperative); // Update operative modifiers on valid selection } }); } @@ -83,10 +97,18 @@ function fetchWeaponsData() { } // Function to populate the select element with weapons +// Function to populate the weapon dropdown function populateWeapons() { const select = document.getElementById('weapon-select'); select.innerHTML = ""; // Clear any existing options + // Add the placeholder option + const placeholderOption = document.createElement('option'); + placeholderOption.value = ""; // Empty value for the placeholder + placeholderOption.text = "Select a Weapon"; + select.appendChild(placeholderOption); // Add the placeholder option + + // Populate with actual weapons weapons.forEach(weapon => { const option = document.createElement('option'); option.value = weapon.id; @@ -97,9 +119,16 @@ function populateWeapons() { // Attach event listener to detect when a weapon is selected select.addEventListener('change', (event) => { const selectedWeaponId = parseInt(event.target.value); + + // If placeholder is selected, don't proceed + if (!selectedWeaponId) { + document.getElementById('weapon-stats').innerHTML = ''; + return; // Do nothing when the placeholder is selected + } + selectedWeapon = weapons.find(weapon => weapon.id === selectedWeaponId); if (selectedWeapon) { - updateWeaponStats(selectedWeapon); // Update stats on selection + updateWeaponStats(selectedWeapon); // Update stats on valid selection } }); } diff --git a/templates/calculator.html b/templates/calculator.html index 125850b..e7af1e5 100644 --- a/templates/calculator.html +++ b/templates/calculator.html @@ -27,11 +27,11 @@ } } - // Collapsible functionality for perks, buffs, etc. + // Collapsible functionality for perks, buffs, etc. document.addEventListener('DOMContentLoaded', function () { var coll = document.getElementsByClassName("collapsible-header"); for (var i = 0; i < coll.length; i++) { - coll[i].addEventListener("click", function() { + coll[i].addEventListener("click", function () { this.classList.toggle("active"); var content = this.nextElementSibling; if (content.style.display === "block") { @@ -72,13 +72,12 @@
- From 98f87ad60e0eac580bf97f7bd7899b1963398970 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Sat, 21 Sep 2024 09:42:12 +0200 Subject: [PATCH 18/50] added default value for selectors and some more operatives --- static/filterWeapons.js | 13 ++++-- static/json/data.json | 2 +- static/json/operative.json | 85 +++++++++++++++++++++++++++++++++++++- 3 files changed, 93 insertions(+), 7 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 1ec9706..3d25839 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -238,6 +238,9 @@ function applyModifiers() { if (mod.appliesTo && mod.appliesTo !== selectedWeapon.guntype) { return; // Skip this modifier } + if (mod.operatives && selectedOperative && mod.operatives !== selectedOperative.category) { + return; // Skip this modifier if it doesn't apply to the current operative's category + } // Handle modifiers with multiple buffs if (mod.dataset.buffs) { @@ -266,7 +269,7 @@ function applyModifiers() { } }; - // Function to process operative-based modifiers + // Function to process operative-specific modifiers const processOperativeModifier = (mod) => { if (mod.appliesNotTo && mod.appliesNotTo === selectedWeapon.guntype) { return; // Skip this modifier for this weapon type @@ -275,6 +278,11 @@ function applyModifiers() { return; // Skip if the modifier does not apply to this weapon type } + // Ensure that the modifier only applies if it matches the selected operative's category + if (mod.operatives && selectedOperative && mod.operatives !== selectedOperative.category) { + return; // Skip this modifier if it doesn't apply to the current operative's category + } + // Handle operative modifiers with multiple buffs if (mod.buffs) { mod.buffs.forEach(buff => { @@ -303,11 +311,9 @@ function applyModifiers() { processModifier(mod); }); - // Re-apply listener after change modifiersContainer.addEventListener('change', applyModifiers); - // Process operative-specific modifiers // Process operative-specific modifiers that are checked const operativeSection = document.getElementById('operative-modifiers'); operativeSection.querySelectorAll('input:checked').forEach(mod => { @@ -319,7 +325,6 @@ function applyModifiers() { } }); - // Recalculate with applied modifiers let damage = baseDamage * damageModifier.multiplicative; damage += damageModifier.additive; diff --git a/static/json/data.json b/static/json/data.json index 5f0d167..77919ad 100644 --- a/static/json/data.json +++ b/static/json/data.json @@ -337,7 +337,7 @@ "rpm": 30, "mag_size": 5, "reload_time": 3.5, - "guntype": "RIFLE?" + "guntype": "RIFLE" }, { "id": 38, diff --git a/static/json/operative.json b/static/json/operative.json index f7d6f43..9e5f362 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -182,8 +182,8 @@ "appliesTo": "" }, { - "id": "adrenaline-damage-perk", - "label": "All Upgrades (+30% Damage)", + "id": "anarchist-adrenaline-damage-perk", + "label": "Adrenaline (+30% Damage)", "value": 1.3, "type": "multiplicative", "appliesTo": "" @@ -1097,6 +1097,87 @@ "appliesTo": "SMG" } ] + }, + { + "id": "GRU-P-Assault", + "name": "GRU-P Assault", + "category": "GRU-P", + "modifiers": [ + { + "id": "not-step-back-damage-perk", + "label": "Not one step back (+50% Damage)", + "value": 1.5, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "gru-p-assault-mastery-reload-perk", + "label": "Mastery [SOVIET WEAPONS] (+10% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.9, + "buffType": "multiplicative" + } + ], + "appliesTo": "SOVIET" + }, + { + "id": "gru-p-assault-mastery-damage-perk", + "label": "Mastery (+20% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.2, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "gru-p-assault-patriotic-damage-perk", + "label": "Patriotic (+60% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.6, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + } + ] + }, + { + "id": "GRU-P-Specialist", + "name": "GRU-P Specialist", + "category": "GRU-P", + "modifiers": [ + { + "id": "well-taught-reload-perk", + "label": "Not one step back (+50% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.5, + "buffType": "multiplicative" + } + ], + "appliesNotTo": "SHOTGUN" + }, + { + "id": "heavy-bullets-damage-perk", + "label": "Heavy Bullets (+32% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.32, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + } + ] } ] } \ No newline at end of file From ea61296d0d74f12b69481db9dc487bcadfab6637 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Sat, 21 Sep 2024 09:57:18 +0200 Subject: [PATCH 19/50] fixed weapon expert perk and added winter soldier --- static/filterWeapons.js | 19 ++++++++++++--- static/json/operative.json | 50 +++++++++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 3d25839..0111760 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -330,16 +330,23 @@ function applyModifiers() { damage += damageModifier.additive; let rpm = baseRpm * rpmModifier.multiplicative; - rpm += rpm * rpmModifier.additive; + rpm += rpmModifier.additive; let reloadTime = baseReloadTime * reloadTimeModifier.multiplicative; - reloadTime += reloadTime * reloadTimeModifier.additive; + reloadTime += reloadTimeModifier.additive; + +// Safeguard: Reload time can not go below 0.1 seconds + if (reloadTime < 0.1) { + reloadTime = 0.1; + } calculateDPSAndDPM(damage, rpm, selectedWeapon.mag_size, reloadTime); updateModifiedWeaponStats(damage, rpm, reloadTime); + } // Function to apply individual buffs (simplified to avoid mistakes) +// Function to apply individual buffs (modified to prevent reload time going below 0) function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier = null) { const {type, buffType, value} = buff; @@ -350,8 +357,12 @@ function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier = null) } if (type === 'reloadTime') { - if (buffType === 'multiplicative') reloadTimeModifier.multiplicative *= value; - else if (buffType === 'additive') reloadTimeModifier.additive += value; + if (buffType === 'multiplicative') { + reloadTimeModifier.multiplicative *= value; + } else if (buffType === 'additive') { + // Subtract value for additive reload time modifiers (like Weapon Expert) + reloadTimeModifier.additive += value; + } } // Apply damage buffs diff --git a/static/json/operative.json b/static/json/operative.json index 9e5f362..faa1ba6 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -1155,7 +1155,7 @@ "modifiers": [ { "id": "well-taught-reload-perk", - "label": "Not one step back (+50% Reload Speed)", + "label": "Well Taught (+50% Reload Speed)", "buffs": [ { "type": "reloadTime", @@ -1178,6 +1178,54 @@ "appliesTo": "" } ] + }, + { + "id": "GRU-P-Specialist", + "name": "GRU-P Specialist", + "category": "GRU-P", + "modifiers": [ + { + "id": "well-taught-reload-perk", + "label": "Snow Beast (+25% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.75, + "buffType": "multiplicative" + } + ], + "appliesNotTo": "" + }, + { + "id": "heavy-bullets-damage-perk", + "label": "Heavy Bullets (+32% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.32, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "ws-mastery-damage-perk", + "label": "Mastery (+?% Damage, +?% Reload Speed)", + "buffs": [ + { + "type": "damage", + "value": 1, + "buffType": "multiplicative" + }, + { + "type": "reloadTime", + "value": 1, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + } + ] } ] } \ No newline at end of file From 4766540fc51803728752e7f60487f81b85239fb0 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Sat, 21 Sep 2024 15:05:09 +0200 Subject: [PATCH 20/50] added 'WW2', 'SOVIET' and 'SECONDARY' detection and added Shade --- static/filterWeapons.js | 35 ++++++++++++++++------------- static/json/data.json | 46 +++++++++++++++++++------------------- static/json/operative.json | 25 ++++++++++++++++++--- 3 files changed, 64 insertions(+), 42 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 0111760..4789eca 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -232,16 +232,18 @@ function applyModifiers() { // Function to process global modifiers const processModifier = (mod) => { - if (mod.appliesNotTo && mod.appliesNotTo === selectedWeapon.guntype) { - return; // Skip this modifier - } - if (mod.appliesTo && mod.appliesTo !== selectedWeapon.guntype) { - return; // Skip this modifier - } - if (mod.operatives && selectedOperative && mod.operatives !== selectedOperative.category) { - return; // Skip this modifier if it doesn't apply to the current operative's category + // Ensure guntype is now an array of tags + const weaponTags = selectedWeapon.guntype; // This is now an array like ["PISTOL", "WW2", "SECONDARY"] + + // Skip the modifier if it should not apply to any of the current weapon's tags + if (mod.appliesNotTo && weaponTags.includes(mod.appliesNotTo)) { + return; // Skip this modifier } + // Check if the modifier applies to any of the current weapon's tags + if (mod.appliesTo && !weaponTags.includes(mod.appliesTo)) { + return; // Skip this modifier + } // Handle modifiers with multiple buffs if (mod.dataset.buffs) { const buffs = JSON.parse(mod.dataset.buffs); @@ -271,16 +273,17 @@ function applyModifiers() { // Function to process operative-specific modifiers const processOperativeModifier = (mod) => { - if (mod.appliesNotTo && mod.appliesNotTo === selectedWeapon.guntype) { - return; // Skip this modifier for this weapon type - } - if (mod.appliesTo && mod.appliesTo !== selectedWeapon.guntype) { - return; // Skip if the modifier does not apply to this weapon type + // Ensure guntype is now an array of tags + const weaponTags = selectedWeapon.guntype; // This is now an array like ["PISTOL", "WW2", "SECONDARY"] + + // Skip the modifier if it should not apply to any of the current weapon's tags + if (mod.appliesNotTo && weaponTags.includes(mod.appliesNotTo)) { + return; // Skip this modifier } - // Ensure that the modifier only applies if it matches the selected operative's category - if (mod.operatives && selectedOperative && mod.operatives !== selectedOperative.category) { - return; // Skip this modifier if it doesn't apply to the current operative's category + // Check if the modifier applies to any of the current weapon's tags + if (mod.appliesTo && !weaponTags.includes(mod.appliesTo)) { + return; // Skip this modifier } // Handle operative modifiers with multiple buffs diff --git a/static/json/data.json b/static/json/data.json index 77919ad..2a01576 100644 --- a/static/json/data.json +++ b/static/json/data.json @@ -7,7 +7,7 @@ "rpm": 550, "mag_size": 18, "reload_time": 2, - "guntype": "PISTOL" + "guntype": ["PISTOL", "SECONDARY"] }, { "id": 2, @@ -17,7 +17,7 @@ "rpm": 580, "mag_size": 8, "reload_time": 1.15, - "guntype": "PISTOL" + "guntype": ["PISTOL", "SECONDARY", "WW2"] }, { "id": 3, @@ -27,7 +27,7 @@ "rpm": 850, "mag_size": 15, "reload_time": 2, - "guntype": "PISTOL" + "guntype": ["PISTOL", "SECONDARY"] }, { "id": 4, @@ -37,7 +37,7 @@ "rpm": 720, "mag_size": 16, "reload_time": 3, - "guntype": "PISTOL" + "guntype": ["PISTOL", "SECONDARY"] }, { "id": 5, @@ -47,7 +47,7 @@ "rpm": 500, "mag_size": 8, "reload_time": 1.95, - "guntype": "PISTOL" + "guntype": ["PISTOL", "WW2", "SECONDARY"] }, { "id": 6, @@ -57,7 +57,7 @@ "rpm": 600, "mag_size": 30, "reload_time": 2.1, - "guntype": "RIFLE" + "guntype": ["RIFLE", "SOVIET"] }, { "id": 7, @@ -77,7 +77,7 @@ "rpm": 400, "mag_size": 24, "reload_time": 2.6, - "guntype": "RIFLE" + "guntype": "SEMI-AUTO" }, { "id": 9, @@ -107,7 +107,7 @@ "rpm": 60, "mag_size": 8, "reload_time": 2.8, - "guntype": "RIFLE" + "guntype": ["RIFLE", "WW2"] }, { "id": 12, @@ -177,7 +177,7 @@ "rpm": 750, "mag_size": 50, "reload_time": 2.5, - "guntype": "SMG" + "guntype": ["RIFLE", "WW2"] }, { "id": 22, @@ -267,7 +267,7 @@ "rpm": 550, "mag_size": 32, "reload_time": 3, - "guntype": "SMG" + "guntype": ["SMG", "WW2"] }, { "id": 31, @@ -277,7 +277,7 @@ "rpm": 750, "mag_size": 100, "reload_time": 5.5, - "guntype": "LMG" + "guntype": ["LMG", "SOVIET"] }, { "id": 32, @@ -337,7 +337,7 @@ "rpm": 30, "mag_size": 5, "reload_time": 3.5, - "guntype": "RIFLE" + "guntype": "SEMI-AUTO" }, { "id": 38, @@ -517,7 +517,7 @@ "rpm": 700, "mag_size": 34, "reload_time": 3.5, - "guntype": "PISTOL" + "guntype": ["PISTOL"] }, { "id": 57, @@ -527,7 +527,7 @@ "rpm": 440, "mag_size": 18, "reload_time": 3.5, - "guntype": "RIFLE" + "guntype": "SEMI-AUTO" }, { "id": 58, @@ -537,7 +537,7 @@ "rpm": 540, "mag_size": 18, "reload_time": 3.5, - "guntype": "RIFLE" + "guntype": "SEMI-AUTO" }, { "id": 59, @@ -557,7 +557,7 @@ "rpm": 900, "mag_size": 26, "reload_time": 2.5, - "guntype": "SMG?" + "guntype": ["PISTOL"] }, { "id": 61, @@ -567,7 +567,7 @@ "rpm": 1200, "mag_size": 26, "reload_time": 2, - "guntype": "SMG?" + "guntype": ["PISTOL"] }, { "id": 62, @@ -687,7 +687,7 @@ "rpm": 400, "mag_size": 18, "reload_time": 2.1, - "guntype": "PISTOL" + "guntype": ["PISTOL"] }, { "id": 74, @@ -697,7 +697,7 @@ "rpm": 400, "mag_size": 36, "reload_time": 3.5, - "guntype": "PISTOL" + "guntype": ["PISTOL"] }, { "id": 75, @@ -707,7 +707,7 @@ "rpm": 300, "mag_size": 10, "reload_time": 3, - "guntype": "RIFLE" + "guntype": "SEMI-AUTO" }, { "id": 76, @@ -717,7 +717,7 @@ "rpm": 700, "mag_size": 10, "reload_time": 2, - "guntype": "RIFLE?" + "guntype": "RIFLE" }, { "id": 77, @@ -727,7 +727,7 @@ "rpm": 1000, "mag_size": 71, "reload_time": 2.5, - "guntype": "UNKOWN" + "guntype": ["SMG", "SOVIET"] }, { "id": 78, @@ -737,7 +737,7 @@ "rpm": 690, "mag_size": 30, "reload_time": 2.5, - "guntype": "RIFLE" + "guntype": ["RIFLE", "SOVIET"] }, { "id": 79, diff --git a/static/json/operative.json b/static/json/operative.json index faa1ba6..87c746e 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -1180,12 +1180,12 @@ ] }, { - "id": "GRU-P-Specialist", - "name": "GRU-P Specialist", + "id": "winter-soldier", + "name": "Winter Soldier", "category": "GRU-P", "modifiers": [ { - "id": "well-taught-reload-perk", + "id": "snow-beast-reload-perk", "label": "Snow Beast (+25% Reload Speed)", "buffs": [ { @@ -1226,6 +1226,25 @@ "appliesTo": "" } ] + }, + { + "id": "shade", + "name": "Shade", + "category": "SCP", + "modifiers": [ + { + "id": "hell-bullets-damage-perk", + "label": "Hell Bullets (+10% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.1, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + } + ] } ] } \ No newline at end of file From 74a52244da7c3c037a1028d5e317a9a99d2ea89c Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Sat, 21 Sep 2024 15:19:11 +0200 Subject: [PATCH 21/50] added 'WW2', 'SOVIET' and 'SECONDARY' detection and added Shade --- static/json/operative.json | 78 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/static/json/operative.json b/static/json/operative.json index 87c746e..b00c7fc 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -1245,6 +1245,84 @@ "appliesTo": "" } ] + }, + { + "id": "magmion", + "name": "Magmion", + "category": "SCP" + }, + { + "id": "frostkill", + "name": "Frostkill", + "category": "SCP" + }, + { + "id": "able", + "name": "Able", + "category": "SCP" + }, + { + "id": "devil-hunter", + "name": "Devil Hunter", + "category": "SCP" + }, + { + "id": "polatia-heath", + "name": "Heath", + "category": "Polatia", + "modifiers": [ + { + "id": "angel-of-death-damage-perk", + "label": "Angel of Death (+20% Damage, +20% Reload Speed, +20% Firerate)", + "buffs": [ + { + "type": "damage", + "value": 1.2, + "buffType": "multiplicative" + }, + { + "type": "rpm", + "value": 1.2, + "buffType": "multiplicative" + }, + { + "type": "reloadTime", + "value": 0.8, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + } + ] + }, + { + "id": "polatia-thavin", + "name": "Thavin", + "category": "Polatia" + }, + { + "id": "polatia-dd", + "name": "Diamond Dog", + "category": "Polatia", + "modifiers": [ + { + "id": "experimental-kamui-damage-perk", + "label": "Experimental Kami (+40% Damage, +35% Reload Speed)", + "buffs": [ + { + "type": "damage", + "value": 1.4, + "buffType": "multiplicative" + }, + { + "type": "reloadTime", + "value": 0.65, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + } + ] } ] } \ No newline at end of file From 647ac0b808a5254f4cde16796426a05f6fc74e99 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Sat, 21 Sep 2024 16:32:48 +0200 Subject: [PATCH 22/50] ALL OPERATIVES DONE --- static/json/modifiers.json | 13 +- static/json/operative.json | 410 +++++++++++++++++++++++++++++++++++++ 2 files changed, 422 insertions(+), 1 deletion(-) diff --git a/static/json/modifiers.json b/static/json/modifiers.json index 0974533..b13cb60 100644 --- a/static/json/modifiers.json +++ b/static/json/modifiers.json @@ -85,7 +85,7 @@ { "id": "damage-perk-multiplicative-precise-shots", "label": "Precise Shots (+15% Damage)", - "value": 1.40, + "value": 1.15, "type": "multiplicative", "operatives": "" }, @@ -108,6 +108,17 @@ } ], "abilityPerks": [ + { + "id": "headshot-damage-buff", + "label": "[All Operatives] Headshot (+25% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.25, + "buffType": "multiplicative" + } + ] + }, { "id": "multiple-buffs-firefight", "label": "[All Operatives] Firefight (+35% Damage, +40% Reload Speed)", diff --git a/static/json/operative.json b/static/json/operative.json index b00c7fc..faa7e0e 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -1323,6 +1323,416 @@ "appliesTo": "" } ] + }, + { + "id": "polatia-arms-dealer", + "name": "Polatia Arms Dealer", + "category": "Polatia", + "modifiers": [ + { + "id": "polatia-high-velocity-bullets-damage-perk", + "label": "High Velocity Bullets (+25% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.25, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "familiarity-reload-perk", + "label": "Familiarity (+30% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.7, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + } + ] + }, + { + "id": "polatia-contractor", + "name": "Polatia Contractor", + "category": "Polatia" + }, + { + "id": "polatia-consigliere", + "name": "Polatia Consigliere", + "category": "Polatia" + }, + { + "id": "pratva-hitman", + "name": "Pratva Hitman", + "category": "Polatia", + "modifiers": [ + { + "id": "hit-list-damage-perk", + "label": "Hit List (+50% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.5, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "Backliner-damage-perk", + "label": "Backliner (+35% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.35, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "spree-damage-perk", + "label": "Headshot Spree (+200% Damage)", + "buffs": [ + { + "type": "damage", + "value": 3, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + } + ] + }, + { + "id": "pratva-machinegunner", + "name": "Pratva Machinegunner", + "category": "Polatia", + "modifiers": [ + { + "id": "spray-and-pary-damage-perk", + "label": "Spray and Pray (+100% Damage)", + "buffs": [ + { + "type": "damage", + "value": 2, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "static-defender-reload-perk", + "label": "Static Defender (+30% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.7, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "Polatia-LMG-User-perk", + "label": "LMG User (+35% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.35, + "buffType": "multiplicative" + } + ], + "appliesTo": "LMG" + }, + { + "id": "focus-reload-perk", + "label": "Focus (+20% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.8, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "hollow-point-ammunition-damage-perk", + "label": "Hollow Point Ammunition (+10 Damage)", + "buffs": [ + { + "type": "damage", + "value": 10, + "buffType": "additive" + } + ], + "appliesTo": "" + } + ] + }, + { + "id": "pratva-executor", + "name": "Pratva Executor", + "category": "Polatia", + "modifiers": [ + { + "id": "undertaker-damage-perk", + "label": "Undertaker (+30% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.3, + "buffType": "multiplicative" + } + ], + "appliesTo": "SHOTGUN" + }, + { + "id": "execute-damage-perk", + "label": "Execute (+40% Reload Speed)", + "buffs": [ + { + "type": "damage", + "value": 1.4, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + } + ] + }, + { + "id": "polatia-zero-day", + "name": "Zero Day", + "category": "Polatia" + }, + { + "id": "goc-goc", + "name": "GOC", + "category": "GOC", + "modifiers": [ + { + "id": "goc-special-ammo", + "label": "Special Ammo (+40% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.4, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "goc-weapon-expert-reload-perk", + "label": "Weapon Expert (-1s Reload Time)", + "value": -1, + "type": "additive", + "appliesTo": "" + } + ] + }, + { + "id": "goc-BD", + "name": "Broken Dagger", + "category": "GOC", + "modifiers": [ + { + "id": "BD-special-ammo", + "label": "Special Ammo (+40% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.4, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "BD-BED", + "label": "Break 'em down (+40% Damage, +40% Firerate, +100% Reload Speed)", + "buffs": [ + { + "type": "damage", + "value": 1.4, + "buffType": "multiplicative" + }, + { + "type": "rpm", + "value": 1.4, + "buffType": "multiplicative" + }, + { + "type": "reloadTime", + "value": 0, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "BD-Vengeance", + "label": "Vengeance (+35% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.65, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + } + ] + }, + { + "id": "goc-SH", + "name": "Steelhead", + "category": "GOC", + "modifiers": [ + { + "id": "sh-silver", + "label": "Silver Ammo (+30% Damage, +20% Firerate)", + "buffs": [ + { + "type": "damage", + "value": 1.3, + "buffType": "multiplicative" + }, + { + "type": "rpm", + "value": 1.2, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "sh-hammer", + "label": "Hammer Ammo (+50% Damage, -30% Firerate)", + "buffs": [ + { + "type": "damage", + "value": 1.5, + "buffType": "multiplicative" + }, + { + "type": "rpm", + "value": 0.7, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "sh-hellfire", + "label": "Hellfire Ammo (-10% Firerate)", + "buffs": [ + { + "type": "rpm", + "value": 0.9, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "sh-weapon-expert-reload-perk", + "label": "Weapon Expert (-1s Reload Time)", + "value": -1, + "type": "additive", + "appliesTo": "" + } + ] + }, + { + "id": "goc-ambassador", + "name": "GOC Ambassador", + "category": "GOC", + "modifiers": [ + { + "id": "goca-civilian", + "label": "Civilian (-15% Damage)", + "buffs": [ + { + "type": "damage", + "value": 0.85, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + } + ] + }, + { + "id": "goc-thaumaturge", + "name": "Thaumaturge", + "category": "GOC" + }, + { + "id": "goc-gs", + "name": "Gunslinger", + "category": "GOC", + "modifiers": [ + { + "id": "deep-focus-reload-perk", + "label": "Deep Focus (+50% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.5, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "bullet-hell-damage-perk", + "label": "Bullet Hell (+100% Damage)", + "buffs": [ + { + "type": "damage", + "value": 2, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "run-and-gun-damage-perk", + "label": "Run & Gun (+30% Firerate, +20% Reload Speed)", + "buffs": [ + { + "type": "rpm", + "value": 1.3, + "buffType": "multiplicative" + }, + { + "type": "reloadTime", + "value": 0.8, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "suppressive-fire-firerate-perk", + "label": "Hammer Ammo (+100% Firerate)", + "buffs": [ + { + "type": "rpm", + "value": 2, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + } + ] } ] } \ No newline at end of file From 20b788cb2edfb292801e1bdff51693b1b25849f1 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Sat, 21 Sep 2024 16:38:09 +0200 Subject: [PATCH 23/50] changed M1 to SEMI-AUTO --- static/json/data.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/json/data.json b/static/json/data.json index 2a01576..aaad894 100644 --- a/static/json/data.json +++ b/static/json/data.json @@ -107,7 +107,7 @@ "rpm": 60, "mag_size": 8, "reload_time": 2.8, - "guntype": ["RIFLE", "WW2"] + "guntype": ["SEMI-AUTO", "WW2"] }, { "id": 12, From 7feed73dda6bcbf06eb68b4d561b2cb07afa4dff Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Sat, 21 Sep 2024 16:55:15 +0200 Subject: [PATCH 24/50] Added a 'Special Thanks' Section to 'About Us' --- templates/about_us.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/templates/about_us.html b/templates/about_us.html index 837e593..5a35788 100644 --- a/templates/about_us.html +++ b/templates/about_us.html @@ -85,7 +85,17 @@ (damage per second) and DPM (damage per minute) of each weapon via a formula that is also mentioned on Lanz1021' Spreadsheet.

How often are stats updated?

-

We update the weapon stats every time a new update is released for TRL.


+

We update the weapon stats every time a new update is released for TRL.

+

Special Thanks

+

+ gameknight90999(holdenn/holdenisch): For telling me what Sandevistan does. (The wiki doesn't tell what it does, lol)
+ delete(real_delete): For the info about the 'Weapon Expert' perk (I don't know where else I would've found that).
+ Epicdragon99999999(epicdog999): For helping me categorize WW2 and Soviet weapons (I don't think I would've thought about the PKM)
+ NocturnalAndrea(nocturnalandrea): For helping me categorize Semi-auto weapons (again, why isn't this listed on the wiki?)
+ Kris HD(krishd1337): For the motivation and help with finding bugs.
+ Lanz1021: For reviewing and giving feedback.
+ AND YOU!: We are thankful for every visitor we get on this website, and we hope you're enjoying it! +

Thank you for visiting TRL Stats.

From 9f12490fc7baf13f815c517a5b8f951d716c20d9 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Sat, 21 Sep 2024 18:18:07 +0200 Subject: [PATCH 25/50] added search bar --- static/filterWeapons.js | 60 +++++++++++++++++++++++++++++++++++++++ static/json/data.json | 10 +++---- static/style.css | 8 ++++++ templates/calculator.html | 13 ++++++--- 4 files changed, 82 insertions(+), 9 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 4789eca..022c10c 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -401,6 +401,66 @@ 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'); + const options = weaponSelect.getElementsByTagName('option'); + + let firstVisibleOption = null; // Variable to track the first matching option + + for (let i = 0; i < options.length; i++) { + const optionText = options[i].textContent || options[i].innerText; + + // Check if the option matches the search query + if (optionText.toLowerCase().indexOf(input) > -1) { + options[i].style.display = ''; // Show matching option + if (!firstVisibleOption) { + firstVisibleOption = options[i]; // Save the first visible option + } + } else { + options[i].style.display = 'none'; // Hide non-matching option + } + } + + // Automatically select the first visible matching option + if (firstVisibleOption) { + weaponSelect.value = firstVisibleOption.value; + } +} + +// Function to filter operatives in the dropdown based on search input +function filterOperatives() { + const input = document.getElementById('operative-search').value.toLowerCase(); + const operativeSelect = document.getElementById('operative-select'); + const options = operativeSelect.getElementsByTagName('option'); + + let firstVisibleOption = null; // Track the first matching option + + for (let i = 0; i < options.length; i++) { + const optionText = options[i].textContent || options[i].innerText; + + // Check if the option matches the search query + if (optionText.toLowerCase().indexOf(input) > -1) { + options[i].style.display = ''; // Show matching option + if (!firstVisibleOption) { + firstVisibleOption = options[i]; // Save the first visible option + } + } else { + options[i].style.display = 'none'; // Hide non-matching option + } + } + + // Automatically select the first visible matching option + if (firstVisibleOption) { + operativeSelect.value = firstVisibleOption.value; + } +} + +// Attach event listeners to the search inputs +document.getElementById('weapon-search').addEventListener('keyup', filterWeapons); +document.getElementById('operative-search').addEventListener('keyup', filterOperatives); + // Call the fetch function to load the data and populate the dropdown on page load fetchWeaponsData(); fetchModifiers(); diff --git a/static/json/data.json b/static/json/data.json index aaad894..87f7165 100644 --- a/static/json/data.json +++ b/static/json/data.json @@ -187,7 +187,7 @@ "rpm": 850, "mag_size": 32, "reload_time": 2, - "guntype": "SMG" + "guntype": ["SMG", "SECONDARY"] }, { "id": 23, @@ -217,7 +217,7 @@ "rpm": 750, "mag_size": 65, "reload_time": 2, - "guntype": "SMG" + "guntype": ["SMG", "SECONDARY"] }, { "id": 26, @@ -227,7 +227,7 @@ "rpm": 780, "mag_size": 30, "reload_time": 2.65, - "guntype": "SMG" + "guntype": ["SMG", "SECONDARY"] }, { "id": 27, @@ -247,7 +247,7 @@ "rpm": 800, "mag_size": 25, "reload_time": 2.5, - "guntype": "SMG" + "guntype": ["SMG", "SECONDARY"] }, { "id": 29, @@ -257,7 +257,7 @@ "rpm": 800, "mag_size": 25, "reload_time": 2.5, - "guntype": "SMG" + "guntype": ["SMG", "SECONDARY"] }, { "id": 30, diff --git a/static/style.css b/static/style.css index 0b1bfff..09af742 100644 --- a/static/style.css +++ b/static/style.css @@ -1,3 +1,11 @@ +input[type="text"] { + width: 100%; + padding: 8px; + margin: 10px 0; + box-sizing: border-box; + font-size: 16px; +} + body { background-image: url("/static/img/trlbg1.jpg"); background-repeat: no-repeat; diff --git a/templates/calculator.html b/templates/calculator.html index e7af1e5..087be33 100644 --- a/templates/calculator.html +++ b/templates/calculator.html @@ -70,16 +70,21 @@
- + + +
+ - + + +
+ - +
From 8a35ac8edd6849aa99c59b40c513d272303d307d Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Sat, 21 Sep 2024 18:55:30 +0200 Subject: [PATCH 26/50] fixed some bugs --- static/filterWeapons.js | 5 ++++- static/populateTable.js | 19 +++++++++---------- templates/index.html | 1 - 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 022c10c..b15ef3d 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -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')); } } diff --git a/static/populateTable.js b/static/populateTable.js index b8c35a6..47a81b5 100644 --- a/static/populateTable.js +++ b/static/populateTable.js @@ -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); }); } diff --git a/templates/index.html b/templates/index.html index 806743d..77de8e2 100644 --- a/templates/index.html +++ b/templates/index.html @@ -61,7 +61,6 @@ Rounds per minute Magazine Size Reload time - Gun type RPS DPS DPM From 46e056e197a71c810e4a56976cd3ca391298faa9 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Sat, 21 Sep 2024 19:57:39 +0200 Subject: [PATCH 27/50] fixed some bugs --- static/filterWeapons.js | 13 +++++-- static/json/modifiers.json | 78 +++++++++++++++++++++++++++++++++----- 2 files changed, 78 insertions(+), 13 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index b15ef3d..f932dee 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -5,7 +5,7 @@ let globalModifiers = []; // Function to fetch operatives data from JSON function fetchOperativesData() { - fetch('static/json/operative.json') // Adjust the path to the actual location of your JSON file + fetch('/static/json/operative.json') // Adjust the path to the actual location of your JSON file .then(response => response.json()) .then(data => { populateOperatives(data.operatives); // Populate the operative dropdown once data is loaded @@ -230,6 +230,8 @@ function applyModifiers() { let rpmModifier = {additive: 0, multiplicative: 1}; let reloadTimeModifier = {additive: 0, multiplicative: 1}; + // Function to process global modifiers + // Function to process global modifiers // Function to process global modifiers const processModifier = (mod) => { // Ensure guntype is now an array of tags @@ -242,8 +244,9 @@ function applyModifiers() { // Check if the modifier applies to any of the current weapon's tags if (mod.appliesTo && !weaponTags.includes(mod.appliesTo)) { - return; // Skip this modifier + return; // Skip this modifier if it does not apply to the selected weapon type } + // Handle modifiers with multiple buffs if (mod.dataset.buffs) { const buffs = JSON.parse(mod.dataset.buffs); @@ -271,6 +274,9 @@ function applyModifiers() { } }; + + // Function to process operative-specific modifiers + // Function to process operative-specific modifiers // Function to process operative-specific modifiers const processOperativeModifier = (mod) => { // Ensure guntype is now an array of tags @@ -283,7 +289,7 @@ function applyModifiers() { // Check if the modifier applies to any of the current weapon's tags if (mod.appliesTo && !weaponTags.includes(mod.appliesTo)) { - return; // Skip this modifier + return; // Skip this modifier if it does not apply to the selected weapon type } // Handle operative modifiers with multiple buffs @@ -305,6 +311,7 @@ function applyModifiers() { } }; + // Clear out listeners and avoid re-adding const modifiersContainer = document.getElementById('modifiers'); modifiersContainer.removeEventListener('change', applyModifiers); diff --git a/static/json/modifiers.json b/static/json/modifiers.json index b13cb60..160df35 100644 --- a/static/json/modifiers.json +++ b/static/json/modifiers.json @@ -117,7 +117,8 @@ "value": 1.25, "buffType": "multiplicative" } - ] + ], + "appliesTo": "" }, { "id": "multiple-buffs-firefight", @@ -134,14 +135,16 @@ "buffType": "multiplicative" } ], - "operatives": "" + "operatives": "", + "appliesTo": "" }, { "id": "damage-ability-multiplicative-heath-spawn", "label": "[All Operatives] Heath Spawn (+30% Damage)", "value": 1.3, "type": "multiplicative", - "operatives": "" + "operatives": "", + "appliesTo": "" }, { "id": "multiple-buffs-warcry", @@ -158,49 +161,104 @@ "value": 1, "buffType": "multiplicative" } - ] + ], + "appliesTo": "" }, { "id": "damage-ability-multiplicative-blackout", "label": "[All Operatives] Blackout (+30% Damage)", "value": 1.3, "type": "multiplicative", - "operatives": "" + "operatives": "", + "appliesTo": "" }, { "id": "damage-ability-multiplicative-red-scan", "label": "[All Operatives] Red Scan (+30% Damage)", "value": 1.3, "type": "multiplicative", - "operatives": "" + "operatives": "", + "appliesTo": "" }, { "id": "damage-ability-multiplicative-red-scan", "label": "[All Operatives] Green Scan (+50% Damage)", "value": 1.5, "type": "multiplicative", - "operatives": "" + "operatives": "", + "appliesTo": "" }, { "id": "damage-ability-multiplicative-point-out", "label": "[All Operatives] Point Out (+50% Damage)", "value": 1.5, "type": "multiplicative", - "operatives": "" + "operatives": "", + "appliesTo": "" }, { "id": "damage-item-additive-5-uiu-elite", "label": "[All Operatives] 5 UIU Elite nearby (+25 damage)", "value": 25, "type": "additive", - "operatives": "" + "operatives": "", + "appliesTo": "" }, { "id": "damage-item-additive-field-support", "label": "[All Operatives] MTF Commander Field Support (+8 damage)", "value": 8, "type": "additive", - "operatives": "" + "operatives": "", + "appliesTo": "" + }, + { + "id": "damage-ability-multiplicative-scan grenade", + "label": "[All Operatives] Scan Grenade (+15% Damage)", + "value": 1.15, + "type": "multiplicative", + "operatives": "", + "appliesTo": "" + }, + { + "id": "damage-upgrade-multiplicative-upgraded-bullets", + "label": "[All Operatives] Experimental Bullets (+30% Damage)", + "value": 1.3, + "type": "multiplicative", + "operatives": "", + "appliesTo": "" + }, + { + "id": "damage-item-additive-GOC", + "label": "[All Operatives] GOC Ally (+8 damage)", + "value": 8, + "type": "additive", + "operatives": "", + "appliesTo": "" + }, + { + "id": "damage-item-additive-GOC-1", + "label": "[All Operatives] Weak Points (+8 damage)", + "value": 8, + "type": "additive", + "operatives": "", + "appliesTo": "" + }, + { + "id": "damage-item-additive-GOC-3", + "label": "[All Operatives] GOC Ally: Kraken Buff (+3 damage)", + "value": 3, + "type": "additive", + "operatives": "", + "appliesTo": "" + }, + { + "id": "damage-item-additive-uiu-1", + "label": "[All Operatives] UIU Upgraded Towers (+20% damage)", + "value": 1.2, + "type": "multiplicative", + "operatives": "", + "appliesTo": "" } ] } From cb5c971e3f36d583eba7fb047bb98e8fb9df703b Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Sat, 21 Sep 2024 20:00:34 +0200 Subject: [PATCH 28/50] expanded on modifiers.json --- static/json/modifiers.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/json/modifiers.json b/static/json/modifiers.json index 160df35..5b1b193 100644 --- a/static/json/modifiers.json +++ b/static/json/modifiers.json @@ -254,8 +254,8 @@ }, { "id": "damage-item-additive-uiu-1", - "label": "[All Operatives] UIU Upgraded Towers (+20% damage)", - "value": 1.2, + "label": "[All Operatives] UIU Upgraded Towers (+10% damage)", + "value": 1.1, "type": "multiplicative", "operatives": "", "appliesTo": "" From e0996327ba783c27a87bf8808ba7e614a28dc317 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Thu, 26 Sep 2024 13:18:05 +0200 Subject: [PATCH 29/50] better calculator design on PC --- static/filterWeapons.js | 39 ++++++++++++++++++++++++--------------- static/style.css | 39 +++++++++++++++++++++++++++++++++++++++ templates/calculator.html | 8 ++++++-- 3 files changed, 69 insertions(+), 17 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index f932dee..9d57f59 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -167,10 +167,14 @@ function fetchModifiers() { // Function to dynamically populate modifiers into the HTML function populateModifiers(modifiers) { - const modifiersContainer = document.getElementById('modifiers'); + const modifiersContainer = document.getElementById('modifiers-container'); + modifiersContainer.innerHTML = ''; // Clear existing modifiers - const createModifierSection = (title, modifierList) => { + const createModifierSection = (title, modifierList, sectionId) => { const section = document.createElement('div'); + section.id = sectionId; // Set an ID for the section + section.className = sectionId === 'abilities' ? 'abilities' : ''; // Only for abilities + const header = document.createElement('h3'); header.textContent = title; section.appendChild(header); @@ -183,32 +187,37 @@ function populateModifiers(modifiers) { // Check if the modifier has multiple buffs if (mod.buffs) { - input.dataset.buffs = JSON.stringify(mod.buffs); // Store buffs data as a string in data-buffs + input.dataset.buffs = JSON.stringify(mod.buffs); } else { input.value = mod.value; - input.dataset.type = mod.type; // Store if it's additive or multiplicative + input.dataset.type = mod.type; } label.appendChild(input); label.appendChild(document.createTextNode(mod.label)); - section.appendChild(label); - section.appendChild(document.createElement('br')); + + // Create a container for each modifier item + const modifierItem = document.createElement('div'); + modifierItem.className = 'modifier-item'; // Add the class for styling + modifierItem.appendChild(label); + section.appendChild(modifierItem); // Append the modifier item to the section }); return section; }; - // Clear any existing modifiers - modifiersContainer.innerHTML = ''; + // Create a container for all modifiers + const container = document.createElement('div'); + container.id = 'modifiers'; - // Add Item Buffs - modifiersContainer.appendChild(createModifierSection('Item Buffs', modifiers.itemBuffs)); + // Populate sections + container.appendChild(createModifierSection('Item Buffs', modifiers.itemBuffs, 'items')); + container.appendChild(createModifierSection('Perks', modifiers.operativePerks, 'perks')); + modifiersContainer.appendChild(container); // Append item and perks container - // Add Operative Perks - modifiersContainer.appendChild(createModifierSection('Perks', modifiers.operativePerks)); - - // Add Ability Perks - modifiersContainer.appendChild(createModifierSection('Abilities', modifiers.abilityPerks)); + // Create and append abilities section + const abilitiesSection = createModifierSection('Abilities', modifiers.abilityPerks, 'abilities'); + modifiersContainer.appendChild(abilitiesSection); // Append abilities section // Add event listener to recalculate DPS/DPM when modifiers are toggled modifiersContainer.addEventListener('change', applyModifiers); diff --git a/static/style.css b/static/style.css index 09af742..c948074 100644 --- a/static/style.css +++ b/static/style.css @@ -6,6 +6,23 @@ input[type="text"] { font-size: 16px; } +#modifiers-container { + display: flex; + justify-content: space-between; /* Distribute space between the items */ + flex-wrap: wrap; /* Allow wrapping to avoid overflow */ +} + +/* Style for the modifiers section */ +#modifiers { + display: flex; /* Use flexbox for alignment */ + flex-direction: column; /* Stack items vertically */ + width: 50%; /* Adjust this percentage to control the width */ +} + +#abilities { + width: 42.5%; /* Adjust this value as needed */ +} + body { background-image: url("/static/img/trlbg1.jpg"); background-repeat: no-repeat; @@ -323,4 +340,26 @@ textarea { .suggestion-title { font-size: 1.2em; } + + #modifiers { + width: 100%; /* Adjust this percentage to control the width */ + } + + #abilities { + width: 100%; + } + + /* Adjust spacing between different ability modifiers */ + #abilities label { + display: block; /* Ensures each label takes up its own line */ + margin-bottom: 10px; /* Adds space between each ability checkbox */ + line-height: 1.2; /* Keeps the spacing between wrapped lines consistent */ + white-space: normal; /* Allows text to wrap normally */ + } + + /* Optional: Adjust margin between checkbox and text */ + #abilities input[type="checkbox"] { + margin-right: 5px; /* Adjust the spacing between the checkbox and the label */ + } + } diff --git a/templates/calculator.html b/templates/calculator.html index 087be33..74518f2 100644 --- a/templates/calculator.html +++ b/templates/calculator.html @@ -90,11 +90,15 @@
- -

Operative Specific Modifiers

+ +
+
+
+
+
From 8f5ca38d88580f3165d547274bff3923366db8a2 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Thu, 26 Sep 2024 14:08:49 +0200 Subject: [PATCH 30/50] weapon stats are shown in a table, horizontally --- static/filterWeapons.js | 102 ++++++++++++++++++++++++++++------------ static/style.css | 25 +++++++++- 2 files changed, 95 insertions(+), 32 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 9d57f59..dad567d 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -133,15 +133,33 @@ function populateWeapons() { }); } +// Function to display the selected weapon's stats in the UI +// Function to display the selected weapon's stats in a table-like format +// Function to display the selected weapon's stats in a table-like format // Function to display the selected weapon's stats in the UI function updateWeaponStats(weapon) { const statsElement = document.getElementById('weapon-stats'); statsElement.innerHTML = ` -

Name: ${weapon.name}

-

Damage: ${weapon.damage * weapon.damage_multiplier}

-

RPM: ${weapon.rpm}

-

Mag Size: ${weapon.mag_size}

-

Reload Time: ${weapon.reload_time}

+ + + + + + + + + + + + + + + + + + + +
NameDamageRPMMag SizeReload TimeDPSDPM
${weapon.name}${(weapon.damage * weapon.damage_multiplier).toFixed(2)}${weapon.rpm}${weapon.mag_size}${weapon.reload_time.toFixed(2)} seconds
`; // Store values for further calculations @@ -154,6 +172,48 @@ function updateWeaponStats(weapon) { calculateDPSAndDPM(damage, rpm, magSize, reloadTime); } +// Function to calculate DPS and DPM and update the values in the table +function calculateDPSAndDPM(damage, rpm, magSize, reloadTime) { + const rps = rpm / 60; // Rounds per second + let dps = damage * rps; + const reloadTimeMin = reloadTime / 60; + let dpm = (magSize * damage) / (reloadTimeMin + (magSize / rpm)); + + // Update DPS and DPM values in the table + document.getElementById('dps-value').innerText = dps.toFixed(2); + document.getElementById('dpm-value').innerText = dpm.toFixed(2); +} + +// Function to display the modified weapon's stats in the table format +function updateModifiedWeaponStats(damage, rpm, reloadTime) { + const statsElement = document.getElementById('weapon-stats'); + statsElement.innerHTML = ` + + + + + + + + + + + + + + + + + + + +
NameModified DamageModified RPMMag SizeModified Reload TimeDPSDPM
${selectedWeapon.name}${damage.toFixed(2)}${rpm.toFixed(2)}${selectedWeapon.mag_size}${reloadTime.toFixed(2)} seconds
+ `; + + // Recalculate and update DPS and DPM values with modifiers applied + calculateDPSAndDPM(damage, rpm, selectedWeapon.mag_size, reloadTime); +} + // Function to fetch and populate modifiers from the JSON file function fetchModifiers() { fetch('static/json/modifiers.json') // Adjust the path to your JSON file @@ -322,6 +382,12 @@ function applyModifiers() { // Clear out listeners and avoid re-adding + // Process ability modifiers + const abilitiesSection = document.getElementById('abilities'); + abilitiesSection.querySelectorAll('input:checked').forEach(mod => { + processModifier(mod); // Process the ability modifier the same way as global modifiers + }); + const modifiersContainer = document.getElementById('modifiers'); modifiersContainer.removeEventListener('change', applyModifiers); @@ -391,32 +457,6 @@ function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier = null) } } -// Function to calculate DPS and DPM with optional modifiers -function calculateDPSAndDPM(damage, rpm, magSize, reloadTime) { - const rps = rpm / 60; // Rounds per second - let dps = damage * rps; - const reloadTimeMin = reloadTime / 60; - let dpm = (magSize * damage) / (reloadTimeMin + (magSize / rpm)); - - // Display the calculated stats - const resultElement = document.getElementById('calculated-stats'); - resultElement.innerHTML = ` -

DPS: ${dps.toFixed(2)}

-

DPM: ${dpm.toFixed(2)}

- `; -} - -// Function to display the modified weapon's stats in the UI -function updateModifiedWeaponStats(damage, rpm, reloadTime) { - const statsElement = document.getElementById('weapon-stats'); - statsElement.innerHTML = ` -

Modified Damage: ${damage.toFixed(2)}

-

Modified RPM: ${rpm.toFixed(2)}

-

Mag Size: ${selectedWeapon.mag_size}

-

Modified Reload Time: ${reloadTime.toFixed(2)} seconds

- `; -} - function filterWeapons() { const input = document.getElementById('weapon-search').value.toLowerCase(); const weaponSelect = document.getElementById('weapon-select'); diff --git a/static/style.css b/static/style.css index c948074..8fff33a 100644 --- a/static/style.css +++ b/static/style.css @@ -361,5 +361,28 @@ textarea { #abilities input[type="checkbox"] { margin-right: 5px; /* Adjust the spacing between the checkbox and the label */ } - +} + +/* Styling for horizontal table */ +.weapon-stats-table { + width: 100%; + border-collapse: collapse; + margin: 10px 0; +} + +.weapon-stats-table th, .weapon-stats-table td { + border: 1px solid #ddd; + padding: 8px; + text-align: center; /* Center the text */ +} + +.weapon-stats-table th { + background-color: #f2f2f2; + color: black; +} + +/* Horizontal styling specifically for the table */ +.horizontal-table tr:first-child th { + text-align: center; + font-weight: bold; } From 9d76a047f7c1005f5ce4833803a36381047876c1 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Fri, 27 Sep 2024 06:28:47 +0200 Subject: [PATCH 31/50] made comments easier to read and added some more --- static/filterWeapons.js | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index dad567d..64710e1 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -1,11 +1,11 @@ let selectedWeapon = null; // Store the selected weapon's data -let weapons = []; // This will be populated by the fetched JSON data let selectedOperative = null; // Store the selected operative's data -let globalModifiers = []; +let weapons = []; // This will be populated by the fetched JSON data +let globalModifiers = []; // This will be populated by the fetched JSON data // Function to fetch operatives data from JSON function fetchOperativesData() { - fetch('/static/json/operative.json') // Adjust the path to the actual location of your JSON file + fetch('/static/json/operative.json') .then(response => response.json()) .then(data => { populateOperatives(data.operatives); // Populate the operative dropdown once data is loaded @@ -14,7 +14,6 @@ function fetchOperativesData() { } // Function to populate the select element with operatives -// Function to populate the operative dropdown function populateOperatives(operatives) { const select = document.getElementById('operative-select'); select.innerHTML = ""; // Clear any existing options @@ -96,7 +95,6 @@ function fetchWeaponsData() { .catch(error => console.error('Error fetching weapons data:', error)); } -// Function to populate the select element with weapons // Function to populate the weapon dropdown function populateWeapons() { const select = document.getElementById('weapon-select'); @@ -133,10 +131,7 @@ function populateWeapons() { }); } -// Function to display the selected weapon's stats in the UI // Function to display the selected weapon's stats in a table-like format -// Function to display the selected weapon's stats in a table-like format -// Function to display the selected weapon's stats in the UI function updateWeaponStats(weapon) { const statsElement = document.getElementById('weapon-stats'); statsElement.innerHTML = ` @@ -283,8 +278,6 @@ function populateModifiers(modifiers) { modifiersContainer.addEventListener('change', applyModifiers); } -// Function to apply the modifiers and recalculate DPS and DPM -// Function to apply the modifiers and recalculate damage, RPM, and reloadTime // Function to apply the modifiers and recalculate damage, RPM, and reloadTime function applyModifiers() { if (!selectedWeapon) return; @@ -299,8 +292,6 @@ function applyModifiers() { let rpmModifier = {additive: 0, multiplicative: 1}; let reloadTimeModifier = {additive: 0, multiplicative: 1}; - // Function to process global modifiers - // Function to process global modifiers // Function to process global modifiers const processModifier = (mod) => { // Ensure guntype is now an array of tags @@ -343,9 +334,6 @@ function applyModifiers() { } }; - - // Function to process operative-specific modifiers - // Function to process operative-specific modifiers // Function to process operative-specific modifiers const processOperativeModifier = (mod) => { // Ensure guntype is now an array of tags @@ -431,7 +419,6 @@ function applyModifiers() { } // Function to apply individual buffs (simplified to avoid mistakes) -// Function to apply individual buffs (modified to prevent reload time going below 0) function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier = null) { const {type, buffType, value} = buff; From f0ef29e3a40e6f8bc3b9b74fe87b3847227611c7 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Fri, 27 Sep 2024 21:28:07 +0200 Subject: [PATCH 32/50] added checkboxes, average dps, a bugfix with shotguns and some adjustments with data.json --- static/filterWeapons.js | 117 +++++++++++++++++++++++++++-------- static/json/data.json | 124 +++++++++++++++++++------------------- templates/calculator.html | 14 +++++ 3 files changed, 168 insertions(+), 87 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 64710e1..58cc41f 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -2,6 +2,7 @@ let selectedWeapon = null; // Store the selected weapon's data let selectedOperative = null; // Store the selected operative's data let weapons = []; // This will be populated by the fetched JSON data let globalModifiers = []; // This will be populated by the fetched JSON data +let selectedGunTypes = []; // Track selected gun types for filtering // Function to fetch operatives data from JSON function fetchOperativesData() { @@ -91,6 +92,7 @@ function fetchWeaponsData() { .then(data => { weapons = data; // Store the fetched data in the global 'weapons' variable populateWeapons(); // Populate the weapon dropdown once data is loaded + createGunTypeCheckboxes(); // Create the gun type checkboxes after loading the weapons }) .catch(error => console.error('Error fetching weapons data:', error)); } @@ -144,6 +146,7 @@ function updateWeaponStats(weapon) { Reload Time DPS DPM + Average DPS ${weapon.name} @@ -153,6 +156,7 @@ function updateWeaponStats(weapon) { ${weapon.reload_time.toFixed(2)} seconds + `; @@ -163,22 +167,10 @@ function updateWeaponStats(weapon) { const magSize = weapon.mag_size; const reloadTime = weapon.reload_time; - // Calculate DPS and DPM initially without modifiers + // Calculate DPS, DPM, and Average DPS calculateDPSAndDPM(damage, rpm, magSize, reloadTime); } -// Function to calculate DPS and DPM and update the values in the table -function calculateDPSAndDPM(damage, rpm, magSize, reloadTime) { - const rps = rpm / 60; // Rounds per second - let dps = damage * rps; - const reloadTimeMin = reloadTime / 60; - let dpm = (magSize * damage) / (reloadTimeMin + (magSize / rpm)); - - // Update DPS and DPM values in the table - document.getElementById('dps-value').innerText = dps.toFixed(2); - document.getElementById('dpm-value').innerText = dpm.toFixed(2); -} - // Function to display the modified weapon's stats in the table format function updateModifiedWeaponStats(damage, rpm, reloadTime) { const statsElement = document.getElementById('weapon-stats'); @@ -192,6 +184,7 @@ function updateModifiedWeaponStats(damage, rpm, reloadTime) { Modified Reload Time DPS DPM + Average DPS ${selectedWeapon.name} @@ -201,14 +194,30 @@ function updateModifiedWeaponStats(damage, rpm, reloadTime) { ${reloadTime.toFixed(2)} seconds + `; - // Recalculate and update DPS and DPM values with modifiers applied + // Recalculate and update DPS, DPM, and Average DPS calculateDPSAndDPM(damage, rpm, selectedWeapon.mag_size, reloadTime); } +// Function to calculate DPS, DPM, and Average DPS, and update the values in the table +function calculateDPSAndDPM(damage, rpm, magSize, reloadTime) { + const rps = rpm / 60; // Rounds per second + let dps = damage * rps; + const reloadTimeMin = reloadTime / 60; + let dpm = (magSize * damage) / (reloadTimeMin + (magSize / rpm)); + let averageDPS = dpm / 60; // New Average DPS Calculation + + // Update DPS, DPM, and Average DPS values in the table + document.getElementById('dps-value').innerText = dps.toFixed(2); + document.getElementById('dpm-value').innerText = dpm.toFixed(2); + document.getElementById('average-dps-value').innerText = averageDPS.toFixed(2); // Update the Average DPS in the table +} + + // Function to fetch and populate modifiers from the JSON file function fetchModifiers() { fetch('static/json/modifiers.json') // Adjust the path to your JSON file @@ -283,7 +292,7 @@ function applyModifiers() { if (!selectedWeapon) return; // Base stats - let baseDamage = selectedWeapon.damage * selectedWeapon.damage_multiplier; + let baseDamage = selectedWeapon.damage; let baseRpm = selectedWeapon.rpm; let baseReloadTime = selectedWeapon.reload_time; @@ -398,24 +407,30 @@ function applyModifiers() { } }); - // Recalculate with applied modifiers - let damage = baseDamage * damageModifier.multiplicative; + // Step 1: Calculate final damage + let damage = baseDamage; // Reset to base damage + + // Step 2: Apply multiplicative damage modifiers + damage *= damageModifier.multiplicative; + + // Step 3: Apply additive damage modifiers damage += damageModifier.additive; - let rpm = baseRpm * rpmModifier.multiplicative; - rpm += rpmModifier.additive; + // Apply the weapon's damage multiplier (if applicable) last + damage *= selectedWeapon.damage_multiplier; - let reloadTime = baseReloadTime * reloadTimeModifier.multiplicative; - reloadTime += reloadTimeModifier.additive; + // Calculate other modified stats + let rpm = baseRpm * rpmModifier.multiplicative + rpmModifier.additive; + let reloadTime = baseReloadTime * reloadTimeModifier.multiplicative + reloadTimeModifier.additive; -// Safeguard: Reload time can not go below 0.1 seconds + // Safeguard: Reload time cannot go below 0.1 seconds if (reloadTime < 0.1) { reloadTime = 0.1; } + // Calculate and update DPS, DPM, and average DPS calculateDPSAndDPM(damage, rpm, selectedWeapon.mag_size, reloadTime); updateModifiedWeaponStats(damage, rpm, reloadTime); - } // Function to apply individual buffs (simplified to avoid mistakes) @@ -444,18 +459,31 @@ function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier = null) } } +// Modify the existing filterWeapons function to consider gun type checkboxes function filterWeapons() { const input = document.getElementById('weapon-search').value.toLowerCase(); const weaponSelect = document.getElementById('weapon-select'); const options = weaponSelect.getElementsByTagName('option'); + // Get selected guntype filters + const selectedGuntypes = Array.from(document.querySelectorAll('#guntype-filters input:checked')) + .map(checkbox => checkbox.value); + let firstVisibleOption = null; // Variable to track the first matching option for (let i = 0; i < options.length; i++) { const optionText = options[i].textContent || options[i].innerText; + const weaponId = parseInt(options[i].value); // Get the weapon ID + const weapon = weapons.find(w => w.id === weaponId); // Find the corresponding weapon - // Check if the option matches the search query - if (optionText.toLowerCase().indexOf(input) > -1) { + if (!weapon) continue; // Skip if the weapon is not found (for safety) + + // Check if the option matches the search query and the selected guntype filters + const matchesSearch = optionText.toLowerCase().indexOf(input) > -1; + const matchesGuntypes = selectedGuntypes.length === 0 || selectedGuntypes.every(type => weapon.guntype.includes(type)); + + // Show or hide options based on both search and guntype filters + if (matchesSearch && matchesGuntypes) { options[i].style.display = ''; // Show matching option if (!firstVisibleOption) { firstVisibleOption = options[i]; // Save the first visible option @@ -503,9 +531,48 @@ function filterOperatives() { } } +// Function to dynamically create gun type checkboxes based on available gun types in the weapon data +function createGunTypeCheckboxes() { + const gunTypeFiltersContainer = document.getElementById('gun-type-filters'); + gunTypeFiltersContainer.innerHTML = ''; // Clear existing checkboxes + + const gunTypesSet = new Set(); // Use a Set to store unique gun types from the weapon data + + // Extract unique gun types from the weapon data + weapons.forEach(weapon => { + weapon.guntype.forEach(type => gunTypesSet.add(type)); // Add each gun type to the Set + }); + + // Create checkboxes for each unique gun type + gunTypesSet.forEach(gunType => { + const label = document.createElement('label'); + const input = document.createElement('input'); + input.type = 'checkbox'; + input.value = gunType; + input.className = 'gun-type-checkbox'; + + // Add event listener to filter weapons when checkbox is checked/unchecked + input.addEventListener('change', () => { + const selectedCheckboxes = Array.from(document.querySelectorAll('.gun-type-checkbox:checked')); + selectedGunTypes = selectedCheckboxes.map(checkbox => checkbox.value); + filterWeapons(); // Re-filter weapons based on the selected gun types + }); + + label.appendChild(input); + label.appendChild(document.createTextNode(gunType)); + gunTypeFiltersContainer.appendChild(label); + gunTypeFiltersContainer.appendChild(document.createElement('br')); + }); +} + // Attach event listeners to the search inputs document.getElementById('weapon-search').addEventListener('keyup', filterWeapons); document.getElementById('operative-search').addEventListener('keyup', filterOperatives); +// Add event listeners to the guntype checkboxes +document.querySelectorAll('#guntype-filters input').forEach(checkbox => { + checkbox.addEventListener('change', filterWeapons); +}); + // Call the fetch function to load the data and populate the dropdown on page load fetchWeaponsData(); diff --git a/static/json/data.json b/static/json/data.json index 87f7165..4fa563a 100644 --- a/static/json/data.json +++ b/static/json/data.json @@ -57,7 +57,7 @@ "rpm": 600, "mag_size": 30, "reload_time": 2.1, - "guntype": ["RIFLE", "SOVIET"] + "guntype": ["RIFLE", "PRIMARY","SOVIET"] }, { "id": 7, @@ -67,7 +67,7 @@ "rpm": 700, "mag_size": 30, "reload_time": 2.4, - "guntype": "RIFLE" + "guntype": ["RIFLE", "PRIMARY"] }, { "id": 8, @@ -77,7 +77,7 @@ "rpm": 400, "mag_size": 24, "reload_time": 2.6, - "guntype": "SEMI-AUTO" + "guntype": ["RIFLE", "SEMI-AUTO", "PRIMARY"] }, { "id": 9, @@ -87,7 +87,7 @@ "rpm": 670, "mag_size": 30, "reload_time": 3.25, - "guntype": "RIFLE" + "guntype": ["RIFLE", "PRIMARY"] }, { "id": 10, @@ -97,7 +97,7 @@ "rpm": 700, "mag_size": 30, "reload_time": 2.35, - "guntype": "RIFLE" + "guntype": ["RIFLE", "PRIMARY"] }, { "id": 11, @@ -107,7 +107,7 @@ "rpm": 60, "mag_size": 8, "reload_time": 2.8, - "guntype": ["SEMI-AUTO", "WW2"] + "guntype": ["RIFLE", "SEMI-AUTO", "PRIMARY"] }, { "id": 12, @@ -117,7 +117,7 @@ "rpm": 70, "mag_size": 12, "reload_time": 12, - "guntype": "SHOTGUN" + "guntype": ["SHOTGUN", "PRIMARY"] }, { "id": 87, @@ -127,7 +127,7 @@ "rpm": 70, "mag_size": 12, "reload_time": 12, - "guntype": "R870-B" + "guntype": ["SHOTGUN", "PRIMARY"] }, { "id": 14, @@ -137,7 +137,7 @@ "rpm": 300, "mag_size": 7, "reload_time": 4, - "guntype": "SHOTGUN" + "guntype": ["SHOTGUN", "PRIMARY"] }, { "id": 16, @@ -147,7 +147,7 @@ "rpm": 185, "mag_size": 8, "reload_time": 3.5, - "guntype": "SHOTGUN" + "guntype": ["SHOTGUN", "SECONDARY"] }, { "id": 18, @@ -157,7 +157,7 @@ "rpm": 300, "mag_size": 20, "reload_time": 2.2, - "guntype": "SHOTGUN" + "guntype": ["SHOTGUN", "PRIMARY"] }, { "id": 20, @@ -167,7 +167,7 @@ "rpm": 900, "mag_size": 50, "reload_time": 3, - "guntype": "SMG" + "guntype": ["SMG", "PRIMARY"] }, { "id": 21, @@ -177,7 +177,7 @@ "rpm": 750, "mag_size": 50, "reload_time": 2.5, - "guntype": ["RIFLE", "WW2"] + "guntype": ["SMG", "PRIMARY", "WW2"] }, { "id": 22, @@ -197,7 +197,7 @@ "rpm": 1050, "mag_size": 33, "reload_time": 2, - "guntype": "SMG" + "guntype": ["SMG", "PRIMARY"] }, { "id": 24, @@ -207,7 +207,7 @@ "rpm": 800, "mag_size": 30, "reload_time": 2.1, - "guntype": "SMG" + "guntype": ["SMG", "SECONDARY"] }, { "id": 25, @@ -237,7 +237,7 @@ "rpm": 600, "mag_size": 25, "reload_time": 2, - "guntype": "SMG" + "guntype": ["SMG", "SECONDARY"] }, { "id": 28, @@ -267,7 +267,7 @@ "rpm": 550, "mag_size": 32, "reload_time": 3, - "guntype": ["SMG", "WW2"] + "guntype": ["SMG", "PRIMARY", "WW2"] }, { "id": 31, @@ -277,7 +277,7 @@ "rpm": 750, "mag_size": 100, "reload_time": 5.5, - "guntype": ["LMG", "SOVIET"] + "guntype": ["LMG", "PRIMARY","SOVIET"] }, { "id": 32, @@ -287,7 +287,7 @@ "rpm": 850, "mag_size": 100, "reload_time": 6, - "guntype": "LMG" + "guntype": ["LMG", "PRIMARY"] }, { "id": 33, @@ -297,7 +297,7 @@ "rpm": 780, "mag_size": 125, "reload_time": 5.5, - "guntype": "LMG" + "guntype": ["LMG", "PRIMARY"] }, { "id": 34, @@ -307,7 +307,7 @@ "rpm": 700, "mag_size": 50, "reload_time": 3.25, - "guntype": "RIFLE" + "guntype": ["RIFLE", "PRIMARY"] }, { "id": 35, @@ -317,7 +317,7 @@ "rpm": 850, "mag_size": 125, "reload_time": 5.5, - "guntype": "LMG" + "guntype": ["LMG", "PRIMARY"] }, { "id": 36, @@ -327,7 +327,7 @@ "rpm": 750, "mag_size": 50, "reload_time": 3.25, - "guntype": "RIFLE" + "guntype": ["RIFLE", "PRIMARY"] }, { "id": 37, @@ -337,7 +337,7 @@ "rpm": 30, "mag_size": 5, "reload_time": 3.5, - "guntype": "SEMI-AUTO" + "guntype": ["RIFLE", "SEMI-AUTO", "PRIMARY"] }, { "id": 38, @@ -347,7 +347,7 @@ "rpm": 800, "mag_size": 50, "reload_time": 2.5, - "guntype": "SMG" + "guntype": ["SMG", "PRIMARY"] }, { "id": 39, @@ -357,7 +357,7 @@ "rpm": 900, "mag_size": 64, "reload_time": 4, - "guntype": "SMG" + "guntype": ["SMG", "PRIMARY"] }, { "id": 40, @@ -367,7 +367,7 @@ "rpm": 1000, "mag_size": 50, "reload_time": 2.45, - "guntype": "RIFLE" + "guntype": ["RIFLE", "PRIMARY"] }, { "id": 41, @@ -377,7 +377,7 @@ "rpm": 3000, "mag_size": 10000000000000000000, "reload_time": 0, - "guntype": "SPECIAL" + "guntype": ["SPECIAL"] }, { "id": 42, @@ -387,7 +387,7 @@ "rpm": 500, "mag_size": 650, "reload_time": 0, - "guntype": "SPECIAL" + "guntype": ["SPECIAL"] }, { "id": 43, @@ -397,7 +397,7 @@ "rpm": 300, "mag_size": 650, "reload_time": 0, - "guntype": "SPECIAL" + "guntype": ["SPECIAL"] }, { "id": 44, @@ -407,7 +407,7 @@ "rpm": 650, "mag_size": 18, "reload_time": 2, - "guntype": "PISTOL" + "guntype": ["PISTOL"] }, { "id": 45, @@ -417,7 +417,7 @@ "rpm": 550, "mag_size": 18, "reload_time": 2, - "guntype": "PISTOL" + "guntype": ["PISTOL"] }, { "id": 46, @@ -427,7 +427,7 @@ "rpm": 225, "mag_size": 10, "reload_time": 5, - "guntype": "SHOTGUN" + "guntype": ["SHOTGUN", "PRIMARY"] }, { "id": 48, @@ -437,7 +437,7 @@ "rpm": 550, "mag_size": 30, "reload_time": 2.35, - "guntype": "RIFLE" + "guntype": ["RIFLE", "PRIMARY"] }, { "id": 49, @@ -447,7 +447,7 @@ "rpm": 600, "mag_size": 30, "reload_time": 2.35, - "guntype": "RIFLE" + "guntype": ["RIFLE", "PRIMARY"] }, { "id": 50, @@ -457,7 +457,7 @@ "rpm": 600, "mag_size": 32, "reload_time": 2.45, - "guntype": "RIFLE" + "guntype": ["RIFLE", "PRIMARY"] }, { "id": 51, @@ -467,7 +467,7 @@ "rpm": 650, "mag_size": 32, "reload_time": 2.45, - "guntype": "RIFLE" + "guntype": ["RIFLE", "PRIMARY"] }, { "id": 52, @@ -477,7 +477,7 @@ "rpm": 625, "mag_size": 100, "reload_time": 4.5, - "guntype": "LMG" + "guntype": ["LMG", "PRIMARY"] }, { "id": 53, @@ -487,7 +487,7 @@ "rpm": 700, "mag_size": 100, "reload_time": 4.5, - "guntype": "LMG" + "guntype": ["LMG", "PRIMARY"] }, { "id": 54, @@ -497,7 +497,7 @@ "rpm": 800, "mag_size": 50, "reload_time": 2.6, - "guntype": "SMG" + "guntype": ["SMG", "PRIMARY"] }, { "id": 55, @@ -507,7 +507,7 @@ "rpm": 550, "mag_size": 32, "reload_time": 2.5, - "guntype": "SMG" + "guntype": ["SMG", "PRIMARY", "WW2"] }, { "id": 56, @@ -527,7 +527,7 @@ "rpm": 440, "mag_size": 18, "reload_time": 3.5, - "guntype": "SEMI-AUTO" + "guntype": ["RIFLE", "SEMI-AUTO", "PRIMARY"] }, { "id": 58, @@ -537,7 +537,7 @@ "rpm": 540, "mag_size": 18, "reload_time": 3.5, - "guntype": "SEMI-AUTO" + "guntype": ["RIFLE", "SEMI-AUTO", "PRIMARY"] }, { "id": 59, @@ -547,7 +547,7 @@ "rpm": 780, "mag_size": 30, "reload_time": 2.25, - "guntype": "RIFLE" + "guntype": ["RIFLE", "PRIMARY"] }, { "id": 60, @@ -577,7 +577,7 @@ "rpm": 800, "mag_size": 30, "reload_time": 1.5, - "guntype": "SMG" + "guntype": ["SMG", "PRIMARY"] }, { "id": 63, @@ -597,7 +597,7 @@ "rpm": 1050, "mag_size": 30, "reload_time": 2, - "guntype": "SMG" + "guntype": ["SMG", "PRIMARY"] }, { "id": 65, @@ -607,7 +607,7 @@ "rpm": 850, "mag_size": 30, "reload_time": 2, - "guntype": "SMG" + "guntype": ["SMG", "PRIMARY"] }, { "id": 66, @@ -617,7 +617,7 @@ "rpm": 850, "mag_size": 30, "reload_time": 2, - "guntype": "SMG" + "guntype": ["SMG", "PRIMARY"] }, { "id": 67, @@ -647,7 +647,7 @@ "rpm": 830, "mag_size": 30, "reload_time": 2.5, - "guntype": "RIFLE" + "guntype": ["RIFLE", "PRIMARY"] }, { "id": 70, @@ -657,7 +657,7 @@ "rpm": 900, "mag_size": 30, "reload_time": 2.5, - "guntype": "RIFLE" + "guntype": ["RIFLE", "PRIMARY"] }, { "id": 71, @@ -677,7 +677,7 @@ "rpm": 700, "mag_size": 30, "reload_time": 3.25, - "guntype": "RIFLE" + "guntype": ["RIFLE", "PRIMARY"] }, { "id": 73, @@ -707,7 +707,7 @@ "rpm": 300, "mag_size": 10, "reload_time": 3, - "guntype": "SEMI-AUTO" + "guntype": ["RIFLE", "PRIMARY", "SEMI-AUTO"] }, { "id": 76, @@ -727,7 +727,7 @@ "rpm": 1000, "mag_size": 71, "reload_time": 2.5, - "guntype": ["SMG", "SOVIET"] + "guntype": ["SMG", "PRIMARY", "SOVIET"] }, { "id": 78, @@ -737,7 +737,7 @@ "rpm": 690, "mag_size": 30, "reload_time": 2.5, - "guntype": ["RIFLE", "SOVIET"] + "guntype": ["RIFLE", "PRIMARY", "SOVIET"] }, { "id": 79, @@ -747,7 +747,7 @@ "rpm": 800, "mag_size": 64, "reload_time": 4, - "guntype": "SMG" + "guntype": ["SMG"] }, { "id": 80, @@ -757,7 +757,7 @@ "rpm": 800, "mag_size": 60, "reload_time": 4, - "guntype": "SMG" + "guntype": ["SMG"] }, { "id": 81, @@ -767,7 +767,7 @@ "rpm": 800, "mag_size": 50, "reload_time": 2.5, - "guntype": "SMG" + "guntype": ["SMG", "PRIMARY"] }, { "id": 82, @@ -777,7 +777,7 @@ "rpm": 400, "mag_size": 12, "reload_time": 2.6, - "guntype": "RIFLE" + "guntype": ["RIFLE"] }, { "id": 83, @@ -787,7 +787,7 @@ "rpm": 150, "mag_size": 8, "reload_time": 2.2, - "guntype": "SHOTGUN" + "guntype": ["SHOTGUN", "PRIMARY"] }, { "id": 84, @@ -797,7 +797,7 @@ "rpm": 200, "mag_size": 1000000000000000000000000000000000000000000000000000000000000000, "reload_time": 0, - "guntype": "SHOTGUN" + "guntype": ["SHOTGUN", "PRIMARY"] }, { "id": 85, @@ -807,7 +807,7 @@ "rpm": 900, "mag_size": 30, "reload_time": 4, - "guntype": "RIFLE" + "guntype": ["RIFLE", "PRIMARY"] }, { "id": 86, @@ -817,6 +817,6 @@ "rpm": 9999, "mag_size": 999, "reload_time": 1, - "guntype": "RIFLE" + "guntype": ["RIFLE", "PRIMARY"] } ] \ No newline at end of file diff --git a/templates/calculator.html b/templates/calculator.html index 74518f2..a148b0d 100644 --- a/templates/calculator.html +++ b/templates/calculator.html @@ -77,6 +77,20 @@ +
+
+ + + + + + + + + + + +
From a8b1454e1ac82e595b27af21c537bcc20b461294 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Fri, 27 Sep 2024 21:41:51 +0200 Subject: [PATCH 33/50] added semi-auto option and minor code adjustments --- static/filterWeapons.js | 2 +- templates/calculator.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 58cc41f..9d16b96 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -6,7 +6,7 @@ let selectedGunTypes = []; // Track selected gun types for filtering // Function to fetch operatives data from JSON function fetchOperativesData() { - fetch('/static/json/operative.json') + fetch('static/json/operative.json') .then(response => response.json()) .then(data => { populateOperatives(data.operatives); // Populate the operative dropdown once data is loaded diff --git a/templates/calculator.html b/templates/calculator.html index a148b0d..563af33 100644 --- a/templates/calculator.html +++ b/templates/calculator.html @@ -89,6 +89,7 @@ + From cd11c1b3beeb096249b0ec92c888fc4c6003150d Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Fri, 27 Sep 2024 21:47:08 +0200 Subject: [PATCH 34/50] renamed the 'semi-auto' checkbox to actually say Semi-Auto and not Special (typo) --- templates/calculator.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/calculator.html b/templates/calculator.html index 563af33..2441d76 100644 --- a/templates/calculator.html +++ b/templates/calculator.html @@ -89,7 +89,7 @@ - + From 835d5073fa41ab199f5a3476eb9c6135c047b252 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Fri, 27 Sep 2024 21:50:33 +0200 Subject: [PATCH 35/50] minor CSS adjustment for mobile --- static/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/style.css b/static/style.css index 8fff33a..9c8e059 100644 --- a/static/style.css +++ b/static/style.css @@ -354,7 +354,7 @@ textarea { display: block; /* Ensures each label takes up its own line */ margin-bottom: 10px; /* Adds space between each ability checkbox */ line-height: 1.2; /* Keeps the spacing between wrapped lines consistent */ - white-space: normal; /* Allows text to wrap normally */ + white-space: nowrap; /* Allows text to wrap normally */ } /* Optional: Adjust margin between checkbox and text */ From 8d58522441cde3fc0717728d2ca61731152f2b53 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Sat, 28 Sep 2024 18:38:48 +0200 Subject: [PATCH 36/50] minor CSS adjustment for mobile --- static/json/operative.json | 2 +- static/style.css | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/static/json/operative.json b/static/json/operative.json index faa7e0e..b44c75b 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -1494,7 +1494,7 @@ }, { "id": "execute-damage-perk", - "label": "Execute (+40% Reload Speed)", + "label": "Execute (+40% Damage)", "buffs": [ { "type": "damage", diff --git a/static/style.css b/static/style.css index 9c8e059..e11a0b2 100644 --- a/static/style.css +++ b/static/style.css @@ -16,7 +16,7 @@ input[type="text"] { #modifiers { display: flex; /* Use flexbox for alignment */ flex-direction: column; /* Stack items vertically */ - width: 50%; /* Adjust this percentage to control the width */ + width: 50%; } #abilities { @@ -28,7 +28,7 @@ body { background-repeat: no-repeat; background-attachment: fixed; background-size: cover; - position: relative; /* This allows the z-index on children elements to work */ + position: relative; z-index: -1; /* Send the background behind the content */ font-family: Arial, sans-serif; margin: 20px; @@ -351,15 +351,15 @@ textarea { /* Adjust spacing between different ability modifiers */ #abilities label { - display: block; /* Ensures each label takes up its own line */ - margin-bottom: 10px; /* Adds space between each ability checkbox */ - line-height: 1.2; /* Keeps the spacing between wrapped lines consistent */ - white-space: nowrap; /* Allows text to wrap normally */ + display: block; + margin-bottom: 10px; + line-height: 1.2; + white-space: nowrap; } /* Optional: Adjust margin between checkbox and text */ #abilities input[type="checkbox"] { - margin-right: 5px; /* Adjust the spacing between the checkbox and the label */ + margin-right: 5px; } } @@ -373,7 +373,7 @@ textarea { .weapon-stats-table th, .weapon-stats-table td { border: 1px solid #ddd; padding: 8px; - text-align: center; /* Center the text */ + text-align: center; /* Centers the text */ } .weapon-stats-table th { From 5856301aa8639fd6bf547a366174be48d44cd3d3 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Sat, 28 Sep 2024 18:47:32 +0200 Subject: [PATCH 37/50] json adjustments --- static/json/data.json | 4 ++-- static/json/operative.json | 34 +++++++++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/static/json/data.json b/static/json/data.json index 4fa563a..1cb5301 100644 --- a/static/json/data.json +++ b/static/json/data.json @@ -687,7 +687,7 @@ "rpm": 400, "mag_size": 18, "reload_time": 2.1, - "guntype": ["PISTOL"] + "guntype": ["PISTOL", "DEAGLE"] }, { "id": 74, @@ -697,7 +697,7 @@ "rpm": 400, "mag_size": 36, "reload_time": 3.5, - "guntype": ["PISTOL"] + "guntype": ["PISTOL", "DEAGLE"] }, { "id": 75, diff --git a/static/json/operative.json b/static/json/operative.json index b44c75b..034b909 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -266,7 +266,7 @@ "buffs": [ { "type": "damage", - "value": 1.30, + "value": 1.3, "buffType": "multiplicative" }, { @@ -698,6 +698,30 @@ } ], "appliesTo": "" + }, + { + "id": "uiu-hru-deagle-8-damage-perk", + "label": "Anomalous Deagle (Raid) (+8 Damage)", + "buffs": [ + { + "type": "damage", + "value": 8, + "buffType": "additive" + } + ], + "appliesTo": "DEAGLE" + }, + { + "id": "uiu-hru-deagle-15-damage-perk", + "label": "Anomalous Deagle (Classic) (+15 Damage)", + "buffs": [ + { + "type": "damage", + "value": 15, + "buffType": "additive" + } + ], + "appliesTo": "DEAGLE" } ] }, @@ -763,7 +787,7 @@ }, { "id": "uiu-elite-master-teamwork-damage-perk", - "label": "Moral Boost (+30% Damage)", + "label": "Master Teamwork (+30% Damage)", "buffs": [ { "type": "damage", @@ -806,7 +830,7 @@ }, { "id": "uiu-detective-secondaries-boost-damage-perk", - "label": "Secondaries Boost (+50% Damage)", + "label": "Mastery [SECONDARY] (+50% Damage)", "buffs": [ { "type": "damage", @@ -837,7 +861,7 @@ "modifiers": [ { "id": "shotgun-specialist-damage-perk", - "label": "Shotgun Specialist (+30% Damage)", + "label": "Shotgun Specialist [SHOTGUN] (+30% Damage)", "buffs": [ { "type": "damage", @@ -1482,7 +1506,7 @@ "modifiers": [ { "id": "undertaker-damage-perk", - "label": "Undertaker (+30% Damage)", + "label": "Undertaker [SHOTGUN] (+30% Damage)", "buffs": [ { "type": "damage", From cbb00b060cdf8b536947da388ff7fd69e7d268c0 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Sat, 28 Sep 2024 21:55:37 +0200 Subject: [PATCH 38/50] json adjustments --- static/json/operative.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/static/json/operative.json b/static/json/operative.json index 034b909..ce4801d 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -26,7 +26,7 @@ "modifiers": [ { "id": "shotgun-expert-damage-perk", - "label": "Shotgun Expert (+25% Damage)", + "label": "Shotgun Expert [SHOTGUN] (+25% Damage)", "value": 1.25, "type": "multiplicative", "appliesTo": "SHOTGUN" @@ -100,7 +100,7 @@ }, { "id": "lmg-user-damage-perk", - "label": "LMG User (+35% Damage)", + "label": "LMG User [LMG] (+35% Damage)", "value": 1.35, "type": "multiplicative", "appliesTo": "LMG" @@ -217,7 +217,7 @@ "modifiers": [ { "id": "smg-user-damage-perk", - "label": "SMG User (+15% Damage)", + "label": "SMG User [SMG] (+15% Damage)", "value": 1.15, "type": "multiplicative", "appliesTo": "SMG" @@ -415,7 +415,7 @@ }, { "id": "SMG-Pro-reload-perk", - "label": "SMG Pro (+100% Reload Speed)", + "label": "SMG Pro [SMG] (+100% Reload Speed)", "buffs": [ { "type": "reloadTime", @@ -427,7 +427,7 @@ }, { "id": "IA-smg-damage-perk", - "label": "SMG User (+15% Damage)", + "label": "SMG User [SMG] (+15% Damage)", "value": 1.15, "type": "multiplicative", "appliesTo": "SMG" @@ -1746,7 +1746,7 @@ }, { "id": "suppressive-fire-firerate-perk", - "label": "Hammer Ammo (+100% Firerate)", + "label": "Suppressive Fire (+100% Firerate)", "buffs": [ { "type": "rpm", From 9287c98635d800ef5da3355cb27be8c7a3f379df Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Wed, 6 Nov 2024 18:58:09 +0100 Subject: [PATCH 39/50] some new features + json adjustments --- static/filterWeapons.js | 66 +++++++++++++++++++++++++++++--------- static/json/data.json | 28 +++++++++++++--- static/json/modifiers.json | 12 +++++-- static/json/operative.json | 4 +-- 4 files changed, 85 insertions(+), 25 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 9d16b96..490254f 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -3,6 +3,9 @@ let selectedOperative = null; // Store the selected operative's data let weapons = []; // This will be populated by the fetched JSON data let globalModifiers = []; // This will be populated by the fetched JSON data let selectedGunTypes = []; // Track selected gun types for filtering +let headshotMultiplier = 0; +let headshotBaseApplied = false; + // Function to fetch operatives data from JSON function fetchOperativesData() { @@ -300,6 +303,9 @@ function applyModifiers() { let damageModifier = {additive: 0, multiplicative: 1}; let rpmModifier = {additive: 0, multiplicative: 1}; let reloadTimeModifier = {additive: 0, multiplicative: 1}; + headshotMultiplier = 0; // Reset headshot multiplier + headshotBaseApplied = false; + // Function to process global modifiers const processModifier = (mod) => { @@ -316,6 +322,28 @@ function applyModifiers() { return; // Skip this modifier if it does not apply to the selected weapon type } + + if (mod.dataset.type === 'multiplicative-headshot') { + if (!headshotBaseApplied) { + // Automatically check and apply headshot base + const baseHeadshotModifier = document.querySelector("#modifiers input[data-type='multiplicative-headshot-base']"); + if (baseHeadshotModifier && !baseHeadshotModifier.checked) { + baseHeadshotModifier.checked = true; + headshotMultiplier += parseFloat(baseHeadshotModifier.value) - 1; + headshotBaseApplied = true; + } + } + headshotMultiplier += parseFloat(mod.value) - 1; + } else if (mod.dataset.type === 'multiplicative-headshot-base') { + if (!headshotBaseApplied) { + headshotMultiplier += parseFloat(mod.value) - 1; + headshotBaseApplied = true; + } + } else { + // Process other modifiers + applyBuff(mod, rpmModifier, reloadTimeModifier, damageModifier); + } + // Handle modifiers with multiple buffs if (mod.dataset.buffs) { const buffs = JSON.parse(mod.dataset.buffs); @@ -407,12 +435,16 @@ function applyModifiers() { } }); - // Step 1: Calculate final damage + // Step 1: Calculate final damage let damage = baseDamage; // Reset to base damage // Step 2: Apply multiplicative damage modifiers damage *= damageModifier.multiplicative; + if (headshotMultiplier > 0) { + damage *= (1 + headshotMultiplier); + } + // Step 3: Apply additive damage modifiers damage += damageModifier.additive; @@ -433,27 +465,29 @@ function applyModifiers() { updateModifiedWeaponStats(damage, rpm, reloadTime); } -// Function to apply individual buffs (simplified to avoid mistakes) -function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier = null) { +// Function to apply individual buffs, with headshot handling +function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier) { const {type, buffType, value} = buff; + // Handle headshot multipliers + if (buffType === 'multiplicative-headshot-base' && !headshotBaseApplied) { + headshotMultiplier = value - 1; + headshotBaseApplied = true; + return; + } + if (buffType === 'multiplicative-headshot') { + headshotMultiplier += value - 1; + return; + } + // Apply buffs based on the stat being modified if (type === 'rpm') { if (buffType === 'multiplicative') rpmModifier.multiplicative *= value; else if (buffType === 'additive') rpmModifier.additive += value; - } - - if (type === 'reloadTime') { - if (buffType === 'multiplicative') { - reloadTimeModifier.multiplicative *= value; - } else if (buffType === 'additive') { - // Subtract value for additive reload time modifiers (like Weapon Expert) - reloadTimeModifier.additive += value; - } - } - - // Apply damage buffs - if (type === 'damage' && damageModifier) { + } else if (type === 'reloadTime') { + if (buffType === 'multiplicative') reloadTimeModifier.multiplicative *= value; + else if (buffType === 'additive') reloadTimeModifier.additive += value; + } else if (type === 'damage' && damageModifier) { if (buffType === 'multiplicative') damageModifier.multiplicative *= value; else if (buffType === 'additive') damageModifier.additive += value; } diff --git a/static/json/data.json b/static/json/data.json index 1cb5301..039512d 100644 --- a/static/json/data.json +++ b/static/json/data.json @@ -136,7 +136,7 @@ "damage_multiplier": 4, "rpm": 300, "mag_size": 7, - "reload_time": 4, + "reload_time": 4.5, "guntype": ["SHOTGUN", "PRIMARY"] }, { @@ -402,13 +402,23 @@ { "id": 44, "name": "Improved G18", - "damage": 38, + "damage": 46, "damage_multiplier": 1, "rpm": 650, "mag_size": 18, "reload_time": 2, "guntype": ["PISTOL"] }, + { + "id": 89, + "name": "Improved G18 (150+ Kills)", + "damage": 51, + "damage_multiplier": 1, + "rpm": 650, + "mag_size": 23, + "reload_time": 2, + "guntype": ["PISTOL"] + }, { "id": 45, "name": "Silenced G18", @@ -592,10 +602,20 @@ { "id": 64, "name": "Improved Vector", - "damage": 36, + "damage": 34, "damage_multiplier": 1, "rpm": 1050, - "mag_size": 30, + "mag_size": 33, + "reload_time": 2, + "guntype": ["SMG", "PRIMARY"] + }, + { + "id": 88, + "name": "Improved Vector (150+ Kills)", + "damage": 39, + "damage_multiplier": 1, + "rpm": 1050, + "mag_size": 33, "reload_time": 2, "guntype": ["SMG", "PRIMARY"] }, diff --git a/static/json/modifiers.json b/static/json/modifiers.json index 5b1b193..f0b9029 100644 --- a/static/json/modifiers.json +++ b/static/json/modifiers.json @@ -85,8 +85,14 @@ { "id": "damage-perk-multiplicative-precise-shots", "label": "Precise Shots (+15% Damage)", - "value": 1.15, - "type": "multiplicative", + "buffs": [ + { + "type": "damage", + "value": 1.15, + "buffType": "multiplicative-headshot" + } + ], + "appliesTo": "", "operatives": "" }, { @@ -115,7 +121,7 @@ { "type": "damage", "value": 1.25, - "buffType": "multiplicative" + "buffType": "multiplicative-headshot-base" } ], "appliesTo": "" diff --git a/static/json/operative.json b/static/json/operative.json index ce4801d..d0ae08c 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -694,7 +694,7 @@ { "type": "damage", "value": 1.2, - "buffType": "multiplicative" + "buffType": "multiplicative-headshot" } ], "appliesTo": "" @@ -749,7 +749,7 @@ { "type": "damage", "value": 1.2, - "buffType": "multiplicative" + "buffType": "multiplicative-headshot" } ], "appliesTo": "" From 540b4e00b63ba39e43d7433c20c050acfaad67db Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Thu, 7 Nov 2024 13:20:09 +0100 Subject: [PATCH 40/50] some new features + json adjustments --- static/filterWeapons.js | 3 ++- static/json/data.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 490254f..215251d 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -9,7 +9,7 @@ let headshotBaseApplied = false; // Function to fetch operatives data from JSON function fetchOperativesData() { - fetch('static/json/operative.json') + fetch('/static/json/operative.json') .then(response => response.json()) .then(data => { populateOperatives(data.operatives); // Populate the operative dropdown once data is loaded @@ -132,6 +132,7 @@ function populateWeapons() { selectedWeapon = weapons.find(weapon => weapon.id === selectedWeaponId); if (selectedWeapon) { updateWeaponStats(selectedWeapon); // Update stats on valid selection + applyModifiers(); } }); } diff --git a/static/json/data.json b/static/json/data.json index 039512d..5ef894b 100644 --- a/static/json/data.json +++ b/static/json/data.json @@ -2,7 +2,7 @@ { "id": 1, "name": "G18", - "damage": 32, + "damage": 34, "damage_multiplier": 1, "rpm": 550, "mag_size": 18, From 894ae41efc2db23b0f53a94a04255b0db848f88b Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Thu, 7 Nov 2024 14:39:45 +0100 Subject: [PATCH 41/50] Added some more comments --- static/filterWeapons.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 215251d..78124e2 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -132,7 +132,7 @@ function populateWeapons() { selectedWeapon = weapons.find(weapon => weapon.id === selectedWeaponId); if (selectedWeapon) { updateWeaponStats(selectedWeapon); // Update stats on valid selection - applyModifiers(); + applyModifiers(); // Apply Modifiers on valid selection } }); } From e75510dd8fdeb5405008f3211986b4226ecf0ce3 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Thu, 7 Nov 2024 15:24:11 +0100 Subject: [PATCH 42/50] Added some more comments and updated code arrangement --- static/filterWeapons.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 78124e2..b8829df 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -188,7 +188,7 @@ function updateModifiedWeaponStats(damage, rpm, reloadTime) { Modified Reload Time DPS DPM - Average DPS + Average DPS ${selectedWeapon.name} @@ -198,7 +198,7 @@ function updateModifiedWeaponStats(damage, rpm, reloadTime) { ${reloadTime.toFixed(2)} seconds - + `; @@ -541,12 +541,9 @@ function filterOperatives() { const input = document.getElementById('operative-search').value.toLowerCase(); const operativeSelect = document.getElementById('operative-select'); const options = operativeSelect.getElementsByTagName('option'); - let firstVisibleOption = null; // Track the first matching option - for (let i = 0; i < options.length; i++) { const optionText = options[i].textContent || options[i].innerText; - // Check if the option matches the search query if (optionText.toLowerCase().indexOf(input) > -1) { options[i].style.display = ''; // Show matching option @@ -557,7 +554,6 @@ function filterOperatives() { options[i].style.display = 'none'; // Hide non-matching option } } - // Automatically select the first visible matching option if (firstVisibleOption) { operativeSelect.value = firstVisibleOption.value; @@ -570,14 +566,11 @@ function filterOperatives() { function createGunTypeCheckboxes() { const gunTypeFiltersContainer = document.getElementById('gun-type-filters'); gunTypeFiltersContainer.innerHTML = ''; // Clear existing checkboxes - const gunTypesSet = new Set(); // Use a Set to store unique gun types from the weapon data - // Extract unique gun types from the weapon data weapons.forEach(weapon => { weapon.guntype.forEach(type => gunTypesSet.add(type)); // Add each gun type to the Set }); - // Create checkboxes for each unique gun type gunTypesSet.forEach(gunType => { const label = document.createElement('label'); @@ -585,21 +578,18 @@ function createGunTypeCheckboxes() { input.type = 'checkbox'; input.value = gunType; input.className = 'gun-type-checkbox'; - // Add event listener to filter weapons when checkbox is checked/unchecked input.addEventListener('change', () => { const selectedCheckboxes = Array.from(document.querySelectorAll('.gun-type-checkbox:checked')); selectedGunTypes = selectedCheckboxes.map(checkbox => checkbox.value); filterWeapons(); // Re-filter weapons based on the selected gun types }); - label.appendChild(input); label.appendChild(document.createTextNode(gunType)); gunTypeFiltersContainer.appendChild(label); gunTypeFiltersContainer.appendChild(document.createElement('br')); }); } - // Attach event listeners to the search inputs document.getElementById('weapon-search').addEventListener('keyup', filterWeapons); document.getElementById('operative-search').addEventListener('keyup', filterOperatives); @@ -608,7 +598,6 @@ document.querySelectorAll('#guntype-filters input').forEach(checkbox => { checkbox.addEventListener('change', filterWeapons); }); - // Call the fetch function to load the data and populate the dropdown on page load fetchWeaponsData(); fetchModifiers(); From 588e0ecc8846147bdb07c38205a4072b365fd150 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Thu, 7 Nov 2024 15:29:47 +0100 Subject: [PATCH 43/50] Added some more comments and updated code arrangement --- static/filterWeapons.js | 68 +++-------------------------------------- 1 file changed, 4 insertions(+), 64 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index b8829df..07208b2 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -21,30 +21,25 @@ function fetchOperativesData() { function populateOperatives(operatives) { const select = document.getElementById('operative-select'); select.innerHTML = ""; // Clear any existing options - // Add the placeholder option const placeholderOption = document.createElement('option'); placeholderOption.value = ""; // Empty value for the placeholder placeholderOption.text = "Select an operative"; select.appendChild(placeholderOption); // Add the placeholder option - operatives.forEach(operative => { const option = document.createElement('option'); option.value = operative.id; option.text = operative.name; select.appendChild(option); }); - // Attach event listener to detect when an operative is selected select.addEventListener('change', (event) => { const selectedOperativeId = event.target.value; - // If placeholder is selected, don't proceed if (!selectedOperativeId) { document.getElementById('operative-modifiers').innerHTML = ''; return; // Do nothing when the placeholder is selected } - selectedOperative = operatives.find(op => op.id === selectedOperativeId); if (selectedOperative) { updateOperativeBuffs(selectedOperative); // Update operative modifiers on valid selection @@ -54,11 +49,9 @@ function populateOperatives(operatives) { function updateOperativeBuffs(operative) { const operativeModifiers = operative.modifiers || []; - // Remove previously added operative-specific modifiers const operativeSection = document.getElementById('operative-modifiers'); operativeSection.innerHTML = ''; // Clear existing operative modifiers - // If the operative has specific modifiers, show them if (operativeModifiers.length > 0) { operativeModifiers.forEach(mod => { @@ -69,25 +62,20 @@ function updateOperativeBuffs(operative) { input.value = mod.value; input.dataset.type = mod.type; input.dataset.buffs = mod.buffs ? JSON.stringify(mod.buffs) : ''; // Store buffs if available - // Set checkbox to be unchecked by default input.checked = false; - label.appendChild(input); label.appendChild(document.createTextNode(mod.label)); operativeSection.appendChild(label); operativeSection.appendChild(document.createElement('br')); }); } - // Make sure that each operative-specific modifier checkbox triggers recalculation when changed operativeSection.addEventListener('change', applyModifiers); - // Trigger recalculation once the operative buffs are displayed applyModifiers(); } - // Function to fetch weapons data from JSON function fetchWeaponsData() { fetch('static/json/data.json') // Adjust the path to the actual location of your JSON file @@ -104,13 +92,11 @@ function fetchWeaponsData() { function populateWeapons() { const select = document.getElementById('weapon-select'); select.innerHTML = ""; // Clear any existing options - // Add the placeholder option const placeholderOption = document.createElement('option'); placeholderOption.value = ""; // Empty value for the placeholder placeholderOption.text = "Select a Weapon"; select.appendChild(placeholderOption); // Add the placeholder option - // Populate with actual weapons weapons.forEach(weapon => { const option = document.createElement('option'); @@ -118,17 +104,14 @@ function populateWeapons() { option.text = weapon.name; select.appendChild(option); }); - // Attach event listener to detect when a weapon is selected select.addEventListener('change', (event) => { const selectedWeaponId = parseInt(event.target.value); - // If placeholder is selected, don't proceed if (!selectedWeaponId) { document.getElementById('weapon-stats').innerHTML = ''; return; // Do nothing when the placeholder is selected } - selectedWeapon = weapons.find(weapon => weapon.id === selectedWeaponId); if (selectedWeapon) { updateWeaponStats(selectedWeapon); // Update stats on valid selection @@ -164,13 +147,11 @@ function updateWeaponStats(weapon) { `; - // Store values for further calculations const damage = weapon.damage * weapon.damage_multiplier; const rpm = weapon.rpm; const magSize = weapon.mag_size; const reloadTime = weapon.reload_time; - // Calculate DPS, DPM, and Average DPS calculateDPSAndDPM(damage, rpm, magSize, reloadTime); } @@ -202,7 +183,6 @@ function updateModifiedWeaponStats(damage, rpm, reloadTime) { `; - // Recalculate and update DPS, DPM, and Average DPS calculateDPSAndDPM(damage, rpm, selectedWeapon.mag_size, reloadTime); } @@ -214,14 +194,12 @@ function calculateDPSAndDPM(damage, rpm, magSize, reloadTime) { const reloadTimeMin = reloadTime / 60; let dpm = (magSize * damage) / (reloadTimeMin + (magSize / rpm)); let averageDPS = dpm / 60; // New Average DPS Calculation - // Update DPS, DPM, and Average DPS values in the table document.getElementById('dps-value').innerText = dps.toFixed(2); document.getElementById('dpm-value').innerText = dpm.toFixed(2); document.getElementById('average-dps-value').innerText = averageDPS.toFixed(2); // Update the Average DPS in the table } - // Function to fetch and populate modifiers from the JSON file function fetchModifiers() { fetch('static/json/modifiers.json') // Adjust the path to your JSON file @@ -237,22 +215,18 @@ function fetchModifiers() { function populateModifiers(modifiers) { const modifiersContainer = document.getElementById('modifiers-container'); modifiersContainer.innerHTML = ''; // Clear existing modifiers - const createModifierSection = (title, modifierList, sectionId) => { const section = document.createElement('div'); section.id = sectionId; // Set an ID for the section section.className = sectionId === 'abilities' ? 'abilities' : ''; // Only for abilities - const header = document.createElement('h3'); header.textContent = title; section.appendChild(header); - modifierList.forEach(mod => { const label = document.createElement('label'); const input = document.createElement('input'); input.type = 'checkbox'; input.id = mod.id; - // Check if the modifier has multiple buffs if (mod.buffs) { input.dataset.buffs = JSON.stringify(mod.buffs); @@ -260,33 +234,26 @@ function populateModifiers(modifiers) { input.value = mod.value; input.dataset.type = mod.type; } - label.appendChild(input); label.appendChild(document.createTextNode(mod.label)); - // Create a container for each modifier item const modifierItem = document.createElement('div'); modifierItem.className = 'modifier-item'; // Add the class for styling modifierItem.appendChild(label); section.appendChild(modifierItem); // Append the modifier item to the section }); - return section; }; - // Create a container for all modifiers const container = document.createElement('div'); container.id = 'modifiers'; - // Populate sections container.appendChild(createModifierSection('Item Buffs', modifiers.itemBuffs, 'items')); container.appendChild(createModifierSection('Perks', modifiers.operativePerks, 'perks')); modifiersContainer.appendChild(container); // Append item and perks container - // Create and append abilities section const abilitiesSection = createModifierSection('Abilities', modifiers.abilityPerks, 'abilities'); modifiersContainer.appendChild(abilitiesSection); // Append abilities section - // Add event listener to recalculate DPS/DPM when modifiers are toggled modifiersContainer.addEventListener('change', applyModifiers); } @@ -294,12 +261,10 @@ function populateModifiers(modifiers) { // Function to apply the modifiers and recalculate damage, RPM, and reloadTime function applyModifiers() { if (!selectedWeapon) return; - // Base stats let baseDamage = selectedWeapon.damage; let baseRpm = selectedWeapon.rpm; let baseReloadTime = selectedWeapon.reload_time; - // Modifiers initialization let damageModifier = {additive: 0, multiplicative: 1}; let rpmModifier = {additive: 0, multiplicative: 1}; @@ -311,19 +276,15 @@ function applyModifiers() { // Function to process global modifiers const processModifier = (mod) => { // Ensure guntype is now an array of tags - const weaponTags = selectedWeapon.guntype; // This is now an array like ["PISTOL", "WW2", "SECONDARY"] - + const weaponTags = selectedWeapon.guntype; // This is now an array like ["PISTOL", "WW2", "SECONDARY"] -> Do not write "guntype": "PISTOL", write "guntype": ["PISTOL"] // Skip the modifier if it should not apply to any of the current weapon's tags if (mod.appliesNotTo && weaponTags.includes(mod.appliesNotTo)) { return; // Skip this modifier } - // Check if the modifier applies to any of the current weapon's tags if (mod.appliesTo && !weaponTags.includes(mod.appliesTo)) { return; // Skip this modifier if it does not apply to the selected weapon type } - - if (mod.dataset.type === 'multiplicative-headshot') { if (!headshotBaseApplied) { // Automatically check and apply headshot base @@ -344,7 +305,6 @@ function applyModifiers() { // Process other modifiers applyBuff(mod, rpmModifier, reloadTimeModifier, damageModifier); } - // Handle modifiers with multiple buffs if (mod.dataset.buffs) { const buffs = JSON.parse(mod.dataset.buffs); @@ -354,13 +314,11 @@ function applyModifiers() { } else { const modType = mod.dataset.type; const modValue = parseFloat(mod.value); - const singleBuff = { type: modType === 'multiplicative' ? 'multiplicative' : 'additive', buffType: modType, value: modValue }; - if (mod.id.includes('damage')) { singleBuff.type = 'damage'; } else if (mod.id.includes('rpm')) { @@ -376,17 +334,14 @@ function applyModifiers() { const processOperativeModifier = (mod) => { // Ensure guntype is now an array of tags const weaponTags = selectedWeapon.guntype; // This is now an array like ["PISTOL", "WW2", "SECONDARY"] - // Skip the modifier if it should not apply to any of the current weapon's tags if (mod.appliesNotTo && weaponTags.includes(mod.appliesNotTo)) { return; // Skip this modifier } - // Check if the modifier applies to any of the current weapon's tags if (mod.appliesTo && !weaponTags.includes(mod.appliesTo)) { return; // Skip this modifier if it does not apply to the selected weapon type } - // Handle operative modifiers with multiple buffs if (mod.buffs) { mod.buffs.forEach(buff => { @@ -405,26 +360,19 @@ function applyModifiers() { applyBuff(singleBuff, rpmModifier, reloadTimeModifier, damageModifier); } }; - - - // Clear out listeners and avoid re-adding // Process ability modifiers const abilitiesSection = document.getElementById('abilities'); abilitiesSection.querySelectorAll('input:checked').forEach(mod => { processModifier(mod); // Process the ability modifier the same way as global modifiers }); - const modifiersContainer = document.getElementById('modifiers'); modifiersContainer.removeEventListener('change', applyModifiers); - // Process global modifiers document.querySelectorAll('#modifiers input:checked').forEach(mod => { processModifier(mod); }); - // Re-apply listener after change modifiersContainer.addEventListener('change', applyModifiers); - // Process operative-specific modifiers that are checked const operativeSection = document.getElementById('operative-modifiers'); operativeSection.querySelectorAll('input:checked').forEach(mod => { @@ -442,14 +390,15 @@ function applyModifiers() { // Step 2: Apply multiplicative damage modifiers damage *= damageModifier.multiplicative; + // Step 3: Apply headshot multiplicative damage modifiers if (headshotMultiplier > 0) { damage *= (1 + headshotMultiplier); } - // Step 3: Apply additive damage modifiers + // Step 4: Apply additive damage modifiers damage += damageModifier.additive; - // Apply the weapon's damage multiplier (if applicable) last + // Step 5: Apply the weapon's damage multiplier damage *= selectedWeapon.damage_multiplier; // Calculate other modified stats @@ -469,7 +418,6 @@ function applyModifiers() { // Function to apply individual buffs, with headshot handling function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier) { const {type, buffType, value} = buff; - // Handle headshot multipliers if (buffType === 'multiplicative-headshot-base' && !headshotBaseApplied) { headshotMultiplier = value - 1; @@ -480,7 +428,6 @@ function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier) { headshotMultiplier += value - 1; return; } - // Apply buffs based on the stat being modified if (type === 'rpm') { if (buffType === 'multiplicative') rpmModifier.multiplicative *= value; @@ -499,24 +446,18 @@ function filterWeapons() { const input = document.getElementById('weapon-search').value.toLowerCase(); const weaponSelect = document.getElementById('weapon-select'); const options = weaponSelect.getElementsByTagName('option'); - // Get selected guntype filters const selectedGuntypes = Array.from(document.querySelectorAll('#guntype-filters input:checked')) .map(checkbox => checkbox.value); - let firstVisibleOption = null; // Variable to track the first matching option - for (let i = 0; i < options.length; i++) { const optionText = options[i].textContent || options[i].innerText; const weaponId = parseInt(options[i].value); // Get the weapon ID const weapon = weapons.find(w => w.id === weaponId); // Find the corresponding weapon - if (!weapon) continue; // Skip if the weapon is not found (for safety) - // Check if the option matches the search query and the selected guntype filters const matchesSearch = optionText.toLowerCase().indexOf(input) > -1; const matchesGuntypes = selectedGuntypes.length === 0 || selectedGuntypes.every(type => weapon.guntype.includes(type)); - // Show or hide options based on both search and guntype filters if (matchesSearch && matchesGuntypes) { options[i].style.display = ''; // Show matching option @@ -527,7 +468,6 @@ function filterWeapons() { options[i].style.display = 'none'; // Hide non-matching option } } - // Automatically select the first visible matching option if (firstVisibleOption) { weaponSelect.value = firstVisibleOption.value; From 170ffdbcc4ffd527f44dfb824faf2022bd0e012a Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Thu, 7 Nov 2024 15:30:19 +0100 Subject: [PATCH 44/50] Added some more comments and updated code arrangement --- static/filterWeapons.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 07208b2..18b7929 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -383,33 +383,25 @@ function applyModifiers() { } } }); - // Step 1: Calculate final damage let damage = baseDamage; // Reset to base damage - // Step 2: Apply multiplicative damage modifiers damage *= damageModifier.multiplicative; - // Step 3: Apply headshot multiplicative damage modifiers if (headshotMultiplier > 0) { damage *= (1 + headshotMultiplier); } - // Step 4: Apply additive damage modifiers damage += damageModifier.additive; - // Step 5: Apply the weapon's damage multiplier damage *= selectedWeapon.damage_multiplier; - // Calculate other modified stats let rpm = baseRpm * rpmModifier.multiplicative + rpmModifier.additive; let reloadTime = baseReloadTime * reloadTimeModifier.multiplicative + reloadTimeModifier.additive; - // Safeguard: Reload time cannot go below 0.1 seconds if (reloadTime < 0.1) { reloadTime = 0.1; } - // Calculate and update DPS, DPM, and average DPS calculateDPSAndDPM(damage, rpm, selectedWeapon.mag_size, reloadTime); updateModifiedWeaponStats(damage, rpm, reloadTime); From d3cdca00fe27577e58da370099616ebc673085e4 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Thu, 7 Nov 2024 15:36:13 +0100 Subject: [PATCH 45/50] removed ID from gun stats --- static/populateTable.js | 19 +++++++++---------- templates/index.html | 1 - 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/static/populateTable.js b/static/populateTable.js index 47a81b5..226ce85 100644 --- a/static/populateTable.js +++ b/static/populateTable.js @@ -31,15 +31,14 @@ function populateTable(data) { table.innerHTML = ''; // Clear existing table data data.forEach(gun => { const row = table.insertRow(); - row.insertCell(0).innerText = gun.id; - row.insertCell(1).innerText = gun.name; - row.insertCell(2).innerText = gun.total_damage.toFixed(2); - 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.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); + row.insertCell(0).innerText = gun.name; + row.insertCell(1).innerText = gun.total_damage.toFixed(2); + row.insertCell(2).innerText = gun.rpm; + row.insertCell(3).innerText = gun.mag_size; + row.insertCell(4).innerText = gun.reload_time; + row.insertCell(5).innerText = gun.rps.toFixed(2); + row.insertCell(6).innerText = gun.dps.toFixed(2); + row.insertCell(7).innerText = gun.dpm.toFixed(2); + row.insertCell(8).innerText = gun.avg_dps.toFixed(2); }); } diff --git a/templates/index.html b/templates/index.html index 77de8e2..d48132e 100644 --- a/templates/index.html +++ b/templates/index.html @@ -55,7 +55,6 @@ - From d51de260a937d721e2738e32e401d5730621fe2c Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Thu, 7 Nov 2024 15:36:46 +0100 Subject: [PATCH 46/50] linting --- app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app.py b/app.py index 4e2db2e..a87ef3e 100644 --- a/app.py +++ b/app.py @@ -23,5 +23,6 @@ def about_us(): def suggestion(): return render_template('suggestion.html') + if __name__ == '__main__': app.run(debug=True) From e133d2aaa2b4868ad6eb16210f90d217125e58f5 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Fri, 8 Nov 2024 10:48:11 +0100 Subject: [PATCH 47/50] updated all json files --- static/json/data.json | 44 +++++------ static/json/modifiers.json | 23 +++++- static/json/operative.json | 148 ++++++++++++++++++++++++++----------- 3 files changed, 148 insertions(+), 67 deletions(-) diff --git a/static/json/data.json b/static/json/data.json index 5ef894b..a1e5e60 100644 --- a/static/json/data.json +++ b/static/json/data.json @@ -4,15 +4,15 @@ "name": "G18", "damage": 34, "damage_multiplier": 1, - "rpm": 550, - "mag_size": 18, + "rpm": 800, + "mag_size": 17, "reload_time": 2, "guntype": ["PISTOL", "SECONDARY"] }, { "id": 2, "name": "M1911", - "damage": 37, + "damage": 45, "damage_multiplier": 1, "rpm": 580, "mag_size": 8, @@ -22,9 +22,9 @@ { "id": 3, "name": "M9A", - "damage": 31, + "damage": 65, "damage_multiplier": 1, - "rpm": 850, + "rpm": 300, "mag_size": 15, "reload_time": 2, "guntype": ["PISTOL", "SECONDARY"] @@ -32,7 +32,7 @@ { "id": 4, "name": "M1911MK2", - "damage": 48, + "damage": 60, "damage_multiplier": 1, "rpm": 720, "mag_size": 16, @@ -42,7 +42,7 @@ { "id": 5, "name": "Luger", - "damage": 58, + "damage": 150, "damage_multiplier": 1, "rpm": 500, "mag_size": 8, @@ -142,9 +142,9 @@ { "id": 16, "name": "Shorty", - "damage": 29, + "damage": 40, "damage_multiplier": 4, - "rpm": 185, + "rpm": 150, "mag_size": 8, "reload_time": 3.5, "guntype": ["SHOTGUN", "SECONDARY"] @@ -182,10 +182,10 @@ { "id": 22, "name": "Uzi", - "damage": 20, + "damage": 32, "damage_multiplier": 1, - "rpm": 850, - "mag_size": 32, + "rpm": 950, + "mag_size": 20, "reload_time": 2, "guntype": ["SMG", "SECONDARY"] }, @@ -202,7 +202,7 @@ { "id": 24, "name": "MP5", - "damage": 23, + "damage": 26, "damage_multiplier": 1, "rpm": 800, "mag_size": 30, @@ -212,7 +212,7 @@ { "id": 25, "name": "U10", - "damage": 18, + "damage": 22, "damage_multiplier": 1, "rpm": 750, "mag_size": 65, @@ -222,7 +222,7 @@ { "id": 26, "name": "MPX", - "damage": 28, + "damage": 36, "damage_multiplier": 1, "rpm": 780, "mag_size": 30, @@ -232,7 +232,7 @@ { "id": 27, "name": "UMP45", - "damage": 28, + "damage": 36, "damage_multiplier": 1, "rpm": 600, "mag_size": 25, @@ -242,7 +242,7 @@ { "id": 28, "name": "Prototype", - "damage": 21, + "damage": 28, "damage_multiplier": 1, "rpm": 800, "mag_size": 25, @@ -252,7 +252,7 @@ { "id": 29, "name": "Prototype (Overcharged)", - "damage": 21, + "damage": 28, "damage_multiplier": 1.35, "rpm": 800, "mag_size": 25, @@ -402,7 +402,7 @@ { "id": 44, "name": "Improved G18", - "damage": 46, + "damage": 38, "damage_multiplier": 1, "rpm": 650, "mag_size": 18, @@ -502,7 +502,7 @@ { "id": 54, "name": "Improved P90", - "damage": 32, + "damage": 34, "damage_multiplier": 1, "rpm": 800, "mag_size": 50, @@ -602,10 +602,10 @@ { "id": 64, "name": "Improved Vector", - "damage": 34, + "damage": 36, "damage_multiplier": 1, "rpm": 1050, - "mag_size": 33, + "mag_size": 30, "reload_time": 2, "guntype": ["SMG", "PRIMARY"] }, diff --git a/static/json/modifiers.json b/static/json/modifiers.json index f0b9029..dfcc6f8 100644 --- a/static/json/modifiers.json +++ b/static/json/modifiers.json @@ -170,6 +170,19 @@ ], "appliesTo": "" }, + { + "id": "reload-buff-focus-fire", + "label": "[All Operatives] Focus Fire (+20% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.8, + "buffType": "multiplicative" + } + ], + "operatives": "", + "appliesTo": "" + }, { "id": "damage-ability-multiplicative-blackout", "label": "[All Operatives] Blackout (+30% Damage)", @@ -178,6 +191,14 @@ "operatives": "", "appliesTo": "" }, + { + "id": "damage-ability-demoman", + "label": "[All Operatives] Enemy hit by Demolitionist Explosive (+15% Damage)", + "value": 1.15, + "type": "multiplicative", + "operatives": "", + "appliesTo": "" + }, { "id": "damage-ability-multiplicative-red-scan", "label": "[All Operatives] Red Scan (+30% Damage)", @@ -267,4 +288,4 @@ "appliesTo": "" } ] -} +} \ No newline at end of file diff --git a/static/json/operative.json b/static/json/operative.json index d0ae08c..e29653d 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -17,7 +17,25 @@ { "id": "Classic-Scout", "name": "Scout", - "category": "Classic" + "category": "Classic", + "modifiers": [ + { + "id": "run-and-gun-damage-perk", + "label": "Run and Gun 100% (+12% Firerate, +16% Reload Speed)", + "buffs": [ + { + "type": "rpm", + "value": 1.12, + "buffType": "multiplicative" + }, + { + "type": "reloadTime", + "value": 0.84, + "buffType": "multiplicative" + } + ] + } + ] }, { "id": "Classic-RCU", @@ -26,7 +44,7 @@ "modifiers": [ { "id": "shotgun-expert-damage-perk", - "label": "Shotgun Expert [SHOTGUN] (+25% Damage)", + "label": "Shotgun Expert (+25% Damage)", "value": 1.25, "type": "multiplicative", "appliesTo": "SHOTGUN" @@ -49,6 +67,30 @@ "value": 1.30, "type": "multiplicative", "appliesTo": "" + }, + { + "id": "sergeant-high-velocity-bullets-damage-perk", + "label": "High Velocity Bullets (+25% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.25, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "sergeant-quick-hands-reload-perk", + "label": "Quick Hands (+20% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.8, + "buffType": "multiplicative" + } + ], + "appliesTo": "" } ] }, @@ -100,7 +142,7 @@ }, { "id": "lmg-user-damage-perk", - "label": "LMG User [LMG] (+35% Damage)", + "label": "LMG User (+35% Damage)", "value": 1.35, "type": "multiplicative", "appliesTo": "LMG" @@ -168,17 +210,24 @@ "category": "Classic", "modifiers": [ { - "id": "last-stand-damage-perk", - "label": "Last Stand (+150% Damage)", - "value": 2.5, + "id": "armor-restructure-10-damage-perk", + "label": "Armor Restructure(10 HP Left) (+32% Damage)", + "value": 1.32, "type": "multiplicative", "appliesTo": "" }, { - "id": "world-on-fire-damage-perk", - "label": "World on fire (+150% Damage)", - "value": 2.5, - "type": "multiplicative", + "id": "anarchist-threat-control-damage-perk", + "label": "Threat Control (Max Corruption) (+20 Damage)", + "value": 20, + "type": "additive", + "appliesTo": "" + }, + { + "id": "berserker-damage-perk", + "label": "Berserker (+30 Damage)", + "value": 30, + "type": "additive", "appliesTo": "" }, { @@ -217,7 +266,7 @@ "modifiers": [ { "id": "smg-user-damage-perk", - "label": "SMG User [SMG] (+15% Damage)", + "label": "SMG User (+15% Damage)", "value": 1.15, "type": "multiplicative", "appliesTo": "SMG" @@ -415,7 +464,7 @@ }, { "id": "SMG-Pro-reload-perk", - "label": "SMG Pro [SMG] (+100% Reload Speed)", + "label": "SMG Pro (+100% Reload Speed)", "buffs": [ { "type": "reloadTime", @@ -427,7 +476,7 @@ }, { "id": "IA-smg-damage-perk", - "label": "SMG User [SMG] (+15% Damage)", + "label": "SMG User (+15% Damage)", "value": 1.15, "type": "multiplicative", "appliesTo": "SMG" @@ -635,7 +684,23 @@ { "id": "MTF-Beta-7", "name": "Beta-7", - "category": "MTF" + "category": "MTF", + "modifiers": [ + { + "id": "toxic-rounds-damage-perk", + "label": "Toxic Rounds (+8 Damage)", + "value": 8, + "type": "additive", + "appliesTo": "" + }, + { + "id": "toxic-rounds-exploders-damage-perk", + "label": "Toxic Rounds (Against Exploders) (+100% Damage)", + "value": 2, + "type": "multiplicative", + "appliesTo": "" + } + ] }, { "id": "MTF-Commander", @@ -689,11 +754,11 @@ }, { "id": "uiu-hru-skull-cracker-damage-perk", - "label": "Skull Cracker (+20% Damage)", + "label": "Skull Cracker (+15% Damage)", "buffs": [ { "type": "damage", - "value": 1.2, + "value": 1.15, "buffType": "multiplicative-headshot" } ], @@ -744,11 +809,11 @@ }, { "id": "uiu-marksman-skull-cracker-damage-perk", - "label": "Skull Cracker (+20% Damage)", + "label": "Skull Cracker (+15% Damage)", "buffs": [ { "type": "damage", - "value": 1.2, + "value": 1.15, "buffType": "multiplicative-headshot" } ], @@ -895,23 +960,6 @@ ], "appliesTo": "SHOTGUN" }, - { - "id": "buckshot-damage-rpm-perk", - "label": "Buckshot Bullet-type [R870-B] (+20% Firerate, +15% Damage)", - "buffs": [ - { - "type": "damage", - "value": 1.15, - "buffType": "multiplicative" - }, - { - "type": "rpm", - "value": 1.20, - "buffType": "multiplicative" - } - ], - "appliesTo": "R870-B" - }, { "id": "anger-issues-damage-perk", "label": "Aggression bar (+20% Firerate, +20% Reload Speed)", @@ -1088,6 +1136,18 @@ } ], "appliesTo": "SMG" + }, + { + "id": "uiu-quick-hands-reload-perk", + "label": "Quick Hands (+20% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.8, + "buffType": "multiplicative" + } + ], + "appliesTo": "" } ] }, @@ -1396,11 +1456,11 @@ "modifiers": [ { "id": "hit-list-damage-perk", - "label": "Hit List (+50% Damage)", + "label": "Hit List (+30% Damage)", "buffs": [ { "type": "damage", - "value": 1.5, + "value": 1.3, "buffType": "multiplicative" } ], @@ -1408,11 +1468,11 @@ }, { "id": "Backliner-damage-perk", - "label": "Backliner (+35% Damage)", + "label": "Backliner (+20% Damage)", "buffs": [ { "type": "damage", - "value": 1.35, + "value": 1.20, "buffType": "multiplicative" } ], @@ -1420,11 +1480,11 @@ }, { "id": "spree-damage-perk", - "label": "Headshot Spree (+200% Damage)", + "label": "Headshot Spree (+50% Damage)", "buffs": [ { "type": "damage", - "value": 3, + "value": 1.5, "buffType": "multiplicative" } ], @@ -1439,11 +1499,11 @@ "modifiers": [ { "id": "spray-and-pary-damage-perk", - "label": "Spray and Pray (+100% Damage)", + "label": "Spray and Pray (+50% Damage)", "buffs": [ { "type": "damage", - "value": 2, + "value": 1.5, "buffType": "multiplicative" } ], @@ -1746,7 +1806,7 @@ }, { "id": "suppressive-fire-firerate-perk", - "label": "Suppressive Fire (+100% Firerate)", + "label": "Hammer Ammo (+100% Firerate)", "buffs": [ { "type": "rpm", From 6c2d54098241d2173a0c4145e36172d30a1256c9 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Fri, 8 Nov 2024 10:57:49 +0100 Subject: [PATCH 48/50] adjusted some things --- static/json/operative.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/json/operative.json b/static/json/operative.json index e29653d..26a64d3 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -35,7 +35,7 @@ } ] } - ] + ] }, { "id": "Classic-RCU", From 62f758fc4c74d7d744f9216ff6704818a74d8d05 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Fri, 8 Nov 2024 10:59:05 +0100 Subject: [PATCH 49/50] adjusted one string for better design --- static/json/operative.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/json/operative.json b/static/json/operative.json index 26a64d3..df13744 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -211,7 +211,7 @@ "modifiers": [ { "id": "armor-restructure-10-damage-perk", - "label": "Armor Restructure(10 HP Left) (+32% Damage)", + "label": "Armor Restructure (10 HP Left) (+32% Damage)", "value": 1.32, "type": "multiplicative", "appliesTo": "" From be82ecbb9321120672c75981608ea2eddedfbc3a Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Wed, 13 Nov 2024 08:57:37 +0100 Subject: [PATCH 50/50] added some more comments --- static/filterWeapons.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 18b7929..8490108 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -3,8 +3,8 @@ let selectedOperative = null; // Store the selected operative's data let weapons = []; // This will be populated by the fetched JSON data let globalModifiers = []; // This will be populated by the fetched JSON data let selectedGunTypes = []; // Track selected gun types for filtering -let headshotMultiplier = 0; -let headshotBaseApplied = false; +let headshotMultiplier = 0; // Track Headshot Multiplier +let headshotBaseApplied = false; // Track if Base Headshot Multiplier (+25%) is active // Function to fetch operatives data from JSON @@ -340,7 +340,7 @@ function applyModifiers() { } // Check if the modifier applies to any of the current weapon's tags if (mod.appliesTo && !weaponTags.includes(mod.appliesTo)) { - return; // Skip this modifier if it does not apply to the selected weapon type + return; // Skip this modifier } // Handle operative modifiers with multiple buffs if (mod.buffs) {
ID Name Damage Rounds per minute