Ejemplo n.º 1
0
 def inventory_buttons(self):
     buttons = []
     for item in self:
         item_name = self.get_item_name(item, self.member.lang)
         call_data = item[1]
         if item[1] == 'weapon':
             item_name = emote_dict['weapon_em'] + item_name
         elif item[1] == 'armor':
             item_name = emote_dict['shield_em'] + item_name
         else:
             item_name = self.get_string(call_data, self.member.lang)
         buttons.append(
             keyboards.DungeonButton(item_name,
                                     self.member,
                                     'item',
                                     'action',
                                     str(call_data),
                                     item[0]['name'],
                                     named=item_name))
     buttons.append(
         keyboards.DungeonButton('Закрыть',
                                 self.member,
                                 'menu',
                                 'main',
                                 named=True))
     return buttons
Ejemplo n.º 2
0
 def dungeon_buttons(self):
     if self.name == self.unit.weapon:
         main_key = keyboards.DungeonButton('strip', self.unit, 'strip')
     else:
         main_key = keyboards.DungeonButton('equip', self.unit, 'equip')
     return [main_key, keyboards.DungeonButton('equip', self.unit, 'inventory'),
             ]
Ejemplo n.º 3
0
 def get_item_menu(self, item_id, item_name):
     buttons = []
     item = self.get_item_object(item_id, item_name=item_name)
     table_row = item.table_row
     actions = self.get_item_actions(item, item_id)
     for action in actions:
         buttons.append(
             keyboards.DungeonButton(action[0],
                                     self.member,
                                     'item',
                                     action[1],
                                     item_id,
                                     item_name,
                                     named=True))
     buttons.append(
         keyboards.DungeonButton('Назад',
                                 self.member,
                                 'item',
                                 'menu',
                                 named=True))
     keyboard = keyboards.form_keyboard(*buttons)
     text = LangTuple(table_row, 'name').translate(self.member.lang) + '\n' \
            + LangTuple(table_row, 'desc').translate(self.member.lang)
     self.member.edit_message(text, reply_markup=keyboard)
     self.member.menu.update()
Ejemplo n.º 4
0
 def send_choice(self, member):
     text = 'Выберите предмет, который хотите улучшить'
     buttons = []
     valid_items = [
         item for item in member['inventory'] if 'improved' in item.keys()
     ]
     if 'improved' in member['weapon']:
         valid_items.append(member['weapon'])
     for item in valid_items:
         if not item['improved']:
             buttons.append(
                 keyboards.DungeonButton(member.inventory.get_item_name(
                     item, member.lang),
                                         member,
                                         'location',
                                         'improve',
                                         item['id'],
                                         named=True))
     buttons.append(
         keyboards.DungeonButton('Закрыть',
                                 member,
                                 'menu',
                                 'main',
                                 named=True))
     keyboard = keyboards.form_keyboard(*buttons)
     member.edit_message(text, reply_markup=keyboard)
Ejemplo n.º 5
0
 def run(self):
     self.member.occupied = True
     buttons = []
     for ability in self.ability_list:
         buttons.append(
             keyboards.DungeonButton(
                 'name',
                 self,
                 'lvl',
                 ability,
                 special=abilities.ability_dict[ability](
                     None).get_table_row(),
             ))
     buttons.append(
         keyboards.DungeonButton('Назад', self, 'lvl', 'back', named=True))
     keyboard = keyboards.form_keyboard(*buttons)
     self.member.send_message('Выберите новую способность',
                              reply_markup=keyboard)
Ejemplo n.º 6
0
    def menu_keyboard(self):
        buttons = list()

        buttons.append(
            keyboards.DungeonButton('Инвентарь',
                                    self,
                                    'menu',
                                    'inventory',
                                    named=True))
        buttons.append(
            keyboards.DungeonButton('На карту',
                                    self,
                                    'menu',
                                    'map',
                                    named=True))
        buttons.append(
            keyboards.DungeonButton('Покинуть карту',
                                    self,
                                    'menu',
                                    'leave',
                                    named=True))
        if len(self.dungeon.party.members) > 1:
            buttons.append(
                keyboards.DungeonButton('Обмен',
                                        self,
                                        'menu',
                                        'give',
                                        named=True))

        idle_buttons = self.dungeon.party.current_location.get_button_list(
        )['idle']
        idle_buttons = [(self.dungeon.party.current_location.get_button_tuples(
            self.lang)[str(button[0])], str(button[0]))
                        for button in idle_buttons]
        for button in idle_buttons:
            buttons.append(
                keyboards.DungeonButton(button[0],
                                        self,
                                        'location',
                                        str(button[1]),
                                        named=True))
        keyboard = form_keyboard(*buttons)
        return keyboard
Ejemplo n.º 7
0
 def give_buttons(self):
     buttons = []
     for item in self.items(without_equipped=True):
         call_data = item[1]
         item_name = self.get_string(call_data, self.member.lang)
         buttons.append(
             keyboards.DungeonButton(item_name,
                                     self.member,
                                     'item',
                                     'givelist',
                                     str(call_data),
                                     item[0]['name'],
                                     named=item_name))
     buttons.append(
         keyboards.DungeonButton('Закрыть',
                                 self.member,
                                 'menu',
                                 'main',
                                 named=True))
     return buttons
Ejemplo n.º 8
0
 def get_buttons_members_to_give(self, item_id):
     buttons = []
     members = self.dungeon.party.member_dict
     for key in members:
         if key != self.chat_id:
             call_data = item_id
             buttons.append(
                 keyboards.DungeonButton(members[key].name,
                                         self,
                                         'item',
                                         'give',
                                         str(call_data),
                                         str(key),
                                         named=True))
     buttons.append(
         keyboards.DungeonButton('Закрыть',
                                 self,
                                 'menu',
                                 'main',
                                 named=True))
     keyboard = form_keyboard(*buttons)
     return keyboard
Ejemplo n.º 9
0
 def menu_keyboard(self):
     buttons = list()
     buttons.append(
         keyboards.DungeonButton('Инвентарь',
                                 self,
                                 'menu',
                                 'inventory',
                                 named=True))
     buttons.append(
         keyboards.DungeonButton('На карту',
                                 self,
                                 'menu',
                                 'map',
                                 named=True))
     buttons.append(
         keyboards.DungeonButton('Покинуть карту',
                                 self,
                                 'menu',
                                 'leave',
                                 named=True))
     if len(self.dungeon.party.members) > 1:
         buttons.append(
             keyboards.DungeonButton('Обмен',
                                     self,
                                     'menu',
                                     'give',
                                     named=True))
     for button in self.dungeon.party.current_location.buttons(self):
         buttons.append(
             keyboards.DungeonButton(button['name'],
                                     self,
                                     'location',
                                     button['act'],
                                     named=True))
     keyboard = form_keyboard(*buttons)
     return keyboard