From 17cb66870a8df27dd18e2cf67c8a9d7f55ddc50a Mon Sep 17 00:00:00 2001 From: alwayscompiling Date: Sun, 26 Jun 2022 17:10:39 -0400 Subject: [PATCH] Create format boss highscore function. --- utils/message_formatter.py | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 utils/message_formatter.py diff --git a/utils/message_formatter.py b/utils/message_formatter.py new file mode 100644 index 0000000..76cfdf1 --- /dev/null +++ b/utils/message_formatter.py @@ -0,0 +1,42 @@ +""" +Contains various function to format the highscore messages +""" + +import highscores # pylint: disable=import-error + + +def format_boss_highscore(boss): + """ + returns a formattedd string for a boss's highscore + @param the dictionary object for the boss + @return the formatted string + """ + boss_name = boss["boss"] + ret_string = f"**{boss_name}**/n" + + # Gather all categories and add to string + for category in highscores.highscores_config["categories"]: + category_name = category["category"] + ret_string += f"{category_name}\t\t" + + highscore_size = highscores.highscores_config["highscore_size"] + + # list rankings + for x in range(highscore_size): + for category in highscores.highscores_config["categories"]: + ret_string += f"{x}: (name here)\t\t" + ret_string += "\n" + + # if boss is hardmode, repeat above for hardmode applicable categories + if boss["hardmode"]: + for category in highscores.highscores_config["categories"]: + if category["hardmode"]: + category_name = category["category"] + ret_string += f"{category_name}\t\t" + + ret_string += "\n" + + for x in range(highscore_size): + for category in highscores.highscores_config["categories"]: + ret_string += f"{x}: (name here)\t\t" + ret_string += "\n"