Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
MinoMino committed Jan 26, 2016
2 parents 8097beb + 000f4ef commit a35c6aa
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
6 changes: 4 additions & 2 deletions balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,16 @@ 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.
del players[sid]

# 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.
Expand Down Expand Up @@ -431,7 +433,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])
Expand Down
8 changes: 6 additions & 2 deletions ban.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -393,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.")
24 changes: 24 additions & 0 deletions fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@
_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_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
Expand Down Expand Up @@ -136,6 +144,22 @@ 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_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:
Expand Down

0 comments on commit a35c6aa

Please sign in to comment.