feat: implement purge logic for undefined Ikonis weapon features to ensure data consistency

This commit is contained in:
CPTN Cosmo 2026-04-26 20:52:41 +02:00
parent b7b9a62fcc
commit f488400e78

View file

@ -46,10 +46,19 @@ export async function seedIkonisHomebrew() {
if (!homebrew.itemFeatures.weaponFeatures) homebrew.itemFeatures.weaponFeatures = {};
let updates = false;
const recognizedIds = DEFAULT_AUGMENTS.map(aug => `ikonis-${aug.id}`);
// Purge undefined Ikonis features
for (const [id, feature] of Object.entries(homebrew.itemFeatures.weaponFeatures)) {
if (id.startsWith('ikonis-') && !recognizedIds.includes(id)) {
console.log(`DH-Ikonis | Purging undefined feature: ${id}`);
delete homebrew.itemFeatures.weaponFeatures[id];
updates = true;
}
}
for (const aug of DEFAULT_AUGMENTS) {
const nativeId = `ikonis-${aug.id}`;
const existing = homebrew.itemFeatures.weaponFeatures[nativeId];
// Force update to ensure 16-character IDs and correct mechanical effects are synced
console.log(`DH-Ikonis | Seeding/Updating feature: ${aug.name}`);
homebrew.itemFeatures.weaponFeatures[nativeId] = {