def do_status(self, string): self.load_players() players_table = printing.table( ["Player", "AC", "Spell save", "Perception"]) for entity in self.active_entities: if entity.startswith("players/"): player = self.active_entities[entity] players_table.add_row( [player["name"], player["ac"], player["spell_save"], player["perception"]]) status_table = printing.table( ["key", "Name", "HP", "AC", "Attack", "Damage", "Initiative"]) for npc in self.active_entities["encounter"]: status_table.add_row( [npc["key"], npc["name"], npc["hp"], npc["ac"], npc["attack"], npc["damage"], npc["initiative"]]) print players_table print status_table
def generate_table(messages, quest_type): if quest_type == "boss": dmgDict = questutils.damage_dict(messages) table = printing.table(['User', 'Damage given', 'Damage taken', 'Attacks', 'K/D ratio']) for key, value in dmgDict.iteritems(): table.add_row([key, "{:.1f}".format(value["damageGiven"]), "{:.1f}".format(value["damageTaken"]), "{:.0f}".format(value["nrAttacks"]), "{:.1f}".format(value["kd"])]) elif quest_type == "collect": table = "Summary table not yet implemented for collect quests." else: table = "Error: Summary table not yet implemented for this type of " \ "quest. Are you sure you're in a quest?" return table
def print_status(party_info): members = party_info["members"] # Print names, health and XP of party members. print printing.title("Party Status", 1) party_table = printing.table(["Name", "Level", "HP/Max HP", "XP/Max XP"]) for member in members: name = member["profile"]["name"] lvl = member["stats"]["lvl"] exp = member["stats"]["exp"] max_exp = round((0.25*lvl**2 + 10*lvl + 139.75)/10)*10 hp = member["stats"]["hp"] party_table.add_row([name, lvl, str(int(round(hp))).rjust(2) + '/' + str(max_health) + ' ' + printing.progress_bar(hp, max_health, health_bar_width), str(int(round(exp))).rjust(4) + '/' + str(int(max_exp)).ljust(4) + ' ' + printing.progress_bar(exp, max_exp, exp_bar_width)]) print party_table