v.0.4.2-fix
Inflation and Recovery fix
This commit is contained in:
parent
4108f231e7
commit
eeb4fea58c
13
bot.js
13
bot.js
@ -1001,7 +1001,7 @@ const recoverResourcePrices = async () => {
|
|||||||
|
|
||||||
for (const resource of resources) {
|
for (const resource of resources) {
|
||||||
// Определяем случайное колебание в диапазоне [-maxFluctuation, maxFluctuation]
|
// Определяем случайное колебание в диапазоне [-maxFluctuation, maxFluctuation]
|
||||||
const maxFluctuation = resource.basePrice * 0.03; // 3% от базовой цены
|
const maxFluctuation = resource.basePrice * 0.3; // 30% от базовой цены
|
||||||
const priceFluctuation = (Math.random() * 2 - 1) * maxFluctuation;
|
const priceFluctuation = (Math.random() * 2 - 1) * maxFluctuation;
|
||||||
|
|
||||||
// Применяем колебание
|
// Применяем колебание
|
||||||
@ -1009,7 +1009,7 @@ const recoverResourcePrices = async () => {
|
|||||||
|
|
||||||
// Если цена выше базовой, шанс на её снижение
|
// Если цена выше базовой, шанс на её снижение
|
||||||
if (resource.price > resource.basePrice) {
|
if (resource.price > resource.basePrice) {
|
||||||
const chanceToDrop = 0.6; // 60% шанс на снижение
|
const chanceToDrop = 0.5; // 50% шанс на снижение
|
||||||
if (Math.random() < chanceToDrop) {
|
if (Math.random() < chanceToDrop) {
|
||||||
resource.price -= Math.round(resource.basePrice * 0.01); // Снижение на 1% базовой цены
|
resource.price -= Math.round(resource.basePrice * 0.01); // Снижение на 1% базовой цены
|
||||||
}
|
}
|
||||||
@ -1419,6 +1419,11 @@ bot.command('force_hour', async (ctx) => {
|
|||||||
return await ctx.reply(`Принудительный час.`)
|
return await ctx.reply(`Принудительный час.`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
bot.command('force_recover', async (ctx) => {
|
||||||
|
recoverResourcePrices()
|
||||||
|
updateResourcePricesMessage()
|
||||||
|
return await ctx.reply(`Принудительно.`)
|
||||||
|
})
|
||||||
bot.command('force_mat', async (ctx) => {
|
bot.command('force_mat', async (ctx) => {
|
||||||
utils.matPriceUpdate()
|
utils.matPriceUpdate()
|
||||||
return await ctx.reply(`Принудительный материал.`)
|
return await ctx.reply(`Принудительный материал.`)
|
||||||
@ -1444,7 +1449,7 @@ const spinSlots = async (ctx, bet, user) => {
|
|||||||
console.log(`Win: ${winnings}`)
|
console.log(`Win: ${winnings}`)
|
||||||
resultMessage += `🎉 Вы выиграли ₽${spaces(winnings)}! Множитель: x${winMultiplier}`;
|
resultMessage += `🎉 Вы выиграли ₽${spaces(winnings)}! Множитель: x${winMultiplier}`;
|
||||||
} else {
|
} else {
|
||||||
utils.giveExp(user, 10)
|
utils.giveExp(user, 2)
|
||||||
user.money -= bet;
|
user.money -= bet;
|
||||||
await user.save();
|
await user.save();
|
||||||
resultMessage += `💔 Вы проиграли ₽${spaces(bet)}. Попробуйте ещё раз!`;
|
resultMessage += `💔 Вы проиграли ₽${spaces(bet)}. Попробуйте ещё раз!`;
|
||||||
@ -1750,7 +1755,7 @@ setInterval(() => {
|
|||||||
let hours = today.getHours();
|
let hours = today.getHours();
|
||||||
if (hours == "0" || hours == "12") {
|
if (hours == "0" || hours == "12") {
|
||||||
//weaponShopUpdate()
|
//weaponShopUpdate()
|
||||||
matPriceUpdate()
|
utils.matPriceUpdate()
|
||||||
}
|
}
|
||||||
/*if (hours == "9" || hours == "18" || hours == "12") {
|
/*if (hours == "9" || hours == "18" || hours == "12") {
|
||||||
generatePromo()
|
generatePromo()
|
||||||
|
Loading…
Reference in New Issue
Block a user