Ejemplo n.º 1
0
def print_achievements(messages, quest_type):
    achmts = get_achievements(messages, quest_type)
    string = printing.title("Achievements", 2) + '\n'
    for achmt in achmts:
        string += repr(achmt) + '  \n'
        if achmt.get_quotation():
            q, name = achmt.get_quotation()
            string += '\t    "' + q + '" - ' + name + '  \n'
    print string
Ejemplo n.º 2
0
def print_progress(habitica_content, party_info):
    if "quest" in party_info and party_info["quest"]:
        # Print status e.g. current boss and its health.
        print printing.title("Quest Status", 2)
        quest_key = party_info["quest"]["key"]
        quest_info = habitica_content["quests"][quest_key]
        if party_info["quest"]["active"]:
            if "boss" in quest_info:
                boss_hp = party_info["quest"]["progress"]["hp"]
                boss_max_hp = quest_info["boss"]["hp"]
                boss_name = quest_info["boss"]["name"]
                print 'Boss: {}'.format(boss_name)
                sys.stdout.write('{}/{} '.format(int(round(boss_hp)), boss_max_hp))
                sys.stdout.write(printing.progress_bar(boss_hp, boss_max_hp, boss_health_bar_width))
                sys.stdout.write('\n\n')
            elif "collect" in quest_info:
                print "Collecting items..."
        else:
            print "Waiting for members.\n"
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
def print_table(messages, quest_type):
    string = printing.title("Quest Summary", 1) + '\n'
    string += repr(generate_table(messages, quest_type)) + '\n\n'
    print string