594eec1ab4
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m20s
Priority 4 fixes: - #50: getUnlockedAttunements filter now only returns active attunements - #48: doPrestige return type changed from void to boolean - #47: ConfirmDialog now catches and displays async errors from onConfirm - #46: GameStateDebug Fill Mana now uses direct setState instead of loop - #55: DisciplinesTab statBonus/baseValue props verified correct - #56: DisciplinesTab tab filtering verified working Priority 3 fixes: - #45: drain spell description changed from 'life force' to 'vital energy' - #44: removed banned 'ascension' skill category - #43: renamed lifeEssenceDrop to vitalityEssenceDrop - #42: pactMaster achievement requirement changed from 12 to 9 - #40: golems/utils.ts and equipment/utils.ts now import from index - #39: removed duplicate RoomType from constants/rooms.ts - #38: consolidated EquipmentSlot type in types/equipmentSlot.ts - #37: removed duplicate EnchantmentEffectDef from spell-effects/types.ts - #36: renamed RARITY_COLORS in loot-drops.ts to LOOT_RARITY_COLORS
63 lines
2.0 KiB
TypeScript
63 lines
2.0 KiB
TypeScript
// ─── Equipment Helper Functions ─────────────────────────
|
|
|
|
import type { EquipmentType, EquipmentSlot, EquipmentCategory } from './types';
|
|
import { EQUIPMENT_TYPES } from './index';
|
|
|
|
export function getEquipmentType(id: string): EquipmentType | undefined {
|
|
return EQUIPMENT_TYPES[id];
|
|
}
|
|
|
|
export function getEquipmentByCategory(category: EquipmentCategory): EquipmentType[] {
|
|
return Object.values(EQUIPMENT_TYPES).filter(e => e.category === category) as EquipmentType[];
|
|
}
|
|
|
|
export function getEquipmentBySlot(slot: EquipmentSlot): EquipmentType[] {
|
|
return Object.values(EQUIPMENT_TYPES).filter(e => e.slot === slot) as EquipmentType[];
|
|
}
|
|
|
|
export function getAllEquipmentTypes(): EquipmentType[] {
|
|
return Object.values(EQUIPMENT_TYPES) as EquipmentType[];
|
|
}
|
|
|
|
// Get valid slots for a category
|
|
// Note: For 2-handed weapons, use getValidSlotsForEquipmentType instead
|
|
export function getValidSlotsForCategory(category: EquipmentCategory): EquipmentSlot[] {
|
|
switch (category) {
|
|
case 'caster':
|
|
case 'catalyst':
|
|
case 'sword':
|
|
return ['mainHand'];
|
|
case 'shield':
|
|
return ['offHand'];
|
|
case 'head':
|
|
return ['head'];
|
|
case 'body':
|
|
return ['body'];
|
|
case 'hands':
|
|
return ['hands'];
|
|
case 'feet':
|
|
return ['feet'];
|
|
case 'accessory':
|
|
return ['accessory1', 'accessory2'];
|
|
default:
|
|
return [];
|
|
}
|
|
}
|
|
|
|
// Get valid slots for a specific equipment type (considers 2-handed weapons)
|
|
export function getValidSlotsForEquipmentType(equipType: EquipmentType): EquipmentSlot[] {
|
|
// 2-handed weapons occupy both main hand and offhand
|
|
if (equipType.twoHanded) {
|
|
return ['mainHand', 'offHand'];
|
|
}
|
|
|
|
// Otherwise use category-based slots
|
|
return getValidSlotsForCategory(equipType.category);
|
|
}
|
|
|
|
// Check if an equipment type can be equipped in a specific slot
|
|
export function canEquipInSlot(equipmentType: EquipmentType, slot: EquipmentSlot): boolean {
|
|
const validSlots = getValidSlotsForEquipmentType(equipmentType);
|
|
return validSlots.includes(slot);
|
|
}
|