This commit is contained in:
Degradin 2025-01-18 01:37:29 +03:00
parent 289dc0f938
commit b7db1ecd55
4 changed files with 700 additions and 3 deletions

31
bot.js
View File

@ -495,6 +495,33 @@ bot.command('daily_bonus', async (ctx) => {
}
});
bot.command('daily', async (ctx) => {
try {
// Получаем данные пользователя
const user = await UserModel.findByPk(ctx.from.id);
// Создаем клавиатуру с кнопкой перехода в мини-приложение
const keyboard = {
inline_keyboard: [
[
{
text: '🎁 Ежедневный бонус',
web_app: { url: 'https://web-bot.campfiregg.ru/daily' } // Замените на URL мини-приложения
}
]
]
};
// Отправляем сообщение с кнопкой
await ctx.reply('👋 Добро пожаловать в раздел ежедневных наград! Нажмите на кнопку ниже, чтобы открыть календарь и получить сегодняшнюю награду.', {
reply_markup: keyboard
});
} catch (error) {
console.error('Ошибка при открытии ежедневного бонуса:', error);
return ctx.reply('Произошла ошибка. Попробуйте снова.');
}
});
/////////////////////////////////////Enterprise Update 20.12.2024//////////////////////////////////////////////////
@ -912,6 +939,10 @@ bot.action(/upgrade_(\d+)/, async (ctx) => {
return await ctx.telegram.answerCbQuery(ctx.callbackQuery.id, `У вас недостаточно средств для прокачки предприятия. Необходимо ${upgradeCost} руб.`)
}
if(enterprise.level >= 5) {
return await ctx.reply('Предприятие уже достигло максимального уровня.')
}
// Прокачка: повышение уровня и эффективности
await enterprise.update({
level: enterprise.level + 1,

View File

@ -31992,6 +31992,7 @@
}
}
{
<<<<<<< Updated upstream
"timestamp": "2025-01-16T23:43:39.004Z",
"user": {
"id": 275416286,
@ -32031,6 +32032,9 @@
}
{
"timestamp": "2025-01-17T03:54:45.300Z",
=======
"timestamp": "2025-01-17T20:33:22.008Z",
>>>>>>> Stashed changes
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
@ -32048,6 +32052,7 @@
}
}
{
<<<<<<< Updated upstream
"timestamp": "2025-01-17T03:54:55.564Z",
"user": {
"id": 805814188,
@ -32085,6 +32090,9 @@
}
{
"timestamp": "2025-01-17T03:55:00.195Z",
=======
"timestamp": "2025-01-17T20:33:22.790Z",
>>>>>>> Stashed changes
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
@ -32099,6 +32107,7 @@
"extraData": {
"baseChance": 20,
"chance": 38,
<<<<<<< Updated upstream
"randomRoll": 37,
"moneyIn": 112505
}
@ -32782,6 +32791,14 @@
}
{
"timestamp": "2025-01-17T09:57:28.198Z",
=======
"randomRoll": 5,
"moneyIn": 108150
}
}
{
"timestamp": "2025-01-17T20:33:25.779Z",
>>>>>>> Stashed changes
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
@ -32799,7 +32816,11 @@
}
}
{
<<<<<<< Updated upstream
"timestamp": "2025-01-17T09:57:33.175Z",
=======
"timestamp": "2025-01-17T20:33:29.411Z",
>>>>>>> Stashed changes
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
@ -32817,7 +32838,11 @@
}
}
{
<<<<<<< Updated upstream
"timestamp": "2025-01-17T09:57:36.659Z",
=======
"timestamp": "2025-01-17T20:33:32.641Z",
>>>>>>> Stashed changes
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
@ -32835,7 +32860,31 @@
}
}
{
<<<<<<< Updated upstream
"timestamp": "2025-01-17T09:57:42.627Z",
=======
"timestamp": "2025-01-17T20:33:36.390Z",
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
"first_name": "Егор",
"last_name": ""
},
"chat": {
"id": 805814188,
"type": "private"
},
"action": "Карманная кража (Сумка)",
"extraData": {
"baseChance": 20,
"chance": 38,
"randomRoll": 19,
"moneyIn": 12660
}
}
{
"timestamp": "2025-01-17T20:33:40.840Z",
>>>>>>> Stashed changes
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
@ -32853,6 +32902,7 @@
}
}
{
<<<<<<< Updated upstream
"timestamp": "2025-01-17T09:57:43.467Z",
"user": {
"id": 805814188,
@ -32874,6 +32924,9 @@
}
{
"timestamp": "2025-01-17T09:57:46.490Z",
=======
"timestamp": "2025-01-17T20:33:45.406Z",
>>>>>>> Stashed changes
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
@ -32891,7 +32944,31 @@
}
}
{
<<<<<<< Updated upstream
"timestamp": "2025-01-17T09:57:50.543Z",
=======
"timestamp": "2025-01-17T20:33:46.979Z",
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
"first_name": "Егор",
"last_name": ""
},
"chat": {
"id": 805814188,
"type": "private"
},
"action": "Карманная кража (Сумка)",
"extraData": {
"baseChance": 20,
"chance": 38,
"randomRoll": 11,
"moneyIn": 14466
}
}
{
"timestamp": "2025-01-17T20:34:09.846Z",
>>>>>>> Stashed changes
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
@ -32905,11 +32982,19 @@
"action": "Карманная кража (Start)",
"extraData": {
"cdBefore": 1697887440,
<<<<<<< Updated upstream
"stamina": 30
}
}
{
"timestamp": "2025-01-17T09:57:56.423Z",
=======
"stamina": 33
}
}
{
"timestamp": "2025-01-17T20:34:13.842Z",
>>>>>>> Stashed changes
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
@ -32927,7 +33012,11 @@
}
}
{
<<<<<<< Updated upstream
"timestamp": "2025-01-17T09:58:00.072Z",
=======
"timestamp": "2025-01-17T20:34:17.764Z",
>>>>>>> Stashed changes
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
@ -32945,7 +33034,11 @@
}
}
{
<<<<<<< Updated upstream
"timestamp": "2025-01-17T09:58:05.212Z",
=======
"timestamp": "2025-01-17T20:34:21.384Z",
>>>>>>> Stashed changes
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
@ -32962,3 +33055,226 @@
"stamina": 3
}
}
<<<<<<< Updated upstream
=======
{
"timestamp": "2025-01-17T22:15:18.599Z",
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
"first_name": "Егор",
"last_name": ""
},
"chat": {
"id": 805814188,
"type": "private"
},
"action": "Карманная кража (Start)",
"extraData": {
"cdBefore": 1697887440,
"stamina": 90
}
}
{
"timestamp": "2025-01-17T22:15:19.535Z",
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
"first_name": "Егор",
"last_name": ""
},
"chat": {
"id": 805814188,
"type": "private"
},
"action": "Карманная кража (Сумка)",
"extraData": {
"baseChance": 20,
"chance": 38,
"randomRoll": 5,
"moneyIn": 30807
}
}
{
"timestamp": "2025-01-17T22:15:23.145Z",
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
"first_name": "Егор",
"last_name": ""
},
"chat": {
"id": 805814188,
"type": "private"
},
"action": "Карманная кража (Start)",
"extraData": {
"cdBefore": 1697887440,
"stamina": 80
}
}
{
"timestamp": "2025-01-17T22:15:28.001Z",
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
"first_name": "Егор",
"last_name": ""
},
"chat": {
"id": 805814188,
"type": "private"
},
"action": "Карманная кража (Start)",
"extraData": {
"cdBefore": 1697887440,
"stamina": 70
}
}
{
"timestamp": "2025-01-17T22:15:32.087Z",
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
"first_name": "Егор",
"last_name": ""
},
"chat": {
"id": 805814188,
"type": "private"
},
"action": "Карманная кража (Start)",
"extraData": {
"cdBefore": 1697887440,
"stamina": 60
}
}
{
"timestamp": "2025-01-17T22:15:37.393Z",
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
"first_name": "Егор",
"last_name": ""
},
"chat": {
"id": 805814188,
"type": "private"
},
"action": "Карманная кража (Start)",
"extraData": {
"cdBefore": 1697887440,
"stamina": 50
}
}
{
"timestamp": "2025-01-17T22:15:41.432Z",
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
"first_name": "Егор",
"last_name": ""
},
"chat": {
"id": 805814188,
"type": "private"
},
"action": "Карманная кража (Start)",
"extraData": {
"cdBefore": 1697887440,
"stamina": 40
}
}
{
"timestamp": "2025-01-17T22:15:46.263Z",
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
"first_name": "Егор",
"last_name": ""
},
"chat": {
"id": 805814188,
"type": "private"
},
"action": "Карманная кража (Start)",
"extraData": {
"cdBefore": 1697887440,
"stamina": 30
}
}
{
"timestamp": "2025-01-17T22:15:50.570Z",
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
"first_name": "Егор",
"last_name": ""
},
"chat": {
"id": 805814188,
"type": "private"
},
"action": "Карманная кража (Start)",
"extraData": {
"cdBefore": 1697887440,
"stamina": 20
}
}
{
"timestamp": "2025-01-17T22:15:55.802Z",
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
"first_name": "Егор",
"last_name": ""
},
"chat": {
"id": 805814188,
"type": "private"
},
"action": "Карманная кража (Start)",
"extraData": {
"cdBefore": 1697887440,
"stamina": 13
}
}
{
"timestamp": "2025-01-17T22:16:00.649Z",
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
"first_name": "Егор",
"last_name": ""
},
"chat": {
"id": 805814188,
"type": "private"
},
"action": "Карманная кража (Start)",
"extraData": {
"cdBefore": 1697887440,
"stamina": 3
}
}
{
"timestamp": "2025-01-17T22:16:01.654Z",
"user": {
"id": 805814188,
"username": "Mana_Terroristo",
"first_name": "Егор",
"last_name": ""
},
"chat": {
"id": 805814188,
"type": "private"
},
"action": "Карманная кража (Сумка)",
"extraData": {
"baseChance": 20,
"chance": 38,
"randomRoll": 21,
"moneyIn": 21497
}
}
>>>>>>> Stashed changes

