feat: add weapon type filter (heavy, light, finesse, 2H, bow, crossbow, thrown, caster)
Backend: new weapon_type query parameter on /search/items. Uses skill ID from IntValues[218103840] for melee types (Heavy=44, Light=45, Finesse=46, TwoHanded=41) and name matching for missile sub-types (bow, crossbow, thrown). Caster = ObjectClass 31. Frontend: dropdown appears when "Weapons" radio selected, hidden otherwise. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
35a11d0cf1
commit
9749eafde4
3 changed files with 60 additions and 4 deletions
|
|
@ -552,6 +552,20 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="filter-group" id="weaponTypeGroup" style="display: none;">
|
||||
<label>Weapon Type:</label>
|
||||
<select id="weaponTypeFilter">
|
||||
<option value="">All Weapons</option>
|
||||
<option value="heavy">Heavy Weapons</option>
|
||||
<option value="light">Light Weapons</option>
|
||||
<option value="finesse">Finesse Weapons</option>
|
||||
<option value="two_handed">Two Handed</option>
|
||||
<option value="bow">Bow</option>
|
||||
<option value="crossbow">Crossbow</option>
|
||||
<option value="thrown">Thrown</option>
|
||||
<option value="caster">Wand/Staff/Orb</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="filter-group">
|
||||
<label>Slot:</label>
|
||||
<select id="slotFilter">
|
||||
|
|
|
|||
|
|
@ -57,6 +57,17 @@ function initializeEventListeners() {
|
|||
document.getElementById('backToSearch').addEventListener('click', showSearchSection);
|
||||
document.getElementById('runSetAnalysis').addEventListener('click', performSetAnalysis);
|
||||
|
||||
// Show/hide weapon type dropdown when equipment type changes
|
||||
document.querySelectorAll('input[name="equipmentType"]').forEach(radio => {
|
||||
radio.addEventListener('change', (e) => {
|
||||
const weaponGroup = document.getElementById('weaponTypeGroup');
|
||||
weaponGroup.style.display = e.target.value === 'weapon' ? '' : 'none';
|
||||
if (e.target.value !== 'weapon') {
|
||||
document.getElementById('weaponTypeFilter').value = '';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Checkbox visual feedback for cantrips and equipment sets
|
||||
document.querySelectorAll('.checkbox-item input[type="checkbox"]').forEach(checkbox => {
|
||||
checkbox.addEventListener('change', handleCheckboxChange);
|
||||
|
|
@ -168,8 +179,10 @@ function clearAllFields() {
|
|||
// Reset equipment type to armor
|
||||
document.getElementById('armorOnly').checked = true;
|
||||
|
||||
// Reset slot filter
|
||||
// Reset slot filter and weapon type
|
||||
document.getElementById('slotFilter').value = '';
|
||||
document.getElementById('weaponTypeFilter').value = '';
|
||||
document.getElementById('weaponTypeGroup').style.display = 'none';
|
||||
|
||||
// Clear item state checkboxes (not covered by form.reset for standalone checkboxes)
|
||||
['searchBonded', 'searchAttuned', 'searchIsRare'].forEach(id => {
|
||||
|
|
@ -258,6 +271,10 @@ function buildSearchParameters() {
|
|||
params.append('pants_only', 'true');
|
||||
} else if (equipmentType === 'weapon') {
|
||||
params.append('weapon_only', 'true');
|
||||
const weaponType = document.getElementById('weaponTypeFilter')?.value;
|
||||
if (weaponType) {
|
||||
params.append('weapon_type', weaponType);
|
||||
}
|
||||
} else if (equipmentType === 'clothing') {
|
||||
params.append('clothing_only', 'true');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue