def attack_monster(self, damage, chat_id): monster = Monster.get(Monster.hp != None) chat = Chats.get(Chats.chat_id == chat_id) monster.hp-=damage chat.total_dmg += damage rem_hp = monster.hp monster.save() chat.save() return rem_hp
def get_dmg(self, chat_id): chat = Chats.get(Chats.chat_id==chat_id) return chat.total_dmg
def set_stats_id(self, chat_id, stats_id, time_stats=time.time()): chat = Chats.get(Chats.chat_id==chat_id) chat.stat_message_id = stats_id chat.time_stat_message = time_stats chat.save()
def set_kill_id(self, chat_id, kill_id, time_kill=time.time()): chat = Chats.get(Chats.chat_id==chat_id) chat.kill_message_id = kill_id chat.time_kill_message = time_kill chat.save()
def get_stats_id(self, chat_id): chat = Chats.get(Chats.chat_id==chat_id) return chat.stat_message_id, chat.time_stat_message
def get_kill_id(self, chat_id): chat = Chats.get(Chats.chat_id==chat_id) return chat.kill_message_id, chat.time_kill_message