210 lines
6.6 KiB
JavaScript
210 lines
6.6 KiB
JavaScript
/**
|
|
* Generate temporary placeholder images for all item types
|
|
* Run this script with: node generate_assets.js
|
|
*/
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
// Create directories
|
|
const directories = [
|
|
'assets/images/ships',
|
|
'assets/images/weapons',
|
|
'assets/images/armors',
|
|
'assets/images/items/materials',
|
|
'assets/images/items/consumables',
|
|
'assets/images/items/cosmetics',
|
|
'assets/images/ui/icons'
|
|
];
|
|
|
|
directories.forEach(dir => {
|
|
const fullPath = path.join(__dirname, dir);
|
|
if (!fs.existsSync(fullPath)) {
|
|
fs.mkdirSync(fullPath, { recursive: true });
|
|
console.log(`Created directory: ${dir}`);
|
|
}
|
|
});
|
|
|
|
// Generate simple SVG placeholder
|
|
function generateSVG(width, height, color, text, filename) {
|
|
const svg = `
|
|
<svg width="${width}" height="${height}" xmlns="http://www.w3.org/2000/svg">
|
|
<rect width="${width}" height="${height}" fill="${color}"/>
|
|
<text x="50%" y="50%" text-anchor="middle" dy=".3em"
|
|
font-family="Arial, sans-serif" font-size="12" fill="white">
|
|
${text}
|
|
</text>
|
|
</svg>`;
|
|
|
|
return svg;
|
|
}
|
|
|
|
// Ships - Blue theme
|
|
const ships = [
|
|
'starter_cruiser_common',
|
|
'starter_cruiser_uncommon',
|
|
'starter_cruiser_rare',
|
|
'advanced_fighter_common',
|
|
'advanced_fighter_uncommon',
|
|
'advanced_fighter_rare',
|
|
'heavy_battleship_common',
|
|
'heavy_battleship_uncommon',
|
|
'heavy_battleship_rare',
|
|
'stealth_ship_common',
|
|
'stealth_ship_uncommon',
|
|
'stealth_ship_rare'
|
|
];
|
|
|
|
// Weapons - Red theme
|
|
const weapons = [
|
|
'laser_cannon_common',
|
|
'laser_cannon_uncommon',
|
|
'laser_cannon_rare',
|
|
'plasma_rifle_common',
|
|
'plasma_rifle_uncommon',
|
|
'plasma_rifle_rare',
|
|
'missile_launcher_common',
|
|
'missile_launcher_uncommon',
|
|
'missile_launcher_rare',
|
|
'railgun_common',
|
|
'railgun_uncommon',
|
|
'railgun_rare'
|
|
];
|
|
|
|
// Armors - Green theme
|
|
const armors = [
|
|
'light_armor_common',
|
|
'light_armor_uncommon',
|
|
'light_armor_rare',
|
|
'medium_armor_common',
|
|
'medium_armor_uncommon',
|
|
'medium_armor_rare',
|
|
'heavy_armor_common',
|
|
'heavy_armor_uncommon',
|
|
'heavy_armor_rare',
|
|
'energy_shield_common',
|
|
'energy_shield_uncommon',
|
|
'energy_shield_rare'
|
|
];
|
|
|
|
// Materials - Gray theme
|
|
const materials = [
|
|
'metal_scraps',
|
|
'energy_crystal',
|
|
'plastic_parts',
|
|
'electronic_components',
|
|
'rare_earth_metal',
|
|
'quantum_core',
|
|
'nanomaterials',
|
|
'dark_matter_fragment',
|
|
'solar_panel',
|
|
'cooling_system',
|
|
'power_cell',
|
|
'hull_plating'
|
|
];
|
|
|
|
// Consumables - Purple theme
|
|
const consumables = [
|
|
'health_pack',
|
|
'energy_boost',
|
|
'shield_recharge',
|
|
'speed_boost',
|
|
'repair_kit',
|
|
'ammo_pack',
|
|
'stealth_device',
|
|
'scanner_boost',
|
|
'experience_boost',
|
|
'credit_multiplier',
|
|
'lucky_charm',
|
|
'emergency_beacon'
|
|
];
|
|
|
|
// Cosmetics - Gold theme
|
|
const cosmetics = [
|
|
'cool_paint_job',
|
|
'neon_lights',
|
|
'custom_decal',
|
|
'golden_trim',
|
|
'carbon_fiber',
|
|
'chrome_finish',
|
|
'matte_black',
|
|
'camo_pattern',
|
|
'flame_design',
|
|
'electric_aura',
|
|
'ice_effect',
|
|
'rainbow_sparkle'
|
|
];
|
|
|
|
// Generate all images
|
|
console.log('Generating ship images...');
|
|
ships.forEach(shipId => {
|
|
const rarity = shipId.split('_').pop();
|
|
const color = rarity === 'common' ? '#3498db' : rarity === 'uncommon' ? '#2ecc71' : '#f39c12';
|
|
const svg = generateSVG(80, 80, color, shipId.replace(/_/g, ' ').toUpperCase(), shipId);
|
|
fs.writeFileSync(path.join(__dirname, `assets/images/ships/${shipId}.png`), svg);
|
|
console.log(`Created: ${shipId}.png`);
|
|
});
|
|
|
|
console.log('Generating weapon images...');
|
|
weapons.forEach(weaponId => {
|
|
const rarity = weaponId.split('_').pop();
|
|
const color = rarity === 'common' ? '#e74c3c' : rarity === 'uncommon' ? '#c0392b' : '#8e44ad';
|
|
const svg = generateSVG(64, 64, color, weaponId.replace(/_/g, ' ').toUpperCase(), weaponId);
|
|
fs.writeFileSync(path.join(__dirname, `assets/images/weapons/${weaponId}.png`), svg);
|
|
console.log(`Created: ${weaponId}.png`);
|
|
});
|
|
|
|
console.log('Generating armor images...');
|
|
armors.forEach(armorId => {
|
|
const rarity = armorId.split('_').pop();
|
|
const color = rarity === 'common' ? '#27ae60' : rarity === 'uncommon' ? '#16a085' : '#2c3e50';
|
|
const svg = generateSVG(64, 64, color, armorId.replace(/_/g, ' ').toUpperCase(), armorId);
|
|
fs.writeFileSync(path.join(__dirname, `assets/images/armors/${armorId}.png`), svg);
|
|
console.log(`Created: ${armorId}.png`);
|
|
});
|
|
|
|
console.log('Generating material images...');
|
|
materials.forEach(materialId => {
|
|
const svg = generateSVG(48, 48, '#7f8c8d', materialId.replace(/_/g, ' ').toUpperCase(), materialId);
|
|
fs.writeFileSync(path.join(__dirname, `assets/images/items/materials/${materialId}.png`), svg);
|
|
console.log(`Created: ${materialId}.png`);
|
|
});
|
|
|
|
console.log('Generating consumable images...');
|
|
consumables.forEach(consumableId => {
|
|
const svg = generateSVG(48, 48, '#9b59b6', consumableId.replace(/_/g, ' ').toUpperCase(), consumableId);
|
|
fs.writeFileSync(path.join(__dirname, `assets/images/items/consumables/${consumableId}.png`), svg);
|
|
console.log(`Created: ${consumableId}.png`);
|
|
});
|
|
|
|
console.log('Generating cosmetic images...');
|
|
cosmetics.forEach(cosmeticId => {
|
|
const svg = generateSVG(64, 64, '#f1c40f', cosmeticId.replace(/_/g, ' ').toUpperCase(), cosmeticId);
|
|
fs.writeFileSync(path.join(__dirname, `assets/images/items/cosmetics/${cosmeticId}.png`), svg);
|
|
console.log(`Created: ${cosmeticId}.png`);
|
|
});
|
|
|
|
// Generate UI placeholder
|
|
console.log('Generating UI placeholder...');
|
|
const placeholderSvg = generateSVG(80, 80, '#95a5a6', 'PLACEHOLDER', 'placeholder');
|
|
fs.writeFileSync(path.join(__dirname, 'assets/images/ui/placeholder.png'), placeholderSvg);
|
|
|
|
// Generate some UI icons
|
|
const icons = ['coin', 'gem', 'heart', 'shield', 'star', 'lock', 'unlock', 'settings'];
|
|
icons.forEach(iconId => {
|
|
const svg = generateSVG(32, 32, '#34495e', iconId.toUpperCase(), iconId);
|
|
fs.writeFileSync(path.join(__dirname, `assets/images/ui/icons/${iconId}.png`), svg);
|
|
console.log(`Created icon: ${iconId}.png`);
|
|
});
|
|
|
|
console.log('\n🎉 All placeholder images generated successfully!');
|
|
console.log('📁 Total images created:');
|
|
console.log(` Ships: ${ships.length}`);
|
|
console.log(` Weapons: ${weapons.length}`);
|
|
console.log(` Armors: ${armors.length}`);
|
|
console.log(` Materials: ${materials.length}`);
|
|
console.log(` Consumables: ${consumables.length}`);
|
|
console.log(` Cosmetics: ${cosmetics.length}`);
|
|
console.log(` UI Icons: ${icons.length + 1} (including placeholder)`);
|
|
console.log('\n🚀 Your shop should now display all items with placeholder images!');
|