94
public/daily.html Normal file
View File

@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Daily Bonus</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f7fc;
color: #333;
text-align: center;
}
.calendar {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 5px;
margin: 20px auto;
width: 90%;
max-width: 400px;
}
.day {
padding: 15px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
cursor: pointer;
}
.day.today {
background-color: #e26f22;
color: #fff;
font-weight: bold;
}
.day.claimed {
background-color: #4caf50;
color: white;
}
</style>
</head>
<body>
<h1>Ежедневный бонус</h1>
<div class="calendar" id="calendar"></div>
<script>
const tg = window.Telegram.WebApp;
const today = new Date().getDate();
// Фиктивные данные (замените запросом к вашему серверу)
const rewards = [
{ day: 1, reward: '100 монет' },
{ day: 2, reward: '200 монет' },
{ day: 3, reward: '50 опыта' },
// Добавьте остальные дни...
];
const claimedDays = []; // Дни, в которые пользователь уже получил награду (серверные данные)
const calendar = document.getElementById('calendar');
for (let i = 1; i <= 31; i++) {
const dayElement = document.createElement('div');
dayElement.className = 'day';
dayElement.innerText = i;
const reward = rewards.find(r => r.day === i);
if (reward) {
dayElement.title = `🎁 ${reward.reward}`;
}
if (i === today) {
dayElement.classList.add('today');
}
if (claimedDays.includes(i)) {
dayElement.classList.add('claimed');
}
dayElement.addEventListener('click', () => {
if (i === today && !claimedDays.includes(i)) {
claimedDays.push(i);
dayElement.classList.add('claimed');
tg.sendData(JSON.stringify({ day: i })); // Отправляем данные на сервер
alert(`Вы получили награду: ${reward ? reward.reward : 'Награда не найдена'}`);
}
});
calendar.appendChild(dayElement);
}
tg.ready();
</script>
</body>
</html>

