Esempio n. 1
0
 def activate(self):
     keyboard = keyboards.form_keyboard(
         *keyboards.get_item_buttons(self.unit),
         keyboards.MenuButton(self.unit, 'back'))
     self.unit.controller.edit_message(localization.LangTuple(
         'utils', 'items'),
                                       reply_markup=keyboard)
Esempio n. 2
0
 def target_keyboard(self):
     return keyboards.form_keyboard(
         *[
             keyboards.OptionObject(
                 self,
                 name=(unit.name if isinstance(unit.name, str) else
                       unit.name.str(self.unit.controller.lang)),
                 option=unit) for unit in self.targets()
         ], keyboards.MenuButton(self.unit, 'back'))
Esempio n. 3
0
 def activate(self):
     keyboard = keyboards.form_keyboard(
         *[
             ability.button() for ability in self.unit.abilities
             if ability.available()
         ], keyboards.MenuButton(self.unit, 'back'))
     self.unit.controller.edit_message(localization.LangTuple(
         'utils', 'abilities'),
                                       reply_markup=keyboard)
Esempio n. 4
0
 def ask_target(self, spell_tuple):
     self.unit.active = True
     string = 'Выберите цель.'
     targets = [*self.unit.targets(), *self.unit.get_allies()]
     buttons = []
     for target in targets:
         buttons.append(
             keyboards.FightButton(
                 (target.name if isinstance(target.name, str) else
                  target.name.str(self.unit.controller.lang)),
                 self.unit,
                 self.types[0],
                 self.name,
                 str(target),
                 spell_tuple,
                 named=True))
     buttons.append(keyboards.MenuButton(self.unit, 'back'))
     keyboard = keyboards.form_keyboard(*buttons)
     self.unit.controller.edit_message(string, reply_markup=keyboard)
Esempio n. 5
0
 def target_keyboard(self):
     return keyboards.form_keyboard(*self.options_keyboard(),
                                    keyboards.MenuButton(self.unit, 'back'), row_width=3)
Esempio n. 6
0
 def create_menu(self, keyboard):
     keyboard.add(keyboards.MenuButton(self.unit, 'back'))
     self.unit.controller.edit_message(self.get_menu_string(), reply_markup=keyboard)
Esempio n. 7
0
 def target_keyboard(self, action=None, row_width=2):
     return keyboards.form_keyboard(*self.options_keyboard(action=action),
                                    keyboards.MenuButton(self.unit, 'back'),
                                    row_width=row_width)