uploaded
This commit is contained in:
100
config.js
Normal file
100
config.js
Normal file
@@ -0,0 +1,100 @@
|
||||
// config.js
|
||||
const GAMEMODES = [
|
||||
'NETH_POT',
|
||||
'CRYSTAL',
|
||||
'CLASSIC',
|
||||
'BUILDUHC',
|
||||
'SUMO',
|
||||
'GAP',
|
||||
'AXE',
|
||||
'SMP',
|
||||
'VANILLA',
|
||||
'BRIDGE',
|
||||
'COMBO',
|
||||
'FIREBALL',
|
||||
];
|
||||
|
||||
const GAMEMODE_LABELS = {
|
||||
NETH_POT: 'Netherite Pot',
|
||||
CRYSTAL: 'Crystal',
|
||||
CLASSIC: 'Classic',
|
||||
BUILDUHC: 'Build UHC',
|
||||
SUMO: 'Sumo',
|
||||
GAP: 'Gapple',
|
||||
AXE: 'Axe',
|
||||
SMP: 'SMP',
|
||||
VANILLA: 'Vanilla',
|
||||
BRIDGE: 'Bridge',
|
||||
COMBO: 'Combo',
|
||||
FIREBALL: 'Fireball',
|
||||
};
|
||||
|
||||
const REGIONS = ['NA', 'EU', 'AS', 'AU'];
|
||||
|
||||
// Minecraft username regex: 3-16 chars, letters, numbers, underscore
|
||||
const USERNAME_REGEX = /^[a-zA-Z0-9_]{3,16}$/;
|
||||
|
||||
// Helper functions
|
||||
function avatarUrl(username) {
|
||||
return `https://render.crafty.gg/3d/bust/${encodeURIComponent(username)}`;
|
||||
}
|
||||
|
||||
function isValidTier(tier) {
|
||||
const valid = ['HT1', 'LT1', 'HT2', 'LT2', 'HT3', 'LT3', 'HT4', 'LT4', 'HT5', 'LT5'];
|
||||
return valid.includes(tier);
|
||||
}
|
||||
|
||||
function isValidGamemode(gamemode) {
|
||||
return GAMEMODES.includes(gamemode);
|
||||
}
|
||||
|
||||
function isValidRegion(region) {
|
||||
return REGIONS.includes(region);
|
||||
}
|
||||
|
||||
function normalizeGamemode(gamemode) {
|
||||
if (!gamemode) return null;
|
||||
return gamemode.toUpperCase().replace(/\s+/g, '_');
|
||||
}
|
||||
|
||||
function normalizeRegion(region) {
|
||||
if (!region) return 'NA';
|
||||
return region.toUpperCase().trim();
|
||||
}
|
||||
|
||||
function normalizeTier(tier) {
|
||||
if (!tier) return null;
|
||||
return tier.toUpperCase().trim();
|
||||
}
|
||||
|
||||
function tierToPoints(tier) {
|
||||
if (!tier) return 0;
|
||||
const map = {
|
||||
HT1: 100,
|
||||
LT1: 90,
|
||||
HT2: 80,
|
||||
LT2: 70,
|
||||
HT3: 60,
|
||||
LT3: 50,
|
||||
HT4: 40,
|
||||
LT4: 30,
|
||||
HT5: 20,
|
||||
LT5: 10,
|
||||
};
|
||||
return map[tier] || 0;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
GAMEMODES,
|
||||
GAMEMODE_LABELS,
|
||||
REGIONS,
|
||||
USERNAME_REGEX,
|
||||
avatarUrl,
|
||||
isValidTier,
|
||||
isValidGamemode,
|
||||
isValidRegion,
|
||||
normalizeGamemode,
|
||||
normalizeRegion,
|
||||
normalizeTier,
|
||||
tierToPoints,
|
||||
};
|
||||
Reference in New Issue
Block a user