Merge remote-tracking branch 'origin/main'
This commit is contained in:
+34
-1
@@ -1,5 +1,38 @@
|
|||||||
let selectedWeapon = null; // Store the selected weapon's data
|
let selectedWeapon = null; // Store the selected weapon's data
|
||||||
let weapons = []; // This will be populated by the fetched JSON 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 to fetch weapons data from JSON
|
||||||
function fetchWeaponsData() {
|
function fetchWeaponsData() {
|
||||||
@@ -184,7 +217,6 @@ function applyModifiers() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Helper function to apply individual buffs
|
// Helper function to apply individual buffs
|
||||||
function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier = null) {
|
function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier = null) {
|
||||||
const {type, buffType, value} = buff;
|
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
|
// Call the fetch function to load the data and populate the dropdown on page load
|
||||||
fetchWeaponsData();
|
fetchWeaponsData();
|
||||||
fetchModifiers();
|
fetchModifiers();
|
||||||
|
fetchOperativesData()
|
||||||
+13
-182
@@ -3,236 +3,67 @@
|
|||||||
{
|
{
|
||||||
"id": "Classic-Guard",
|
"id": "Classic-Guard",
|
||||||
"name": "Guard",
|
"name": "Guard",
|
||||||
"buffs": [
|
"category": "Classic"
|
||||||
{
|
|
||||||
"label": "[SMG] (+15% Damage)",
|
|
||||||
"type": "damage",
|
|
||||||
"value": 1.15,
|
|
||||||
"affectedWeapons": "SMG",
|
|
||||||
"buffType": "multiplicative"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "Classic-Scout",
|
"id": "Classic-Scout",
|
||||||
"name": "Scout",
|
"name": "Scout",
|
||||||
"buffs": [
|
"category": "Classic"
|
||||||
{
|
|
||||||
"label": "None",
|
|
||||||
"type": "damage",
|
|
||||||
"value": 1,
|
|
||||||
"affectedWeapons": "",
|
|
||||||
"buffType": "multiplicative"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "Classic-RCU",
|
"id": "Classic-RCU",
|
||||||
"name": "RCU",
|
"name": "RCU",
|
||||||
"buffs": [
|
"category": "Classic"
|
||||||
{
|
|
||||||
"label": "[SHOTGUN] +25% Damage",
|
|
||||||
"type": "damage",
|
|
||||||
"value": 1.25,
|
|
||||||
"affectedWeapons": "SHOTGUN",
|
|
||||||
"buffType": "multiplicative"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "Classic-Viper",
|
"id": "Classic-Viper",
|
||||||
"name": "Viper",
|
"name": "Viper",
|
||||||
"buffs": [
|
"category": "Classic"
|
||||||
{
|
|
||||||
"label": "None",
|
|
||||||
"type": "damage",
|
|
||||||
"value": 1,
|
|
||||||
"affectedWeapons": "",
|
|
||||||
"buffType": "multiplicative"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "Classic-SD-Sergeant",
|
"id": "Classic-SD-Sergeant",
|
||||||
"name": "SD Sergeant",
|
"name": "SD Sergeant",
|
||||||
"buffs": [
|
"category": "Classic"
|
||||||
{
|
|
||||||
"label": "Max Corruption (+30% Damage)",
|
|
||||||
"type": "damage",
|
|
||||||
"value": 1.3,
|
|
||||||
"affectedWeapons": "",
|
|
||||||
"buffType": "multiplicative"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "Classic-ISD",
|
"id": "Classic-ISD",
|
||||||
"name": "ISD",
|
"name": "ISD",
|
||||||
"buffs": [
|
"category": "Classic"
|
||||||
{
|
|
||||||
"label": "[Chaos Insurgency] +50% Damage",
|
|
||||||
"type": "damage",
|
|
||||||
"value": 1.5,
|
|
||||||
"affectedWeapons": "",
|
|
||||||
"buffType": "multiplicative"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "Classic-TRU",
|
"id": "Classic-TRU",
|
||||||
"name": "TRU",
|
"name": "TRU",
|
||||||
"buffs": [
|
"category": "Classic"
|
||||||
{
|
|
||||||
"label": "None",
|
|
||||||
"type": "damage",
|
|
||||||
"value": 1,
|
|
||||||
"affectedWeapons": "",
|
|
||||||
"buffType": "multiplicative"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "Classic-SD-Captain",
|
"id": "Classic-SD-Captain",
|
||||||
"name": "SD Captain",
|
"name": "SD Captain",
|
||||||
"buffs": [
|
"category": "Classic"
|
||||||
{
|
|
||||||
"label": "None",
|
|
||||||
"type": "damage",
|
|
||||||
"value": 1,
|
|
||||||
"affectedWeapons": "",
|
|
||||||
"buffType": "multiplicative"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "Classic-Vanguard",
|
"id": "Classic-Vanguard",
|
||||||
"name": "Vanguard",
|
"name": "Vanguard",
|
||||||
"buffs": [
|
"category": "Classic"
|
||||||
{
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "Classic-Demolitionist",
|
"id": "Classic-Demolitionist",
|
||||||
"name": "Demolitionist",
|
"name": "Demolitionist",
|
||||||
"buffs": [
|
"category": "Classic"
|
||||||
{
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "Classic-Mercenary",
|
"id": "Classic-Mercenary",
|
||||||
"name": "Mercenary",
|
"name": "Mercenary",
|
||||||
"buffs": [
|
"category": "Classic"
|
||||||
{
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "Classic-CRT",
|
"id": "Classic-CRT",
|
||||||
"name": "CRT",
|
"name": "CRT",
|
||||||
"buffs": [
|
"category": "Classic"
|
||||||
{
|
|
||||||
"label": "None",
|
|
||||||
"type": "damage",
|
|
||||||
"value": 1,
|
|
||||||
"affectedWeapons": "",
|
|
||||||
"buffType": "multiplicative"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "Classic-Anarchist",
|
"id": "Classic-Anarchist",
|
||||||
"name": "Anarchist",
|
"name": "Anarchist",
|
||||||
"buffs": [
|
"category": "Classic"
|
||||||
{
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,15 +59,21 @@
|
|||||||
<!-- Weapon options will be populated here dynamically -->
|
<!-- Weapon options will be populated here dynamically -->
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- Weapon Stats will be displayed here -->
|
<!-- Operative Select Dropdown -->
|
||||||
<div id="weapon-stats"></div>
|
<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>
|
<div id="calculated-stats"></div>
|
||||||
|
|
||||||
<!-- Modifier Checkboxes -->
|
<!-- Modifiers Display -->
|
||||||
<div id="modifiers"></div>
|
<div id="modifiers"></div>
|
||||||
|
|
||||||
|
|
||||||
<script src="{{ url_for('static', filename='filterWeapons.js') }}"></script>
|
<script src="{{ url_for('static', filename='filterWeapons.js') }}"></script>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user