This repository has been archived on 2026-05-04. You can view files and clone it, but cannot push or open issues or pull requests.
Galaxy-Strike-Online/Client/js/data/GameData.js

126 lines
3.7 KiB
JavaScript

/**
* Galaxy Strike Online - Game Data
* UI constants and configuration only.
* All game content (items, skills, recipes, dungeons, enemies) is loaded from the server.
*/
// Game configuration
const GAME_CONFIG = {
version: '1.0.0',
name: 'Galaxy Strike Online',
maxLevel: 100,
saveInterval: 30000, // 30 seconds
notificationDuration: 3000,
maxNotifications: 5
};
// Player defaults (used only for initial UI state before server data arrives)
const PLAYER_DEFAULTS = {
level: 1,
experience: 0,
skillPoints: 0,
credits: 1000,
gems: 10,
health: 100,
maxHealth: 100,
energy: 100,
maxEnergy: 100,
attack: 10,
defense: 5,
speed: 10,
criticalChance: 0.05,
criticalDamage: 1.5
};
// Experience requirements (client-side display only; server is authoritative)
const EXPERIENCE_TABLE = [];
for (let i = 1; i <= 100; i++) {
EXPERIENCE_TABLE[i] = Math.floor(100 * Math.pow(1.5, i - 1));
}
// Item rarity display properties (colours/labels only - drop rates are server-side)
const ITEM_RARITIES = {
common: { name: 'Common', color: '#888888', multiplier: 1.0 },
uncommon: { name: 'Uncommon', color: '#00ff00', multiplier: 1.2 },
rare: { name: 'Rare', color: '#0088ff', multiplier: 1.5 },
epic: { name: 'Epic', color: '#8833ff', multiplier: 2.0 },
legendary: { name: 'Legendary', color: '#ff8800', multiplier: 3.0 }
};
// Game messages and notifications
const GAME_MESSAGES = {
welcome: 'Welcome to Galaxy Strike Online, Commander!',
levelUp: 'Level Up! You are now level {level}!',
questCompleted: 'Quest completed: {questName}!',
dungeonCompleted: 'Dungeon completed! Time: {time}',
achievementUnlocked: 'Achievement Unlocked: {achievementName}!',
insufficientCredits: 'Not enough credits!',
insufficientGems: 'Not enough gems!',
insufficientEnergy: 'Not enough energy!',
inventoryFull: 'Inventory is full!',
skillPointsAvailable: 'You have {points} skill points available!',
dailyReward: 'Daily reward claimed! Day {day}',
offlineRewards: 'Welcome back! You were offline for {time}'
};
// Utility functions
const GameUtils = {
getRandomItem(array) {
return array[Math.floor(Math.random() * array.length)];
},
getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
},
getRandomFloat(min, max) {
return Math.random() * (max - min) + min;
},
checkChance(chance) {
return Math.random() < chance;
},
formatNumber(num) {
if (num >= 1000000) return (num / 1000000).toFixed(1) + 'M';
if (num >= 1000) return (num / 1000).toFixed(1) + 'K';
return Math.floor(num).toString();
},
formatTime(milliseconds) {
const seconds = Math.floor(milliseconds / 1000);
const minutes = Math.floor(seconds / 60);
const hours = Math.floor(minutes / 60);
const days = Math.floor(hours / 24);
if (days > 0) return `${days}d ${hours % 24}h`;
if (hours > 0) return `${hours}h ${minutes % 60}m`;
if (minutes > 0) return `${minutes}m ${seconds % 60}s`;
return `${seconds}s`;
},
getExperienceForLevel(level) {
return EXPERIENCE_TABLE[level] || 0;
},
deepClone(obj) {
return JSON.parse(JSON.stringify(obj));
},
generateId() {
return Date.now().toString() + Math.random().toString(36).substr(2, 9);
}
};
// Export for use in other modules
if (typeof module !== 'undefined' && module.exports) {
module.exports = {
GAME_CONFIG,
PLAYER_DEFAULTS,
EXPERIENCE_TABLE,
ITEM_RARITIES,
GAME_MESSAGES,
GameUtils
};
}