Merge remote-tracking branch 'origin/main'

This commit is contained in:
IM23a-bachmannj2
2024-09-17 14:23:04 +02:00
3 changed files with 85 additions and 215 deletions
+34 -1
View File
@@ -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/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
})
.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() {
@@ -184,7 +217,6 @@ function applyModifiers() {
}
// Helper function to apply individual buffs
function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier = null) {
const {type, buffType, value} = buff;
@@ -236,3 +268,4 @@ function updateModifiedWeaponStats(damage, rpm, reloadTime) {
// Call the fetch function to load the data and populate the dropdown on page load
fetchWeaponsData();
fetchModifiers();
fetchOperativesData()
+13 -182
View File
@@ -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"
}
]
}
+10 -4
View File
@@ -59,15 +59,21 @@
<!-- Weapon options will be populated here dynamically -->
</select>
<!-- Weapon Stats will be displayed here -->
<div id="weapon-stats"></div>
<!-- Operative Select Dropdown -->
<label for="operative-select">Pick an Operative</label>
<select id="operative-select">
<option value="">Select an operative</option>
</select>
<!-- Calculated DPS/DPM results will be shown here -->
<!-- Weapon Stats Display -->
<div id="weapon-stats"></div>
<div id="calculated-stats"></div>
<!-- Modifier Checkboxes -->
<!-- Modifiers Display -->
<div id="modifiers"></div>
<script src="{{ url_for('static', filename='filterWeapons.js') }}"></script>
</main>
</body>