Пример #1
0
async def send(message: types.Message):
    item = db.check_item(message.from_user.id, "отрава")
    if not item:
        await message.reply(f"Купи отраву для начала")
        return
    d_timer = db.timer_check(message.from_user.id, "otrava")
    if time.time() < d_timer[0][0]:
        t = holy.since(d_timer[0][0] - time.time())
        await message.reply(
            f"До следующего отравления\nосталось: <b>{t}</b>\nЖди 🦖")
        return
    target = message.reply_to_message.from_user
    await message.reply(f"Отравил!")
    await db.add_item("-", message.from_user.id, "отрава")
    db.post_sql(
        f"UPDATE users SET hunger = hunger - 50 WHERE chat_id = {target.id}")
    db.post_sql(
        f"UPDATE timers SET time = {time.time()+ TIMERS['otrava']} WHERE chat_id = {message.from_user.id} AND timer = 'otrava' "
    )
Пример #2
0
def edit(index):
	if 'admin' in session:
		index = int(index)
		item = db.get_item_by_index(index)
		if item.get("sale_index") is None:
			in_stock = db.check_item(index)
			if request.method == 'GET':
				return render_template('edit.html.j2', item=item, in_stock=in_stock)
			elif request.method == 'POST':
				name = request.form['item']
				desc = request.form['desc']
				cost = request.form['cost']
				db.edit_item(index, name, desc, cost)
				if stock:
					return redirect(url_for('items'))
				else:
					return redirect(url_for('held'))
		else:
			return redirect(url_for('login'))
	else:
		return redirect(url_for('login'))
Пример #3
0
async def send(message: types.Message):

    item = db.check_item(message.from_user.id, "динамит")
    if not item:
        await message.reply(f"Купи динамит для начала")
        return
    d_timer = db.timer_check(message.from_user.id, "dynamite")
    if time.time() < d_timer[0][0]:
        t = holy.since(d_timer[0][0] - time.time())
        await message.reply(
            f"До следующего подрыва\nосталось: <b>{t}</b>\nЖди 🦖")
        return
    target = message.reply_to_message.from_user
    home = db.dbget("home", target.id)
    if int(home) == 0:
        await message.reply(f"🙉 Что ты подрывать собрался? Он на улице живёт")
        return

    await message.reply(
        f"🧨 {message.from_user.first_name} подорвал домик {target.first_name}!"
    )
    await db.add_item("-", message.from_user.id, "динамит")
    # db.post_sql(f"UPDATE users SET hunger = hunger - 50 WHERE chat_id = {target.id}")
    db.post_sql(
        f"UPDATE timers SET time = {time.time()+20} WHERE chat_id = {message.from_user.id} AND timer = 'otrava' "
    )
    db.post_sql(
        f"UPDATE assets SET state = state - 50 WHERE chat_id = {message.from_user.id} AND rowid = {home} "
    )
    check = db.post_sql(f"SELECT state FROM assets WHERE rowid = {home}")
    if int(check[0][0]) <= 0:
        db.post_sql(
            f"UPDATE users SET home = 0 WHERE chat_id = {message.from_user.id}"
        )
        db.post_sql(
            f"UPDATE assets SET state = 0 WHERE chat_id = {message.from_user.id} AND rowid = {home} "
        )
Пример #4
0
async def send(message: types.Message):
    d_timer = db.post_sql(
        f"SELECT time FROM timers WHERE chat_id = {message.from_user.id} AND timer = 'rob' "
    )
    if time.time() < d_timer[0][0]:
        t = holy.since(d_timer[0][0] - time.time())
        await message.reply(
            f"До следующего ограбления\nосталось: <b>{t}</b>\nЖди 🔫🦖")
        return

    target = message.reply_to_message.from_user
    await db.hunger_check(target.id)
    target_hunger = db.dbget("hunger", target.id)
    home = db.dbget("home", target.id)

    holyshit = db.holyshit(target.id, "check")
    if holyshit:
        await message.reply(
            f"<b>{target.first_name}</b> под защитой 🧿\n<code>Выбери другую жертву</code>"
        )
        return

    if int(home) != 0:
        await message.reply(f"{target.first_name} в домике 🏠\nпососи")
        return

    if target_hunger == 0:
        gun = db.check_item(message.from_user.id, "пестик")
        if gun:
            chance = [1]
            amount_rand = [3, 3, 3, 2.5, 2.5, 2.5, 2, 1.5]

        else:
            chance = [0, 0, 0, 1]
            amount_rand = [7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 3]

        if random.choice(chance) == 0:
            await message.reply(
                f"‼️ {message.from_user.first_name} попытался ограбить {target.first_name} но не получилось ..."
            )
            db.post_sql(
                f"UPDATE timers SET time = {time.time()+TIMERS['rob_attempt']} WHERE chat_id = {message.from_user.id} AND timer = 'rob' "
            )
            return

        amount = db.dbget("holics", target.id)
        amount = int(amount / int(random.choice(amount_rand)))
        await message.answer_animation(
            "CgACAgQAAxkBAAIvoWAjo96LFMGOLNYgsEQXtwmjpE5aAAJiAgAC84o0Un_UeBSZfoYGHgQ"
        )
        await asyncio.sleep(0.2)
        await message.reply(
            f"{message.from_user.first_name} 🔫 ограбил {target.first_name} на {amount} 💕"
        )
        db.post_sql(
            f"UPDATE timers SET time = {time.time()+TIMERS['rob']} WHERE chat_id = {message.from_user.id} AND timer = 'rob' "
        )
        db.post_sql(
            f"UPDATE users SET holics = holics - {amount} WHERE chat_id = {target.id}"
        )
        db.post_sql(
            f"UPDATE users SET holics = holics + {amount} WHERE chat_id = {message.from_user.id}"
        )
    else:
        await message.reply(f"🥺 низя, жертва сыта")
Пример #5
0
                            else:
                                print(
                                    "That wasn't a valid price, please try again."
                                )

                        elif table_choice == '2':
                            date = input("Date?\n")
                            venue = input("Venue?\n")
                            db.add_show(date, venue)

                        elif table_choice == '3':
                            show_id = input("Show id?\n")
                            if check_int(show_id):
                                if db.check_id(show_id):
                                    item = input("Item?\n")
                                    if db.check_item(item):
                                        sold = input("Sold?\n")
                                        if check_int(sold):
                                            db.add_sale(show_id, item, sold)
                                        else:
                                            print(
                                                "That wasn't a valid item, please try again."
                                            )
                                    else:
                                        print(
                                            "That wasn't a valid item, please try again."
                                        )
                                else:
                                    print(
                                        "That isn't a valid show id, please try again."
                                    )