View File

@ -6,6 +6,7 @@
<title>Меню игрока</title>
<style>
/* Общие стили */
<<<<<<< Updated upstream
body {
font-family: 'Arial', sans-serif;
margin: 0;
@ -167,11 +168,127 @@
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
=======
body {
font-family: 'Arial', sans-serif;
margin: 0;
padding: 0;
background-color: #f4f7fc;
color: #333;
}
.fire-stats .stat {
text-align: center;
}
/* Контейнер для контента */
.container {
max-width: 600px;
margin: 20px auto;
background: white;
padding: 20px;
border-radius: 15px;
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
font-size: 16px;
}
/* Заголовки */
.title {
font-size: 28px;
font-weight: bold;
text-align: center;
margin-bottom: 20px;
color: #e26f22;
}
.section {
margin-bottom: 20px;
}
.section h2 {
font-size: 20px;
margin-bottom: 10px;
color: #e26f22;
}
.section p {
margin: 5px 0;
}
.section span {
font-weight: bold;
}
/* Кнопка */
.button {
display: inline-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: 50%;
}
/* Эмодзи */
.emoji {
font-size: 1.3em;
}
/* Иконки ресурсов */
.resource-icon {
font-size: 1.5em;
}
/* Стили для предприятия */
.enterprise {
padding: 15px;
background-color: #f9f9f9;
border-radius: 10px;
margin-top: 10px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
/* Контейнер профиля */
.profile-container {
position: relative;
width: 100px;
height: 100px;
margin: 0 auto;
}
/* Аватар профиля */
.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-ring {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
z-index: 1;
}
svg {
transform: rotate(-90deg);
}
>>>>>>> Stashed changes
circle {
transition: stroke-dashoffset 1s;
}
<<<<<<< Updated upstream
.fire-stats .stat span {
font-weight: bold;
}
@ -196,6 +313,113 @@
border-radius: 5px;
transition: width 0.5s ease;
}
=======
.level-ring {
stroke-width: 10;
fill: transparent;
}
.profile-level-ring {
stroke: #e26f22;
}
.character-level-ring {
stroke: #4e9f3d;
}
#progress-ring {
stroke-dasharray: 283;
stroke-dashoffset: 283;
}
/* Уровень в профиле */
.level-circle {
position: absolute;
bottom: -7px;
right: 10px;
width: 30px;
height: 30px;
background-color: #e26f22;
border-radius: 50%;
color: white;
display: flex;
justify-content: center;
align-items: center;
font-weight: bold;
font-size: 14px;
}
/* Прогресс-бары */
.progress-bar {
margin-top: 15px;
background-color: #ddd;
border-radius: 10px;
height: 10px;
width: 100%;
}
.progress-hp {
height: 100%;
border-radius: 10px;
background-color: #e26f22;
transition: width 0.5s ease;
display: flex;
justify-content: center;
align-items: center;
font-weight: bold;
font-size: 14px;
}
.progress-stamina {
height: 100%;
border-radius: 10px;
background-color: #4ba100;
transition: width 0.5s ease;
display: flex;
justify-content: center;
align-items: center;
font-weight: bold;
font-size: 14px;
}
/* Статистика игрока */
.fire-stats {
display: flex;
justify-content: space-between;
background-color: #f9f9f9;
padding: 10px;
margin-top: 15px;
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.fire-stats .stat {
text-align: center;
}
.fire-stats .stat span {
font-weight: bold;
}
/* Полукруговые кольца */
.circle {
stroke-width: 10;
fill: transparent;
transform-origin: center;
}
.profile-level-ring {
stroke-dasharray: 141.5; /* Половина окружности */
}
.character-level-ring {
stroke-dasharray: 141.5; /* Половина окружности */
transform: rotate(180deg); /* Поворот правого полукруга */
}
>>>>>>> Stashed changes
</style>
<script src="https://telegram.org/js/telegram-web-app.js"></script>
</head>
@ -207,23 +431,39 @@
<div id="profile-img" class="profile-img"></div>
<div class="progress-circle">
<div class="circle-container">
<<<<<<< Updated upstream
<svg class="circle" width="100" height="100">
=======
<svg class="circle">
>>>>>>> Stashed changes
<circle class="background-ring" cx="50" cy="50" r="40"></circle>
<circle class="progress-ring" id="profile-progress" cx="50" cy="50" r="40"></circle>
</svg>
<div class="circle-text" id="profile-level">0</div>
<<<<<<< Updated upstream
</div>
<p>Профиль</p>
</div>
<div class="progress-circle">
<div class="circle-container">
<svg class="circle" width="100" height="100">
=======
<p>Профиль</p>
</div>
<div class="circle-container">
<svg class="circle">
>>>>>>> Stashed changes
<circle class="background-ring" cx="50" cy="50" r="40"></circle>
<circle class="progress-ring" id="character-progress" cx="50" cy="50" r="40"></circle>
</svg>
<div class="circle-text" id="character-level">0</div>
<<<<<<< Updated upstream
</div>
<p>Персонаж</p>
=======
<p>Персонаж</p>
</div>
>>>>>>> Stashed changes
</div>
</div>
@ -313,11 +553,23 @@
// Уровни профиля и персонажа
document.getElementById("profile-level").textContent = user.profileLevel;
document.getElementById("character-level").textContent = user.characterLevel;
<<<<<<< Updated upstream
const profileProgress = document.getElementById("profile-progress");
const characterProgress = document.getElementById("character-progress");
profileProgress.style.strokeDashoffset = 251 - (251 * user.profileLevel / 100);
characterProgress.style.strokeDashoffset = 251 - (251 * user.characterLevel / 100);
=======
const profileProgress = document.getElementById("profile-progress");
const characterProgress = document.getElementById("character-progress");
profileProgress.style.strokeDashoffset = 251 - (251 * user.profileLevel / 100);
characterProgress.style.strokeDashoffset = 251 - (251 * user.characterLevel / 100);
// Уровень в кружке
document.getElementById("level-circle").textContent = user.profileLevel;
>>>>>>> Stashed changes
// Установка прогресса HP и Стамины
const hpProgress = (user.hp / user.maxHp) * 100;
@ -355,7 +607,11 @@
const progress = (ent.currentResources / ent.warehouseCapacity) * 100;
const progressBar = document.createElement("div");
progressBar.classList.add("progress-bar");
<<<<<<< Updated upstream
progressBar.innerHTML = `<div class="progress-bar-inner" style="width: ${progress}%"></div>`;
=======
progressBar.innerHTML = `<div class="progress-hp" style="width: ${progress}%">${progress}%</div>`;
>>>>>>> Stashed changes
div.appendChild(progressBar);
enterprisesDiv.appendChild(div);
});