This commit is contained in:
Degradin 2025-01-22 00:09:53 +03:00
parent d78a11bce2
commit 0b94436005
4 changed files with 252 additions and 221 deletions

5
bot.js
View File

@ -989,6 +989,11 @@ bot.command('ent_rename', async (ctx) => {
if (!enterprise) {
return await ctx.reply(`Предприятие с ID ${enterpriseId} не найдено.`)
}
const user = await UserModel.findByPk(ctx.from.id);
if (enterprise.playerId !== user.telegram_id) {
return await ctx.reply('Это не ваше предприятие.');
}
// Переименовываем предприятие
await enterprise.update({ name: newName })

View File

@ -4,228 +4,256 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Меню игрока</title>
<link href="https://fonts.googleapis.com/css2?family=Tektur:wght@400..900&display=swap" rel="stylesheet">
<style>
/* Общие стили */
body {
font-family: 'Arial', sans-serif;
padding: 0;
background-color: #f4f7fc;
color: #333;
display: flex;
justify-content: center;
align-items: center;
max-width: 500px;
}
body {
font-family: 'Tektur', sans-serif;
background-color: #121212;
color: #e0e0e0;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
/* Контейнер для контента */
.container {
max-width: 500px;
width: 100%;
background: white;
padding: 20px;
border-radius: 15px;
font-size: 16px;
}
.container {
width: 90%;
max-width: 800px;
padding: 20px;
background: rgba(0, 0, 0, 0.8);
border-radius: 15px;
box-shadow: 0 0 20px rgba(226, 111, 34, 0.3);
text-align: center;
}
/* Заголовки */
.title {
font-size: 28px;
font-weight: bold;
text-align: center;
margin-bottom: 20px;
color: #e26f22;
}
.title {
font-size: 32px;
font-weight: bold;
color: #e26f22;
text-shadow: 0 0 10px rgba(226, 111, 34, 0.8), 0 0 20px rgba(226, 111, 34, 0.5);
margin-bottom: 20px;
}
.section {
margin-bottom: 20px;
}
/* Секции */
.section {
margin-top: 20px;
padding: 10px;
border: 2px solid #e26f22;
border-radius: 10px;
background: rgba(255, 255, 255, 0.05);
}
.section h2 {
font-size: 20px;
margin-bottom: 10px;
color: #e26f22;
}
.section h2 {
font-size: 22px;
color: #e26f22;
margin-bottom: 10px;
}
.section p {
font-size: 16px;
margin: 5px 0;
}
.section span {
font-weight: bold;
}
/* Прогресс-бары */
.progress-bar {
position: relative;
height: 20px;
width: 100%;
background: rgba(255, 255, 255, 0.1);
border-radius: 10px;
overflow: hidden;
margin: 10px 0;
transition: width 0.5s ease;
}
/* Кнопка */
.button {
display: block;
background-color: #e26f22;
color: white;
padding: 10px 20px;
text-decoration: none;
border-radius: 5px;
font-size: 16px;
margin-top: 20px;
text-align: center;
width: 350px;
}
.progress-hp, .progress-stamina {
height: 100%;
border-radius: 10px;
transition: width 0.5s ease;
}
/* Профиль */
.profile-section {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.progress-hp {
background: linear-gradient(90deg, red, darkred);
}
.profile-img {
width: 100px;
height: 100px;
border-radius: 50%;
background-size: cover;
background-position: center;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.progress-stamina {
background: linear-gradient(90deg, green, darkgreen);
}
.progress-circle {
display: flex;
flex-direction: column;
align-items: center;
}
/* FIRE характеристики */
.fire-stats {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
}
.circle-container {
position: relative;
width: 100px;
height: 100px;
margin-bottom: 10px;
}
.stat {
padding: 10px;
border: 2px solid #e26f22;
border-radius: 10px;
background: rgba(255, 255, 255, 0.05);
text-align: center;
}
.circle {
stroke-width: 10;
fill: transparent;
transform-origin: center;
transform: rotate(-90deg);
}
.stat span {
font-size: 20px;
color: #e26f22;
font-weight: bold;
}
.background-ring {
stroke: #ddd;
}
/* Круги прогресса */
.progress-circle {
display: inline-block;
text-align: center;
margin: 10px;
}
.progress-ring {
stroke: #e26f22;
stroke-dasharray: 251;
stroke-dashoffset: 251;
transition: stroke-dashoffset 1s;
}
.circle-container {
position: relative;
width: 100px;
height: 100px;
}
.circle-text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 18px;
font-weight: bold;
}
.circle {
transform: rotate(-90deg);
}
/* Прогресс-бары */
.progress-bar {
background-color: #ddd;
border-radius: 10px;
height: 15px;
width: 100%;
margin-bottom: 10px;
overflow: hidden;
}
.background-ring {
fill: none;
stroke: rgba(255, 255, 255, 0.1);
stroke-width: 8;
}
.progress-hp, .progress-stamina {
height: 100%;
border-radius: 10px;
transition: width 0.5s ease;
display: flex;
justify-content: center;
align-items: center;
font-weight: bold;
font-size: 14px;
color: white;
}
.progress-ring {
fill: none;
stroke: #e26f22;
stroke-width: 8;
stroke-dasharray: 251;
stroke-dashoffset: 251;
transition: stroke-dashoffset 0.5s ease;
}
/* Статистика игрока */
.fire-stats {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
background-color: #f9f9f9;
padding: 10px;
margin-top: 15px;
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.circle-text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 18px;
font-weight: bold;
color: #e26f22;
text-shadow: 0 0 10px rgba(226, 111, 34, 0.8);
}
.fire-stats .stat {
text-align: center;
}
/* Кнопка */
.button {
display: block;
margin: 20px auto 0;
padding: 10px 20px;
font-size: 18px;
font-weight: bold;
text-transform: uppercase;
color: #FFFFFF;
background: linear-gradient(90deg, #e26f22, #0099CC);
text-decoration: none;
border-radius: 10px;
box-shadow: 0 0 15px rgba(226, 111, 34, 0.6);
transition: all 0.3s ease;
}
.fire-stats .stat span {
font-weight: bold;
}
.button:hover {
transform: scale(1.05);
box-shadow: 0 0 25px rgba(226, 111, 34, 0.8);
}
/* Предприятия */
.enterprise {
padding: 15px;
background-color: #f9f9f9;
border-radius: 10px;
margin-top: 10px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
/* Картинка профиля */
.profile-img {
width: 100px;
height: 100px;
border-radius: 50%;
margin: 10px auto;
background-size: cover;
background-position: center;
border: 2px solid #e26f22;
box-shadow: 0 0 10px rgba(226, 111, 34, 0.6), 0 0 20px rgba(226, 111, 34, 0.4), 0 0 30px rgba(226, 111, 34, 0.3); /* Тени для неонового эффекта */
transition: all 0.3s ease; /* Плавные переходы */
}
.enterprise strong {
display: block;
margin-bottom: 5px;
}
.profile-img:hover {
transform: scale(1.05); /* Легкое увеличение при наведении */
box-shadow: 0 0 15px rgba(226, 111, 34, 1), 0 0 25px rgba(226, 111, 34, 0.8), 0 0 35px rgba(226, 111, 34, 0.6); /* Увеличение свечения при наведении */
}
.progress-bar-inner {
background-color: #e26f22;
height: 10px;
border-radius: 5px;
transition: width 0.5s ease;
}
.company {
font-family: 'Tektur', sans-serif; /* Футуристический шрифт */
font-size: 16px; /* Размер текста */
font-weight: bold; /* Жирное начертание */
color: #e26f22; /* Холодный цвет для футуристичного эффекта */
text-transform: uppercase; /* Заглавные буквы */
letter-spacing: 2px; /* Расстояние между буквами для четкости */
background: linear-gradient(90deg, #e26f22, #e28f22, #e29c22); /* Градиент */
-webkit-background-clip: text; /* Применение градиента к тексту */
color: transparent; /* Прозрачный цвет для текста */
text-shadow: 0 0 10px rgba(226, 111, 34, 0.6), 0 0 20px rgba(226, 111, 34, 0.4), 0 0 30px rgba(226, 111, 34, 0.3); /* Тени для неонового эффекта */
transition: all 0.3s ease; /* Плавные переходы */
}
/* Анимация */
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.company:hover {
transform: scale(1.05); /* Легкое увеличение при наведении */
text-shadow: 0 0 15px rgba(226, 111, 34, 1), 0 0 25px rgba(226, 111, 34, 0.8), 0 0 35px rgba(226, 111, 34, 0.6); /* Увеличение свечения при наведении */
}
@keyframes progress {
from {
width: 0;
}
}
.money {
font-family: 'Tektur', sans-serif; /* Используем тот же футуристический шрифт */
font-size: 12px;
font-weight: bold;
color: #00ff99; /* Цвет текста — светлый неоново-зеленый */
text-shadow: 0 0 5px rgba(0, 255, 153, 0.8), 0 0 10px rgba(0, 255, 153, 0.7), 0 0 15px rgba(0, 255, 153, 0.6); /* Электронный блеск */
letter-spacing: 2px; /* Немного увеличиваем расстояние между символами для эффектности */
text-transform: uppercase; /* Верхний регистр для четкости */
background: linear-gradient(90deg, #00ff99, #33ccff, #ff33cc); /* Градиент для фона текста */
background-clip: text; /* Применяем фон к тексту */
color: transparent; /* Делаем текст прозрачным, чтобы фон был виден */
animation: glow-electronic 3s infinite alternate; /* Анимация мерцающего эффекта */
}
/* Анимация для всех элементов */
* {
animation: fadeIn 1s;
}
@keyframes glow-electronic {
0% {
text-shadow: 0 0 5px rgba(0, 255, 153, 0.8), 0 0 10px rgba(0, 255, 153, 0.7), 0 0 15px rgba(0, 255, 153, 0.6);
}
50% {
text-shadow: 0 0 10px rgba(0, 255, 153, 1), 0 0 20px rgba(0, 255, 153, 0.9), 0 0 30px rgba(0, 255, 153, 0.8);
}
100% {
text-shadow: 0 0 5px rgba(0, 255, 153, 0.8), 0 0 10px rgba(0, 255, 153, 0.7), 0 0 15px rgba(0, 255, 153, 0.6);
}
}
/* Анимация для прогресс-баров */
.progress-bar-inner {
animation: progress 1s;
}
.nickname {
font-family: 'Tektur', sans-serif; /* Шрифт с футуристическим стилем */
font-size: 13px;
font-weight: bold;
background: linear-gradient(90deg, #00ff99, #00ccff, #ff33cc); /* Градиент для текста */
background-clip: text; /* Применяет фон к тексту */
color: transparent; /* Делаем текст прозрачным, чтобы фон был виден */
text-shadow: 0 0 10px rgba(0, 255, 153, 0.7), 0 0 20px rgba(0, 204, 255, 0.7), 0 0 30px rgba(255, 51, 204, 0.7); /* Неоновые тени */
letter-spacing: 1px; /* Расстояние между буквами для футуристичного эффекта */
text-transform: uppercase; /* Преобразуем в верхний регистр для более стильного вида */
transition: all 0.3s ease; /* Плавные переходы */
}
/* Анимация .progress-hp */
.progress-hp {
animation: progress 3s;
}
/* Анимация .progress-stamina */
.progress-stamina {
animation: progress 3s;
}
.nickname:hover {
transform: scale(1.05); /* Легкое увеличение при наведении */
text-shadow: 0 0 15px rgba(0, 255, 153, 1), 0 0 40px rgba(0, 204, 255, 1), 0 0 60px rgba(255, 51, 204, 1);
}
</style>
<script src="https://telegram.org/js/telegram-web-app.js"></script>
</head>
<body>
<div class="container">
<div class="title">📜 Меню игрока</div>
<div class="company">📜 Меню игрока</div>
<div class="profile-section">
<div id="profile-img" class="profile-img"></div>
@ -252,11 +280,11 @@ body {
</div>
<div class="progress-bar">
<div class="progress-hp" id="hp-bar"></div>
<div class="progress-hp" id="hp-bar" style="width: 0%;"></div>
</div>
<div class="progress-bar">
<div class="progress-stamina" id="stamina-bar"></div>
<div class="progress-stamina" id="stamina-bar" style="width: 0%;"></div>
</div>
<div class="fire-stats">
@ -279,33 +307,33 @@ body {
</div>
<div class="section">
<h2>👤 Личные данные</h2>
<p>Имя: <span id="name"></span></p>
<h2 class="company">👤 Личные данные</h2>
<p>Имя: <span class="nickname" id="name"></span></p>
<p>Telegram ID: <span id="telegramID"></span></p>
</div>
<div class="section">
<h2>👤 Профиль</h2>
<p>Деньги: <span id="money"></span></p>
<p>Грязные деньги: <span id="dirtymoney"></span></p>
<h2 class="company">👤 Профиль</h2>
<p>Деньги: <span class="money" id="money"></span></p>
<p>Грязные деньги: <span class="money" id="dirtymoney"></span></p>
</div>
<div class="section">
<h2>🏢 Организация</h2>
<p>Название: <span id="business-name"></span></p>
<p>Баланс: <span id="business-balance"></span></p>
<h2 class="company">🏢 Организация</h2>
<p>Название: <span class="company" id="business-name"></span></p>
<p>Баланс: <span class="money" id="business-balance"></span></p>
<p>Материалы: <span id="business-materials"></span></p>
</div>
<div class="section">
<h2>🏭 Предприятия</h2>
<h2 class="company">🏭 Предприятия</h2>
<div id="enterprises">
<p>Нет активных предприятий.</p>
</div>
</div>
<div class="section">
<h2>🗄️ Склад</h2>
<h2 class="company">🗄️ Склад</h2>
<div id="warehouse">
<p>Нет доступного склада.</p>
</div>
@ -328,8 +356,8 @@ body {
document.getElementById("telegramID").textContent = user.telegramID;
// Профиль
document.getElementById("money").textContent = user.money;
document.getElementById("dirtymoney").textContent = user.dirtymoney;
document.getElementById("money").textContent = "₽" + user.money;
document.getElementById("dirtymoney").textContent = "Ð" + user.dirtymoney;
// Устанавливаем картинку профиля
const profileImg = document.getElementById("profile-img");
@ -358,7 +386,6 @@ body {
document.getElementById("hp-bar").style.width = `${hpProgress}%`;
document.getElementById("hp-bar").style.backgroundColor = `red`;
document.getElementById("hp-bar").textContent = `❤`;
document.getElementById("stamina-bar").style.width = `${staminaProgress}%`;
document.getElementById("stamina-bar").style.backgroundColor = `green`;
@ -373,7 +400,7 @@ body {
// Организация
document.getElementById("business-name").textContent = business.name;
document.getElementById("business-balance").textContent = business.balance;
document.getElementById("business-balance").textContent = "₽" + business.balance;
document.getElementById("business-materials").textContent = business.materials;
// Предприятия
@ -382,18 +409,18 @@ body {
enterprisesDiv.innerHTML = "";
enterprises.forEach(ent => {
const div = document.createElement("div");
div.classList.add("enterprise");
div.classList.add("section");
div.innerHTML = `
<strong>${ent.name}</strong><br>
Тип ресурса: ${getResourceIcon(ent.resourceType)} ${getResourceName(ent.resourceType)}<br>
Уровень: ${ent.level}<br>
Эффективность: ${ent.efficiency}/час<br>
Заполненность склада: ${ent.currentResources}/${ent.warehouseCapacity}
Заполненность склада: ${ent.currentResources}/${ent.warehouseCapacity}<br><br>
`;
// Добавляем прогрессбар заполненности склада
const progress = (ent.currentResources / ent.warehouseCapacity) * 100;
const progressBar = document.createElement("div");
progressBar.innerHTML = `<div class="progress-bar-inner" style="width: ${progress}%"></div>`;
progressBar.innerHTML = `<div class="progress-bar" style="width: ${progress}%"></div>`;
div.appendChild(progressBar);
enterprisesDiv.appendChild(div);
});
@ -412,8 +439,7 @@ body {
const warehouseCapacity = warehouse.wood + warehouse.coal + warehouse.oil + warehouse.metall + warehouse.gold + warehouse.diamond;
const progress = (warehouseCapacity / warehouse.capacity) * 100;
const progressBar = document.createElement("div");
progressBar.classList.add("progress-bar");
progressBar.innerHTML = `<div class="progress-bar-inner" style="width: ${progress}%"></div>`;
progressBar.innerHTML = `<div class="progress-bar" style="width: ${progress}%"></div>`;
warehouseDiv.appendChild(progressBar);
})
.catch(err => {

View File

@ -5,12 +5,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Таблица лидеров</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KyZXEJgP4v8Jf+K6cM7V3zv7+uCGo5F5O+Xq6bM+bB5HXitBzvvhQ2V5+fu+n9U7" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Tektur:wght@400..900&display=swap" rel="stylesheet">
<style>
body {
background-color: #121212;
color: #e0e0e0;
font-family: 'Roboto', sans-serif;
font-family: 'Tektur', sans-serif;
margin: 0;
padding: 0;
display: flex;
@ -111,7 +111,7 @@
display: inline-flex;
justify-content: center;
align-items: center;
font-family: 'Orbitron', sans-serif; /* Используем футуристический шрифт */
font-family: 'Tektur', sans-serif; /* Используем футуристический шрифт */
font-size: 11px; /* Размер текста внутри круга */
color: white; /* Цвет текста */
background: radial-gradient(circle, rgba(255, 165, 0, 1) 10%, rgba(255, 69, 0, 1) 60%, rgba(255, 0, 0, 1) 100%); /* Огненный градиент */
@ -134,7 +134,7 @@
.money {
font-family: 'Orbitron', sans-serif; /* Используем тот же футуристический шрифт */
font-family: 'Tektur', sans-serif; /* Используем тот же футуристический шрифт */
font-size: 12px;
font-weight: bold;
color: #00ff99; /* Цвет текста — светлый неоново-зеленый */
@ -161,7 +161,7 @@
.nickname {
font-family: 'Orbitron', sans-serif; /* Шрифт с футуристическим стилем */
font-family: 'Tektur', sans-serif; /* Шрифт с футуристическим стилем */
font-size: 13px;
font-weight: bold;
background: linear-gradient(90deg, #00ff99, #00ccff, #ff33cc); /* Градиент для текста */
@ -179,7 +179,7 @@
}
.company {
font-family: 'Orbitron', sans-serif; /* Футуристический шрифт */
font-family: 'Tektur', sans-serif; /* Футуристический шрифт */
font-size: 16px; /* Размер текста */
font-weight: bold; /* Жирное начертание */
color: #00FFFF; /* Холодный цвет для футуристичного эффекта */
@ -244,7 +244,7 @@
<span class="nickname">${player.username} ${player.status === 'bronze' ? '[🔺]' : player.status === 'silver' ? '[🔹]' : player.status === 'gold' ? '[🔸]' : player.status === 'admin' ? '[🛡️]' : ''}
</div>
<div class="card-body">
<p>Баланс: <span class="money">${player.money}</span></p>
<p>Баланс: <span class="money">${player.money}</span></p>
<p>Уровень: <span class="circle">${player.level}</span></p>
</div>
</div>
@ -257,7 +257,7 @@
<span class="nickname">${character.username}
</div>
<div class="card-body">
<p>Баланс: <span class="money">${character.dirtymoney} Ð</span></p>
<p>Баланс: <span class="money">Ð${character.dirtymoney}</span></p>
<p>Уровень: <span class="circle">${character.level}</span></p>
<p>Врагов ликвидировано: ${character.enemiesKilled}</p>
<div class="fire-stats">
@ -286,10 +286,10 @@
topContent.innerHTML = data.map(enterprise => `
<div class="card">
<div class="card-header">
<span class="company">${enterprise.name} <span class="icon">${enterprise.icon}</span>
<span class="company">${enterprise.name}</span>
</div>
<div class="card-body">
<p>Тип ресурса: ${enterprise.resourceType}</p>
<p>Тип ресурса: <span class="icon">${enterprise.icon}</p>
<p>Уровень: <span class="circle">${enterprise.level}</span></p>
<p>Производительность: ${enterprise.efficiency} ед./час</p>
<p>Емкость склада: ${enterprise.warehouseCapacity} ед.</p>
@ -307,7 +307,7 @@
</div>
<div class="card-body">
<p>Владелец: <span class="nickname">${business.owner}</span></p>
<p>Баланс: <span class="money">${business.balance}</span></p>
<p>Баланс: <span class="money">${business.balance}</span></p>
<p>Сотрудники: ${business.usersCount}</p>
</div>
</div>

View File

@ -138,7 +138,7 @@ app.get('/enterprises', async (req, res) => {
const enterprisesData = await Promise.all(enterprises.map(async enterprise => {
const player = await UserModel.findOne({
attributes: ['name'],
attributes: ['username'],
where: { telegram_id: enterprise.playerId }
});
@ -149,7 +149,7 @@ app.get('/enterprises', async (req, res) => {
efficiency: enterprise.efficiency,
warehouseCapacity: enterprise.warehouseCapacity,
currentResources: enterprise.currentResources,
owner: player ? player.name : 'Unknown',
owner: player ? player.username : 'Unknown',
icon: resourceIcons[enterprise.resourceType] || '❓'
};
}));