Ejemplo n.º 1
0
def get_text_to_general_buttons(user_data, player=None):
    """
    Возвращает текст, который нужно отправить по умолчанию с статусом в user_data
    :param user_data: Словарь user_data, функция использует значения 'status' и 'rp_off'
    :param player: Player
    :return: Str
    """
    status = user_data.get("status")
    location_id = user_data.get("location_id")
    rp_off = user_data.get("rp_off")
    if location_id is None:
        user_data.update({"location_id": 0})
    print(rp_off, status)
    if rp_off and status in ["central_square", "rp_off"]:
        return "Доброго времени суток!\nВыберите действие:"
    if status is None or status == "default":
        return "Вы входите в замок Скалы. Выберите, куда направиться!"
    if status in ["construction", "sawmill", "quarry"]:
        if player is not None:
            j = construction_jobs.get(player.id)
            if j is not None:
                seconds_left = j.get_time_left()
                return "Вы заняты делом. Окончание через <b>{:02.0f}:{:02.0f}</b>".format(
                    seconds_left // 60, (seconds_left % 60) // 1)
    if location_id is not None:
        return Location.get_location_enter_text_by_id(location_id,
                                                      player=player)
Ejemplo n.º 2
0
def request_change_update_message(bot, update, user_data):
    user_data.update({"status": "editing_update_message"})
    buttons = get_general_buttons(user_data)
    bot.send_message(chat_id=update.message.from_user.id,
                     text="Следующее сообщение будет отображено в башне. Оно должен влезть в это сообщение:\n\n"
                          "{}".format(Location.get_location_enter_text_by_id(5, without_format=True).format(
                                "")), reply_markup=buttons)
Ejemplo n.º 3
0
def request_change_debrief(bot, update, user_data):
    """
    Функция запроса смены дебрифа в Тронном Зале
    """
    user_data.update({"status": "editing_debrief"})
    buttons = get_general_buttons(user_data)
    bot.send_message(
        chat_id=update.message.from_user.id,
        text=
        "Следующее сообщение будет новым дебрифом. Он должен влезть в это сообщение:\n\n"
        "{}".format(
            Location.get_location_enter_text_by_id(2,
                                                   without_format=True).format(
                                                       "DjedyBreaM", "")),
        reply_markup=buttons)
Ejemplo n.º 4
0
def castle_gates(bot, update, user_data):
    """
    Функция, вызываемая при подходе к вратам замка
    """
    location_id = 3
    user_data.update({"status": "castle_gates", "location_id": 3})
    response = Location.get_location_enter_text_by_id(location_id)
    player = Player.get_player(update.message.from_user.id)
    buttons = get_general_buttons(user_data, only_buttons=True, player=player)
    if player is not None and player.game_class == "Sentinel":  # Только для стражей, захардкожено
        response += "\nКак страж, ты имеешь возможность заступить на вахту\n"
    reply_markup = ReplyKeyboardMarkup(buttons, resize_keyboard=True)
    bot.send_message(chat_id=update.message.chat_id,
                     text=response,
                     parse_mode='HTML',
                     reply_markup=reply_markup)