From c365474cc612f8afd10f6056cac0334608bd5109 Mon Sep 17 00:00:00 2001 From: Mino Date: Tue, 19 Jan 2016 20:26:28 +0100 Subject: [PATCH 1/6] ban: Fixed a bug where !forgive on a player with no leaves results in an exception being thrown. --- ban.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ban.py b/ban.py index a281707..e8bba46 100644 --- a/ban.py +++ b/ban.py @@ -311,7 +311,11 @@ def cmd_forgive(self, player, msg, channel): channel.reply("I do not know ^6{}^7.".format(name)) return - leaves = int(self.db[base_key + ":games_left"]) + try: + leaves = int(self.db[base_key + ":games_left"]) + except KeyError: + leaves = 0 + if leaves <= 0: channel.reply("^6{}^7's leaves are already at ^6{}^7.".format(name, leaves)) return From 1cd04b6b5b23e42d484aaff85960faa888f94839 Mon Sep 17 00:00:00 2001 From: Thomas Jones Date: Wed, 20 Jan 2016 19:12:17 +1000 Subject: [PATCH 2/6] improve wording of !a request --- balance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/balance.py b/balance.py index 3da4de5..46a42dc 100644 --- a/balance.py +++ b/balance.py @@ -431,7 +431,7 @@ def callback_teams(self, players, channel): minimum_suggestion_diff = self.get_cvar("qlx_balanceMinimumSuggestionDiff", int) if switch and switch[1] >= minimum_suggestion_diff: - channel.reply("SUGGESTION: switch ^6{}^7 with ^6{}^7. Type !a to agree." + channel.reply("SUGGESTION: switch ^6{}^7 with ^6{}^7. Mentioned players can type !a to agree." .format(switch[0][0].clean_name, switch[0][1].clean_name)) if not self.suggested_pair or self.suggested_pair[0] != switch[0][0] or self.suggested_pair[1] != switch[0][1]: self.suggested_pair = (switch[0][0], switch[0][1]) From e721135ad371de9134c7d6dd67b4ff8f4f602894 Mon Sep 17 00:00:00 2001 From: JohnnyDenver Date: Mon, 25 Jan 2016 02:24:20 -0500 Subject: [PATCH 3/6] Update fun.py More fun :) --- fun.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/fun.py b/fun.py index d176eea..78a5422 100644 --- a/fun.py +++ b/fun.py @@ -53,6 +53,15 @@ _re_quakelive = re.compile(r"^(?:ql|quake live)\W?$", flags=re.IGNORECASE) _re_chaching = re.compile(r"(?:\$|€|£)\d+", flags=re.IGNORECASE) _re_uh_ah = re.compile(r"^uh ah$", flags=re.IGNORECASE) +_re_oohwee = re.compile(r"^ooh+wee\W?$", flags=re.IGNORECASE) +_re_erah = re.compile(r"^erah\W?$", flags=re.IGNORECASE) +_re_yeahhh = re.compile(r"^yeahhh\W?$", flags=re.IGNORECASE) +_re_scream = re.compile(r"^scream\W?$", flags=re.IGNORECASE) +_re_demon_scream = re.compile(r"^demon scream\W?$", flags=re.IGNORECASE) +_re_salute = re.compile(r"^salute\W?$", flags=re.IGNORECASE) +_re_squish = re.compile(r"^squish\W?$", flags=re.IGNORECASE) +_re_oh_god = re.compile(r"^oh god\W?$", flags=re.IGNORECASE) +_re_snarl = re.compile(r"^snarl\W?$", flags=re.IGNORECASE) class fun(minqlx.Plugin): database = Redis @@ -136,6 +145,24 @@ def handle_chat(self, player, msg, channel): self.play_sound("sound/misc/chaching") elif _re_uh_ah.match(msg): self.play_sound("sound/player/mynx/taunt.wav") + elif _re_oohwee.match(msg): + self.play_sound("sound/player/anarki/taunt.wav") + elif _re_erah.match(msg): + self.play_sound("sound/player/bitterman/taunt.wav") + elif _re_yeahhh.match(msg): + self.play_sound("sound/player/major/taunt.wav") + elif _re_scream.match(msg): + self.play_sound("sound/player/bones/taunt.wav") + elif _re_demon_scream.match(msg): + self.play_sound("sound/player/klesk/taunt.wav") + elif _re_salute.match(msg): + self.play_sound("sound/player/sarge/taunt.wav") + elif _re_squish.match(msg): + self.play_sound("sound/player/orb/taunt.wav") + elif _re_oh_god.match(msg): + self.play_sound("sound/player/ranger/taunt.wav") + elif _re_snarl.match(msg): + self.play_sound("sound/player/sorlag/taunt.wav") def play_sound(self, path): if not self.last_sound: From f1dbad6e9c1b83c6b23b049d6ee2775aa72a9126 Mon Sep 17 00:00:00 2001 From: Mino Date: Mon, 25 Jan 2016 13:12:11 +0100 Subject: [PATCH 4/6] fun: Removed Klesk's taunt. --- fun.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/fun.py b/fun.py index 78a5422..2485a00 100644 --- a/fun.py +++ b/fun.py @@ -57,7 +57,6 @@ _re_erah = re.compile(r"^erah\W?$", flags=re.IGNORECASE) _re_yeahhh = re.compile(r"^yeahhh\W?$", flags=re.IGNORECASE) _re_scream = re.compile(r"^scream\W?$", flags=re.IGNORECASE) -_re_demon_scream = re.compile(r"^demon scream\W?$", flags=re.IGNORECASE) _re_salute = re.compile(r"^salute\W?$", flags=re.IGNORECASE) _re_squish = re.compile(r"^squish\W?$", flags=re.IGNORECASE) _re_oh_god = re.compile(r"^oh god\W?$", flags=re.IGNORECASE) @@ -153,8 +152,6 @@ def handle_chat(self, player, msg, channel): self.play_sound("sound/player/major/taunt.wav") elif _re_scream.match(msg): self.play_sound("sound/player/bones/taunt.wav") - elif _re_demon_scream.match(msg): - self.play_sound("sound/player/klesk/taunt.wav") elif _re_salute.match(msg): self.play_sound("sound/player/sarge/taunt.wav") elif _re_squish.match(msg): From b0087d18d567f41ada43c47450bc1954cb77f41f Mon Sep 17 00:00:00 2001 From: Mino Date: Mon, 25 Jan 2016 16:46:58 +0100 Subject: [PATCH 5/6] ban: Fixed a small bug in the warning a player gets on connect for leaving games. --- ban.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ban.py b/ban.py index e8bba46..85463ba 100644 --- a/ban.py +++ b/ban.py @@ -397,5 +397,5 @@ def leave_status(self, steam_id): return action, ratio def warn_player(self, player, ratio): - player.tell("^7You have only completed ^6{}^7 percent of your games.".format(round(ratio * 100, 1))) + player.tell("^7You have only completed ^6{}^7 percent of your games.".format(round((completed / total) * 100, 1))) player.tell("^7If you keep leaving you ^6will^7 be banned.") From 000f4ef52bcbe3dd18a61b2e2a7b4d80263dc424 Mon Sep 17 00:00:00 2001 From: Mino Date: Mon, 25 Jan 2016 20:28:38 +0100 Subject: [PATCH 6/6] balance: Reverted ef91605ea503e3eb5d1684552b1ff7a795c2e149 because it wasn't really doing anything. Implemented it properly this time. --- balance.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/balance.py b/balance.py index 46a42dc..fb5372c 100644 --- a/balance.py +++ b/balance.py @@ -149,6 +149,8 @@ def fetch_ratings(self, players, request_id): p[gt]["time"] = t p[gt]["local"] = False self.ratings[sid][gt] = p[gt] + if self.ratings[sid][gt]["elo"] == 0 and self.ratings[sid][gt]["games"] == 0: + self.ratings[sid][gt]["elo"] = DEFAULT_RATING if sid in players and gt == players[sid]: # The API gave us the game type we wanted, so we remove it. @@ -156,7 +158,7 @@ def fetch_ratings(self, players, request_id): # Fill the rest of the game types the API didn't return but supports. for gt in SUPPORTED_GAMETYPES: - if gt not in self.ratings[sid] or (gt in self.ratings[sid] and self.ratings[sid][gt] == 0): + if gt not in self.ratings[sid]: self.ratings[sid][gt] = {"games": -1, "elo": DEFAULT_RATING, "local": False, "time": time.time()} # If the API didn't return all the players, we set them to the default rating.