From 4dfd8d63bf2346c076b26580572def66487d9e90 Mon Sep 17 00:00:00 2001 From: russelg Date: Wed, 20 Jul 2016 21:20:23 +0800 Subject: [PATCH] .ADD. .BANCHO. Add mania pp to !last --- constants/fokabotCommands.py | 21 +++++++++++---------- constants/gameModes.py | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/constants/fokabotCommands.py b/constants/fokabotCommands.py index f6addc9..853bcfe 100644 --- a/constants/fokabotCommands.py +++ b/constants/fokabotCommands.py @@ -543,15 +543,20 @@ def tillerinoLast(fro, chan, message): data["300_count"], data["100_count"], data["50_count"], data["misses_count"]) ifPlayer = "{0} | ".format(fro) if chan != "FokaBot" else "" + ifFc = " (FC)" if data["max_combo"] == data["fc"] else " {0}x/{1}x".format(data["max_combo"], data["fc"]) beatmapLink = "[http://osu.ppy.sh/b/{1} {0}]".format(data["sn"], data["bid"]) - ifFc = " (FC)" if data["max_combo"] == data["fc"] else " {0}x/{1}x".format(data["max_combo"], data["fc"]) + hasPP = data["play_mode"] == gameModes.std or data["play_mode"] == gameModes.mania + msg = ifPlayer + msg += beatmapLink if data["play_mode"] != gameModes.std: - msg = ifPlayer - msg += beatmapLink - if data["mods"]: - msg += ' +' + generalFunctions.readableMods(data["mods"]) + msg += " <{0}>".format(gameModes.getGameModeForPrinting(data["play_mode"])) + + if data["mods"]: + msg += ' +' + generalFunctions.readableMods(data["mods"]) + + if not hasPP: msg += " | {0:,}".format(data["score"]) msg += ifFc msg += " | {0:.2f}%, {1}".format(data["accuracy"], rank.upper()) @@ -559,16 +564,12 @@ def tillerinoLast(fro, chan, message): msg += " | {0:.2f} stars".format(data[diffString]) return msg - msg = ifPlayer - msg += beatmapLink - if data["mods"]: - msg += ' +' + generalFunctions.readableMods(data["mods"]) msg += " ({0:.2f}%, {1})".format(data["accuracy"], rank.upper()) msg += ifFc msg += " | {0:.2f}pp".format(data["pp"]) stars = data[diffString] - if data["mods"] and data["play_mode"] == gameModes.std: + if data["mods"]: token = glob.tokens.getTokenFromUsername(fro) if token == None: return False diff --git a/constants/gameModes.py b/constants/gameModes.py index 8716996..0b78ffb 100644 --- a/constants/gameModes.py +++ b/constants/gameModes.py @@ -21,3 +21,21 @@ def getGameModeForDB(gameMode): return "ctb" else: return "mania" + +def getGameModeForPrinting(gameMode): + """ + Convert a gamemode number to string for showing to a user (e.g. !last) + + gameMode -- gameMode int or variable (ex: gameMode.std) + + return -- game mode readable string for a human + """ + + if gameMode == std: + return "osu!" + elif gameMode == taiko: + return "Taiko" + elif gameMode == ctb: + return "CatchTheBeat" + else: + return "osu!mania" \ No newline at end of file