Files
gamercomp/frontend/public/assets/avatar/accessories.js
T
2026-04-30 02:14:25 +00:00

763 lines
18 KiB
JavaScript

/**
* Avatar Accessories System
* Defines all unlockable accessories for the avatar customization system
*/
(function() {
'use strict';
// =============================================================================
// RARITY COLORS
// =============================================================================
var RARITY_COLORS = {
common: '#9d9d9d',
uncommon: '#1eff00',
rare: '#0070dd',
epic: '#a335ee',
legendary: '#ff8000',
mythic: '#e6cc80'
};
// =============================================================================
// EYEWEAR (15 items)
// =============================================================================
var EYEWEAR = [
{
id: 'sunglasses-classic',
name: 'Classic Sunglasses',
category: 'eyewear',
unlockLevel: 5,
rarity: 'common',
zIndex: 10,
anchor: 'eyes',
offset: { x: 0, y: -2 },
scale: 1.0,
hasEffect: false,
description: 'Timeless shades for any occasion'
},
{
id: 'aviator',
name: 'Aviator Glasses',
category: 'eyewear',
unlockLevel: 10,
rarity: 'common',
zIndex: 10,
anchor: 'eyes',
offset: { x: 0, y: -1 },
scale: 1.0,
hasEffect: false,
description: 'Top Gun approved eyewear'
},
{
id: 'nerd-glasses',
name: 'Nerd Glasses',
category: 'eyewear',
unlockLevel: 15,
rarity: 'common',
zIndex: 10,
anchor: 'eyes',
offset: { x: 0, y: 0 },
scale: 1.0,
hasEffect: false,
description: 'Intelligence +100 (cosmetic only)'
},
{
id: '3d-glasses',
name: '3D Glasses',
category: 'eyewear',
unlockLevel: 20,
rarity: 'uncommon',
zIndex: 10,
anchor: 'eyes',
offset: { x: 0, y: -1 },
scale: 1.0,
hasEffect: false,
description: 'See the world in a whole new dimension'
},
{
id: 'goggles',
name: 'Goggles',
category: 'eyewear',
unlockLevel: 25,
rarity: 'uncommon',
zIndex: 10,
anchor: 'eyes',
offset: { x: 0, y: -3 },
scale: 1.1,
hasEffect: false,
description: 'Ready for adventure or science experiments'
},
{
id: 'monocle',
name: 'Monocle',
category: 'eyewear',
unlockLevel: 30,
rarity: 'uncommon',
zIndex: 10,
anchor: 'eyes',
offset: { x: 8, y: 0 },
scale: 0.8,
hasEffect: false,
description: 'Distinguished and sophisticated'
},
{
id: 'star-glasses',
name: 'Star Glasses',
category: 'eyewear',
unlockLevel: 35,
rarity: 'rare',
zIndex: 10,
anchor: 'eyes',
offset: { x: 0, y: -2 },
scale: 1.1,
hasEffect: false,
description: 'You are a star!'
},
{
id: 'heart-glasses',
name: 'Heart Glasses',
category: 'eyewear',
unlockLevel: 40,
rarity: 'rare',
zIndex: 10,
anchor: 'eyes',
offset: { x: 0, y: -2 },
scale: 1.1,
hasEffect: false,
description: 'Spread the love wherever you go'
},
{
id: 'sport-visor',
name: 'Sport Visor',
category: 'eyewear',
unlockLevel: 45,
rarity: 'rare',
zIndex: 10,
anchor: 'eyes',
offset: { x: 0, y: -5 },
scale: 1.2,
hasEffect: false,
description: 'Professional gamer gear'
},
{
id: 'vr-headset',
name: 'VR Headset',
category: 'eyewear',
unlockLevel: 50,
rarity: 'epic',
zIndex: 11,
anchor: 'eyes',
offset: { x: 0, y: -4 },
scale: 1.3,
hasEffect: false,
description: 'Immerse yourself in virtual worlds'
},
{
id: 'cyber-visor',
name: 'Cyber Visor',
category: 'eyewear',
unlockLevel: 55,
rarity: 'epic',
zIndex: 11,
anchor: 'eyes',
offset: { x: 0, y: -3 },
scale: 1.2,
hasEffect: false,
description: 'Sleek futuristic eye protection'
},
{
id: 'x-ray-specs',
name: 'X-Ray Specs',
category: 'eyewear',
unlockLevel: 60,
rarity: 'epic',
zIndex: 11,
anchor: 'eyes',
offset: { x: 0, y: -2 },
scale: 1.1,
hasEffect: true,
description: 'See through walls... probably'
},
{
id: 'laser-eyes',
name: 'Laser Eyes',
category: 'eyewear',
unlockLevel: 70,
rarity: 'legendary',
zIndex: 12,
anchor: 'eyes',
offset: { x: 0, y: 0 },
scale: 1.0,
hasEffect: true,
description: 'Pew pew! Lasers shoot from your eyes'
},
{
id: 'diamond-glasses',
name: 'Diamond Glasses',
category: 'eyewear',
unlockLevel: 80,
rarity: 'legendary',
zIndex: 12,
anchor: 'eyes',
offset: { x: 0, y: -2 },
scale: 1.1,
hasEffect: false,
description: 'Pure crystallized luxury'
},
{
id: 'cosmic-lenses',
name: 'Cosmic Lenses',
category: 'eyewear',
unlockLevel: 90,
rarity: 'mythic',
zIndex: 13,
anchor: 'eyes',
offset: { x: 0, y: -2 },
scale: 1.2,
hasEffect: true,
description: 'Gaze upon the infinite universe'
}
];
// =============================================================================
// HEADWEAR (20 items)
// =============================================================================
var HEADWEAR = [
{
id: 'baseball-cap',
name: 'Baseball Cap',
category: 'headwear',
unlockLevel: 3,
rarity: 'common',
zIndex: 8,
anchor: 'top',
offset: { x: 0, y: -15 },
scale: 1.0,
hasEffect: false,
description: 'A classic casual cap'
},
{
id: 'backwards-cap',
name: 'Backwards Cap',
category: 'headwear',
unlockLevel: 8,
rarity: 'common',
zIndex: 8,
anchor: 'top',
offset: { x: 0, y: -15 },
scale: 1.0,
hasEffect: false,
description: 'Cool kids wear it backwards'
},
{
id: 'beanie',
name: 'Beanie',
category: 'headwear',
unlockLevel: 12,
rarity: 'common',
zIndex: 8,
anchor: 'top',
offset: { x: 0, y: -12 },
scale: 1.0,
hasEffect: false,
description: 'Cozy knitted headwear'
},
{
id: 'party-hat',
name: 'Party Hat',
category: 'headwear',
unlockLevel: 18,
rarity: 'uncommon',
zIndex: 9,
anchor: 'top',
offset: { x: 0, y: -20 },
scale: 1.0,
hasEffect: false,
description: 'Every day is a celebration!'
},
{
id: 'chef-hat',
name: 'Chef Hat',
category: 'headwear',
unlockLevel: 22,
rarity: 'uncommon',
zIndex: 9,
anchor: 'top',
offset: { x: 0, y: -25 },
scale: 1.1,
hasEffect: false,
description: 'Master of the kitchen'
},
{
id: 'crown-bronze',
name: 'Bronze Crown',
category: 'headwear',
unlockLevel: 25,
rarity: 'uncommon',
zIndex: 9,
anchor: 'top',
offset: { x: 0, y: -18 },
scale: 1.0,
hasEffect: false,
description: 'A humble crown for rising royalty'
},
{
id: 'hard-hat',
name: 'Hard Hat',
category: 'headwear',
unlockLevel: 26,
rarity: 'uncommon',
zIndex: 9,
anchor: 'top',
offset: { x: 0, y: -14 },
scale: 1.0,
hasEffect: false,
description: 'Safety first on the job site'
},
{
id: 'wizard-hat',
name: 'Wizard Hat',
category: 'headwear',
unlockLevel: 30,
rarity: 'rare',
zIndex: 9,
anchor: 'top',
offset: { x: 0, y: -30 },
scale: 1.2,
hasEffect: false,
description: 'Channel your inner sorcerer'
},
{
id: 'pirate-hat',
name: 'Pirate Hat',
category: 'headwear',
unlockLevel: 35,
rarity: 'rare',
zIndex: 9,
anchor: 'top',
offset: { x: 0, y: -18 },
scale: 1.1,
hasEffect: false,
description: 'Arrr! Set sail for adventure'
},
{
id: 'santa-hat',
name: 'Santa Hat',
category: 'headwear',
unlockLevel: 38,
rarity: 'rare',
zIndex: 9,
anchor: 'top',
offset: { x: 3, y: -16 },
scale: 1.0,
hasEffect: false,
description: 'Ho ho ho! Spread holiday cheer'
},
{
id: 'crown-silver',
name: 'Silver Crown',
category: 'headwear',
unlockLevel: 40,
rarity: 'rare',
zIndex: 9,
anchor: 'top',
offset: { x: 0, y: -18 },
scale: 1.0,
hasEffect: false,
description: 'A noble crown for dedicated players'
},
{
id: 'graduation-cap',
name: 'Graduation Cap',
category: 'headwear',
unlockLevel: 42,
rarity: 'rare',
zIndex: 9,
anchor: 'top',
offset: { x: 0, y: -16 },
scale: 1.0,
hasEffect: false,
description: 'Scholar of the gaming arts'
},
{
id: 'bunny-ears',
name: 'Bunny Ears',
category: 'headwear',
unlockLevel: 45,
rarity: 'rare',
zIndex: 9,
anchor: 'top',
offset: { x: 0, y: -22 },
scale: 1.1,
hasEffect: false,
description: 'Hop into the fun!'
},
{
id: 'devil-horns',
name: 'Devil Horns',
category: 'headwear',
unlockLevel: 48,
rarity: 'rare',
zIndex: 9,
anchor: 'top',
offset: { x: 0, y: -14 },
scale: 1.0,
hasEffect: false,
description: 'A little mischief never hurt anyone'
},
{
id: 'halo',
name: 'Halo',
category: 'headwear',
unlockLevel: 52,
rarity: 'epic',
zIndex: 7,
anchor: 'top',
offset: { x: 0, y: -25 },
scale: 1.0,
hasEffect: true,
description: 'An angelic golden ring of light'
},
{
id: 'top-hat',
name: 'Top Hat',
category: 'headwear',
unlockLevel: 56,
rarity: 'epic',
zIndex: 9,
anchor: 'top',
offset: { x: 0, y: -28 },
scale: 1.1,
hasEffect: false,
description: 'Dapper and distinguished'
},
{
id: 'crown-gold',
name: 'Gold Crown',
category: 'headwear',
unlockLevel: 60,
rarity: 'epic',
zIndex: 10,
anchor: 'top',
offset: { x: 0, y: -18 },
scale: 1.1,
hasEffect: false,
description: 'True royalty in golden splendor'
},
{
id: 'viking-helmet',
name: 'Viking Helmet',
category: 'headwear',
unlockLevel: 62,
rarity: 'epic',
zIndex: 9,
anchor: 'top',
offset: { x: 0, y: -16 },
scale: 1.2,
hasEffect: false,
description: 'Conquer games like a Norse warrior'
},
{
id: 'crown-diamond',
name: 'Diamond Crown',
category: 'headwear',
unlockLevel: 80,
rarity: 'legendary',
zIndex: 10,
anchor: 'top',
offset: { x: 0, y: -20 },
scale: 1.2,
hasEffect: true,
description: 'A magnificent crown of pure diamonds'
},
{
id: 'crown-cosmic',
name: 'Cosmic Crown',
category: 'headwear',
unlockLevel: 100,
rarity: 'mythic',
zIndex: 11,
anchor: 'top',
offset: { x: 0, y: -22 },
scale: 1.3,
hasEffect: true,
description: 'The ultimate crown, forged from stardust'
}
];
// =============================================================================
// EFFECTS/AURAS (10 items)
// =============================================================================
var EFFECTS = [
{
id: 'sparkle-trail',
name: 'Sparkle Trail',
category: 'effect',
unlockLevel: 15,
rarity: 'uncommon',
zIndex: 1,
anchor: 'head',
offset: { x: 0, y: 0 },
scale: 1.0,
hasEffect: true,
effectType: 'particles',
color: '#FFD700',
description: 'Leave a trail of golden sparkles'
},
{
id: 'fire-aura',
name: 'Fire Aura',
category: 'effect',
unlockLevel: 25,
rarity: 'rare',
zIndex: 0,
anchor: 'head',
offset: { x: 0, y: 0 },
scale: 1.2,
hasEffect: true,
effectType: 'glow',
color: '#FF4500',
description: 'Surrounded by fierce flames'
},
{
id: 'lightning-crackle',
name: 'Lightning Crackle',
category: 'effect',
unlockLevel: 35,
rarity: 'rare',
zIndex: 2,
anchor: 'head',
offset: { x: 0, y: 0 },
scale: 1.1,
hasEffect: true,
effectType: 'electric',
color: '#00BFFF',
description: 'Electricity crackles around you'
},
{
id: 'rainbow-glow',
name: 'Rainbow Glow',
category: 'effect',
unlockLevel: 45,
rarity: 'epic',
zIndex: 0,
anchor: 'head',
offset: { x: 0, y: 0 },
scale: 1.3,
hasEffect: true,
effectType: 'glow',
color: 'rainbow',
description: 'Radiate all colors of the spectrum'
},
{
id: 'star-particles',
name: 'Star Particles',
category: 'effect',
unlockLevel: 55,
rarity: 'epic',
zIndex: 2,
anchor: 'head',
offset: { x: 0, y: 0 },
scale: 1.2,
hasEffect: true,
effectType: 'particles',
color: '#FFFF00',
description: 'Tiny stars orbit around you'
},
{
id: 'ice-crystals',
name: 'Ice Crystals',
category: 'effect',
unlockLevel: 65,
rarity: 'legendary',
zIndex: 2,
anchor: 'head',
offset: { x: 0, y: 0 },
scale: 1.2,
hasEffect: true,
effectType: 'particles',
color: '#87CEEB',
description: 'Frozen crystals shimmer around you'
},
{
id: 'shadow-effect',
name: 'Shadow Effect',
category: 'effect',
unlockLevel: 70,
rarity: 'legendary',
zIndex: -1,
anchor: 'head',
offset: { x: 0, y: 0 },
scale: 1.4,
hasEffect: true,
effectType: 'shadow',
color: '#2F2F4F',
description: 'Darkness follows your every move'
},
{
id: 'golden-glow',
name: 'Golden Glow',
category: 'effect',
unlockLevel: 75,
rarity: 'legendary',
zIndex: 0,
anchor: 'head',
offset: { x: 0, y: 0 },
scale: 1.3,
hasEffect: true,
effectType: 'glow',
color: '#FFD700',
description: 'Bathe in pure golden light'
},
{
id: 'void-aura',
name: 'Void Aura',
category: 'effect',
unlockLevel: 85,
rarity: 'mythic',
zIndex: -1,
anchor: 'head',
offset: { x: 0, y: 0 },
scale: 1.5,
hasEffect: true,
effectType: 'void',
color: '#4B0082',
description: 'The void itself surrounds you'
},
{
id: 'cosmic-trail',
name: 'Cosmic Trail',
category: 'effect',
unlockLevel: 95,
rarity: 'mythic',
zIndex: 1,
anchor: 'head',
offset: { x: 0, y: 0 },
scale: 1.4,
hasEffect: true,
effectType: 'cosmic',
color: 'cosmic',
description: 'Trail galaxies and nebulae in your wake'
}
];
// =============================================================================
// HELPER FUNCTIONS
// =============================================================================
/**
* Get all accessories combined into a single array
*/
function getAll() {
return [].concat(EYEWEAR, HEADWEAR, EFFECTS);
}
/**
* Get accessories filtered by category
* @param {string} category - 'eyewear', 'headwear', or 'effect'
*/
function getByCategory(category) {
switch (category) {
case 'eyewear':
return EYEWEAR.slice();
case 'headwear':
return HEADWEAR.slice();
case 'effect':
return EFFECTS.slice();
default:
return [];
}
}
/**
* Find an accessory by its unique ID
* @param {string} id - The accessory ID
*/
function getById(id) {
var all = getAll();
for (var i = 0; i < all.length; i++) {
if (all[i].id === id) {
return all[i];
}
}
return null;
}
/**
* Get all accessories of a specific rarity
* @param {string} rarity - 'common', 'uncommon', 'rare', 'epic', 'legendary', or 'mythic'
*/
function getByRarity(rarity) {
return getAll().filter(function(item) {
return item.rarity === rarity;
});
}
/**
* Get all accessories unlockable at or before the given level
* @param {number} level - The player's current level
*/
function getUnlockedAtLevel(level) {
return getAll().filter(function(item) {
return item.unlockLevel <= level;
});
}
/**
* Get accessories that unlock exactly at the specified level
* @param {number} level - The level to check
*/
function getNewlyUnlockedAtLevel(level) {
return getAll().filter(function(item) {
return item.unlockLevel === level;
});
}
/**
* Get the color associated with a rarity
* @param {string} rarity - The rarity level
*/
function getRarityColor(rarity) {
return RARITY_COLORS[rarity] || RARITY_COLORS.common;
}
/**
* Get an organized catalog for UI display
* Returns accessories grouped by category and sorted by unlock level
*/
function getCatalog() {
var sortByLevel = function(a, b) {
return a.unlockLevel - b.unlockLevel;
};
return {
eyewear: EYEWEAR.slice().sort(sortByLevel),
headwear: HEADWEAR.slice().sort(sortByLevel),
effects: EFFECTS.slice().sort(sortByLevel),
totalCount: EYEWEAR.length + HEADWEAR.length + EFFECTS.length,
rarityColors: Object.assign({}, RARITY_COLORS)
};
}
// =============================================================================
// PUBLIC API
// =============================================================================
window.AvatarAccessories = {
// Data arrays
EYEWEAR: EYEWEAR,
HEADWEAR: HEADWEAR,
EFFECTS: EFFECTS,
RARITY_COLORS: RARITY_COLORS,
// Methods
getAll: getAll,
getByCategory: getByCategory,
getById: getById,
getByRarity: getByRarity,
getUnlockedAtLevel: getUnlockedAtLevel,
getNewlyUnlockedAtLevel: getNewlyUnlockedAtLevel,
getRarityColor: getRarityColor,
getCatalog: getCatalog
};
})();