def __init__(self, x, y, dungeon, map_tuple): self.state = 'entrance' self.table_row = 'locations_' + self.name self.visited = False self.current = False self.seen = False self.action_expected = False self.coordinates = (x, y) self.x = x self.y = y self.dungeon = dungeon self.special = '0' self.mobs = None self.mob_team = None self.mob_image = None self.receipts = engine.ChatContainer() if map_tuple is not None: self.complexity = map_tuple.complexity self.emote = self.get_emote() self.get_mobs() self.loot = engine.ChatContainer() self.cleared_emote = ' ' self.entrance_location = None self.cleared = False self.create_images()
def use_item(self, item): container = engine.ChatContainer() container.from_json(self.used_armory) print(item) container.put(item) print(self.used_armory) self.used_armory = container.to_json() session.commit()
def add_receipt(self, receipt): container = engine.ChatContainer() container.from_json(self.receipts) if isinstance(receipt, engine.ChatContainer) or isinstance(receipt, engine.Container): container += receipt else: container.put(receipt) self.receipts = container.to_json() session.commit()
def __init__(self, player_dict, chat_id, dungeon_id): # Текущая локация self.current_location = None self.id = chat_id # Чат, куда будет посылаться информация по игре self.dungeon = dynamic_dicts.dungeons[dungeon_id] self.members = [ Member(key, value['unit_dict'], dungeon=dynamic_dicts.dungeons[dungeon_id]) for key, value in player_dict.items() ] self.leader = self.members[0] self.member_dict = {member.chat_id: member for member in self.members} self.experience = 0 self.collected_receipts = engine.ChatContainer() self.time = 0
def show_chat_stats(self, lang): receipts = self.get_receipts() message = '' for key in receipts: name = standart_actions.get_name(key, 'rus') if receipts[key] == 'inf': value = 'Много' else: value = str(receipts[key]) message += name + ' - ' + value + '\n' used_items = engine.ChatContainer(base_dict=self.get_free_armory()) lang_tuple = LangTuple('chatmanagement', 'chat_stats', format_dict={ 'resources': str(self.resources), 'items': used_items.to_string(lang, marked=True, emoted=True) }) self.send_message(lang_tuple.translate(lang))
def get_menu_string(self): return 'Арсенал чата {}:\n' \ '{}'.format(self.chat.name, engine.ChatContainer(self.chat.get_armory()).to_string('rus'))
def print_items(self): used_items = engine.ChatContainer(base_dict=self.get_free_armory()) string = 'Свободные предметы:' string += used_items.to_string('rus', marked=True, emoted=True) self.send_message(string)
def delete_receipt(self, receipt): container = engine.ChatContainer() container.from_json(self.receipts) container.remove(receipt) self.receipts = container.to_json() session.commit()
def delete_used_item(self, item, value=1): container = engine.ChatContainer() container.from_json(self.used_armory) container.remove(item, value=value) self.used_armory = container.to_json() session.commit()
def add_item(self, item, value=1): container = engine.ChatContainer() container.from_json(self.armory) container.put(item, value=value) self.armory = container.to_json() session.commit()